private void executeInContainer(ContainerWrapper theWrapper,
DeployableFile theFile)
{
super.init();
log("Starting up container", Project.MSG_VERBOSE);
ContainerRunner runner = new ContainerRunner(theWrapper);
runner.setLogger(new AntLogger(getProject()));
try
{
URL url = new URL(theWrapper.getBaseURL() + "/"
+ theFile.getTestContext()
+ theFile.getServletRedirectorMapping()
+ "?Cactus_Service=RUN_TEST");
runner.setURL(url);
runner.startUpContainer();
log("Server name retrieved from 'Server' HTTP header: ["
+ runner.getServerName() + "]", Project.MSG_VERBOSE);
try
{
Enumeration tests = getIndividualTests();
while (tests.hasMoreElements())
{
JUnitTest test = (JUnitTest) tests.nextElement();
if (test.shouldRun(getProject())
&& !theWrapper.isExcluded(test.getName()))
{
test.setFork(true);
if (theWrapper.getToDir() != null)
{
test.setTodir(theWrapper.getToDir());
}
execute(test);
}
}
}
finally
{
log("Shutting down container", Project.MSG_VERBOSE);
runner.shutDownContainer();
log("Container shut down", Project.MSG_VERBOSE);
}
}
catch (MalformedURLException mue)
{