use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.
the class JettyBootstrapErrorsTest method missingServletWarFromClasspathTest.
@Test(expected = JettyBootstrapException.class)
public void missingServletWarFromClasspathTest() throws IllegalStateException, IOException, JettyBootstrapException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException {
// will throw JettyBootstrapException because war is not in classpath
JettyBootstrap jettyBootstrap = initServer(false);
jettyBootstrap.addWarAppFromClasspath("/servlet-missing.war", "/servletWarFromClasspath-missing");
jettyBootstrap.startServer();
}
use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.
the class JettyBootstrapErrorsTest method missingStaticWarTest.
@Test(expected = JettyBootstrapException.class)
public void missingStaticWarTest() throws IllegalStateException, IOException, JettyBootstrapException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, URISyntaxException {
JettyBootstrap jettyBootstrap = initServer(false);
jettyBootstrap.addWarApp("Missing", "/staticWar");
jettyBootstrap.startServer();
}
use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.
the class AbstractJettyBootstrapTest method initServer.
protected JettyBootstrap initServer(boolean ssl) throws JettyBootstrapException, IOException {
JettyConfiguration jettyConfiguration = new JettyConfiguration();
jettyConfiguration.setStopAtShutdown(false);
jettyConfiguration.setAutoJoinOnStart(false);
jettyConfiguration.setTempDirectory(temporaryFolder.newFolder());
jettyConfiguration.setCleanTempDir(true);
jettyConfiguration.setPersistAppTempDirectories(false);
jettyConfiguration.setHost(HOST);
if (ssl) {
jettyConfiguration.setJettyConnectors(JettyConnector.HTTPS);
jettyConfiguration.setSslPort(SSL_PORT);
} else {
jettyConfiguration.setJettyConnectors(JettyConnector.HTTP);
jettyConfiguration.setPort(PORT);
}
this.ssl = ssl;
this.jettyBootstrap = new JettyBootstrap(jettyConfiguration);
return this.jettyBootstrap;
}
use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.
the class JettyBootstrapTest method do06SslStaticWarFromClasspathTest.
@Test
public void do06SslStaticWarFromClasspathTest() throws IllegalStateException, IOException, JettyBootstrapException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException {
JettyBootstrap jettyBootstrap = initServer(true);
jettyBootstrap.addWarAppFromClasspath("/static.war", "/sslStaticWarFromClasspath");
jettyBootstrap.startServer();
Assert.assertEquals(new SimpleResponse(200, "test1content\n"), get("/sslStaticWarFromClasspath/test1.html"));
Assert.assertEquals(new SimpleResponse(200, "test2content\n"), get("/sslStaticWarFromClasspath/test2.html"));
Assert.assertEquals(new Integer(404), get("/test3.html").getStatusCode());
}
use of org.teknux.jettybootstrap.JettyBootstrap in project jetty-bootstrap by teknux-org.
the class JettyBootstrapTest method do08SslServletWarFromClasspathTest.
@Test
public void do08SslServletWarFromClasspathTest() throws IllegalStateException, IOException, JettyBootstrapException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException {
JettyBootstrap jettyBootstrap = initServer(true);
jettyBootstrap.addWarAppFromClasspath("/servlet.war", "/sslServletWarFromClasspath");
jettyBootstrap.startServer();
Assert.assertEquals(new SimpleResponse(200, "Value=value1" + LINE_SEPARATOR), get("/sslServletWarFromClasspath?value=value1"));
Assert.assertEquals(new SimpleResponse(200, "Value=value2" + LINE_SEPARATOR), get("/sslServletWarFromClasspath?value=value2"));
}
Aggregations