Repository: ant
Updated Branches:
  refs/heads/master 9b76c3588 -> 679a94224


Add magic names for tests, run more tests in Surefire

Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/679a9422
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/679a9422
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/679a9422

Branch: refs/heads/master
Commit: 679a94224de0c57c777f6ecca5c33207c11e500b
Parents: 9b76c35
Author: Gintas Grigelionis <gin...@apache.org>
Authored: Tue Oct 23 20:16:24 2018 +0200
Committer: Gintas Grigelionis <gin...@apache.org>
Committed: Tue Oct 23 20:17:28 2018 +0200

----------------------------------------------------------------------
 src/etc/poms/ant-antlr/pom.xml                  |  7 +++-
 src/etc/poms/ant-imageio/pom.xml                |  9 +++--
 src/etc/poms/ant-jai/pom.xml                    |  7 +++-
 src/etc/poms/ant-jdepend/pom.xml                |  7 +++-
 src/main/org/apache/tools/ant/MagicNames.java   | 36 ++++++++++++++++++++
 .../apache/tools/ant/taskdefs/CallTarget.java   |  3 +-
 .../ant/taskdefs/condition/AntVersion.java      |  3 +-
 .../org/apache/tools/ant/BuildFileRule.java     | 11 +++---
 .../org/apache/tools/ant/BuildFileTest.java     | 11 +++---
 .../apache/tools/ant/taskdefs/ExecTaskTest.java |  5 +--
 .../apache/tools/ant/taskdefs/JavacTest.java    | 10 +++---
 .../tools/ant/types/CommandlineJavaTest.java    |  6 ++--
 .../org/apache/tools/ant/types/PathTest.java    |  5 +--
 .../apache/tools/ant/types/XMLCatalogTest.java  |  5 +--
 .../ant/types/resources/FileResourceTest.java   |  6 ++--
 .../types/selectors/ModifiedSelectorTest.java   | 16 ++++++---
 .../types/selectors/OwnedBySelectorTest.java    |  4 +--
 .../apache/tools/ant/util/FileUtilsTest.java    |  3 +-
 .../util/LayoutPreservingPropertiesTest.java    |  3 +-
 .../tools/ant/util/ReaderInputStreamTest.java   |  3 +-
 20 files changed, 120 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/etc/poms/ant-antlr/pom.xml
----------------------------------------------------------------------
diff --git a/src/etc/poms/ant-antlr/pom.xml b/src/etc/poms/ant-antlr/pom.xml
index 783b15d..35a112c 100644
--- a/src/etc/poms/ant-antlr/pom.xml
+++ b/src/etc/poms/ant-antlr/pom.xml
@@ -73,7 +73,12 @@
         <configuration>
           <basedir>../../../..</basedir>
           <workingDirectory>../../../..</workingDirectory>
-          <skipTests>true</skipTests>
+          <systemProperties>
+            <property>
+              <name>ant.test.basedir.ignore</name>
+              <value>true</value>
+            </property>
+          </systemProperties>
         </configuration>
       </plugin>
     </plugins>

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/etc/poms/ant-imageio/pom.xml
----------------------------------------------------------------------
diff --git a/src/etc/poms/ant-imageio/pom.xml b/src/etc/poms/ant-imageio/pom.xml
index 39f90d1..bb62b2b 100644
--- a/src/etc/poms/ant-imageio/pom.xml
+++ b/src/etc/poms/ant-imageio/pom.xml
@@ -65,8 +65,13 @@
         <configuration>
           <basedir>../../../..</basedir>
           <workingDirectory>../../../..</workingDirectory>
-          <skipTests>true</skipTests>
-        </configuration>
+          <systemProperties>
+            <property>
+              <name>ant.test.basedir.ignore</name>
+              <value>true</value>
+            </property>
+          </systemProperties>
+       </configuration>
       </plugin>
     </plugins>
     <sourceDirectory>../../../../src/main</sourceDirectory>

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/etc/poms/ant-jai/pom.xml
----------------------------------------------------------------------
diff --git a/src/etc/poms/ant-jai/pom.xml b/src/etc/poms/ant-jai/pom.xml
index 971cfc8..90a4368 100644
--- a/src/etc/poms/ant-jai/pom.xml
+++ b/src/etc/poms/ant-jai/pom.xml
@@ -84,7 +84,12 @@
         <configuration>
           <basedir>../../../..</basedir>
           <workingDirectory>../../../..</workingDirectory>
