}
}
}
private ServletContext createServletContext() {
MockServletContext ctx = new MockServletContext();
File testDataDir = null;
;
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext();
Resource testDataResource = context.getResource("testdata");
if (testDataResource == null)
throw new RuntimeException("Can't find test data.");
try {
testDataDir = testDataResource.getFile();
File services = new File(testDataDir, "services.xml");
if (!services.exists())
throw new FileNotFoundException(services.getPath());
ctx.addInitParameter("GEOSERVER_DATA_DIR", testDataDir.getAbsolutePath());
ctx.addInitParameter("serviceStrategy", "PARTIAL-BUFFER2");
} catch (IOException ex) {
LOGGER.severe("Error in test files: " + ex.getMessage());
throw new RuntimeException("Error in test files", ex);
}