|
@@ -1625,22 +1625,15 @@ public class TestCombineFileInputFormat {
|
|
|
*/
|
|
|
@Test
|
|
|
public void testMissingBlocks() throws Exception {
|
|
|
- String namenode = null;
|
|
|
- MiniDFSCluster dfs = null;
|
|
|
- FileSystem fileSys = null;
|
|
|
- String testName = "testMissingBlocks";
|
|
|
- try {
|
|
|
- Configuration conf = new Configuration();
|
|
|
- conf.set("fs.hdfs.impl", MissingBlockFileSystem.class.getName());
|
|
|
- conf.setBoolean("dfs.replication.considerLoad", false);
|
|
|
- dfs = new MiniDFSCluster.Builder(conf).racks(rack1).hosts(hosts1)
|
|
|
- .build();
|
|
|
+ final Configuration conf = new Configuration();
|
|
|
+ conf.set("fs.hdfs.impl", MissingBlockFileSystem.class.getName());
|
|
|
+ conf.setBoolean("dfs.replication.considerLoad", false);
|
|
|
+ try (MiniDFSCluster dfs = new MiniDFSCluster.Builder(conf)
|
|
|
+ .racks(rack1).hosts(hosts1).build()) {
|
|
|
dfs.waitActive();
|
|
|
|
|
|
- namenode = (dfs.getFileSystem()).getUri().getHost() + ":" +
|
|
|
- (dfs.getFileSystem()).getUri().getPort();
|
|
|
-
|
|
|
- fileSys = dfs.getFileSystem();
|
|
|
+ final FileSystem fileSys =
|
|
|
+ MissingBlockFileSystem.newInstance(dfs.getURI(), conf);
|
|
|
if (!fileSys.mkdirs(inDir)) {
|
|
|
throw new IOException("Mkdirs failed to create " + inDir.toString());
|
|
|
}
|
|
@@ -1672,11 +1665,6 @@ public class TestCombineFileInputFormat {
|
|
|
assertEquals(0, fileSplit.getOffset(1));
|
|
|
assertEquals(BLOCKSIZE, fileSplit.getLength(1));
|
|
|
assertEquals(hosts1[0], fileSplit.getLocations()[0]);
|
|
|
-
|
|
|
- } finally {
|
|
|
- if (dfs != null) {
|
|
|
- dfs.shutdown();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|