From 72dd75b66e80d031ff72ba904bfe5882b4ac34d1 Mon Sep 17 00:00:00 2001 From: "sopov.ivan" Date: Tue, 18 Nov 2014 15:37:00 +0300 Subject: [PATCH] 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 --- .../AbstractEmbeddedServletContainerFactoryTests.java | 6 +++++- .../jetty/JettyEmbeddedServletContainerFactoryTests.java | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java index d8a4dd6ebc..268a7c1e85 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java @@ -312,6 +312,10 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { @Test public void basicSsl() throws Exception { + testBasicSllWithKeystore("src/test/resources/test.jks"); + } + + protected final void testBasicSllWithKeystore(String keyStore) throws Exception { FileCopyUtils.copy("test", new FileWriter(this.temporaryFolder.newFile("test.txt"))); @@ -319,7 +323,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { factory.setDocumentRoot(this.temporaryFolder.getRoot()); Ssl ssl = new Ssl(); - ssl.setKeyStore("src/test/resources/test.jks"); + ssl.setKeyStore(keyStore); ssl.setKeyStorePassword("secret"); ssl.setKeyPassword("password"); factory.setSsl(ssl); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java index 33b8be6fa8..1e5677666f 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java @@ -154,4 +154,9 @@ public class JettyEmbeddedServletContainerFactoryTests extends assertThat(getResponse(getLocalUrl("/hello")), equalTo("Hello World")); } + @Test + public void basicSslClasspathKeyStore() throws Exception { + testBasicSllWithKeystore("classpath:test.jks"); + } + }