}
@Test
public void compile() throws Exception {
final PathHandler servletPath = new PathHandler();
final ServletContainer container = ServletContainer.Factory.newInstance();
JspMojo mojo = TL.get();
final File root = mojo.getJspLocation();
getLog().info(String.format("JSP location: %s", root));
final FileFilter filter = new FileFilter() {
public boolean accept(File pathname) {
return pathname.getName().endsWith(".jsp");
}
};
ServletInfo servlet = JspServletBuilder.createServlet("Default Jsp Servlet", "*.jsp");
servlet.addInitParam("mappedfile", Boolean.TRUE.toString());
DeploymentInfo builder = new DeploymentInfo()
.setClassLoader(JspMojo.class.getClassLoader())
.setContextPath("/tck")
.setClassIntrospecter(DefaultClassIntrospector.INSTANCE)
.setDeploymentName("tck.war")
.setResourceManager(new FileResourceManager(root, Integer.MAX_VALUE))
.setTempDir(mojo.getTempDir())
.setServletStackTraces(ServletStackTraces.NONE)
.addServlet(servlet);
JspServletBuilder.setupDeployment(builder, new HashMap<String, JspPropertyGroup>(), new HashMap<String, TagLibraryInfo>(), new HackInstanceManager());
DeploymentManager manager = container.addDeployment(builder);
manager.deploy();
servletPath.addPrefixPath(builder.getContextPath(), manager.start());
DefaultServer.setRootHandler(servletPath);