import junit.extensions.TestSetup;
import junit.framework.Test;
[...]
public class CargoTestSetup extends TestSetup
{
InstalledLocalContainer container;
public CargoTestSetup(Test test)
{
super(test);
}
protected void setUp() throws Exception
{
Installer installer = new ZipURLInstaller(
new URL("http:));
installer.install();
LocalConfiguration configuration = (LocalConfiguration) new DefaultConfigurationFactory().createConfiguration(
"tomcat6x", ContainerType.INSTALLED, ConfigurationType.STANDALONE);
InstalledLocalContainer container =
(InstalledLocalContainer) new DefaultContainerFactory().createContainer(
"tomcat6x", ContainerType.INSTALLED, configuration);
container.setHome(installer.getHome());
configuration.addDeployable(new WAR("cargo.war"));
container.start();
}
protected void tearDown() throws Exception
{
container.stop();
}
}