.setDeploymentName("servletContext.war")
.addServlet(s)
.addFilter(f)
.addFilterUrlMapping("filter", "/aa", DispatcherType.REQUEST);
DeploymentManager manager = container.addDeployment(builder);
manager.deploy();
root.addPrefixPath(builder.getContextPath(), manager.start());
DefaultServer.setRootHandler(root);
TestHttpClient client = new TestHttpClient();
try {
HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/servletContext/aa");
HttpResponse result = client.execute(get);
Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode());
final String response = HttpClientUtils.readResponse(result);
manager.stop();
manager.undeploy();
Assert.assertTrue(LifeCycleServlet.initCalled);
Assert.assertTrue(LifeCycleServlet.destroyCalled);
Assert.assertTrue(LifecycleFilter.initCalled);
Assert.assertTrue(LifecycleFilter.destroyCalled);