-          <skipTests>true</skipTests>
+          <systemProperties>
+            <property>
+              <name>ant.test.basedir.ignore</name>
+              <value>true</value>
+            </property>
+          </systemProperties>
         </configuration>
       </plugin>
     </plugins>

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/etc/poms/ant-jdepend/pom.xml
----------------------------------------------------------------------
diff --git a/src/etc/poms/ant-jdepend/pom.xml b/src/etc/poms/ant-jdepend/pom.xml
index 9b30cbc..98c1e60 100644
--- a/src/etc/poms/ant-jdepend/pom.xml
+++ b/src/etc/poms/ant-jdepend/pom.xml
@@ -71,7 +71,12 @@
         <configuration>
           <basedir>../../../..</basedir>
           <workingDirectory>../../../..</workingDirectory>
-          <skipTests>true</skipTests>
+          <systemProperties>
+            <property>
+              <name>ant.test.basedir.ignore</name>
+              <value>true</value>
+            </property>
+          </systemProperties>
         </configuration>
       </plugin>
     </plugins>

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/main/org/apache/tools/ant/MagicNames.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/MagicNames.java 
b/src/main/org/apache/tools/ant/MagicNames.java
index 5457e62..2479bce 100644
--- a/src/main/org/apache/tools/ant/MagicNames.java
+++ b/src/main/org/apache/tools/ant/MagicNames.java
@@ -321,5 +321,41 @@ public final class MagicNames {
      * @since Ant 1.10.2
      */
     public static final String TSTAMP_NOW_ISO = "ant.tstamp.now.iso";
+
+    /**
+     * Magic property that makes unit tests based on BuildFileTest
+     * or BuildFileRule ignore externally set basedir
+     * (typically by Surefire/Failsafe)
+     *
+     * Value: {@value}
+     * @since Ant 1.10.6
+     */
+    public static final String TEST_BASEDIR_IGNORE = "ant.test.basedir.ignore";
+
+    /**
+     * Magic property that makes unit tests based on BuildFileTest
+     * or BuildFileRule use build files in alternative locations
+     * (relative to "root" directory)
+     *
+     * Value: {@value}
+     * @since Ant 1.10.6
+     */
+    public static final String TEST_ROOT_DIRECTORY = "root";
+
+    /**
+     * Property for ant process ID set in unit tests by BuildFileTest
+     * or BuildFileRule.
+     *
+     * Value: {@value}
+     */
+    public static final String TEST_PROCESS_ID = "ant.processid";
+
+    /**
+     * Property for ant thread name set in unit tests by BuildFileTest
+     * or BuildFileRule.
+     *
+     * Value: {@value}
+     */
+    public static final String TEST_THREAD_NAME = "ant.threadname";
 }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/main/org/apache/tools/ant/taskdefs/CallTarget.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/CallTarget.java 
b/src/main/org/apache/tools/ant/taskdefs/CallTarget.java
index d8a0e8c..ebef7c4 100644
--- a/src/main/org/apache/tools/ant/taskdefs/CallTarget.java
+++ b/src/main/org/apache/tools/ant/taskdefs/CallTarget.java
@@ -21,6 +21,7 @@ package org.apache.tools.ant.taskdefs;
 import java.io.IOException;
 
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.MagicNames;
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.types.PropertySet;
 
@@ -99,7 +100,7 @@ public class CallTarget extends Task {
                 "Attribute target or at least one nested target is required.",
                  getLocation());
         }
