@@ -73,7 +73,12 @@ | |||||
<configuration> | <configuration> | ||||
<basedir>../../../..</basedir> | <basedir>../../../..</basedir> | ||||
<workingDirectory>../../../..</workingDirectory> | <workingDirectory>../../../..</workingDirectory> | ||||
<skipTests>true</skipTests> | |||||
<systemProperties> | |||||
<property> | |||||
<name>ant.test.basedir.ignore</name> | |||||
<value>true</value> | |||||
</property> | |||||
</systemProperties> | |||||
</configuration> | </configuration> | ||||
</plugin> | </plugin> | ||||
</plugins> | </plugins> | ||||
@@ -65,8 +65,13 @@ | |||||
<configuration> | <configuration> | ||||
<basedir>../../../..</basedir> | <basedir>../../../..</basedir> | ||||
<workingDirectory>../../../..</workingDirectory> | <workingDirectory>../../../..</workingDirectory> | ||||
<skipTests>true</skipTests> | |||||
</configuration> | |||||
<systemProperties> | |||||
<property> | |||||
<name>ant.test.basedir.ignore</name> | |||||
<value>true</value> | |||||
</property> | |||||
</systemProperties> | |||||
</configuration> | |||||
</plugin> | </plugin> | ||||
</plugins> | </plugins> | ||||
<sourceDirectory>../../../../src/main</sourceDirectory> | <sourceDirectory>../../../../src/main</sourceDirectory> | ||||
@@ -84,7 +84,12 @@ | |||||
<configuration> | <configuration> | ||||
<basedir>../../../..</basedir> | <basedir>../../../..</basedir> | ||||
<workingDirectory>../../../..</workingDirectory> | <workingDirectory>../../../..</workingDirectory> | ||||
<skipTests>true</skipTests> | |||||
<systemProperties> | |||||
<property> | |||||
<name>ant.test.basedir.ignore</name> | |||||
<value>true</value> | |||||
</property> | |||||
</systemProperties> | |||||
</configuration> | </configuration> | ||||
</plugin> | </plugin> | ||||
</plugins> | </plugins> | ||||
@@ -71,7 +71,12 @@ | |||||
<configuration> | <configuration> | ||||
<basedir>../../../..</basedir> | <basedir>../../../..</basedir> | ||||
<workingDirectory>../../../..</workingDirectory> | <workingDirectory>../../../..</workingDirectory> | ||||
<skipTests>true</skipTests> | |||||
<systemProperties> | |||||
<property> | |||||
<name>ant.test.basedir.ignore</name> | |||||
<value>true</value> | |||||
</property> | |||||
</systemProperties> | |||||
</configuration> | </configuration> | ||||
</plugin> | </plugin> | ||||
</plugins> | </plugins> | ||||
@@ -321,5 +321,41 @@ public final class MagicNames { | |||||
* @since Ant 1.10.2 | * @since Ant 1.10.2 | ||||
*/ | */ | ||||
public static final String TSTAMP_NOW_ISO = "ant.tstamp.now.iso"; | 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"; | |||||
} | } | ||||
@@ -21,6 +21,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.types.PropertySet; | 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.", | "Attribute target or at least one nested target is required.", | ||||
getLocation()); | getLocation()); | ||||
} | } | ||||
callee.setAntfile(getProject().getProperty("ant.file")); | |||||
callee.setAntfile(getProject().getProperty(MagicNames.ANT_FILE)); | |||||
callee.setInheritAll(inheritAll); | callee.setInheritAll(inheritAll); | ||||
callee.setInheritRefs(inheritRefs); | callee.setInheritRefs(inheritRefs); | ||||
callee.execute(); | callee.execute(); | ||||
@@ -18,6 +18,7 @@ | |||||
package org.apache.tools.ant.taskdefs.condition; | package org.apache.tools.ant.taskdefs.condition; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.MagicNames; | |||||
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.apache.tools.ant.util.DeweyDecimal; | import org.apache.tools.ant.util.DeweyDecimal; | ||||
@@ -104,7 +105,7 @@ public class AntVersion extends Task implements Condition { | |||||
p.init(); | p.init(); | ||||
StringBuilder sb = new StringBuilder(); | StringBuilder sb = new StringBuilder(); | ||||
boolean foundFirstDigit = false; | boolean foundFirstDigit = false; | ||||
for (char versionChar : p.getProperty("ant.version").toCharArray()) { | |||||
for (char versionChar : p.getProperty(MagicNames.ANT_VERSION).toCharArray()) { | |||||
if (Character.isDigit(versionChar)) { | if (Character.isDigit(versionChar)) { | ||||
sb.append(versionChar); | sb.append(versionChar); | ||||
foundFirstDigit = true; | foundFirstDigit = true; | ||||
@@ -153,11 +153,14 @@ public class BuildFileRule extends ExternalResource { | |||||
logBuffer = new StringBuffer(); | logBuffer = new StringBuffer(); | ||||
fullLogBuffer = new StringBuffer(); | fullLogBuffer = new StringBuffer(); | ||||
project = new Project(); | project = new Project(); | ||||
if (Boolean.getBoolean(MagicNames.TEST_BASEDIR_IGNORE)) { | |||||
System.clearProperty(MagicNames.PROJECT_BASEDIR); | |||||
} | |||||
project.init(); | 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)); | project.addBuildListener(new AntTestListener(logLevel)); | ||||
ProjectHelper.configureProject(project, antFile); | ProjectHelper.configureProject(project, antFile); | ||||
} | } | ||||
@@ -327,12 +327,15 @@ public abstract class BuildFileTest extends TestCase { | |||||
logBuffer = new StringBuffer(); | logBuffer = new StringBuffer(); | ||||
fullLogBuffer = new StringBuffer(); | fullLogBuffer = new StringBuffer(); | ||||
project = new Project(); | project = new Project(); | ||||
if (Boolean.getBoolean(MagicNames.TEST_BASEDIR_IGNORE)) { | |||||
System.clearProperty(MagicNames.PROJECT_BASEDIR); | |||||
} | |||||
project.init(); | 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 | // 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)); | project.addBuildListener(new AntTestListener(logLevel)); | ||||
ProjectHelper.configureProject(project, antFile); | ProjectHelper.configureProject(project, antFile); | ||||
} | } | ||||
@@ -28,6 +28,7 @@ import java.util.GregorianCalendar; | |||||
import org.apache.tools.ant.BuildEvent; | import org.apache.tools.ant.BuildEvent; | ||||
import org.apache.tools.ant.BuildFileRule; | import org.apache.tools.ant.BuildFileRule; | ||||
import org.apache.tools.ant.BuildListener; | import org.apache.tools.ant.BuildListener; | ||||
import org.apache.tools.ant.MagicNames; | |||||
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; | ||||
@@ -66,7 +67,7 @@ public class ExecTaskTest { | |||||
buildRule.getProject().executeTarget("setUp"); | buildRule.getProject().executeTarget("setUp"); | ||||
assumeNotNull(buildRule.getProject().getProperty("test.can.run")); | assumeNotNull(buildRule.getProject().getProperty("test.can.run")); | ||||
MonitoredBuild myBuild = new MonitoredBuild(new File( | 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", | File logFile = FILE_UTILS.createTempFile("spawn", "log", | ||||
new File(buildRule.getProject().getProperty("output")), false, false); | new File(buildRule.getProject().getProperty("output")), false, false); | ||||
// this is guaranteed by FileUtils#createTempFile | // this is guaranteed by FileUtils#createTempFile | ||||
@@ -131,7 +132,7 @@ public class ExecTaskTest { | |||||
this.target = target; | this.target = target; | ||||
project = new Project(); | project = new Project(); | ||||
project.init(); | project.init(); | ||||
project.setUserProperty("ant.file", myBuildFile.getAbsolutePath()); | |||||
project.setUserProperty(MagicNames.ANT_FILE, myBuildFile.getAbsolutePath()); | |||||
ProjectHelper.configureProject(project, myBuildFile); | ProjectHelper.configureProject(project, myBuildFile); | ||||
} | } | ||||
@@ -19,6 +19,8 @@ | |||||
package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
import java.io.File; | import java.io.File; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; | import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; | ||||
import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; | import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; | ||||
@@ -215,13 +217,13 @@ public class JavacTest { | |||||
@Test | @Test | ||||
public void testSourceWithDefault() { | public void testSourceWithDefault() { | ||||
project.setNewProperty("ant.build.javac.source", "1.4"); | |||||
project.setNewProperty(MagicNames.BUILD_JAVAC_SOURCE, "1.4"); | |||||
assertEquals("1.4", javac.getSource()); | assertEquals("1.4", javac.getSource()); | ||||
} | } | ||||
@Test | @Test | ||||
public void testSourceOverridesDefault() { | public void testSourceOverridesDefault() { | ||||
project.setNewProperty("ant.build.javac.source", "1.4"); | |||||
project.setNewProperty(MagicNames.BUILD_JAVAC_SOURCE, "1.4"); | |||||
javac.setSource("1.5"); | javac.setSource("1.5"); | ||||
assertEquals("1.5", javac.getSource()); | assertEquals("1.5", javac.getSource()); | ||||
} | } | ||||
@@ -233,13 +235,13 @@ public class JavacTest { | |||||
@Test | @Test | ||||
public void testTargetWithDefault() { | public void testTargetWithDefault() { | ||||
project.setNewProperty("ant.build.javac.target", "1.4"); | |||||
project.setNewProperty(MagicNames.BUILD_JAVAC_TARGET, "1.4"); | |||||
assertEquals("1.4", javac.getTarget()); | assertEquals("1.4", javac.getTarget()); | ||||
} | } | ||||
@Test | @Test | ||||
public void testTargetOverridesDefault() { | public void testTargetOverridesDefault() { | ||||
project.setNewProperty("ant.build.javac.target", "1.4"); | |||||
project.setNewProperty(MagicNames.BUILD_JAVAC_TARGET, "1.4"); | |||||
javac.setTarget("1.5"); | javac.setTarget("1.5"); | ||||
assertEquals("1.5", javac.getTarget()); | assertEquals("1.5", javac.getTarget()); | ||||
} | } | ||||
@@ -49,8 +49,8 @@ public class CommandlineJavaTest { | |||||
@Before | @Before | ||||
public void setUp() { | public void setUp() { | ||||
project = new Project(); | 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"); | project.setProperty("build.sysclasspath", "ignore"); | ||||
cloneVm = System.getProperty("ant.build.clonevm"); | cloneVm = System.getProperty("ant.build.clonevm"); | ||||
@@ -74,7 +74,7 @@ public class CommandlineJavaTest { | |||||
*/ | */ | ||||
@Test | @Test | ||||
public void testGetCommandline() throws CloneNotSupportedException { | 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.createArgument().setValue("org.apache.tools.ant.CommandlineJavaTest"); | ||||
c.setClassname("junit.textui.TestRunner"); | c.setClassname("junit.textui.TestRunner"); | ||||
c.createVmArgument().setValue("-Djava.compiler=NONE"); | c.createVmArgument().setValue("-Djava.compiler=NONE"); | ||||
@@ -22,6 +22,7 @@ import java.io.File; | |||||
import java.util.Locale; | import java.util.Locale; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.taskdefs.condition.Os; | import org.apache.tools.ant.taskdefs.condition.Os; | ||||
import org.junit.Before; | import org.junit.Before; | ||||
@@ -52,8 +53,8 @@ public class PathTest { | |||||
@Before | @Before | ||||
public void setUp() { | public void setUp() { | ||||
project = new Project(); | 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); | p = new Path(project); | ||||
} | } | ||||
@@ -28,6 +28,7 @@ import javax.xml.transform.TransformerException; | |||||
import javax.xml.transform.sax.SAXSource; | import javax.xml.transform.sax.SAXSource; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.util.JAXPUtils; | import org.apache.tools.ant.util.JAXPUtils; | ||||
import org.junit.Before; | import org.junit.Before; | ||||
@@ -68,8 +69,8 @@ public class XMLCatalogTest { | |||||
@Before | @Before | ||||
public void setUp() { | public void setUp() { | ||||
project = new Project(); | 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 | // This causes XMLCatalog to print out detailed logging | ||||
// messages for debugging | // messages for debugging | ||||
@@ -20,6 +20,7 @@ package org.apache.tools.ant.types.resources; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.junit.Before; | import org.junit.Before; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
@@ -36,8 +37,9 @@ public class FileResourceTest { | |||||
@Before | @Before | ||||
public void setUp() throws IOException { | 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 | @Test | ||||
@@ -27,6 +27,7 @@ import java.util.Iterator; | |||||
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.MagicNames; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.Target; | import org.apache.tools.ant.Target; | ||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
@@ -147,7 +148,8 @@ public class ModifiedSelectorTest { | |||||
@Test | @Test | ||||
public void testCustomClasses() { | 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 bft = new BFT(); | ||||
bft.setUp(); | bft.setUp(); | ||||
// don't catch the JUnit exceptions | // don't catch the JUnit exceptions | ||||
@@ -554,7 +556,8 @@ public class ModifiedSelectorTest { | |||||
@Test | @Test | ||||
public void testResourceSelectorScenarioSimple() { | 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 bft = new BFT(); | ||||
bft.doTarget("modifiedselectortest-scenario-resourceSimple"); | bft.doTarget("modifiedselectortest-scenario-resourceSimple"); | ||||
bft.doTarget("modifiedselectortest-scenario-clean"); | bft.doTarget("modifiedselectortest-scenario-clean"); | ||||
@@ -774,19 +777,22 @@ public class ModifiedSelectorTest { | |||||
@Test | @Test | ||||
public void testScenarioCoreSelectorDefaults() { | 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"); | doScenarioTest("modifiedselectortest-scenario-coreselector-defaults", "cache.properties"); | ||||
} | } | ||||
@Test | @Test | ||||
public void testScenarioCoreSelectorSettings() { | 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"); | doScenarioTest("modifiedselectortest-scenario-coreselector-settings", "core.cache.properties"); | ||||
} | } | ||||
@Test | @Test | ||||
public void testScenarioCustomSelectorSettings() { | 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"); | doScenarioTest("modifiedselectortest-scenario-customselector-settings", "core.cache.properties"); | ||||
} | } | ||||
@@ -45,7 +45,7 @@ public class OwnedBySelectorTest { | |||||
private final String SELF = System.getProperty("user.name"); | private final String SELF = System.getProperty("user.name"); | ||||
private final String ROOT = "root"; | |||||
private final String ROOT_USER = "root"; | |||||
private OwnedBySelector s; | private OwnedBySelector s; | ||||
@@ -73,7 +73,7 @@ public class OwnedBySelectorTest { | |||||
Path symbolicLink = Files.createSymbolicLink(target.toPath(), TEST_FILE.toPath()); | Path symbolicLink = Files.createSymbolicLink(target.toPath(), TEST_FILE.toPath()); | ||||
UserPrincipal root = Files.getOwner(symbolicLink); | UserPrincipal root = Files.getOwner(symbolicLink); | ||||
assertEquals(ROOT, root.getName()); | |||||
assertEquals(ROOT_USER, root.getName()); | |||||
UserPrincipal user = Files.getOwner(symbolicLink, LinkOption.NOFOLLOW_LINKS); | UserPrincipal user = Files.getOwner(symbolicLink, LinkOption.NOFOLLOW_LINKS); | ||||
assertEquals(SELF, user.getName()); | assertEquals(SELF, user.getName()); | ||||
@@ -23,6 +23,7 @@ import java.io.FileOutputStream; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.apache.tools.ant.taskdefs.condition.Os; | import org.apache.tools.ant.taskdefs.condition.Os; | ||||
import org.junit.After; | import org.junit.After; | ||||
import org.junit.Before; | import org.junit.Before; | ||||
@@ -50,7 +51,7 @@ public class FileUtilsTest { | |||||
public ExpectedException thrown = ExpectedException.none(); | public ExpectedException thrown = ExpectedException.none(); | ||||
private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | 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 File removeThis; | ||||
private String root; | private String root; | ||||
@@ -24,6 +24,7 @@ import java.io.IOException; | |||||
import java.io.InputStreamReader; | import java.io.InputStreamReader; | ||||
import java.util.Properties; | import java.util.Properties; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.junit.Before; | import org.junit.Before; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
@@ -35,7 +36,7 @@ import static org.junit.Assert.assertThat; | |||||
public class LayoutPreservingPropertiesTest { | 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; | private LayoutPreservingProperties lpf; | ||||
@@ -17,6 +17,7 @@ | |||||
*/ | */ | ||||
package org.apache.tools.ant.util; | package org.apache.tools.ant.util; | ||||
import org.apache.tools.ant.MagicNames; | |||||
import org.junit.Test; | import org.junit.Test; | ||||
import java.io.ByteArrayOutputStream; | import java.io.ByteArrayOutputStream; | ||||
@@ -33,7 +34,7 @@ import static org.junit.Assert.assertEquals; | |||||
*/ | */ | ||||
public class ReaderInputStreamTest { | public class ReaderInputStreamTest { | ||||
private static final String ROOT = System.getProperty("root"); | |||||
private static final String ROOT = System.getProperty(MagicNames.TEST_ROOT_DIRECTORY); | |||||
@Test | @Test | ||||
public void testSimple() throws Exception { | public void testSimple() throws Exception { | ||||