ServletRunner servletRunner = new ServletRunner(webXMLInputStream);
servletRunner.registerServlet("MyServlet",
"com.volantis.mcs.devices.ResolveDeviceServlet");
final ServletUnitClient servletClient = servletRunner.newClient();
final WebRequest request = new PostMethodWebRequest(
"http://test.colantis.com/MyServlet");
request.setHeaderField("User-Agent", "Mozilla/5.0 blah blah blah");
request.setHeaderField("host", "www.volantis.com:8080");
request.setHeaderField("Accept", "text/html");
request.setHeaderField("HeaderName", "HeaderValue");
ConfigValue cv = new ConfigValue();
AppConfigurator ac = new MyAppConfigurator();
ac.setUp(cv);
try {
ConfigFileBuilder configFileBuilder = new ConfigFileBuilder();
configFileBuilder.buildConfigDocument(cv);
servletRunner.setRealPath(configFileBuilder.getConfigFileDir());
hypersonicManager.useCleanupWith(new Executor() {
public void execute() throws Exception {
createRepository();
WebResponse response = servletClient.getResponse(request);
assertEquals("Response Not as expected.",
"Device is Wibble", response.getText());
response = servletClient.getResponse(request);
assertEquals("Response Not as expected.",
"Device is Wibble", response.getText());
response = servletClient.getResponse(request);
assertEquals("Response Not as expected.",
"Device is Wibble", response.getText());
}
});
} finally {