Browse Source

Use WithPackageResources on shouldUpdateSslWhenReloadingSslBundles

See gh-44397
pull/42891/head
Andy Wilkinson 10 months ago
parent
commit
7d01c941b9
  1. 7
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java

7
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java

@ -660,12 +660,12 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory @@ -660,12 +660,12 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory
}
@Test
@WithPackageResources({ "1.crt", "1.key", "2.crt", "2.key" })
void shouldUpdateSslWhenReloadingSslBundles() throws Exception {
TomcatServletWebServerFactory factory = getFactory();
addTestTxtFile(factory);
DefaultSslBundleRegistry bundles = new DefaultSslBundleRegistry("test",
createPemSslBundle("classpath:org/springframework/boot/web/embedded/tomcat/1.crt",
"classpath:org/springframework/boot/web/embedded/tomcat/1.key"));
createPemSslBundle("classpath:1.crt", "classpath:1.key"));
factory.setSslBundles(bundles);
factory.setSsl(Ssl.forBundle("test"));
this.webServer = factory.getWebServer();
@ -677,8 +677,7 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory @@ -677,8 +677,7 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory
assertThat(getResponse(getLocalUrl("https", "/test.txt"), requestFactory)).isEqualTo("test");
assertThat(verifier.getLastPrincipal()).isEqualTo("CN=1");
requestFactory = createHttpComponentsRequestFactory(socketFactory);
bundles.updateBundle("test", createPemSslBundle("classpath:org/springframework/boot/web/embedded/tomcat/2.crt",
"classpath:org/springframework/boot/web/embedded/tomcat/2.key"));
bundles.updateBundle("test", createPemSslBundle("classpath:2.crt", "classpath:2.key"));
assertThat(getResponse(getLocalUrl("https", "/test.txt"), requestFactory)).isEqualTo("test");
assertThat(verifier.getLastPrincipal()).isEqualTo("CN=2");
}

Loading…
Cancel
Save