Browse Source

Import assumptions statically

master
Gintas Grigelionis 7 years ago
parent
commit
805b6eb058
24 changed files with 135 additions and 137 deletions
  1. +9
    -9
      src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java
  2. +4
    -4
      src/tests/junit/org/apache/tools/ant/taskdefs/AntlibTest.java
  3. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java
  4. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java
  5. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java
  6. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
  7. +3
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java
  8. +9
    -7
      src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
  9. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java
  10. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java
  11. +3
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java
  12. +9
    -9
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/TraXLiaisonTest.java
  13. +3
    -4
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
  14. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
  15. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
  16. +55
    -55
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
  17. +2
    -2
      src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java
  18. +3
    -5
      src/tests/junit/org/apache/tools/ant/types/selectors/DateSelectorTest.java
  19. +6
    -6
      src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
  20. +2
    -2
      src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
  21. +3
    -4
      src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
  22. +3
    -3
      src/tests/junit/org/apache/tools/ant/util/PermissionUtilsTest.java
  23. +2
    -2
      src/tests/junit/org/apache/tools/ant/util/SymlinkUtilsTest.java
  24. +3
    -3
      src/tests/junit/org/example/junit/JUnit4Skippable.java

+ 9
- 9
src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java View File

@@ -22,6 +22,7 @@ import static org.apache.tools.ant.AntAssert.assertContains;
import static org.apache.tools.ant.AntAssert.assertNotContains; import static org.apache.tools.ant.AntAssert.assertNotContains;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;


import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
@@ -29,7 +30,6 @@ import java.io.Reader;


