use of org.apache.tools.ant.types.Path in project ant by apache.
the class JavacTest method testModulesourcepathAndSrcDirForbidden.
@Test(expected = BuildException.class)
public void testModulesourcepathAndSrcDirForbidden() {
javac.checkParameters();
final Path p = new Path(project);
p.setPath("src");
javac.setSrcdir(p);
final Path mp = new Path(project);
p.setPath("modsrc");
javac.setModulesourcepath(mp);
}
use of org.apache.tools.ant.types.Path in project ant by apache.
the class JavacTest method testSrcDir.
@Test
public void testSrcDir() {
final Path p = new Path(project);
p.setPath("src");
javac.setSrcdir(p);
javac.checkParameters();
}
use of org.apache.tools.ant.types.Path in project ant by apache.
the class AntClassLoaderTest method testInvalidZipException.
/**
* @see <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=47593">
* bug 47593, request to log the name of corrupt zip files from which
* classes cannot be loaded</a>
*/
@Test
public void testInvalidZipException() {
buildRule.executeTarget("createNonJar");
File jar = new File(buildRule.getProject().getProperty("tmp.dir") + "/foo.jar");
Path myPath = new Path(buildRule.getProject());
myPath.setLocation(jar);
buildRule.getProject().setUserProperty("build.sysclasspath", "ignore");
loader = buildRule.getProject().createClassLoader(myPath);
PrintStream sysErr = System.err;
try {
StringBuffer errBuffer = new StringBuffer();
PrintStream err = new PrintStream(new BuildFileRule.AntOutputStream(errBuffer));
System.setErr(err);
loader.getResource("foo.txt");
String log = buildRule.getLog();
int startMessage = log.indexOf("CLASSPATH element ");
assertTrue(startMessage >= 0);
assertTrue(log.indexOf("foo.jar is not a JAR", startMessage) > 0);
} finally {
System.setErr(sysErr);
}
}
use of org.apache.tools.ant.types.Path in project ant by apache.
the class AntClassLoaderTest method testGetResourcesUsingFactory.
@Test
public void testGetResourcesUsingFactory() throws IOException {
AntClassLoader acl = AntClassLoader.newAntClassLoader(new EmptyLoader(), null, new Path(null), true);
assertNull(acl.getResource("META-INF/MANIFEST.MF"));
assertFalse(acl.getResources("META-INF/MANIFEST.MF").hasMoreElements());
}
use of org.apache.tools.ant.types.Path in project ant by apache.
the class AntClassLoaderTest method testGetResources.
/**
* Asserts that getResources won't return resources that cannot be
* seen by AntClassLoader but by ClassLoader.this.parent.
*
* @see <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=46752">
* https://issues.apache.org/bugzilla/show_bug.cgi?id=46752</a>
*/
@SuppressWarnings("resource")
@Test
public void testGetResources() throws IOException {
AntClassLoader acl = new AntClassLoader(new EmptyLoader(), null, new Path(null), true);
assertNull(acl.getResource("META-INF/MANIFEST.MF"));
assertFalse(acl.getResources("META-INF/MANIFEST.MF").hasMoreElements());
// double check using system classloader as parent
acl = new AntClassLoader(null, null, new Path(null), true);
assertNotNull(acl.getResource("META-INF/MANIFEST.MF"));
assertTrue(acl.getResources("META-INF/MANIFEST.MF").hasMoreElements());
}
Aggregations