| @@ -81,7 +81,7 @@ public class IncludeTest { | |||
| thrown.expect(BuildException.class); | |||
| thrown.expect(hasProperty("location", hasProperty("fileName", | |||
| containsString("build.xml")))); | |||
| buildRule.configureProject("src/etc/testcases/core/include/including_file_parse_error/build.xml"); | |||
| buildRule.configureProject("src/etc/testcases/core/include/including_file_parse_error/build.xml"); | |||
| } | |||
| @Test | |||
| @@ -255,7 +255,7 @@ public class IntrospectionHelperTest { | |||
| Map<String, Class<?>> elemMap = getExpectedNestedElements(); | |||
| for (String name : Collections.list(ih.getNestedElements())) { | |||
| Class<?> expect = elemMap.get(name); | |||
| assertNotNull("Support for " + name + " in IntrospectioNHelperTest?", | |||
| assertNotNull("Support for " + name + " in IntrospectionHelperTest?", | |||
| expect); | |||
| assertEquals("Return type of " + name, expect, ih.getElementType(name)); | |||
| elemMap.remove(name); | |||
| @@ -605,8 +605,7 @@ public class IntrospectionHelperTest { | |||
| @Test | |||
| public void testGetAttributeMap() { | |||
| Map<String, Class<?>> attrMap = getExpectedAttributes(); | |||
| Map<String, Class<?>> actualMap = ih.getAttributeMap(); | |||
| actualMap.forEach((attrName, value) -> { | |||
| ih.getAttributeMap().forEach((attrName, value) -> { | |||
| Class<?> attrClass = attrMap.get(attrName); | |||
| assertNotNull("Support for " + attrName + " in IntrospectionHelperTest?", attrClass); | |||
| assertEquals("Type of " + attrName, attrClass, value); | |||
| @@ -614,11 +613,14 @@ public class IntrospectionHelperTest { | |||
| }); | |||
| attrMap.remove("name"); | |||
| assertTrue("Found all", attrMap.isEmpty()); | |||
| } | |||
| @Test | |||
| public void testClearGetAttributeMap() { | |||
| thrown.expect(UnsupportedOperationException.class); | |||
| // TODO we should be asserting a value somewhere in here | |||
| // Check it's a read-only map. | |||
| actualMap.clear(); | |||
| ih.getAttributeMap().clear(); | |||
| } | |||
| @Test | |||
| @@ -659,8 +661,7 @@ public class IntrospectionHelperTest { | |||
| private void assertAttrMethod(String attrName, String methodName, | |||
| Class<?> methodArg, Object arg, Object badArg) { | |||
| Method m = ih.getAttributeMethod(attrName); | |||
| assertMethod(m, methodName, methodArg, arg, badArg); | |||
| assertMethod(ih.getAttributeMethod(attrName), methodName, methodArg, arg, badArg); | |||
| } | |||
| public int setTwo(String s) { | |||
| @@ -830,5 +831,4 @@ public class IntrospectionHelperTest { | |||
| return table; | |||
| } | |||
| } // IntrospectionHelperTest | |||
| } | |||
| @@ -56,6 +56,11 @@ public class CVSPassTest { | |||
| buildRule.configureProject("src/etc/testcases/taskdefs/cvspass.xml"); | |||
| } | |||
| @After | |||
| public void tearDown() { | |||
| buildRule.executeTarget("cleanup"); | |||
| } | |||
| @Test | |||
| public void testNoCVSRoot() { | |||
| thrown.expect(BuildException.class); | |||
| @@ -70,11 +75,6 @@ public class CVSPassTest { | |||
| buildRule.executeTarget("test2"); | |||
| } | |||
| @After | |||
| public void tearDown() { | |||
| buildRule.executeTarget("cleanup"); | |||
| } | |||
| @Test | |||
| public void testPassFile() throws Exception { | |||
| buildRule.executeTarget("test3"); | |||
| @@ -275,16 +275,4 @@ public class ConcatTest { | |||
| FileUtilities.getFileContents(f1), FileUtilities.getFileContents(f2)); | |||
| } | |||
| // ------------------------------------------------------ | |||
| // Helper methods - should be in a utility class | |||
| // ----------------------------------------------------- | |||
| @SuppressWarnings("unused") | |||
| private void expectFileContainsx(String target, String filename, String contains) | |||
| throws IOException { | |||
| buildRule.executeTarget(target); | |||
| String content = FileUtilities.getFileContents(buildRule.getProject(), filename); | |||
| assertThat("expecting file " + filename + " to contain " + contains + " but got " + content, | |||
| content, containsString(contains)); | |||
| } | |||
| } | |||
| @@ -79,17 +79,18 @@ public class CopyTest { | |||
| @Test | |||
| public void test3() { | |||
| buildRule.executeTarget("test3"); | |||
| File file3 = new File(buildRule.getProject().getProperty("output"), "copytest3.tmp"); | |||
| final String output = buildRule.getProject().getProperty("output"); | |||
| final File file3 = new File(output, "copytest3.tmp"); | |||
| // rollback file timestamp instead of delaying test | |||
| FileUtilities.rollbackTimestamps(file3, 3); | |||
| buildRule.executeTarget("test3Part2"); | |||
| assertTrue(file3.exists()); | |||
| File file3a = new File(buildRule.getProject().getProperty("output"), "copytest3a.tmp"); | |||
| File file3a = new File(output, "copytest3a.tmp"); | |||
| assertTrue(file3a.exists()); | |||
| File file3b = new File(buildRule.getProject().getProperty("output"), "copytest3b.tmp"); | |||
| File file3b = new File(output, "copytest3b.tmp"); | |||
| assertTrue(file3b.exists()); | |||
| File file3c = new File(buildRule.getProject().getProperty("output"), "copytest3c.tmp"); | |||
| File file3c = new File(output, "copytest3c.tmp"); | |||
| assertTrue(file3c.exists()); | |||
| // file length checks rely on touch generating a zero byte file | |||
| @@ -118,8 +119,9 @@ public class CopyTest { | |||
| @Test | |||
| public void testFilterSet() throws IOException { | |||
| buildRule.executeTarget("testFilterSet"); | |||
| File tmp = new File(buildRule.getProject().getProperty("output"), "copy.filterset.tmp"); | |||
| File check = new File(buildRule.getProject().getBaseDir(), "expected/copy.filterset.filtered"); | |||
| File tmp = new File(buildRule.getProject().getProperty("output"), "copy.filterset.tmp"); | |||
| File check = new File(buildRule.getProject().getBaseDir(), | |||
| "expected/copy.filterset.filtered"); | |||
| assertTrue(tmp.exists()); | |||
| assertEquals(FileUtilities.getFileContents(tmp), FileUtilities.getFileContents(check)); | |||
| } | |||
| @@ -127,8 +129,9 @@ public class CopyTest { | |||
| @Test | |||
| public void testFilterChain() throws IOException { | |||
| buildRule.executeTarget("testFilterChain"); | |||
| File tmp = new File(buildRule.getProject().getProperty("output"), "copy.filterchain.tmp"); | |||
| File check = new File(buildRule.getProject().getBaseDir(), "expected/copy.filterset.filtered"); | |||
| File tmp = new File(buildRule.getProject().getProperty("output"), "copy.filterchain.tmp"); | |||
| File check = new File(buildRule.getProject().getBaseDir(), | |||
| "expected/copy.filterset.filtered"); | |||
| assertTrue(tmp.exists()); | |||
| assertEquals(FileUtilities.getFileContents(tmp), FileUtilities.getFileContents(check)); | |||
| } | |||
| @@ -186,24 +189,20 @@ public class CopyTest { | |||
| @Test | |||
| public void testFileResourcePlain() { | |||
| buildRule.executeTarget("testFileResourcePlain"); | |||
| File file1 = new File(buildRule.getProject().getProperty("to.dir") + "/file1.txt"); | |||
| File file2 = new File(buildRule.getProject().getProperty("to.dir") + "/file2.txt"); | |||
| File file3 = new File(buildRule.getProject().getProperty("to.dir") + "/file3.txt"); | |||
| assertTrue(file1.exists()); | |||
| assertTrue(file2.exists()); | |||
| assertTrue(file3.exists()); | |||
| final String toDir = buildRule.getProject().getProperty("to.dir"); | |||
| assertTrue(new File(toDir + "/file1.txt").exists()); | |||
| assertTrue(new File(toDir + "/file2.txt").exists()); | |||
| assertTrue(new File(toDir + "/file3.txt").exists()); | |||
| } | |||
| @Ignore("Previously ignored by naming convention") | |||
| @Test | |||
| public void testFileResourceWithMapper() { | |||
| buildRule.executeTarget("testFileResourceWithMapper"); | |||
| File file1 = new File(buildRule.getProject().getProperty("to.dir") + "/file1.txt.bak"); | |||
| File file2 = new File(buildRule.getProject().getProperty("to.dir") + "/file2.txt.bak"); | |||
| File file3 = new File(buildRule.getProject().getProperty("to.dir") + "/file3.txt.bak"); | |||
| assertTrue(file1.exists()); | |||
| assertTrue(file2.exists()); | |||
| assertTrue(file3.exists()); | |||
| final String toDir = buildRule.getProject().getProperty("to.dir"); | |||
| assertTrue(new File(toDir + "/file1.txt.bak").exists()); | |||
| assertTrue(new File(toDir + "/file2.txt.bak").exists()); | |||
| assertTrue(new File(toDir + "/file3.txt.bak").exists()); | |||
| } | |||
| @Test | |||
| @@ -222,23 +221,19 @@ public class CopyTest { | |||
| @Test | |||
| public void testPathAsResource() { | |||
| buildRule.executeTarget("testPathAsResource"); | |||
| File file1 = new File(buildRule.getProject().getProperty("to.dir") + "/file1.txt"); | |||
| File file2 = new File(buildRule.getProject().getProperty("to.dir") + "/file2.txt"); | |||
| File file3 = new File(buildRule.getProject().getProperty("to.dir") + "/file3.txt"); | |||
| assertTrue(file1.exists()); | |||
| assertTrue(file2.exists()); | |||
| assertTrue(file3.exists()); | |||
| final String toDir = buildRule.getProject().getProperty("to.dir"); | |||
| assertTrue(new File(toDir + "/file1.txt").exists()); | |||
| assertTrue(new File(toDir + "/file2.txt").exists()); | |||
| assertTrue(new File(toDir + "/file3.txt").exists()); | |||
| } | |||
| @Test | |||
| public void testZipfileset() { | |||
| buildRule.executeTarget("testZipfileset"); | |||
| File file1 = new File(buildRule.getProject().getProperty("to.dir") + "/file1.txt"); | |||
| File file2 = new File(buildRule.getProject().getProperty("to.dir") + "/file2.txt"); | |||
| File file3 = new File(buildRule.getProject().getProperty("to.dir") + "/file3.txt"); | |||
| assertTrue(file1.exists()); | |||
| assertTrue(file2.exists()); | |||
| assertTrue(file3.exists()); | |||
| final String toDir = buildRule.getProject().getProperty("to.dir"); | |||
| assertTrue(new File(toDir + "/file1.txt").exists()); | |||
| assertTrue(new File(toDir + "/file2.txt").exists()); | |||
| assertTrue(new File(toDir + "/file3.txt").exists()); | |||
| } | |||
| @Test | |||
| @@ -69,7 +69,7 @@ public class DirnameTest { | |||
| @Test | |||
| public void test4() { | |||
| assumeFalse("Test not possible on DOS or Netware family OS", Os.isFamily("netware") || Os.isFamily("dos")); | |||
| assumeFalse("Skip on DOS or Netware", Os.isFamily("netware") || Os.isFamily("dos")); | |||
| buildRule.executeTarget("test4"); | |||
| assertEquals("dirname failed", File.separator + "usr" + File.separator + "local", | |||
| buildRule.getProject().getProperty("local.dir")); | |||
| @@ -75,7 +75,7 @@ public class FailTest { | |||
| public void testUnless() { | |||
| try { | |||
| buildRule.executeTarget("testUnless"); | |||
| //TODO assert rules | |||
| // TODO assert rules | |||
| } finally { | |||
| buildRule.getProject().setProperty("foo", ""); | |||
| buildRule.executeTarget("testUnless"); | |||
| @@ -67,7 +67,7 @@ public class JavaTest { | |||
| /** Utilities used for file operations */ | |||
| private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | |||
| private boolean runFatalTests=false; | |||
| private boolean runFatalTests = false; | |||
| /** | |||
| @@ -327,7 +327,8 @@ public class RmicAdvancedTest { | |||
| */ | |||
| @Test | |||
| public void testXnewForked() { | |||
| assumeFalse("Current system is Java 9 or newer", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| assumeFalse("Current system is Java 9 or newer", | |||
| JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| buildRule.executeTarget("testXnewForked"); | |||
| } | |||
| @@ -336,7 +337,8 @@ public class RmicAdvancedTest { | |||
| */ | |||
| @Test | |||
| public void testXnewForkedJava9plus() { | |||
| assumeTrue("Current system is Java 8 or older", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| assumeTrue("Current system is Java 8 or older", | |||
| JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| thrown.expect(BuildException.class); | |||
| thrown.expectMessage("JDK9 has removed support for -Xnew"); | |||
| buildRule.executeTarget("testXnewForked"); | |||
| @@ -347,7 +349,8 @@ public class RmicAdvancedTest { | |||
| */ | |||
| @Test | |||
| public void testXnewForkedDest() { | |||
| assumeFalse("Current system is Java 9 or newer", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| assumeFalse("Current system is Java 9 or newer", | |||
| JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| buildRule.executeTarget("testXnewForkedDest"); | |||
| } | |||
| @@ -356,7 +359,8 @@ public class RmicAdvancedTest { | |||
| */ | |||
| @Test | |||
| public void testXnewForkedDestJava9plus() { | |||
| assumeTrue("Current system is Java 8 or older", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| assumeTrue("Current system is Java 8 or older", | |||
| JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| thrown.expect(BuildException.class); | |||
| thrown.expectMessage("JDK9 has removed support for -Xnew"); | |||
| buildRule.executeTarget("testXnewForkedDest"); | |||
| @@ -367,7 +371,8 @@ public class RmicAdvancedTest { | |||
| */ | |||
| @Test | |||
| public void testXnewCompiler() { | |||
| assumeFalse("Current system is Java 9 or newer", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| assumeFalse("Current system is Java 9 or newer", | |||
| JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| buildRule.executeTarget("testXnewCompiler"); | |||
| } | |||
| @@ -376,7 +381,8 @@ public class RmicAdvancedTest { | |||
| */ | |||
| @Test | |||
| public void testXnewCompilerJava9plus() { | |||
| assumeTrue("Current system is Java 8 or older", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| assumeTrue("Current system is Java 8 or older", | |||
| JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| thrown.expect(BuildException.class); | |||
| thrown.expectMessage("JDK9 has removed support for -Xnew"); | |||
| buildRule.executeTarget("testXnewCompiler"); | |||
| @@ -387,7 +393,8 @@ public class RmicAdvancedTest { | |||
| */ | |||
| @Test | |||
| public void testXnewCompilerDest() { | |||
| assumeFalse("Current system is Java 9 or newer", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| assumeFalse("Current system is Java 9 or newer", | |||
| JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| buildRule.executeTarget("testXnewCompilerDest"); | |||
| } | |||
| @@ -396,7 +403,8 @@ public class RmicAdvancedTest { | |||
| */ | |||
| @Test | |||
| public void testXnewCompilerDestJava9plus() { | |||
| assumeTrue("Current system is Java 8 or older", JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| assumeTrue("Current system is Java 8 or older", | |||
| JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); | |||
| thrown.expect(BuildException.class); | |||
| thrown.expectMessage("JDK9 has removed support for -Xnew"); | |||
| buildRule.executeTarget("testXnewCompilerDest"); | |||
| @@ -65,8 +65,7 @@ public class SignJarTest { | |||
| sj.setAlias("testonly"); | |||
| sj.setKeystore("testkeystore"); | |||
| sj.setStorepass("apacheant"); | |||
| File jar = new File(buildRule.getProject().getProperty("test.jar")); | |||
| sj.setJar(jar); | |||
| sj.setJar(new File(buildRule.getProject().getProperty("test.jar"))); | |||
| assertFalse("mustn't find signature without sigfile attribute", | |||
| sj.isSigned()); | |||
| sj.setSigfile("TEST"); | |||
| @@ -81,8 +80,7 @@ public class SignJarTest { | |||
| sj.setAlias("test@nly"); | |||
| sj.setKeystore("testkeystore"); | |||
| sj.setStorepass("apacheant"); | |||
| File jar = new File(buildRule.getProject().getProperty("test.jar")); | |||
| sj.setJar(jar); | |||
| sj.setJar(new File(buildRule.getProject().getProperty("test.jar"))); | |||
| assertTrue(sj.isSigned()); | |||
| } | |||
| @@ -111,10 +111,10 @@ public class TarTest { | |||
| private void test7(String target) { | |||
| buildRule.executeTarget(target); | |||
| File f1 = new File(buildRule.getProject().getProperty("output"), "untar/test7-prefix"); | |||
| final String output = buildRule.getProject().getProperty("output"); | |||
| File f1 = new File(output, "untar/test7-prefix"); | |||
| assertTrue("The prefix attribute is not working properly.", f1.exists() && f1.isDirectory()); | |||
| File f2 = new File(buildRule.getProject().getProperty("output"), "untar/test7dir"); | |||
| File f2 = new File(output, "untar/test7dir"); | |||
| assertTrue("The prefix attribute is not working properly.", f2.exists() && f2.isDirectory()); | |||
| } | |||
| @@ -94,8 +94,7 @@ public class TouchTest { | |||
| public void testNow() { | |||
| long now = System.currentTimeMillis(); | |||
| buildRule.executeTarget("testNow"); | |||
| long time = getTargetTime(); | |||
| assertTimesNearlyMatch(time, now, 5000); | |||
| assertTimesNearlyMatch(getTargetTime(), now, 5000); | |||
| } | |||
| /** | |||
| @@ -103,10 +103,9 @@ public class UnzipTest { | |||
| @Test | |||
| public void testPatternSetExcludeOnly() { | |||
| buildRule.executeTarget("testPatternSetExcludeOnly"); | |||
| assertFileMissing("1/foo is excluded", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/1/foo"); | |||
| assertFileExists("2/bar is not excluded", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/2/bar"); | |||
| final String output = buildRule.getProject().getProperty("output"); | |||
| assertFileMissing("1/foo is excluded", output + "/unziptestout/1/foo"); | |||
| assertFileExists("2/bar is not excluded", output + "/unziptestout/2/bar"); | |||
| } | |||
| /* | |||
| @@ -115,10 +114,9 @@ public class UnzipTest { | |||
| @Test | |||
| public void testPatternSetIncludeOnly() { | |||
| buildRule.executeTarget("testPatternSetIncludeOnly"); | |||
| assertFileMissing("1/foo is not included", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/1/foo"); | |||
| assertFileExists("2/bar is included", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/2/bar"); | |||
| final String output = buildRule.getProject().getProperty("output"); | |||
| assertFileMissing("1/foo is not included", output + "/unziptestout/1/foo"); | |||
| assertFileExists("2/bar is included", output + "/unziptestout/2/bar"); | |||
| } | |||
| /* | |||
| @@ -127,10 +125,9 @@ public class UnzipTest { | |||
| @Test | |||
| public void testPatternSetIncludeAndExclude() { | |||
| buildRule.executeTarget("testPatternSetIncludeAndExclude"); | |||
| assertFileMissing("1/foo is not included", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/1/foo"); | |||
| assertFileMissing("2/bar is excluded", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/2/bar"); | |||
| final String output = buildRule.getProject().getProperty("output"); | |||
| assertFileMissing("1/foo is not included", output + "/unziptestout/1/foo"); | |||
| assertFileMissing("2/bar is excluded", output + "/unziptestout/2/bar"); | |||
| } | |||
| /* | |||
| @@ -139,10 +136,9 @@ public class UnzipTest { | |||
| @Test | |||
| public void testTwoPatternSets() { | |||
| buildRule.executeTarget("testTwoPatternSets"); | |||
| assertFileMissing("1/foo is not included", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/1/foo"); | |||
| assertFileExists("2/bar is included", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/2/bar"); | |||
| final String output = buildRule.getProject().getProperty("output"); | |||
| assertFileMissing("1/foo is not included", output + "/unziptestout/1/foo"); | |||
| assertFileExists("2/bar is included", output + "/unziptestout/2/bar"); | |||
| } | |||
| /* | |||
| @@ -151,10 +147,9 @@ public class UnzipTest { | |||
| @Test | |||
| public void testTwoPatternSetsWithExcludes() { | |||
| buildRule.executeTarget("testTwoPatternSetsWithExcludes"); | |||
| assertFileMissing("1/foo is not included", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/1/foo"); | |||
| assertFileMissing("2/bar is excluded", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/2/bar"); | |||
| final String output = buildRule.getProject().getProperty("output"); | |||
| assertFileMissing("1/foo is not included", output + "/unziptestout/1/foo"); | |||
| assertFileMissing("2/bar is excluded", output + "/unziptestout/2/bar"); | |||
| } | |||
| /* | |||
| @@ -174,10 +169,9 @@ public class UnzipTest { | |||
| @Test | |||
| public void testPatternSetSlashOnly() { | |||
| buildRule.executeTarget("testPatternSetSlashOnly"); | |||
| assertFileMissing("1/foo is not included", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/1/foo"); | |||
| assertFileExists("\"2/bar is included", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/2/bar"); | |||
| final String output = buildRule.getProject().getProperty("output"); | |||
| assertFileMissing("1/foo is not included", output + "/unziptestout/1/foo"); | |||
| assertFileExists("\"2/bar is included", output + "/unziptestout/2/bar"); | |||
| } | |||
| /* | |||
| @@ -196,10 +190,9 @@ public class UnzipTest { | |||
| @Test | |||
| public void testFlattenMapper() { | |||
| buildRule.executeTarget("testFlattenMapper"); | |||
| assertFileMissing("1/foo is not flattened", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/1/foo"); | |||
| assertFileExists("foo is flattened", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/foo"); | |||
| final String output = buildRule.getProject().getProperty("output"); | |||
| assertFileMissing("1/foo is not flattened", output + "/unziptestout/1/foo"); | |||
| assertFileExists("foo is flattened", output + "/unziptestout/foo"); | |||
| } | |||
| /** | |||
| @@ -227,10 +220,9 @@ public class UnzipTest { | |||
| @Test | |||
| public void testGlobMapper() { | |||
| buildRule.executeTarget("testGlobMapper"); | |||
| assertFileMissing("1/foo is not mapped", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/1/foo"); | |||
| assertFileExists("1/foo is mapped", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/1/foo.txt"); | |||
| final String output = buildRule.getProject().getProperty("output"); | |||
| assertFileMissing("1/foo is not mapped", output + "/unziptestout/1/foo"); | |||
| assertFileExists("1/foo is mapped", output + "/unziptestout/1/foo.txt"); | |||
| } | |||
| /** | |||
| @@ -252,9 +244,8 @@ public class UnzipTest { | |||
| @Test | |||
| public void testDocumentationClaimsOnCopy() { | |||
| buildRule.executeTarget("testDocumentationClaimsOnCopy"); | |||
| assertFileMissing("1/foo is excluded", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/1/foo"); | |||
| assertFileExists("2/bar is not excluded", | |||
| buildRule.getProject().getProperty("output") + "/unziptestout/2/bar"); | |||
| final String output = buildRule.getProject().getProperty("output"); | |||
| assertFileMissing("1/foo is excluded", output + "/unziptestout/1/foo"); | |||
| assertFileExists("2/bar is not excluded", output + "/unziptestout/2/bar"); | |||
| } | |||
| } | |||
| @@ -26,16 +26,13 @@ import org.junit.Test; | |||
| import static org.junit.Assert.assertNotNull; | |||
| public class WhichResourceTest { | |||
| public static final String TEST_BUILD_FILE | |||
| = "src/etc/testcases/taskdefs/whichresource.xml"; | |||
| @Rule | |||
| public BuildFileRule buildRule = new BuildFileRule(); | |||
| @Before | |||
| public void setUp() { | |||
| buildRule.configureProject(TEST_BUILD_FILE); | |||
| buildRule.configureProject("src/etc/testcases/taskdefs/whichresource.xml"); | |||
| } | |||
| @Test | |||
| @@ -44,15 +44,15 @@ public class ParserSupportsTest { | |||
| @Test | |||
| public void testEmpty() { | |||
| thrown.expect(BuildException .class) ; | |||
| thrown.expectMessage(ParserSupports.ERROR_NO_ATTRIBUTES); | |||
| thrown.expect(BuildException .class); | |||
| thrown.expectMessage(ParserSupports.ERROR_NO_ATTRIBUTES); | |||
| buildRule.executeTarget("testEmpty"); | |||
| } | |||
| @Test | |||
| public void testBoth() { | |||
| thrown.expect(BuildException .class) ; | |||
| thrown.expectMessage(ParserSupports.ERROR_BOTH_ATTRIBUTES); | |||
| thrown.expect(BuildException .class); | |||
| thrown.expectMessage(ParserSupports.ERROR_BOTH_ATTRIBUTES); | |||
| buildRule.executeTarget("testBoth"); | |||
| } | |||
| @@ -63,8 +63,8 @@ public class ParserSupportsTest { | |||
| @Test | |||
| public void testPropertyNoValue() { | |||
| thrown.expect(BuildException .class) ; | |||
| thrown.expectMessage(ParserSupports.ERROR_NO_VALUE); | |||
| thrown.expect(BuildException .class); | |||
| thrown.expectMessage(ParserSupports.ERROR_NO_VALUE); | |||
| buildRule.executeTarget("testPropertyNoValue"); | |||
| } | |||
| @@ -134,8 +134,7 @@ public class ANTLRTest { | |||
| public void test10() { | |||
| buildRule.executeTarget("test10"); | |||
| File outputDirectory = new File(buildRule.getProject().getProperty("output")); | |||
| String[] calcFiles = outputDirectory.list(new HTMLFilter()); | |||
| assertNotEquals(calcFiles.length, 0); | |||
| assertNotEquals(outputDirectory.list(new HTMLFilter()).length, 0); | |||
| } | |||
| /** | |||
| @@ -58,6 +58,7 @@ public class JavahTest { | |||
| public void testCompileFileset() { | |||
| assumeFalse(JavaEnvUtils.isAtLeastJavaVersion("10")); | |||
| buildRule.executeTarget("test-fileset"); | |||
| assertTrue(new File(buildRule.getProject().getProperty("output"), "org_example_Foo.h").exists()); | |||
| assertTrue(new File(buildRule.getProject().getProperty("output"), "org_example_Foo.h") | |||
| .exists()); | |||
| } | |||
| } | |||
| @@ -102,7 +102,7 @@ public class ReplaceRegExpTest { | |||
| buildRule.executeTarget("lastModifiedSetup"); | |||
| File testFile = new File(buildRule.getOutputDir(), "test.txt"); | |||
| assumeTrue(testFile.setLastModified(testFile.lastModified() | |||
| - (FileUtils.getFileUtils().getFileTimestampGranularity() * 3))); | |||
| - FileUtils.getFileUtils().getFileTimestampGranularity() * 3)); | |||
| long ts1 = testFile.lastModified(); | |||
| buildRule.executeTarget("testNoPreserve"); | |||
| assertTrue(ts1 < testFile.lastModified()); | |||
| @@ -113,7 +113,7 @@ public class ReplaceRegExpTest { | |||
| buildRule.executeTarget("lastModifiedSetup"); | |||
| File testFile = new File(buildRule.getOutputDir(), "test.txt"); | |||
| assumeTrue(testFile.setLastModified(testFile.lastModified() | |||
| - (FileUtils.getFileUtils().getFileTimestampGranularity() * 3))); | |||
| - FileUtils.getFileUtils().getFileTimestampGranularity() * 3)); | |||
| long ts1 = testFile.lastModified(); | |||
| buildRule.executeTarget("testPreserve"); | |||
| assertEquals(ts1, testFile.lastModified()); | |||
| @@ -34,17 +34,12 @@ import static org.junit.Assert.assertThat; | |||
| */ | |||
| public class XsltTest { | |||
| /** | |||
| * where tasks run | |||
| */ | |||
| private static final String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/"; | |||
| @Rule | |||
| public BuildFileRule buildRule = new BuildFileRule(); | |||
| @Before | |||
| public void setUp() { | |||
| buildRule.configureProject(TASKDEFS_DIR + "xslt.xml"); | |||
| buildRule.configureProject("src/etc/testcases/taskdefs/optional/xslt.xml"); | |||
| } | |||
| /** | |||
| @@ -37,8 +37,7 @@ public class JDependTest { | |||
| @Before | |||
| public void setUp() { | |||
| buildRule.configureProject( | |||
| "src/etc/testcases/taskdefs/optional/jdepend/jdepend.xml"); | |||
| buildRule.configureProject("src/etc/testcases/taskdefs/optional/jdepend/jdepend.xml"); | |||
| } | |||
| /** | |||
| @@ -47,7 +46,8 @@ public class JDependTest { | |||
| @Test | |||
| public void testSimple() { | |||
| buildRule.executeTarget("simple"); | |||
| assertThat(buildRule.getOutput(), containsString("Package: org.apache.tools.ant.util.facade")); | |||
| assertThat(buildRule.getOutput(), | |||
| containsString("Package: org.apache.tools.ant.util.facade")); | |||
| } | |||
| /** | |||
| @@ -66,7 +66,8 @@ public class JDependTest { | |||
| @Test | |||
| public void testFork() { | |||
| buildRule.executeTarget("fork"); | |||
| assertThat(buildRule.getLog(), containsString("Package: org.apache.tools.ant.util.facade")); | |||
| assertThat(buildRule.getLog(), | |||
| containsString("Package: org.apache.tools.ant.util.facade")); | |||
| } | |||
| /** | |||
| @@ -94,7 +95,8 @@ public class JDependTest { | |||
| @Test | |||
| public void testTimeoutNot() { | |||
| buildRule.executeTarget("fork-timeout-not"); | |||
| assertThat(buildRule.getLog(), containsString("Package: org.apache.tools.ant.util.facade")); | |||
| assertThat(buildRule.getLog(), | |||
| containsString("Package: org.apache.tools.ant.util.facade")); | |||
| } | |||
| } | |||
| @@ -140,10 +140,10 @@ public class SOSTest { | |||
| @Test | |||
| public void testGetExceptions() { | |||
| buildRule.configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml"); | |||
| expectSpecificBuildException("sosget.1", "some cause", "sosserverpath attribute must be set!"); | |||
| expectSpecificBuildException("sosget.2", "some cause", "username attribute must be set!"); | |||
| expectSpecificBuildException("sosget.3", "some cause", "vssserverpath attribute must be set!"); | |||
| expectSpecificBuildException("sosget.4", "some cause", "projectpath attribute must be set!"); | |||
| expectSpecificBuildException("sosget.1", "sosserverpath attribute must be set!"); | |||
| expectSpecificBuildException("sosget.2", "username attribute must be set!"); | |||
| expectSpecificBuildException("sosget.3", "vssserverpath attribute must be set!"); | |||
| expectSpecificBuildException("sosget.4", "projectpath attribute must be set!"); | |||
| } | |||
| /** Test CheckInFile option flags */ | |||
| @@ -209,10 +209,10 @@ public class SOSTest { | |||
| @Test | |||
| public void testCheckinExceptions() { | |||
| buildRule.configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml"); | |||
| expectSpecificBuildException("soscheckin.1", "some cause", "sosserverpath attribute must be set!"); | |||
| expectSpecificBuildException("soscheckin.2", "some cause", "username attribute must be set!"); | |||
| expectSpecificBuildException("soscheckin.3", "some cause", "vssserverpath attribute must be set!"); | |||
| expectSpecificBuildException("soscheckin.4", "some cause", "projectpath attribute must be set!"); | |||
| expectSpecificBuildException("soscheckin.1", "sosserverpath attribute must be set!"); | |||
| expectSpecificBuildException("soscheckin.2", "username attribute must be set!"); | |||
| expectSpecificBuildException("soscheckin.3", "vssserverpath attribute must be set!"); | |||
| expectSpecificBuildException("soscheckin.4", "projectpath attribute must be set!"); | |||
| } | |||
| /** Test CheckOutFile option flags */ | |||
| @@ -276,10 +276,10 @@ public class SOSTest { | |||
| @Test | |||
| public void testCheckoutExceptions() { | |||
| buildRule.configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml"); | |||
| expectSpecificBuildException("soscheckout.1", "some cause", "sosserverpath attribute must be set!"); | |||
| expectSpecificBuildException("soscheckout.2", "some cause", "username attribute must be set!"); | |||
| expectSpecificBuildException("soscheckout.3", "some cause", "vssserverpath attribute must be set!"); | |||
| expectSpecificBuildException("soscheckout.4", "some cause", "projectpath attribute must be set!"); | |||
| expectSpecificBuildException("soscheckout.1", "sosserverpath attribute must be set!"); | |||
| expectSpecificBuildException("soscheckout.2", "username attribute must be set!"); | |||
| expectSpecificBuildException("soscheckout.3", "vssserverpath attribute must be set!"); | |||
| expectSpecificBuildException("soscheckout.4", "projectpath attribute must be set!"); | |||
| } | |||
| /** Test Label option flags */ | |||
| @@ -312,14 +312,14 @@ public class SOSTest { | |||
| @Test | |||
| public void testLabelExceptions() { | |||
| buildRule.configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml"); | |||
| expectSpecificBuildException("soslabel.1", "some cause", "sosserverpath attribute must be set!"); | |||
| expectSpecificBuildException("soslabel.2", "some cause", "username attribute must be set!"); | |||
| expectSpecificBuildException("soslabel.3", "some cause", "vssserverpath attribute must be set!"); | |||
| expectSpecificBuildException("soslabel.4", "some cause", "projectpath attribute must be set!"); | |||
| expectSpecificBuildException("soslabel.5", "some cause", "label attribute must be set!"); | |||
| expectSpecificBuildException("soslabel.1", "sosserverpath attribute must be set!"); | |||
| expectSpecificBuildException("soslabel.2", "username attribute must be set!"); | |||
| expectSpecificBuildException("soslabel.3", "vssserverpath attribute must be set!"); | |||
| expectSpecificBuildException("soslabel.4", "projectpath attribute must be set!"); | |||
| expectSpecificBuildException("soslabel.5", "label attribute must be set!"); | |||
| } | |||
| private void expectSpecificBuildException(String target, String errorMessage, | |||
| private void expectSpecificBuildException(String target, | |||
| String exceptionMessage) { | |||
| thrown.expect(BuildException.class); | |||
| thrown.expectMessage(exceptionMessage); | |||
| @@ -65,11 +65,9 @@ public class SymlinkTest { | |||
| @Rule | |||
| public BuildFileRule buildRule = new BuildFileRule(); | |||
| private boolean supportsSymlinks = Os.isFamily("unix"); | |||
| @Before | |||
| public void setUp() { | |||
| assumeTrue("Symlinks not supported on current operating system", supportsSymlinks); | |||
| assumeTrue("Symlinks not supported on current operating system", Os.isFamily("unix")); | |||
| buildRule.configureProject("src/etc/testcases/taskdefs/optional/unix/symlink.xml"); | |||
| buildRule.executeTarget("setUp"); | |||
| } | |||
| @@ -31,10 +31,9 @@ public class PackageNameMapperTest { | |||
| mapper.setFrom("*.java"); | |||
| mapper.setTo("TEST-*.xml"); | |||
| String file = fixupPath("org/apache/tools/ant/util/PackageNameMapperTest.java"); | |||
| String result = mapper.mapFileName(file)[0]; | |||
| assertEquals("TEST-org.apache.tools.ant.util.PackageNameMapperTest.xml", | |||
| result); | |||
| mapper.mapFileName(file)[0]); | |||
| } | |||
| private String fixupPath(String file) { | |||
| @@ -30,10 +30,9 @@ public class UnPackageNameMapperTest { | |||
| mapper.setFrom("TEST-*.xml"); | |||
| mapper.setTo("*.java"); | |||
| String file = "TEST-org.apache.tools.ant.util.UnPackageNameMapperTest.xml"; | |||
| String result = mapper.mapFileName(file)[0]; | |||
| String expected = fixupPath("org/apache/tools/ant/util/UnPackageNameMapperTest.java"); | |||
| assertEquals(expected, result); | |||
| assertEquals(expected, mapper.mapFileName(file)[0]); | |||
| } | |||
| private String fixupPath(String file) { | |||