import org.apache.tools.ant.BuildFileRule; import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@@ -115,7 +115,7 @@ public class TokenFilterTest {
public void testReplaceRegex() throws IOException { public void testReplaceRegex() throws IOException {


buildRule.executeTarget("hasregex"); buildRule.executeTarget("hasregex");
Assume.assumeTrue("Regex not present",
assumeTrue("Regex not present",
getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world")); getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world"));


buildRule.executeTarget("replaceregex"); buildRule.executeTarget("replaceregex");
@@ -131,7 +131,7 @@ public class TokenFilterTest {
@Test @Test
public void testFilterReplaceRegex() throws IOException { public void testFilterReplaceRegex() throws IOException {
buildRule.executeTarget("hasregex"); buildRule.executeTarget("hasregex");
Assume.assumeTrue("Regex not present",
assumeTrue("Regex not present",
getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world")); getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world"));


buildRule.executeTarget("filterreplaceregex"); buildRule.executeTarget("filterreplaceregex");
@@ -143,7 +143,7 @@ public class TokenFilterTest {
@Test @Test
public void testHandleDollerMatch() throws IOException { public void testHandleDollerMatch() throws IOException {
buildRule.executeTarget("hasregex"); 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"); buildRule.executeTarget("dollermatch");
} }
@@ -183,7 +183,7 @@ public class TokenFilterTest {
@Test @Test
public void testContainsRegex() throws IOException { public void testContainsRegex() throws IOException {
buildRule.executeTarget("hasregex"); 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"); //expectFileContains(buildRule.getProject().getProperty("output") + "/replaceregexp", "bye world");


@@ -197,7 +197,7 @@ public class TokenFilterTest {
@Test @Test
public void testFilterContainsRegex() throws IOException { public void testFilterContainsRegex() throws IOException {
buildRule.executeTarget("hasregex"); 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"); buildRule.executeTarget("filtercontainsregex");
String contents = getFileString(buildRule.getProject().getProperty("output") + "/filtercontainsregex"); String contents = getFileString(buildRule.getProject().getProperty("output") + "/filtercontainsregex");
@@ -209,7 +209,7 @@ public class TokenFilterTest {
@Test @Test
public void testContainsRegex2() throws IOException { public void testContainsRegex2() throws IOException {
buildRule.executeTarget("hasregex"); 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"); buildRule.executeTarget("containsregex2");
String contents = getFileString(buildRule.getProject().getProperty("output") + "/containsregex2"); String contents = getFileString(buildRule.getProject().getProperty("output") + "/containsregex2");
@@ -227,7 +227,7 @@ public class TokenFilterTest {


@Test @Test
public void testScriptFilter() throws IOException { 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.getProject().getTargets().contains("testScriptFilter"));
buildRule.executeTarget("scriptfilter"); buildRule.executeTarget("scriptfilter");
assertContains("HELLO WORLD", getFileString(buildRule.getProject().getProperty("output") + "/scriptfilter")); assertContains("HELLO WORLD", getFileString(buildRule.getProject().getProperty("output") + "/scriptfilter"));
@@ -236,7 +236,7 @@ public class TokenFilterTest {


@Test @Test
public void testScriptFilter2() throws IOException { 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"); buildRule.executeTarget("scriptfilter2");
assertContains("HELLO MOON", getFileString(buildRule.getProject().getProperty("output") + "/scriptfilter2")); assertContains("HELLO MOON", getFileString(buildRule.getProject().getProperty("output") + "/scriptfilter2"));
} }


+ 4
- 4
src/tests/junit/org/apache/tools/ant/taskdefs/AntlibTest.java View File

@@ -21,12 +21,12 @@ package org.apache.tools.ant.taskdefs;
import org.apache.tools.ant.BuildFileRule; import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;


import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue;


/** /**
*/ */
@@ -74,19 +74,19 @@ public class AntlibTest {


@Test @Test
public void testAntlib_uri() { public void testAntlib_uri() {
Assume.assumeTrue("Test requires shared JVM", isSharedJVM());
assumeTrue("Test requires shared JVM", isSharedJVM());
buildRule.executeTarget("antlib_uri"); buildRule.executeTarget("antlib_uri");
} }


@Test @Test
public void testAntlib_uri_auto() { public void testAntlib_uri_auto() {
Assume.assumeTrue("Test requires shared JVM", isSharedJVM());
assumeTrue("Test requires shared JVM", isSharedJVM());
buildRule.executeTarget("antlib_uri_auto"); buildRule.executeTarget("antlib_uri_auto");
} }


@Test @Test
public void testAntlib_uri_auto2() { public void testAntlib_uri_auto2() {
Assume.assumeTrue("Test requires shared JVM", isSharedJVM());
assumeTrue("Test requires shared JVM", isSharedJVM());
buildRule.executeTarget("antlib_uri_auto2"); buildRule.executeTarget("antlib_uri_auto2");
} }




+ 2
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java View File

@@ -20,11 +20,11 @@ package org.apache.tools.ant.taskdefs;


import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.junit.Assume.assumeFalse;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule; import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.taskdefs.condition.Os; import org.apache.tools.ant.taskdefs.condition.Os;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@@ -73,7 +73,7 @@ public class DirnameTest {


@Test @Test
public void test4() { 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"); buildRule.executeTarget("test4");
String filesep = System.getProperty("file.separator"); String filesep = System.getProperty("file.separator");
String expected = filesep + "usr" + filesep + "local"; String expected = filesep + "usr" + filesep + "local";


+ 2
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java View File

@@ -19,6 +19,7 @@
package org.apache.tools.ant.taskdefs; package org.apache.tools.ant.taskdefs;


import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeNotNull;


import java.io.File; import java.io.File;
import java.util.GregorianCalendar; 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.Project;
import org.apache.tools.ant.ProjectHelper; import org.apache.tools.ant.ProjectHelper;
import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Rule; import org.junit.Rule;
@@ -68,7 +68,7 @@ public class ExecTaskTest {
@Test @Test
public void testspawn() throws InterruptedException { public void testspawn() throws InterruptedException {
buildRule.getProject().executeTarget("setUp"); 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"); myBuild = new MonitoredBuild(new File(System.getProperty("root"), BUILD_FILE), "spawn");
logFile = FILE_UTILS.createTempFile("spawn", "log", new File(buildRule.getProject().getProperty("output")), logFile = FILE_UTILS.createTempFile("spawn", "log", new File(buildRule.getProject().getProperty("output")),
false, false); false, false);


+ 2
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java View File

@@ -23,6 +23,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;


import java.io.File; import java.io.File;
import java.io.IOException; 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.BuildFileRule;
import org.apache.tools.ant.Location; import org.apache.tools.ant.Location;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.junit.Assume;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@@ -138,7 +138,7 @@ public class ImportTest {
if (!new File(ln).exists()) { if (!new File(ln).exists()) {
ln = "/bin/ln"; 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"; String symlink = "src/etc/testcases/taskdefs/import/symlinks/d3b";
File symlinkFile = new File(System.getProperty("root"), symlink); File symlinkFile = new File(System.getProperty("root"), symlink);
if (Runtime.getRuntime().exec(new String[] {ln, "-s", "d3a", symlinkFile.getAbsolutePath()}).waitFor() != 0) { if (Runtime.getRuntime().exec(new String[] {ln, "-s", "d3a", symlinkFile.getAbsolutePath()}).waitFor() != 0) {


+ 2
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java View File

@@ -34,7 +34,6 @@ import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.FileUtilities; import org.apache.tools.ant.FileUtilities;
import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;
import org.junit.After; import org.junit.After;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; 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.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; 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); File jarFile = new File(getOutputDir(), tempJar);


// move the modified date back a couple of seconds rather than delay the test on each run // 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)); - FileUtils.getFileUtils().getFileTimestampGranularity() * 3));
long jarModifiedDate = jarFile.lastModified(); long jarModifiedDate = jarFile.lastModified();




+ 3
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java View File

@@ -34,7 +34,6 @@ import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.input.DefaultInputHandler; import org.apache.tools.ant.input.DefaultInputHandler;
import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.TeeOutputStream; import org.apache.tools.ant.util.TeeOutputStream;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; 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.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;


/** /**
* stress out java task * stress out java task
@@ -220,13 +220,13 @@ public class JavaTest {
*/ */
@Test @Test
public void testRunFail() { 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"); buildRule.executeTarget("testRunFail");
} }


@Test @Test
public void testRunFailFoe() { 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 { try {
buildRule.executeTarget("testRunFailFoe"); buildRule.executeTarget("testRunFailFoe");
fail("Build exception should have been thrown - " + "java failures being propagated"); fail("Build exception should have been thrown - " + "java failures being propagated");


+ 9
- 7
src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java View File

@@ -21,6 +21,9 @@ import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail; 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.File;
import java.io.IOException; 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.BuildFileRule;
import org.apache.tools.ant.taskdefs.condition.Os; import org.apache.tools.ant.taskdefs.condition.Os;
import org.apache.tools.ant.util.regexp.RegexpMatcherFactory; import org.apache.tools.ant.util.regexp.RegexpMatcherFactory;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@@ -145,7 +147,7 @@ public class ManifestClassPathTest {


@Test @Test
public void testPseudoTahoeRefid() { 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"); buildRule.executeTarget("test-pseudo-tahoe-refid");
assertEquals(buildRule.getProject().getProperty("jar.classpath"), "classes/dsp-core/ " assertEquals(buildRule.getProject().getProperty("jar.classpath"), "classes/dsp-core/ "
@@ -158,7 +160,7 @@ public class ManifestClassPathTest {


@Test @Test
public void testPseudoTahoeNested() { 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"); buildRule.executeTarget("test-pseudo-tahoe-nested");
assertEquals(buildRule.getProject().getProperty("jar.classpath"), "classes/dsp-core/ " assertEquals(buildRule.getProject().getProperty("jar.classpath"), "classes/dsp-core/ "
@@ -195,7 +197,7 @@ public class ManifestClassPathTest {


@Test @Test
public void testInternationalHebrew() { 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("international-hebrew");
buildRule.executeTarget("run-two-jars"); buildRule.executeTarget("run-two-jars");
assertContains("beta alpha", buildRule.getLog()); assertContains("beta alpha", buildRule.getLog());
@@ -203,14 +205,14 @@ public class ManifestClassPathTest {


@Test @Test
public void testSameWindowsDrive() { 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"); buildRule.executeTarget("testSameDrive");
assertEquals(buildRule.getProject().getProperty("cp"), "../a/b/x.jar"); assertEquals(buildRule.getProject().getProperty("cp"), "../a/b/x.jar");
} }


@Test @Test
public void testDifferentWindowsDrive() { 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 // 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 C will try to use D
// if the temp dir is on D or other will try to use C // 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(); new File(altDriveLetter + ":/foo.txt").getCanonicalPath();
} catch (IOException e) { } 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); buildRule.getProject().setProperty("altDriveLetter", altDriveLetter);




+ 2
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java View File

@@ -22,11 +22,11 @@ import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.junit.Assume.assumeNoException;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule; import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@@ -128,7 +128,7 @@ public class PropertyTest {
try { try {
Class.forName("java.lang.Iterable"); Class.forName("java.lang.Iterable");
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
Assume.assumeNoException("XML Loading only on Java 5+", e);
assumeNoException("XML Loading only on Java 5+", e);
} }
buildRule.executeTarget("testXmlProperty"); buildRule.executeTarget("testXmlProperty");
assertEquals("ONE", buildRule.getProject().getProperty("xml.one")); assertEquals("ONE", buildRule.getProject().getProperty("xml.one"));


+ 2
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java View File

@@ -22,7 +22,6 @@ import java.io.File;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule; import org.apache.tools.ant.BuildFileRule;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; 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.assertNotEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.junit.Assume.assumeFalse;


/** /**
* Testcase for the Signjar task * Testcase for the Signjar task
@@ -100,7 +100,7 @@ public class SignJarTest {


@Test @Test
public void testURLKeystoreHTTP() { public void testURLKeystoreHTTP() {
Assume.assumeFalse("Test is set offline", isOffline());
assumeFalse("Test is set offline", isOffline());
buildRule.executeTarget("urlKeystoreHTTP"); buildRule.executeTarget("urlKeystoreHTTP");
} }




+ 3
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java View File

@@ -19,7 +19,6 @@ package org.apache.tools.ant.taskdefs.optional;


import org.apache.tools.ant.BuildFileRule; import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.util.JavaEnvUtils; import org.apache.tools.ant.util.JavaEnvUtils;
import org.junit.Assume;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
@@ -28,6 +27,7 @@ import org.junit.Test;
import java.io.File; import java.io.File;


import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;


public class JavahTest { public class JavahTest {


@@ -48,7 +48,7 @@ public class JavahTest {


@Test @Test
public void testSimpleCompile() { public void testSimpleCompile() {
Assume.assumeFalse(JavaEnvUtils.isAtLeastJavaVersion("10"));
assumeFalse(JavaEnvUtils.isAtLeastJavaVersion("10"));
buildRule.executeTarget("simple-compile"); buildRule.executeTarget("simple-compile");
assertTrue(new File(buildRule.getProject().getProperty("output"), "org_example_Foo.h") assertTrue(new File(buildRule.getProject().getProperty("output"), "org_example_Foo.h")
.exists()); .exists());
@@ -56,7 +56,7 @@ public class JavahTest {


@Test @Test
public void testCompileFileset() { public void testCompileFileset() {
Assume.assumeFalse(JavaEnvUtils.isAtLeastJavaVersion("10"));
assumeFalse(JavaEnvUtils.isAtLeastJavaVersion("10"));
buildRule.executeTarget("test-fileset"); 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());
} }


+ 9
- 9
src/tests/junit/org/apache/tools/ant/taskdefs/optional/TraXLiaisonTest.java View File

@@ -19,6 +19,9 @@
package org.apache.tools.ant.taskdefs.optional; package org.apache.tools.ant.taskdefs.optional;


import static org.junit.Assert.assertTrue; 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.ByteArrayInputStream;
import java.io.File; 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.taskdefs.XSLTLogger;
import org.apache.tools.ant.util.JAXPUtils; import org.apache.tools.ant.util.JAXPUtils;
import org.junit.After; import org.junit.After;
import org.junit.Assume;
import org.junit.Test; import org.junit.Test;


/** /**
@@ -59,13 +61,12 @@ public class TraXLiaisonTest extends AbstractXSLTLiaisonTest implements XSLTLogg
try { try {
getClass().getClassLoader().loadClass("org.apache.xalan.lib.Redirect"); getClass().getClassLoader().loadClass("org.apache.xalan.lib.Redirect");
} catch (Exception exc) { } catch (Exception exc) {
Assume.assumeNoException("xalan redirect is not on the classpath", exc);
assumeNoException("xalan redirect is not on the classpath", exc);
} }
try { try {
String factoryName = TransformerFactory.newInstance().getClass().getName(); 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) { } catch (TransformerFactoryConfigurationError exc) {
throw new RuntimeException(exc); throw new RuntimeException(exc);
} }
@@ -106,13 +107,12 @@ public class TraXLiaisonTest extends AbstractXSLTLiaisonTest implements XSLTLogg
try { try {
getClass().getClassLoader().loadClass("org.apache.xalan.lib.Redirect"); getClass().getClassLoader().loadClass("org.apache.xalan.lib.Redirect");
} catch (Exception exc) { } catch (Exception exc) {
Assume.assumeNoException("xalan redirect is not on the classpath", exc);
assumeNoException("xalan redirect is not on the classpath", exc);
} }
try { try {
String factoryName = TransformerFactory.newInstance().getClass().getName(); 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) { } catch (TransformerFactoryConfigurationError exc) {
throw new RuntimeException(exc); throw new RuntimeException(exc);
} }


+ 3
- 4
src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java View File

@@ -21,6 +21,7 @@ package org.apache.tools.ant.taskdefs.optional.junit;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.apache.tools.ant.AntAssert.assertContains; import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assume.assumeTrue;


import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
@@ -35,7 +36,6 @@ import javax.xml.transform.TransformerFactoryConfigurationError;


import org.apache.tools.ant.BuildFileRule; import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@@ -187,9 +187,8 @@ public class JUnitReportTest {
public void testWithSecurityManagerAndXalanFactory() throws Exception { public void testWithSecurityManagerAndXalanFactory() throws Exception {
try { try {
String factoryName = TransformerFactory.newInstance().getClass().getName(); 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) { } catch (TransformerFactoryConfigurationError exc) {
throw new RuntimeException(exc); throw new RuntimeException(exc);
} }


+ 2
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java View File

@@ -22,6 +22,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue; 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.assertNotContains;
import static org.apache.tools.ant.AntAssert.assertContains; 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.types.Path;
import org.apache.tools.ant.util.JavaEnvUtils; import org.apache.tools.ant.util.JavaEnvUtils;
import org.apache.tools.ant.util.LoaderUtils; import org.apache.tools.ant.util.LoaderUtils;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@@ -140,7 +140,7 @@ public class JUnitTaskTest {
if (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_5)) { if (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_5)) {
try { try {
Class<?> clazz = Class.forName("junit.framework.JUnit4TestAdapter"); 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) { } catch (ClassNotFoundException e) {
// OK, this is JUnit3, can run test // OK, this is JUnit3, can run test
} }


+ 2
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java View File

@@ -19,6 +19,7 @@
package org.apache.tools.ant.taskdefs.optional.junit; package org.apache.tools.ant.taskdefs.optional.junit;


import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeNoException;


import java.io.File; import java.io.File;
import java.io.FileOutputStream; 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.Project;
import org.apache.tools.ant.taskdefs.Delete; import org.apache.tools.ant.taskdefs.Delete;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;
import org.junit.Assume;
import org.junit.Test; import org.junit.Test;


public class XMLResultAggregatorTest { public class XMLResultAggregatorTest {
@@ -40,7 +40,7 @@ public class XMLResultAggregatorTest {
try { try {
Class.forName("java.nio.file.Files"); Class.forName("java.nio.file.Files");
} catch (ClassNotFoundException x) { } 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"); final File d = new File(System.getProperty("java.io.tmpdir"), "XMLResultAggregatorTest");
if (d.exists()) { if (d.exists()) {


+ 55
- 55
src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java View File

@@ -21,6 +21,7 @@ import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;


import java.io.File; import java.io.File;
import java.io.IOException; 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.RegexpMatcher;
import org.apache.tools.ant.util.regexp.RegexpMatcherFactory; import org.apache.tools.ant.util.regexp.RegexpMatcherFactory;
import org.junit.After; import org.junit.After;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@@ -127,8 +127,8 @@ public class FTPTest {


@Test @Test
public void test1() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
@@ -139,8 +139,8 @@ public class FTPTest {


@Test @Test
public void test2() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/"}); ds.setIncludes(new String[] {"alpha/"});
@@ -151,8 +151,8 @@ public class FTPTest {


@Test @Test
public void test3() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.scan(); ds.scan();
@@ -162,8 +162,8 @@ public class FTPTest {


@Test @Test
public void testFullPathMatchesCaseSensitive() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"}); ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"});
@@ -173,8 +173,8 @@ public class FTPTest {


@Test @Test
public void testFullPathMatchesCaseInsensitive() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setCaseSensitive(false); ds.setCaseSensitive(false);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
@@ -185,8 +185,8 @@ public class FTPTest {


@Test @Test
public void test2ButCaseInsensitive() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"ALPHA/"}); ds.setIncludes(new String[] {"ALPHA/"});
@@ -198,8 +198,8 @@ public class FTPTest {


@Test @Test
public void test2bisButCaseInsensitive() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/BETA/gamma/"}); ds.setIncludes(new String[] {"alpha/BETA/gamma/"});
@@ -234,9 +234,9 @@ public class FTPTest {


@Test @Test
public void testGetFollowSymlinksTrue() { 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"); buildRule.getProject().executeTarget("ftp-get-directory-symbolic-link");
FileSet fsDestination = buildRule.getProject().getReference("fileset-destination-without-selector"); FileSet fsDestination = buildRule.getProject().getReference("fileset-destination-without-selector");
DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject()); DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject());
@@ -247,9 +247,9 @@ public class FTPTest {


@Test @Test
public void testGetFollowSymlinksFalse() { 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"); buildRule.getProject().executeTarget("ftp-get-directory-no-symbolic-link");
FileSet fsDestination = buildRule.getProject().getReference("fileset-destination-without-selector"); FileSet fsDestination = buildRule.getProject().getReference("fileset-destination-without-selector");
DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject()); DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject());
@@ -259,9 +259,9 @@ public class FTPTest {


@Test @Test
public void testAllowSymlinks() { 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"); buildRule.getProject().executeTarget("symlink-setup");
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
@@ -274,9 +274,9 @@ public class FTPTest {


@Test @Test
public void testProhibitSymlinks() { 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"); buildRule.getProject().executeTarget("symlink-setup");
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
@@ -288,9 +288,9 @@ public class FTPTest {


@Test @Test
public void testFileSymlink() { 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"); buildRule.getProject().executeTarget("symlink-file-setup");
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
@@ -304,8 +304,8 @@ public class FTPTest {
// father and child pattern test // father and child pattern test
@Test @Test
public void testOrderOfIncludePatternsIrrelevant() { 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[] expectedFiles = {"alpha/beta/beta.xml", "alpha/beta/gamma/gamma.xml"};
String[] expectedDirectories = {"alpha/beta", "alpha/beta/gamma" }; String[] expectedDirectories = {"alpha/beta", "alpha/beta/gamma" };
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
@@ -323,8 +323,8 @@ public class FTPTest {


@Test @Test
public void testPatternsDifferInCaseScanningSensitive() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/", "ALPHA/"}); ds.setIncludes(new String[] {"alpha/", "ALPHA/"});
@@ -335,8 +335,8 @@ public class FTPTest {


@Test @Test
public void testPatternsDifferInCaseScanningInsensitive() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/", "ALPHA/"}); ds.setIncludes(new String[] {"alpha/", "ALPHA/"});
@@ -348,8 +348,8 @@ public class FTPTest {


@Test @Test
public void testFullpathDiffersInCaseScanningSensitive() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/beta/gamma/gamma.xml", "alpha/beta/gamma/GAMMA.XML"}); ds.setIncludes(new String[] {"alpha/beta/gamma/gamma.xml", "alpha/beta/gamma/GAMMA.XML"});
@@ -359,8 +359,8 @@ public class FTPTest {


@Test @Test
public void testFullpathDiffersInCaseScanningInsensitive() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] { ds.setIncludes(new String[] {
@@ -375,8 +375,8 @@ public class FTPTest {


@Test @Test
public void testParentDiffersInCaseScanningSensitive() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"}); ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"});
@@ -388,8 +388,8 @@ public class FTPTest {


@Test @Test
public void testParentDiffersInCaseScanningInsensitive() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"}); ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"});
@@ -401,8 +401,8 @@ public class FTPTest {


@Test @Test
public void testExcludeOneFile() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"**/*.xml"}); ds.setIncludes(new String[] {"**/*.xml"});
@@ -413,8 +413,8 @@ public class FTPTest {


@Test @Test
public void testExcludeHasPrecedence() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/**"}); ds.setIncludes(new String[] {"alpha/**"});
@@ -425,8 +425,8 @@ public class FTPTest {


@Test @Test
public void testAlternateIncludeExclude() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/**", "alpha/beta/gamma/**"}); ds.setIncludes(new String[] {"alpha/**", "alpha/beta/gamma/**"});
@@ -437,8 +437,8 @@ public class FTPTest {


@Test @Test
public void testAlternateExcludeInclude() { 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); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setExcludes(new String[] {"alpha/**", "alpha/beta/gamma/**"}); ds.setExcludes(new String[] {"alpha/**", "alpha/beta/gamma/**"});
@@ -452,8 +452,8 @@ public class FTPTest {
*/ */
@Test @Test
public void testChildrenOfExcludedDirectory() { 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"); buildRule.getProject().executeTarget("children-of-excluded-dir-setup");
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp); FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp")); 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"}); compareFiles(ds, new String[] {"delta/delta.xml"}, new String[] {"delta"});


ds = myFTPTask.newScanner(ftp); 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.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setExcludes(new String[] {"alpha"}); ds.setExcludes(new String[] {"alpha"});
ds.scan(); ds.scan();


+ 2
- 2
src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java View File

@@ -19,13 +19,13 @@ package org.apache.tools.ant.types;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule; import org.apache.tools.ant.BuildFileRule;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;


import static org.apache.tools.ant.AntAssert.assertContains; import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.junit.Assume.assumeFalse;


/** /**
* test assertion handling * test assertion handling
@@ -111,7 +111,7 @@ public class AssertionsTest {


@Test @Test
public void testNofork() { 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"); buildRule.executeTarget("test-nofork");
assertContains("Assertion statements are currently ignored in non-forked mode", buildRule.getLog()); assertContains("Assertion statements are currently ignored in non-forked mode", buildRule.getLog());
} }


+ 3
- 5
src/tests/junit/org/apache/tools/ant/types/selectors/DateSelectorTest.java View File

@@ -20,13 +20,12 @@ package org.apache.tools.ant.types.selectors;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.types.Parameter; import org.apache.tools.ant.types.Parameter;
import org.junit.Assume;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;


import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;


/** /**
* Tests Date Selectors. * Tests Date Selectors.
@@ -37,7 +36,6 @@ public class DateSelectorTest {
@Rule @Rule
public final BaseSelectorRule selectorRule = new BaseSelectorRule(); public final BaseSelectorRule selectorRule = new BaseSelectorRule();



/** /**
* Test the code that validates the selector. * 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 // 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 // files don't exist so can't be changed, so don't try and loop over them
for (int i = 1; i <= 2; i++) { 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))); selectorRule.getMirrorFiles()[i].setLastModified(testtime - (3 * 60 * 60 * 100)));
} }


@@ -225,7 +223,7 @@ public class DateSelectorTest {
s.setWhen(before); s.setWhen(before);
s.setGranularity(2); s.setGranularity(2);
for (int i = 7; i <= 10; i++) { 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))); selectorRule.getMirrorFiles()[i].setLastModified(testtime + (3 * 60 * 60 * 100)));
} }




+ 6
- 6
src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java View File

@@ -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.types.selectors.modifiedselector.PropertiesfileCache;
import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.StringUtils; import org.apache.tools.ant.util.StringUtils;
import org.junit.Assume;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Rule; 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.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.junit.Assume.assumeNotNull;




/** /**
@@ -172,7 +172,7 @@ public class ModifiedSelectorTest {


@Test @Test
public void testCustomClasses() { 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 bft = new BFT();
bft.setUp(); bft.setUp();
// don't catch the JUnit exceptions // don't catch the JUnit exceptions
@@ -584,7 +584,7 @@ public class ModifiedSelectorTest {
@Test @Test
public void testResourceSelectorScenarioSimple() { 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 bft = new BFT();
bft.doTarget("modifiedselectortest-scenario-resourceSimple"); bft.doTarget("modifiedselectortest-scenario-resourceSimple");
bft.doTarget("modifiedselectortest-scenario-clean"); bft.doTarget("modifiedselectortest-scenario-clean");
@@ -804,19 +804,19 @@ public class ModifiedSelectorTest {


@Test @Test
public void testScenarioCoreSelectorDefaults() { 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"); doScenarioTest("modifiedselectortest-scenario-coreselector-defaults", "cache.properties");
} }


@Test @Test
public void testScenarioCoreSelectorSettings() { 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"); doScenarioTest("modifiedselectortest-scenario-coreselector-settings", "core.cache.properties");
} }


@Test @Test
public void testScenarioCustomSelectorSettings() { 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"); doScenarioTest("modifiedselectortest-scenario-customselector-settings", "core.cache.properties");
} }




+ 2
- 2
src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java View File

@@ -20,13 +20,13 @@ package org.apache.tools.ant.types.selectors;


import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;


import java.io.File; import java.io.File;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.attribute.UserPrincipal; import java.nio.file.attribute.UserPrincipal;


import org.apache.tools.ant.taskdefs.condition.Os; import org.apache.tools.ant.taskdefs.condition.Os;
import org.junit.Assume;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TemporaryFolder; import org.junit.rules.TemporaryFolder;
@@ -39,7 +39,7 @@ public class OwnedBySelectorTest {
@Test @Test
public void ownedByIsTrueForSelf() throws Exception { public void ownedByIsTrueForSelf() throws Exception {
// at least on Jenkins the file is owned by "BUILTIN\Administrators" // 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"); String self = System.getProperty("user.name");
File file = folder.newFile("f.txt"); File file = folder.newFile("f.txt");
UserPrincipal user = Files.getOwner(file.toPath()); UserPrincipal user = Files.getOwner(file.toPath());


+ 3
- 4
src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java View File

@@ -20,7 +20,6 @@ package org.apache.tools.ant.util;
import java.io.File; import java.io.File;


import org.apache.tools.ant.taskdefs.condition.Os; import org.apache.tools.ant.taskdefs.condition.Os;
import org.junit.Assume;
import org.junit.Test; import org.junit.Test;


import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@@ -37,7 +36,7 @@ public class JavaEnvUtilsTest {


@Test @Test
public void testGetExecutableNetware() { 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("java", JavaEnvUtils.getJreExecutable("java"));
assertEquals("javac", JavaEnvUtils.getJdkExecutable("javac")); assertEquals("javac", JavaEnvUtils.getJdkExecutable("javac"));
assertEquals("foo", JavaEnvUtils.getJreExecutable("foo")); assertEquals("foo", JavaEnvUtils.getJreExecutable("foo"));
@@ -46,7 +45,7 @@ public class JavaEnvUtilsTest {


@Test @Test
public void testGetExecutableWindows() { 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")) String javaHome = FILE_UTILS.normalize(System.getProperty("java.home"))
.getAbsolutePath(); .getAbsolutePath();


@@ -83,7 +82,7 @@ public class JavaEnvUtilsTest {


@Test @Test
public void testGetExecutableMostPlatforms() { 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")); !Os.isName("netware") && !Os.isFamily("windows"));
String javaHome = FILE_UTILS.normalize(System.getProperty("java.home")).getAbsolutePath(); String javaHome = FILE_UTILS.normalize(System.getProperty("java.home")).getAbsolutePath();




+ 3
- 3
src/tests/junit/org/apache/tools/ant/util/PermissionUtilsTest.java View File

@@ -19,6 +19,7 @@
package org.apache.tools.ant.util; package org.apache.tools.ant.util;


import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeNotNull;


import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@@ -36,7 +37,6 @@ import org.apache.tools.tar.TarEntry;
import org.apache.tools.tar.TarOutputStream; import org.apache.tools.tar.TarOutputStream;
import org.apache.tools.zip.ZipEntry; import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipOutputStream; import org.apache.tools.zip.ZipOutputStream;
import org.junit.Assume;
import org.junit.Test; import org.junit.Test;


public class PermissionUtilsTest { public class PermissionUtilsTest {
@@ -103,8 +103,8 @@ public class PermissionUtilsTest {
public void getSetPermissionsWorksForFiles() throws IOException { public void getSetPermissionsWorksForFiles() throws IOException {
File f = File.createTempFile("ant", ".tst"); File f = File.createTempFile("ant", ".tst");
f.deleteOnExit(); f.deleteOnExit();
Assume.assumeNotNull(Files.getFileAttributeView(f.toPath(),
PosixFileAttributeView.class));
assumeNotNull(Files.getFileAttributeView(f.toPath(),
PosixFileAttributeView.class));
Set<PosixFilePermission> s = Set<PosixFilePermission> s =
EnumSet.of(PosixFilePermission.OWNER_READ, EnumSet.of(PosixFilePermission.OWNER_READ,
PosixFilePermission.OWNER_WRITE, PosixFilePermission.OWNER_WRITE,


+ 2
- 2
src/tests/junit/org/apache/tools/ant/util/SymlinkUtilsTest.java View File

@@ -19,11 +19,11 @@
package org.apache.tools.ant.util; package org.apache.tools.ant.util;


import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assume.assumeFalse;


import java.io.IOException; import java.io.IOException;


import org.apache.tools.ant.taskdefs.condition.Os; import org.apache.tools.ant.taskdefs.condition.Os;
import org.junit.Assume;
import org.junit.Test; import org.junit.Test;


public class SymlinkUtilsTest { public class SymlinkUtilsTest {
@@ -33,7 +33,7 @@ public class SymlinkUtilsTest {


@Test @Test
public void testRootIsNoSymlink() throws IOException { 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("/")); assertFalse(SYMLINK_UTILS.isSymbolicLink("/"));
} }




+ 3
- 3
src/tests/junit/org/example/junit/JUnit4Skippable.java View File

@@ -18,12 +18,12 @@


package org.example.junit; package org.example.junit;


import org.junit.Assume;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;


import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.junit.Assume.assumeFalse;


public class JUnit4Skippable { public class JUnit4Skippable {


@@ -40,7 +40,7 @@ public class JUnit4Skippable {


@Test @Test
public void implicitlyIgnoreTest() { 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!"); fail("I told you, this test should have been ignored!");
} }


@@ -52,7 +52,7 @@ public class JUnit4Skippable {


@Test @Test
public void implicitlyIgnoreTestNoMessage() { public void implicitlyIgnoreTestNoMessage() {
Assume.assumeFalse(true);
assumeFalse(true);
fail("I told you, this test should have been ignored!"); fail("I told you, this test should have been ignored!");
} }




Loading…
Cancel
Save