-        callee.setAntfile(getProject().getProperty("ant.file"));
+        callee.setAntfile(getProject().getProperty(MagicNames.ANT_FILE));
         callee.setInheritAll(inheritAll);
         callee.setInheritRefs(inheritRefs);
         callee.execute();

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/main/org/apache/tools/ant/taskdefs/condition/AntVersion.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/AntVersion.java 
b/src/main/org/apache/tools/ant/taskdefs/condition/AntVersion.java
index 796dcff..fcb104b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/condition/AntVersion.java
+++ b/src/main/org/apache/tools/ant/taskdefs/condition/AntVersion.java
@@ -18,6 +18,7 @@
 package org.apache.tools.ant.taskdefs.condition;
 
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.MagicNames;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.util.DeweyDecimal;
@@ -104,7 +105,7 @@ public class AntVersion extends Task implements Condition {
         p.init();
         StringBuilder sb = new StringBuilder();
         boolean foundFirstDigit = false;
-        for (char versionChar : p.getProperty("ant.version").toCharArray()) {
+        for (char versionChar : 
p.getProperty(MagicNames.ANT_VERSION).toCharArray()) {
             if (Character.isDigit(versionChar)) {
                 sb.append(versionChar);
                 foundFirstDigit = true;

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/tests/junit/org/apache/tools/ant/BuildFileRule.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/BuildFileRule.java 
b/src/tests/junit/org/apache/tools/ant/BuildFileRule.java
index 51cc395..48c71ad 100644
--- a/src/tests/junit/org/apache/tools/ant/BuildFileRule.java
+++ b/src/tests/junit/org/apache/tools/ant/BuildFileRule.java
@@ -153,11 +153,14 @@ public class BuildFileRule extends ExternalResource {
         logBuffer = new StringBuffer();
         fullLogBuffer = new StringBuffer();
         project = new Project();
+        if (Boolean.getBoolean(MagicNames.TEST_BASEDIR_IGNORE)) {
+            System.clearProperty(MagicNames.PROJECT_BASEDIR);
+        }
         project.init();
-        File antFile = new File(System.getProperty("root"), filename);
-        project.setProperty("ant.processid", 
ProcessUtil.getProcessId("<Process>"));
-        project.setProperty("ant.threadname", 
Thread.currentThread().getName());
-        project.setUserProperty("ant.file", antFile.getAbsolutePath());
+        File antFile = new 
File(System.getProperty(MagicNames.TEST_ROOT_DIRECTORY), filename);
+        project.setProperty(MagicNames.TEST_PROCESS_ID, 
ProcessUtil.getProcessId("<Process>"));
+        project.setProperty(MagicNames.TEST_THREAD_NAME, 
Thread.currentThread().getName());
+        project.setUserProperty(MagicNames.ANT_FILE, 
antFile.getAbsolutePath());
         project.addBuildListener(new AntTestListener(logLevel));
         ProjectHelper.configureProject(project, antFile);
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/tests/junit/org/apache/tools/ant/BuildFileTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/BuildFileTest.java 
b/src/tests/junit/org/apache/tools/ant/BuildFileTest.java
index c2af9c9..723e4e1 100644
--- a/src/tests/junit/org/apache/tools/ant/BuildFileTest.java
+++ b/src/tests/junit/org/apache/tools/ant/BuildFileTest.java
@@ -327,12 +327,15 @@ public abstract class BuildFileTest extends TestCase {
         logBuffer = new StringBuffer();
         fullLogBuffer = new StringBuffer();
         project = new Project();
+        if (Boolean.getBoolean(MagicNames.TEST_BASEDIR_IGNORE)) {
+            System.clearProperty(MagicNames.PROJECT_BASEDIR);
+        }
         project.init();
-        File antFile = new File(System.getProperty("root"), filename);
-        project.setUserProperty("ant.file", antFile.getAbsolutePath());
+        File antFile = new 
File(System.getProperty(MagicNames.TEST_ROOT_DIRECTORY), filename);
+        project.setUserProperty(MagicNames.ANT_FILE, 
antFile.getAbsolutePath());
         // set two new properties to allow to build unique names when running 
multithreaded tests
-        project.setProperty("ant.processid", 
ProcessUtil.getProcessId("<Process>"));
-        project.setProperty("ant.threadname", 
Thread.currentThread().getName());
+        project.setProperty(MagicNames.TEST_PROCESS_ID, 
ProcessUtil.getProcessId("<Process>"));
+        project.setProperty(MagicNames.TEST_THREAD_NAME, 
Thread.currentThread().getName());
         project.addBuildListener(new AntTestListener(logLevel));
         ProjectHelper.configureProject(project, antFile);
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java
index 9e57dd4..1e77d25 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java
@@ -28,6 +28,7 @@ import java.util.GregorianCalendar;
 import org.apache.tools.ant.BuildEvent;
 import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.MagicNames;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.ProjectHelper;
 import org.apache.tools.ant.util.FileUtils;
@@ -66,7 +67,7 @@ public class ExecTaskTest {
         buildRule.getProject().executeTarget("setUp");
         assumeNotNull(buildRule.getProject().getProperty("test.can.run"));
         MonitoredBuild myBuild = new MonitoredBuild(new File(
-                buildRule.getProject().getProperty("ant.file")), "spawn");
+                buildRule.getProject().getProperty(MagicNames.ANT_FILE)), 
"spawn");
         File logFile = FILE_UTILS.createTempFile("spawn", "log",
                 new File(buildRule.getProject().getProperty("output")), false, 
false);
         // this is guaranteed by FileUtils#createTempFile
@@ -131,7 +132,7 @@ public class ExecTaskTest {
             this.target = target;
             project = new Project();
             project.init();
-            project.setUserProperty("ant.file", myBuildFile.getAbsolutePath());
+            project.setUserProperty(MagicNames.ANT_FILE, 
myBuildFile.getAbsolutePath());
             ProjectHelper.configureProject(project, myBuildFile);
         }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java 
b/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java
index 1aab811..de8047b 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java
@@ -19,6 +19,8 @@
 package org.apache.tools.ant.taskdefs;
 
 import java.io.File;
+
+import org.apache.tools.ant.MagicNames;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter;
 import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory;
@@ -215,13 +217,13 @@ public class JavacTest {
 
     @Test
     public void testSourceWithDefault() {
-        project.setNewProperty("ant.build.javac.source", "1.4");
+        project.setNewProperty(MagicNames.BUILD_JAVAC_SOURCE, "1.4");
         assertEquals("1.4", javac.getSource());
     }
 
     @Test
     public void testSourceOverridesDefault() {
-        project.setNewProperty("ant.build.javac.source", "1.4");
+        project.setNewProperty(MagicNames.BUILD_JAVAC_SOURCE, "1.4");
         javac.setSource("1.5");
         assertEquals("1.5", javac.getSource());
     }
@@ -233,13 +235,13 @@ public class JavacTest {
 
     @Test
     public void testTargetWithDefault() {
-        project.setNewProperty("ant.build.javac.target", "1.4");
+        project.setNewProperty(MagicNames.BUILD_JAVAC_TARGET, "1.4");
         assertEquals("1.4", javac.getTarget());
     }
 
     @Test
     public void testTargetOverridesDefault() {
-        project.setNewProperty("ant.build.javac.target", "1.4");
+        project.setNewProperty(MagicNames.BUILD_JAVAC_TARGET, "1.4");
         javac.setTarget("1.5");
         assertEquals("1.5", javac.getTarget());
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java 
b/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
index a96a96b..e9c47ab 100644
--- a/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
@@ -49,8 +49,8 @@ public class CommandlineJavaTest {
     @Before
     public void setUp() {
         project = new Project();
-        if (System.getProperty("root") != null) {
-            project.setBasedir(System.getProperty("root"));
+        if (System.getProperty(MagicNames.TEST_ROOT_DIRECTORY) != null) {
+            
project.setBasedir(System.getProperty(MagicNames.TEST_ROOT_DIRECTORY));
         }
         project.setProperty("build.sysclasspath", "ignore");
         cloneVm = System.getProperty("ant.build.clonevm");
@@ -74,7 +74,7 @@ public class CommandlineJavaTest {
      */
     @Test
     public void testGetCommandline() throws CloneNotSupportedException {
-        assertNotNull("Ant home not set", System.getProperty("ant.home"));
+        assertNotNull("Ant home not set", 
System.getProperty(MagicNames.ANT_HOME));
         
c.createArgument().setValue("org.apache.tools.ant.CommandlineJavaTest");
         c.setClassname("junit.textui.TestRunner");
         c.createVmArgument().setValue("-Djava.compiler=NONE");

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/tests/junit/org/apache/tools/ant/types/PathTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/PathTest.java 
b/src/tests/junit/org/apache/tools/ant/types/PathTest.java
index 062fe31..22587ef 100644
--- a/src/tests/junit/org/apache/tools/ant/types/PathTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/PathTest.java
@@ -22,6 +22,7 @@ import java.io.File;
 import java.util.Locale;
 
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.MagicNames;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.condition.Os;
 import org.junit.Before;
@@ -52,8 +53,8 @@ public class PathTest {
     @Before
     public void setUp() {
         project = new Project();
-        if (System.getProperty("root") != null) {
-            project.setBasedir(System.getProperty("root"));
+        if (System.getProperty(MagicNames.TEST_ROOT_DIRECTORY) != null) {
+            
project.setBasedir(System.getProperty(MagicNames.TEST_ROOT_DIRECTORY));
         }
         p = new Path(project);
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java 
b/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
index b96143f..81296de 100644
--- a/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
@@ -28,6 +28,7 @@ import javax.xml.transform.TransformerException;
 import javax.xml.transform.sax.SAXSource;
 
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.MagicNames;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.util.JAXPUtils;
 import org.junit.Before;
@@ -68,8 +69,8 @@ public class XMLCatalogTest {
     @Before
     public void setUp() {
         project = new Project();
-        if (System.getProperty("root") != null) {
-            project.setBasedir(System.getProperty("root"));
+        if (System.getProperty(MagicNames.TEST_ROOT_DIRECTORY) != null) {
+            
project.setBasedir(System.getProperty(MagicNames.TEST_ROOT_DIRECTORY));
         }
         // This causes XMLCatalog to print out detailed logging
         // messages for debugging

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java 
b/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java
index 361855c..c09369a 100644
--- a/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java
@@ -20,6 +20,7 @@ package org.apache.tools.ant.types.resources;
 import java.io.File;
 import java.io.IOException;
 
+import org.apache.tools.ant.MagicNames;
 import org.apache.tools.ant.Project;
 import org.junit.Before;
 import org.junit.Test;
@@ -36,8 +37,9 @@ public class FileResourceTest {
 
     @Before
     public void setUp() throws IOException {
-        root = (System.getProperty("root") == null) ? new 
File(".").getCanonicalFile()
-                : new File(System.getProperty("root"));
+        root = (System.getProperty(MagicNames.TEST_ROOT_DIRECTORY) == null)
+                ? new File(".").getCanonicalFile()
+                : new File(System.getProperty(MagicNames.TEST_ROOT_DIRECTORY));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
 
b/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
index 3b388ea..2837fa0 100644
--- 
a/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
@@ -27,6 +27,7 @@ import java.util.Iterator;
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.MagicNames;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Target;
 import org.apache.tools.ant.Task;
@@ -147,7 +148,8 @@ public class ModifiedSelectorTest {
 
     @Test
     public void testCustomClasses() {
-        assertNotNull("Ant home not set", 
selectorRule.getProject().getProperty("ant.home"));
+        assertNotNull("Ant home not set",
+                selectorRule.getProject().getProperty(MagicNames.ANT_HOME));
         BFT bft = new BFT();
         bft.setUp();
         // don't catch the JUnit exceptions
@@ -554,7 +556,8 @@ public class ModifiedSelectorTest {
 
     @Test
     public void testResourceSelectorScenarioSimple() {
-        assertNotNull("Ant home not set", 
selectorRule.getProject().getProperty("ant.home"));
+        assertNotNull("Ant home not set",
+                selectorRule.getProject().getProperty(MagicNames.ANT_HOME));
         BFT bft = new BFT();
         bft.doTarget("modifiedselectortest-scenario-resourceSimple");
         bft.doTarget("modifiedselectortest-scenario-clean");
@@ -774,19 +777,22 @@ public class ModifiedSelectorTest {
 
     @Test
     public void testScenarioCoreSelectorDefaults() {
-        assertNotNull("Ant home not set", 
selectorRule.getProject().getProperty("ant.home"));
+        assertNotNull("Ant home not set",
+                selectorRule.getProject().getProperty(MagicNames.ANT_HOME));
         doScenarioTest("modifiedselectortest-scenario-coreselector-defaults", 
"cache.properties");
     }
 
     @Test
     public void testScenarioCoreSelectorSettings() {
-        assertNotNull("Ant home not set", 
selectorRule.getProject().getProperty("ant.home"));
+        assertNotNull("Ant home not set",
+                selectorRule.getProject().getProperty(MagicNames.ANT_HOME));
         doScenarioTest("modifiedselectortest-scenario-coreselector-settings", 
"core.cache.properties");
     }
 
     @Test
     public void testScenarioCustomSelectorSettings() {
-        assertNotNull("Ant home not set", 
selectorRule.getProject().getProperty("ant.home"));
+        assertNotNull("Ant home not set",
+                selectorRule.getProject().getProperty(MagicNames.ANT_HOME));
         
doScenarioTest("modifiedselectortest-scenario-customselector-settings", 
"core.cache.properties");
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java 
b/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
index be0d71f..1ea26c7 100644
--- 
a/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/types/selectors/OwnedBySelectorTest.java
@@ -45,7 +45,7 @@ public class OwnedBySelectorTest {
 
     private final String SELF = System.getProperty("user.name");
 
-    private final String ROOT = "root";
+    private final String ROOT_USER = "root";
 
     private OwnedBySelector s;
 
@@ -73,7 +73,7 @@ public class OwnedBySelectorTest {
         Path symbolicLink = Files.createSymbolicLink(target.toPath(), 
TEST_FILE.toPath());
 
         UserPrincipal root = Files.getOwner(symbolicLink);
-        assertEquals(ROOT, root.getName());
+        assertEquals(ROOT_USER, root.getName());
 
         UserPrincipal user = Files.getOwner(symbolicLink, 
LinkOption.NOFOLLOW_LINKS);
         assertEquals(SELF, user.getName());

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java 
b/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
index 2a9a83e..241dab7 100644
--- a/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
@@ -23,6 +23,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.MagicNames;
 import org.apache.tools.ant.taskdefs.condition.Os;
 import org.junit.After;
 import org.junit.Before;
@@ -50,7 +51,7 @@ public class FileUtilsTest {
     public ExpectedException thrown = ExpectedException.none();
 
     private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
-    private static final String ROOT = System.getProperty("root");
+    private static final String ROOT = 
System.getProperty(MagicNames.TEST_ROOT_DIRECTORY);
     private File removeThis;
     private String root;
 

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java 
b/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
index 7aec6b6..649584c 100644
--- 
a/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
+++ 
b/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.Properties;
 
+import org.apache.tools.ant.MagicNames;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -35,7 +36,7 @@ import static org.junit.Assert.assertThat;
 
 public class LayoutPreservingPropertiesTest {
 
-    private static final String ROOT = System.getProperty("root");
+    private static final String ROOT = 
System.getProperty(MagicNames.TEST_ROOT_DIRECTORY);
 
     private LayoutPreservingProperties lpf;
 

http://git-wip-us.apache.org/repos/asf/ant/blob/679a9422/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
----------------------------------------------------------------------
diff --git 
a/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java 
b/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
index 332af76..fdb78ab 100644
--- a/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
@@ -17,6 +17,7 @@
  */
 package org.apache.tools.ant.util;
 
+import org.apache.tools.ant.MagicNames;
 import org.junit.Test;
 
 import java.io.ByteArrayOutputStream;
@@ -33,7 +34,7 @@ import static org.junit.Assert.assertEquals;
  */
 public class ReaderInputStreamTest {
 
-    private static final String ROOT = System.getProperty("root");
+    private static final String ROOT = 
System.getProperty(MagicNames.TEST_ROOT_DIRECTORY);
 
     @Test
     public void testSimple() throws Exception {

Reply via email to