use of org.apache.tools.ant.types.Path in project ant by apache.
the class AntTest method testRefId.
@Test
public void testRefId() {
Path testPath = new Path(buildRule.getProject());
testPath.createPath().setPath(System.getProperty("java.class.path"));
PropertyChecker pc = new PropertyChecker("testprop", new String[] { null, testPath.toString() });
buildRule.getProject().addBuildListener(pc);
buildRule.executeTarget("testRefid");
AssertionFailedError ae = pc.getError();
if (ae != null) {
throw ae;
}
buildRule.getProject().removeBuildListener(pc);
}
use of org.apache.tools.ant.types.Path in project ant by apache.
the class AntTest method testReferenceInheritance.
@Test
public void testReferenceInheritance() {
Path p = Path.systemClasspath;
p.setProject(buildRule.getProject());
buildRule.getProject().addReference("path", p);
buildRule.getProject().addReference("no-override", p);
testReference("testInherit", new String[] { "path", "path" }, new boolean[] { true, true }, p);
testReference("testInherit", new String[] { "no-override", "no-override" }, new boolean[] { true, false }, p);
testReference("testInherit", new String[] { "no-override", "no-override" }, new boolean[] { false, false }, null);
}
use of org.apache.tools.ant.types.Path in project ant by apache.
the class AntTest method testReferenceNoInheritance.
@Test
public void testReferenceNoInheritance() {
Path p = Path.systemClasspath;
p.setProject(buildRule.getProject());
buildRule.getProject().addReference("path", p);
buildRule.getProject().addReference("no-override", p);
testReference("testNoInherit", new String[] { "path", "path" }, new boolean[] { true, false }, p);
testReference("testNoInherit", new String[] { "path", "path" }, new boolean[] { false, true }, null);
testReference("testInherit", new String[] { "no-override", "no-override" }, new boolean[] { true, false }, p);
testReference("testInherit", new String[] { "no-override", "no-override" }, new boolean[] { false, false }, null);
}
use of org.apache.tools.ant.types.Path in project ant by apache.
the class AntTest method testReferenceRename.
@Test
public void testReferenceRename() {
Path p = Path.systemClasspath;
p.setProject(buildRule.getProject());
buildRule.getProject().addReference("path", p);
testReference("testRename", new String[] { "path", "path" }, new boolean[] { true, false }, p);
testReference("testRename", new String[] { "path", "path" }, new boolean[] { false, true }, null);
testReference("testRename", new String[] { "newpath", "newpath" }, new boolean[] { false, true }, p);
}
use of org.apache.tools.ant.types.Path in project ant by apache.
the class AntClassLoaderDelegationTest method testFindIsolateResources.
@SuppressWarnings("resource")
@Test
public void testFindIsolateResources() throws Exception {
String buildTestcases = System.getProperty("build.tests");
assertNotNull("defined ${build.tests}", buildTestcases);
assertTrue("have a dir " + buildTestcases, new File(buildTestcases).isDirectory());
Path path = new Path(p, buildTestcases + "/org");
// A special parent loader which is not the system class loader:
ClassLoader parent = new ParentLoader();
URL urlFromPath = new URL(FILE_UTILS.toURI(buildTestcases) + "org/" + TEST_RESOURCE);
AntClassLoader acl = new AntClassLoader(parent, p, path, false);
acl.setIsolated(true);
assertEquals("correct resources (reverse delegation order)", Collections.singletonList(urlFromPath), enum2List(acl.getResources(TEST_RESOURCE)));
}
Aggregations