Add Jetty SSL keystore in classpath test

Update JettyEmbeddedServletContainerFactoryTests to test loading an
SSL keystore from the classpath. Currently this is a Jetty only feature,
although if https://issues.apache.org/bugzilla/show_bug.cgi?id=56777 is
fixed we could do the same thing with Tomcat.

Closes gh-1943
pull/1779/merge
sopov.ivan 10 years ago committed by Phillip Webb
parent 6efa2d5315
commit 72dd75b66e

@ -312,6 +312,10 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
@Test @Test
public void basicSsl() throws Exception { public void basicSsl() throws Exception {
testBasicSllWithKeystore("src/test/resources/test.jks");
}
protected final void testBasicSllWithKeystore(String keyStore) throws Exception {
FileCopyUtils.copy("test", FileCopyUtils.copy("test",
new FileWriter(this.temporaryFolder.newFile("test.txt"))); new FileWriter(this.temporaryFolder.newFile("test.txt")));
@ -319,7 +323,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
factory.setDocumentRoot(this.temporaryFolder.getRoot()); factory.setDocumentRoot(this.temporaryFolder.getRoot());
Ssl ssl = new Ssl(); Ssl ssl = new Ssl();
ssl.setKeyStore("src/test/resources/test.jks"); ssl.setKeyStore(keyStore);
ssl.setKeyStorePassword("secret"); ssl.setKeyStorePassword("secret");
ssl.setKeyPassword("password"); ssl.setKeyPassword("password");
factory.setSsl(ssl); factory.setSsl(ssl);

@ -154,4 +154,9 @@ public class JettyEmbeddedServletContainerFactoryTests extends
assertThat(getResponse(getLocalUrl("/hello")), equalTo("Hello World")); assertThat(getResponse(getLocalUrl("/hello")), equalTo("Hello World"));
} }
@Test
public void basicSslClasspathKeyStore() throws Exception {
testBasicSllWithKeystore("classpath:test.jks");
}
} }

Loading…
Cancel
Save