for (int i = 0; i < cargoElements.length; i++)
{
CargoElement element = (CargoElement) cargoElements[i];
Container container = element.getCargoContainer();
ContainerWrapper wrapper = new ContainerWrapper(container);
wrapper.setLogger(new AntLogger(this));
// Clone the DeployableFile instance as each container can
// override default deployment properties (e.g. port, context
// root, etc).
DeployableFile thisDeployable = null;
try
{
thisDeployable = (DeployableFile) deployableFile.clone();
}
catch (CloneNotSupportedException e)
{
throw new BuildException(e);
}
// Allow the container to override the default test context.
// This is to support container extensions to the web.xml file.
// Most containers allow defining the root context in these
// extensions.
wrapper.setSystemProperties(this.systemProperties);
// Add extra classpath entries
if (containerClasspath != null)
{
wrapper.setContainerClasspath(this.containerClasspath
.list());
}
if (wrapper.isEnabled())
{
wrapper.init();
log("--------------------------------------------------"
+ "---------------", Project.MSG_INFO);
log("Running tests against " + wrapper.getName()
+ " @ " + wrapper.getBaseURL(),
Project.MSG_INFO);
log("--------------------------------------------------"
+ "---------------", Project.MSG_INFO);
contextUrl.setValue(wrapper.getBaseURL() + "/"
+ thisDeployable.getTestContext());
executeInContainer(wrapper, thisDeployable);
}
}
}