Search in sources :

Example 16 with JettyBootstrap

use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.

the class JettyBootstrapTest method do20SslHandlerTest.

@Test
public void do20SslHandlerTest() throws IllegalStateException, IOException, JettyBootstrapException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException {
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/sslHandler");
    context.addServlet(new ServletHolder(new TestServlet()), "/*");
    JettyBootstrap jettyBootstrap = initServer(true);
    jettyBootstrap.addHandler(context);
    jettyBootstrap.startServer();
    Assert.assertEquals(new SimpleResponse(200, "ServletTestContent" + LINE_SEPARATOR), get("/sslHandler"));
}
Also used : ServletHolder(org.eclipse.jetty.servlet.ServletHolder) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler) JettyBootstrap(org.teknux.jettybootstrap.JettyBootstrap) Test(org.junit.Test)

Example 17 with JettyBootstrap

use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.

the class JettyBootstrapTest method do17Self.

@Test
public void do17Self() throws IllegalStateException, IOException, JettyBootstrapException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, URISyntaxException {
    JettyBootstrap jettyBootstrap = initServer(false);
    jettyBootstrap.addSelf();
    jettyBootstrap.startServer();
    Assert.assertEquals(new SimpleResponse(200, "StaticResContent\n"), get("/index.html"));
}
Also used : JettyBootstrap(org.teknux.jettybootstrap.JettyBootstrap) Test(org.junit.Test)

Example 18 with JettyBootstrap

use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.

the class JettyBootstrapTest method do15ExplodedWarFromClasspathTest.

@Test
public void do15ExplodedWarFromClasspathTest() throws IllegalStateException, IOException, JettyBootstrapException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, URISyntaxException {
    JettyBootstrap jettyBootstrap = initServer(false);
    jettyBootstrap.addExplodedWarAppFromClasspath("/webapp", null, "/explodedWarFromClasspath");
    jettyBootstrap.startServer();
    Assert.assertEquals(new SimpleResponse(200, "StaticResContent\n"), get("/explodedWarFromClasspath/index.html"));
}
Also used : JettyBootstrap(org.teknux.jettybootstrap.JettyBootstrap) Test(org.junit.Test)

Example 19 with JettyBootstrap

use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.

the class JettyBootstrapTest method do03ServletWarTest.

@Test
public void do03ServletWarTest() throws IllegalStateException, IOException, JettyBootstrapException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, URISyntaxException {
    File file = temporaryFolder.newFile();
    copyResourceToFile("/servlet.war", file);
    JettyBootstrap jettyBootstrap = initServer(false);
    jettyBootstrap.addWarApp(file.getPath(), "/servletWar");
    jettyBootstrap.startServer();
    Assert.assertEquals(new SimpleResponse(200, "Value=value1" + LINE_SEPARATOR), get("/servletWar?value=value1"));
    Assert.assertEquals(new SimpleResponse(200, "Value=value2" + LINE_SEPARATOR), get("/servletWar?value=value2"));
}
Also used : JettyBootstrap(org.teknux.jettybootstrap.JettyBootstrap) File(java.io.File) Test(org.junit.Test)

Example 20 with JettyBootstrap

use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.

the class JettyBootstrapTest method do18SslSelf.

@Test
public void do18SslSelf() throws IllegalStateException, IOException, JettyBootstrapException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, URISyntaxException {
    JettyBootstrap jettyBootstrap = initServer(true);
    jettyBootstrap.addSelf();
    jettyBootstrap.startServer();
    Assert.assertEquals(new SimpleResponse(200, "StaticResContent\n"), get("/index.html"));
}
Also used : JettyBootstrap(org.teknux.jettybootstrap.JettyBootstrap) Test(org.junit.Test)

Aggregations

JettyBootstrap (org.teknux.jettybootstrap.JettyBootstrap)24 Test (org.junit.Test)22 File (java.io.File)9 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)2 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)2 JettyConfiguration (org.teknux.jettybootstrap.configuration.JettyConfiguration)1