| @@ -22,6 +22,7 @@ import static org.apache.tools.ant.AntAssert.assertContains; | |||
| import static org.apache.tools.ant.AntAssert.assertNotContains; | |||
| import static org.junit.Assert.assertFalse; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.junit.Assume.assumeTrue; | |||
| import java.io.FileReader; | |||
| import java.io.IOException; | |||
| @@ -29,7 +30,6 @@ import java.io.Reader; | |||
| import org.apache.tools.ant.BuildFileRule; | |||
| import org.apache.tools.ant.util.FileUtils; | |||
| import org.junit.Assume; | |||
| import org.junit.Before; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| @@ -115,7 +115,7 @@ public class TokenFilterTest { | |||
| public void testReplaceRegex() throws IOException { | |||
| buildRule.executeTarget("hasregex"); | |||
| Assume.assumeTrue("Regex not present", | |||
| assumeTrue("Regex not present", | |||
| getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world")); | |||
| buildRule.executeTarget("replaceregex"); | |||
| @@ -131,7 +131,7 @@ public class TokenFilterTest { | |||
| @Test | |||
| public void testFilterReplaceRegex() throws IOException { | |||
| buildRule.executeTarget("hasregex"); | |||
| Assume.assumeTrue("Regex not present", | |||
| assumeTrue("Regex not present", | |||
| getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world")); | |||
| buildRule.executeTarget("filterreplaceregex"); | |||
| @@ -143,7 +143,7 @@ public class TokenFilterTest { | |||
| @Test | |||
| public void testHandleDollerMatch() throws IOException { | |||
| buildRule.executeTarget("hasregex"); | |||
| Assume.assumeTrue("Regex not present", getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world")); | |||
| assumeTrue("Regex not present", getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world")); | |||
| buildRule.executeTarget("dollermatch"); | |||
| } | |||
| @@ -183,7 +183,7 @@ public class TokenFilterTest { | |||
| @Test | |||
| public void testContainsRegex() throws IOException { | |||
| buildRule.executeTarget("hasregex"); | |||
| Assume.assumeTrue("Regex not present", getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world")); | |||
| assumeTrue("Regex not present", getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world")); | |||
| //expectFileContains(buildRule.getProject().getProperty("output") + "/replaceregexp", "bye world"); | |||
| @@ -197,7 +197,7 @@ public class TokenFilterTest { | |||
| @Test | |||
| public void testFilterContainsRegex() throws IOException { | |||
| buildRule.executeTarget("hasregex"); | |||
| Assume.assumeTrue("Regex not present", getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world")); | |||
| assumeTrue("Regex not present", getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world")); | |||
| buildRule.executeTarget("filtercontainsregex"); | |||
| String contents = getFileString(buildRule.getProject().getProperty("output") + "/filtercontainsregex"); | |||
| @@ -209,7 +209,7 @@ public class TokenFilterTest { | |||
| @Test | |||
| public void testContainsRegex2() throws IOException { | |||
| buildRule.executeTarget("hasregex"); | |||
| Assume.assumeTrue("Regex not present", getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world")); | |||
| assumeTrue("Regex not present", getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world")); | |||
| buildRule.executeTarget("containsregex2"); | |||
| String contents = getFileString(buildRule.getProject().getProperty("output") + "/containsregex2"); | |||
| @@ -227,7 +227,7 @@ public class TokenFilterTest { | |||
| @Test | |||
| public void testScriptFilter() throws IOException { | |||
| Assume.assumeTrue("Project does not have 'testScriptFilter' target", | |||
| assumeTrue("Project does not have 'testScriptFilter' target", | |||
| buildRule.getProject().getTargets().contains("testScriptFilter")); | |||
| buildRule.executeTarget("scriptfilter"); | |||
| assertContains("HELLO WORLD", getFileString(buildRule.getProject().getProperty("output") + "/scriptfilter")); | |||
| @@ -236,7 +236,7 @@ public class TokenFilterTest { | |||
| @Test | |||
| public void testScriptFilter2() throws IOException { | |||
| Assume.assumeTrue("Project does not have 'testScriptFilter' target", buildRule.getProject().getTargets().contains("testScriptFilter")); | |||
| assumeTrue("Project does not have 'testScriptFilter' target", buildRule.getProject().getTargets().contains("testScriptFilter")); | |||
| buildRule.executeTarget("scriptfilter2"); | |||
| assertContains("HELLO MOON", getFileString(buildRule.getProject().getProperty("output") + "/scriptfilter2")); | |||
| } | |||
| @@ -21,12 +21,12 @@ package org.apache.tools.ant.taskdefs; | |||
| import org.apache.tools.ant.BuildFileRule; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| import org.junit.Assume; | |||
| import org.junit.Before; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| import static org.junit.Assert.assertEquals; | |||
| import static org.junit.Assume.assumeTrue; | |||
| /** | |||
| */ | |||
| @@ -74,19 +74,19 @@ public class AntlibTest { | |||
| @Test | |||
| public void testAntlib_uri() { | |||
| Assume.assumeTrue("Test requires shared JVM", isSharedJVM()); | |||
| assumeTrue("Test requires shared JVM", isSharedJVM()); | |||
| buildRule.executeTarget("antlib_uri"); | |||
| } | |||
| @Test | |||
| public void testAntlib_uri_auto() { | |||
| Assume.assumeTrue("Test requires shared JVM", isSharedJVM()); | |||
| assumeTrue("Test requires shared JVM", isSharedJVM()); | |||
| buildRule.executeTarget("antlib_uri_auto"); | |||
| } | |||
| @Test | |||
| public void testAntlib_uri_auto2() { | |||
| Assume.assumeTrue("Test requires shared JVM", isSharedJVM()); | |||
| assumeTrue("Test requires shared JVM", isSharedJVM()); | |||
| buildRule.executeTarget("antlib_uri_auto2"); | |||
| } | |||
| @@ -20,11 +20,11 @@ package org.apache.tools.ant.taskdefs; | |||
| import static org.junit.Assert.assertEquals; | |||
| import static org.junit.Assert.fail; | |||
| import static org.junit.Assume.assumeFalse; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.BuildFileRule; | |||
| import org.apache.tools.ant.taskdefs.condition.Os; | |||
| import org.junit.Assume; | |||
| import org.junit.Before; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| @@ -73,7 +73,7 @@ public class DirnameTest { | |||
| @Test | |||
| public void test4() { | |||
| Assume.assumeFalse("Test not possible on DOS or Netware family OS", Os.isFamily("netware") || Os.isFamily("dos")); | |||
| assumeFalse("Test not possible on DOS or Netware family OS", Os.isFamily("netware") || Os.isFamily("dos")); | |||
| buildRule.executeTarget("test4"); | |||
| String filesep = System.getProperty("file.separator"); | |||
| String expected = filesep + "usr" + filesep + "local"; | |||
| @@ -19,6 +19,7 @@ | |||
| package org.apache.tools.ant.taskdefs; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.junit.Assume.assumeNotNull; | |||
| import java.io.File; | |||
| import java.util.GregorianCalendar; | |||
| @@ -29,7 +30,6 @@ import org.apache.tools.ant.BuildListener; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.ProjectHelper; | |||
| import org.apache.tools.ant.util.FileUtils; | |||
| import org.junit.Assume; | |||
| import org.junit.Before; | |||
| import org.junit.Ignore; | |||
| import org.junit.Rule; | |||
| @@ -68,7 +68,7 @@ public class ExecTaskTest { | |||
| @Test | |||
| public void testspawn() throws InterruptedException { | |||
| buildRule.getProject().executeTarget("setUp"); | |||
| Assume.assumeNotNull(buildRule.getProject().getProperty("test.can.run")); | |||
| assumeNotNull(buildRule.getProject().getProperty("test.can.run")); | |||
| myBuild = new MonitoredBuild(new File(System.getProperty("root"), BUILD_FILE), "spawn"); | |||
| logFile = FILE_UTILS.createTempFile("spawn", "log", new File(buildRule.getProject().getProperty("output")), | |||
| false, false); | |||
| @@ -23,6 +23,7 @@ import static org.junit.Assert.assertEquals; | |||
| import static org.junit.Assert.assertNotNull; | |||
| import static org.junit.Assert.assertNull; | |||
| import static org.junit.Assert.fail; | |||
| import static org.junit.Assume.assumeTrue; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| @@ -31,7 +32,6 @@ import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.BuildFileRule; | |||
| import org.apache.tools.ant.Location; | |||
| import org.apache.tools.ant.Project; | |||
| import org.junit.Assume; | |||
| import org.junit.Ignore; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| @@ -138,7 +138,7 @@ public class ImportTest { | |||
| if (!new File(ln).exists()) { | |||
| ln = "/bin/ln"; | |||
| } | |||
| Assume.assumeTrue("Current system does not support Symlinks", new File(ln).exists()); | |||
| assumeTrue("Current system does not support Symlinks", new File(ln).exists()); | |||
| String symlink = "src/etc/testcases/taskdefs/import/symlinks/d3b"; | |||
| File symlinkFile = new File(System.getProperty("root"), symlink); | |||
| if (Runtime.getRuntime().exec(new String[] {ln, "-s", "d3a", symlinkFile.getAbsolutePath()}).waitFor() != 0) { | |||
| @@ -34,7 +34,6 @@ import org.apache.tools.ant.BuildFileRule; | |||
| import org.apache.tools.ant.FileUtilities; | |||
| import org.apache.tools.ant.util.FileUtils; | |||
| import org.junit.After; | |||
| import org.junit.Assume; | |||
| import org.junit.Before; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| @@ -44,6 +43,7 @@ import static org.junit.Assert.assertEquals; | |||
| import static org.junit.Assert.assertFalse; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.junit.Assert.fail; | |||
| import static org.junit.Assume.assumeTrue; | |||
| /** | |||
| */ | |||
| @@ -137,7 +137,7 @@ public class JarTest { | |||
| File jarFile = new File(getOutputDir(), tempJar); | |||
| // move the modified date back a couple of seconds rather than delay the test on each run | |||
| Assume.assumeTrue(jarFile.setLastModified(jarFile.lastModified() | |||
| assumeTrue(jarFile.setLastModified(jarFile.lastModified() | |||
| - FileUtils.getFileUtils().getFileTimestampGranularity() * 3)); | |||
| long jarModifiedDate = jarFile.lastModified(); | |||
| @@ -34,7 +34,6 @@ import org.apache.tools.ant.BuildFileRule; | |||
| import org.apache.tools.ant.input.DefaultInputHandler; | |||
| import org.apache.tools.ant.util.FileUtils; | |||
| import org.apache.tools.ant.util.TeeOutputStream; | |||
| import org.junit.Assume; | |||
| import org.junit.Before; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| @@ -45,6 +44,7 @@ import static org.junit.Assert.assertEquals; | |||
| import static org.junit.Assert.assertNotNull; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.junit.Assert.fail; | |||
| import static org.junit.Assume.assumeTrue; | |||
| /** | |||
| * stress out java task | |||
| @@ -220,13 +220,13 @@ public class JavaTest { | |||
| */ | |||
| @Test | |||
| public void testRunFail() { | |||
| Assume.assumeTrue("Fatal tests have not been set to run", runFatalTests); | |||
| assumeTrue("Fatal tests have not been set to run", runFatalTests); | |||
| buildRule.executeTarget("testRunFail"); | |||
| } | |||
| @Test | |||
| public void testRunFailFoe() { | |||
| Assume.assumeTrue("Fatal tests have not been set to run", runFatalTests); | |||
| assumeTrue("Fatal tests have not been set to run", runFatalTests); | |||
| try { | |||
| buildRule.executeTarget("testRunFailFoe"); | |||
| fail("Build exception should have been thrown - " + "java failures being propagated"); | |||
| @@ -21,6 +21,9 @@ import static org.apache.tools.ant.AntAssert.assertContains; | |||
| import static org.junit.Assert.assertEquals; | |||
| import static org.junit.Assert.assertNull; | |||
| import static org.junit.Assert.fail; | |||
| import static org.junit.Assume.assumeFalse; | |||
| import static org.junit.Assume.assumeNoException; | |||
| import static org.junit.Assume.assumeTrue; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| @@ -29,7 +32,6 @@ import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.BuildFileRule; | |||
| import org.apache.tools.ant.taskdefs.condition.Os; | |||
| import org.apache.tools.ant.util.regexp.RegexpMatcherFactory; | |||
| import org.junit.Assume; | |||
| import org.junit.Before; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| @@ -145,7 +147,7 @@ public class ManifestClassPathTest { | |||
| @Test | |||
| public void testPseudoTahoeRefid() { | |||
| Assume.assumeTrue("No regexp matcher is present", RegexpMatcherFactory.regexpMatcherPresent(buildRule.getProject())); | |||
| assumeTrue("No regexp matcher is present", RegexpMatcherFactory.regexpMatcherPresent(buildRule.getProject())); | |||
| buildRule.executeTarget("test-pseudo-tahoe-refid"); | |||
| assertEquals(buildRule.getProject().getProperty("jar.classpath"), "classes/dsp-core/ " | |||
| @@ -158,7 +160,7 @@ public class ManifestClassPathTest { | |||
| @Test | |||
| public void testPseudoTahoeNested() { | |||
| Assume.assumeTrue("No regexp matcher is present", RegexpMatcherFactory.regexpMatcherPresent(buildRule.getProject())); | |||
| assumeTrue("No regexp matcher is present", RegexpMatcherFactory.regexpMatcherPresent(buildRule.getProject())); | |||
| buildRule.executeTarget("test-pseudo-tahoe-nested"); | |||
| assertEquals(buildRule.getProject().getProperty("jar.classpath"), "classes/dsp-core/ " | |||
| @@ -195,7 +197,7 @@ public class ManifestClassPathTest { | |||
| @Test | |||
| public void testInternationalHebrew() { | |||
| Assume.assumeFalse("Test with hebrew path not attempted under Windows", Os.isFamily("windows")); | |||
| assumeFalse("Test with hebrew path not attempted under Windows", Os.isFamily("windows")); | |||
| buildRule.executeTarget("international-hebrew"); | |||
| buildRule.executeTarget("run-two-jars"); | |||
| assertContains("beta alpha", buildRule.getLog()); | |||
| @@ -203,14 +205,14 @@ public class ManifestClassPathTest { | |||
| @Test | |||
| public void testSameWindowsDrive() { | |||
| Assume.assumeTrue("Test with drive letters only run on windows", Os.isFamily("windows")); | |||
| assumeTrue("Test with drive letters only run on windows", Os.isFamily("windows")); | |||
| buildRule.executeTarget("testSameDrive"); | |||
| assertEquals(buildRule.getProject().getProperty("cp"), "../a/b/x.jar"); | |||
| } | |||
| @Test | |||
| public void testDifferentWindowsDrive() { | |||
| Assume.assumeTrue("Test with drive letters only run on windows", Os.isFamily("windows")); | |||
| assumeTrue("Test with drive letters only run on windows", Os.isFamily("windows")); | |||
| // the lines below try to find a drive name different than the one containing the temp dir | |||
| // if the temp dir is C will try to use D | |||
| // if the temp dir is on D or other will try to use C | |||
| @@ -231,7 +233,7 @@ public class ManifestClassPathTest { | |||
| } | |||
| new File(altDriveLetter + ":/foo.txt").getCanonicalPath(); | |||
| } catch (IOException e) { | |||
| Assume.assumeNoException("Drive " + altDriveLetter + ": doesn't exist or is not ready", e); | |||
| assumeNoException("Drive " + altDriveLetter + ": doesn't exist or is not ready", e); | |||
| } | |||
| buildRule.getProject().setProperty("altDriveLetter", altDriveLetter); | |||
| @@ -22,11 +22,11 @@ import static org.apache.tools.ant.AntAssert.assertContains; | |||
| import static org.junit.Assert.assertEquals; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.junit.Assert.fail; | |||
| import static org.junit.Assume.assumeNoException; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.BuildFileRule; | |||
| import org.apache.tools.ant.util.FileUtils; | |||
| import org.junit.Assume; | |||
| import org.junit.Before; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| @@ -128,7 +128,7 @@ public class PropertyTest { | |||
| try { | |||
| Class.forName("java.lang.Iterable"); | |||
| } catch (ClassNotFoundException e) { | |||
| Assume.assumeNoException("XML Loading only on Java 5+", e); | |||
| assumeNoException("XML Loading only on Java 5+", e); | |||
| } | |||
| buildRule.executeTarget("testXmlProperty"); | |||
| assertEquals("ONE", buildRule.getProject().getProperty("xml.one")); | |||
| @@ -22,7 +22,6 @@ import java.io.File; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.BuildFileRule; | |||
| import org.junit.Assume; | |||
| import org.junit.Before; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| @@ -32,6 +31,7 @@ import static org.junit.Assert.assertFalse; | |||
| import static org.junit.Assert.assertNotEquals; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.junit.Assert.fail; | |||
| import static org.junit.Assume.assumeFalse; | |||
| /** | |||
| * Testcase for the Signjar task | |||
| @@ -100,7 +100,7 @@ public class SignJarTest { | |||
| @Test | |||
| public void testURLKeystoreHTTP() { | |||
| Assume.assumeFalse("Test is set offline", isOffline()); | |||
| assumeFalse("Test is set offline", isOffline()); | |||
| buildRule.executeTarget("urlKeystoreHTTP"); | |||
| } | |||
| @@ -19,7 +19,6 @@ package org.apache.tools.ant.taskdefs.optional; | |||
| import org.apache.tools.ant.BuildFileRule; | |||
| import org.apache.tools.ant.util.JavaEnvUtils; | |||
| import org.junit.Assume; | |||
| import org.junit.After; | |||
| import org.junit.Before; | |||
| import org.junit.Rule; | |||
| @@ -28,6 +27,7 @@ import org.junit.Test; | |||
| import java.io.File; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.junit.Assume.assumeFalse; | |||
| public class JavahTest { | |||
| @@ -48,7 +48,7 @@ public class JavahTest { | |||
| @Test | |||
| public void testSimpleCompile() { | |||
| Assume.assumeFalse(JavaEnvUtils.isAtLeastJavaVersion("10")); | |||
| assumeFalse(JavaEnvUtils.isAtLeastJavaVersion("10")); | |||
| buildRule.executeTarget("simple-compile"); | |||
| assertTrue(new File(buildRule.getProject().getProperty("output"), "org_example_Foo.h") | |||
| .exists()); | |||
| @@ -56,7 +56,7 @@ public class JavahTest { | |||
| @Test | |||
| public void testCompileFileset() { | |||
| Assume.assumeFalse(JavaEnvUtils.isAtLeastJavaVersion("10")); | |||
| assumeFalse(JavaEnvUtils.isAtLeastJavaVersion("10")); | |||
| buildRule.executeTarget("test-fileset"); | |||
| assertTrue(new File(buildRule.getProject().getProperty("output"), "org_example_Foo.h").exists()); | |||
| } | |||
| @@ -19,6 +19,9 @@ | |||
| package org.apache.tools.ant.taskdefs.optional; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.junit.Assume.assumeFalse; | |||
| import static org.junit.Assume.assumeNoException; | |||
| import static org.junit.Assume.assumeTrue; | |||
| import java.io.ByteArrayInputStream; | |||
| import java.io.File; | |||
| @@ -32,7 +35,6 @@ import org.apache.tools.ant.taskdefs.XSLTLiaison; | |||
| import org.apache.tools.ant.taskdefs.XSLTLogger; | |||
| import org.apache.tools.ant.util.JAXPUtils; | |||
| import org.junit.After; | |||
| import org.junit.Assume; | |||
| import org.junit.Test; | |||
| /** | |||
| @@ -59,13 +61,12 @@ public class TraXLiaisonTest extends AbstractXSLTLiaisonTest implements XSLTLogg | |||
| try { | |||
| getClass().getClassLoader().loadClass("org.apache.xalan.lib.Redirect"); | |||
| } catch (Exception exc) { | |||
| Assume.assumeNoException("xalan redirect is not on the classpath", exc); | |||
| assumeNoException("xalan redirect is not on the classpath", exc); | |||
| } | |||
| try { | |||
| String factoryName = TransformerFactory.newInstance().getClass().getName(); | |||
| Assume.assumeFalse("TraxFactory is Xalan", | |||
| "org.apache.xalan.processor.TransformerFactoryImpl" | |||
| .equals(factoryName)); | |||
| assumeFalse("TraxFactory is Xalan", | |||
| "org.apache.xalan.processor.TransformerFactoryImpl".equals(factoryName)); | |||
| } catch (TransformerFactoryConfigurationError exc) { | |||
| throw new RuntimeException(exc); | |||
| } | |||
| @@ -106,13 +107,12 @@ public class TraXLiaisonTest extends AbstractXSLTLiaisonTest implements XSLTLogg | |||
| try { | |||
| getClass().getClassLoader().loadClass("org.apache.xalan.lib.Redirect"); | |||
| } catch (Exception exc) { | |||
| Assume.assumeNoException("xalan redirect is not on the classpath", exc); | |||
| assumeNoException("xalan redirect is not on the classpath", exc); | |||
| } | |||
| try { | |||
| String factoryName = TransformerFactory.newInstance().getClass().getName(); | |||
| Assume.assumeTrue("TraxFactory is " + factoryName + " and not Xalan", | |||
| "org.apache.xalan.processor.TransformerFactoryImpl" | |||
| .equals(factoryName)); | |||
| assumeTrue("TraxFactory is " + factoryName + " and not Xalan", | |||
| "org.apache.xalan.processor.TransformerFactoryImpl".equals(factoryName)); | |||
| } catch (TransformerFactoryConfigurationError exc) { | |||
| throw new RuntimeException(exc); | |||
| } | |||
| @@ -21,6 +21,7 @@ package org.apache.tools.ant.taskdefs.optional.junit; | |||
| import static org.junit.Assert.assertFalse; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.apache.tools.ant.AntAssert.assertContains; | |||
| import static org.junit.Assume.assumeTrue; | |||
| import java.io.ByteArrayInputStream; | |||
| import java.io.File; | |||
| @@ -35,7 +36,6 @@ import javax.xml.transform.TransformerFactoryConfigurationError; | |||
| import org.apache.tools.ant.BuildFileRule; | |||
| import org.apache.tools.ant.util.FileUtils; | |||
| import org.junit.Assume; | |||
| import org.junit.Before; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| @@ -187,9 +187,8 @@ public class JUnitReportTest { | |||
| public void testWithSecurityManagerAndXalanFactory() throws Exception { | |||
| try { | |||
| String factoryName = TransformerFactory.newInstance().getClass().getName(); | |||
| Assume.assumeTrue("TraxFactory is " + factoryName + " and not Xalan", | |||
| "org.apache.xalan.processor.TransformerFactoryImpl" | |||
| .equals(factoryName)); | |||
| assumeTrue("TraxFactory is " + factoryName + " and not Xalan", | |||
| "org.apache.xalan.processor.TransformerFactoryImpl".equals(factoryName)); | |||
| } catch (TransformerFactoryConfigurationError exc) { | |||
| throw new RuntimeException(exc); | |||
| } | |||
| @@ -22,6 +22,7 @@ import static org.junit.Assert.assertFalse; | |||
| import static org.junit.Assert.assertNotNull; | |||
| import static org.junit.Assert.assertNull; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.junit.Assume.assumeFalse; | |||
| import static org.apache.tools.ant.AntAssert.assertNotContains; | |||
| import static org.apache.tools.ant.AntAssert.assertContains; | |||
| @@ -52,7 +53,6 @@ import org.apache.tools.ant.taskdefs.launcher.CommandLauncher; | |||
| import org.apache.tools.ant.types.Path; | |||
| import org.apache.tools.ant.util.JavaEnvUtils; | |||
| import org.apache.tools.ant.util.LoaderUtils; | |||
| import org.junit.Assume; | |||
| import org.junit.Before; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| @@ -140,7 +140,7 @@ public class JUnitTaskTest { | |||
| if (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_5)) { | |||
| try { | |||
| Class<?> clazz = Class.forName("junit.framework.JUnit4TestAdapter"); | |||
| Assume.assumeFalse("Skipping test since it fails with JUnit 4", clazz != null); | |||
| assumeFalse("Skipping test since it fails with JUnit 4", clazz != null); | |||
| } catch (ClassNotFoundException e) { | |||
| // OK, this is JUnit3, can run test | |||
| } | |||
| @@ -19,6 +19,7 @@ | |||
| package org.apache.tools.ant.taskdefs.optional.junit; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.junit.Assume.assumeNoException; | |||
| import java.io.File; | |||
| import java.io.FileOutputStream; | |||
| @@ -29,7 +30,6 @@ import org.apache.tools.ant.DefaultLogger; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.taskdefs.Delete; | |||
| import org.apache.tools.ant.types.FileSet; | |||
| import org.junit.Assume; | |||
| import org.junit.Test; | |||
| public class XMLResultAggregatorTest { | |||
| @@ -40,7 +40,7 @@ public class XMLResultAggregatorTest { | |||
| try { | |||
| Class.forName("java.nio.file.Files"); | |||
| } catch (ClassNotFoundException x) { | |||
| Assume.assumeNoException("Skip test on JDK 6 and below", x); | |||
| assumeNoException("Skip test on JDK 6 and below", x); | |||
| } | |||
| final File d = new File(System.getProperty("java.io.tmpdir"), "XMLResultAggregatorTest"); | |||
| if (d.exists()) { | |||
| @@ -21,6 +21,7 @@ import static org.apache.tools.ant.AntAssert.assertContains; | |||
| import static org.junit.Assert.assertEquals; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.junit.Assert.fail; | |||
| import static org.junit.Assume.assumeTrue; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| @@ -44,7 +45,6 @@ import org.apache.tools.ant.util.Retryable; | |||
| import org.apache.tools.ant.util.regexp.RegexpMatcher; | |||
| import org.apache.tools.ant.util.regexp.RegexpMatcherFactory; | |||
| import org.junit.After; | |||
| import org.junit.Assume; | |||
| import org.junit.Before; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| @@ -127,8 +127,8 @@ public class FTPTest { | |||
| @Test | |||
| public void test1() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| @@ -139,8 +139,8 @@ public class FTPTest { | |||
| @Test | |||
| public void test2() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setIncludes(new String[] {"alpha/"}); | |||
| @@ -151,8 +151,8 @@ public class FTPTest { | |||
| @Test | |||
| public void test3() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.scan(); | |||
| @@ -162,8 +162,8 @@ public class FTPTest { | |||
| @Test | |||
| public void testFullPathMatchesCaseSensitive() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"}); | |||
| @@ -173,8 +173,8 @@ public class FTPTest { | |||
| @Test | |||
| public void testFullPathMatchesCaseInsensitive() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setCaseSensitive(false); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| @@ -185,8 +185,8 @@ public class FTPTest { | |||
| @Test | |||
| public void test2ButCaseInsensitive() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setIncludes(new String[] {"ALPHA/"}); | |||
| @@ -198,8 +198,8 @@ public class FTPTest { | |||
| @Test | |||
| public void test2bisButCaseInsensitive() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setIncludes(new String[] {"alpha/BETA/gamma/"}); | |||
| @@ -234,9 +234,9 @@ public class FTPTest { | |||
| @Test | |||
| public void testGetFollowSymlinksTrue() { | |||
| Assume.assumeTrue("System does not support Symlinks", supportsSymlinks); | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue("System does not support Symlinks", supportsSymlinks); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| buildRule.getProject().executeTarget("ftp-get-directory-symbolic-link"); | |||
| FileSet fsDestination = buildRule.getProject().getReference("fileset-destination-without-selector"); | |||
| DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject()); | |||
| @@ -247,9 +247,9 @@ public class FTPTest { | |||
| @Test | |||
| public void testGetFollowSymlinksFalse() { | |||
| Assume.assumeTrue("System does not support Symlinks", supportsSymlinks); | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue("System does not support Symlinks", supportsSymlinks); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| buildRule.getProject().executeTarget("ftp-get-directory-no-symbolic-link"); | |||
| FileSet fsDestination = buildRule.getProject().getReference("fileset-destination-without-selector"); | |||
| DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject()); | |||
| @@ -259,9 +259,9 @@ public class FTPTest { | |||
| @Test | |||
| public void testAllowSymlinks() { | |||
| Assume.assumeTrue("System does not support Symlinks", supportsSymlinks); | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue("System does not support Symlinks", supportsSymlinks); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| buildRule.getProject().executeTarget("symlink-setup"); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| @@ -274,9 +274,9 @@ public class FTPTest { | |||
| @Test | |||
| public void testProhibitSymlinks() { | |||
| Assume.assumeTrue("System does not support Symlinks", supportsSymlinks); | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue("System does not support Symlinks", supportsSymlinks); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| buildRule.getProject().executeTarget("symlink-setup"); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| @@ -288,9 +288,9 @@ public class FTPTest { | |||
| @Test | |||
| public void testFileSymlink() { | |||
| Assume.assumeTrue("System does not support Symlinks", supportsSymlinks); | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue("System does not support Symlinks", supportsSymlinks); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| buildRule.getProject().executeTarget("symlink-file-setup"); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| @@ -304,8 +304,8 @@ public class FTPTest { | |||
| // father and child pattern test | |||
| @Test | |||
| public void testOrderOfIncludePatternsIrrelevant() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| String[] expectedFiles = {"alpha/beta/beta.xml", "alpha/beta/gamma/gamma.xml"}; | |||
| String[] expectedDirectories = {"alpha/beta", "alpha/beta/gamma" }; | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| @@ -323,8 +323,8 @@ public class FTPTest { | |||
| @Test | |||
| public void testPatternsDifferInCaseScanningSensitive() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setIncludes(new String[] {"alpha/", "ALPHA/"}); | |||
| @@ -335,8 +335,8 @@ public class FTPTest { | |||
| @Test | |||
| public void testPatternsDifferInCaseScanningInsensitive() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setIncludes(new String[] {"alpha/", "ALPHA/"}); | |||
| @@ -348,8 +348,8 @@ public class FTPTest { | |||
| @Test | |||
| public void testFullpathDiffersInCaseScanningSensitive() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setIncludes(new String[] {"alpha/beta/gamma/gamma.xml", "alpha/beta/gamma/GAMMA.XML"}); | |||
| @@ -359,8 +359,8 @@ public class FTPTest { | |||
| @Test | |||
| public void testFullpathDiffersInCaseScanningInsensitive() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setIncludes(new String[] { | |||
| @@ -375,8 +375,8 @@ public class FTPTest { | |||
| @Test | |||
| public void testParentDiffersInCaseScanningSensitive() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"}); | |||
| @@ -388,8 +388,8 @@ public class FTPTest { | |||
| @Test | |||
| public void testParentDiffersInCaseScanningInsensitive() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"}); | |||
| @@ -401,8 +401,8 @@ public class FTPTest { | |||
| @Test | |||
| public void testExcludeOneFile() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setIncludes(new String[] {"**/*.xml"}); | |||
| @@ -413,8 +413,8 @@ public class FTPTest { | |||
| @Test | |||
| public void testExcludeHasPrecedence() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setIncludes(new String[] {"alpha/**"}); | |||
| @@ -425,8 +425,8 @@ public class FTPTest { | |||
| @Test | |||
| public void testAlternateIncludeExclude() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setIncludes(new String[] {"alpha/**", "alpha/beta/gamma/**"}); | |||
| @@ -437,8 +437,8 @@ public class FTPTest { | |||
| @Test | |||
| public void testAlternateExcludeInclude() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setExcludes(new String[] {"alpha/**", "alpha/beta/gamma/**"}); | |||
| @@ -452,8 +452,8 @@ public class FTPTest { | |||
| */ | |||
| @Test | |||
| public void testChildrenOfExcludedDirectory() { | |||
| Assume.assumeTrue(loginFailureMessage, loginSucceeded); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue(loginFailureMessage, loginSucceeded); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| buildRule.getProject().executeTarget("children-of-excluded-dir-setup"); | |||
| FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| @@ -462,7 +462,7 @@ public class FTPTest { | |||
| compareFiles(ds, new String[] {"delta/delta.xml"}, new String[] {"delta"}); | |||
| ds = myFTPTask.newScanner(ftp); | |||
| Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir)); | |||
| ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); | |||
| ds.setExcludes(new String[] {"alpha"}); | |||
| ds.scan(); | |||
| @@ -19,13 +19,13 @@ package org.apache.tools.ant.types; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.BuildFileRule; | |||
| import org.junit.Assume; | |||
| import org.junit.Before; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| import static org.apache.tools.ant.AntAssert.assertContains; | |||
| import static org.junit.Assert.fail; | |||
| import static org.junit.Assume.assumeFalse; | |||
| /** | |||
| * test assertion handling | |||
| @@ -111,7 +111,7 @@ public class AssertionsTest { | |||
| @Test | |||
| public void testNofork() { | |||
| Assume.assumeFalse("ran Ant tests with -ea and this would fail spuriously", AssertionsTest.class.desiredAssertionStatus()); | |||
| assumeFalse("ran Ant tests with -ea and this would fail spuriously", AssertionsTest.class.desiredAssertionStatus()); | |||
| buildRule.executeTarget("test-nofork"); | |||
| assertContains("Assertion statements are currently ignored in non-forked mode", buildRule.getLog()); | |||
| } | |||
| @@ -20,13 +20,12 @@ package org.apache.tools.ant.types.selectors; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.types.Parameter; | |||
| import org.junit.Assume; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| import static org.junit.Assert.assertEquals; | |||
| import static org.junit.Assert.fail; | |||
| import static org.junit.Assume.assumeTrue; | |||
| /** | |||
| * Tests Date Selectors. | |||
| @@ -37,7 +36,6 @@ public class DateSelectorTest { | |||
| @Rule | |||
| public final BaseSelectorRule selectorRule = new BaseSelectorRule(); | |||
| /** | |||
| * Test the code that validates the selector. | |||
| */ | |||
| @@ -211,7 +209,7 @@ public class DateSelectorTest { | |||
| // setup the modified timestamp to match what the test needs, although be aware that the 3rd and 4th | |||
| // files don't exist so can't be changed, so don't try and loop over them | |||
| for (int i = 1; i <= 2; i++) { | |||
| Assume.assumeTrue("Cannot setup file times for test", | |||
| assumeTrue("Cannot setup file times for test", | |||
| selectorRule.getMirrorFiles()[i].setLastModified(testtime - (3 * 60 * 60 * 100))); | |||
| } | |||
| @@ -225,7 +223,7 @@ public class DateSelectorTest { | |||
| s.setWhen(before); | |||
| s.setGranularity(2); | |||
| for (int i = 7; i <= 10; i++) { | |||
| Assume.assumeTrue("Cannot setup file times for test", | |||
| assumeTrue("Cannot setup file times for test", | |||
| selectorRule.getMirrorFiles()[i].setLastModified(testtime + (3 * 60 * 60 * 100))); | |||
| } | |||
| @@ -42,7 +42,6 @@ import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; | |||
| import org.apache.tools.ant.types.selectors.modifiedselector.PropertiesfileCache; | |||
| import org.apache.tools.ant.util.FileUtils; | |||
| import org.apache.tools.ant.util.StringUtils; | |||
| import org.junit.Assume; | |||
| import org.junit.Before; | |||
| import org.junit.Ignore; | |||
| import org.junit.Rule; | |||
| @@ -54,6 +53,7 @@ import static org.junit.Assert.assertNotEquals; | |||
| import static org.junit.Assert.assertNotNull; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.junit.Assert.fail; | |||
| import static org.junit.Assume.assumeNotNull; | |||
| /** | |||
| @@ -172,7 +172,7 @@ public class ModifiedSelectorTest { | |||
| @Test | |||
| public void testCustomClasses() { | |||
| Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home")); | |||
| assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home")); | |||
| BFT bft = new BFT(); | |||
| bft.setUp(); | |||
| // don't catch the JUnit exceptions | |||
| @@ -584,7 +584,7 @@ public class ModifiedSelectorTest { | |||
| @Test | |||
| public void testResourceSelectorScenarioSimple() { | |||
| Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home")); | |||
| assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home")); | |||
| BFT bft = new BFT(); | |||
| bft.doTarget("modifiedselectortest-scenario-resourceSimple"); | |||
| bft.doTarget("modifiedselectortest-scenario-clean"); | |||
| @@ -804,19 +804,19 @@ public class ModifiedSelectorTest { | |||
| @Test | |||
| public void testScenarioCoreSelectorDefaults() { | |||
| Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home")); | |||
| assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home")); | |||
| doScenarioTest("modifiedselectortest-scenario-coreselector-defaults", "cache.properties"); | |||
| } | |||
| @Test | |||
| public void testScenarioCoreSelectorSettings() { | |||
| Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home")); | |||
| assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home")); | |||
| doScenarioTest("modifiedselectortest-scenario-coreselector-settings", "core.cache.properties"); | |||
| } | |||
| @Test | |||
| public void testScenarioCustomSelectorSettings() { | |||
| Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home")); | |||
| assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home")); | |||
| doScenarioTest("modifiedselectortest-scenario-customselector-settings", "core.cache.properties"); | |||
| } | |||
| @@ -20,13 +20,13 @@ package org.apache.tools.ant.types.selectors; | |||
| import static org.junit.Assert.assertEquals; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.junit.Assume.assumeFalse; | |||
| import java.io.File; | |||
| import java.nio.file.Files; | |||
| import java.nio.file.attribute.UserPrincipal; | |||
| import org.apache.tools.ant.taskdefs.condition.Os; | |||
| import org.junit.Assume; | |||
| import org.junit.Rule; | |||
| import org.junit.Test; | |||
| import org.junit.rules.TemporaryFolder; | |||
| @@ -39,7 +39,7 @@ public class OwnedBySelectorTest { | |||
| @Test | |||
| public void ownedByIsTrueForSelf() throws Exception { | |||
| // at least on Jenkins the file is owned by "BUILTIN\Administrators" | |||
| Assume.assumeFalse(Os.isFamily("windows")); | |||
| assumeFalse(Os.isFamily("windows")); | |||
| String self = System.getProperty("user.name"); | |||
| File file = folder.newFile("f.txt"); | |||
| UserPrincipal user = Files.getOwner(file.toPath()); | |||
| @@ -20,7 +20,6 @@ package org.apache.tools.ant.util; | |||
| import java.io.File; | |||
| import org.apache.tools.ant.taskdefs.condition.Os; | |||
| import org.junit.Assume; | |||
| import org.junit.Test; | |||
| import static org.junit.Assert.assertEquals; | |||
| @@ -37,7 +36,7 @@ public class JavaEnvUtilsTest { | |||
| @Test | |||
| public void testGetExecutableNetware() { | |||
| Assume.assumeTrue("Test only runs on netware", Os.isName("netware")); | |||
| assumeTrue("Test only runs on netware", Os.isName("netware")); | |||
| assertEquals("java", JavaEnvUtils.getJreExecutable("java")); | |||
| assertEquals("javac", JavaEnvUtils.getJdkExecutable("javac")); | |||
| assertEquals("foo", JavaEnvUtils.getJreExecutable("foo")); | |||
| @@ -46,7 +45,7 @@ public class JavaEnvUtilsTest { | |||
| @Test | |||
| public void testGetExecutableWindows() { | |||
| Assume.assumeTrue("Test only runs on windows", Os.isFamily("windows")); | |||
| assumeTrue("Test only runs on windows", Os.isFamily("windows")); | |||
| String javaHome = FILE_UTILS.normalize(System.getProperty("java.home")) | |||
| .getAbsolutePath(); | |||
| @@ -83,7 +82,7 @@ public class JavaEnvUtilsTest { | |||
| @Test | |||
| public void testGetExecutableMostPlatforms() { | |||
| Assume.assumeTrue("Test only runs on non Netware and non Windows systems", | |||
| assumeTrue("Test only runs on non Netware and non Windows systems", | |||
| !Os.isName("netware") && !Os.isFamily("windows")); | |||
| String javaHome = FILE_UTILS.normalize(System.getProperty("java.home")).getAbsolutePath(); | |||
| @@ -19,6 +19,7 @@ | |||
| package org.apache.tools.ant.util; | |||
| import static org.junit.Assert.assertEquals; | |||
| import static org.junit.Assume.assumeNotNull; | |||
| import java.io.File; | |||
| import java.io.FileOutputStream; | |||
| @@ -36,7 +37,6 @@ import org.apache.tools.tar.TarEntry; | |||
| import org.apache.tools.tar.TarOutputStream; | |||
| import org.apache.tools.zip.ZipEntry; | |||
| import org.apache.tools.zip.ZipOutputStream; | |||
| import org.junit.Assume; | |||
| import org.junit.Test; | |||
| public class PermissionUtilsTest { | |||
| @@ -103,8 +103,8 @@ public class PermissionUtilsTest { | |||
| public void getSetPermissionsWorksForFiles() throws IOException { | |||
| File f = File.createTempFile("ant", ".tst"); | |||
| f.deleteOnExit(); | |||
| Assume.assumeNotNull(Files.getFileAttributeView(f.toPath(), | |||
| PosixFileAttributeView.class)); | |||
| assumeNotNull(Files.getFileAttributeView(f.toPath(), | |||
| PosixFileAttributeView.class)); | |||
| Set<PosixFilePermission> s = | |||
| EnumSet.of(PosixFilePermission.OWNER_READ, | |||
| PosixFilePermission.OWNER_WRITE, | |||
| @@ -19,11 +19,11 @@ | |||
| package org.apache.tools.ant.util; | |||
| import static org.junit.Assert.assertFalse; | |||
| import static org.junit.Assume.assumeFalse; | |||
| import java.io.IOException; | |||
| import org.apache.tools.ant.taskdefs.condition.Os; | |||
| import org.junit.Assume; | |||
| import org.junit.Test; | |||
| public class SymlinkUtilsTest { | |||
| @@ -33,7 +33,7 @@ public class SymlinkUtilsTest { | |||
| @Test | |||
| public void testRootIsNoSymlink() throws IOException { | |||
| Assume.assumeFalse("Symlink doesn't work on Windows", Os.isFamily("windows")); | |||
| assumeFalse("Symlink doesn't work on Windows", Os.isFamily("windows")); | |||
| assertFalse(SYMLINK_UTILS.isSymbolicLink("/")); | |||
| } | |||
| @@ -18,12 +18,12 @@ | |||
| package org.example.junit; | |||
| import org.junit.Assume; | |||
| import org.junit.Ignore; | |||
| import org.junit.Test; | |||
| import static org.junit.Assert.assertTrue; | |||
| import static org.junit.Assert.fail; | |||
| import static org.junit.Assume.assumeFalse; | |||
| public class JUnit4Skippable { | |||
| @@ -40,7 +40,7 @@ public class JUnit4Skippable { | |||
| @Test | |||
| public void implicitlyIgnoreTest() { | |||
| Assume.assumeFalse("This test will be ignored", true); | |||
| assumeFalse("This test will be ignored", true); | |||
| fail("I told you, this test should have been ignored!"); | |||
| } | |||
| @@ -52,7 +52,7 @@ public class JUnit4Skippable { | |||
| @Test | |||
| public void implicitlyIgnoreTestNoMessage() { | |||
| Assume.assumeFalse(true); | |||
| assumeFalse(true); | |||
| fail("I told you, this test should have been ignored!"); | |||
| } | |||