Methods Summary |
---|
public void | setUp()configure the project.
if the property junit.run.fatal.tests is set we run
the fatal tests
configureProject("src/etc/testcases/taskdefs/java.xml");
//final String propname="tests-classpath.value";
//String testClasspath=System.getProperty(propname);
//System.out.println("Test cp="+testClasspath);
String propname="tests-classpath.value";
String runFatal=System.getProperty("junit.run.fatal.tests");
if(runFatal!=null)
runFatalTests=true;
|
public void | tearDown()
// remove log file from testSpawn
project.executeTarget("cleanup");
|
public void | testClassnameAndJar()
expectBuildException("testClassnameAndJar",
"Should not be able to set both classname AND jar");
|
public void | testExcepting()
expectLogContaining("testExcepting",
"Exception raised inside called program");
|
public void | testExceptingFoe()
expectBuildExceptionContaining("testExceptingFoe",
"passes exception through",
"Exception raised inside called program");
|
public void | testExceptingFoeFork()
expectBuildExceptionContaining("testExceptingFoeFork",
"exceptions turned into error codes",
"Java returned:");
|
public void | testExceptingFork()
expectLogContaining("testExceptingFork",
"Java Result:");
|
public void | testJarAndClassName()
expectBuildException("testJarAndClassName",
"Should not be able to set both classname AND jar");
|
public void | testJarNoFork()
expectBuildExceptionContaining("testJarNoFork",
"parameter validation",
"Cannot execute a jar in non-forked mode. "
+ "Please set fork='true'. ");
|
public void | testNoJarNoClassname()
expectBuildExceptionContaining("testNoJarNoClassname",
"parameter validation",
"Classname must not be null.");
|
public void | testRedirect1()
executeTarget("redirect1");
|
public void | testRedirect2()
executeTarget("redirect2");
|
public void | testRedirect3()
executeTarget("redirect3");
|
public void | testRedirector1()
executeTarget("redirector1");
|
public void | testRedirector2()
executeTarget("redirector2");
|
public void | testResultPropertyNonZero()
executeTarget("testResultPropertyNonZero");
assertEquals("2",project.getProperty("exitcode"));
|
public void | testResultPropertyNonZeroNoFork()
executeTarget("testResultPropertyNonZeroNoFork");
assertEquals("-1",project.getProperty("exitcode"));
|
public void | testResultPropertyZero()
executeTarget("testResultPropertyZero");
assertEquals("0",project.getProperty("exitcode"));
|
public void | testResultPropertyZeroNoFork()
executeTarget("testResultPropertyZeroNoFork");
assertEquals("0",project.getProperty("exitcode"));
|
public void | testRun()
executeTarget("testRun");
|
public void | testRunFail()this test fails but we ignore the return value;
we verify that failure only matters when failonerror is set
if(runFatalTests) {
executeTarget("testRunFail");
}
|
public void | testRunFailFoe()
if(runFatalTests) {
expectBuildExceptionContaining("testRunFailFoe",
"java failures being propagated",
"Java returned:");
}
|
public void | testRunFailFoeFork()
expectBuildExceptionContaining("testRunFailFoeFork",
"java failures being propagated",
"Java returned:");
|
public void | testRunFailWithFailOnError()
expectBuildExceptionContaining("testRunFailWithFailOnError",
"non zero return code",
"Java returned:");
|
public void | testRunSuccessWithFailOnError()
executeTarget("testRunSuccessWithFailOnError");
|
public void | testSpawn()
File logFile = FILE_UTILS.createTempFile("spawn","log", project.getBaseDir());
// this is guaranteed by FileUtils#createTempFile
assertTrue("log file not existing", !logFile.exists());
project.setProperty("logFile", logFile.getAbsolutePath());
project.setProperty("timeToWait", Long.toString(TIME_TO_WAIT));
project.executeTarget("testSpawn");
try {
Thread.sleep(TIME_TO_WAIT * 1000 + SECURITY_MARGIN);
} catch (Exception ex) {
System.out.println("my sleep was interrupted");
}
// let's be nice with the next generation of developers
if (!logFile.exists()) {
System.out.println("suggestion: increase the constant"
+ " SECURITY_MARGIN to give more time for java to start.");
}
assertTrue("log file exists", logFile.exists());
|