diff --git a/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestDistCpViewFs.java b/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestDistCpViewFs.java index a6939a2452..5511e094ce 100644 --- a/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestDistCpViewFs.java +++ b/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestDistCpViewFs.java @@ -73,13 +73,12 @@ public static void setup() throws URISyntaxException{ } @Test - public void testSingleFileMissingTarget() { + public void testSingleFileMissingTarget() throws IOException { caseSingleFileMissingTarget(false); caseSingleFileMissingTarget(true); } - - private void caseSingleFileMissingTarget(boolean sync) { + private void caseSingleFileMissingTarget(boolean sync) throws IOException{ try { addEntries(listFile, "singlefile1/file1"); @@ -88,21 +87,18 @@ private void caseSingleFileMissingTarget(boolean sync) { runTest(listFile, target, false, sync); checkResult(target, 1); - } catch (IOException e) { - LOG.error("Exception encountered while testing distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); } } @Test - public void testSingleFileTargetFile() { + public void testSingleFileTargetFile() throws IOException{ caseSingleFileTargetFile(false); caseSingleFileTargetFile(true); } - private void caseSingleFileTargetFile(boolean sync) { + private void caseSingleFileTargetFile(boolean sync) throws IOException { try { addEntries(listFile, "singlefile1/file1"); @@ -111,21 +107,18 @@ private void caseSingleFileTargetFile(boolean sync) { runTest(listFile, target, false, sync); checkResult(target, 1); - } catch (IOException e) { - LOG.error("Exception encountered while testing distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); } } @Test - public void testSingleFileTargetDir() { + public void testSingleFileTargetDir() throws IOException { caseSingleFileTargetDir(false); caseSingleFileTargetDir(true); } - private void caseSingleFileTargetDir(boolean sync) { + private void caseSingleFileTargetDir(boolean sync) throws IOException { try { addEntries(listFile, "singlefile2/file2"); @@ -135,21 +128,18 @@ private void caseSingleFileTargetDir(boolean sync) { runTest(listFile, target, true, sync); checkResult(target, 1, "file2"); - } catch (IOException e) { - LOG.error("Exception encountered while testing distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); } } @Test - public void testSingleDirTargetMissing() { + public void testSingleDirTargetMissing() throws IOException{ caseSingleDirTargetMissing(false); caseSingleDirTargetMissing(true); } - private void caseSingleDirTargetMissing(boolean sync) { + private void caseSingleDirTargetMissing(boolean sync) throws IOException { try { addEntries(listFile, "singledir"); @@ -158,16 +148,13 @@ private void caseSingleDirTargetMissing(boolean sync) { runTest(listFile, target, false, sync); checkResult(target, 1, "dir1"); - } catch (IOException e) { - LOG.error("Exception encountered while testing distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); } } @Test - public void testSingleDirTargetPresent() { + public void testSingleDirTargetPresent() throws IOException{ try { addEntries(listFile, "singledir"); @@ -177,16 +164,13 @@ public void testSingleDirTargetPresent() { runTest(listFile, target, true, false); checkResult(target, 1, "singledir/dir1"); - } catch (IOException e) { - LOG.error("Exception encountered while testing distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); } } @Test - public void testUpdateSingleDirTargetPresent() { + public void testUpdateSingleDirTargetPresent() throws IOException { try { addEntries(listFile, "Usingledir"); @@ -196,21 +180,18 @@ public void testUpdateSingleDirTargetPresent() { runTest(listFile, target, true, true); checkResult(target, 1, "Udir1"); - } catch (IOException e) { - LOG.error("Exception encountered while testing distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); } } @Test - public void testMultiFileTargetPresent() { + public void testMultiFileTargetPresent() throws IOException { caseMultiFileTargetPresent(false); caseMultiFileTargetPresent(true); } - private void caseMultiFileTargetPresent(boolean sync) { + private void caseMultiFileTargetPresent(boolean sync) throws IOException { try { addEntries(listFile, "multifile/file3", "multifile/file4", "multifile/file5"); @@ -220,21 +201,18 @@ private void caseMultiFileTargetPresent(boolean sync) { runTest(listFile, target, true, sync); checkResult(target, 3, "file3", "file4", "file5"); - } catch (IOException e) { - LOG.error("Exception encountered while testing distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); } } @Test - public void testMultiFileTargetMissing() { + public void testMultiFileTargetMissing() throws IOException { caseMultiFileTargetMissing(false); caseMultiFileTargetMissing(true); } - private void caseMultiFileTargetMissing(boolean sync) { + private void caseMultiFileTargetMissing(boolean sync) throws IOException { try { addEntries(listFile, "multifile/file3", "multifile/file4", "multifile/file5"); @@ -243,16 +221,13 @@ private void caseMultiFileTargetMissing(boolean sync) { runTest(listFile, target, false, sync); checkResult(target, 3, "file3", "file4", "file5"); - } catch (IOException e) { - LOG.error("Exception encountered while testing distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); } } @Test - public void testMultiDirTargetPresent() { + public void testMultiDirTargetPresent() throws IOException { try { addEntries(listFile, "multifile", "singledir"); @@ -262,16 +237,13 @@ public void testMultiDirTargetPresent() { runTest(listFile, target, true, false); checkResult(target, 2, "multifile/file3", "multifile/file4", "multifile/file5", "singledir/dir1"); - } catch (IOException e) { - LOG.error("Exception encountered while testing distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); } } @Test - public void testUpdateMultiDirTargetPresent() { + public void testUpdateMultiDirTargetPresent() throws IOException { try { addEntries(listFile, "Umultifile", "Usingledir"); @@ -281,16 +253,13 @@ public void testUpdateMultiDirTargetPresent() { runTest(listFile, target, true, true); checkResult(target, 4, "Ufile3", "Ufile4", "Ufile5", "Udir1"); - } catch (IOException e) { - LOG.error("Exception encountered while testing distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); } } @Test - public void testMultiDirTargetMissing() { + public void testMultiDirTargetMissing() throws IOException { try { addEntries(listFile, "multifile", "singledir"); @@ -301,16 +270,13 @@ public void testMultiDirTargetMissing() { checkResult(target, 2, "multifile/file3", "multifile/file4", "multifile/file5", "singledir/dir1"); - } catch (IOException e) { - LOG.error("Exception encountered while testing distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); } } @Test - public void testUpdateMultiDirTargetMissing() { + public void testUpdateMultiDirTargetMissing() throws IOException { try { addEntries(listFile, "multifile", "singledir"); @@ -320,16 +286,13 @@ public void testUpdateMultiDirTargetMissing() { runTest(listFile, target, false, true); checkResult(target, 4, "file3", "file4", "file5", "dir1"); - } catch (IOException e) { - LOG.error("Exception encountered while testing distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); } } @Test - public void testGlobTargetMissingSingleLevel() { + public void testGlobTargetMissingSingleLevel() throws IOException { try { Path listFile = new Path("target/tmp1/listing").makeQualified(fs.getUri(), @@ -342,9 +305,6 @@ public void testGlobTargetMissingSingleLevel() { checkResult(target, 2, "multifile/file3", "multifile/file4", "multifile/file5", "singledir/dir2/file6"); - } catch (IOException e) { - LOG.error("Exception encountered while testing distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); TestDistCpUtils.delete(fs, "target/tmp1"); @@ -352,7 +312,7 @@ public void testGlobTargetMissingSingleLevel() { } @Test - public void testUpdateGlobTargetMissingSingleLevel() { + public void testUpdateGlobTargetMissingSingleLevel() throws IOException { try { Path listFile = new Path("target/tmp1/listing").makeQualified(fs.getUri(), @@ -364,9 +324,6 @@ public void testUpdateGlobTargetMissingSingleLevel() { runTest(listFile, target, false, true); checkResult(target, 4, "file3", "file4", "file5", "dir2/file6"); - } catch (IOException e) { - LOG.error("Exception encountered while running distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); TestDistCpUtils.delete(fs, "target/tmp1"); @@ -374,7 +331,7 @@ public void testUpdateGlobTargetMissingSingleLevel() { } @Test - public void testGlobTargetMissingMultiLevel() { + public void testGlobTargetMissingMultiLevel() throws IOException { try { Path listFile = new Path("target/tmp1/listing").makeQualified(fs.getUri(), @@ -388,9 +345,6 @@ public void testGlobTargetMissingMultiLevel() { checkResult(target, 4, "file3", "file4", "file5", "dir3/file7", "dir3/file8", "dir3/file9"); - } catch (IOException e) { - LOG.error("Exception encountered while running distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); TestDistCpUtils.delete(fs, "target/tmp1"); @@ -398,7 +352,7 @@ public void testGlobTargetMissingMultiLevel() { } @Test - public void testUpdateGlobTargetMissingMultiLevel() { + public void testUpdateGlobTargetMissingMultiLevel() throws IOException { try { Path listFile = new Path("target/tmp1/listing").makeQualified(fs.getUri(), @@ -412,9 +366,6 @@ public void testUpdateGlobTargetMissingMultiLevel() { checkResult(target, 6, "file3", "file4", "file5", "file7", "file8", "file9"); - } catch (IOException e) { - LOG.error("Exception encountered while running distcp", e); - Assert.fail("distcp failure"); } finally { TestDistCpUtils.delete(fs, root); TestDistCpUtils.delete(fs, "target/tmp1");