Search in sources :

Example 1 with Embedded

use of org.apache.catalina.startup.Embedded in project async-http-client by AsyncHttpClient.

the class WebDavBasicTest method setUpGlobal.

@BeforeClass(alwaysRun = true)
public void setUpGlobal() throws Exception {
    embedded = new Embedded();
    String path = new File(".").getAbsolutePath();
    embedded.setCatalinaHome(path);
    Engine engine = embedded.createEngine();
    engine.setDefaultHost("localhost");
    Host host = embedded.createHost("localhost", path);
    engine.addChild(host);
    Context c = embedded.createContext("/", path);
    c.setReloadable(false);
    Wrapper w = c.createWrapper();
    w.addMapping("/*");
    w.setServletClass(org.apache.catalina.servlets.WebdavServlet.class.getName());
    w.addInitParameter("readonly", "false");
    w.addInitParameter("listings", "true");
    w.setLoadOnStartup(0);
    c.addChild(w);
    host.addChild(c);
    Connector connector = embedded.createConnector("localhost", 0, Http11NioProtocol.class.getName());
    connector.setContainer(host);
    embedded.addEngine(engine);
    embedded.addConnector(connector);
    embedded.start();
    port1 = connector.getLocalPort();
}
Also used : Context(org.apache.catalina.Context) Wrapper(org.apache.catalina.Wrapper) Connector(org.apache.catalina.connector.Connector) Http11NioProtocol(org.apache.coyote.http11.Http11NioProtocol) Host(org.apache.catalina.Host) Embedded(org.apache.catalina.startup.Embedded) File(java.io.File) Engine(org.apache.catalina.Engine) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

File (java.io.File)1 Context (org.apache.catalina.Context)1 Engine (org.apache.catalina.Engine)1 Host (org.apache.catalina.Host)1 Wrapper (org.apache.catalina.Wrapper)1 Connector (org.apache.catalina.connector.Connector)1 Embedded (org.apache.catalina.startup.Embedded)1 Http11NioProtocol (org.apache.coyote.http11.Http11NioProtocol)1 BeforeClass (org.testng.annotations.BeforeClass)1