Search in sources :

Example 16 with TestResourceLoader

use of io.undertow.servlet.test.util.TestResourceLoader in project undertow by undertow-io.

the class RealPathTestCase method setup.

@BeforeClass
public static void setup() throws ServletException {
    final PathHandler root = new PathHandler();
    final ServletContainer container = ServletContainer.Factory.newInstance();
    ServletInfo realPathServlet = new ServletInfo("real path servlet", RealPathServlet.class).addMapping("/path/*");
    DeploymentInfo builder = new DeploymentInfo().setClassIntrospecter(TestClassIntrospector.INSTANCE).setClassLoader(RealPathTestCase.class.getClassLoader()).setContextPath("/servletContext").setDeploymentName("servletContext.war").setResourceManager(new TestResourceLoader(RealPathTestCase.class)).addServlets(realPathServlet);
    DeploymentManager manager = container.addDeployment(builder);
    manager.deploy();
    root.addPrefixPath(builder.getContextPath(), manager.start());
    DefaultServer.setRootHandler(root);
}
Also used : ServletInfo(io.undertow.servlet.api.ServletInfo) TestResourceLoader(io.undertow.servlet.test.util.TestResourceLoader) DeploymentManager(io.undertow.servlet.api.DeploymentManager) ServletContainer(io.undertow.servlet.api.ServletContainer) PathHandler(io.undertow.server.handlers.PathHandler) DeploymentInfo(io.undertow.servlet.api.DeploymentInfo) BeforeClass(org.junit.BeforeClass)

Example 17 with TestResourceLoader

use of io.undertow.servlet.test.util.TestResourceLoader in project undertow by undertow-io.

the class ContentTypeFilesTestCase method setup.

@BeforeClass
public static void setup() throws ServletException {
    final PathHandler root = new PathHandler();
    final ServletContainer container = ServletContainer.Factory.newInstance();
    DeploymentInfo builder = new DeploymentInfo().setClassIntrospecter(TestClassIntrospector.INSTANCE).setClassLoader(ContentTypeFilesTestCase.class.getClassLoader()).setContextPath("/app").setDeploymentName("servletContext.war").setResourceManager(new TestResourceLoader(ContentTypeServlet.class)).setDefaultServletConfig(new DefaultServletConfig(true)).addMimeMapping(new MimeMapping("jnlp", "application/x-java-jnlp-file"));
    DeploymentManager manager = container.addDeployment(builder);
    manager.deploy();
    root.addPrefixPath(builder.getContextPath(), manager.start());
    DefaultServer.setRootHandler(root);
}
Also used : TestResourceLoader(io.undertow.servlet.test.util.TestResourceLoader) DeploymentManager(io.undertow.servlet.api.DeploymentManager) ServletContainer(io.undertow.servlet.api.ServletContainer) PathHandler(io.undertow.server.handlers.PathHandler) DefaultServletConfig(io.undertow.servlet.api.DefaultServletConfig) DeploymentInfo(io.undertow.servlet.api.DeploymentInfo) MimeMapping(io.undertow.servlet.api.MimeMapping) BeforeClass(org.junit.BeforeClass)

Aggregations

DeploymentInfo (io.undertow.servlet.api.DeploymentInfo)17 DeploymentManager (io.undertow.servlet.api.DeploymentManager)17 ServletContainer (io.undertow.servlet.api.ServletContainer)17 TestResourceLoader (io.undertow.servlet.test.util.TestResourceLoader)17 BeforeClass (org.junit.BeforeClass)16 PathHandler (io.undertow.server.handlers.PathHandler)11 ServletInfo (io.undertow.servlet.api.ServletInfo)11 WebSocketDeploymentInfo (io.undertow.websockets.jsr.WebSocketDeploymentInfo)6 FilterInfo (io.undertow.servlet.api.FilterInfo)5 ServerWebSocketContainer (io.undertow.websockets.jsr.ServerWebSocketContainer)5 ServletPathMappingTestCase (io.undertow.servlet.test.path.ServletPathMappingTestCase)3 LoginConfig (io.undertow.servlet.api.LoginConfig)2 ServletSecurityInfo (io.undertow.servlet.api.ServletSecurityInfo)2 ServletIdentityManager (io.undertow.servlet.test.security.constraint.ServletIdentityManager)2 MessageFilter (io.undertow.servlet.test.util.MessageFilter)2 MessageServlet (io.undertow.servlet.test.util.MessageServlet)2 DefaultByteBufferPool (io.undertow.server.DefaultByteBufferPool)1 MetricsHandler (io.undertow.server.handlers.MetricsHandler)1 AccessLogHandler (io.undertow.server.handlers.accesslog.AccessLogHandler)1 DefaultServletConfig (io.undertow.servlet.api.DefaultServletConfig)1