diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java index 86c30311a7f9..e4de8e40ba37 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/BeanDefinitionLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import org.springframework.boot.sampleconfig.MyComponent; import org.springframework.boot.sampleconfig.MyNamedComponent; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.context.support.StaticApplicationContext; import org.springframework.core.io.ClassPathResource; @@ -72,8 +73,9 @@ void loadJsr330Class() { } @Test + @WithSampleBeansXmlResource void loadXmlResource() { - ClassPathResource resource = new ClassPathResource("sample-beans.xml", getClass()); + ClassPathResource resource = new ClassPathResource("org/springframework/boot/sample-beans.xml"); BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, resource); assertThat(load(loader)).isOne(); assertThat(this.registry.containsBean("myXmlComponent")).isTrue(); @@ -81,8 +83,15 @@ void loadXmlResource() { } @Test + @WithResource(name = "org/springframework/boot/sample-beans.groovy", content = """ + import org.springframework.boot.sampleconfig.MyComponent; + + beans { + myGroovyComponent(MyComponent) {} + } + """) void loadGroovyResource() { - ClassPathResource resource = new ClassPathResource("sample-beans.groovy", getClass()); + ClassPathResource resource = new ClassPathResource("org/springframework/boot/sample-beans.groovy"); BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, resource); assertThat(load(loader)).isOne(); assertThat(this.registry.containsBean("myGroovyComponent")).isTrue(); @@ -90,8 +99,17 @@ void loadGroovyResource() { } @Test + @WithResource(name = "org/springframework/boot/sample-namespace.groovy", content = """ + import org.springframework.boot.sampleconfig.MyComponent; + + beans { + xmlns([ctx:'http://www.springframework.org/schema/context']) + ctx.'component-scan'('base-package':'nonexistent') + myGroovyComponent(MyComponent) {} + } + """) void loadGroovyResourceWithNamespace() { - ClassPathResource resource = new ClassPathResource("sample-namespace.groovy", getClass()); + ClassPathResource resource = new ClassPathResource("org/springframework/boot/sample-namespace.groovy"); BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, resource); assertThat(load(loader)).isOne(); assertThat(this.registry.containsBean("myGroovyComponent")).isTrue(); @@ -114,7 +132,8 @@ void loadClassName() { } @Test - void loadResourceName() { + @WithSampleBeansXmlResource + void loadXmlName() { BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, "classpath:org/springframework/boot/sample-beans.xml"); assertThat(load(loader)).isOne(); @@ -122,6 +141,13 @@ void loadResourceName() { } @Test + @WithResource(name = "org/springframework/boot/sample-beans.groovy", content = """ + import org.springframework.boot.sampleconfig.MyComponent; + + beans { + myGroovyComponent(MyComponent) {} + } + """) void loadGroovyName() { BeanDefinitionLoader loader = new BeanDefinitionLoader(this.registry, "classpath:org/springframework/boot/sample-beans.groovy"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java index 2db0367d3858..924a80d9977d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SimpleMainTests.java @@ -61,12 +61,14 @@ void configClassContext(CapturedOutput output) throws Exception { } @Test + @WithSampleBeansXmlResource void xmlContext(CapturedOutput output) throws Exception { SpringApplication.main(getArgs("org/springframework/boot/sample-beans.xml")); assertThat(output).contains(SPRING_STARTUP); } @Test + @WithSampleBeansXmlResource void mixedContext(CapturedOutput output) throws Exception { SpringApplication.main(getArgs(getClass().getName(), "org/springframework/boot/sample-beans.xml")); assertThat(output).contains(SPRING_STARTUP); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationBannerPrinterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationBannerPrinterTests.java index 50250c8c0c00..1335c0aa690e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationBannerPrinterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationBannerPrinterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.context.support.GenericApplicationContext; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; @@ -47,9 +48,10 @@ void shouldRegisterRuntimeHints() { } @Test + @WithResource(name = "banner.txt", content = "\uD83D\uDE0D Spring Boot! \uD83D\uDE0D") void shouldUseUtf8() { ResourceLoader resourceLoader = new GenericApplicationContext(); - Resource resource = resourceLoader.getResource("classpath:/banner-utf8.txt"); + Resource resource = resourceLoader.getResource("classpath:banner.txt"); SpringApplicationBannerPrinter printer = new SpringApplicationBannerPrinter(resourceLoader, new ResourceBanner(resource)); Log log = mock(Log.class); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java index 681e7ca881a0..3117b3d4446e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -72,6 +72,7 @@ import org.springframework.boot.context.event.SpringApplicationEvent; import org.springframework.boot.convert.ApplicationConversionService; import org.springframework.boot.testsupport.classpath.ForkedClassPath; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.boot.testsupport.system.CapturedOutput; import org.springframework.boot.testsupport.system.OutputCaptureExtension; import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory; @@ -226,19 +227,24 @@ void sourcesMustBeAccessible() { } @Test + @WithResource(name = "banner.txt", content = "Running a Test!") void customBanner(CapturedOutput output) { SpringApplication application = spy(new SpringApplication(ExampleConfig.class)); application.setWebApplicationType(WebApplicationType.NONE); - this.context = application.run("--spring.banner.location=classpath:test-banner.txt"); + this.context = application.run(); assertThat(output).startsWith("Running a Test!"); + } @Test + @WithResource(name = "banner.txt", content = """ + Running a Test! + + ${test.property}""") void customBannerWithProperties(CapturedOutput output) { SpringApplication application = spy(new SpringApplication(ExampleConfig.class)); application.setWebApplicationType(WebApplicationType.NONE); - this.context = application.run("--spring.banner.location=classpath:test-banner-with-placeholder.txt", - "--test.property=123456"); + this.context = application.run("--test.property=123456"); assertThat(output).containsPattern("Running a Test!\\s+123456"); } @@ -288,6 +294,7 @@ void enableBannerInLogViaProperty(CapturedOutput output) { } @Test + @WithResource(name = "bindtoapplication.properties", content = "spring.main.banner-mode=off") void triggersConfigFileApplicationListenerBeforeBinding() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -539,6 +546,7 @@ void commandLinePropertySourceEnhancesEnvironment() { } @Test + @WithResource(name = "application.properties", content = "foo=bucket") void propertiesFileEnhancesEnvironment() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -571,6 +579,8 @@ void additionalProfilesOrderedBeforeActiveProfiles() { } @Test + @WithResource(name = "application.properties", content = "my.property=fromapplicationproperties") + @WithResource(name = "application-other.properties", content = "my.property=fromotherpropertiesfile") void addProfilesOrderWithProperties() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -583,6 +593,7 @@ void addProfilesOrderWithProperties() { } @Test + @WithResource(name = "application.properties", content = "foo=bucket") void emptyCommandLinePropertySourceNotAdded() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -813,11 +824,13 @@ void loadSources() { } @Test + @WithSampleBeansXmlResource + @WithResource(name = "application.properties", content = "sample.app.test.prop=*") void wildcardSources() { TestSpringApplication application = new TestSpringApplication(); application.getSources().add("classpath*:org/springframework/boot/sample-${sample.app.test.prop}.xml"); application.setWebApplicationType(WebApplicationType.NONE); - this.context = application.run(); + this.context = application.run("--spring.config.location=classpath:/"); } @Test @@ -1138,6 +1151,8 @@ void reactiveApplicationConfiguredViaAPropertyHasTheCorrectTypeOfContextAndEnvir } @Test + @WithResource(name = "application-withwebapplicationtype.yml", + content = "spring.main.web-application-type: reactive") void environmentIsConvertedIfTypeDoesNotMatch() { ConfigurableApplicationContext context = new SpringApplication(ExampleReactiveWebConfig.class) .run("--spring.profiles.active=withwebapplicationtype"); @@ -1194,6 +1209,7 @@ void circularReferencesCanBeEnabled() { } @Test + @WithResource(name = "custom-config/application.yml", content = "hello: world") void relaxedBindingShouldWorkBeforeEnvironmentIsPrepared() { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); @@ -1328,6 +1344,8 @@ void bindsEnvironmentPrefixToSpringApplication() { } @Test + @WithResource(name = "spring-application-config-property-source.properties", + content = "test.name=spring-application-config-property-source") void movesConfigClassPropertySourcesToEnd() { SpringApplication application = new SpringApplication(PropertySourceConfig.class); application.setWebApplicationType(WebApplicationType.NONE); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/WithSampleBeansXmlResource.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/WithSampleBeansXmlResource.java new file mode 100644 index 000000000000..91359f63bcfb --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/WithSampleBeansXmlResource.java @@ -0,0 +1,47 @@ +/* + * Copyright 2012-2025 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.boot.testsupport.classpath.resources.WithResource; + +/** + * Makes an {@code org/springframework/boot/sample-beans.xml} resource available from the + * thread context classloader. + * + * @author Andy Wilkinson + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +@WithResource(name = "org/springframework/boot/sample-beans.xml", + content = """ + + + + + """) +@interface WithSampleBeansXmlResource { + +} diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java index c5341c8fd945..3f4b5a4ed9f5 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/builder/SpringApplicationBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplicationShutdownHookInstance; import org.springframework.boot.WebApplicationType; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -72,14 +73,21 @@ private void close(ApplicationContext context) { } @Test + @WithResource(name = "application.properties", content = """ + b=file + c=file + """) + @WithResource(name = "application-foo.properties", content = "b=profile-specific-file") void profileAndProperties() { SpringApplicationBuilder application = new SpringApplicationBuilder().sources(ExampleConfig.class) .contextFactory(ApplicationContextFactory.ofContextClass(StaticApplicationContext.class)) .profiles("foo") - .properties("foo=bar"); + .properties("a=default"); this.context = application.run(); assertThat(this.context).isInstanceOf(StaticApplicationContext.class); - assertThat(this.context.getEnvironment().getProperty("foo")).isEqualTo("bucket"); + assertThat(this.context.getEnvironment().getProperty("a")).isEqualTo("default"); + assertThat(this.context.getEnvironment().getProperty("b")).isEqualTo("profile-specific-file"); + assertThat(this.context.getEnvironment().getProperty("c")).isEqualTo("file"); assertThat(this.context.getEnvironment().acceptsProfiles(Profiles.of("foo"))).isTrue(); } @@ -194,6 +202,7 @@ void parentFirstCreation() { } @Test + @WithResource(name = "application-node.properties", content = "bar=spam") void parentFirstCreationWithProfileAndDefaultArgs() { SpringApplicationBuilder application = new SpringApplicationBuilder(ExampleConfig.class).profiles("node") .properties("transport=redis") diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/annotation/ImportCandidatesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/annotation/ImportCandidatesTests.java index 2d4551f00edf..8af49ee43a1e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/annotation/ImportCandidatesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/annotation/ImportCandidatesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,8 @@ import org.junit.jupiter.api.Test; +import org.springframework.boot.testsupport.classpath.resources.WithResource; + import static org.assertj.core.api.Assertions.assertThat; /** @@ -32,7 +34,18 @@ */ class ImportCandidatesTests { + private static final String IMPORTS_FILE = "META-INF/spring/org.springframework.boot.context.annotation.ImportCandidatesTests$TestAnnotation.imports"; + @Test + @WithResource(name = IMPORTS_FILE, content = """ + # A comment spanning a complete line + class1 + + class2 # with comment at the end + # Comment with some whitespace in front + class3 + + """) void loadReadsFromClasspathFile() { ImportCandidates candidates = ImportCandidates.load(TestAnnotation.class, null); assertThat(candidates).containsExactly("class1", "class2", "class3"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/AnsiOutputApplicationListenerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/AnsiOutputApplicationListenerTests.java index 75c4b9bbcd67..cf198bf2c237 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/AnsiOutputApplicationListenerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/AnsiOutputApplicationListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,11 +28,9 @@ import org.springframework.boot.ansi.AnsiOutput; import org.springframework.boot.ansi.AnsiOutput.Enabled; import org.springframework.boot.ansi.AnsiOutputEnabledValue; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.StandardEnvironment; -import org.springframework.test.context.support.TestPropertySourceUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -81,11 +79,9 @@ void disabled() { } @Test + @WithResource(name = "application.properties", content = "spring.output.ansi.enabled=never") void disabledViaApplicationProperties() { - ConfigurableEnvironment environment = new StandardEnvironment(); - TestPropertySourceUtils.addInlinedPropertiesToEnvironment(environment, "spring.config.name=ansi"); SpringApplication application = new SpringApplication(Config.class); - application.setEnvironment(environment); application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run(); assertThat(AnsiOutputEnabledValue.get()).isEqualTo(Enabled.NEVER); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorBootstrapContextIntegrationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorBootstrapContextIntegrationTests.java index 45d8eec77158..93a3d39efacc 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorBootstrapContextIntegrationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorBootstrapContextIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.WebApplicationType; import org.springframework.boot.context.config.TestConfigDataBootstrap.LoaderHelper; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Configuration; @@ -45,9 +46,24 @@ void setup() { } @Test + @WithResource(name = "imported.properties", content = """ + spring.config.import=testbootstrap:test + spring.profiles.active=test + myprop=igotbound + #--- + spring.config.activate.on-profile=test + myprofileprop=igotprofilebound + + """) + @WithResource(name = "META-INF/spring.factories", content = """ + org.springframework.boot.context.config.ConfigDataLoader=\ + org.springframework.boot.context.config.TestConfigDataBootstrap.Loader + org.springframework.boot.context.config.ConfigDataLocationResolver=\ + org.springframework.boot.context.config.TestConfigDataBootstrap.LocationResolver + """) void bootstrapsApplicationContext() { try (ConfigurableApplicationContext context = this.application - .run("--spring.config.import=classpath:application-bootstrap-registry-integration-tests.properties")) { + .run("--spring.config.import=classpath:imported.properties")) { LoaderHelper bean = context.getBean(TestConfigDataBootstrap.LoaderHelper.class); assertThat(bean).isNotNull(); assertThat(bean.getBound()).isEqualTo("igotbound"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegrationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegrationTests.java index 0b9f5e58c621..c4e28c206d59 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegrationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ import org.springframework.boot.context.config.ConfigData.Option; import org.springframework.boot.context.config.ConfigData.Options; import org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessorIntegrationTests.Config; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.PropertySource; @@ -45,6 +46,18 @@ * * @author Phillip Webb */ +@WithResource(name = "application.properties", content = """ + spring.config.import=icwps: + prop=fromfile + """) +@WithResource(name = "application-prod.properties", content = "prop=fromprofilefile") +@WithResource(name = "META-INF/spring.factories", + content = """ + org.springframework.boot.context.config.ConfigDataLoader=\ + org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegrationTests.Loader + org.springframework.boot.context.config.ConfigDataLocationResolver=\ + org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegrationTests.LocationResolver + """) class ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegrationTests { private SpringApplication application; @@ -60,16 +73,14 @@ void setup() { @Test void testWithoutProfile() { - ConfigurableApplicationContext context = this.application - .run("--spring.config.name=configimportwithprofilespecific"); + ConfigurableApplicationContext context = this.application.run(); String value = context.getEnvironment().getProperty("prop"); assertThat(value).isEqualTo("fromicwps1"); } @Test void testWithProfile() { - ConfigurableApplicationContext context = this.application - .run("--spring.config.name=configimportwithprofilespecific", "--spring.profiles.active=prod"); + ConfigurableApplicationContext context = this.application.run("--spring.profiles.active=prod"); String value = context.getEnvironment().getProperty("prop"); assertThat(value).isEqualTo("fromicwps2"); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorIntegrationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorIntegrationTests.java index 940db092ec43..12005f44db17 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorIntegrationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,16 +20,17 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.UUID; -import org.apache.logging.log4j.util.Strings; import org.assertj.core.api.Condition; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -46,6 +47,9 @@ import org.springframework.boot.context.properties.source.ConfigurationProperty; import org.springframework.boot.context.properties.source.ConfigurationPropertyName; import org.springframework.boot.origin.Origin; +import org.springframework.boot.testsupport.BuildOutput; +import org.springframework.boot.testsupport.classpath.resources.WithResource; +import org.springframework.boot.testsupport.classpath.resources.WithResourceDirectory; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Configuration; @@ -59,6 +63,7 @@ import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; import org.springframework.util.FileCopyUtils; +import org.springframework.util.FileSystemUtils; import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; @@ -115,6 +120,7 @@ public ClassLoader getClassLoader() { } @Test + @WithResource(name = "application.properties", content = "foo=bucket") void runLoadsApplicationPropertiesOnClasspath() { ConfigurableApplicationContext context = this.application.run(); String property = context.getEnvironment().getProperty("foo"); @@ -122,13 +128,15 @@ void runLoadsApplicationPropertiesOnClasspath() { } @Test + @WithResource(name = "application.yaml", content = "yamlkey: yamlvalue") void runLoadsApplicationYamlOnClasspath() { - ConfigurableApplicationContext context = this.application.run("--spring.config.name=customapplication"); + ConfigurableApplicationContext context = this.application.run(); String property = context.getEnvironment().getProperty("yamlkey"); assertThat(property).isEqualTo("yamlvalue"); } @Test + @WithResource(name = "testproperties.properties", content = "the.property=frompropertiesfile") void runLoadsFileWithCustomName() { ConfigurableApplicationContext context = this.application.run("--spring.config.name=testproperties"); String property = context.getEnvironment().getProperty("the.property"); @@ -136,45 +144,84 @@ void runLoadsFileWithCustomName() { } @Test + @WithResource(name = "application.properties", content = """ + duplicate=properties + only-properties = properties + """) + @WithResource(name = "application.yaml", content = """ + duplicate: yaml + only-yaml: yaml + """) void runWhenPropertiesAndYamlShouldPreferProperties() { ConfigurableApplicationContext context = this.application.run(); - String property = context.getEnvironment().getProperty("duplicate"); - assertThat(property).isEqualTo("properties"); + assertThat(context.getEnvironment().getProperty("duplicate")).isEqualTo("properties"); + assertThat(context.getEnvironment().getProperty("only-properties")).isEqualTo("properties"); + assertThat(context.getEnvironment().getProperty("only-yaml")).isEqualTo("yaml"); } @Test + @WithResource(name = "moreproperties.properties", content = """ + the.property=more + only.more=more + """) + @WithResource(name = "testproperties.properties", content = """ + the.property=test + only.test=test + """) void runWhenMultipleCustomNamesLoadsEachName() { ConfigurableApplicationContext context = this.application .run("--spring.config.name=moreproperties,testproperties"); - String property = context.getEnvironment().getProperty("the.property"); - assertThat(property).isEqualTo("frompropertiesfile"); + assertThat(context.getEnvironment().getProperty("the.property")).isEqualTo("test"); + assertThat(context.getEnvironment().getProperty("only.more")).isEqualTo("more"); + assertThat(context.getEnvironment().getProperty("only.test")).isEqualTo("test"); } @Test + @WithResource(name = "application-default.properties", content = "my.property=fromdefaultpropertiesfile") void runWhenNoActiveProfilesLoadsDefaultProfileFile() { - ConfigurableApplicationContext context = this.application.run("--spring.config.name=testprofiles"); + ConfigurableApplicationContext context = this.application.run(); String property = context.getEnvironment().getProperty("my.property"); assertThat(property).isEqualTo("fromdefaultpropertiesfile"); } @Test + @WithResource(name = "application.yaml", content = """ + --- + my: + property: fromyamlfile + other: notempty + --- + spring.config.activate.on-profile: default + my: + property: fromdefaultprofile + --- + spring.config.activate.on-profile: other + my: + property: fromotherprofile + """) void runWhenActiveProfilesDoesNotLoadDefault() { - ConfigurableApplicationContext context = this.application.run("--spring.config.name=testprofilesdocument", - "--spring.config.location=classpath:configdata/profiles/", "--spring.profiles.default=thedefault", - "--spring.profiles.active=other"); + ConfigurableApplicationContext context = this.application.run("--spring.profiles.active=other"); String property = context.getEnvironment().getProperty("my.property"); assertThat(property).isEqualTo("fromotherprofile"); } @Test + @WithResource(name = "application-thedefault.properties", content = "the.property=fromdefaultpropertiesfile") void runWhenHasCustomDefaultProfileLoadsDefaultProfileFile() { - ConfigurableApplicationContext context = this.application.run("--spring.config.name=testprofiles", - "--spring.profiles.default=thedefault"); + ConfigurableApplicationContext context = this.application.run("--spring.profiles.default=thedefault"); String property = context.getEnvironment().getProperty("the.property"); assertThat(property).isEqualTo("fromdefaultpropertiesfile"); } @Test + @WithResource(name = "application.properties", content = """ + foo=bucket + my.property=fromapplicationproperties + """) + @WithResource(name = "testproperties.properties", content = """ + my.property=frompropertiesfile + the.property=frompropertiesfile + """) void runWhenHasCustomSpringConfigLocationLoadsAllFromSpecifiedLocation() { ConfigurableApplicationContext context = this.application .run("--spring.config.location=classpath:application.properties,classpath:testproperties.properties"); @@ -187,29 +234,68 @@ void runWhenHasCustomSpringConfigLocationLoadsAllFromSpecifiedLocation() { } @Test - void runWhenOneCustomLocationDoesNotExistLoadsOthers() { + @WithResource(name = "application.properties", content = """ + foo=bucket + my.property=fromapplicationproperties + """) + @WithResource(name = "testproperties.properties", content = """ + my.property=frompropertiesfile + the.property=frompropertiesfile + """) + void runWhenOneCustomOptionalLocationDoesNotExistLoadsOthers() { ConfigurableApplicationContext context = this.application.run( "--spring.config.location=classpath:application.properties,classpath:testproperties.properties,optional:classpath:nonexistent.properties"); - String property = context.getEnvironment().getProperty("the.property"); - assertThat(property).isEqualTo("frompropertiesfile"); + assertThat(context.getEnvironment().getProperty("my.property")).isEqualTo("frompropertiesfile"); + assertThat(context.getEnvironment().getProperty("foo")).isEqualTo("bucket"); } @Test + @WithResource(name = "application.yml", content = """ + --- + my: + property: fromyamlfile + --- + spring.config.activate.on-profile: prod + spring.config.import: file:./non-existent.yml + """) void runWhenProfileSpecificMandatoryLocationDoesNotExistShouldNotFail() { - ConfigurableApplicationContext context = this.application.run("--spring.config.name=testprofiles", - "--spring.config.location=classpath:configdata/profiles/"); + ConfigurableApplicationContext context = this.application.run(); String property = context.getEnvironment().getProperty("my.property"); assertThat(property).isEqualTo("fromyamlfile"); } @Test + @WithResource(name = "application.yml", content = """ + --- + my: + property: fromyamlfile + --- + spring.config.activate.on-profile: prod + spring.config.import: file:./non-existent.yml + """) void runWhenProfileSpecificMandatoryLocationDoesNotExistShouldFailWhenProfileActive() { this.application.setAdditionalProfiles("prod"); - assertThatExceptionOfType(ConfigDataResourceNotFoundException.class).isThrownBy(() -> this.application - .run("--spring.config.name=testprofiles", "--spring.config.location=classpath:configdata/profiles/")); - } - - @Test + assertThatExceptionOfType(ConfigDataResourceNotFoundException.class).isThrownBy(() -> this.application.run()) + .withMessageContaining("non-existent.yml"); + } + + @Test + @WithResource(name = "enableprofile.properties", content = """ + spring.profiles.active=myprofile + my.property=frompropertiesfile + the.property=frompropertiesfile + one.more=${my.property} + """) + @WithResource(name = "enableother.properties", content = """ + spring.profiles.active=other + my.property=fromenableotherpropertiesfile + one.more=${my.property} + """) + @WithResource(name = "enableprofile-other.properties", content = "other.property=fromotherpropertiesfile") + @WithResource(name = "enableprofile-myprofile.properties", content = """ + my.property=fromprofilepropertiesfile + the.property=fromprofilepropertiesfile + """) void runWhenHasActiveProfilesFromMultipleLocationsActivatesProfileFromOneLocation() { ConfigurableApplicationContext context = this.application .run("--spring.config.location=classpath:enableprofile.properties,classpath:enableother.properties"); @@ -220,13 +306,27 @@ void runWhenHasActiveProfilesFromMultipleLocationsActivatesProfileFromOneLocatio } @Test + @WithResource(name = "enableprofile.properties", content = """ + spring.profiles.active=myprofile + my.property=frompropertiesfile + """) + @WithResource(name = "enabletwoprofiles.properties", content = """ + spring.profiles.active=myprofile,another + my.property=fromtwopropertiesfile + """) + @WithResource(name = "enableprofile-myprofile.properties", content = """ + my.property=frommyprofilepropertiesfile + """) + @WithResource(name = "enableprofile-another.properties", content = """ + my.property=fromanotherprofilepropertiesfile + """) void runWhenHasActiveProfilesFromMultipleAdditionalLocationsWithOneSwitchedOffLoadsExpectedProperties() { ConfigurableApplicationContext context = this.application.run( "--spring.config.additional-location=classpath:enabletwoprofiles.properties,classpath:enableprofile.properties"); ConfigurableEnvironment environment = context.getEnvironment(); assertThat(environment.getActiveProfiles()).containsExactly("myprofile"); String property = environment.getProperty("my.property"); - assertThat(property).isEqualTo("fromprofilepropertiesfile"); + assertThat(property).isEqualTo("frommyprofilepropertiesfile"); } @Test @@ -249,14 +349,18 @@ void runWhenHasLocalFileLoadsWithLocalFileTakingPrecedenceOverClasspath() throws } @Test + @WithResource(name = "application.properties", content = """ + my.property=frompropertiesfile + the.property=frompropertiesfile + """) void runWhenHasCommandLinePropertiesLoadsWithCommandLineTakingPrecedence() { StandardEnvironment environment = new StandardEnvironment(); environment.getPropertySources() .addFirst(new SimpleCommandLinePropertySource("--the.property=fromcommandline")); this.application.setEnvironment(environment); - ConfigurableApplicationContext context = this.application.run("--spring.config.name=testproperties"); - String property = context.getEnvironment().getProperty("the.property"); - assertThat(property).isEqualTo("fromcommandline"); + ConfigurableApplicationContext context = this.application.run(); + assertThat(context.getEnvironment().getProperty("the.property")).isEqualTo("fromcommandline"); + assertThat(context.getEnvironment().getProperty("my.property")).isEqualTo("frompropertiesfile"); } @Test @@ -268,15 +372,17 @@ void runWhenHasSystemPropertyLoadsWithSystemPropertyTakingPrecedence() { } @Test + @WithResource(name = "application.properties", content = "my.property=fromapplicationproperties") void runWhenHasDefaultPropertiesIncludesDefaultPropertiesLast() { - this.application.setDefaultProperties(Collections.singletonMap("my.fallback", "foo")); + this.application.setDefaultProperties(Map.of("my.property", "fromdefaults", "my.fallback", "fromdefaults")); ConfigurableApplicationContext context = this.application.run(); - String property = context.getEnvironment().getProperty("my.fallback"); - assertThat(property).isEqualTo("foo"); + assertThat(context.getEnvironment().getProperty("my.fallback")).isEqualTo("fromdefaults"); + assertThat(context.getEnvironment().getProperty("my.property")).isEqualTo("fromapplicationproperties"); } @Test - void runWhenHasDefaultPropertiesWithConfigLocationConfigurationLoadsExpectedProperties() { + @WithResource(name = "testproperties.properties", content = "the.property=frompropertiesfile") + void runWhenHasDefaultPropertiesWithConfigNameLoadsExpectedProperties() { this.application.setDefaultProperties(Collections.singletonMap("spring.config.name", "testproperties")); ConfigurableApplicationContext context = this.application.run(); String property = context.getEnvironment().getProperty("the.property"); @@ -284,13 +390,15 @@ void runWhenHasDefaultPropertiesWithConfigLocationConfigurationLoadsExpectedProp } @Test - void runWhenHasActiveProfilesFromDefaultPropertiesAndFileLoadsWithFileTakingPrecedence() { + @WithResource(name = "application.properties", content = "spring.profiles.active=myprofile") + void runWhenHasActiveProfilesFromDefaultPropertiesAndFileLoadsWithActiveProfilesFromFileTakingPrecedence() { this.application.setDefaultProperties(Collections.singletonMap("spring.profiles.active", "dev")); - ConfigurableApplicationContext context = this.application.run("--spring.config.name=enableprofile"); + ConfigurableApplicationContext context = this.application.run(); assertThat(context.getEnvironment().getActiveProfiles()).containsExactly("myprofile"); } @Test + @WithResource(name = "application-other.properties", content = "my.property=fromotherpropertiesfile") void runWhenProgrammaticallySetProfilesLoadsWithSetProfilesTakePrecedenceOverDefaultProfile() { this.application.setAdditionalProfiles("other"); ConfigurableApplicationContext context = this.application.run(); @@ -299,6 +407,8 @@ void runWhenProgrammaticallySetProfilesLoadsWithSetProfilesTakePrecedenceOverDef } @Test + @WithResource(name = "application-dev.properties", content = "my.property=fromdevpropertiesfile") + @WithResource(name = "application-other.properties", content = "my.property=fromotherpropertiesfile") void runWhenTwoProfilesSetProgrammaticallyLoadsWithPreservedProfileOrder() { this.application.setAdditionalProfiles("other", "dev"); ConfigurableApplicationContext context = this.application.run(); @@ -307,9 +417,12 @@ void runWhenTwoProfilesSetProgrammaticallyLoadsWithPreservedProfileOrder() { } @Test + @WithResource(name = "application.properties", content = "spring.profiles.active=myprofile") + @WithResource(name = "application-myprofile.properties", content = "the.property=fromprofilepropertiesfile") + @WithResource(name = "application-other.properties", content = "other.property=fromotherpropertiesfile") void runWhenProfilesPresentBeforeConfigFileProcessingAugmentsProfileActivatedByConfigFile() { this.application.setAdditionalProfiles("other"); - ConfigurableApplicationContext context = this.application.run("--spring.config.name=enableprofile"); + ConfigurableApplicationContext context = this.application.run(); assertThat(context.getEnvironment().getActiveProfiles()).containsExactly("other", "myprofile"); String property = context.getEnvironment().getProperty("other.property"); assertThat(property).isEqualTo("fromotherpropertiesfile"); @@ -318,13 +431,19 @@ void runWhenProfilesPresentBeforeConfigFileProcessingAugmentsProfileActivatedByC } @Test + @WithResource(name = "application.properties", content = """ + spring.profiles.active=myprofile + one.more=${my.property} + """) + @WithResource(name = "application-myprofile.properties", content = "my.property=fromprofilepropertiesfile") void runWhenProfilePropertiesUsedInPlaceholdersLoadsWithResolvedPlaceholders() { - ConfigurableApplicationContext context = this.application.run("--spring.config.name=enableprofile"); - String property = context.getEnvironment().getProperty("one.more"); - assertThat(property).isEqualTo("fromprofilepropertiesfile"); + ConfigurableApplicationContext context = this.application.run(); + assertThat(context.getEnvironment().getProperty("one.more")).isEqualTo("fromprofilepropertiesfile"); } @Test + @WithResource(name = "application-dev.properties", content = "my.property=fromdevpropertiesfile") + @WithResource(name = "application-other.properties", content = "my.property=fromotherpropertiesfile") void runWhenDuplicateProfileSetProgrammaticallyAndViaPropertyLoadsWithProfiles() { this.application.setAdditionalProfiles("dev"); ConfigurableApplicationContext context = this.application.run("--spring.profiles.active=dev,other"); @@ -333,6 +452,8 @@ void runWhenDuplicateProfileSetProgrammaticallyAndViaPropertyLoadsWithProfiles() } @Test + @WithResource(name = "application-dev.properties", content = "my.property=fromdevpropertiesfile") + @WithResource(name = "application-other.properties", content = "my.property=fromotherpropertiesfile") void runWhenProfilesActivatedViaBracketNotationSetsProfiles() { ConfigurableApplicationContext context = this.application.run("--spring.profiles.active[0]=dev", "--spring.profiles.active[1]=other"); @@ -341,21 +462,43 @@ void runWhenProfilesActivatedViaBracketNotationSetsProfiles() { } @Test + @WithResource(name = "application.yaml", content = """ + --- + my: + property: fromyamlfile + other: notempty + --- + spring.config.activate.on-profile: dev + my: + property: fromdevprofile + """) void loadWhenProfileInMultiDocumentFilesLoadsExpectedProperties() { this.application.setAdditionalProfiles("dev"); - ConfigurableApplicationContext context = this.application.run("--spring.config.name=testprofiles", - "--spring.config.location=classpath:configdata/profiles/"); - String property = context.getEnvironment().getProperty("my.property"); - assertThat(property).isEqualTo("fromdevprofile"); - property = context.getEnvironment().getProperty("my.other"); - assertThat(property).isEqualTo("notempty"); - } - - @Test + ConfigurableApplicationContext context = this.application.run(); + assertThat(context.getEnvironment().getProperty("my.property")).isEqualTo("fromdevprofile"); + assertThat(context.getEnvironment().getProperty("my.other")).isEqualTo("notempty"); + } + + @Test + @WithResource(name = "application.yaml", content = """ + --- + my: + property: fromyamlfile + other: notempty + --- + spring.config.activate.on-profile: dev + my: + property: fromdevprofile + dev: + property: devproperty + --- + spring.config.activate.on-profile: other + my: + property: fromotherprofile + """) void runWhenMultipleActiveProfilesWithMultiDocumentFilesLoadsInOrderOfDocument() { this.application.setAdditionalProfiles("other", "dev"); - ConfigurableApplicationContext context = this.application.run("--spring.config.name=testprofiles", - "--spring.config.location=classpath:configdata/profiles/"); + ConfigurableApplicationContext context = this.application.run(); String property = context.getEnvironment().getProperty("my.property"); assertThat(property).isEqualTo("fromotherprofile"); property = context.getEnvironment().getProperty("my.other"); @@ -365,106 +508,223 @@ void runWhenMultipleActiveProfilesWithMultiDocumentFilesLoadsInOrderOfDocument() } @Test + @WithResource(name = "application.yaml", content = """ + --- + my: + property: fromyamlfile + --- + spring.config.activate.on-profile: dev & other + my: + property: devandother + --- + spring.config.activate.on-profile: (dev | other) & another + my: + property: devorotherandanother + """) void runWhenHasAndProfileExpressionLoadsExpectedProperties() { - assertProfileExpression("devandother", "dev", "other"); - } - - @Test + this.application.setAdditionalProfiles("dev", "other"); + ConfigurableApplicationContext context = this.application.run(); + assertThat(context.getEnvironment().getProperty("my.property")).isEqualTo("devandother"); + } + + @Test + @WithResource(name = "application.yaml", content = """ + --- + my: + property: fromyamlfile + --- + spring.config.activate.on-profile: dev & other + my: + property: devandother + --- + spring.config.activate.on-profile: (dev | other) & another + my: + property: devorotherandanother + """) void runWhenHasComplexProfileExpressionsLoadsExpectedProperties() { - assertProfileExpression("devorotherandanother", "dev", "another"); - } - - @Test + this.application.setAdditionalProfiles("dev", "another"); + ConfigurableApplicationContext context = this.application.run(); + assertThat(context.getEnvironment().getProperty("my.property")).isEqualTo("devorotherandanother"); + } + + @Test + @WithResource(name = "application.yaml", content = """ + --- + my: + property: fromyamlfile + --- + spring.config.activate.on-profile: dev & other + my: + property: devandother + --- + spring.config.activate.on-profile: (dev | other) & another + my: + property: devorotherandanother + """) void runWhenProfileExpressionsDoNotMatchLoadsExpectedProperties() { - assertProfileExpression("fromyamlfile", "dev"); - } - - @Test + this.application.setAdditionalProfiles("dev"); + ConfigurableApplicationContext context = this.application.run(); + assertThat(context.getEnvironment().getProperty("my.property")).isEqualTo("fromyamlfile"); + } + + @Test + @WithResource(name = "application.yml", content = """ + --- + my: + property: fromyamlfile + other: notempty + --- + spring.config.activate.on-profile: other + my: + property: fromotherprofile + --- + spring.config.activate.on-profile: "!other" + my: + property: fromnototherprofile + notother: foo + + """) void runWhenHasNegatedProfilesLoadsExpectedProperties() { - ConfigurableApplicationContext context = this.application.run("--spring.config.name=testnegatedprofiles", - "--spring.config.location=classpath:configdata/profiles/"); - String property = context.getEnvironment().getProperty("my.property"); - assertThat(property).isEqualTo("fromnototherprofile"); - property = context.getEnvironment().getProperty("my.notother"); - assertThat(property).isEqualTo("foo"); - } - - @Test + ConfigurableApplicationContext context = this.application.run(); + assertThat(context.getEnvironment().getProperty("my.property")).isEqualTo("fromnototherprofile"); + assertThat(context.getEnvironment().getProperty("my.notother")).isEqualTo("foo"); + } + + @Test + @WithResource(name = "application.yml", content = """ + --- + my: + property: fromyamlfile + other: notempty + --- + spring.config.activate.on-profile: other + my: + property: fromotherprofile + --- + spring.config.activate.on-profile: "!other" + my: + property: fromnototherprofile + notother: foo + + """) void runWhenHasNegatedProfilesWithProfileActiveLoadsExpectedProperties() { this.application.setAdditionalProfiles("other"); - ConfigurableApplicationContext context = this.application.run("--spring.config.name=testnegatedprofiles", - "--spring.config.location=classpath:configdata/profiles/"); - String property = context.getEnvironment().getProperty("my.property"); - assertThat(property).isEqualTo("fromotherprofile"); - property = context.getEnvironment().getProperty("my.notother"); - assertThat(property).isNull(); - } - - @Test + ConfigurableApplicationContext context = this.application.run(); + assertThat(context.getEnvironment().getProperty("my.property")).isEqualTo("fromotherprofile"); + assertThat(context.getEnvironment().getProperty("my.notother")).isNull(); + } + + @Test + @WithResource(name = "application.yml", content = """ + --- + spring: + profiles: + active: dev + my: + property: fromyamlfile + --- + spring.config.activate.on-profile: dev + my: + property: fromdevprofile + """) void runWhenHasActiveProfileConfigurationInMultiDocumentFileLoadsInExpectedOrder() { - ConfigurableApplicationContext context = this.application.run("--spring.config.name=testsetprofiles", - "--spring.config.location=classpath:configdata/profiles/"); + ConfigurableApplicationContext context = this.application.run(); assertThat(context.getEnvironment().getActiveProfiles()).containsExactly("dev"); String property = context.getEnvironment().getProperty("my.property"); assertThat(context.getEnvironment().getActiveProfiles()).contains("dev"); assertThat(property).isEqualTo("fromdevprofile"); assertThat(context.getEnvironment().getPropertySources()).extracting("name") .contains( - "Config resource 'class path resource [configdata/profiles/testsetprofiles.yml]' via location 'classpath:configdata/profiles/' (document #0)", - "Config resource 'class path resource [configdata/profiles/testsetprofiles.yml]' via location 'classpath:configdata/profiles/' (document #1)"); + "Config resource 'class path resource [application.yml]' via location 'optional:classpath:/' (document #0)", + "Config resource 'class path resource [application.yml]' via location 'optional:classpath:/' (document #1)"); } @Test + @WithResource(name = "application.yml", content = """ + --- + spring: + profiles: + active: dev,healthcheck + """) void runWhenHasYamlWithCommaSeparatedMultipleProfilesLoadsExpectedProperties() { - ConfigurableApplicationContext context = this.application.run("--spring.config.name=testsetmultiprofiles"); + ConfigurableApplicationContext context = this.application.run(); assertThat(context.getEnvironment().getActiveProfiles()).containsExactly("dev", "healthcheck"); } @Test + @WithResource(name = "application.yml", content = """ + --- + spring: + profiles: + active: + - dev + - healthcheck + """) void runWhenHasYamlWithListProfilesLoadsExpectedProperties() { - ConfigurableApplicationContext context = this.application.run("--spring.config.name=testsetmultiprofileslist"); + ConfigurableApplicationContext context = this.application.run(); assertThat(context.getEnvironment().getActiveProfiles()).containsExactly("dev", "healthcheck"); } @Test + @WithResource(name = "application.yml", content = """ + --- + spring: + profiles: + active: dev , healthcheck + """) void loadWhenHasWhitespaceTrims() { - ConfigurableApplicationContext context = this.application - .run("--spring.config.name=testsetmultiprofileswhitespace"); + ConfigurableApplicationContext context = this.application.run(); assertThat(context.getEnvironment().getActiveProfiles()).containsExactly("dev", "healthcheck"); } @Test - void loadWhenHasConfigLocationAsFile() { - String location = "file:src/test/resources/specificlocation.properties"; + void loadWhenHasConfigLocationAsFile() throws IOException { + File properties = new File(this.temp, "specificlocation.properties"); + Files.write(properties.toPath(), + List.of("my.property=fromspecificlocation", "the.property=fromspecificlocation")); + String location = properties.toURI().toURL().toString(); ConfigurableApplicationContext context = this.application.run("--spring.config.location=" + location); - assertThat(context.getEnvironment()).has(matchingPropertySource("Config resource 'file [" + Strings - .join(Arrays.asList("src", "test", "resources", "specificlocation.properties"), File.separatorChar) - + "]' via location '" + location + "'")); + assertThat(context.getEnvironment()) + .has(matchingPropertySource("Config resource 'file [" + properties + "]' via location '" + location + "'")); } @Test - void loadWhenHasRelativeConfigLocationUsesFileLocation() { - String location = "src/test/resources/specificlocation.properties"; - ConfigurableApplicationContext context = this.application.run("--spring.config.location=" + location); - assertThat(context.getEnvironment()).has(matchingPropertySource("Config resource 'file [" + Strings - .join(Arrays.asList("src", "test", "resources", "specificlocation.properties"), File.separatorChar) - + "]' via location '" + location + "'")); + void loadWhenHasRelativeConfigLocationUsesFileLocation() throws IOException { + File buildOutput = new BuildOutput(getClass()).getRootLocation(); + File resources = new File(buildOutput, "resources-" + UUID.randomUUID()); + try { + resources.mkdirs(); + File properties = new File(resources, "specificlocation.properties").getAbsoluteFile(); + Files.write(properties.toPath(), + List.of("my.property=fromspecificlocation", "the.property=fromspecificlocation")); + Path relative = new File("").getAbsoluteFile().toPath().relativize(properties.toPath()); + ConfigurableApplicationContext context = this.application.run("--spring.config.location=" + relative); + assertThat(context.getEnvironment()).has(matchingPropertySource( + "Config resource 'file [" + relative + "]' via location '" + relative + "'")); + } + finally { + FileSystemUtils.deleteRecursively(resources); + } } @Test + @WithResource(name = "application-customdefault.properties", content = "customdefault=true") + @WithResource(name = "application-dev.properties", content = "my.property=fromdevpropertiesfile") void loadWhenCustomDefaultProfileAndActiveFromPreviousSourceDoesNotActivateDefault() { ConfigurableApplicationContext context = this.application.run("--spring.profiles.default=customdefault", "--spring.profiles.active=dev"); - String property = context.getEnvironment().getProperty("my.property"); - assertThat(property).isEqualTo("fromdevpropertiesfile"); + assertThat(context.getEnvironment().getProperty("my.property")).isEqualTo("fromdevpropertiesfile"); assertThat(context.getEnvironment().containsProperty("customdefault")).isFalse(); } @Test + @WithResource(name = "application.properties", content = """ + spring.profiles.active=customdefault + customprofile=true + """) + @WithResource(name = "application-customdefault.properties", content = "customprofile-customdefault=true") void runWhenCustomDefaultProfileSameAsActiveFromFileActivatesProfile() { - ConfigurableApplicationContext context = this.application.run( - "--spring.config.location=classpath:configdata/profiles/", "--spring.profiles.default=customdefault", - "--spring.config.name=customprofile"); + ConfigurableApplicationContext context = this.application.run("--spring.profiles.default=customdefault"); ConfigurableEnvironment environment = context.getEnvironment(); assertThat(environment.containsProperty("customprofile")).isTrue(); assertThat(environment.containsProperty("customprofile-customdefault")).isTrue(); @@ -472,13 +732,18 @@ void runWhenCustomDefaultProfileSameAsActiveFromFileActivatesProfile() { } @Test + @WithResource(name = "application.properties", content = "spring.profiles.active=${activeProfile:propertiesfile}") void runWhenActiveProfilesCanBeConfiguredUsingPlaceholdersResolvedAgainstTheEnvironmentLoadsExpectedProperties() { - ConfigurableApplicationContext context = this.application.run("--activeProfile=testPropertySource", - "--spring.config.name=testactiveprofiles"); + ConfigurableApplicationContext context = this.application.run("--activeProfile=testPropertySource"); assertThat(context.getEnvironment().getActiveProfiles()).containsExactly("testPropertySource"); } @Test + @WithResource(name = "application.properties", content = """ + foo=bucket + value=1234 + """) + @WithResource(name = "override.properties", content = "foo=bar") void runWhenHasAdditionalLocationLoadsWithAdditionalTakingPrecedenceOverDefaultLocation() { ConfigurableApplicationContext context = this.application .run("--spring.config.additional-location=classpath:override.properties"); @@ -487,6 +752,12 @@ void runWhenHasAdditionalLocationLoadsWithAdditionalTakingPrecedenceOverDefaultL } @Test + @WithResource(name = "application.properties", content = """ + foo=bucket + value=1234 + """) + @WithResource(name = "override.properties", content = "foo=bar") + @WithResource(name = "some.properties", content = "foo=spam") void runWhenMultipleAdditionalLocationsLoadsWithLastWinning() { ConfigurableApplicationContext context = this.application .run("--spring.config.additional-location=classpath:override.properties,classpath:some.properties"); @@ -495,6 +766,9 @@ void runWhenMultipleAdditionalLocationsLoadsWithLastWinning() { } @Test + @WithResource(name = "application.properties", content = "value=1234") + @WithResource(name = "override.properties", content = "foo=bar") + @WithResource(name = "some.properties", content = "foo=spam") void runWhenAdditionalLocationAndLocationLoadsWithAdditionalTakingPrecedenceOverConfigured() { ConfigurableApplicationContext context = this.application.run( "--spring.config.location=classpath:some.properties", @@ -504,12 +778,19 @@ void runWhenAdditionalLocationAndLocationLoadsWithAdditionalTakingPrecedenceOver } @Test + @WithResource(name = "application.custom", content = "") + @WithResource(name = "META-INF/spring.factories", content = """ + org.springframework.boot.env.PropertySourceLoader=\ + org.springframework.boot.context.config.TestPropertySourceLoader1,\ + org.springframework.boot.context.config.TestPropertySourceLoader2 + """) void runWhenPropertiesFromCustomPropertySourceLoaderShouldLoadFromCustomSource() { ConfigurableApplicationContext context = this.application.run(); assertThat(context.getEnvironment().getProperty("customloader1")).isEqualTo("true"); } @Test + @WithResource(name = "gh17001.properties", content = "gh17001loaded=true") void runWhenCustomDefaultPropertySourceLoadsWithoutReplacingCustomSource() { // gh-17011 Map source = new HashMap<>(); @@ -581,75 +862,123 @@ void runWhenConfigLocationHasMandatoryDirectoryThatDoesntExistThrowsException() void runWhenConfigLocationHasNonOptionalEmptyFileDoesNotThrowException() throws IOException { File location = new File(this.temp, "application.properties"); FileCopyUtils.copy(new byte[0], location); - assertThatNoException() - .isThrownBy(() -> this.application.run("--spring.config.location=classpath:/application.properties," - + StringUtils.cleanPath(location.getAbsolutePath()))); + assertThatNoException().isThrownBy(() -> this.application + .run("--spring.config.location=" + StringUtils.cleanPath(location.getAbsolutePath()))); } @Test + @WithResource(name = "META-INF/spring.factories", content = """ + org.springframework.boot.context.config.ConfigDataLocationResolver=\ + org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessorIntegrationTests$LocationResolver + + org.springframework.boot.context.config.ConfigDataLoader=\ + org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessorIntegrationTests$Loader + """) void runWhenResolvedIsOptionalDoesNotThrowException() { ApplicationContext context = this.application.run("--spring.config.location=test:optionalresult"); assertThat(context.getEnvironment().containsProperty("spring")).isFalse(); } @Test + @WithResource(name = "application.properties", content = "spring.profiles=a") void runWhenUsingInvalidPropertyThrowsException() { - assertThatExceptionOfType(InvalidConfigDataPropertyException.class) - .isThrownBy(() -> this.application.run("--spring.config.location=classpath:invalidproperty.properties")); + assertThatExceptionOfType(InvalidConfigDataPropertyException.class).isThrownBy(() -> this.application.run()); } @Test + @WithResource(name = "application.properties", content = """ + my.import=imported + spring.config.import=classpath:${my.import}.properties + """) + @WithResource(name = "imported.properties", content = "my.value=iwasimported") void runWhenImportUsesPlaceholder() { - ConfigurableApplicationContext context = this.application - .run("--spring.config.location=classpath:application-import-with-placeholder.properties"); + ConfigurableApplicationContext context = this.application.run(); assertThat(context.getEnvironment().getProperty("my.value")).isEqualTo("iwasimported"); } @Test + @WithResource(name = "application.properties", content = """ + my.import=imported + #--- + spring.config.import=classpath:${my.import}.properties + """) + @WithResource(name = "imported.properties", content = "my.value=iwasimported") void runWhenImportFromEarlierDocumentUsesPlaceholder() { - ConfigurableApplicationContext context = this.application - .run("--spring.config.location=classpath:application-import-with-placeholder-in-document.properties"); + ConfigurableApplicationContext context = this.application.run(); assertThat(context.getEnvironment().getProperty("my.value")).isEqualTo("iwasimported"); } @Test // gh-26858 + @WithResource(name = "application.properties", content = """ + spring.config.import=classpath:imported.properties + my.value=application.properties + """) + @WithResource(name = "imported.properties", content = "my.value=imported.properties") + @WithResource(name = "application-dev.properties", content = "my.value=application-dev.properties") void runWhenImportWithProfileVariantOrdersPropertySourcesCorrectly() { this.application.setAdditionalProfiles("dev"); - ConfigurableApplicationContext context = this.application - .run("--spring.config.location=classpath:application-import-with-profile-variant.properties"); - assertThat(context.getEnvironment().getProperty("my.value")) - .isEqualTo("application-import-with-profile-variant-imported-dev"); + ConfigurableApplicationContext context = this.application.run(); + assertThat(context.getEnvironment().getProperty("my.value")).isEqualTo("application-dev.properties"); } @Test + @WithResource(name = "application.properties", content = """ + spring.config.import=classpath:imported.properties + my.value=application.properties + """) + @WithResource(name = "imported.properties", content = "my.value=imported.properties") + @WithResource(name = "imported-dev.properties", content = "my.value=imported-dev.properties") + @WithResource(name = "application-dev.properties", content = """ + spring.config.import=imported-dev.properties + my.value=application-dev.properties""") void runWhenImportWithProfileVariantAndDirectProfileImportOrdersPropertySourcesCorrectly() { this.application.setAdditionalProfiles("dev"); - ConfigurableApplicationContext context = this.application.run( - "--spring.config.location=classpath:application-import-with-profile-variant-and-direct-profile-import.properties"); - assertThat(context.getEnvironment().getProperty("my.value")) - .isEqualTo("application-import-with-profile-variant-imported-dev"); + ConfigurableApplicationContext context = this.application.run(); + assertThat(context.getEnvironment().getProperty("my.value")).isEqualTo("imported-dev.properties"); } @Test + @WithResource(name = "application.properties", content = """ + my.import=application-import-with-placeholder-imported + #--- + spring.config.import=classpath:org/springframework/boot/context/config/${my.import}.properties + #--- + my.import=badbadbad + spring.config.activate.on-profile=missing + """) void runWhenHasPropertyInProfileDocumentThrowsException() { - assertThatExceptionOfType(BindException.class).isThrownBy(() -> this.application.run( - "--spring.config.location=classpath:application-import-with-placeholder-in-profile-document.properties")) + assertThatExceptionOfType(BindException.class).isThrownBy(() -> this.application.run()) .withCauseInstanceOf(InactiveConfigDataAccessException.class); } @Test // gh-29386 + @WithResource(name = "application.properties", content = """ + my.value=application + #--- + my.import=imported + spring.config.activate.on-profile=missing + #--- + spring.config.import=${my.import}.properties + """) + @WithResource(name = "imported.properties", content = "my.value=imported") void runWhenHasPropertyInEarlierProfileDocumentThrowsException() { - assertThatExceptionOfType(BindException.class).isThrownBy(() -> this.application.run( - "--spring.config.location=classpath:application-import-with-placeholder-in-earlier-profile-document.properties")) + assertThatExceptionOfType(BindException.class).isThrownBy(() -> this.application.run()) .withCauseInstanceOf(InactiveConfigDataAccessException.class); } @Test // gh-29386 + @WithResource(name = "application.properties", content = """ + my.import=imported + #--- + my.value=should-be-ignored + spring.config.activate.on-profile=missing + #--- + spring.config.import=classpath:${my.import}.properties + """) + @WithResource(name = "imported.properties", content = "my.value=imported") void runWhenHasPropertyInEarlierDocumentLoads() { - ConfigurableApplicationContext context = this.application.run( - "--spring.config.location=classpath:application-import-with-placeholder-in-earlier-document.properties"); - assertThat(context.getEnvironment().getProperty("my.value")) - .isEqualTo("application-import-with-placeholder-in-earlier-document-imported"); + ConfigurableApplicationContext context = this.application.run(); + assertThat(context.getEnvironment().getProperty("my.value")).isEqualTo("imported"); } @Test @@ -665,38 +994,69 @@ void runWhenHasNonOptionalImportAndIgnoreNotFoundPropertyDoesNotThrowException() } @Test + @WithResource(name = "application.properties", content = """ + spring.profiles.active=p1 + spring.profiles.include=p2 + #--- + spring.profiles.include=p3,p4 + #--- + spring.profiles.include=p5 + """) void runWhenHasIncludedProfilesActivatesProfiles() { - ConfigurableApplicationContext context = this.application - .run("--spring.config.location=classpath:application-include-profiles.properties"); + ConfigurableApplicationContext context = this.application.run(); assertThat(context.getEnvironment().getActiveProfiles()).containsExactlyInAnyOrder("p1", "p2", "p3", "p4", "p5"); } @Test + @WithResource(name = "application.properties", content = """ + spring.profiles.active=p1 + spring.profiles.include=p2 + #--- + myprofile=p4 + spring.profiles.include=p3,${myprofile} + #--- + myotherprofile=p5 + spring.profiles.include=${myotherprofile} + """) void runWhenHasIncludedProfilesWithPlaceholderActivatesProfiles() { - ConfigurableApplicationContext context = this.application - .run("--spring.config.location=classpath:application-include-profiles-with-placeholder.properties"); + ConfigurableApplicationContext context = this.application.run(); assertThat(context.getEnvironment().getActiveProfiles()).containsExactlyInAnyOrder("p1", "p2", "p3", "p4", "p5"); } @Test + @WithResource(name = "application.properties", content = """ + spring.profiles.active=p1 + spring.profiles.include=p2 + #--- + spring.config.activate.on-profile=p2 + spring.profiles.include=p3 + """) void runWhenHasIncludedProfilesWithProfileSpecificDocumentThrowsException() { - assertThatExceptionOfType(InactiveConfigDataAccessException.class).isThrownBy(() -> this.application.run( - "--spring.config.location=classpath:application-include-profiles-in-profile-specific-document.properties")); + assertThatExceptionOfType(InactiveConfigDataAccessException.class).isThrownBy(() -> this.application.run()); } @Test + @WithResource(name = "application-test.yaml", content = """ + spring: + profiles: + include: + - p + """) void runWhenHasIncludedProfilesWithListSyntaxWithProfileSpecificDocumentThrowsException() { - assertThatExceptionOfType(InvalidConfigDataPropertyException.class).isThrownBy(() -> this.application.run( - "--spring.config.name=application-include-profiles-list-in-profile-specific-file", - "--spring.profiles.active=test")); + assertThatExceptionOfType(InvalidConfigDataPropertyException.class) + .isThrownBy(() -> this.application.run("--spring.profiles.active=test")); } @Test + @WithResource(name = "application.properties", content = """ + my.import=imported + spring.config.import=classpath:${my.import}.properties + """) + @WithResource(name = "imported.properties", content = "my.value=imported") void runWhenImportingIncludesParentOrigin() { - ConfigurableApplicationContext context = this.application - .run("--spring.config.location=classpath:application-import-with-placeholder.properties"); + ConfigurableApplicationContext context = this.application.run(); Binder binder = Binder.get(context.getEnvironment()); List properties = new ArrayList<>(); BindHandler bindHandler = new BindHandler() { @@ -712,107 +1072,158 @@ public Object onSuccess(ConfigurationPropertyName name, Bindable target, Bind binder.bind("my.value", Bindable.of(String.class), bindHandler); assertThat(properties).hasSize(1); Origin origin = properties.get(0).getOrigin(); - assertThat(origin.toString()).contains("application-import-with-placeholder-imported"); - assertThat(origin.getParent().toString()).contains("application-import-with-placeholder"); + assertThat(origin.toString()).contains("imported.properties"); + assertThat(origin.getParent().toString()).contains("application.properties"); } @Test + @WithResource(name = "config/first/application.properties", content = "first.property=apple") + @WithResource(name = "config/second/application.properties", content = "second.property=ball") + @WithResource(name = "config/third/nested/application.properties", content = "third.property=three") void runWhenHasWildcardLocationLoadsFromAllMatchingLocations() { - ConfigurableApplicationContext context = this.application - .run("--spring.config.location=file:src/test/resources/config/*/", "--spring.config.name=testproperties"); + ConfigurableApplicationContext context = this.application.run("--spring.config.location=classpath:config/*/"); ConfigurableEnvironment environment = context.getEnvironment(); assertThat(environment.getProperty("first.property")).isEqualTo("apple"); assertThat(environment.getProperty("second.property")).isEqualTo("ball"); + assertThat(environment.getProperty("third.property")).isNull(); } @Test - void runWhenOptionalWildcardLocationDoesNotExistDoesNotThrowException() { + void runWhenOptionalWildcardFileDoesNotExistDoesNotThrowException() { assertThatNoException().isThrownBy(() -> this.application - .run("--spring.config.location=optional:file:src/test/resources/nonexistent/*/testproperties.properties")); + .run("--spring.config.location=optional:classpath:nonexistent/*/testproperties.properties")); } @Test - void runWhenMandatoryWildcardLocationDoesNotExistThrowsException() { + void runWhenMandatoryWildcardFileDoesNotExistThrowsException() { assertThatExceptionOfType(ConfigDataLocationNotFoundException.class).isThrownBy(() -> this.application - .run("--spring.config.location=file:src/test/resources/nonexistent/*/testproperties.properties")); + .run("--spring.config.location=classpath:nonexistent/*/testproperties.properties")); } @Test - void runWhenMandatoryWildcardLocationHasEmptyFileDirectory() { - assertThatNoException() - .isThrownBy(() -> this.application.run("--spring.config.location=file:src/test/resources/config/*/")); + @WithResourceDirectory("config/empty") + void runWhenMandatoryWildcardDirectoryHasEmptyDirectoryDoesNotThrowException() { + assertThatNoException().isThrownBy(() -> this.application.run("--spring.config.location=classpath:config/*/")); } @Test - void runWhenMandatoryWildcardLocationHasNoSubdirectories() { - assertThatExceptionOfType(ConfigDataLocationNotFoundException.class) - .isThrownBy( - () -> this.application.run("--spring.config.location=file:src/test/resources/config/0-empty/*/")) - .withMessage("Config data location 'file:src/test/resources/config/0-empty/*/' contains no subdirectories"); + @WithResourceDirectory("config/empty") + void runWhenOptionalWildcardDirectoryHasNoSubdirectoriesDoesNotThrow() { + assertThatNoException() + .isThrownBy(() -> this.application.run("--spring.config.location=optional:classpath:config/*/")); } @Test - void runWhenHasMandatoryWildcardLocationThatDoesNotExist() { + @WithResourceDirectory("config") + void runWhenMandatoryWildcardDirectoryHasNoSubdirectoriesThrows() { assertThatExceptionOfType(ConfigDataLocationNotFoundException.class) - .isThrownBy(() -> this.application.run("--spring.config.location=file:invalid/*/")); + .isThrownBy(() -> this.application.run("--spring.config.location=classpath:config/*/")) + .withMessage("Config data location 'classpath:config/*/' contains no subdirectories"); } @Test - void runWhenHasOptionalWildcardLocationThatDoesNotExistDoesNotThrow() { + void runWhenOptionalWildcardDirectoryDoesNotExistDoesNotThrowException() { assertThatNoException() .isThrownBy(() -> this.application.run("--spring.config.location=optional:file:invalid/*/")); } - @Test - void runWhenOptionalWildcardLocationHasNoSubdirectoriesDoesNotThrow() { - assertThatNoException().isThrownBy(() -> this.application - .run("--spring.config.location=optional:file:src/test/resources/config/0-empty/*/")); - } - @Test // gh-24990 + @WithResource(name = "application.properties", content = "spring.profiles.active=test,other") + @WithResource(name = "application-test.properties", content = """ + test1=test1 + #--- + spring.config.activate.on-profile=other + test2=test2 + """) void runWhenHasProfileSpecificFileWithActiveOnProfileProperty() { - ConfigurableApplicationContext context = this.application - .run("--spring.config.name=application-activate-on-profile-in-profile-specific-file"); + ConfigurableApplicationContext context = this.application.run(); ConfigurableEnvironment environment = context.getEnvironment(); assertThat(environment.getProperty("test1")).isEqualTo("test1"); assertThat(environment.getProperty("test2")).isEqualTo("test2"); } @Test // gh-26960 + @WithResource(name = "application.properties", content = """ + spring.profiles.active=p1,p2 + application=true + """) + @WithResource(name = "application-p1.properties", content = """ + application-p1=true + spring.config.import=import.properties + """) + @WithResource(name = "import.properties", content = "import=true") + @WithResource(name = "import-p1.properties", content = "import-p1=true") + @WithResource(name = "import-p2.properties", content = "import-p2=true") void runWhenHasProfileSpecificImportWithImportImportsSecondProfileSpecificFile() { - ConfigurableApplicationContext context = this.application - .run("--spring.config.name=application-profile-specific-import-with-import"); + ConfigurableApplicationContext context = this.application.run(); ConfigurableEnvironment environment = context.getEnvironment(); - assertThat(environment.containsProperty("application-profile-specific-import-with-import")).isTrue(); - assertThat(environment.containsProperty("application-profile-specific-import-with-import-p1")).isTrue(); - assertThat(environment.containsProperty("application-profile-specific-import-with-import-p2")).isFalse(); - assertThat(environment.containsProperty("application-profile-specific-import-with-import-import")).isTrue(); - assertThat(environment.containsProperty("application-profile-specific-import-with-import-import-p1")).isTrue(); - assertThat(environment.containsProperty("application-profile-specific-import-with-import-import-p2")).isTrue(); + assertThat(environment.containsProperty("application")).isTrue(); + assertThat(environment.containsProperty("application-p1")).isTrue(); + assertThat(environment.containsProperty("application-p2")).isFalse(); + assertThat(environment.containsProperty("import")).isTrue(); + assertThat(environment.containsProperty("import-p1")).isTrue(); + assertThat(environment.containsProperty("import-p2")).isTrue(); } @Test // gh-26960 + @WithResource(name = "application.properties", content = "spring.profiles.active=p1,p2") + @WithResource(name = "application-p1.properties", content = "spring.config.import:test:boot") + @WithResource(name = "META-INF/spring.factories", content = """ + org.springframework.boot.context.config.ConfigDataLocationResolver=\ + org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessorIntegrationTests$LocationResolver + + org.springframework.boot.context.config.ConfigDataLoader=\ + org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessorIntegrationTests$Loader + """) void runWhenHasProfileSpecificImportWithCustomImportResolvesProfileSpecific() { - ConfigurableApplicationContext context = this.application - .run("--spring.config.name=application-profile-specific-import-with-custom-import"); + ConfigurableApplicationContext context = this.application.run(); ConfigurableEnvironment environment = context.getEnvironment(); assertThat(environment.containsProperty("test:boot")).isTrue(); assertThat(environment.containsProperty("test:boot:ps")).isTrue(); } @Test // gh-26593 + @WithResource(name = "application.properties", content = """ + root=true + v1=root + v2=root + """) + @WithResource(name = "application-p1.properties", content = """ + root-p1=true + v1=root-p1 + v2=root-p1 + """) + @WithResource(name = "application-p2.properties", content = """ + root-p2=true + v1=root-p2 + v2=root-p2 + """) + @WithResource(name = "config/application.properties", content = """ + config=true + v1=config + v2=config + """) + @WithResource(name = "config/application-p1.properties", content = """ + config-p1=true + v1=config-p1 + #v2 intentionally missing + """) + @WithResource(name = "config/application-p2.properties", content = """ + config-p2=true + v1=config-p2 + #v2 intentionally missing + """) void runWhenHasFilesInRootAndConfigWithProfiles() { - ConfigurableApplicationContext context = this.application - .run("--spring.config.name=file-in-root-and-config-with-profile", "--spring.profiles.active=p1,p2"); + ConfigurableApplicationContext context = this.application.run("--spring.profiles.active=p1,p2"); ConfigurableEnvironment environment = context.getEnvironment(); - assertThat(environment.containsProperty("file-in-root-and-config-with-profile")).isTrue(); - assertThat(environment.containsProperty("file-in-root-and-config-with-profile-p1")).isTrue(); - assertThat(environment.containsProperty("file-in-root-and-config-with-profile-p2")).isTrue(); - assertThat(environment.containsProperty("config-file-in-root-and-config-with-profile")).isTrue(); - assertThat(environment.containsProperty("config-file-in-root-and-config-with-profile-p1")).isTrue(); - assertThat(environment.containsProperty("config-file-in-root-and-config-with-profile-p2")).isTrue(); - assertThat(environment.getProperty("v1")).isEqualTo("config-file-in-root-and-config-with-profile-p2"); - assertThat(environment.getProperty("v2")).isEqualTo("file-in-root-and-config-with-profile-p2"); + assertThat(environment.containsProperty("root")).isTrue(); + assertThat(environment.containsProperty("root-p1")).isTrue(); + assertThat(environment.containsProperty("root-p2")).isTrue(); + assertThat(environment.containsProperty("config")).isTrue(); + assertThat(environment.containsProperty("config-p1")).isTrue(); + assertThat(environment.containsProperty("config-p2")).isTrue(); + assertThat(environment.getProperty("v1")).isEqualTo("config-p2"); + assertThat(environment.getProperty("v2")).isEqualTo("root-p2"); } private Condition matchingPropertySource(final String sourceName) { @@ -820,21 +1231,12 @@ private Condition matchingPropertySource(final String s @Override public boolean matches(ConfigurableEnvironment value) { - value.getPropertySources().forEach((ps) -> System.out.println(ps.getName())); return value.getPropertySources().contains(sourceName); } }; } - private void assertProfileExpression(String value, String... activeProfiles) { - this.application.setAdditionalProfiles(activeProfiles); - ConfigurableApplicationContext context = this.application.run("--spring.config.name=testprofileexpression", - "--spring.config.location=classpath:configdata/profiles/"); - String property = context.getEnvironment().getProperty("my.property"); - assertThat(property).isEqualTo(value); - } - @Configuration(proxyBeanMethods = false) static class Config { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorTests.java index f7139ad750ad..283b3be3a87d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import org.springframework.boot.DefaultBootstrapContext; import org.springframework.boot.SpringApplication; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.core.env.StandardEnvironment; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.ResourceLoader; @@ -103,6 +104,8 @@ void postProcessEnvironmentWhenNoActiveProfiles() { } @Test + @WithResource(name = "application.properties", content = "property=value") + @WithResource(name = "application-dev.properties", content = "property=dev-value") void applyToAppliesPostProcessing() { int before = this.environment.getPropertySources().size(); TestConfigDataEnvironmentUpdateListener listener = new TestConfigDataEnvironmentUpdateListener(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentTests.java index d602bf215444..656e93c2670b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package org.springframework.boot.context.config; -import java.io.File; import java.io.IOException; import java.net.URL; import java.util.Collection; @@ -28,7 +27,6 @@ import java.util.function.Supplier; import org.assertj.core.api.InstanceOfAssertFactories; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.params.ParameterizedTest; @@ -42,6 +40,7 @@ import org.springframework.boot.context.config.TestConfigDataEnvironmentUpdateListener.AddedPropertySource; import org.springframework.boot.context.properties.bind.Binder; import org.springframework.boot.logging.DeferredLogFactory; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.core.convert.ConversionService; import org.springframework.core.convert.support.DefaultConversionService; import org.springframework.core.env.ConfigurableEnvironment; @@ -149,8 +148,8 @@ void createCreatesInitialImportContributorsInCorrectOrder() { } @Test - void processAndApplyAddsImportedSourceToEnvironment(TestInfo info) { - this.environment.setProperty("spring.config.location", getConfigLocation(info)); + @WithResource(name = "application.properties", content = "spring=boot") + void processAndApplyAddsImportedSourceToEnvironment() { ConfigDataEnvironment configDataEnvironment = new ConfigDataEnvironment(this.logFactory, this.bootstrapContext, this.environment, this.resourceLoader, this.additionalProfiles, null); configDataEnvironment.processAndApply(); @@ -158,8 +157,14 @@ void processAndApplyAddsImportedSourceToEnvironment(TestInfo info) { } @Test - void processAndApplyOnlyAddsActiveContributors(TestInfo info) { - this.environment.setProperty("spring.config.location", getConfigLocation(info)); + @WithResource(name = "application.properties", content = """ + spring=boot + #--- + spring.config.activate.on-profile=missing + other=value + No newline at end of file + """) + void processAndApplyOnlyAddsActiveContributors() { ConfigDataEnvironment configDataEnvironment = new ConfigDataEnvironment(this.logFactory, this.bootstrapContext, this.environment, this.resourceLoader, this.additionalProfiles, null); configDataEnvironment.processAndApply(); @@ -180,8 +185,8 @@ void processAndApplyMovesDefaultPropertySourceToLast(TestInfo info) { } @Test + @WithResource(name = "application.properties", content = "spring.profiles.default=one,two,three") void processAndApplySetsDefaultProfiles(TestInfo info) { - this.environment.setProperty("spring.config.location", getConfigLocation(info)); ConfigDataEnvironment configDataEnvironment = new ConfigDataEnvironment(this.logFactory, this.bootstrapContext, this.environment, this.resourceLoader, this.additionalProfiles, null); configDataEnvironment.processAndApply(); @@ -189,8 +194,8 @@ void processAndApplySetsDefaultProfiles(TestInfo info) { } @Test - void processAndApplySetsActiveProfiles(TestInfo info) { - this.environment.setProperty("spring.config.location", getConfigLocation(info)); + @WithResource(name = "application.properties", content = "spring.profiles.active=one,two,three") + void processAndApplySetsActiveProfiles() { ConfigDataEnvironment configDataEnvironment = new ConfigDataEnvironment(this.logFactory, this.bootstrapContext, this.environment, this.resourceLoader, this.additionalProfiles, null); configDataEnvironment.processAndApply(); @@ -198,8 +203,11 @@ void processAndApplySetsActiveProfiles(TestInfo info) { } @Test - void processAndApplySetsActiveProfilesAndProfileGroups(TestInfo info) { - this.environment.setProperty("spring.config.location", getConfigLocation(info)); + @WithResource(name = "application.properties", content = """ + spring.profiles.active=one,two,three + spring.profiles.group.one=four,five + """) + void processAndApplySetsActiveProfilesAndProfileGroups() { ConfigDataEnvironment configDataEnvironment = new ConfigDataEnvironment(this.logFactory, this.bootstrapContext, this.environment, this.resourceLoader, this.additionalProfiles, null); configDataEnvironment.processAndApply(); @@ -207,8 +215,8 @@ void processAndApplySetsActiveProfilesAndProfileGroups(TestInfo info) { } @Test + @WithResource(name = "application.properties", content = "spring.profiles.active=test") void processAndApplyDoesNotSetProfilesFromIgnoreProfilesContributors(TestInfo info) { - this.environment.setProperty("spring.config.location", getConfigLocation(info)); ConfigDataEnvironment configDataEnvironment = new ConfigDataEnvironment(this.logFactory, this.bootstrapContext, this.environment, this.resourceLoader, this.additionalProfiles, null) { @@ -281,8 +289,8 @@ protected ConfigDataEnvironmentContributors createContributors( } @Test + @WithResource(name = "application.properties", content = "spring=boot") void processAndApplyDoesNotSetProfilesFromIgnoreProfilesContributorsWhenNoProfilesActive(TestInfo info) { - this.environment.setProperty("spring.config.location", getConfigLocation(info)); ConfigDataEnvironment configDataEnvironment = new ConfigDataEnvironment(this.logFactory, this.bootstrapContext, this.environment, this.resourceLoader, this.additionalProfiles, null) { @@ -307,9 +315,8 @@ protected ConfigDataEnvironmentContributors createContributors( } @Test - @Disabled("Disabled until spring.profiles support is dropped") void processAndApplyWhenHasInvalidPropertyThrowsException() { - this.environment.setProperty("spring.profile", "a"); + this.environment.setProperty("spring.profiles", "a"); ConfigDataEnvironment configDataEnvironment = new ConfigDataEnvironment(this.logFactory, this.bootstrapContext, this.environment, this.resourceLoader, this.additionalProfiles, null); assertThatExceptionOfType(InvalidConfigDataPropertyException.class) @@ -317,8 +324,9 @@ void processAndApplyWhenHasInvalidPropertyThrowsException() { } @Test + @WithResource(name = "custom/config.properties", content = "spring=boot") void processAndApplyWhenHasListenerCallsOnPropertySourceAdded(TestInfo info) { - this.environment.setProperty("spring.config.location", getConfigLocation(info)); + this.environment.setProperty("spring.config.location", "classpath:custom/config.properties"); TestConfigDataEnvironmentUpdateListener listener = new TestConfigDataEnvironmentUpdateListener(); ConfigDataEnvironment configDataEnvironment = new ConfigDataEnvironment(this.logFactory, this.bootstrapContext, this.environment, this.resourceLoader, this.additionalProfiles, listener); @@ -326,14 +334,14 @@ void processAndApplyWhenHasListenerCallsOnPropertySourceAdded(TestInfo info) { assertThat(listener.getAddedPropertySources()).hasSize(1); AddedPropertySource addedPropertySource = listener.getAddedPropertySources().get(0); assertThat(addedPropertySource.getPropertySource().getProperty("spring")).isEqualTo("boot"); - assertThat(addedPropertySource.getLocation()).hasToString(getConfigLocation(info)); + assertThat(addedPropertySource.getLocation()).hasToString("classpath:custom/config.properties"); assertThat(addedPropertySource.getResource().toString()).contains("class path resource") - .contains(info.getTestMethod().get().getName()); + .contains("custom/config.properties"); } @Test + @WithResource(name = "application.properties", content = "spring.profiles.active=one,two,three") void processAndApplyWhenHasListenerCallsOnSetProfiles(TestInfo info) { - this.environment.setProperty("spring.config.location", getConfigLocation(info)); TestConfigDataEnvironmentUpdateListener listener = new TestConfigDataEnvironmentUpdateListener(); ConfigDataEnvironment configDataEnvironment = new ConfigDataEnvironment(this.logFactory, this.bootstrapContext, this.environment, this.resourceLoader, this.additionalProfiles, listener); @@ -343,17 +351,18 @@ void processAndApplyWhenHasListenerCallsOnSetProfiles(TestInfo info) { @Test @SuppressWarnings("rawtypes") + @WithResource(name = "separate-class-loader-spring.factories", content = """ + org.springframework.boot.context.config.ConfigDataLoader=\ + org.springframework.boot.context.config.ConfigDataEnvironmentTests$SeparateClassLoaderConfigDataLoader + """) void configDataLoadersAreLoadedUsingClassLoaderFromResourceLoader() { ResourceLoader resourceLoader = mock(ResourceLoader.class); - ClassLoader classLoader = new ClassLoader() { + ClassLoader classLoader = new ClassLoader(Thread.currentThread().getContextClassLoader()) { @Override public Enumeration getResources(String name) throws IOException { if (SpringFactoriesLoader.FACTORIES_RESOURCE_LOCATION.equals(name)) { - return Collections.enumeration(List.of(new File( - "src/test/resources/org/springframework/boot/context/config/separate-class-loader-spring.factories") - .toURI() - .toURL())); + return super.getResources("separate-class-loader-spring.factories"); } return super.getResources(name); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsTests.java index e4a822bd4db0..7db561f8198d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationRuntimeHintsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import org.springframework.boot.env.PropertiesPropertySourceLoader; import org.springframework.boot.env.PropertySourceLoader; import org.springframework.boot.env.YamlPropertySourceLoader; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.core.io.support.SpringFactoriesLoader; import org.springframework.core.test.io.support.MockSpringFactoriesLoader; @@ -41,9 +42,11 @@ class ConfigDataLocationRuntimeHintsTests { @Test + @WithResource(name = "application.properties", content = "") + @WithResource(name = "config/application.properties", content = "") void registerWithDefaultSettings() { RuntimeHints hints = new RuntimeHints(); - new TestConfigDataLocationRuntimeHints().registerHints(hints, null); + new TestConfigDataLocationRuntimeHints().registerHints(hints, Thread.currentThread().getContextClassLoader()); assertThat(hints.resources().resourcePatternHints()).singleElement() .satisfies(includes("application*.properties", "application*.xml", "application*.yaml", "application*.yml", "config/application*.properties", "config/application*.xml", "config/application*.yaml", @@ -51,6 +54,8 @@ void registerWithDefaultSettings() { } @Test + @WithResource(name = "test.properties") + @WithResource(name = "config/test.properties") void registerWithCustomName() { RuntimeHints hints = new RuntimeHints(); new TestConfigDataLocationRuntimeHints() { @@ -59,13 +64,15 @@ protected List getFileNames(ClassLoader classLoader) { return List.of("test"); } - }.registerHints(hints, null); + }.registerHints(hints, Thread.currentThread().getContextClassLoader()); assertThat(hints.resources().resourcePatternHints()).singleElement() .satisfies(includes("test*.properties", "test*.xml", "test*.yaml", "test*.yml", "config/test*.properties", "config/test*.xml", "config/test*.yaml", "config/test*.yml")); } @Test + @WithResource(name = "application.properties") + @WithResource(name = "config/application.properties") void registerWithCustomLocation() { RuntimeHints hints = new RuntimeHints(); new TestConfigDataLocationRuntimeHints() { @@ -73,13 +80,15 @@ void registerWithCustomLocation() { protected List getLocations(ClassLoader classLoader) { return List.of("config/"); } - }.registerHints(hints, null); + }.registerHints(hints, Thread.currentThread().getContextClassLoader()); assertThat(hints.resources().resourcePatternHints()).singleElement() .satisfies(includes("config/application*.properties", "config/application*.xml", "config/application*.yaml", "config/application*.yml")); } @Test + @WithResource(name = "application.conf") + @WithResource(name = "config/application.conf") void registerWithCustomExtension() { RuntimeHints hints = new RuntimeHints(); new ConfigDataLocationRuntimeHints() { @@ -87,7 +96,7 @@ void registerWithCustomExtension() { protected List getExtensions(ClassLoader classLoader) { return List.of(".conf"); } - }.registerHints(hints, null); + }.registerHints(hints, Thread.currentThread().getContextClassLoader()); assertThat(hints.resources().resourcePatternHints()).singleElement() .satisfies(includes("application*.conf", "config/application*.conf")); } @@ -100,7 +109,7 @@ void registerWithUnknownLocationDoesNotAddHint() { protected List getLocations(ClassLoader classLoader) { return List.of(UUID.randomUUID().toString()); } - }.registerHints(hints, null); + }.registerHints(hints, Thread.currentThread().getContextClassLoader()); assertThat(hints.resources().resourcePatternHints()).isEmpty(); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLoaderTests.java index 908c4a29c0f5..ad06f8e77cbc 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import org.springframework.boot.env.PropertiesPropertySourceLoader; import org.springframework.boot.env.YamlPropertySourceLoader; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.core.env.PropertySource; import org.springframework.core.io.ClassPathResource; @@ -41,32 +42,36 @@ class StandardConfigDataLoaderTests { private final ConfigDataLoaderContext loaderContext = mock(ConfigDataLoaderContext.class); @Test + @WithResource(name = "application.yml", content = """ + foo: bar + --- + hello: world + """) void loadWhenLocationResultsInMultiplePropertySourcesAddsAllToConfigData() throws IOException { - ClassPathResource resource = new ClassPathResource("configdata/yaml/application.yml"); + ClassPathResource resource = new ClassPathResource("application.yml"); StandardConfigDataReference reference = new StandardConfigDataReference( - ConfigDataLocation.of("classpath:configdata/yaml/application.yml"), null, - "classpath:configdata/yaml/application", null, "yml", new YamlPropertySourceLoader()); + ConfigDataLocation.of("classpath:application.yml"), null, "classpath:application", null, "yml", + new YamlPropertySourceLoader()); StandardConfigDataResource location = new StandardConfigDataResource(reference, resource); ConfigData configData = this.loader.load(this.loaderContext, location); assertThat(configData.getPropertySources()).hasSize(2); PropertySource source1 = configData.getPropertySources().get(0); PropertySource source2 = configData.getPropertySources().get(1); - assertThat(source1.getName()) - .isEqualTo("Config resource 'class path resource [configdata/yaml/application.yml]' " - + "via location 'classpath:configdata/yaml/application.yml' (document #0)"); + assertThat(source1.getName()).isEqualTo("Config resource 'class path resource [application.yml]' " + + "via location 'classpath:application.yml' (document #0)"); assertThat(source1.getProperty("foo")).isEqualTo("bar"); - assertThat(source2.getName()) - .isEqualTo("Config resource 'class path resource [configdata/yaml/application.yml]' " - + "via location 'classpath:configdata/yaml/application.yml' (document #1)"); + assertThat(source2.getName()).isEqualTo("Config resource 'class path resource [application.yml]' " + + "via location 'classpath:application.yml' (document #1)"); assertThat(source2.getProperty("hello")).isEqualTo("world"); } @Test + @WithResource(name = "empty.properties") void loadWhenPropertySourceIsEmptyAddsNothingToConfigData() throws IOException { - ClassPathResource resource = new ClassPathResource("config/0-empty/testproperties.properties"); + ClassPathResource resource = new ClassPathResource("empty.properties"); StandardConfigDataReference reference = new StandardConfigDataReference( - ConfigDataLocation.of("classpath:config/0-empty/testproperties.properties"), null, - "config/0-empty/testproperties", null, "properties", new PropertiesPropertySourceLoader()); + ConfigDataLocation.of("empty.properties"), null, "empty", null, "properties", + new PropertiesPropertySourceLoader()); StandardConfigDataResource location = new StandardConfigDataResource(reference, resource); ConfigData configData = this.loader.load(this.loaderContext, location); assertThat(configData.getPropertySources()).isEmpty(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLocationResolverTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLocationResolverTests.java index eec8716dbaa0..183195037f68 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLocationResolverTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLocationResolverTests.java @@ -17,6 +17,7 @@ package org.springframework.boot.context.config; import java.io.File; +import java.nio.file.Path; import java.util.Collections; import java.util.List; @@ -26,6 +27,8 @@ import org.springframework.boot.context.properties.bind.Binder; import org.springframework.boot.env.PropertiesPropertySourceLoader; import org.springframework.boot.logging.DeferredLogs; +import org.springframework.boot.testsupport.classpath.resources.ResourcesRoot; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.core.env.PropertySource; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.DefaultResourceLoader; @@ -72,23 +75,22 @@ void isResolvableAlwaysReturnsTrue() { } @Test + @WithResource(name = "configdata/application.properties") void resolveWhenLocationIsDirectoryResolvesAllMatchingFilesInDirectory() { - ConfigDataLocation location = ConfigDataLocation.of("classpath:/configdata/properties/"); + ConfigDataLocation location = ConfigDataLocation.of("classpath:/configdata/"); List locations = this.resolver.resolve(this.context, location); assertThat(locations).hasSize(1); assertThat(locations).extracting(Object::toString) - .containsExactly("class path resource [configdata/properties/application.properties]"); + .containsExactly("class path resource [configdata/application.properties]"); } @Test void resolveWhenLocationIsFileResolvesFile() { - ConfigDataLocation location = ConfigDataLocation - .of("file:src/test/resources/configdata/properties/application.properties"); + ConfigDataLocation location = ConfigDataLocation.of("file:configdata/application.properties"); List locations = this.resolver.resolve(this.context, location); assertThat(locations).hasSize(1); assertThat(locations).extracting(Object::toString) - .containsExactly( - filePath("src", "test", "resources", "configdata", "properties", "application.properties")); + .containsExactly(filePath("configdata", "application.properties")); } @Test @@ -144,49 +146,55 @@ void resolveWhenLocationHasMultipleWildcardsThrowsException() { } @Test - void resolveWhenLocationIsWildcardDirectoriesRestrictsToOneLevelDeep() { - ConfigDataLocation location = ConfigDataLocation.of("file:src/test/resources/config/*/"); + @WithResource(name = "config/0-empty/testproperties.properties") + @WithResource(name = "config/1-first/testproperties.properties", content = "first.property=apple") + @WithResource(name = "config/2-second/testproperties.properties", content = "second.property=ball") + @WithResource(name = "config/nested/3-third/testproperties.properties", content = "third.property=shouldnotbefound") + void resolveWhenLocationIsWildcardDirectoriesRestrictsToOneLevelDeep(@ResourcesRoot Path resourcesRoot) { + ConfigDataLocation location = ConfigDataLocation.of("file:" + resourcesRoot + "/config/*/"); this.environment.setProperty("spring.config.name", "testproperties"); this.resolver = new StandardConfigDataLocationResolver(new DeferredLogs(), this.environmentBinder, this.resourceLoader); List locations = this.resolver.resolve(this.context, location); assertThat(locations).hasSize(3); assertThat(locations).extracting(Object::toString) - .contains(filePath("src", "test", "resources", "config", "1-first", "testproperties.properties")) - .contains(filePath("src", "test", "resources", "config", "2-second", "testproperties.properties")) - .doesNotContain(filePath("src", "test", "resources", "config", "3-third", "testproperties.properties")); + .contains(filePath(resourcesRoot.resolve("config/1-first/testproperties.properties"))) + .contains(filePath(resourcesRoot.resolve("config/2-second/testproperties.properties"))) + .doesNotContain(filePath(resourcesRoot.resolve("config/nested/3-third/testproperties.properties"))); } @Test - void resolveWhenLocationIsWildcardDirectoriesSortsAlphabeticallyBasedOnAbsolutePath() { - ConfigDataLocation location = ConfigDataLocation.of("file:src/test/resources/config/*/"); + @WithResource(name = "config/0-empty/testproperties.properties") + @WithResource(name = "config/1-first/testproperties.properties", content = "first.property=apple") + @WithResource(name = "config/2-second/testproperties.properties", content = "second.property=ball") + @WithResource(name = "config/nested/3-third/testproperties.properties", content = "third.property=shouldnotbefound") + void resolveWhenLocationIsWildcardDirectoriesSortsAlphabeticallyBasedOnAbsolutePath( + @ResourcesRoot Path resourcesRoot) { + ConfigDataLocation location = ConfigDataLocation.of("file:" + resourcesRoot + "/config/*/"); this.environment.setProperty("spring.config.name", "testproperties"); this.resolver = new StandardConfigDataLocationResolver(new DeferredLogs(), this.environmentBinder, this.resourceLoader); List locations = this.resolver.resolve(this.context, location); assertThat(locations).extracting(Object::toString) - .containsExactly(filePath("src", "test", "resources", "config", "0-empty", "testproperties.properties"), - filePath("src", "test", "resources", "config", "1-first", "testproperties.properties"), - filePath("src", "test", "resources", "config", "2-second", "testproperties.properties")); + .containsExactly(filePath(resourcesRoot.resolve("config/0-empty/testproperties.properties")), + filePath(resourcesRoot.resolve("config/1-first/testproperties.properties")), + filePath(resourcesRoot.resolve("config/2-second/testproperties.properties"))); } @Test - void resolveWhenLocationIsWildcardAndMatchingFilePresentShouldNotFail() { - ConfigDataLocation location = ConfigDataLocation.of("optional:file:src/test/resources/a-file/*/"); - assertThatNoException().isThrownBy(() -> this.resolver.resolve(this.context, location)); - } - - @Test - void resolveWhenLocationIsWildcardFilesLoadsAllFilesThatMatch() { + @WithResource(name = "config/0-empty/testproperties.properties") + @WithResource(name = "config/1-first/testproperties.properties", content = "first.property=apple") + @WithResource(name = "config/2-second/testproperties.properties", content = "second.property=ball") + @WithResource(name = "config/nested/3-third/testproperties.properties", content = "third.property=shouldnotbefound") + void resolveWhenLocationIsWildcardFilesLoadsAllFilesThatMatch(@ResourcesRoot Path resourcesRoot) { ConfigDataLocation location = ConfigDataLocation - .of("file:src/test/resources/config/*/testproperties.properties"); + .of("file:" + resourcesRoot + "/config/*/testproperties.properties"); List locations = this.resolver.resolve(this.context, location); assertThat(locations).hasSize(3); assertThat(locations).extracting(Object::toString) - .contains(filePath("src", "test", "resources", "config", "1-first", "testproperties.properties")) - .contains(filePath("src", "test", "resources", "config", "2-second", "testproperties.properties")) - .doesNotContain( - filePath("src", "test", "resources", "config", "nested", "3-third", "testproperties.properties")); + .contains(filePath(resourcesRoot.resolve("config/1-first/testproperties.properties"))) + .contains(filePath(resourcesRoot.resolve("config/2-second/testproperties.properties"))) + .doesNotContain(filePath(resourcesRoot.resolve("config/nested/3-third/testproperties.properties"))); } @Test @@ -209,6 +217,8 @@ void resolveWhenLocationIsRelativeAndFileResolves() { } @Test + @WithResource(name = "config/specific.properties") + @WithResource(name = "config/nested/3-third/testproperties.properties") void resolveWhenLocationIsRelativeAndDirectoryResolves() { this.environment.setProperty("spring.config.name", "testproperties"); ConfigDataLocation location = ConfigDataLocation.of("nested/3-third/"); @@ -241,6 +251,7 @@ void resolveWhenLocationIsRelativeAndNoMatchingLoaderThrowsException() { } @Test + @WithResource(name = "application-props-no-extension", content = "withnoextension=test") void resolveWhenLocationUsesOptionalExtensionSyntaxResolves() throws Exception { ConfigDataLocation location = ConfigDataLocation.of("classpath:/application-props-no-extension[.properties]"); List locations = this.resolver.resolve(this.context, location); @@ -249,19 +260,20 @@ void resolveWhenLocationUsesOptionalExtensionSyntaxResolves() throws Exception { assertThat(resolved.getResource().getFilename()).endsWith("application-props-no-extension"); ConfigData loaded = new StandardConfigDataLoader().load(null, resolved); PropertySource propertySource = loaded.getPropertySources().get(0); - assertThat(propertySource.getProperty("withnotext")).isEqualTo("test"); + assertThat(propertySource.getProperty("withnoextension")).isEqualTo("test"); } @Test + @WithResource(name = "application-dev.properties") void resolveProfileSpecificReturnsProfileSpecificFiles() { - ConfigDataLocation location = ConfigDataLocation.of("classpath:/configdata/properties/"); + ConfigDataLocation location = ConfigDataLocation.of("classpath:/"); this.environment.setActiveProfiles("dev"); Profiles profiles = new Profiles(this.environment, this.environmentBinder, Collections.emptyList()); List locations = this.resolver.resolveProfileSpecific(this.context, location, profiles); assertThat(locations).hasSize(1); assertThat(locations).extracting(Object::toString) - .containsExactly("class path resource [configdata/properties/application-dev.properties]"); + .containsExactly("class path resource [application-dev.properties]"); } @Test @@ -375,4 +387,8 @@ private String filePath(String... components) { return "file [" + String.join(File.separator, components) + "]"; } + private String filePath(Path path) { + return "file [%s]".formatted(path); + } + } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java index 1d8c729d22e6..44191581879a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java @@ -18,6 +18,10 @@ import java.io.File; import java.io.IOException; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; import java.nio.file.Path; import java.util.Collections; import java.util.HashMap; @@ -62,6 +66,7 @@ import org.springframework.boot.logging.java.JavaLoggingSystem; import org.springframework.boot.system.ApplicationPid; import org.springframework.boot.testsupport.classpath.ClassPathExclusions; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.boot.testsupport.system.CapturedOutput; import org.springframework.boot.testsupport.system.OutputCaptureExtension; import org.springframework.context.ApplicationEvent; @@ -160,8 +165,9 @@ void baseConfigLocation() { } @Test + @WithNonDefaultXmlResource void overrideConfigLocation() { - addPropertiesToEnvironment(this.context, "logging.config=classpath:logback-nondefault.xml"); + addPropertiesToEnvironment(this.context, "logging.config=classpath:nondefault.xml"); this.listener.initialize(this.context.getEnvironment(), this.context.getClassLoader()); this.logger.info("Hello world"); assertThat(this.output).contains("Hello world").doesNotContain("???").startsWith("null ").endsWith("BOOTBOOT"); @@ -178,8 +184,9 @@ void throwableFromInitializeResultsInGracefulFailure(CapturedOutput output) { } @Test + @WithNonDefaultXmlResource void trailingWhitespaceInLoggingConfigShouldBeTrimmed() { - addPropertiesToEnvironment(this.context, "logging.config=classpath:logback-nondefault.xml "); + addPropertiesToEnvironment(this.context, "logging.config=classpath:nondefault.xml "); this.listener.initialize(this.context.getEnvironment(), this.context.getClassLoader()); this.logger.info("Hello world"); assertThat(this.output).contains("Hello world").doesNotContain("???").startsWith("null ").endsWith("BOOTBOOT"); @@ -226,8 +233,9 @@ void overrideConfigBroken() { } @Test + @WithNonDefaultXmlResource void addLogFileProperty() { - addPropertiesToEnvironment(this.context, "logging.config=classpath:logback-nondefault.xml", + addPropertiesToEnvironment(this.context, "logging.config=classpath:nondefault.xml", "logging.file.name=" + this.logFile); this.listener.initialize(this.context.getEnvironment(), this.context.getClassLoader()); Log logger = LogFactory.getLog(LoggingApplicationListenerTests.class); @@ -248,8 +256,9 @@ void addLogFilePropertyWithDefault() { } @Test + @WithNonDefaultXmlResource void addLogPathProperty() { - addPropertiesToEnvironment(this.context, "logging.config=classpath:logback-nondefault.xml", + addPropertiesToEnvironment(this.context, "logging.config=classpath:nondefault.xml", "logging.file.path=" + this.tempDir); this.listener.initialize(this.context.getEnvironment(), this.context.getClassLoader()); Log logger = LogFactory.getLog(LoggingApplicationListenerTests.class); @@ -779,4 +788,22 @@ public int getPhase() { } + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "nondefault.xml", content = """ + + + + %property{LOG_FILE} [%t] ${PID:-????} %c{1}: %m%n BOOTBOOT + + + + + + + """) + private @interface WithNonDefaultXmlResource { + + } + } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java index 3c80f26dfa48..a223cfa1a66e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java @@ -70,6 +70,7 @@ import org.springframework.boot.convert.PeriodStyle; import org.springframework.boot.convert.PeriodUnit; import org.springframework.boot.env.RandomValuePropertySource; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.boot.testsupport.system.CapturedOutput; import org.springframework.boot.testsupport.system.OutputCaptureExtension; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -262,6 +263,21 @@ void loadWhenBindingWithoutAnnotationValueShouldBind() { } @Test + @WithResource(name = "testProperties.xml", + content = """ + + + + + + + + + """) void loadWhenBindingWithDefaultsInXmlShouldBind() { removeSystemProperties(); load(new Class[] { DefaultsInXmlConfiguration.class }); @@ -654,6 +670,7 @@ void customProtocolResolverIsInvoked() { } @Test + @WithResource(name = "application.properties") void customProtocolResolver() { this.context = new AnnotationConfigApplicationContext(); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, @@ -1377,7 +1394,7 @@ static class WithoutAnnotationValueConfiguration { @Configuration(proxyBeanMethods = false) @EnableConfigurationProperties - @ImportResource("org/springframework/boot/context/properties/testProperties.xml") + @ImportResource("testProperties.xml") static class DefaultsInXmlConfiguration { } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/StringToFileConverterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/StringToFileConverterTests.java index a3cb2b37af07..015e6ab1cfad 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/StringToFileConverterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/StringToFileConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.provider.Arguments; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.core.convert.ConversionService; import org.springframework.core.io.ClassPathResource; @@ -52,9 +53,10 @@ void convertWhenFilePrefixedReturnsFile(ConversionService conversionService) { } @ConversionServiceTest + @WithResource(name = "com/example/test-file.txt", content = "test content") void convertWhenClasspathPrefixedReturnsFile(ConversionService conversionService) throws IOException { - String resource = new ClassPathResource("test-banner.txt", this.getClass().getClassLoader()).getURL().getFile(); - assertThat(convert(conversionService, "classpath:test-banner.txt").getAbsoluteFile()) + String resource = new ClassPathResource("com/example/test-file.txt").getURL().getFile(); + assertThat(convert(conversionService, "classpath:com/example/test-file.txt").getAbsoluteFile()) .isEqualTo(new File(resource).getAbsoluteFile()); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/NoUniqueBeanDefinitionFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/NoUniqueBeanDefinitionFailureAnalyzerTests.java index e67fc5240628..ba440e31827e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/NoUniqueBeanDefinitionFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/NoUniqueBeanDefinitionFailureAnalyzerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import org.springframework.boot.diagnostics.FailureAnalysis; import org.springframework.boot.diagnostics.analyzer.nounique.TestBean; import org.springframework.boot.diagnostics.analyzer.nounique.TestBeanConsumer; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -39,6 +40,17 @@ * @author Andy Wilkinson * @author Scott Frederick */ +@WithResource(name = "producer.xml", + content = """ + + + + + + + """) class NoUniqueBeanDefinitionFailureAnalyzerTests { private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @@ -79,6 +91,17 @@ void failureAnalysisForObjectProviderMethodConsumer() { } @Test + @WithResource(name = "consumer.xml", + content = """ + + + + + + + """) void failureAnalysisForXmlConsumer() { FailureAnalysis failureAnalysis = analyzeFailure(createFailure(XmlConsumer.class)); assertThat(failureAnalysis.getDescription()).startsWith("Parameter 0 of constructor in " @@ -147,7 +170,7 @@ private void assertFoundBeans(FailureAnalysis analysis) { @Configuration(proxyBeanMethods = false) @ComponentScan(basePackageClasses = TestBean.class) - @ImportResource("/org/springframework/boot/diagnostics/analyzer/nounique/producer.xml") + @ImportResource("classpath:producer.xml") static class DuplicateBeansProducer { @Bean @@ -216,7 +239,7 @@ String consumer(ObjectProvider testBeanProvider) { } @Configuration(proxyBeanMethods = false) - @ImportResource("/org/springframework/boot/diagnostics/analyzer/nounique/consumer.xml") + @ImportResource("classpath:consumer.xml") static class XmlConsumer { } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java index 6fdb3e743bb4..e5f3e7d399e1 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import org.springframework.boot.env.OriginTrackedPropertiesLoader.Document; import org.springframework.boot.origin.OriginTrackedValue; import org.springframework.boot.origin.TextResourceOrigin; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.support.PropertiesLoaderUtils; @@ -92,9 +93,10 @@ void getUnicodeProperty() { } @Test + @WithResource(name = "malformed-unicode.properties", content = "test-malformed-unicode=properties\\u(026test") void getMalformedUnicodeProperty() { // gh-12716 - ClassPathResource resource = new ClassPathResource("test-properties-malformed-unicode.properties", getClass()); + ClassPathResource resource = new ClassPathResource("malformed-unicode.properties"); assertThatIllegalStateException().isThrownBy(() -> new OriginTrackedPropertiesLoader(resource).load()) .withMessageContaining("Malformed \\uxxxx encoding"); } @@ -326,8 +328,43 @@ void getPropertyWithEscapedTrailingSpace() { } @Test + @WithResource(name = "existing-non-multi-document.properties", content = """ + #--- + # Test + #--- + + spring=boot + + #--- + # Test + + boot=bar + + + # Test + #--- + + bar=ok + + !--- + ! Test + !--- + + ok=well + + !--- + ! Test + + well=hello + + ! Test + !--- + + hello=world + + """) void existingCommentsAreNotTreatedAsMultiDoc() throws Exception { - this.resource = new ClassPathResource("existing-non-multi-document.properties", getClass()); + this.resource = new ClassPathResource("existing-non-multi-document.properties"); this.documents = new OriginTrackedPropertiesLoader(this.resource).load(); assertThat(this.documents).hasSize(1); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedYamlLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedYamlLoaderTests.java index 58720b002351..86cc0e9de17d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedYamlLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedYamlLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,10 @@ package org.springframework.boot.env; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; @@ -26,6 +30,7 @@ import org.springframework.boot.origin.OriginTrackedValue; import org.springframework.boot.origin.TextResourceOrigin; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; @@ -47,11 +52,12 @@ class OriginTrackedYamlLoaderTests { @BeforeEach void setUp() { - Resource resource = new ClassPathResource("test-yaml.yml", getClass()); + Resource resource = new ClassPathResource("test-yaml.yml"); this.loader = new OriginTrackedYamlLoader(resource); } @Test + @WithTestYamlResource void processSimpleKey() { OriginTrackedValue value = getValue("name"); assertThat(value).hasToString("Martin D'vloper"); @@ -59,6 +65,7 @@ void processSimpleKey() { } @Test + @WithTestYamlResource void processMap() { OriginTrackedValue perl = getValue("languages.perl"); OriginTrackedValue python = getValue("languages.python"); @@ -72,6 +79,7 @@ void processMap() { } @Test + @WithTestYamlResource void processCollection() { OriginTrackedValue apple = getValue("foods[0]"); OriginTrackedValue orange = getValue("foods[1]"); @@ -88,6 +96,7 @@ void processCollection() { } @Test + @WithTestYamlResource void processMultiline() { OriginTrackedValue education = getValue("education"); assertThat(education).hasToString("4 GCSEs\n3 A-Levels\nBSc in the Internet of Things\n"); @@ -95,6 +104,7 @@ void processMultiline() { } @Test + @WithTestYamlResource void processListOfMaps() { OriginTrackedValue name = getValue("example.foo[0].name"); OriginTrackedValue url = getValue("example.foo[0].url"); @@ -111,6 +121,7 @@ void processListOfMaps() { } @Test + @WithTestYamlResource void processEmptyAndNullValues() { OriginTrackedValue empty = getValue("empty"); OriginTrackedValue nullValue = getValue("null-value"); @@ -124,6 +135,7 @@ void processEmptyAndNullValues() { } @Test + @WithTestYamlResource void emptyMapsAreDropped() { Object emptyMap = getValue("emptymap"); assertThat(emptyMap).isNull(); @@ -138,8 +150,15 @@ void unsupportedType() { } @Test + @WithResource(name = "test-empty-yaml.yml", content = """ + --- + --- + + --- + --- + """) void emptyDocuments() { - this.loader = new OriginTrackedYamlLoader(new ClassPathResource("test-empty-yaml.yml", getClass())); + this.loader = new OriginTrackedYamlLoader(new ClassPathResource("test-empty-yaml.yml")); List> loaded = this.loader.load(); assertThat(loaded).isEmpty(); } @@ -165,8 +184,17 @@ void loadWhenLargeNumberOfNodesLoadsYaml() { } @Test + @WithResource(name = "recursive.yml", content = """ + &def1 + *def1: a + test: + a: + spring: 'a' + b: + boot: 'b' + """) void loadWhenRecursiveLoadsYaml() { - Resource resource = new ClassPathResource("recursive.yml", getClass()); + Resource resource = new ClassPathResource("recursive.yml"); this.loader = new OriginTrackedYamlLoader(resource); Map loaded = this.loader.load().get(0); assertThat(loaded.get("test.a.spring")).hasToString("a"); @@ -174,8 +202,16 @@ void loadWhenRecursiveLoadsYaml() { } @Test + @WithResource(name = "anchors.yml", content = """ + some: + path: &anchor + config: + key: value + anotherpath: + <<: *anchor + """) void loadWhenUsingAnchors() { - Resource resource = new ClassPathResource("anchors.yml", getClass()); + Resource resource = new ClassPathResource("anchors.yml"); this.loader = new OriginTrackedYamlLoader(resource); Map loaded = this.loader.load().get(0); assertThat(loaded.get("some.path.config.key")).hasToString("value"); @@ -206,4 +242,49 @@ private String getLocation(OriginTrackedValue value) { return ((TextResourceOrigin) value.getOrigin()).getLocation().toString(); } + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.METHOD) + @WithResource(name = "test-yaml.yml", content = """ + # https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html + + name: Martin D'vloper + job: Developer + skill: Elite + employed: True + foods: + - Apple + - Orange + - Strawberry + - Mango + languages: + perl: Elite + python: Elite + pascal: Lame + education: | + 4 GCSEs + 3 A-Levels + BSc in the Internet of Things + example: + foo: + - name: springboot + url: https://springboot.example.com/ + bar: + - bar1: baz + - bar2: bling + empty: "" + null-value: null + emptylist: [] + emptymap: {} + --- + + spring: + profiles: development + name: Test Name + + --- + """) + private @interface WithTestYamlResource { + + } + } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java index 67b24310faba..f38cafabbe14 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/PropertiesPropertySourceLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.core.env.PropertySource; import org.springframework.core.io.ClassPathResource; @@ -41,17 +42,28 @@ void getFileExtensions() { } @Test + @WithResource(name = "test.properties", content = "test=properties") void loadProperties() throws Exception { - List> loaded = this.loader.load("test.properties", - new ClassPathResource("test-properties.properties", getClass())); + List> loaded = this.loader.load("test.properties", new ClassPathResource("test.properties")); PropertySource source = loaded.get(0); assertThat(source.getProperty("test")).isEqualTo("properties"); } @Test + @WithResource(name = "test.properties", content = """ + #--- + #test + blah=hello world + bar=baz + hello=world + #--- + foo=bar + bling=biz + #comment1 + #comment2 + """) void loadMultiDocumentPropertiesWithSeparatorAtTheBeginningOfFile() throws Exception { - List> loaded = this.loader.load("test.properties", - new ClassPathResource("multi-document-properties-2.properties", getClass())); + List> loaded = this.loader.load("test.properties", new ClassPathResource("test.properties")); assertThat(loaded).hasSize(2); PropertySource source1 = loaded.get(0); PropertySource source2 = loaded.get(1); @@ -60,9 +72,20 @@ void loadMultiDocumentPropertiesWithSeparatorAtTheBeginningOfFile() throws Excep } @Test + @WithResource(name = "test.properties", content = """ + #test + blah=hello world + bar=baz + hello=world + #--- + foo=bar + bling=biz + #comment1 + #comment2 + #--- + """) void loadMultiDocumentProperties() throws Exception { - List> loaded = this.loader.load("test.properties", - new ClassPathResource("multi-document-properties.properties", getClass())); + List> loaded = this.loader.load("test.properties", new ClassPathResource("test.properties")); assertThat(loaded).hasSize(2); PropertySource source1 = loaded.get(0); PropertySource source2 = loaded.get(1); @@ -71,9 +94,22 @@ void loadMultiDocumentProperties() throws Exception { } @Test + @WithResource(name = "test.properties", content = """ + + #--- + #test + blah=hello world + bar=baz + hello=world + #--- + #--- + foo=bar + bling=biz + #comment1 + #comment2 + """) void loadMultiDocumentPropertiesWithEmptyDocument() throws Exception { - List> loaded = this.loader.load("test.properties", - new ClassPathResource("multi-document-properties-empty.properties", getClass())); + List> loaded = this.loader.load("test.properties", new ClassPathResource("test.properties")); assertThat(loaded).hasSize(2); PropertySource source1 = loaded.get(0); PropertySource source2 = loaded.get(1); @@ -82,9 +118,15 @@ void loadMultiDocumentPropertiesWithEmptyDocument() throws Exception { } @Test + @WithResource(name = "test.xml", content = """ + + + + xml + + """) void loadXml() throws Exception { - List> loaded = this.loader.load("test.xml", - new ClassPathResource("test-xml.xml", getClass())); + List> loaded = this.loader.load("test.xml", new ClassPathResource("test.xml")); PropertySource source = loaded.get(0); assertThat(source.getProperty("test")).isEqualTo("xml"); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java index c5d076a55dee..029c2b18585d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/YamlPropertySourceLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import org.junit.jupiter.api.Test; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.core.env.EnumerablePropertySource; import org.springframework.core.env.PropertySource; import org.springframework.core.io.ByteArrayResource; @@ -86,8 +87,14 @@ void timestampLikeItemsDoNotBecomeDates() throws Exception { } @Test + @WithResource(name = "test-yaml.yml", content = """ + a: b + --- + c: d + e: f + """) void loadOriginAware() throws Exception { - Resource resource = new ClassPathResource("test-yaml.yml", getClass()); + Resource resource = new ClassPathResource("test-yaml.yml"); List> loaded = this.loader.load("resource", resource); for (PropertySource source : loaded) { EnumerablePropertySource enumerableSource = (EnumerablePropertySource) source; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/AbstractClientHttpRequestFactoryBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/AbstractClientHttpRequestFactoryBuilderTests.java index bb9b9c2c2ad4..64d9682864c4 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/AbstractClientHttpRequestFactoryBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/AbstractClientHttpRequestFactoryBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,6 +40,7 @@ import org.springframework.boot.ssl.SslOptions; import org.springframework.boot.ssl.jks.JksSslStoreBundle; import org.springframework.boot.ssl.jks.JksSslStoreDetails; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.boot.testsupport.web.servlet.DirtiesUrlFactories; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.server.Ssl; @@ -100,6 +101,7 @@ void buildWhenHadReadTimeout() { } @ParameterizedTest + @WithPackageResources("test.jks") @ValueSource(strings = { "GET", "POST" }) void connectWithSslBundle(String httpMethod) throws Exception { TomcatServletWebServerFactory webServerFactory = new TomcatServletWebServerFactory(0); @@ -126,6 +128,7 @@ void connectWithSslBundle(String httpMethod) throws Exception { } @ParameterizedTest + @WithPackageResources("test.jks") @ValueSource(strings = { "GET", "POST" }) void connectWithSslBundleAndOptionsMismatch(String httpMethod) throws Exception { TomcatServletWebServerFactory webServerFactory = new TomcatServletWebServerFactory(0); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilderTests.java index bcdb86f7985d..930586724343 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/http/client/HttpComponentsClientHttpRequestFactoryBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.ssl.SslBundle; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.test.util.ReflectionTestUtils; @@ -77,6 +78,7 @@ void withCustomizers() { } @Test + @WithPackageResources("test.jks") void withTlsSocketStrategyFactory() { ClientHttpRequestFactorySettings settings = ClientHttpRequestFactorySettings.ofSslBundle(sslBundle()); List bundles = new ArrayList<>(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/info/SslInfoTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/info/SslInfoTests.java index 316c05d1dc28..04d817b021ae 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/info/SslInfoTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/info/SslInfoTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,7 @@ import org.springframework.boot.ssl.SslStoreBundle; import org.springframework.boot.ssl.jks.JksSslStoreBundle; import org.springframework.boot.ssl.jks.JksSslStoreDetails; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import static org.assertj.core.api.Assertions.assertThat; @@ -49,6 +50,7 @@ class SslInfoTests { @Test + @WithPackageResources("test.p12") void validCertificatesShouldProvideSslInfo() { SslInfo sslInfo = createSslInfo("classpath:test.p12"); assertThat(sslInfo.getBundles()).hasSize(1); @@ -88,6 +90,7 @@ void validCertificatesShouldProvideSslInfo() { } @Test + @WithPackageResources("test-not-yet-valid.p12") void notYetValidCertificateShouldProvideSslInfo() { SslInfo sslInfo = createSslInfo("classpath:test-not-yet-valid.p12"); assertThat(sslInfo.getBundles()).hasSize(1); @@ -112,6 +115,7 @@ void notYetValidCertificateShouldProvideSslInfo() { } @Test + @WithPackageResources("test-expired.p12") void expiredCertificateShouldProvideSslInfo() { SslInfo sslInfo = createSslInfo("classpath:test-expired.p12"); assertThat(sslInfo.getBundles()).hasSize(1); @@ -162,6 +166,7 @@ void soonToBeExpiredCertificateShouldProvideSslInfo(@TempDir Path tempDir) } @Test + @WithPackageResources({ "test.p12", "test-not-yet-valid.p12", "test-expired.p12" }) void multipleBundlesShouldProvideSslInfo(@TempDir Path tempDir) throws IOException, InterruptedException { Path keyStore = createKeyStore(tempDir); SslInfo sslInfo = createSslInfo("classpath:test.p12", "classpath:test-not-yet-valid.p12", diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/io/ApplicationResourceLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/io/ApplicationResourceLoaderTests.java index c7e863cf41f3..7424067fc12b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/io/ApplicationResourceLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/io/ApplicationResourceLoaderTests.java @@ -28,6 +28,8 @@ import jakarta.servlet.ServletContext; import org.junit.jupiter.api.Test; +import org.springframework.boot.testsupport.classpath.resources.ResourcePath; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.DefaultResourceLoader; @@ -111,6 +113,7 @@ void shouldLoadRelativePathWithWorkingDirectory() throws IOException { } @Test + @WithResource(name = "a-file") void shouldLoadClasspathLocations() { Resource resource = ApplicationResourceLoader.get().getResource("classpath:a-file"); assertThat(resource.exists()).isTrue(); @@ -123,8 +126,9 @@ void shouldLoadNonExistentClasspathLocations() { } @Test + @WithResource(name = "a-file", content = "some content") void shouldLoadClasspathLocationsWithWorkingDirectory() { - ClassLoader classLoader = getClass().getClassLoader(); + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Resource resource = ApplicationResourceLoader .get(classLoader, SpringFactoriesLoader.forDefaultResourceLocation(classLoader), Path.of("/working-directory")) @@ -179,6 +183,8 @@ void shouldLoadAbsoluteFileUrisWithWorkingDirectory() throws IOException { } @Test + @WithResource(name = TEST_PROTOCOL_RESOLVERS_FACTORIES, + content = "org.springframework.core.io.ProtocolResolver=org.springframework.boot.io.ReverseStringProtocolResolver") void getWithClassPathIncludesProtocolResolvers() throws IOException { ClassLoader classLoader = new TestClassLoader(this::useTestProtocolResolversFactories); ResourceLoader loader = ApplicationResourceLoader.get(classLoader); @@ -194,9 +200,11 @@ void getWithClassPathWhenClassPathIsNullIncludesProtocolResolvers() throws IOExc } @Test + @WithResource(name = TEST_PROTOCOL_RESOLVERS_FACTORIES, + content = "org.springframework.core.io.ProtocolResolver=org.springframework.boot.io.ReverseStringProtocolResolver") void getWithClassPathAndSpringFactoriesLoaderIncludesProtocolResolvers() throws IOException { SpringFactoriesLoader springFactoriesLoader = SpringFactoriesLoader - .forResourceLocation(TEST_PROTOCOL_RESOLVERS_FACTORIES); + .forResourceLocation(TEST_PROTOCOL_RESOLVERS_FACTORIES, Thread.currentThread().getContextClassLoader()); ResourceLoader loader = ApplicationResourceLoader.get((ClassLoader) null, springFactoriesLoader); Resource resource = loader.getResource("reverse:test"); assertThat(contentAsString(resource)).isEqualTo("tset"); @@ -255,14 +263,17 @@ void getWithResourceLoaderAndSpringFactoriesLoaderWhenSpringFactoriesLoaderIsNul @Test void getResourceWhenPathIsRelative() throws IOException { ResourceLoader loader = ApplicationResourceLoader.get(); - String name = "src/test/resources/" + TEST_PROTOCOL_RESOLVERS_FACTORIES; + String name = "relative/path/file.txt"; Resource resource = loader.getResource(name); - assertThat(resource.getFile()).isEqualTo(new File(name)); + File resourceFile = resource.getFile(); + assertThat(resourceFile).isRelative(); + assertThat(resourceFile).isEqualTo(new File(name)); } @Test - void getResourceWhenPathIsAbsolute() throws IOException { - File file = new File("src/test/resources/" + TEST_PROTOCOL_RESOLVERS_FACTORIES); + @WithResource(name = TEST_PROTOCOL_RESOLVERS_FACTORIES, + content = "org.springframework.core.io.ProtocolResolver=org.springframework.boot.io.ReverseStringProtocolResolver") + void getResourceWhenPathIsAbsolute(@ResourcePath(TEST_PROTOCOL_RESOLVERS_FACTORIES) File file) throws IOException { ResourceLoader loader = ApplicationResourceLoader.get(); Resource resource = loader.getResource(file.getAbsolutePath()); assertThat(resource.getFile()).hasSameBinaryContentAs(file); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/init/DataSourceScriptDatabaseInitializerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/init/DataSourceScriptDatabaseInitializerTests.java index a723a3de5186..508b9cbd05dd 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/init/DataSourceScriptDatabaseInitializerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/init/DataSourceScriptDatabaseInitializerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,6 +70,7 @@ void whenDatabaseIsInaccessibleThenItIsAssumedNotToBeEmbedded() { } @Test + @WithDataSqlResource void whenCustomizeIsOverriddenThenDatabasePopulatorIsConfiguredAccordingly() { DatabaseInitializationSettings settings = new DatabaseInitializationSettings(); settings.setContinueOnError(true); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/AbstractJsonParserTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/AbstractJsonParserTests.java index fed13ff2b31c..0fbef469064e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/AbstractJsonParserTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/AbstractJsonParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,15 +16,14 @@ package org.springframework.boot.json; -import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.Test; -import org.springframework.util.StreamUtils; +import org.springframework.boot.testsupport.classpath.resources.ResourceContent; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -192,26 +191,22 @@ void mapWithKeyAndNoValue() { } @Test // gh-31868 - void listWithRepeatedOpenArray() throws IOException { - String input = StreamUtils.copyToString( - AbstractJsonParserTests.class.getResourceAsStream("repeated-open-array.txt"), StandardCharsets.UTF_8); + @WithPackageResources("repeated-open-array.txt") + void listWithRepeatedOpenArray(@ResourceContent("repeated-open-array.txt") String input) { assertThatExceptionOfType(JsonParseException.class).isThrownBy(() -> this.parser.parseList(input)) .havingCause() .withMessageContaining("too deeply nested"); } @Test // gh-31869 - void largeMalformed() throws IOException { - String input = StreamUtils.copyToString( - AbstractJsonParserTests.class.getResourceAsStream("large-malformed-json.txt"), StandardCharsets.UTF_8); + @WithPackageResources("large-malformed-json.txt") + void largeMalformed(@ResourceContent("large-malformed-json.txt") String input) { assertThatExceptionOfType(JsonParseException.class).isThrownBy(() -> this.parser.parseList(input)); } @Test // gh-32029 - void deeplyNestedMap() throws IOException { - String input = StreamUtils.copyToString( - AbstractJsonParserTests.class.getResourceAsStream("deeply-nested-map-json.txt"), - StandardCharsets.UTF_8); + @WithPackageResources("deeply-nested-map-json.txt") + void deeplyNestedMap(@ResourceContent("deeply-nested-map-json.txt") String input) { assertThatExceptionOfType(JsonParseException.class).isThrownBy(() -> this.parser.parseList(input)); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/GsonJsonParserTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/GsonJsonParserTests.java index 3a7b7f04aa84..f597fd1902ce 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/GsonJsonParserTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/GsonJsonParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.boot.json; -import java.io.IOException; - /** * Tests for {@link GsonJsonParser}. * @@ -31,7 +29,7 @@ protected JsonParser getParser() { } @Override - void listWithRepeatedOpenArray() throws IOException { + void listWithRepeatedOpenArray(String input) { // Gson does not protect against deeply nested JSON } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/JacksonJsonParserTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/JacksonJsonParserTests.java index 4e79ac568614..57f445c64dd6 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/JacksonJsonParserTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/JacksonJsonParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ void instanceWithSpecificObjectMapper() throws IOException { @Override @Disabled("Jackson's array handling is no longer stack bound so protection has been removed.") // https://github.com/FasterXML/jackson-databind/commit/8238ab41d0350fb915797c89d46777b4496b74fd - void listWithRepeatedOpenArray() throws IOException { + void listWithRepeatedOpenArray(String input) { } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggingSystemTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggingSystemTests.java index 495193de4bb2..eccdef167ae0 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggingSystemTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggingSystemTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ import org.springframework.boot.logging.LoggerConfiguration; import org.springframework.boot.logging.LoggingSystem; import org.springframework.boot.logging.LoggingSystemProperty; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.boot.testsupport.system.CapturedOutput; import org.springframework.boot.testsupport.system.OutputCaptureExtension; import org.springframework.util.ClassUtils; @@ -123,6 +124,10 @@ void testSystemPropertyInitializesFormat(CapturedOutput output) { } @Test + @WithResource(name = "logging-nondefault.properties", content = """ + handlers = java.util.logging.ConsoleHandler + .level = INFO + """) void testNonDefaultConfigLocation(CapturedOutput output) { this.loggingSystem.beforeInitialize(); this.loggingSystem.initialize(null, "classpath:logging-nondefault.properties", null); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java index 24d4bfaaed4f..2eb022235a6e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java @@ -19,6 +19,10 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; import java.net.ProtocolException; import java.util.EnumSet; import java.util.LinkedHashMap; @@ -59,6 +63,7 @@ import org.springframework.boot.logging.LoggingSystemProperties; import org.springframework.boot.logging.LoggingSystemProperty; import org.springframework.boot.testsupport.classpath.ClassPathExclusions; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.boot.testsupport.logging.ConfigureClasspathToPreferLog4j2; import org.springframework.boot.testsupport.system.CapturedOutput; import org.springframework.boot.testsupport.system.OutputCaptureExtension; @@ -146,16 +151,16 @@ void withFile(CapturedOutput output) { } @Test + @WithNonDefaultXmlResource void testNonDefaultConfigLocation(CapturedOutput output) { this.loggingSystem.beforeInitialize(); - this.loggingSystem.initialize(this.initializationContext, "classpath:log4j2-nondefault.xml", + this.loggingSystem.initialize(this.initializationContext, "classpath:nondefault.xml", getLogFile(tmpDir() + "/tmp.log", null)); this.logger.info("Hello world"); Configuration configuration = this.loggingSystem.getConfiguration(); assertThat(output).contains("Hello world").contains(tmpDir() + "/tmp.log"); assertThat(new File(tmpDir() + "/tmp.log")).doesNotExist(); - assertThat(configuration.getConfigurationSource().getFile().getAbsolutePath()) - .contains("log4j2-nondefault.xml"); + assertThat(configuration.getConfigurationSource().getFile().getAbsolutePath()).contains("nondefault.xml"); assertThat(configuration.getWatchManager().getIntervalSeconds()).isEqualTo(30); } @@ -449,15 +454,18 @@ void shutdownHookIsDisabled() { } @Test + @WithNonDefaultXmlResource + @WithOverrideXmlResource void compositeConfigurationWithCustomBaseConfiguration() { - this.environment.setProperty("logging.log4j2.config.override", "src/test/resources/log4j2-override.xml"); - this.loggingSystem.initialize(this.initializationContext, "src/test/resources/log4j2-nondefault.xml", null); + this.environment.setProperty("logging.log4j2.config.override", "classpath:override.xml"); + this.loggingSystem.initialize(this.initializationContext, "classpath:nondefault.xml", null); assertThat(this.loggingSystem.getConfiguration()).isInstanceOf(CompositeConfiguration.class); } @Test + @WithOverrideXmlResource void compositeConfigurationWithStandardConfigLocationConfiguration() { - this.environment.setProperty("logging.log4j2.config.override", "src/test/resources/log4j2-override.xml"); + this.environment.setProperty("logging.log4j2.config.override", "classpath:override.xml"); this.loggingSystem.initialize(this.initializationContext, null, null); assertThat(this.loggingSystem.getConfiguration()).isInstanceOf(CompositeConfiguration.class); } @@ -777,4 +785,45 @@ static class Nested { } + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "nondefault.xml", + content = """ + + + ???? + ${sys:LOG_FILE} %d{yyyy-MM-dd HH:mm:ss.SSS}] service%X{context} - ${sys:PID} %5p [%t] --- %c{1}: %m%n + + + + + + + + + + + + + """) + private @interface WithNonDefaultXmlResource { + + } + + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "override.xml", content = """ + + + + + + + + + """) + private @interface WithOverrideXmlResource { + + } + } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/SpringProfileArbiterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/SpringProfileArbiterTests.java index e27a1e4cdb89..f410ca55c548 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/SpringProfileArbiterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/SpringProfileArbiterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,10 @@ package org.springframework.boot.logging.log4j2; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; import java.util.Set; import org.apache.logging.log4j.LogManager; @@ -32,12 +36,12 @@ import org.springframework.boot.logging.LoggingInitializationContext; import org.springframework.boot.testsupport.classpath.ClassPathExclusions; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.boot.testsupport.logging.ConfigureClasspathToPreferLog4j2; import org.springframework.boot.testsupport.system.CapturedOutput; import org.springframework.boot.testsupport.system.OutputCaptureExtension; import org.springframework.mock.env.MockEnvironment; import org.springframework.test.util.ReflectionTestUtils; -import org.springframework.util.ClassUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -93,6 +97,7 @@ private void cleanUpPropertySources() { // https://issues.apache.org/jira/browse } @Test + @WithProductionProfileXmlResource void profileActive() { this.environment.setActiveProfiles("production"); initialize("production-profile.xml"); @@ -101,6 +106,7 @@ void profileActive() { } @Test + @WithMultiProfileNamesXmlResource void multipleNamesFirstProfileActive() { this.environment.setActiveProfiles("production"); initialize("multi-profile-names.xml"); @@ -109,6 +115,7 @@ void multipleNamesFirstProfileActive() { } @Test + @WithMultiProfileNamesXmlResource void multipleNamesSecondProfileActive() { this.environment.setActiveProfiles("test"); initialize("multi-profile-names.xml"); @@ -117,6 +124,7 @@ void multipleNamesSecondProfileActive() { } @Test + @WithProductionProfileXmlResource void profileNotActive() { initialize("production-profile.xml"); this.logger.trace("Hello"); @@ -124,6 +132,7 @@ void profileNotActive() { } @Test + @WithProfileExpressionXmlResource void profileExpressionMatchFirst() { this.environment.setActiveProfiles("production"); initialize("profile-expression.xml"); @@ -132,6 +141,7 @@ void profileExpressionMatchFirst() { } @Test + @WithProfileExpressionXmlResource void profileExpressionMatchSecond() { this.environment.setActiveProfiles("test"); initialize("profile-expression.xml"); @@ -140,6 +150,7 @@ void profileExpressionMatchSecond() { } @Test + @WithProfileExpressionXmlResource void profileExpressionNoMatch() { this.environment.setActiveProfiles("development"); initialize("profile-expression.xml"); @@ -148,13 +159,56 @@ void profileExpressionNoMatch() { } private void initialize(String config) { - this.environment.setProperty("logging.log4j2.config.override", getPackageResource(config)); + this.environment.setProperty("logging.log4j2.config.override", "classpath:" + config); this.loggingSystem.initialize(this.initializationContext, null, null); } - private String getPackageResource(String fileName) { - String path = ClassUtils.getPackageName(getClass()); - return "src/test/resources/" + path.replace('.', '/') + "/" + fileName; + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "multi-profile-names.xml", content = """ + + + + + + + + + """) + private @interface WithMultiProfileNamesXmlResource { + + } + + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "profile-expression.xml", content = """ + + + + + + + + + """) + private @interface WithProfileExpressionXmlResource { + + } + + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "production-profile.xml", content = """ + + + + + + + + + """) + private @interface WithProductionProfileXmlResource { + } } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackConfigurationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackConfigurationTests.java index 0e6ad7bd18c2..37382c9350b5 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackConfigurationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,9 @@ import ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy; import org.junit.jupiter.api.Test; +import org.springframework.boot.testsupport.classpath.resources.ResourcesRoot; +import org.springframework.boot.testsupport.classpath.resources.WithResource; + import static org.assertj.core.api.Assertions.assertThat; /** @@ -43,11 +46,17 @@ class LogbackConfigurationTests { @Test - void consolePatternCanBeOverridden() throws JoranException { + @WithResource(name = "custom-console-log-pattern.xml", content = """ + + + + + """) + void consolePatternCanBeOverridden(@ResourcesRoot File resourcesRoot) throws JoranException { JoranConfigurator configurator = new JoranConfigurator(); LoggerContext context = new LoggerContext(); configurator.setContext(context); - configurator.doConfigure(new File("src/test/resources/custom-console-log-pattern.xml")); + configurator.doConfigure(new File(resourcesRoot, "custom-console-log-pattern.xml")); Appender appender = context.getLogger("ROOT").getAppender("CONSOLE"); assertThat(appender).isInstanceOf(ConsoleAppender.class); Encoder encoder = ((ConsoleAppender) appender).getEncoder(); @@ -56,11 +65,17 @@ void consolePatternCanBeOverridden() throws JoranException { } @Test - void filePatternCanBeOverridden() throws JoranException { + @WithResource(name = "custom-file-log-pattern.xml", content = """ + + + + + """) + void filePatternCanBeOverridden(@ResourcesRoot File resourcesRoot) throws JoranException { JoranConfigurator configurator = new JoranConfigurator(); LoggerContext context = new LoggerContext(); configurator.setContext(context); - configurator.doConfigure(new File("src/test/resources/custom-file-log-pattern.xml")); + configurator.doConfigure(new File(resourcesRoot, "custom-file-log-pattern.xml")); Appender appender = context.getLogger("ROOT").getAppender("FILE"); assertThat(appender).isInstanceOf(FileAppender.class); Encoder encoder = ((FileAppender) appender).getEncoder(); @@ -69,11 +84,17 @@ void filePatternCanBeOverridden() throws JoranException { } @Test - void defaultRollingFileNamePattern() throws JoranException { + @WithResource(name = "custom-file-log-pattern.xml", content = """ + + + + + """) + void defaultRollingFileNamePattern(@ResourcesRoot File resourcesRoot) throws JoranException { JoranConfigurator configurator = new JoranConfigurator(); LoggerContext context = new LoggerContext(); configurator.setContext(context); - configurator.doConfigure(new File("src/test/resources/custom-file-log-pattern.xml")); + configurator.doConfigure(new File(resourcesRoot, "custom-file-log-pattern.xml")); Appender appender = context.getLogger("ROOT").getAppender("FILE"); assertThat(appender).isInstanceOf(RollingFileAppender.class); RollingPolicy rollingPolicy = ((RollingFileAppender) appender).getRollingPolicy(); @@ -82,11 +103,17 @@ void defaultRollingFileNamePattern() throws JoranException { } @Test - void customRollingFileNamePattern() throws JoranException { + @WithResource(name = "custom-file-log-pattern-with-fileNamePattern.xml", content = """ + + + + + """) + void customRollingFileNamePattern(@ResourcesRoot File resourcesRoot) throws JoranException { JoranConfigurator configurator = new JoranConfigurator(); LoggerContext context = new LoggerContext(); configurator.setContext(context); - configurator.doConfigure(new File("src/test/resources/custom-file-log-pattern-with-fileNamePattern.xml")); + configurator.doConfigure(new File(resourcesRoot, "custom-file-log-pattern-with-fileNamePattern.xml")); Appender appender = context.getLogger("ROOT").getAppender("FILE"); assertThat(appender).isInstanceOf(RollingFileAppender.class); RollingPolicy rollingPolicy = ((RollingFileAppender) appender).getRollingPolicy(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java index 474fe2b37fa9..241c9613e24d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java @@ -17,6 +17,10 @@ package org.springframework.boot.logging.logback; import java.io.File; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Path; @@ -67,6 +71,7 @@ import org.springframework.boot.logging.LoggingSystemProperty; import org.springframework.boot.testsupport.classpath.ClassPathExclusions; import org.springframework.boot.testsupport.classpath.ClassPathOverrides; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.boot.testsupport.system.CapturedOutput; import org.springframework.boot.testsupport.system.OutputCaptureExtension; import org.springframework.core.convert.ConversionService; @@ -137,16 +142,18 @@ void cleanUp() { } @Test + @WithIncludeDefaultsXmlResource void logbackDefaultsConfigurationDoesNotTriggerDeprecation(CapturedOutput output) { - initialize(this.initializationContext, "classpath:logback-include-defaults.xml", null); + initialize(this.initializationContext, "classpath:include-defaults.xml", null); this.logger.info("Hello world"); assertThat(getLineWithText(output, "Hello world")).isEqualTo("[INFO] - Hello world"); assertThat(output.toString()).doesNotContain("WARN").doesNotContain("deprecated"); } @Test + @WithIncludeBaseXmlResource void logbackBaseConfigurationDoesNotTriggerDeprecation(CapturedOutput output) { - initialize(this.initializationContext, "classpath:logback-include-base.xml", null); + initialize(this.initializationContext, "classpath:include-base.xml", null); this.logger.info("Hello world"); assertThat(getLineWithText(output, "Hello world")).contains(" INFO ").endsWith(": Hello world"); assertThat(output.toString()).doesNotContain("WARN").doesNotContain("deprecated"); @@ -204,10 +211,10 @@ void defaultConfigConfiguresAConsoleAppender() { } @Test + @WithNonDefaultXmlResource void testNonDefaultConfigLocation(CapturedOutput output) { this.loggingSystem.beforeInitialize(); - initialize(this.initializationContext, "classpath:logback-nondefault.xml", - getLogFile(tmpDir() + "/tmp.log", null)); + initialize(this.initializationContext, "classpath:nondefault.xml", getLogFile(tmpDir() + "/tmp.log", null)); this.logger.info("Hello world"); assertThat(output).doesNotContain("DEBUG") .contains("Hello world") @@ -411,12 +418,13 @@ void testCleanHistoryOnStartProperty() { } @Test + @WithIncludeBaseXmlResource void testCleanHistoryOnStartPropertyWithXmlConfiguration() { this.environment.setProperty("logging.file.clean-history-on-start", "true"); LoggingInitializationContext loggingInitializationContext = new LoggingInitializationContext(this.environment); File file = new File(tmpDir(), "logback-test.log"); LogFile logFile = getLogFile(file.getPath(), null); - initialize(loggingInitializationContext, "classpath:logback-include-base.xml", logFile); + initialize(loggingInitializationContext, "classpath:include-base.xml", logFile); this.logger.info("Hello world"); assertThat(getLineWithText(file, "Hello world")).contains("INFO"); assertThat(getRollingPolicy().isCleanHistoryOnStart()).isTrue(); @@ -449,12 +457,13 @@ private void testMaxFileSizeProperty(String sizeValue, String expectedFileSize) } @Test + @WithIncludeBaseXmlResource void testMaxFileSizePropertyWithXmlConfiguration() { this.environment.setProperty("logging.file.max-size", "100MB"); LoggingInitializationContext loggingInitializationContext = new LoggingInitializationContext(this.environment); File file = new File(tmpDir(), "logback-test.log"); LogFile logFile = getLogFile(file.getPath(), null); - initialize(loggingInitializationContext, "classpath:logback-include-base.xml", logFile); + initialize(loggingInitializationContext, "classpath:include-base.xml", logFile); this.logger.info("Hello world"); assertThat(getLineWithText(file, "Hello world")).contains("INFO"); assertThat(ReflectionTestUtils.getField(getRollingPolicy(), "maxFileSize")).hasToString("100 MB"); @@ -473,12 +482,13 @@ void testMaxHistoryProperty() { } @Test + @WithIncludeBaseXmlResource void testMaxHistoryPropertyWithXmlConfiguration() { this.environment.setProperty("logging.file.max-history", "30"); LoggingInitializationContext loggingInitializationContext = new LoggingInitializationContext(this.environment); File file = new File(tmpDir(), "logback-test.log"); LogFile logFile = getLogFile(file.getPath(), null); - initialize(loggingInitializationContext, "classpath:logback-include-base.xml", logFile); + initialize(loggingInitializationContext, "classpath:include-base.xml", logFile); this.logger.info("Hello world"); assertThat(getLineWithText(file, "Hello world")).contains("INFO"); assertThat(getRollingPolicy().getMaxHistory()).isEqualTo(30); @@ -511,13 +521,14 @@ private void testTotalSizeCapProperty(String sizeValue, String expectedFileSize) } @Test + @WithIncludeBaseXmlResource void testTotalSizeCapPropertyWithXmlConfiguration() { String expectedSize = "101 MB"; this.environment.setProperty("logging.file.total-size-cap", expectedSize); LoggingInitializationContext loggingInitializationContext = new LoggingInitializationContext(this.environment); File file = new File(tmpDir(), "logback-test.log"); LogFile logFile = getLogFile(file.getPath(), null); - initialize(loggingInitializationContext, "classpath:logback-include-base.xml", logFile); + initialize(loggingInitializationContext, "classpath:include-base.xml", logFile); this.logger.info("Hello world"); assertThat(getLineWithText(file, "Hello world")).contains("INFO"); assertThat(ReflectionTestUtils.getField(getRollingPolicy(), "totalSizeCap")).hasToString(expectedSize); @@ -551,12 +562,13 @@ void customExceptionConversionWord(CapturedOutput output) { } @Test + @WithNonDefaultXmlResource void initializeShouldSetSystemProperty() { // gh-5491 this.loggingSystem.beforeInitialize(); this.logger.info("Hidden"); LogFile logFile = getLogFile(tmpDir() + "/example.log", null, false); - initialize(this.initializationContext, "classpath:logback-nondefault.xml", logFile); + initialize(this.initializationContext, "classpath:nondefault.xml", logFile); assertThat(System.getProperty(LoggingSystemProperty.LOG_FILE.getEnvironmentVariableName())) .endsWith("example.log"); } @@ -675,6 +687,21 @@ void logbackDebugPropertyIsHonored(CapturedOutput output) { } @Test + @WithResource(name = "logback-include-status-listener.xml", content = """ + + + + + + + [%p] - %m%n + + + + + + + """) void logbackSystemStatusListenerShouldBeRegisteredWhenCustomLogbackXmlHasStatusListener(CapturedOutput output) { this.loggingSystem.beforeInitialize(); initialize(this.initializationContext, "classpath:logback-include-status-listener.xml", null); @@ -737,9 +764,10 @@ void logbackSystemStatusListenerShouldBeRegisteredAndFilterStatusByLevelIfDebugD } @Test + @WithIncludeDefaultsXmlResource void logbackSystemStatusListenerShouldBeRegisteredWhenUsingCustomLogbackXml(CapturedOutput output) { this.loggingSystem.beforeInitialize(); - initialize(this.initializationContext, "classpath:logback-include-defaults.xml", null); + initialize(this.initializationContext, "classpath:include-defaults.xml", null); LoggerContext loggerContext = this.logger.getLoggerContext(); assertThat(loggerContext.getStatusManager().getCopyOfStatusListenerList()).allSatisfy((listener) -> { assertThat(listener).isInstanceOf(SystemStatusListener.class); @@ -795,9 +823,23 @@ void whenContextHasAotContributionThenProcessAheadOfTimeClearsAndReturnsIt() { } @Test // gh-33610 + @WithResource(name = "springprofile-in-root.xml", content = """ + + + + %property{LOG_FILE} [%t] ${PID:-????} %c{1}: %m%n BOOTBOOT + + + + + + + + + """) void springProfileIfNestedWithinSecondPhaseElementSanityChecker(CapturedOutput output) { this.loggingSystem.beforeInitialize(); - initialize(this.initializationContext, "classpath:logback-springprofile-in-root.xml", null); + initialize(this.initializationContext, "classpath:springprofile-in-root.xml", null); this.logger.info("Hello world"); assertThat(output).contains(" elements cannot be nested within an"); } @@ -853,9 +895,10 @@ void correlationLoggingToConsoleWhenHasCorrelationPattern(CapturedOutput output) } @Test + @WithIncludeBaseXmlResource void correlationLoggingToConsoleWhenUsingXmlConfiguration(CapturedOutput output) { this.environment.setProperty(LoggingSystem.EXPECT_CORRELATION_ID_PROPERTY, "true"); - initialize(this.initializationContext, "classpath:logback-include-base.xml", null); + initialize(this.initializationContext, "classpath:include-base.xml", null); MDC.setContextMap(Map.of("traceId", "01234567890123456789012345678901", "spanId", "0123456789012345")); this.logger.info("Hello world"); assertThat(getLineWithText(output, "Hello world")) @@ -863,11 +906,12 @@ void correlationLoggingToConsoleWhenUsingXmlConfiguration(CapturedOutput output) } @Test + @WithIncludeBaseXmlResource void correlationLoggingToFileWhenUsingFileConfiguration() { this.environment.setProperty(LoggingSystem.EXPECT_CORRELATION_ID_PROPERTY, "true"); File file = new File(tmpDir(), "logback-test.log"); LogFile logFile = getLogFile(file.getPath(), null); - initialize(this.initializationContext, "classpath:logback-include-base.xml", logFile); + initialize(this.initializationContext, "classpath:include-base.xml", logFile); MDC.setContextMap(Map.of("traceId", "01234567890123456789012345678901", "spanId", "0123456789012345")); this.logger.info("Hello world"); assertThat(getLineWithText(file, "Hello world")) @@ -931,30 +975,55 @@ void applicationNameLoggingToFileWhenDisabled() { } @Test + @WithResource(name = "broken.xml", content = """ + + + + + ${LOG_FILE} [%t] ${PID:-????} %c{1}: %m%n BOOTBOOT + + + + + + + """) void whenConfigurationErrorIsDetectedUnderlyingCausesAreIncludedAsSuppressedExceptions() { this.loggingSystem.beforeInitialize(); assertThatIllegalStateException() - .isThrownBy(() -> initialize(this.initializationContext, "classpath:logback-broken.xml", + .isThrownBy(() -> initialize(this.initializationContext, "classpath:broken.xml", getLogFile(tmpDir() + "/tmp.log", null))) .satisfies((ex) -> assertThat(ex.getSuppressed()) .hasAtLeastOneElementOfType(DynamicClassLoadingException.class)); } @Test + @WithResource(name = "invalid-format.txt", content = "Not XML") void whenConfigLocationIsNotXmlThenIllegalArgumentExceptionShouldBeThrown() { this.loggingSystem.beforeInitialize(); assertThatIllegalStateException() - .isThrownBy(() -> initialize(this.initializationContext, "classpath:logback-invalid-format.txt", + .isThrownBy(() -> initialize(this.initializationContext, "classpath:invalid-format.txt", getLogFile(tmpDir() + "/tmp.log", null))) .satisfies((ex) -> assertThat(ex.getCause()).isInstanceOf(JoranException.class) .hasMessageStartingWith("Problem parsing XML document. See previously reported errors")); } @Test + @WithResource(name = "without-extension", content = """ + + + + %msg + + + + + + + """) void whenConfigLocationIsXmlFileWithoutExtensionShouldWork(CapturedOutput output) { this.loggingSystem.beforeInitialize(); - initialize(this.initializationContext, "classpath:logback-without-extension", - getLogFile(tmpDir() + "/tmp.log", null)); + initialize(this.initializationContext, "classpath:without-extension", getLogFile(tmpDir() + "/tmp.log", null)); this.logger.info("No extension and works!"); assertThat(output.toString()).contains("No extension and works!"); } @@ -992,11 +1061,12 @@ void shouldRespectFileThreshold() { } @Test + @WithNonDefaultXmlResource void applyingSystemPropertiesDoesNotCauseUnwantedStatusWarnings(CapturedOutput output) { this.loggingSystem.beforeInitialize(); this.environment.getPropertySources() .addFirst(new MapPropertySource("test", Map.of("logging.pattern.console", "[CONSOLE]%m"))); - this.loggingSystem.initialize(this.initializationContext, "classpath:logback-nondefault.xml", null); + this.loggingSystem.initialize(this.initializationContext, "classpath:nondefault.xml", null); assertThat(output).doesNotContain("WARN"); } @@ -1072,10 +1142,11 @@ void getEnvironment() { } @Test + @WithNonDefaultXmlResource void getEnvironmentWhenUsingFile() { this.loggingSystem.beforeInitialize(); LogFile logFile = getLogFile(tmpDir() + "/example.log", null, false); - initialize(this.initializationContext, "classpath:logback-nondefault.xml", logFile); + initialize(this.initializationContext, "classpath:nondefault.xml", logFile); assertThat(this.logger.getLoggerContext().getObject(Environment.class.getName())).isSameAs(this.environment); } @@ -1112,4 +1183,52 @@ protected void append(ILoggingEvent eventObject) { } + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "include-base.xml", content = """ + + + + """) + private @interface WithIncludeBaseXmlResource { + + } + + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "nondefault.xml", content = """ + + + + %property{LOG_FILE} [%t] ${PID:-????} %c{1}: %m%n BOOTBOOT + + + + + + + """) + private @interface WithNonDefaultXmlResource { + + } + + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "include-defaults.xml", content = """ + + + + + [%p] - %m%n + + + + + + + """) + private @interface WithIncludeDefaultsXmlResource { + + } + } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/SpringBootJoranConfiguratorTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/SpringBootJoranConfiguratorTests.java index 22a6584b343f..cf8b7cbda66f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/SpringBootJoranConfiguratorTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/SpringBootJoranConfiguratorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,11 @@ package org.springframework.boot.logging.logback; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + import ch.qos.logback.classic.BasicConfigurator; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.joran.JoranConfigurator; @@ -30,6 +35,8 @@ import org.springframework.beans.factory.aot.BeanFactoryInitializationAotContribution; import org.springframework.boot.context.properties.source.ConfigurationPropertySources; import org.springframework.boot.logging.LoggingInitializationContext; +import org.springframework.boot.testsupport.classpath.ClassPathExclusions; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.boot.testsupport.system.CapturedOutput; import org.springframework.boot.testsupport.system.OutputCaptureExtension; import org.springframework.context.aot.AbstractAotProcessor; @@ -78,6 +85,7 @@ void reset() { } @Test + @WithProductionProfileXmlResource void profileActive() throws Exception { this.environment.setActiveProfiles("production"); initialize("production-profile.xml"); @@ -86,6 +94,20 @@ void profileActive() throws Exception { } @Test + @WithResource(name = "profile-in-include.xml", content = """ + + + + + + """) + @WithResource(name = "include-with-profile.xml", content = """ + + + + + + """) void profileInIncludeActive() throws Exception { this.environment.setActiveProfiles("production"); initialize("profile-in-include.xml"); @@ -94,6 +116,7 @@ void profileInIncludeActive() throws Exception { } @Test + @WithMultiProfileNamesXmlResource void multipleNamesFirstProfileActive() throws Exception { this.environment.setActiveProfiles("production"); initialize("multi-profile-names.xml"); @@ -102,6 +125,7 @@ void multipleNamesFirstProfileActive() throws Exception { } @Test + @WithMultiProfileNamesXmlResource void multipleNamesSecondProfileActive() throws Exception { this.environment.setActiveProfiles("test"); initialize("multi-profile-names.xml"); @@ -110,6 +134,7 @@ void multipleNamesSecondProfileActive() throws Exception { } @Test + @WithProductionProfileXmlResource void profileNotActive() throws Exception { initialize("production-profile.xml"); this.logger.trace("Hello"); @@ -117,6 +142,7 @@ void profileNotActive() throws Exception { } @Test + @WithProfileExpressionXmlResource void profileExpressionMatchFirst() throws Exception { this.environment.setActiveProfiles("production"); initialize("profile-expression.xml"); @@ -125,6 +151,7 @@ void profileExpressionMatchFirst() throws Exception { } @Test + @WithProfileExpressionXmlResource void profileExpressionMatchSecond() throws Exception { this.environment.setActiveProfiles("test"); initialize("profile-expression.xml"); @@ -133,6 +160,7 @@ void profileExpressionMatchSecond() throws Exception { } @Test + @WithProfileExpressionXmlResource void profileExpressionNoMatch() throws Exception { this.environment.setActiveProfiles("development"); initialize("profile-expression.xml"); @@ -141,26 +169,31 @@ void profileExpressionNoMatch() throws Exception { } @Test + @WithNestedXmlResource void profileNestedActiveActive() throws Exception { doTestNestedProfile(true, "outer", "inner"); } @Test + @WithNestedXmlResource void profileNestedActiveNotActive() throws Exception { doTestNestedProfile(false, "outer"); } @Test + @WithNestedXmlResource void profileNestedNotActiveActive() throws Exception { doTestNestedProfile(false, "inner"); } @Test + @WithNestedXmlResource void profileNestedNotActiveNotActive() throws Exception { doTestNestedProfile(false); } @Test + @WithPropertyXmlResource void springProperty() throws Exception { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "my.example-property=test"); initialize("property.xml"); @@ -168,6 +201,7 @@ void springProperty() throws Exception { } @Test + @WithPropertyXmlResource void relaxedSpringProperty() throws Exception { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "my.EXAMPLE_PROPERTY=test"); ConfigurationPropertySources.attach(this.environment); @@ -176,30 +210,35 @@ void relaxedSpringProperty() throws Exception { } @Test + @WithPropertyXmlResource void springPropertyNoValue() throws Exception { initialize("property.xml"); assertThat(this.context.getProperty("SIMPLE")).isNull(); } @Test + @WithPropertyXmlResource void relaxedSpringPropertyNoValue() throws Exception { initialize("property.xml"); assertThat(this.context.getProperty("MINE")).isNull(); } @Test + @WithPropertyDefaultValueXmlResource void springPropertyWithDefaultValue() throws Exception { initialize("property-default-value.xml"); assertThat(this.context.getProperty("SIMPLE")).isEqualTo("foo"); } @Test + @WithPropertyDefaultValueXmlResource void relaxedSpringPropertyWithDefaultValue() throws Exception { initialize("property-default-value.xml"); assertThat(this.context.getProperty("MINE")).isEqualTo("bar"); } @Test + @WithPropertyInIfXmlResource void springPropertyInIfWhenTrue() throws Exception { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "my.example-property=true"); initialize("property-in-if.xml"); @@ -207,6 +246,7 @@ void springPropertyInIfWhenTrue() throws Exception { } @Test + @WithPropertyInIfXmlResource void springPropertyInIfWhenFalse() throws Exception { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "my.example-property=false"); initialize("property-in-if.xml"); @@ -214,6 +254,19 @@ void springPropertyInIfWhenFalse() throws Exception { } @Test + @WithResource(name = "property-in-include.xml", content = """ + + + + + + """) + @WithResource(name = "include-with-property.xml", content = """ + + + + """) + @ClassPathExclusions void springPropertyInInclude() throws Exception { TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.environment, "my.example-property=test"); initialize("property-in-include.xml"); @@ -221,6 +274,7 @@ void springPropertyInInclude() throws Exception { } @Test + @WithPropertyXmlResource void addsAotContributionToContextDuringAotProcessing() throws Exception { withSystemProperty(AbstractAotProcessor.AOT_PROCESSING, "true", () -> { initialize("property.xml"); @@ -254,7 +308,8 @@ private void doTestNestedProfile(boolean expected, String... profiles) throws Jo private void initialize(String config) throws JoranException { this.configurator.setContext(this.context); - this.configurator.doConfigure(getClass().getResourceAsStream(config)); + ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); + this.configurator.doConfigure(contextClassLoader.getResource(config)); } private interface Action { @@ -263,4 +318,112 @@ private interface Action { } + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "property-default-value.xml", content = """ + + + + + + + """) + private @interface WithPropertyDefaultValueXmlResource { + + } + + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "property-in-if.xml", content = """ + + + + + + + + + + + """) + private @interface WithPropertyInIfXmlResource { + + } + + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "property.xml", content = """ + + + + + + + """) + private @interface WithPropertyXmlResource { + + } + + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "profile-expression.xml", content = """ + + + + + + + + """) + private @interface WithProfileExpressionXmlResource { + + } + + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "production-profile.xml", content = """ + + + + + + + + """) + private @interface WithProductionProfileXmlResource { + + } + + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "nested.xml", content = """ + + + + + + + + + + """) + private @interface WithNestedXmlResource { + + } + + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + @WithResource(name = "multi-profile-names.xml", content = """ + + + + + + + + """) + private @interface WithMultiProfileNamesXmlResource { + + } + } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java index 424cfc4fabf7..625c314b25b5 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,6 +53,8 @@ import org.springframework.boot.ssl.jks.JksSslStoreDetails; import org.springframework.boot.ssl.pem.PemSslStoreBundle; import org.springframework.boot.ssl.pem.PemSslStoreDetails; +import org.springframework.boot.testsupport.classpath.resources.ResourcePath; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.boot.web.server.Ssl; import org.springframework.core.codec.CharSequenceEncoder; import org.springframework.core.codec.StringDecoder; @@ -157,91 +159,107 @@ void serverCustomizers() { } @Test + @WithPackageResources("test.jks") void tcpTransportBasicSslFromClassPath() { testBasicSslWithKeyStore("classpath:test.jks", "password", Transport.TCP); } @Test - void tcpTransportBasicSslFromFileSystem() { - testBasicSslWithKeyStore("src/test/resources/test.jks", "password", Transport.TCP); + @WithPackageResources("test.jks") + void tcpTransportBasicSslFromFileSystem(@ResourcePath("test.jks") String keyStore) { + testBasicSslWithKeyStore(keyStore, "password", Transport.TCP); } @Test + @WithPackageResources("test.jks") void websocketTransportBasicSslFromClassPath() { testBasicSslWithKeyStore("classpath:test.jks", "password", Transport.WEBSOCKET); } @Test - void websocketTransportBasicSslFromFileSystem() { - testBasicSslWithKeyStore("src/test/resources/test.jks", "password", Transport.WEBSOCKET); + @WithPackageResources("test.jks") + void websocketTransportBasicSslFromFileSystem(@ResourcePath("test.jks") String keyStore) { + testBasicSslWithKeyStore(keyStore, "password", Transport.WEBSOCKET); } @Test + @WithPackageResources({ "test-cert.pem", "test-key.pem" }) void tcpTransportBasicSslCertificateFromClassPath() { testBasicSslWithPemCertificate("classpath:test-cert.pem", "classpath:test-key.pem", "classpath:test-cert.pem", Transport.TCP); } @Test - void tcpTransportBasicSslCertificateFromFileSystem() { - testBasicSslWithPemCertificate("src/test/resources/test-cert.pem", "src/test/resources/test-key.pem", - "src/test/resources/test-cert.pem", Transport.TCP); + @WithPackageResources({ "test-cert.pem", "test-key.pem" }) + void tcpTransportBasicSslCertificateFromFileSystem(@ResourcePath("test-cert.pem") String testCert, + @ResourcePath("test-key.pem") String testKey) { + testBasicSslWithPemCertificate(testCert, testKey, testCert, Transport.TCP); } @Test + @WithPackageResources({ "test-cert.pem", "test-key.pem" }) void websocketTransportBasicSslCertificateFromClassPath() { testBasicSslWithPemCertificate("classpath:test-cert.pem", "classpath:test-key.pem", "classpath:test-cert.pem", Transport.WEBSOCKET); } @Test - void websocketTransportBasicSslCertificateFromFileSystem() { - testBasicSslWithPemCertificate("src/test/resources/test-cert.pem", "src/test/resources/test-key.pem", - "src/test/resources/test-cert.pem", Transport.WEBSOCKET); + @WithPackageResources({ "test-cert.pem", "test-key.pem" }) + void websocketTransportBasicSslCertificateFromFileSystem(@ResourcePath("test-cert.pem") String testCert, + @ResourcePath("test-key.pem") String testKey) { + testBasicSslWithPemCertificate(testCert, testKey, testCert, Transport.WEBSOCKET); } @Test + @WithPackageResources("test.jks") void tcpTransportBasicSslFromClassPathWithBundle() { testBasicSslWithKeyStoreFromBundle("classpath:test.jks", "password", Transport.TCP); } @Test - void tcpTransportBasicSslFromFileSystemWithBundle() { - testBasicSslWithKeyStoreFromBundle("src/test/resources/test.jks", "password", Transport.TCP); + @WithPackageResources("test.jks") + void tcpTransportBasicSslFromFileSystemWithBundle(@ResourcePath("test.jks") String keyStore) { + testBasicSslWithKeyStoreFromBundle(keyStore, "password", Transport.TCP); } @Test + @WithPackageResources("test.jks") void websocketTransportBasicSslFromClassPathWithBundle() { testBasicSslWithKeyStoreFromBundle("classpath:test.jks", "password", Transport.WEBSOCKET); } @Test - void websocketTransportBasicSslFromFileSystemWithBundle() { - testBasicSslWithKeyStoreFromBundle("src/test/resources/test.jks", "password", Transport.WEBSOCKET); + @WithPackageResources("test.jks") + void websocketTransportBasicSslFromFileSystemWithBundle(@ResourcePath("test.jks") String keyStore) { + testBasicSslWithKeyStoreFromBundle(keyStore, "password", Transport.WEBSOCKET); } @Test + @WithPackageResources({ "test-cert.pem", "test-key.pem" }) void tcpTransportBasicSslCertificateFromClassPathWithBundle() { testBasicSslWithPemCertificateFromBundle("classpath:test-cert.pem", "classpath:test-key.pem", "classpath:test-cert.pem", Transport.TCP); } @Test - void tcpTransportBasicSslCertificateFromFileSystemWithBundle() { - testBasicSslWithPemCertificateFromBundle("src/test/resources/test-cert.pem", "src/test/resources/test-key.pem", - "src/test/resources/test-cert.pem", Transport.TCP); + @WithPackageResources({ "test-cert.pem", "test-key.pem" }) + void tcpTransportBasicSslCertificateFromFileSystemWithBundle(@ResourcePath("test-cert.pem") String testCert, + @ResourcePath("test-key.pem") String testKey) { + testBasicSslWithPemCertificateFromBundle(testCert, testKey, testCert, Transport.TCP); } @Test + @WithPackageResources({ "test-cert.pem", "test-key.pem" }) void websocketTransportBasicSslCertificateFromClassPathWithBundle() { testBasicSslWithPemCertificateFromBundle("classpath:test-cert.pem", "classpath:test-key.pem", "classpath:test-cert.pem", Transport.WEBSOCKET); } @Test - void websocketTransportBasicSslCertificateFromFileSystemWithBundle() { - testBasicSslWithPemCertificateFromBundle("src/test/resources/test-cert.pem", "src/test/resources/test-key.pem", - "src/test/resources/test-cert.pem", Transport.WEBSOCKET); + @WithPackageResources({ "test-cert.pem", "test-key.pem" }) + void websocketTransportBasicSslCertificateFromFileSystemWithBundle(@ResourcePath("test-cert.pem") String testCert, + @ResourcePath("test-key.pem") String testKey) { + testBasicSslWithPemCertificateFromBundle(testCert, testKey, testCert, Transport.WEBSOCKET); } private void checkEchoRequest() { @@ -319,7 +337,7 @@ void tcpTransportSslRejectsInsecureClient() { NettyRSocketServerFactory factory = getFactory(); factory.setTransport(Transport.TCP); Ssl ssl = new Ssl(); - ssl.setKeyStore("classpath:test.jks"); + ssl.setKeyStore("classpath:org/springframework/boot/rsocket/netty/test.jks"); ssl.setKeyPassword("password"); factory.setSsl(ssl); this.server = factory.create(new EchoRequestResponseAcceptor()); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/sql/init/AbstractScriptDatabaseInitializerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/sql/init/AbstractScriptDatabaseInitializerTests.java index 84b250e45616..efd5886d77f6 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/sql/init/AbstractScriptDatabaseInitializerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/sql/init/AbstractScriptDatabaseInitializerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,15 @@ package org.springframework.boot.sql.init; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; import java.util.Arrays; import org.junit.jupiter.api.Test; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.dao.DataAccessException; import static org.assertj.core.api.Assertions.assertThat; @@ -35,6 +40,8 @@ public abstract class AbstractScriptDatabaseInitializerTests { @Test + @WithSchemaSqlResource + @WithDataSqlResource void whenDatabaseIsInitializedThenSchemaAndDataScriptsAreApplied() { DatabaseInitializationSettings settings = new DatabaseInitializationSettings(); settings.setSchemaLocations(Arrays.asList("schema.sql")); @@ -55,6 +62,7 @@ void whenDatabaseIsInitializedWithDirectoryLocationsThenFailureIsHelpful() { } @Test + @WithDataSqlResource void whenContinueOnErrorIsFalseThenInitializationFailsOnError() { DatabaseInitializationSettings settings = new DatabaseInitializationSettings(); settings.setDataLocations(Arrays.asList("data.sql")); @@ -64,6 +72,7 @@ void whenContinueOnErrorIsFalseThenInitializationFailsOnError() { } @Test + @WithDataSqlResource void whenContinueOnErrorIsTrueThenInitializationDoesNotFailOnError() { DatabaseInitializationSettings settings = new DatabaseInitializationSettings(); settings.setContinueOnError(true); @@ -112,6 +121,8 @@ void whenNoScriptsExistAtAnOptionalDataLocationThenDatabaseIsNotAccessed() { } @Test + @WithSchemaSqlResource + @WithDataSqlResource void whenModeIsNeverThenEmbeddedDatabaseIsNotInitialized() { DatabaseInitializationSettings settings = new DatabaseInitializationSettings(); settings.setSchemaLocations(Arrays.asList("schema.sql")); @@ -123,6 +134,8 @@ void whenModeIsNeverThenEmbeddedDatabaseIsNotInitialized() { } @Test + @WithSchemaSqlResource + @WithDataSqlResource void whenModeIsNeverThenStandaloneDatabaseIsNotInitialized() { DatabaseInitializationSettings settings = new DatabaseInitializationSettings(); settings.setSchemaLocations(Arrays.asList("schema.sql")); @@ -134,6 +147,8 @@ void whenModeIsNeverThenStandaloneDatabaseIsNotInitialized() { } @Test + @WithSchemaSqlResource + @WithDataSqlResource void whenModeIsEmbeddedThenEmbeddedDatabaseIsInitialized() { DatabaseInitializationSettings settings = new DatabaseInitializationSettings(); settings.setSchemaLocations(Arrays.asList("schema.sql")); @@ -145,6 +160,8 @@ void whenModeIsEmbeddedThenEmbeddedDatabaseIsInitialized() { } @Test + @WithSchemaSqlResource + @WithDataSqlResource void whenModeIsEmbeddedThenStandaloneDatabaseIsNotInitialized() { DatabaseInitializationSettings settings = new DatabaseInitializationSettings(); settings.setSchemaLocations(Arrays.asList("schema.sql")); @@ -156,6 +173,8 @@ void whenModeIsEmbeddedThenStandaloneDatabaseIsNotInitialized() { } @Test + @WithSchemaSqlResource + @WithDataSqlResource void whenModeIsAlwaysThenEmbeddedDatabaseIsInitialized() { DatabaseInitializationSettings settings = new DatabaseInitializationSettings(); settings.setSchemaLocations(Arrays.asList("schema.sql")); @@ -167,6 +186,8 @@ void whenModeIsAlwaysThenEmbeddedDatabaseIsInitialized() { } @Test + @WithSchemaSqlResource + @WithDataSqlResource void whenModeIsAlwaysThenStandaloneDatabaseIsInitialized() { DatabaseInitializationSettings settings = new DatabaseInitializationSettings(); settings.setSchemaLocations(Arrays.asList("schema.sql")); @@ -195,4 +216,23 @@ private void assertThatDatabaseWasNotAccessed(T initializer) { protected abstract void assertDatabaseAccessed(boolean accessed, T initializer); + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.METHOD) + @WithResource(name = "schema.sql", content = """ + CREATE TABLE EXAMPLE ( + id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + name VARCHAR(30) + ); + """) + protected @interface WithSchemaSqlResource { + + } + + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.METHOD) + @WithResource(name = "data.sql", content = "INSERT INTO EXAMPLE VALUES (1, 'Andy');") + protected @interface WithDataSqlResource { + + } + } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/jks/JksSslStoreBundleTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/jks/JksSslStoreBundleTests.java index fe10414642ea..3bc2efb0bbba 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/jks/JksSslStoreBundleTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/jks/JksSslStoreBundleTests.java @@ -25,6 +25,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.io.ApplicationResourceLoader; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.boot.testsupport.ssl.MockPkcs11Security; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.Resource; @@ -77,6 +78,7 @@ void whenTypePKCS11AndLocationGetKeyStoreThrowsException() { } @Test + @WithPackageResources("test.jks") void whenHasKeyStoreLocation() { JksSslStoreDetails keyStoreDetails = JksSslStoreDetails.forLocation("classpath:test.jks") .withPassword("secret"); @@ -86,6 +88,7 @@ void whenHasKeyStoreLocation() { } @Test + @WithPackageResources("test.jks") void getTrustStoreWithLocations() { JksSslStoreDetails keyStoreDetails = null; JksSslStoreDetails trustStoreDetails = JksSslStoreDetails.forLocation("classpath:test.jks") @@ -95,6 +98,7 @@ void getTrustStoreWithLocations() { } @Test + @WithPackageResources("test.jks") void whenHasKeyStoreType() { JksSslStoreDetails keyStoreDetails = new JksSslStoreDetails("jks", null, "classpath:test.jks", "secret"); JksSslStoreDetails trustStoreDetails = null; @@ -103,6 +107,7 @@ void whenHasKeyStoreType() { } @Test + @WithPackageResources("test.jks") void whenHasTrustStoreType() { JksSslStoreDetails keyStoreDetails = null; JksSslStoreDetails trustStoreDetails = new JksSslStoreDetails("jks", null, "classpath:test.jks", "secret"); @@ -111,6 +116,7 @@ void whenHasTrustStoreType() { } @Test + @WithPackageResources("test.jks") void whenHasKeyStoreProvider() { JksSslStoreDetails keyStoreDetails = new JksSslStoreDetails(null, "com.example.KeyStoreProvider", "classpath:test.jks", "secret"); @@ -120,6 +126,7 @@ void whenHasKeyStoreProvider() { } @Test + @WithPackageResources("test.jks") void whenHasTrustStoreProvider() { JksSslStoreDetails trustStoreDetails = new JksSslStoreDetails(null, "com.example.KeyStoreProvider", "classpath:test.jks", "secret"); @@ -137,6 +144,7 @@ void storeCreationIsLazy() { } @Test + @WithPackageResources({ "test.p12", "test.jks" }) void whenLocationsAreBase64Encoded() throws IOException { JksSslStoreDetails keyStoreDetails = JksSslStoreDetails.forLocation(encodeFileContent("classpath:test.p12")) .withPassword("secret"); @@ -169,6 +177,7 @@ void invalidLocationThrowsException() { } @Test + @WithPackageResources("test.jks") void usesResourceLoader() { JksSslStoreDetails keyStoreDetails = null; JksSslStoreDetails trustStoreDetails = new JksSslStoreDetails("jks", null, "classpath:test.jks", "secret"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/LoadedPemSslStoreTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/LoadedPemSslStoreTests.java index a188092a7489..93636326dab9 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/LoadedPemSslStoreTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/LoadedPemSslStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.io.ApplicationResourceLoader; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.ResourceLoader; @@ -37,6 +38,7 @@ class LoadedPemSslStoreTests { @Test + @WithPackageResources("test-key.pem") void certificatesAreLoadedLazily() { PemSslStoreDetails details = PemSslStoreDetails.forCertificate("classpath:missing-test-cert.pem") .withPrivateKey("classpath:test-key.pem"); @@ -45,6 +47,7 @@ void certificatesAreLoadedLazily() { } @Test + @WithPackageResources("test-cert.pem") void privateKeyIsLoadedLazily() { PemSslStoreDetails details = PemSslStoreDetails.forCertificate("classpath:test-cert.pem") .withPrivateKey("classpath:missing-test-key.pem"); @@ -53,6 +56,7 @@ void privateKeyIsLoadedLazily() { } @Test + @WithPackageResources("test-key.pem") void withAliasIsLazy() { PemSslStoreDetails details = PemSslStoreDetails.forCertificate("classpath:missing-test-cert.pem") .withPrivateKey("classpath:test-key.pem"); @@ -61,6 +65,7 @@ void withAliasIsLazy() { } @Test + @WithPackageResources("test-key.pem") void withPasswordIsLazy() { PemSslStoreDetails details = PemSslStoreDetails.forCertificate("classpath:missing-test-cert.pem") .withPrivateKey("classpath:test-key.pem"); @@ -69,6 +74,7 @@ void withPasswordIsLazy() { } @Test + @WithPackageResources("test-cert.pem") void usesResourceLoader() { PemSslStoreDetails details = PemSslStoreDetails.forCertificate("classpath:test-cert.pem"); ResourceLoader resourceLoader = spy(new DefaultResourceLoader()); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemCertificateParserTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemCertificateParserTests.java index db8f71f6b744..b15136fbecba 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemCertificateParserTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemCertificateParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.core.io.ClassPathResource; import static org.assertj.core.api.Assertions.assertThat; @@ -35,6 +36,7 @@ class PemCertificateParserTests { @Test + @WithPackageResources("test-cert.pem") void parseCertificate() throws Exception { List certificates = PemCertificateParser.parse(read("test-cert.pem")); assertThat(certificates).isNotNull(); @@ -43,6 +45,7 @@ void parseCertificate() throws Exception { } @Test + @WithPackageResources("test-cert-chain.pem") void parseCertificateChain() throws Exception { List certificates = PemCertificateParser.parse(read("test-cert-chain.pem")); assertThat(certificates).isNotNull(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemContentTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemContentTests.java index f4894165dfe4..567f559d5113 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemContentTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemContentTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,8 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.io.ApplicationResourceLoader; +import org.springframework.boot.testsupport.classpath.resources.ResourcePath; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.ResourceLoader; @@ -51,6 +53,7 @@ void getCertificateWhenNoCertificatesThrowsException() { } @Test + @WithPackageResources("test-cert-chain.pem") void getCertificateReturnsCertificates() throws Exception { PemContent content = PemContent.load(contentFromClasspath("/test-cert-chain.pem"), ApplicationResourceLoader.get()); @@ -69,9 +72,9 @@ void getPrivateKeyWhenNoKeyThrowsException() { } @Test + @WithPackageResources("dsa.key") void getPrivateKeyReturnsPrivateKey() throws Exception { - PemContent content = PemContent.load(contentFromClasspath("/org/springframework/boot/web/server/pkcs8/dsa.key"), - ApplicationResourceLoader.get()); + PemContent content = PemContent.load(contentFromClasspath("dsa.key"), ApplicationResourceLoader.get()); PrivateKey privateKey = content.getPrivateKey(); assertThat(privateKey).isNotNull(); assertThat(privateKey.getFormat()).isEqualTo("PKCS#8"); @@ -186,6 +189,7 @@ void isPresentInTextWithUntrimmedContent() { } @Test + @WithPackageResources("test-cert.pem") void loadWithStringWhenClasspathLocationReturnsContent() throws IOException { String actual = PemContent.load("classpath:test-cert.pem", ApplicationResourceLoader.get()).toString(); String expected = contentFromClasspath("test-cert.pem"); @@ -193,21 +197,24 @@ void loadWithStringWhenClasspathLocationReturnsContent() throws IOException { } @Test - void loadWithStringWhenFileLocationReturnsContent() throws IOException { - String actual = PemContent.load("src/test/resources/test-cert.pem", ApplicationResourceLoader.get()).toString(); + @WithPackageResources("test-cert.pem") + void loadWithStringWhenFileLocationReturnsContent(@ResourcePath("test-cert.pem") String testCert) + throws IOException { + String actual = PemContent.load(testCert, ApplicationResourceLoader.get()).toString(); String expected = contentFromClasspath("test-cert.pem"); assertThat(actual).isEqualTo(expected); } @Test - void loadWithPathReturnsContent() throws IOException { - Path path = Path.of("src/test/resources/test-cert.pem"); - String actual = PemContent.load(path).toString(); + @WithPackageResources("test-cert.pem") + void loadWithPathReturnsContent(@ResourcePath("test-cert.pem") Path testCert) throws IOException { + String actual = PemContent.load(testCert).toString(); String expected = contentFromClasspath("test-cert.pem"); assertThat(actual).isEqualTo(expected); } @Test + @WithPackageResources("test-cert.pem") void loadWithResourceLoaderUsesResourceLoader() throws IOException { ResourceLoader resourceLoader = spy(new DefaultResourceLoader()); PemContent.load("classpath:test-cert.pem", resourceLoader); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemPrivateKeyParserTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemPrivateKeyParserTests.java index 22ceb5455b43..b337dfb28c30 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemPrivateKeyParserTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemPrivateKeyParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,36 +47,25 @@ class PemPrivateKeyParserTests { "rsa.key, RSA", "rsa-pss.key, RSASSA-PSS" }) - // @formatter:on + // @formatter:on void shouldParseTraditionalPkcs8(String file, String algorithm) throws IOException { - PrivateKey privateKey = PemPrivateKeyParser.parse(read("org/springframework/boot/web/server/pkcs8/" + file)); + PrivateKey privateKey = PemPrivateKeyParser.parse(read("pkcs8/" + file)); assertThat(privateKey).isNotNull(); assertThat(privateKey.getFormat()).isEqualTo("PKCS#8"); assertThat(privateKey.getAlgorithm()).isEqualTo(algorithm); } - @ParameterizedTest - // @formatter:off - @CsvSource({ - "rsa.key, RSA" - }) - // @formatter:on - void shouldParseTraditionalPkcs1(String file, String algorithm) throws IOException { - PrivateKey privateKey = PemPrivateKeyParser.parse(read("org/springframework/boot/web/server/pkcs1/" + file)); + @Test + void shouldParseTraditionalPkcs1() throws IOException { + PrivateKey privateKey = PemPrivateKeyParser.parse(read("pkcs1/rsa.key")); assertThat(privateKey).isNotNull(); assertThat(privateKey.getFormat()).isEqualTo("PKCS#8"); - assertThat(privateKey.getAlgorithm()).isEqualTo(algorithm); + assertThat(privateKey.getAlgorithm()).isEqualTo("RSA"); } - @ParameterizedTest - // @formatter:off - @ValueSource(strings = { - "dsa.key" - }) - // @formatter:on - void shouldNotParseUnsupportedTraditionalPkcs1(String file) { - assertThatIllegalStateException() - .isThrownBy(() -> PemPrivateKeyParser.parse(read("org/springframework/boot/web/server/pkcs1/" + file))) + @Test + void shouldNotParseUnsupportedTraditionalPkcs1() { + assertThatIllegalStateException().isThrownBy(() -> PemPrivateKeyParser.parse(read("pkcs1/dsa.key"))) .withMessageContaining("Missing private key or unrecognized format"); } @@ -94,9 +83,9 @@ void shouldNotParseUnsupportedTraditionalPkcs1(String file) { "secp384r1.key, secp384r1, 1.3.132.0.34", "secp521r1.key, secp521r1, 1.3.132.0.35" }) - // @formatter:on + // @formatter:on void shouldParseEcPkcs8(String file, String curveName, String oid) throws IOException { - PrivateKey privateKey = PemPrivateKeyParser.parse(read("org/springframework/boot/web/server/pkcs8/" + file)); + PrivateKey privateKey = PemPrivateKeyParser.parse(read("pkcs8/" + file)); assertThat(privateKey).isNotNull(); assertThat(privateKey.getFormat()).isEqualTo("PKCS#8"); assertThat(privateKey.getAlgorithm()).isEqualTo("EC"); @@ -115,8 +104,7 @@ void shouldParseEcPkcs8(String file, String curveName, String oid) throws IOExce }) // @formatter:on void shouldNotParseUnsupportedEcPkcs8(String file) { - assertThatIllegalStateException() - .isThrownBy(() -> PemPrivateKeyParser.parse(read("org/springframework/boot/web/server/pkcs8/" + file))) + assertThatIllegalStateException().isThrownBy(() -> PemPrivateKeyParser.parse(read("pkcs8/" + file))) .withMessageContaining("Missing private key or unrecognized format"); } @@ -128,7 +116,7 @@ void shouldNotParseUnsupportedEcPkcs8(String file) { }) // @formatter:on void shouldParseEdDsaPkcs8(String file) throws IOException { - PrivateKey privateKey = PemPrivateKeyParser.parse(read("org/springframework/boot/web/server/pkcs8/" + file)); + PrivateKey privateKey = PemPrivateKeyParser.parse(read("pkcs8/" + file)); assertThat(privateKey).isNotNull(); assertThat(privateKey.getFormat()).isEqualTo("PKCS#8"); assertThat(privateKey.getAlgorithm()).isEqualTo("EdDSA"); @@ -142,7 +130,7 @@ void shouldParseEdDsaPkcs8(String file) throws IOException { }) // @formatter:on void shouldParseXdhPkcs8(String file) throws IOException { - PrivateKey privateKey = PemPrivateKeyParser.parse(read("org/springframework/boot/web/server/pkcs8/" + file)); + PrivateKey privateKey = PemPrivateKeyParser.parse(read("pkcs8/" + file)); assertThat(privateKey).isNotNull(); assertThat(privateKey.getFormat()).isEqualTo("PKCS#8"); assertThat(privateKey.getAlgorithm()).isEqualTo("XDH"); @@ -164,7 +152,7 @@ void shouldParseXdhPkcs8(String file) throws IOException { }) // @formatter:on void shouldParseEcSec1(String file, String curveName, String oid) throws IOException { - PrivateKey privateKey = PemPrivateKeyParser.parse(read("org/springframework/boot/web/server/sec1/" + file)); + PrivateKey privateKey = PemPrivateKeyParser.parse(read("sec1/" + file)); assertThat(privateKey).isNotNull(); assertThat(privateKey.getFormat()).isEqualTo("PKCS#8"); assertThat(privateKey.getAlgorithm()).isEqualTo("EC"); @@ -183,14 +171,13 @@ void shouldParseEcSec1(String file, String curveName, String oid) throws IOExcep }) // @formatter:on void shouldNotParseUnsupportedEcSec1(String file) { - assertThatIllegalStateException() - .isThrownBy(() -> PemPrivateKeyParser.parse(read("org/springframework/boot/web/server/sec1/" + file))) + assertThatIllegalStateException().isThrownBy(() -> PemPrivateKeyParser.parse(read("sec1/" + file))) .withMessageContaining("Missing private key or unrecognized format"); } @Test void parseWithNonKeyTextWillThrowException() { - assertThatIllegalStateException().isThrownBy(() -> PemPrivateKeyParser.parse(read("test-banner.txt"))); + assertThatIllegalStateException().isThrownBy(() -> PemPrivateKeyParser.parse(read("file.txt"))); } @ParameterizedTest @@ -208,8 +195,7 @@ void shouldParseEncryptedPkcs8(String file, String algorithm) throws IOException // openssl pkcs8 -topk8 -in -out -v2 // -passout pass:test // where is aes128 or aes256 - PrivateKey privateKey = PemPrivateKeyParser.parse(read("org/springframework/boot/web/server/pkcs8/" + file), - "test"); + PrivateKey privateKey = PemPrivateKeyParser.parse(read("pkcs8/" + file), "test"); assertThat(privateKey).isNotNull(); assertThat(privateKey.getFormat()).isEqualTo("PKCS#8"); assertThat(privateKey.getAlgorithm()).isEqualTo(algorithm); @@ -221,8 +207,7 @@ void shouldNotParseEncryptedPkcs8NotUsingAes() { // openssl pkcs8 -topk8 -in rsa.key -out rsa-des-ede3-cbc.key -v2 des3 -passout // pass:test assertThatIllegalStateException() - .isThrownBy(() -> PemPrivateKeyParser - .parse(read("org/springframework/boot/web/server/pkcs8/rsa-des-ede3-cbc.key"), "test")) + .isThrownBy(() -> PemPrivateKeyParser.parse(read("pkcs8/rsa-des-ede3-cbc.key"), "test")) .isInstanceOf(IllegalStateException.class) .withMessageContaining("Error decrypting private key"); } @@ -233,8 +218,7 @@ void shouldNotParseEncryptedPkcs8NotUsingPbkdf2() { // openssl pkcs8 -topk8 -in rsa.key -out rsa-des-ede3-cbc.key -scrypt -passout // pass:test assertThatIllegalStateException() - .isThrownBy(() -> PemPrivateKeyParser - .parse(read("org/springframework/boot/web/server/pkcs8/rsa-scrypt.key"), "test")) + .isThrownBy(() -> PemPrivateKeyParser.parse(read("pkcs8/rsa-scrypt.key"), "test")) .withMessageContaining("Error decrypting private key"); } @@ -244,8 +228,7 @@ void shouldNotParseEncryptedSec1() { // openssl ecparam -genkey -name prime256v1 | openssl ec -aes-128-cbc -out // prime256v1-aes-128-cbc.key assertThatIllegalStateException() - .isThrownBy(() -> PemPrivateKeyParser - .parse(read("org/springframework/boot/web/server/sec1/prime256v1-aes-128-cbc.key"), "test")) + .isThrownBy(() -> PemPrivateKeyParser.parse(read("sec1/prime256v1-aes-128-cbc.key"), "test")) .withMessageContaining("Missing private key or unrecognized format"); } @@ -254,13 +237,13 @@ void shouldNotParseEncryptedPkcs1() { // created with: // openssl genrsa -aes-256-cbc -out rsa-aes-256-cbc.key assertThatIllegalStateException() - .isThrownBy(() -> PemPrivateKeyParser - .parse(read("org/springframework/boot/web/server/pkcs1/rsa-aes-256-cbc.key"), "test")) + .isThrownBy(() -> PemPrivateKeyParser.parse(read("pkcs1/rsa-aes-256-cbc.key"), "test")) .withMessageContaining("Missing private key or unrecognized format"); } private String read(String path) throws IOException { - return new ClassPathResource(path).getContentAsString(StandardCharsets.UTF_8); + return new ClassPathResource("org/springframework/boot/ssl/pem/" + path) + .getContentAsString(StandardCharsets.UTF_8); } } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemSslStoreBundleTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemSslStoreBundleTests.java index 52d7a63cdecb..10ae67f6af2c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemSslStoreBundleTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ssl/pem/PemSslStoreBundleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import org.junit.jupiter.api.Test; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.util.function.ThrowingConsumer; import static org.assertj.core.api.Assertions.assertThat; @@ -120,6 +121,7 @@ void createWithDetailsWhenStoresHaveNoValues() { } @Test + @WithPackageResources({ "test-cert.pem", "test-key.pem" }) void createWithDetailsWhenHasKeyStoreDetailsCertAndKey() { PemSslStoreDetails keyStoreDetails = PemSslStoreDetails.forCertificate("classpath:test-cert.pem") .withPrivateKey("classpath:test-key.pem"); @@ -130,9 +132,10 @@ void createWithDetailsWhenHasKeyStoreDetailsCertAndKey() { } @Test + @WithPackageResources({ "test-cert.pem", "pkcs8/key-rsa-encrypted.pem" }) void createWithDetailsWhenHasKeyStoreDetailsCertAndEncryptedKey() { PemSslStoreDetails keyStoreDetails = PemSslStoreDetails.forCertificate("classpath:test-cert.pem") - .withPrivateKey("classpath:ssl/pkcs8/key-rsa-encrypted.pem") + .withPrivateKey("classpath:pkcs8/key-rsa-encrypted.pem") .withPrivateKeyPassword("test"); PemSslStoreDetails trustStoreDetails = null; PemSslStoreBundle bundle = new PemSslStoreBundle(keyStoreDetails, trustStoreDetails); @@ -141,6 +144,7 @@ void createWithDetailsWhenHasKeyStoreDetailsCertAndEncryptedKey() { } @Test + @WithPackageResources({ "test-cert.pem", "test-key.pem" }) void createWithDetailsWhenHasKeyStoreDetailsAndTrustStoreDetailsWithoutKey() { PemSslStoreDetails keyStoreDetails = PemSslStoreDetails.forCertificate("classpath:test-cert.pem") .withPrivateKey("classpath:test-key.pem"); @@ -151,6 +155,7 @@ void createWithDetailsWhenHasKeyStoreDetailsAndTrustStoreDetailsWithoutKey() { } @Test + @WithPackageResources({ "test-cert.pem", "test-key.pem" }) void createWithDetailsWhenHasKeyStoreDetailsAndTrustStoreDetails() { PemSslStoreDetails keyStoreDetails = PemSslStoreDetails.forCertificate("classpath:test-cert.pem") .withPrivateKey("classpath:test-key.pem"); @@ -172,6 +177,7 @@ void createWithDetailsWhenHasEmbeddedKeyStoreDetailsAndTrustStoreDetails() { } @Test + @WithPackageResources({ "test-cert.pem", "test-key.pem" }) void createWithDetailsWhenHasStoreType() { PemSslStoreDetails keyStoreDetails = new PemSslStoreDetails("PKCS12", "classpath:test-cert.pem", "classpath:test-key.pem"); @@ -183,6 +189,7 @@ void createWithDetailsWhenHasStoreType() { } @Test + @WithPackageResources({ "test-cert.pem", "test-key.pem" }) void createWithDetailsWhenHasKeyStoreDetailsAndTrustStoreDetailsAndKeyPassword() { PemSslStoreDetails keyStoreDetails = PemSslStoreDetails.forCertificate("classpath:test-cert.pem") .withPrivateKey("classpath:test-key.pem") diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/AbstractClientHttpRequestFactoriesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/AbstractClientHttpRequestFactoriesTests.java index 0c913c31353a..af7e9c66f6e7 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/AbstractClientHttpRequestFactoriesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/AbstractClientHttpRequestFactoriesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +36,7 @@ import org.springframework.boot.ssl.SslBundleKey; import org.springframework.boot.ssl.jks.JksSslStoreBundle; import org.springframework.boot.ssl.jks.JksSslStoreDetails; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.boot.testsupport.web.servlet.DirtiesUrlFactories; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.server.Ssl; @@ -131,6 +132,7 @@ void shouldSetReadTimeoutsWhenUsingReflective() { @ParameterizedTest @SuppressWarnings("deprecation") @ValueSource(strings = { "GET", "POST" }) + @WithPackageResources("test.jks") void connectWithSslBundle(String httpMethod) throws Exception { TomcatServletWebServerFactory webServerFactory = new TomcatServletWebServerFactory(0); Ssl ssl = new Ssl(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java index 3bd6529897ee..681e5d8d5cf8 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,6 +62,8 @@ import org.junit.jupiter.api.Test; import org.mockito.InOrder; +import org.springframework.boot.testsupport.classpath.resources.ResourcePath; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.boot.testsupport.system.CapturedOutput; import org.springframework.boot.web.server.Compression; import org.springframework.boot.web.server.GracefulShutdownResult; @@ -230,9 +232,10 @@ void sessionTimeoutInMinutes() { } @Test - void sslCiphersConfiguration() { + @WithPackageResources("test.jks") + void sslCiphersConfiguration(@ResourcePath("test.jks") String keyStore) { Ssl ssl = new Ssl(); - ssl.setKeyStore("src/test/resources/test.jks"); + ssl.setKeyStore(keyStore); ssl.setKeyStorePassword("secret"); ssl.setKeyPassword("password"); ssl.setCiphers(new String[] { "ALPHA", "BRAVO", "CHARLIE" }); @@ -261,9 +264,10 @@ void destroyCalledWithoutStart() { } @Test - void sslEnabledMultiProtocolsConfiguration() { + @WithPackageResources("test.jks") + void sslEnabledMultiProtocolsConfiguration(@ResourcePath("test.jks") String keyStore) { JettyServletWebServerFactory factory = getFactory(); - factory.setSsl(getSslSettings("TLSv1.1", "TLSv1.2")); + factory.setSsl(getSslSettings(keyStore, "TLSv1.1", "TLSv1.2")); this.webServer = factory.getWebServer(); this.webServer.start(); JettyWebServer jettyWebServer = (JettyWebServer) this.webServer; @@ -274,9 +278,10 @@ void sslEnabledMultiProtocolsConfiguration() { } @Test - void sslEnabledProtocolsConfiguration() { + @WithPackageResources("test.jks") + void sslEnabledProtocolsConfiguration(@ResourcePath("test.jks") String keyStore) { JettyServletWebServerFactory factory = getFactory(); - factory.setSsl(getSslSettings("TLSv1.1")); + factory.setSsl(getSslSettings(keyStore, "TLSv1.1")); this.webServer = factory.getWebServer(); this.webServer.start(); JettyWebServer jettyWebServer = (JettyWebServer) this.webServer; @@ -393,9 +398,9 @@ void whenARequestCompletesAfterGracefulShutdownHasBegunThenItHasAConnectionClose assertThat(((HttpResponse) requestResult).getFirstHeader("Connection").getValue()).isEqualTo("close"); } - private Ssl getSslSettings(String... enabledProtocols) { + private Ssl getSslSettings(String keyStore, String... enabledProtocols) { Ssl ssl = new Ssl(); - ssl.setKeyStore("src/test/resources/test.jks"); + ssl.setKeyStore(keyStore); ssl.setKeyStorePassword("secret"); ssl.setKeyPassword("password"); ssl.setCiphers(new String[] { "ALPHA", "BRAVO", "CHARLIE" }); @@ -426,6 +431,7 @@ void wrappedHandlers() throws Exception { } @Test + @WithPackageResources("test.jks") void basicSslClasspathKeyStore() throws Exception { testBasicSslWithKeyStore("classpath:test.jks"); } @@ -479,12 +485,13 @@ void specificIPAddressNotReverseResolved() throws Exception { } @Test + @WithPackageResources("test.jks") void specificIPAddressWithSslIsNotReverseResolved() throws Exception { JettyServletWebServerFactory factory = getFactory(); InetAddress localhost = InetAddress.getLocalHost(); factory.setAddress(InetAddress.getByAddress(localhost.getAddress())); Ssl ssl = new Ssl(); - ssl.setKeyStore("src/test/resources/test.jks"); + ssl.setKeyStore("classpath:test.jks"); ssl.setKeyStorePassword("secret"); ssl.setKeyPassword("password"); factory.setSsl(ssl); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/SslServerCustomizerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/SslServerCustomizerTests.java index aa8ec85690ab..43f2dfb8561c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/SslServerCustomizerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/SslServerCustomizerTests.java @@ -30,6 +30,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.OS; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.boot.testsupport.junit.DisabledOnOs; import org.springframework.boot.testsupport.ssl.MockPkcs11Security; import org.springframework.boot.testsupport.ssl.MockPkcs11SecurityProvider; @@ -53,6 +54,7 @@ class SslServerCustomizerTests { @Test @SuppressWarnings("rawtypes") + @WithPackageResources("test.jks") void whenHttp2IsNotEnabledServerConnectorHasSslAndHttpConnectionFactories() { Server server = createCustomizedServer(); assertThat(server.getConnectors()).hasSize(1); @@ -63,6 +65,7 @@ void whenHttp2IsNotEnabledServerConnectorHasSslAndHttpConnectionFactories() { @Test @SuppressWarnings("rawtypes") + @WithPackageResources("test.jks") @DisabledOnOs(os = { OS.LINUX, OS.MAC }, architecture = "aarch64", disabledReason = "conscrypt doesn't support Linux/macOS aarch64, see https://github.com/google/conscrypt/issues/1051") void whenHttp2IsEnabledServerConnectorsHasSslAlpnH2AndHttpConnectionFactories() { @@ -77,6 +80,7 @@ void whenHttp2IsEnabledServerConnectorsHasSslAlpnH2AndHttpConnectionFactories() } @Test + @WithPackageResources("test.jks") @DisabledOnOs(os = { OS.LINUX, OS.MAC }, architecture = "aarch64", disabledReason = "conscrypt doesn't support Linux/macOS aarch64, see https://github.com/google/conscrypt/issues/1051") void alpnConnectionFactoryHasNullDefaultProtocolToAllowNegotiationToHttp11() { @@ -98,11 +102,12 @@ void configureSslWhenSslIsEnabledWithNoKeyStoreAndNotPkcs11ThrowsException() { } @Test + @WithPackageResources("test.jks") void configureSslWhenSslIsEnabledWithPkcs11AndKeyStoreThrowsException() { Ssl ssl = new Ssl(); ssl.setKeyStoreType("PKCS11"); ssl.setKeyStoreProvider(MockPkcs11SecurityProvider.NAME); - ssl.setKeyStore("src/test/resources/test.jks"); + ssl.setKeyStore("classpath:test.jks"); ssl.setKeyPassword("password"); assertThatIllegalStateException().isThrownBy(() -> { SslServerCustomizer customizer = new SslServerCustomizer(null, null, null, WebServerSslBundle.get(ssl)); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java index d67008187107..fdd41b0f9af7 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,7 @@ import org.springframework.boot.ssl.SslBundles; import org.springframework.boot.ssl.pem.PemSslStoreBundle; import org.springframework.boot.ssl.pem.PemSslStoreDetails; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory; import org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactoryTests; import org.springframework.boot.web.server.PortInUseException; @@ -133,12 +134,14 @@ void useForwardedHeaders() { } @Test + @WithPackageResources("test.jks") void whenSslIsConfiguredWithAValidAliasARequestSucceeds() { Mono result = testSslWithAlias("test-alias"); StepVerifier.create(result).expectNext("Hello World").expectComplete().verify(Duration.ofSeconds(30)); } @Test + @WithPackageResources({ "1.key", "1.crt", "2.key", "2.crt" }) void whenSslBundleIsUpdatedThenSslIsReloaded() { DefaultSslBundleRegistry bundles = new DefaultSslBundleRegistry("bundle1", createSslBundle("1.key", "1.crt")); Mono result = testSslWithBundle(bundles, "bundle1"); @@ -231,9 +234,7 @@ protected void addConnector(int port, AbstractReactiveWebServerFactory factory) private static SslBundle createSslBundle(String key, String certificate) { return SslBundle.of(new PemSslStoreBundle( - new PemSslStoreDetails(null, "classpath:org/springframework/boot/web/embedded/netty/" + certificate, - "classpath:org/springframework/boot/web/embedded/netty/" + key), - null)); + new PemSslStoreDetails(null, "classpath:" + certificate, "classpath:" + key), null)); } static class NoPortNettyReactiveWebServerFactory extends NettyReactiveWebServerFactory { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizerTests.java index 09444ef595c6..f8ff57396d4b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizerTests.java @@ -28,6 +28,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.boot.testsupport.ssl.MockPkcs11Security; import org.springframework.boot.testsupport.ssl.MockPkcs11SecurityProvider; import org.springframework.boot.testsupport.system.OutputCaptureExtension; @@ -71,6 +72,7 @@ void stop() throws Exception { } @Test + @WithPackageResources("test.jks") void sslCiphersConfiguration() throws Exception { Ssl ssl = new Ssl(); ssl.setKeyStore("classpath:test.jks"); @@ -85,10 +87,11 @@ void sslCiphersConfiguration() throws Exception { } @Test + @WithPackageResources("test.jks") void sslEnabledMultipleProtocolsConfiguration() throws Exception { Ssl ssl = new Ssl(); ssl.setKeyPassword("password"); - ssl.setKeyStore("src/test/resources/test.jks"); + ssl.setKeyStore("classpath:test.jks"); ssl.setEnabledProtocols(new String[] { "TLSv1.1", "TLSv1.2" }); ssl.setCiphers(new String[] { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", "BRAVO" }); Connector connector = this.tomcat.getConnector(); @@ -101,10 +104,11 @@ void sslEnabledMultipleProtocolsConfiguration() throws Exception { } @Test + @WithPackageResources("test.jks") void sslEnabledProtocolsConfiguration() throws Exception { Ssl ssl = new Ssl(); ssl.setKeyPassword("password"); - ssl.setKeyStore("src/test/resources/test.jks"); + ssl.setKeyStore("classpath:test.jks"); ssl.setEnabledProtocols(new String[] { "TLSv1.2" }); ssl.setCiphers(new String[] { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", "BRAVO" }); Connector connector = this.tomcat.getConnector(); @@ -126,11 +130,12 @@ void customizeWhenSslIsEnabledWithNoKeyStoreAndNotPkcs11ThrowsException() { } @Test + @WithPackageResources("test.jks") void customizeWhenSslIsEnabledWithPkcs11AndKeyStoreThrowsException() { Ssl ssl = new Ssl(); ssl.setKeyStoreType("PKCS11"); ssl.setKeyStoreProvider(MockPkcs11SecurityProvider.NAME); - ssl.setKeyStore("src/test/resources/test.jks"); + ssl.setKeyStore("classpath:test.jks"); ssl.setKeyPassword("password"); assertThatIllegalStateException().isThrownBy(() -> { SslConnectorCustomizer customizer = new SslConnectorCustomizer(this.logger, this.tomcat.getConnector(), diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java index 0ee1510733b0..556ffb5ccd5e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java @@ -82,6 +82,7 @@ import org.mockito.InOrder; import org.springframework.boot.ssl.DefaultSslBundleRegistry; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.boot.testsupport.system.CapturedOutput; import org.springframework.boot.web.server.PortInUseException; import org.springframework.boot.web.server.Shutdown; @@ -685,11 +686,12 @@ void shouldUpdateSslWhenReloadingSslBundles() throws Exception { } @Test + @WithPackageResources("test.jks") void sslWithHttp11Nio2Protocol() throws Exception { TomcatServletWebServerFactory factory = getFactory(); addTestTxtFile(factory); factory.setProtocol(Http11Nio2Protocol.class.getName()); - factory.setSsl(getSsl(null, "password", "src/test/resources/test.jks")); + factory.setSsl(getSsl(null, "password", "classpath:test.jks")); this.webServer = factory.getWebServer(); this.webServer.start(); HttpComponentsClientHttpRequestFactory requestFactory = createHttpComponentsRequestFactory( diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java index 3b3200574c79..28c58c3c07a4 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java @@ -48,6 +48,7 @@ import org.junit.jupiter.api.condition.JRE; import org.mockito.InOrder; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.boot.testsupport.web.servlet.ExampleServlet; import org.springframework.boot.web.server.ErrorPage; import org.springframework.boot.web.server.GracefulShutdownResult; @@ -57,6 +58,7 @@ import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory; import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactoryTests; import org.springframework.http.HttpStatus; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.test.util.ReflectionTestUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -156,6 +158,7 @@ void deploymentInfo() { } @Test + @WithPackageResources("test.jks") void basicSslClasspathKeyStore() throws Exception { testBasicSslWithKeyStore("classpath:test.jks"); } @@ -288,6 +291,7 @@ protected void addConnector(int port, AbstractServletWebServerFactory factory) { } @Test + @WithPackageResources("restricted.jks") void sslRestrictedProtocolsEmptyCipherFailure() { assertThatIOException() .isThrownBy(() -> testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1.2" }, @@ -296,6 +300,7 @@ void sslRestrictedProtocolsEmptyCipherFailure() { } @Test + @WithPackageResources("restricted.jks") void sslRestrictedProtocolsECDHETLS1Failure() { assertThatIOException() .isThrownBy(() -> testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1" }, @@ -304,12 +309,14 @@ void sslRestrictedProtocolsECDHETLS1Failure() { } @Test + @WithPackageResources("restricted.jks") void sslRestrictedProtocolsECDHESuccess() throws Exception { testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1.2" }, new String[] { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" }); } @Test + @WithPackageResources("restricted.jks") @DisabledForJreRange(min = JRE.JAVA_24) void sslRestrictedProtocolsRSATLS12Success() throws Exception { testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1.2" }, @@ -317,6 +324,7 @@ void sslRestrictedProtocolsRSATLS12Success() throws Exception { } @Test + @WithPackageResources("restricted.jks") void sslRestrictedProtocolsRSATLS11Failure() { assertThatIOException() .isThrownBy(() -> testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1.1" }, @@ -377,4 +385,14 @@ protected String startedLogMessage() { return ((UndertowServletWebServer) this.webServer).getStartLogMessage(); } + private void testRestrictedSSLProtocolsAndCipherSuites(String[] protocols, String[] ciphers) throws Exception { + AbstractServletWebServerFactory factory = getFactory(); + factory.setSsl(getSsl(null, "password", "classpath:restricted.jks", null, protocols, ciphers)); + this.webServer = factory.getWebServer(new ServletRegistrationBean<>(new ExampleServlet(true, false), "/hello")); + this.webServer.start(); + HttpComponentsClientHttpRequestFactory requestFactory = createHttpComponentsRequestFactory( + createTrustSelfSignedTlsSocketStrategy()); + assertThat(getResponse(getLocalUrl("https", "/hello"), requestFactory)).contains("scheme=https"); + } + } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewResolverTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewResolverTests.java index a64f17b00149..0868b81a33be 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewResolverTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.context.support.GenericApplicationContext; import static org.assertj.core.api.Assertions.assertThat; @@ -32,8 +33,6 @@ */ class MustacheViewResolverTests { - private final String prefix = "classpath:/" + getClass().getPackage().getName().replace(".", "/") + "/"; - private final MustacheViewResolver resolver = new MustacheViewResolver(); @BeforeEach @@ -41,7 +40,7 @@ void init() { GenericApplicationContext applicationContext = new GenericApplicationContext(); applicationContext.refresh(); this.resolver.setApplicationContext(applicationContext); - this.resolver.setPrefix(this.prefix); + this.resolver.setPrefix("classpath:"); this.resolver.setSuffix(".html"); } @@ -51,6 +50,7 @@ void resolveNonExistent() { } @Test + @WithResource(name = "template.html", content = "Hello {{World}}") void resolveExisting() { assertThat(this.resolver.resolveViewName("template", null).block(Duration.ofSeconds(30))).isNotNull(); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java index 2431bf79bc39..485f2403fca9 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/result/view/MustacheViewTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import org.junit.jupiter.api.Test; import reactor.test.StepVerifier; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.context.support.StaticApplicationContext; import org.springframework.http.MediaType; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; @@ -38,17 +39,15 @@ */ class MustacheViewTests { - private final String templateUrl = "classpath:/" + getClass().getPackage().getName().replace(".", "/") - + "/template.html"; - private final StaticApplicationContext context = new StaticApplicationContext(); @Test + @WithResource(name = "template.html", content = "Hello {{World}}") void viewResolvesHandlebars() { MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/test").build()); MustacheView view = new MustacheView(); view.setCompiler(Mustache.compiler()); - view.setUrl(this.templateUrl); + view.setUrl("classpath:template.html"); view.setCharset(StandardCharsets.UTF_8.displayName()); view.setApplicationContext(this.context); view.render(Collections.singletonMap("World", "Spring"), MediaType.TEXT_HTML, exchange) diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java index 7a0f48fd229f..96be488e3242 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package org.springframework.boot.web.reactive.server; -import java.io.FileInputStream; import java.io.InputStream; import java.net.InetSocketAddress; import java.net.ServerSocket; @@ -55,12 +54,15 @@ import reactor.netty.tcp.SslProvider.GenericSslContextSpec; import reactor.test.StepVerifier; +import org.springframework.boot.testsupport.classpath.resources.ResourcePath; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.boot.web.server.Compression; import org.springframework.boot.web.server.GracefulShutdownResult; import org.springframework.boot.web.server.Http2; import org.springframework.boot.web.server.Shutdown; import org.springframework.boot.web.server.Ssl; import org.springframework.boot.web.server.WebServer; +import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.buffer.DataBuffer; import org.springframework.core.io.buffer.DataBufferFactory; import org.springframework.core.io.buffer.DefaultDataBufferFactory; @@ -166,13 +168,15 @@ void portIsMinusOneWhenConnectionIsClosed() { } @Test + @WithPackageResources("test.jks") void basicSslFromClassPath() { testBasicSslWithKeyStore("classpath:test.jks", "password"); } @Test - void basicSslFromFileSystem() { - testBasicSslWithKeyStore("src/test/resources/test.jks", "password"); + @WithPackageResources("test.jks") + void basicSslFromFileSystem(@ResourcePath("test.jks") String keyStore) { + testBasicSslWithKeyStore(keyStore, "password"); } @@ -200,6 +204,7 @@ protected final void testBasicSslWithKeyStore(String keyStore, String keyPasswor } @Test + @WithPackageResources("test.jks") void sslWithValidAlias() { String keyStore = "classpath:test.jks"; String keyPassword = "password"; @@ -229,6 +234,7 @@ void sslWithValidAlias() { } @Test + @WithPackageResources("test.jks") void sslWithInvalidAliasFailsDuringStartup() { String keyStore = "classpath:test.jks"; String keyPassword = "password"; @@ -255,6 +261,7 @@ protected ReactorClientHttpConnector buildTrustAllSslConnector() { } @Test + @WithPackageResources("test.jks") void sslWantsClientAuthenticationSucceedsWithClientCertificate() throws Exception { Ssl ssl = new Ssl(); ssl.setClientAuth(Ssl.ClientAuth.WANT); @@ -266,6 +273,7 @@ void sslWantsClientAuthenticationSucceedsWithClientCertificate() throws Exceptio } @Test + @WithPackageResources("test.jks") void sslWantsClientAuthenticationSucceedsWithoutClientCertificate() { Ssl ssl = new Ssl(); ssl.setClientAuth(Ssl.ClientAuth.WANT); @@ -276,10 +284,10 @@ void sslWantsClientAuthenticationSucceedsWithoutClientCertificate() { testClientAuthSuccess(ssl, buildTrustAllSslConnector()); } - protected ReactorClientHttpConnector buildTrustAllSslWithClientKeyConnector(String keyStoreFile, + protected ReactorClientHttpConnector buildTrustAllSslWithClientKeyConnector(String keyStore, String keyStorePassword) throws Exception { KeyStore clientKeyStore = KeyStore.getInstance(KeyStore.getDefaultType()); - try (InputStream stream = new FileInputStream("src/test/resources/" + keyStoreFile)) { + try (InputStream stream = new ClassPathResource(keyStore).getInputStream()) { clientKeyStore.load(stream, "secret".toCharArray()); } KeyManagerFactory clientKeyManagerFactory = KeyManagerFactory @@ -313,6 +321,7 @@ protected void testClientAuthSuccess(Ssl sslConfiguration, ReactorClientHttpConn } @Test + @WithPackageResources("test.jks") void sslNeedsClientAuthenticationSucceedsWithClientCertificate() throws Exception { Ssl ssl = new Ssl(); ssl.setClientAuth(Ssl.ClientAuth.NEED); @@ -324,6 +333,7 @@ void sslNeedsClientAuthenticationSucceedsWithClientCertificate() throws Exceptio } @Test + @WithPackageResources("test.jks") void sslNeedsClientAuthenticationFailsWithoutClientCertificate() { Ssl ssl = new Ssl(); ssl.setClientAuth(Ssl.ClientAuth.NEED); @@ -335,6 +345,7 @@ void sslNeedsClientAuthenticationFailsWithoutClientCertificate() { } @Test + @WithPackageResources({ "test-cert.pem", "test-key.pem", "test.p12" }) void sslWithPemCertificates() throws Exception { Ssl ssl = new Ssl(); ssl.setClientAuth(Ssl.ClientAuth.NEED); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/WebServerSslBundleTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/WebServerSslBundleTests.java index 5ed64b09109d..d8efdb30f849 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/WebServerSslBundleTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/WebServerSslBundleTests.java @@ -22,6 +22,8 @@ import org.springframework.boot.ssl.SslBundleKey; import org.springframework.boot.ssl.SslOptions; import org.springframework.boot.ssl.SslStoreBundle; +import org.springframework.boot.testsupport.classpath.resources.ResourcePath; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.boot.testsupport.ssl.MockPkcs11Security; import org.springframework.boot.testsupport.ssl.MockPkcs11SecurityProvider; @@ -47,6 +49,7 @@ void whenSslDisabledThrowsException() { } @Test + @WithPackageResources("test.p12") void whenFromJksProperties() { Ssl ssl = new Ssl(); ssl.setKeyStore("classpath:test.p12"); @@ -77,11 +80,12 @@ void whenFromJksProperties() { } @Test - void whenFromJksPropertiesWithPkcs11StoreType() { + @WithPackageResources("test.jks") + void whenFromJksPropertiesWithPkcs11StoreType(@ResourcePath("test.jks") String keyStorePath) { Ssl ssl = new Ssl(); ssl.setKeyStoreType("PKCS11"); ssl.setKeyStoreProvider(MockPkcs11SecurityProvider.NAME); - ssl.setKeyStore("src/test/resources/test.jks"); + ssl.setKeyStore(keyStorePath); ssl.setKeyPassword("password"); ssl.setClientAuth(Ssl.ClientAuth.NONE); assertThatIllegalStateException().isThrownBy(() -> WebServerSslBundle.get(ssl)) @@ -108,6 +112,7 @@ void whenFromPkcs11Properties() { } @Test + @WithPackageResources({ "test-cert.pem", "test-key.pem", "test-cert-chain.pem" }) void whenFromPemProperties() { Ssl ssl = new Ssl(); ssl.setCertificate("classpath:test-cert.pem"); @@ -135,6 +140,7 @@ void whenFromPemProperties() { } @Test + @WithPackageResources({ "test-cert.pem", "test-key.pem", "test.p12" }) void whenPemKeyStoreAndJksTrustStoreProperties() { Ssl ssl = new Ssl(); ssl.setCertificate("classpath:test-cert.pem"); @@ -163,6 +169,7 @@ void whenPemKeyStoreAndJksTrustStoreProperties() { } @Test + @WithPackageResources({ "test.p12", "test-cert-chain.pem" }) void whenJksKeyStoreAndPemTrustStoreProperties() { Ssl ssl = new Ssl(); ssl.setKeyStore("classpath:test.p12"); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerMvcIntegrationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerMvcIntegrationTests.java index 24d04bdb3be1..ac717b24fa8b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerMvcIntegrationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerMvcIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.boot.testsupport.web.servlet.DirtiesUrlFactories; import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; @@ -86,6 +87,7 @@ void undertow() throws Exception { } @Test + @WithResource(name = "conf.properties", content = "context=/example") void advancedConfig() throws Exception { this.context = new AnnotationConfigServletWebServerApplicationContext(AdvancedConfig.class); doTest(this.context, "/example/spring/hello"); @@ -161,7 +163,7 @@ HelloWorldController helloWorldController() { @Configuration(proxyBeanMethods = false) @EnableWebMvc - @PropertySource("classpath:/org/springframework/boot/web/servlet/context/conf.properties") + @PropertySource("classpath:conf.properties") static class AdvancedConfig { private final Environment env; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java index 6bf32b920832..3ea9d8f43a69 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -124,6 +124,8 @@ import org.springframework.boot.ssl.pem.PemSslStoreDetails; import org.springframework.boot.system.ApplicationHome; import org.springframework.boot.system.ApplicationTemp; +import org.springframework.boot.testsupport.classpath.resources.ResourcePath; +import org.springframework.boot.testsupport.classpath.resources.WithPackageResources; import org.springframework.boot.testsupport.system.CapturedOutput; import org.springframework.boot.testsupport.system.OutputCaptureExtension; import org.springframework.boot.testsupport.web.servlet.DirtiesUrlFactories; @@ -429,16 +431,19 @@ void errorPageFromPutRequest() throws Exception { } @Test + @WithPackageResources("test.jks") void basicSslFromClassPath() throws Exception { testBasicSslWithKeyStore("classpath:test.jks"); } @Test - void basicSslFromFileSystem() throws Exception { - testBasicSslWithKeyStore("src/test/resources/test.jks"); + @WithPackageResources("test.jks") + void basicSslFromFileSystem(@ResourcePath("test.jks") String keyStore) throws Exception { + testBasicSslWithKeyStore(keyStore); } @Test + @WithPackageResources("test.jks") void sslDisabled() throws Exception { AbstractServletWebServerFactory factory = getFactory(); Ssl ssl = getSsl(null, "password", "classpath:test.jks"); @@ -453,9 +458,10 @@ void sslDisabled() throws Exception { } @Test + @WithPackageResources("test.jks") void sslGetScheme() throws Exception { // gh-2232 AbstractServletWebServerFactory factory = getFactory(); - factory.setSsl(getSsl(null, "password", "src/test/resources/test.jks")); + factory.setSsl(getSsl(null, "password", "classpath:test.jks")); this.webServer = factory.getWebServer(new ServletRegistrationBean<>(new ExampleServlet(true, false), "/hello")); this.webServer.start(); HttpComponentsClientHttpRequestFactory requestFactory = createHttpComponentsRequestFactory( @@ -464,9 +470,10 @@ void sslGetScheme() throws Exception { // gh-2232 } @Test + @WithPackageResources("test.jks") void sslKeyAlias() throws Exception { AbstractServletWebServerFactory factory = getFactory(); - Ssl ssl = getSsl(null, "password", "test-alias", "src/test/resources/test.jks"); + Ssl ssl = getSsl(null, "password", "test-alias", "classpath:test.jks"); factory.setSsl(ssl); ServletRegistrationBean registration = new ServletRegistrationBean<>( new ExampleServlet(true, false), "/hello"); @@ -484,9 +491,10 @@ void sslKeyAlias() throws Exception { } @Test + @WithPackageResources("test.jks") void sslWithInvalidAliasFailsDuringStartup() { AbstractServletWebServerFactory factory = getFactory(); - Ssl ssl = getSsl(null, "password", "test-alias-404", "src/test/resources/test.jks"); + Ssl ssl = getSsl(null, "password", "test-alias-404", "classpath:test.jks"); factory.setSsl(ssl); ServletRegistrationBean registration = new ServletRegistrationBean<>( new ExampleServlet(true, false), "/hello"); @@ -500,9 +508,10 @@ protected void assertThatSslWithInvalidAliasCallFails(ThrowingCallable call) { } @Test + @WithPackageResources("test.jks") void serverHeaderIsDisabledByDefaultWhenUsingSsl() throws Exception { AbstractServletWebServerFactory factory = getFactory(); - factory.setSsl(getSsl(null, "password", "src/test/resources/test.jks")); + factory.setSsl(getSsl(null, "password", "classpath:test.jks")); this.webServer = factory.getWebServer(new ServletRegistrationBean<>(new ExampleServlet(true, false), "/hello")); this.webServer.start(); PoolingHttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder.create() @@ -515,10 +524,11 @@ void serverHeaderIsDisabledByDefaultWhenUsingSsl() throws Exception { } @Test + @WithPackageResources("test.jks") void serverHeaderCanBeCustomizedWhenUsingSsl() throws Exception { AbstractServletWebServerFactory factory = getFactory(); factory.setServerHeader("MyServer"); - factory.setSsl(getSsl(null, "password", "src/test/resources/test.jks")); + factory.setSsl(getSsl(null, "password", "classpath:test.jks")); this.webServer = factory.getWebServer(new ServletRegistrationBean<>(new ExampleServlet(true, false), "/hello")); this.webServer.start(); PoolingHttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder.create() @@ -542,14 +552,15 @@ protected final void testBasicSslWithKeyStore(String keyStore) throws Exception } @Test - void pkcs12KeyStoreAndTrustStore() throws Exception { + @WithPackageResources("test.p12") + void pkcs12KeyStoreAndTrustStore(@ResourcePath("test.p12") File keyStoreFile) throws Exception { AbstractServletWebServerFactory factory = getFactory(); addTestTxtFile(factory); factory.setSsl(getSsl(ClientAuth.NEED, null, "classpath:test.p12", "classpath:test.p12", null, null)); this.webServer = factory.getWebServer(); this.webServer.start(); KeyStore keyStore = KeyStore.getInstance("pkcs12"); - loadStore(keyStore, new FileSystemResource("src/test/resources/test.p12")); + loadStore(keyStore, new FileSystemResource(keyStoreFile)); SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustSelfSignedStrategy()) .loadKeyMaterial(keyStore, "secret".toCharArray()) .build(); @@ -559,14 +570,15 @@ void pkcs12KeyStoreAndTrustStore() throws Exception { } @Test - void pemKeyStoreAndTrustStore() throws Exception { + @WithPackageResources({ "test.p12", "test-cert.pem", "test-key.pem" }) + void pemKeyStoreAndTrustStore(@ResourcePath("test.p12") File keyStoreFile) throws Exception { AbstractServletWebServerFactory factory = getFactory(); addTestTxtFile(factory); factory.setSsl(getSsl("classpath:test-cert.pem", "classpath:test-key.pem")); this.webServer = factory.getWebServer(); this.webServer.start(); KeyStore keyStore = KeyStore.getInstance("pkcs12"); - loadStore(keyStore, new FileSystemResource("src/test/resources/test.p12")); + loadStore(keyStore, new FileSystemResource(keyStoreFile)); SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustSelfSignedStrategy()) .loadKeyMaterial(keyStore, "secret".toCharArray()) .build(); @@ -576,7 +588,8 @@ void pemKeyStoreAndTrustStore() throws Exception { } @Test - void pkcs12KeyStoreAndTrustStoreFromBundle() throws Exception { + @WithPackageResources("test.p12") + void pkcs12KeyStoreAndTrustStoreFromBundle(@ResourcePath("test.p12") File keyStoreFile) throws Exception { AbstractServletWebServerFactory factory = getFactory(); addTestTxtFile(factory); factory.setSsl(Ssl.forBundle("test")); @@ -585,7 +598,7 @@ void pkcs12KeyStoreAndTrustStoreFromBundle() throws Exception { this.webServer = factory.getWebServer(); this.webServer.start(); KeyStore keyStore = KeyStore.getInstance("pkcs12"); - loadStore(keyStore, new FileSystemResource("src/test/resources/test.p12")); + loadStore(keyStore, new FileSystemResource(keyStoreFile)); SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustSelfSignedStrategy()) .loadKeyMaterial(keyStore, "secret".toCharArray()) .build(); @@ -595,7 +608,8 @@ void pkcs12KeyStoreAndTrustStoreFromBundle() throws Exception { } @Test - void pemKeyStoreAndTrustStoreFromBundle() throws Exception { + @WithPackageResources({ "test.p12", "test-cert.pem", "test-key.pem" }) + void pemKeyStoreAndTrustStoreFromBundle(@ResourcePath("test.p12") File keyStoreFile) throws Exception { AbstractServletWebServerFactory factory = getFactory(); addTestTxtFile(factory); factory.setSsl(Ssl.forBundle("test")); @@ -604,7 +618,7 @@ void pemKeyStoreAndTrustStoreFromBundle() throws Exception { this.webServer = factory.getWebServer(); this.webServer.start(); KeyStore keyStore = KeyStore.getInstance("pkcs12"); - loadStore(keyStore, new FileSystemResource("src/test/resources/test.p12")); + loadStore(keyStore, new FileSystemResource(keyStoreFile)); SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustSelfSignedStrategy()) .loadKeyMaterial(keyStore, "secret".toCharArray()) .build(); @@ -614,7 +628,9 @@ void pemKeyStoreAndTrustStoreFromBundle() throws Exception { } @Test - void sslNeedsClientAuthenticationSucceedsWithClientCertificate() throws Exception { + @WithPackageResources("test.jks") + void sslNeedsClientAuthenticationSucceedsWithClientCertificate(@ResourcePath("test.jks") File keyStoreFile) + throws Exception { AbstractServletWebServerFactory factory = getFactory(); factory.setRegisterDefaultServlet(true); addTestTxtFile(factory); @@ -622,7 +638,7 @@ void sslNeedsClientAuthenticationSucceedsWithClientCertificate() throws Exceptio this.webServer = factory.getWebServer(); this.webServer.start(); KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); - loadStore(keyStore, new FileSystemResource("src/test/resources/test.jks")); + loadStore(keyStore, new FileSystemResource(keyStoreFile)); SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustSelfSignedStrategy()) .loadKeyMaterial(keyStore, "password".toCharArray()) .build(); @@ -632,6 +648,7 @@ void sslNeedsClientAuthenticationSucceedsWithClientCertificate() throws Exceptio } @Test + @WithPackageResources("test.jks") void sslNeedsClientAuthenticationFailsWithoutClientCertificate() throws Exception { AbstractServletWebServerFactory factory = getFactory(); addTestTxtFile(factory); @@ -645,7 +662,9 @@ void sslNeedsClientAuthenticationFailsWithoutClientCertificate() throws Exceptio } @Test - void sslWantsClientAuthenticationSucceedsWithClientCertificate() throws Exception { + @WithPackageResources("test.jks") + void sslWantsClientAuthenticationSucceedsWithClientCertificate(@ResourcePath("test.jks") File keyStoreFile) + throws Exception { AbstractServletWebServerFactory factory = getFactory(); addTestTxtFile(factory); factory @@ -653,7 +672,7 @@ void sslWantsClientAuthenticationSucceedsWithClientCertificate() throws Exceptio this.webServer = factory.getWebServer(); this.webServer.start(); KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); - loadStore(keyStore, new FileSystemResource("src/test/resources/test.jks")); + loadStore(keyStore, new FileSystemResource(keyStoreFile)); SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustSelfSignedStrategy()) .loadKeyMaterial(keyStore, "password".toCharArray()) .build(); @@ -663,6 +682,7 @@ void sslWantsClientAuthenticationSucceedsWithClientCertificate() throws Exceptio } @Test + @WithPackageResources("test.jks") void sslWantsClientAuthenticationSucceedsWithoutClientCertificate() throws Exception { AbstractServletWebServerFactory factory = getFactory(); addTestTxtFile(factory); @@ -700,7 +720,7 @@ protected Ssl getSsl(ClientAuth clientAuth, String keyPassword, String keyAlias, return getSsl(clientAuth, keyPassword, keyAlias, keyStore, null, null, null); } - private Ssl getSsl(ClientAuth clientAuth, String keyPassword, String keyStore, String trustStore, + protected Ssl getSsl(ClientAuth clientAuth, String keyPassword, String keyStore, String trustStore, String[] supportedProtocols, String[] ciphers) { return getSsl(clientAuth, keyPassword, null, keyStore, trustStore, supportedProtocols, ciphers); } @@ -761,16 +781,6 @@ protected SslBundle createPemSslBundle(String cert, String privateKey) { return SslBundle.of(stores); } - protected void testRestrictedSSLProtocolsAndCipherSuites(String[] protocols, String[] ciphers) throws Exception { - AbstractServletWebServerFactory factory = getFactory(); - factory.setSsl(getSsl(null, "password", "src/test/resources/restricted.jks", null, protocols, ciphers)); - this.webServer = factory.getWebServer(new ServletRegistrationBean<>(new ExampleServlet(true, false), "/hello")); - this.webServer.start(); - HttpComponentsClientHttpRequestFactory requestFactory = createHttpComponentsRequestFactory( - createTrustSelfSignedTlsSocketStrategy()); - assertThat(getResponse(getLocalUrl("https", "/hello"), requestFactory)).contains("scheme=https"); - } - protected HttpComponentsClientHttpRequestFactory createHttpComponentsRequestFactory( TlsSocketStrategy tlsSocketStrategy) { PoolingHttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder.create() @@ -944,7 +954,7 @@ protected void sslSessionTracking() { AbstractServletWebServerFactory factory = getFactory(); Ssl ssl = new Ssl(); ssl.setEnabled(true); - ssl.setKeyStore("src/test/resources/test.jks"); + ssl.setKeyStore("src/test/resources/org/springframework/boot/web/server/test.jks"); ssl.setKeyPassword("password"); factory.setSsl(ssl); factory.getSession().setTrackingModes(EnumSet.of(SessionTrackingMode.SSL)); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewResolverTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewResolverTests.java index ba3e9c8d40ff..050de81ad363 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewResolverTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.context.support.GenericApplicationContext; import org.springframework.mock.web.MockServletContext; import org.springframework.web.servlet.View; @@ -33,8 +34,6 @@ */ class MustacheViewResolverTests { - private final String prefix = "classpath:/" + getClass().getPackage().getName().replace(".", "/") + "/"; - private final MustacheViewResolver resolver = new MustacheViewResolver(); @BeforeEach @@ -43,7 +42,7 @@ void init() { applicationContext.refresh(); this.resolver.setApplicationContext(applicationContext); this.resolver.setServletContext(new MockServletContext()); - this.resolver.setPrefix(this.prefix); + this.resolver.setPrefix("classpath:"); this.resolver.setSuffix(".html"); } @@ -53,11 +52,13 @@ void resolveNonExistent() throws Exception { } @Test + @WithResource(name = "template.html", content = "Hello {{World}}") void resolveExisting() throws Exception { assertThat(this.resolver.resolveViewName("template", null)).isNotNull(); } @Test + @WithResource(name = "template.html", content = "Hello {{World}}") void setsContentType() throws Exception { this.resolver.setContentType("application/octet-stream"); View view = this.resolver.resolveViewName("template", null); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewTests.java index ee266a60f84c..e5acdd254a5c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/view/MustacheViewTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebApplicationContext; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; @@ -37,9 +38,6 @@ */ class MustacheViewTests { - private final String templateUrl = "classpath:/" + getClass().getPackage().getName().replace(".", "/") - + "/template.html"; - private final MockHttpServletRequest request = new MockHttpServletRequest(); private final MockHttpServletResponse response = new MockHttpServletResponse(); @@ -55,10 +53,11 @@ void init() { } @Test + @WithResource(name = "template.html", content = "Hello {{World}}") void viewResolvesHandlebars() throws Exception { MustacheView view = new MustacheView(); view.setCompiler(Mustache.compiler()); - view.setUrl(this.templateUrl); + view.setUrl("classpath:template.html"); view.setApplicationContext(this.context); view.render(Collections.singletonMap("World", "Spring"), this.request, this.response); assertThat(this.response.getContentAsString().trim()).isEqualTo("Hello Spring"); diff --git a/spring-boot-project/spring-boot/src/test/resources/META-INF/spring-test-protocol-resolvers.factories b/spring-boot-project/spring-boot/src/test/resources/META-INF/spring-test-protocol-resolvers.factories deleted file mode 100644 index 79239c637bff..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/META-INF/spring-test-protocol-resolvers.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.core.io.ProtocolResolver=\ -org.springframework.boot.io.ReverseStringProtocolResolver \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/META-INF/spring.factories b/spring-boot-project/spring-boot/src/test/resources/META-INF/spring.factories deleted file mode 100644 index 0ab92a3d7b83..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/META-INF/spring.factories +++ /dev/null @@ -1,13 +0,0 @@ -org.springframework.boot.env.PropertySourceLoader=\ -org.springframework.boot.context.config.TestPropertySourceLoader1,\ -org.springframework.boot.context.config.TestPropertySourceLoader2 - -org.springframework.boot.context.config.ConfigDataLocationResolver=\ -org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessorIntegrationTests.LocationResolver,\ -org.springframework.boot.context.config.TestConfigDataBootstrap.LocationResolver,\ -org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegrationTests.LocationResolver - -org.springframework.boot.context.config.ConfigDataLoader=\ -org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessorIntegrationTests.Loader,\ -org.springframework.boot.context.config.TestConfigDataBootstrap.Loader,\ -org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegrationTests.Loader diff --git a/spring-boot-project/spring-boot/src/test/resources/META-INF/spring/org.springframework.boot.context.annotation.ImportCandidatesTests$TestAnnotation.imports b/spring-boot-project/spring-boot/src/test/resources/META-INF/spring/org.springframework.boot.context.annotation.ImportCandidatesTests$TestAnnotation.imports deleted file mode 100644 index 8274f7c72c5c..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/META-INF/spring/org.springframework.boot.context.annotation.ImportCandidatesTests$TestAnnotation.imports +++ /dev/null @@ -1,6 +0,0 @@ -# A comment spanning a complete line -class1 - -class2 # with comment at the end - # Comment with some whitespace in front -class3 diff --git a/spring-boot-project/spring-boot/src/test/resources/a-file b/spring-boot-project/spring-boot/src/test/resources/a-file deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/spring-boot-project/spring-boot/src/test/resources/ansi.properties b/spring-boot-project/spring-boot/src/test/resources/ansi.properties deleted file mode 100644 index d99e75a60b97..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/ansi.properties +++ /dev/null @@ -1 +0,0 @@ -spring.output.ansi.enabled=never diff --git a/spring-boot-project/spring-boot/src/test/resources/application-activate-on-profile-in-profile-specific-file-test.properties b/spring-boot-project/spring-boot/src/test/resources/application-activate-on-profile-in-profile-specific-file-test.properties deleted file mode 100644 index 36e382cb6cdf..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-activate-on-profile-in-profile-specific-file-test.properties +++ /dev/null @@ -1,4 +0,0 @@ -test1=test1 -#--- -spring.config.activate.on-profile=other -test2=test2 diff --git a/spring-boot-project/spring-boot/src/test/resources/application-activate-on-profile-in-profile-specific-file.properties b/spring-boot-project/spring-boot/src/test/resources/application-activate-on-profile-in-profile-specific-file.properties deleted file mode 100644 index d7ec8875c8cd..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-activate-on-profile-in-profile-specific-file.properties +++ /dev/null @@ -1 +0,0 @@ -spring.profiles.active=test,other diff --git a/spring-boot-project/spring-boot/src/test/resources/application-bootstrap-registry-integration-tests.properties b/spring-boot-project/spring-boot/src/test/resources/application-bootstrap-registry-integration-tests.properties deleted file mode 100644 index 6fe0d5673ad2..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-bootstrap-registry-integration-tests.properties +++ /dev/null @@ -1,6 +0,0 @@ -spring.config.import=testbootstrap:test -spring.profiles.active=test -myprop=igotbound -#--- -spring.config.activate.on-profile=test -myprofileprop=igotprofilebound diff --git a/spring-boot-project/spring-boot/src/test/resources/application-customdefault.properties b/spring-boot-project/spring-boot/src/test/resources/application-customdefault.properties deleted file mode 100644 index 899e25633bb5..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-customdefault.properties +++ /dev/null @@ -1 +0,0 @@ -customdefault=true diff --git a/spring-boot-project/spring-boot/src/test/resources/application-dev.properties b/spring-boot-project/spring-boot/src/test/resources/application-dev.properties deleted file mode 100644 index 14634a49e75e..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-dev.properties +++ /dev/null @@ -1 +0,0 @@ -my.property=fromdevpropertiesfile diff --git a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-imported.properties b/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-imported.properties deleted file mode 100644 index e80c76a43997..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-imported.properties +++ /dev/null @@ -1 +0,0 @@ -my.value=iwasimported \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-document.properties b/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-document.properties deleted file mode 100644 index 556143a77205..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-document.properties +++ /dev/null @@ -1,3 +0,0 @@ -my.import=application-import-with-placeholder-imported -#--- -spring.config.import=classpath:${my.import}.properties diff --git a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-earlier-document-imported.properties b/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-earlier-document-imported.properties deleted file mode 100644 index 3864e4a45335..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-earlier-document-imported.properties +++ /dev/null @@ -1 +0,0 @@ -my.value=application-import-with-placeholder-in-earlier-document-imported diff --git a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-earlier-document.properties b/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-earlier-document.properties deleted file mode 100644 index feee42ed7202..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-earlier-document.properties +++ /dev/null @@ -1,6 +0,0 @@ -my.import=application-import-with-placeholder-in-earlier-document-imported -#--- -my.value=should-be-ignored -spring.config.activate.on-profile=missing -#--- -spring.config.import=classpath:${my.import}.properties diff --git a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-earlier-profile-document-imported.properties b/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-earlier-profile-document-imported.properties deleted file mode 100644 index 96b8574a861b..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-earlier-profile-document-imported.properties +++ /dev/null @@ -1 +0,0 @@ -my.value=application-import-with-placeholder-in-earlier-profile-document-imported diff --git a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-earlier-profile-document.properties b/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-earlier-profile-document.properties deleted file mode 100644 index ced93c8d9f7e..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-earlier-profile-document.properties +++ /dev/null @@ -1,6 +0,0 @@ -my.value=application-import-with-placeholder-in-earlier-profile-document -#--- -my.import=application-import-with-placeholder-in-earlier-profile-document-imported -spring.config.activate.on-profile=missing -#--- -spring.config.import=classpath:${my.import}.properties diff --git a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-profile-document.properties b/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-profile-document.properties deleted file mode 100644 index 890f961e5f16..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder-in-profile-document.properties +++ /dev/null @@ -1,6 +0,0 @@ -my.import=application-import-with-placeholder-imported -#--- -spring.config.import=classpath:${my.import}.properties -#--- -my.import=badbadbad -spring.config.activate.on-profile=missing \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder.properties b/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder.properties deleted file mode 100644 index de35cff62404..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-import-with-placeholder.properties +++ /dev/null @@ -1,2 +0,0 @@ -my.import=application-import-with-placeholder-imported -spring.config.import=classpath:${my.import}.properties \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-and-direct-profile-import-dev.properties b/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-and-direct-profile-import-dev.properties deleted file mode 100644 index 0ee51673facf..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-and-direct-profile-import-dev.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.config.import=classpath:application-import-with-profile-variant-imported-dev.properties -my.value=application-import-with-profile-variant-and-direct-profile-import-dev diff --git a/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-and-direct-profile-import.properties b/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-and-direct-profile-import.properties deleted file mode 100644 index 3bde4a37706a..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-and-direct-profile-import.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.config.import=classpath:application-import-with-profile-variant-imported.properties -my.value=application-import-with-profile-variant-and-direct-profile-import diff --git a/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-dev.properties b/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-dev.properties deleted file mode 100644 index 2fab0529571c..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-dev.properties +++ /dev/null @@ -1 +0,0 @@ -my.value=application-import-with-profile-variant-dev diff --git a/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-imported-dev.properties b/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-imported-dev.properties deleted file mode 100644 index 358d119e620a..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-imported-dev.properties +++ /dev/null @@ -1 +0,0 @@ -my.value=application-import-with-profile-variant-imported-dev diff --git a/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-imported.properties b/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-imported.properties deleted file mode 100644 index 7627d37b4b5e..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant-imported.properties +++ /dev/null @@ -1 +0,0 @@ -my.value=application-import-with-profile-variant-imported diff --git a/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant.properties b/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant.properties deleted file mode 100644 index d2354c3974ed..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-import-with-profile-variant.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.config.import=classpath:application-import-with-profile-variant-imported.properties -my.value=application-import-with-profile-variant diff --git a/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-in-profile-specific-document.properties b/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-in-profile-specific-document.properties deleted file mode 100644 index 646513a9ce6f..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-in-profile-specific-document.properties +++ /dev/null @@ -1,6 +0,0 @@ -spring.profiles.active=p1 -spring.profiles.include=p2 -#--- -spring.config.activate.on-profile=p2 -spring.profiles.include=p3 - diff --git a/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-in-profile-specific-file-test.properties b/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-in-profile-specific-file-test.properties deleted file mode 100644 index 70251f9e7f05..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-in-profile-specific-file-test.properties +++ /dev/null @@ -1 +0,0 @@ -spring.profiles.include=p2 diff --git a/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-in-profile-specific-file.properties b/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-in-profile-specific-file.properties deleted file mode 100644 index f841722a2f15..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-in-profile-specific-file.properties +++ /dev/null @@ -1 +0,0 @@ -spring.profiles.active=test diff --git a/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-list-in-profile-specific-file-test.yml b/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-list-in-profile-specific-file-test.yml deleted file mode 100644 index b6f2fc555807..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-list-in-profile-specific-file-test.yml +++ /dev/null @@ -1,4 +0,0 @@ -spring: - profiles: - include: - - p diff --git a/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-with-placeholder.properties b/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-with-placeholder.properties deleted file mode 100644 index e1baa5d408a4..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-include-profiles-with-placeholder.properties +++ /dev/null @@ -1,9 +0,0 @@ -spring.profiles.active=p1 -spring.profiles.include=p2 -#--- -myprofile=p4 -spring.profiles.include=p3,${myprofile} -#--- -myotherprofile=p5 -spring.profiles.include=${myotherprofile} - diff --git a/spring-boot-project/spring-boot/src/test/resources/application-include-profiles.properties b/spring-boot-project/spring-boot/src/test/resources/application-include-profiles.properties deleted file mode 100644 index c20ed9ad301e..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-include-profiles.properties +++ /dev/null @@ -1,7 +0,0 @@ -spring.profiles.active=p1 -spring.profiles.include=p2 -#--- -spring.profiles.include=p3,p4 -#--- -spring.profiles.include=p5 - diff --git a/spring-boot-project/spring-boot/src/test/resources/application-includeprofile.properties b/spring-boot-project/spring-boot/src/test/resources/application-includeprofile.properties deleted file mode 100644 index 213a72823c17..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-includeprofile.properties +++ /dev/null @@ -1 +0,0 @@ -spring.profiles.include=specific diff --git a/spring-boot-project/spring-boot/src/test/resources/application-node.properties b/spring-boot-project/spring-boot/src/test/resources/application-node.properties deleted file mode 100644 index 292bb08658cb..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-node.properties +++ /dev/null @@ -1 +0,0 @@ -bar: spam diff --git a/spring-boot-project/spring-boot/src/test/resources/application-other.properties b/spring-boot-project/spring-boot/src/test/resources/application-other.properties deleted file mode 100644 index 34cfee2a78b7..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-other.properties +++ /dev/null @@ -1 +0,0 @@ -my.property=fromotherpropertiesfile diff --git a/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-custom-import-p1.properties b/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-custom-import-p1.properties deleted file mode 100644 index 0457702de8db..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-custom-import-p1.properties +++ /dev/null @@ -1 +0,0 @@ -spring.config.import:test:boot \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-custom-import.properties b/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-custom-import.properties deleted file mode 100644 index 692617a8946d..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-custom-import.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.profiles.active=p1,p2 - diff --git a/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import-import-p1.properties b/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import-import-p1.properties deleted file mode 100644 index c9ad018fd9f4..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import-import-p1.properties +++ /dev/null @@ -1 +0,0 @@ -application-profile-specific-import-with-import-import-p1=true diff --git a/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import-import-p2.properties b/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import-import-p2.properties deleted file mode 100644 index e72f2f191d51..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import-import-p2.properties +++ /dev/null @@ -1 +0,0 @@ -application-profile-specific-import-with-import-import-p2=true diff --git a/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import-import.properties b/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import-import.properties deleted file mode 100644 index e92241ad1edd..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import-import.properties +++ /dev/null @@ -1 +0,0 @@ -application-profile-specific-import-with-import-import=true diff --git a/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import-p1.properties b/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import-p1.properties deleted file mode 100644 index 836dcc3f5eee..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import-p1.properties +++ /dev/null @@ -1,2 +0,0 @@ -application-profile-specific-import-with-import-p1=true -spring.config.import=application-profile-specific-import-with-import-import.properties diff --git a/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import.properties b/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import.properties deleted file mode 100644 index 4b94ad9212ab..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-profile-specific-import-with-import.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.profiles.active=p1,p2 -application-profile-specific-import-with-import=true diff --git a/spring-boot-project/spring-boot/src/test/resources/application-props-no-extension b/spring-boot-project/spring-boot/src/test/resources/application-props-no-extension deleted file mode 100644 index b3efe414930f..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-props-no-extension +++ /dev/null @@ -1 +0,0 @@ -withnotext=test \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/application-withwebapplicationtype.yml b/spring-boot-project/spring-boot/src/test/resources/application-withwebapplicationtype.yml deleted file mode 100644 index 1556b9eca165..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application-withwebapplicationtype.yml +++ /dev/null @@ -1 +0,0 @@ -spring.main.web-application-type: reactive diff --git a/spring-boot-project/spring-boot/src/test/resources/application.custom b/spring-boot-project/spring-boot/src/test/resources/application.custom deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/spring-boot-project/spring-boot/src/test/resources/application.properties b/spring-boot-project/spring-boot/src/test/resources/application.properties deleted file mode 100644 index 2325ace12061..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application.properties +++ /dev/null @@ -1,6 +0,0 @@ -foo: bucket -value: 1234 -my.property: fromapplicationproperties -sample.app.test.prop: * -my.placeholder: ${my.fallback} -duplicate=properties diff --git a/spring-boot-project/spring-boot/src/test/resources/application.yml b/spring-boot-project/spring-boot/src/test/resources/application.yml deleted file mode 100644 index 74fe76ca7cea..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/application.yml +++ /dev/null @@ -1 +0,0 @@ -duplicate: yaml \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/banner-utf8.txt b/spring-boot-project/spring-boot/src/test/resources/banner-utf8.txt deleted file mode 100644 index f3077be2fc5e..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/banner-utf8.txt +++ /dev/null @@ -1 +0,0 @@ -😍 Spring Boot! 😍 diff --git a/spring-boot-project/spring-boot/src/test/resources/bindtoapplication.properties b/spring-boot-project/spring-boot/src/test/resources/bindtoapplication.properties deleted file mode 100644 index 33406d213f83..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/bindtoapplication.properties +++ /dev/null @@ -1 +0,0 @@ -spring.main.banner-mode=off diff --git a/spring-boot-project/spring-boot/src/test/resources/config/..hidden/testproperties.properties b/spring-boot-project/spring-boot/src/test/resources/config/..hidden/testproperties.properties deleted file mode 100644 index 1537a17cf26f..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/config/..hidden/testproperties.properties +++ /dev/null @@ -1 +0,0 @@ -fourth.property=shouldbehidden \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/config/0-empty/testproperties.properties b/spring-boot-project/spring-boot/src/test/resources/config/0-empty/testproperties.properties deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/spring-boot-project/spring-boot/src/test/resources/config/1-first/testproperties.properties b/spring-boot-project/spring-boot/src/test/resources/config/1-first/testproperties.properties deleted file mode 100644 index 1c97e4c41267..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/config/1-first/testproperties.properties +++ /dev/null @@ -1 +0,0 @@ -first.property=apple \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/config/2-second/testproperties.properties b/spring-boot-project/spring-boot/src/test/resources/config/2-second/testproperties.properties deleted file mode 100644 index a568eac54e05..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/config/2-second/testproperties.properties +++ /dev/null @@ -1 +0,0 @@ -second.property=ball \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/config/file-in-root-and-config-with-profile-p1.properties b/spring-boot-project/spring-boot/src/test/resources/config/file-in-root-and-config-with-profile-p1.properties deleted file mode 100644 index ffbd719314e1..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/config/file-in-root-and-config-with-profile-p1.properties +++ /dev/null @@ -1,3 +0,0 @@ -config-file-in-root-and-config-with-profile-p1=true -v1=config-file-in-root-and-config-with-profile-p1 -#v2 intentionally missing \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/config/file-in-root-and-config-with-profile-p2.properties b/spring-boot-project/spring-boot/src/test/resources/config/file-in-root-and-config-with-profile-p2.properties deleted file mode 100644 index 5ead8d0cd908..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/config/file-in-root-and-config-with-profile-p2.properties +++ /dev/null @@ -1,3 +0,0 @@ -config-file-in-root-and-config-with-profile-p2=true -v1=config-file-in-root-and-config-with-profile-p2 -#v2 intentionally missing \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/config/file-in-root-and-config-with-profile.properties b/spring-boot-project/spring-boot/src/test/resources/config/file-in-root-and-config-with-profile.properties deleted file mode 100644 index 556c851a5f22..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/config/file-in-root-and-config-with-profile.properties +++ /dev/null @@ -1,3 +0,0 @@ -config-file-in-root-and-config-with-profile=true -v1=config-file-in-root-and-config-with-profile -v2=config-file-in-root-and-config-with-profile \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/config/nested/3-third/testproperties.properties b/spring-boot-project/spring-boot/src/test/resources/config/nested/3-third/testproperties.properties deleted file mode 100644 index d00e7f0a62f7..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/config/nested/3-third/testproperties.properties +++ /dev/null @@ -1 +0,0 @@ -third.property=shouldnotbefound diff --git a/spring-boot-project/spring-boot/src/test/resources/config/specific.properties b/spring-boot-project/spring-boot/src/test/resources/config/specific.properties deleted file mode 100644 index 744e563a5af2..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/config/specific.properties +++ /dev/null @@ -1 +0,0 @@ -my.property=specific diff --git a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/customprofile-customdefault.properties b/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/customprofile-customdefault.properties deleted file mode 100644 index 0888bcc45919..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/customprofile-customdefault.properties +++ /dev/null @@ -1 +0,0 @@ -customprofile-customdefault=true diff --git a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/customprofile.properties b/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/customprofile.properties deleted file mode 100644 index 4e2652099958..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/customprofile.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.profiles.active=customdefault -customprofile=true diff --git a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testnegatedprofiles.yml b/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testnegatedprofiles.yml deleted file mode 100644 index bf25b22a21f0..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testnegatedprofiles.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -my: - property: fromyamlfile - other: notempty ---- -spring.config.activate.on-profile: dev -my: - property: fromdevprofile ---- -spring.config.activate.on-profile: other -my: - property: fromotherprofile ---- -spring.config.activate.on-profile: "!other" -my: - property: fromnototherprofile - notother: foo diff --git a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testprofileexpression.yml b/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testprofileexpression.yml deleted file mode 100644 index c212cc0c9b5b..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testprofileexpression.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -my: - property: fromyamlfile ---- -spring.config.activate.on-profile: dev & other -my: - property: devandother ---- -spring.config.activate.on-profile: (dev | other) & another -my: - property: devorotherandanother ---- diff --git a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testprofiles.yml b/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testprofiles.yml deleted file mode 100644 index 98a993ef7659..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testprofiles.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -my: - property: fromyamlfile - other: notempty ---- -spring.config.activate.on-profile: dev -my: - property: fromdevprofile -dev: - property: devproperty ---- -spring.config.activate.on-profile: other -my: - property: fromotherprofile ---- -spring.config.activate.on-profile: prod -spring.config.import: file:./non-existent.yml - diff --git a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testprofilesdocument.yml b/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testprofilesdocument.yml deleted file mode 100644 index 159f728f9b30..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testprofilesdocument.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -my: - property: fromyamlfile - other: notempty ---- -spring.config.activate.on-profile: thedefault -my: - property: fromdefaultprofile ---- -spring.config.activate.on-profile: other -my: - property: fromotherprofile diff --git a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testprofilesempty.yml b/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testprofilesempty.yml deleted file mode 100644 index be357f780e76..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testprofilesempty.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -my: - property: fromyamlfile - other: notempty ---- -spring.config.activate.on-profile: -my: - property: fromemptyprofile ---- -spring.config.activate.on-profile: other -my: - property: fromotherprofile diff --git a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testsetprofiles.yml b/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testsetprofiles.yml deleted file mode 100644 index 260670becfe6..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/configdata/profiles/testsetprofiles.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -spring: - profiles: - active: dev -my: - property: fromyamlfile ---- -spring.config.activate.on-profile: dev -my: - property: fromdevprofile diff --git a/spring-boot-project/spring-boot/src/test/resources/configdata/properties/application-dev.properties b/spring-boot-project/spring-boot/src/test/resources/configdata/properties/application-dev.properties deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/spring-boot-project/spring-boot/src/test/resources/configdata/properties/application.other b/spring-boot-project/spring-boot/src/test/resources/configdata/properties/application.other deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/spring-boot-project/spring-boot/src/test/resources/configdata/properties/application.properties b/spring-boot-project/spring-boot/src/test/resources/configdata/properties/application.properties deleted file mode 100644 index c9f0304f65e5..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/configdata/properties/application.properties +++ /dev/null @@ -1 +0,0 @@ -foo=bar \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/configdata/properties/other.properties b/spring-boot-project/spring-boot/src/test/resources/configdata/properties/other.properties deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/spring-boot-project/spring-boot/src/test/resources/configdata/yaml/application.yml b/spring-boot-project/spring-boot/src/test/resources/configdata/yaml/application.yml deleted file mode 100644 index b93638efd6c5..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/configdata/yaml/application.yml +++ /dev/null @@ -1,3 +0,0 @@ -foo: bar ---- -hello: world \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/configimportwithprofilespecific-prod.properties b/spring-boot-project/spring-boot/src/test/resources/configimportwithprofilespecific-prod.properties deleted file mode 100644 index 6b16e80391cb..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/configimportwithprofilespecific-prod.properties +++ /dev/null @@ -1 +0,0 @@ -prop=fromprofilefile \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/configimportwithprofilespecific.properties b/spring-boot-project/spring-boot/src/test/resources/configimportwithprofilespecific.properties deleted file mode 100644 index de523ae42dd5..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/configimportwithprofilespecific.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.config.import=icwps: -prop=fromfile \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/custom-config/application.yml b/spring-boot-project/spring-boot/src/test/resources/custom-config/application.yml deleted file mode 100644 index bb56b055142c..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/custom-config/application.yml +++ /dev/null @@ -1 +0,0 @@ -hello: world diff --git a/spring-boot-project/spring-boot/src/test/resources/custom-console-log-pattern.xml b/spring-boot-project/spring-boot/src/test/resources/custom-console-log-pattern.xml deleted file mode 100644 index 60fd81a46466..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/custom-console-log-pattern.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/custom-file-log-pattern-with-fileNamePattern.xml b/spring-boot-project/spring-boot/src/test/resources/custom-file-log-pattern-with-fileNamePattern.xml deleted file mode 100644 index 1ae820bc92de..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/custom-file-log-pattern-with-fileNamePattern.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/custom-file-log-pattern.xml b/spring-boot-project/spring-boot/src/test/resources/custom-file-log-pattern.xml deleted file mode 100644 index b94a60abfdf5..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/custom-file-log-pattern.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/custom-location.yml b/spring-boot-project/spring-boot/src/test/resources/custom-location.yml deleted file mode 100644 index 69a696159948..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/custom-location.yml +++ /dev/null @@ -1 +0,0 @@ -foo: ${fooValue} diff --git a/spring-boot-project/spring-boot/src/test/resources/customapplication.yml b/spring-boot-project/spring-boot/src/test/resources/customapplication.yml deleted file mode 100644 index 9bda1a4411aa..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/customapplication.yml +++ /dev/null @@ -1 +0,0 @@ -yamlkey: yamlvalue \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/customprofile-customdefault.properties b/spring-boot-project/spring-boot/src/test/resources/customprofile-customdefault.properties deleted file mode 100644 index 4770be45e42f..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/customprofile-customdefault.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.profiles.include=specific -customprofile-customdefault=true diff --git a/spring-boot-project/spring-boot/src/test/resources/customprofile-specific.properties b/spring-boot-project/spring-boot/src/test/resources/customprofile-specific.properties deleted file mode 100644 index cc4c955469b3..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/customprofile-specific.properties +++ /dev/null @@ -1 +0,0 @@ -customprofile-specific=true diff --git a/spring-boot-project/spring-boot/src/test/resources/customprofile.properties b/spring-boot-project/spring-boot/src/test/resources/customprofile.properties deleted file mode 100644 index 4e2652099958..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/customprofile.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.profiles.active=customdefault -customprofile=true diff --git a/spring-boot-project/spring-boot/src/test/resources/data.sql b/spring-boot-project/spring-boot/src/test/resources/data.sql deleted file mode 100644 index 06acad8464bd..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/data.sql +++ /dev/null @@ -1 +0,0 @@ -INSERT INTO EXAMPLE VALUES (1, 'Andy'); \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/dispatcher.properties b/spring-boot-project/spring-boot/src/test/resources/dispatcher.properties deleted file mode 100644 index 0ffbf1791fa3..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/dispatcher.properties +++ /dev/null @@ -1 +0,0 @@ -main.sources: org.springframework.boot.main.DispatcherMainTests diff --git a/spring-boot-project/spring-boot/src/test/resources/enableother.properties b/spring-boot-project/spring-boot/src/test/resources/enableother.properties deleted file mode 100644 index f21b4e998982..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/enableother.properties +++ /dev/null @@ -1,3 +0,0 @@ -spring.profiles.active=other -my.property=fromenableotherpropertiesfile -one.more=${my.property} diff --git a/spring-boot-project/spring-boot/src/test/resources/enableprofile-myprofile.properties b/spring-boot-project/spring-boot/src/test/resources/enableprofile-myprofile.properties deleted file mode 100644 index 88ee464f6753..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/enableprofile-myprofile.properties +++ /dev/null @@ -1,2 +0,0 @@ -my.property=fromprofilepropertiesfile -the.property=fromprofilepropertiesfile diff --git a/spring-boot-project/spring-boot/src/test/resources/enableprofile-other.properties b/spring-boot-project/spring-boot/src/test/resources/enableprofile-other.properties deleted file mode 100644 index 04e2d9608b52..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/enableprofile-other.properties +++ /dev/null @@ -1 +0,0 @@ -other.property=fromotherpropertiesfile diff --git a/spring-boot-project/spring-boot/src/test/resources/enableprofile.properties b/spring-boot-project/spring-boot/src/test/resources/enableprofile.properties deleted file mode 100644 index 885285226242..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/enableprofile.properties +++ /dev/null @@ -1,4 +0,0 @@ -spring.profiles.active=myprofile -my.property=frompropertiesfile -the.property=frompropertiesfile -one.more=${my.property} diff --git a/spring-boot-project/spring-boot/src/test/resources/enabletwoprofiles.properties b/spring-boot-project/spring-boot/src/test/resources/enabletwoprofiles.properties deleted file mode 100644 index 90d74d0f4170..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/enabletwoprofiles.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.profiles.active=myprofile,another -my.property=fromtwopropertiesfile diff --git a/spring-boot-project/spring-boot/src/test/resources/file-in-root-and-config-with-profile-p1.properties b/spring-boot-project/spring-boot/src/test/resources/file-in-root-and-config-with-profile-p1.properties deleted file mode 100644 index c4de4d2a978d..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/file-in-root-and-config-with-profile-p1.properties +++ /dev/null @@ -1,3 +0,0 @@ -file-in-root-and-config-with-profile-p1=true -v1=file-in-root-and-config-with-profile-p1 -v2=file-in-root-and-config-with-profile-p1 diff --git a/spring-boot-project/spring-boot/src/test/resources/file-in-root-and-config-with-profile-p2.properties b/spring-boot-project/spring-boot/src/test/resources/file-in-root-and-config-with-profile-p2.properties deleted file mode 100644 index c60d2dafc39b..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/file-in-root-and-config-with-profile-p2.properties +++ /dev/null @@ -1,3 +0,0 @@ -file-in-root-and-config-with-profile-p2=true -v1=file-in-root-and-config-with-profile-p2 -v2=file-in-root-and-config-with-profile-p2 diff --git a/spring-boot-project/spring-boot/src/test/resources/file-in-root-and-config-with-profile.properties b/spring-boot-project/spring-boot/src/test/resources/file-in-root-and-config-with-profile.properties deleted file mode 100644 index b34ddf5169ba..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/file-in-root-and-config-with-profile.properties +++ /dev/null @@ -1,3 +0,0 @@ -file-in-root-and-config-with-profile=true -v1=file-in-root-and-config-with-profile -v2=file-in-root-and-config-with-profile diff --git a/spring-boot-project/spring-boot/src/test/resources/gh17001.properties b/spring-boot-project/spring-boot/src/test/resources/gh17001.properties deleted file mode 100644 index b61799d2cdee..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/gh17001.properties +++ /dev/null @@ -1 +0,0 @@ -gh17001loaded=true diff --git a/spring-boot-project/spring-boot/src/test/resources/invalidproperty.properties b/spring-boot-project/spring-boot/src/test/resources/invalidproperty.properties deleted file mode 100644 index 4729d6f015ff..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/invalidproperty.properties +++ /dev/null @@ -1 +0,0 @@ -spring.profiles=a \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/log4j2-nondefault.xml b/spring-boot-project/spring-boot/src/test/resources/log4j2-nondefault.xml deleted file mode 100644 index ecaa4dc5effc..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/log4j2-nondefault.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - ???? - ${sys:LOG_FILE} %d{yyyy-MM-dd HH:mm:ss.SSS}] service%X{context} - ${sys:PID} %5p [%t] --- %c{1}: %m%n - - - - - - - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/log4j2-override.xml b/spring-boot-project/spring-boot/src/test/resources/log4j2-override.xml deleted file mode 100644 index f0cdfa02d2bc..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/log4j2-override.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/logback-broken.xml b/spring-boot-project/spring-boot/src/test/resources/logback-broken.xml deleted file mode 100644 index 7f8454941cff..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/logback-broken.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - ${LOG_FILE} [%t] ${PID:-????} %c{1}: %m%n BOOTBOOT - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/logback-include-base.xml b/spring-boot-project/spring-boot/src/test/resources/logback-include-base.xml deleted file mode 100644 index b8a41480d7d6..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/logback-include-base.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/logback-include-defaults.xml b/spring-boot-project/spring-boot/src/test/resources/logback-include-defaults.xml deleted file mode 100644 index 0124d8a7e357..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/logback-include-defaults.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - [%p] - %m%n - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/logback-invalid-format.txt b/spring-boot-project/spring-boot/src/test/resources/logback-invalid-format.txt deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/spring-boot-project/spring-boot/src/test/resources/logback-nondefault.xml b/spring-boot-project/spring-boot/src/test/resources/logback-nondefault.xml deleted file mode 100644 index 5d1622c51841..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/logback-nondefault.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - %property{LOG_FILE} [%t] ${PID:-????} %c{1}: %m%n BOOTBOOT - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/logback-springprofile-in-root.xml b/spring-boot-project/spring-boot/src/test/resources/logback-springprofile-in-root.xml deleted file mode 100644 index 284c547a0b32..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/logback-springprofile-in-root.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %property{LOG_FILE} [%t] ${PID:-????} %c{1}: %m%n BOOTBOOT - - - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/logback-without-extension b/spring-boot-project/spring-boot/src/test/resources/logback-without-extension deleted file mode 100644 index 1d55bbaf83fb..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/logback-without-extension +++ /dev/null @@ -1,11 +0,0 @@ - - - - - %msg - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/logging-nondefault.properties b/spring-boot-project/spring-boot/src/test/resources/logging-nondefault.properties deleted file mode 100644 index d4f6d6970b5e..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/logging-nondefault.properties +++ /dev/null @@ -1,2 +0,0 @@ -handlers = java.util.logging.ConsoleHandler -.level = INFO diff --git a/spring-boot-project/spring-boot/src/test/resources/moreproperties.properties b/spring-boot-project/spring-boot/src/test/resources/moreproperties.properties deleted file mode 100644 index d72233548bda..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/moreproperties.properties +++ /dev/null @@ -1,2 +0,0 @@ -my.property=frommorepropertiesfile -the.property=frommorepropertiesfile diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/animated.gif b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/animated.gif deleted file mode 100644 index 104a96af5168..000000000000 Binary files a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/animated.gif and /dev/null differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/black-and-white.gif b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/black-and-white.gif deleted file mode 100644 index 745fd2538481..000000000000 Binary files a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/black-and-white.gif and /dev/null differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/colors.gif b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/colors.gif deleted file mode 100644 index d6e00226bfbb..000000000000 Binary files a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/colors.gif and /dev/null differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyAddsImportedSourceToEnvironment.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyAddsImportedSourceToEnvironment.properties deleted file mode 100644 index d5578cf52922..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyAddsImportedSourceToEnvironment.properties +++ /dev/null @@ -1 +0,0 @@ -spring=boot \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyDoesNotSetProfilesFromIgnoreProfilesContributors.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyDoesNotSetProfilesFromIgnoreProfilesContributors.properties deleted file mode 100644 index f841722a2f15..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyDoesNotSetProfilesFromIgnoreProfilesContributors.properties +++ /dev/null @@ -1 +0,0 @@ -spring.profiles.active=test diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyDoesNotSetProfilesFromIgnoreProfilesContributorsWhenNoProfilesActive.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyDoesNotSetProfilesFromIgnoreProfilesContributorsWhenNoProfilesActive.properties deleted file mode 100644 index 74bc31f180a7..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyDoesNotSetProfilesFromIgnoreProfilesContributorsWhenNoProfilesActive.properties +++ /dev/null @@ -1 +0,0 @@ -spring=boot diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyMovesDefaultProperySourceToLast.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyMovesDefaultProperySourceToLast.properties deleted file mode 100644 index 74bc31f180a7..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyMovesDefaultProperySourceToLast.properties +++ /dev/null @@ -1 +0,0 @@ -spring=boot diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyOnlyAddsActiveContributors.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyOnlyAddsActiveContributors.properties deleted file mode 100644 index 149c06dae63b..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyOnlyAddsActiveContributors.properties +++ /dev/null @@ -1,4 +0,0 @@ -spring=boot -#--- -spring.config.activate.on-profile=missing -other=value \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplySetsActiveProfiles.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplySetsActiveProfiles.properties deleted file mode 100644 index d0e7d24f2372..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplySetsActiveProfiles.properties +++ /dev/null @@ -1 +0,0 @@ -spring.profiles.active=one,two,three diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplySetsActiveProfilesAndProfileGroups.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplySetsActiveProfilesAndProfileGroups.properties deleted file mode 100644 index 74de2859947d..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplySetsActiveProfilesAndProfileGroups.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.profiles.active=one,two,three -spring.profiles.group.one=four,five diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplySetsDefaultProfiles.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplySetsDefaultProfiles.properties deleted file mode 100644 index 5aee84d320eb..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplySetsDefaultProfiles.properties +++ /dev/null @@ -1 +0,0 @@ -spring.profiles.default=one,two,three diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyWhenHasListenerCallsOnPropertySourceAdded.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyWhenHasListenerCallsOnPropertySourceAdded.properties deleted file mode 100644 index 74bc31f180a7..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyWhenHasListenerCallsOnPropertySourceAdded.properties +++ /dev/null @@ -1 +0,0 @@ -spring=boot diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyWhenHasListenerCallsOnSetProfiles.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyWhenHasListenerCallsOnSetProfiles.properties deleted file mode 100644 index d0e7d24f2372..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/ConfigDataEnvironmentTests-processAndApplyWhenHasListenerCallsOnSetProfiles.properties +++ /dev/null @@ -1 +0,0 @@ -spring.profiles.active=one,two,three diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/separate-class-loader-spring.factories b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/separate-class-loader-spring.factories deleted file mode 100644 index b2d2d3181f3b..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/config/separate-class-loader-spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.context.config.ConfigDataLoader=\ -org.springframework.boot.context.config.ConfigDataEnvironmentTests.SeparateClassLoaderConfigDataLoader \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/properties/bind/convert/resource.txt b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/properties/bind/convert/resource.txt deleted file mode 100644 index 9daeafb9864c..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/properties/bind/convert/resource.txt +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/properties/testProperties.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/properties/testProperties.xml deleted file mode 100644 index b7dc32185af7..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/context/properties/testProperties.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/diagnostics/analyzer/nounique/consumer.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/diagnostics/analyzer/nounique/consumer.xml deleted file mode 100644 index cf74f72245c0..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/diagnostics/analyzer/nounique/consumer.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/diagnostics/analyzer/nounique/producer.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/diagnostics/analyzer/nounique/producer.xml deleted file mode 100644 index f1f3de4abb6a..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/diagnostics/analyzer/nounique/producer.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/anchors.yml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/anchors.yml deleted file mode 100644 index 302131220c7e..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/anchors.yml +++ /dev/null @@ -1,6 +0,0 @@ -some: - path: &anchor - config: - key: value - anotherpath: - <<: *anchor diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/existing-non-multi-document.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/existing-non-multi-document.properties deleted file mode 100644 index faab368e3723..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/existing-non-multi-document.properties +++ /dev/null @@ -1,32 +0,0 @@ -#--- -# Test -#--- - -spring=boot - -#--- -# Test - -boot=bar - - -# Test -#--- - -bar=ok - -!--- -! Test -!--- - -ok=well - -!--- -! Test - -well=hello - -! Test -!--- - -hello=world diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/multi-document-properties-2.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/multi-document-properties-2.properties deleted file mode 100644 index 5f49e461d1c5..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/multi-document-properties-2.properties +++ /dev/null @@ -1,10 +0,0 @@ -#--- -#test -blah=hello world -bar=baz -hello=world -#--- -foo=bar -bling=biz -#comment1 -#comment2 \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/multi-document-properties-empty.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/multi-document-properties-empty.properties deleted file mode 100644 index 4605cdfbe6c0..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/multi-document-properties-empty.properties +++ /dev/null @@ -1,12 +0,0 @@ - -#--- -#test -blah=hello world -bar=baz -hello=world -#--- -#--- -foo=bar -bling=biz -#comment1 -#comment2 \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/multi-document-properties.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/multi-document-properties.properties deleted file mode 100644 index 9f2d4f84ee0f..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/multi-document-properties.properties +++ /dev/null @@ -1,10 +0,0 @@ -#test -blah=hello world -bar=baz -hello=world -#--- -foo=bar -bling=biz -#comment1 -#comment2 -#--- \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/recursive.yml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/recursive.yml deleted file mode 100644 index 3d4ca7d18268..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/recursive.yml +++ /dev/null @@ -1,7 +0,0 @@ -&def1 -*def1: a -test: - a: - spring: 'a' - b: - boot: 'b' diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-empty-yaml.yml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-empty-yaml.yml deleted file mode 100644 index 783019e76188..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-empty-yaml.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- ---- - ---- ---- \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-properties-malformed-unicode.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-properties-malformed-unicode.properties deleted file mode 100644 index 8a9e59229936..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-properties-malformed-unicode.properties +++ /dev/null @@ -1 +0,0 @@ -test-malformed-unicode=properties\u(026test diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-xml.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-xml.xml deleted file mode 100644 index 5d3350e81fbe..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-xml.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - xml - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-yaml.yml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-yaml.yml deleted file mode 100644 index 61c902e2becb..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-yaml.yml +++ /dev/null @@ -1,38 +0,0 @@ -# https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html - -name: Martin D'vloper -job: Developer -skill: Elite -employed: True -foods: - - Apple - - Orange - - Strawberry - - Mango -languages: - perl: Elite - python: Elite - pascal: Lame -education: | - 4 GCSEs - 3 A-Levels - BSc in the Internet of Things -example: - foo: - - name: springboot - url: https://springboot.example.com/ - bar: - - bar1: baz - - bar2: bling -empty: "" -null-value: null -emptylist: [] -emptymap: {} ---- - -spring: - profiles: development -name: Test Name - ---- - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/foobar.txt b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/foobar.txt deleted file mode 100644 index 67d8e4dbe09d..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/foobar.txt +++ /dev/null @@ -1 +0,0 @@ -Foo Bar \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/gradient.gif b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/gradient.gif deleted file mode 100644 index 607269f21f9b..000000000000 Binary files a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/gradient.gif and /dev/null differ diff --git a/spring-boot-project/spring-boot/src/test/resources/test.jks b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/http/client/test.jks similarity index 100% rename from spring-boot-project/spring-boot/src/test/resources/test.jks rename to spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/http/client/test.jks diff --git a/spring-boot-project/spring-boot/src/test/resources/test-expired.p12 b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/info/test-expired.p12 similarity index 100% rename from spring-boot-project/spring-boot/src/test/resources/test-expired.p12 rename to spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/info/test-expired.p12 diff --git a/spring-boot-project/spring-boot/src/test/resources/test-not-yet-valid.p12 b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/info/test-not-yet-valid.p12 similarity index 100% rename from spring-boot-project/spring-boot/src/test/resources/test-not-yet-valid.p12 rename to spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/info/test-not-yet-valid.p12 diff --git a/spring-boot-project/spring-boot/src/test/resources/test.p12 b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/info/test.p12 similarity index 100% rename from spring-boot-project/spring-boot/src/test/resources/test.p12 rename to spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/info/test.p12 diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/large.gif b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/large.gif deleted file mode 100644 index e1ebd0c86ed5..000000000000 Binary files a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/large.gif and /dev/null differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/log4j2/multi-profile-names.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/log4j2/multi-profile-names.xml deleted file mode 100644 index 535f4a7ae24b..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/log4j2/multi-profile-names.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/log4j2/production-profile.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/log4j2/production-profile.xml deleted file mode 100644 index f0c3309f875c..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/log4j2/production-profile.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/log4j2/profile-expression.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/log4j2/profile-expression.xml deleted file mode 100644 index 25d07059818d..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/log4j2/profile-expression.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/include-with-profile.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/include-with-profile.xml deleted file mode 100644 index 231de8f580ae..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/include-with-profile.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/include-with-property.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/include-with-property.xml deleted file mode 100644 index 74f08edcb49e..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/include-with-property.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/multi-profile-names.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/multi-profile-names.xml deleted file mode 100644 index 4f785c163a02..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/multi-profile-names.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/nested.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/nested.xml deleted file mode 100644 index 247229cc0055..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/nested.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/production-profile.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/production-profile.xml deleted file mode 100644 index bb3c8aae3cba..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/production-profile.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/profile-expression.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/profile-expression.xml deleted file mode 100644 index c11d7f9f6599..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/profile-expression.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/profile-in-include.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/profile-in-include.xml deleted file mode 100644 index a03c5d926883..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/profile-in-include.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/property-default-value.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/property-default-value.xml deleted file mode 100644 index 5fcf44025c48..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/property-default-value.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/property-in-if.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/property-in-if.xml deleted file mode 100644 index 92bb19cd9e7b..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/property-in-if.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/property-in-include.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/property-in-include.xml deleted file mode 100644 index f367385c99e3..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/property-in-include.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/property.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/property.xml deleted file mode 100644 index a574d13df7b2..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/logging/logback/property.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/test-cert.pem b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/rsocket/netty/test-cert.pem similarity index 100% rename from spring-boot-project/spring-boot/src/test/resources/test-cert.pem rename to spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/rsocket/netty/test-cert.pem diff --git a/spring-boot-project/spring-boot/src/test/resources/test-key.pem b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/rsocket/netty/test-key.pem similarity index 100% rename from spring-boot-project/spring-boot/src/test/resources/test-key.pem rename to spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/rsocket/netty/test-key.pem diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/rsocket/netty/test.jks b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/rsocket/netty/test.jks new file mode 100644 index 000000000000..74279d80fbac Binary files /dev/null and b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/rsocket/netty/test.jks differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/sample-beans.groovy b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/sample-beans.groovy deleted file mode 100644 index c867cc14b307..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/sample-beans.groovy +++ /dev/null @@ -1,5 +0,0 @@ -import org.springframework.boot.sampleconfig.MyComponent; - -beans { - myGroovyComponent(MyComponent) {} -} \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/sample-beans.xml b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/sample-beans.xml deleted file mode 100644 index f66853848fe0..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/sample-beans.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/sample-namespace.groovy b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/sample-namespace.groovy deleted file mode 100644 index 5404d2f80ca7..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/sample-namespace.groovy +++ /dev/null @@ -1,7 +0,0 @@ -import org.springframework.boot.sampleconfig.MyComponent; - -beans { - xmlns([ctx:'http://www.springframework.org/schema/context']) - ctx.'component-scan'('base-package':'nonexistent') - myGroovyComponent(MyComponent) {} -} \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/jks/test.jks b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/jks/test.jks new file mode 100644 index 000000000000..74279d80fbac Binary files /dev/null and b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/jks/test.jks differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/jks/test.p12 b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/jks/test.p12 new file mode 100644 index 000000000000..e1255f26f665 Binary files /dev/null and b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/jks/test.p12 differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/dsa.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/dsa.key new file mode 100644 index 000000000000..93a9ee56e4f2 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/dsa.key @@ -0,0 +1,21 @@ +-----BEGIN PRIVATE KEY----- +MIIDXQIBADCCAzYGByqGSM44BAEwggMpAoIBgQC1d6MOqEDLxjfjz1v7Vg44bBBX +VOoNdWhvJPl9NL2Js57UmYGrTqFit2VCLxbS5FVLyOZ25S0myQRsEtKyi4V9+ELI +0q3oQplm+l3tZqKjtO69ZlbzYSl9IG1254/FCwBnBTuN7Vl6A2vryIhY7cL4E053 +Yy0xqfP7swPgMYNBqjc9c53hNHKiseQJ8Q2wFKZqm13xgqnBqmWbm7yNmzKJbjMW +Zt3/WpJdjqfRnjSljFOkYPPBkGRUIKHcZ9fw4odVov2vblGzXwR+sFeE3lcF50WN +uppjszMXlqR4y937CUSFbCabatRHEcPTq/FxioERCrCdx3AKOfwAquahtvWb9V7A +47FlibDDeybh5jCH0j9HSjhjSiDZdadSgGKFynPNlVAlOETZKGqkeqAZZ+dsPkVO +n8tx+VXZJF00YSe1HLKJUWXaT1tEGF6vw/dXhhQVir4j63fN2tZdhTOW1ao/J/iT +VYEQQjYeMKKuZQveBKRBlpAjhmjOztbE8VL4O/cCHQCxPXlCpORbfOMEEGU0hbEE +HsxFHMXHCnURCJxVAoIBgQCBqsk+z57UndC1Ut6u19wILXs7UBgLo0ivId2QHtm5 +kY77P9/lNOyCIQkBnULbJ36lHm6yxLZ8imyC5Lc7wlFJpJ6PpiTJ3nPi3fzhbftB +2KCJVSwB3XfkjvyyS8bfwwqyrmce9el+AIFJuWPrFSkjNthq7U5vU5a+uNT9XZrs +EaDbjkjVJXRX1oDS3IfWXWpb9i/LOE9HU+NfDKfydasWASvwNX1F5BKXD0AH9adj +9Q7b0p4DVTh+UPWLBk9/e6gsA5HaRI1urAMNxs5Xnmd8UYF1I+AmjQ9Mi63Pa0YW +QjpdH2hoOQGLemQ/72woFVzLaHWBcTuSwjREilaAA5M8CWq4rpuA79MrcHgzSp2C +W1gtZa2/3SymcJ7Py2PHbncod8gR9dxHWVO07ccOXUG0iL9m4MzQ27uVvTh8Nrma +M+JET778E2FaAkAIT34eNMC6Yk2IDrxU9L66FFx3+3n0cOeWaJxIWrIQ6uWk+uIH +VzPsZAQU/V0/QBABlHuSj1cEHgIcYTbB5VrbIgust0jVvQCnlF4b1V0qz2iDJt6o +sA== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/file.txt b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/file.txt new file mode 100644 index 000000000000..cd13893fe1e5 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/file.txt @@ -0,0 +1 @@ +Text file to test parsing failures with invalid input diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs1/dsa.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs1/dsa.key new file mode 100644 index 000000000000..a30fec06f820 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs1/dsa.key @@ -0,0 +1,12 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIBuwIBAAKBgQCDX+Ux7y7dkfCnQgRIXzAlFrG8uPxwFdC8J4FJNrAurnjL//PV +8LEHBDVbyPjHaoNbH8Pfc2pJnOzndWZVf0nqBd4Q/Tz9w/pJ9g6E8HOh+rzU3eK5 +mF0rezcMbJsot2Vdx6XrTztDKi2GY0etKNV399DYtepIYA6v5ovuYAOjLwIVAPyb +9zR+UjyCkBwESDm9dpzKsGp1AoGAS2vtTiO7/MT8cJwo4mxYtiJnV5R2mk1JJOTe +4AFPgmnce/YbBzU2JwL9J9HGewDkmxudW0zoxZVeNw4dRua6oB5STV8XciW8vSo6 +mdDBJFoBW9/DUscRP4j2aRfkXGlYuiEF6ZT8g6pPHZG7pLviihMAWNRVLmBt38wa +8FA9aZECgYADbfwh7OhSE1J0WRaEk/4Usos5Oi6fhUyqr2u34Ereug9Gt4tkhePa +b3y31i2PQfsatpR+4VpBC6zpPgHQYpuqlqDRWJCd+Cxo9751nOiA3xYVxNoiwIn/ +WxoUkC8Jv8kYFAJRceXkF/auVh77MUoruAmoT2lGE6zP6ngP2q6jFwIVAJMF5kZ+ +AUZbUBUpZaPuZ15RL8GF +-----END DSA PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs1/rsa-aes-256-cbc.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs1/rsa-aes-256-cbc.key new file mode 100644 index 000000000000..4053ed5f6e98 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs1/rsa-aes-256-cbc.key @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CBC,2036BA8802B364C6BE415A48E1AC9966 + +0euP/daGIbl798XGc2Tc6u6NmnCl8C6hE0a2grO+wbvFEa13IT4hNVNTzqahfLb8 +STF9LXdvPbz9HybyWnG8KNm5sqsSY1omsHQI38khhwuhpHuWfjb62TqWobwrAmAU +qh2+kjc7upzW48axJLRQ69vfE4zKczZ4Sqv8qImPz9SiXPeaXinHf/wKfgXZZOvr +6A8nCykLglVrFbrZWydqKrTM9w/LTXsn0gNpDmrfZERDgWnabKnjYidHkXdgAoFy +ulsBjKvj2hJFtnJHTkCPXj6XAj18cwUWsN7inFJR5wqjIWXuLqfv/fNbK9lPzjAk +vMTEVWwynekvXFsSvnHAyEJfmRCNF6DOE+5VwjEROCFq8xceK4fz4T3BHC7XSgis +2ofBZwjCAJ0pP6SdRpbbZ0wlXH09wqDDTZ2vWD6bEG7hO9VuP/aO76MIWydLa78z +bDb2R6MnYKmYEInPzwfU4H66Z3/cz8orfYLlnF55DRd4rO+fJm6Y/XY14ac3x0S+ +P67s5e0WbdImagUsOxGNBjgOr84lwmtk/LoVd5nKho8JyQw3V7tiyrsKsM1lAXdS +TaJXKRnN6LbgC8d+Tgfjc/qMUdVqLlN8zATIa6E4sc861DDiJsneXuFm43pHc/ja +0sxSifBKgLGenj8xY5ANEfrYnXKrzaQemUnMzd+zan6OS02I+e8WTQevESt1j0D8 +7mgLJ9W2SfNNfiEd5OKar21lLNOc3POaFn7M73zL/gyhTROipPR3fpV+08k27UKl +nzGhFtRwQieXl34QjM0JrHokKKfv8FsAJsbrGnz2/wcm6jJGmrj5VVsogMKc90v4 +ZTM44NAKymM0UTuIp/rKb/UUVYDpl9VWDegWh2+XKX8io31ENrDMcvQTJ/mzNCuZ +SINrAeMbVD6W5L0i7THEt32YsDmbFsBaEJBlNXlUNBa/NCK0pjwAn5AYOFUvEqBC +oZUEleUMU6Q3TKI287o37euw3No6jo5VdPULlrwHsZAjmq9EUvRCgMoIEPdxv5XG +a4PljE7DQLlk6G9d+gjRzClLFfkadSTbtH9o2011RtWUKP4dcRuSOcBm64xVIO6J +rhe38sE3yzHvLUM/mvLsEM8B0AHl85nrEstlbBzftXMo2CAJ2Gs9c61PYfft+xiT +pRdHx4HB1P+kfHa96ayvAytOexHih2iVKVG5CchOr5tbWmkhXVE5cZAKzvczDYFd +YvniHNiqt6LO8EbJOzz+Yxessmd0zBXj/rjxTMdGwaRjiFI0BIguYpvmGoMS8+bp +spRj2DMtqjNZz68BEEfgKQwDHPCTblYSR+3Uw4sja608sflqQ8rTmOwbfta3SNS8 +Kq/zzWfYzarQ8hAk5n/H1Jm6AQdvcptyMjuF8FAiMnvt8xDCBRMD3xY2BHb/tcs9 +dBWBxhb76CKIrV3pzm9gGhhZ32Ndq9KmmE+bWCYyvrLxvPJxODfM7X5XamPmG5SH +wEKSbp0wPF0b6vyxt5M72OYnU8UnxYWu6PlbVvczfWEu9fIw/oIN/kDT/QUojTyt +wBgzVSTSNFaDtVXJw10IWQgsgWdNY5XueHKH060P5g+14woxU8i3TboNd+tC3hRl +-----END RSA PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs1/rsa.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs1/rsa.key new file mode 100644 index 000000000000..cf847bcbac64 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs1/rsa.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKAIBAAKCAgEA1zZsVLbl+bOl2QlFZ5R5hbJrR5u+G3Ddd/f25JWwno9tfRik ++39KrIHJKwxq/TH1d0WjfOuvFBz5Ucnh86NOSnffz7kxLgP8QcjQkwuVTjDj4lTp +sJpi/U1npAZ6Eu1/KeC3R2u8qqvYG3U3G6cQYw5Y+0wHf5EYlIvKfx5oVEEf67pz +7q2TffqoOV7PQHyHt+/BKFJI1ehj8W/2uQJJ9UTmGvixAYLZ6gHLmtEUj1cBZUb1 +5X/lVbbsiL8B2prbuPoJWYcppH8L2cqSq4JP43Y2VR3CtrQH9MBbLxBfPVnzuD1j +X1J++xMMN7NCRpBNI/xoJNxvxO+3RgNbkhz4f8WhJbuCwaoNJStytq2fcqOfT3t7 +lW10Gj67joMJZtIsW7JPquFGW6RNq7YqMCJ9ML8Vv9B9UJcUEeE+a+IX6epJBQK6 +1KC6TIe4SB+xl1Vu1xosuAyvni2H7QDjbiZvE8WX2apKk7fv81Epi+9J5Dn4zMpk +Z5GG1/itA+rZSCWCs8c3lbGq0olZMsXNNhbNZOqiih3yeaMw/B/3v/XMn98rliMl +C8VOX92eKKBJTX/CjMuSU48mxNE8lQJaDcfld9JE6ndmiZWe7BpXEF8wYtL/NObI +xZXfcLDsEHopPpU9gaRDZmtL2aUweliF3WIIUmoo/C3kR7ZOSJ5fC66a+yECAwEA +AQKCAgAhLFxqen7cjJqF5+3w12wb9bKfqRwWssEQmwJNnd1Js6YW4FOeCLMEAEV4 +A0QCn07NAcj/mny0RvsPZmUT3xpUVEIFjPBNvYOGyGOOJvzuvo6B9sDG3iVgEixl +ljH+9OjjFaZqteqxDCgVo23JL2lRO4bvxXpqaX02eI3QJmnCgv9eoLD6G3teseJ4 +ZWrg79EjwystAfIENvwg3TdUsUuhKOunQKpYJ0lbzscJqCzZI3otmFCS/bHmEnpH +YdnxTmmMC86hJDqBBqxW9+i/0yhpUXFykVHQQ9PuIDBuAsILfPAaeCv3J4o3PWpm +s5UFt3yMjX2oIOqBmsnPWvkkfp63Gr2rGfAMftXSA0l9VcyMPZx78jihZx43f8bK +MVu4Rd/V1Yxc0n7fr/TTOl5m3Fb4rdOuPOoLEDUQeO4SplStxbjIAEwa1oFFSD8x +xtsBhSP63+dwflkeuV7OgRP8Fsuu2MDnn5AHeHaM81J4smLjpZ9j6BdhWMVmimvH +L0Y/MiScC9ngTXpop5ph1VzOXVM1R05jnt53P3UNNTubkndOnuBoa71Zbcjz1HkZ +APWbETt/1CgJ7aCN9CV7FYNA8/z9t4R/VObquwHE3qfzIOAzSb+rehoBr3nrtzAZ +A4uUOcvgnHzbm9FG0ysdqhri830KxnYfzeQ+bXeZDGU8PZcuIQKCAQEA/BS0oeP0 +5HAPSFVtNrSMNHTUvprHyfxp959Q8gAHD8MmQctoEUcABARUeDNNZbP/pNF2lCWB +rJfDLod8VZsViBj3coF0w4VinuC1hphEiu+He7UhOdS/PlpEr6Ci0gTsIIhqboVa +vKdvaEYaEHVp1//P8yC+M9CtF/fSCNlRElqgWzwkcFxMB4ErTWnIU0+ni+GtcKMs +4DrpAuSf4LXUBxoP6MBuTbRMcurEFE7Vwbslup/AZphXCF++2E5viOvXn3/uBPkh +L/wVTAgjb9Vdd/zTQKYp8Ol769OosrQcfb6Aa6OBuGhpkUVVSdNiSqZrclVfSWOR +5WoHHjiDiZ9a/QKCAQEA2o763dX7lKVTSXTAB7jTBMONrOX7g1gY8Dt2RvCzZY6R +zLQ/mQOcU8r1PdJc3WEdHP6YYzWy+7buMp/vsMsu17UnVW3ac22vISOLwStbZ0XJ +Dvm7rPQvaBG7/EDJvSGv654MCPGyM/JEgispK1I4yTAKltBFQ2NebUtg8NBPqK0q +KrRUiMB1H2QhoRIW47yFTTm3snosu1nnQ/qGDgWWUW2iGZtftN40HzXQPy2bMv2x +/ATRjsWVJcdqytqlg0wYM+4Ekkz633cnR59qZ76o3DoNEJUoM5fBwTKNfxExKRSc +WkqkXWoWGqkvXaW7jPec+8HQ/o15aLzCvhP3OIKz9QKCAQEA+n4I0SaY37eLODHL +iST4fdfq4E0mY0z0cCBca14jpkIh7heWnjSTi2pSFe/E5V9slfefga+ToFJengn8 +P4UQbGGC4sJJqVEOoxpgyBLfacCEPSXMko8aS3ef8XYK1fAWRG3KdXEGrZkkV9Xx +aJGEUCPgHJVY7Fxc5QhaKnjo2vg7iO3Gt/C/jGWLBi4r5r2snI/xrZA4s8lWao2N +YdrNixEW5g7yjTyxCzDHD/cW6qBx6XV913ViZuvd1Ux8AO97IQAbIc3+cJRrBVbB +AAxiCS2vLvrvino5ripx5MKd3UZEjrG34eu/m5/uFKJ9dfjRpJe5TFApVnN6B0nZ +TBSScQKCAQAieroC8zYcTjSkewGsdjD8KGmaZDHYl7Zfd9ICAQkcNXC07Z624gXw +hi1IUn6KAj8YiuW5iQgyg7pyTB8BMhyytQZ+iLUUzrH5NWVf1Ro3YaAFd8puz5sG +/P0+H250IvNg5W8anh6x6T97lZmKFw+UVbrl7fdvWSbVcTXa59IZVzA2ynonlM0l +ZaOUiIkJ5nzVIQzk4DdcWyOL6uLpJWKAeB5Bkex4WTG51sCCpww78B/7FTuGHY+Z +BSvI0tOXshKDZsJb3j8Zr++HchPUSBTVoWbcPdu4v/E2LGZ8LFcoFvNPn0Ts48aW +8CfjyziaVZnzcbEp52HG7zh9yiKPTLddAoIBAEpS/V+z3Vu1iMdQ9uoBIdcQbcLX +GYBoyyLEgmBBAYfNHJ9YTt4HwvDr57vgAqnadXmQh9+IRdpF7rSizr3OBqnBJE0J +nbGLKvJArMw4IcF29JOkpuR3GiuigfYgQ0JgYw7fZwc24eesKwopDWutUexo0Tlc +ef2CmgR/+rymyEknpX8xT5ExYaNz8odguNjRqSohM63p2UXkdi5CLYpu0q28iY59 +0s+3LAwsLPeZirR8TZ0NgirMMAIrILsCYmP78OGV6stOEUj1oUPIu6Txa/Z20saA +b6z079eXrl1voiiRyJ0h7tHL9VEQA62dICHY9BY1I7H9ZL+Fi1Af5jfXGSs= +-----END RSA PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP256r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP256r1.key new file mode 100644 index 000000000000..d17b664d739e --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP256r1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGIAgEAMBQGByqGSM49AgEGCSskAwMCCAEBBwRtMGsCAQEEIBfCkWEWyc2tHIvS +Ao6hhcj09dnh8NOmtZeqGmcXHnIqoUQDQgAElux3elmSzb/WqEZXb1vdXx/tcIpC +Yq2vewG8H1SikMoACeFVRcjuy31gJ4Q8M7UQmrR4+WXSptV/UQ6Gkt3XuQ== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP256t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP256t1.key new file mode 100644 index 000000000000..25bca43c321f --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP256t1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGIAgEAMBQGByqGSM49AgEGCSskAwMCCAEBCARtMGsCAQEEIILhgc3joEZDWMDm +9TYgrENN7gbqtMpMw1e2MTLwlJhCoUQDQgAEiDN20JP8O9zSK46tP6MkXJPNAfyN +IQ0hOgcQ//Fw5V0yiSU+BPGeDoIDsW8LnElS1hIZWq0JVQNZge5ei2bshQ== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP320r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP320r1.key new file mode 100644 index 000000000000..e1bd06c2793b --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP320r1.key @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIGiAgEAMBQGByqGSM49AgEGCSskAwMCCAEBCQSBhjCBgwIBAQQoNifTnb4a5dOR +yr8QFVM7Zkw/f/AMm5T5PQ6iVTCzrnw/kZ8glwl+JKFUA1IABHSnWUC/tKXpNHGE +P89QVKEgvetwCQWFoOENAgXORniLiaLdAdsR80ouTsZiFgHG9su0l5ESEnFWQr5x +UMj/vPwwhSYm+YP5ucx5NezuBM4d +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP320t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP320t1.key new file mode 100644 index 000000000000..5d89229f12f2 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP320t1.key @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIGiAgEAMBQGByqGSM49AgEGCSskAwMCCAEBCgSBhjCBgwIBAQQotGnirBX69ezE +7a9yIBQcqeCMm7hc5YAG8D4396ytBa/2/O/lonDlOqFUA1IABDQHDepa3l/S8Gt9 +WrNCNpCPZNBXvmkGPnVXZchZI5BtUySwYxHX1tpatGs3jY7drVYm+NyxZE81pecY +TvXR8bu7e3BIp2SwZmXEDxdYp1fw +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP384r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP384r1.key new file mode 100644 index 000000000000..c248a0f0d448 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP384r1.key @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIG6AgEAMBQGByqGSM49AgEGCSskAwMCCAEBCwSBnjCBmwIBAQQwK6y6NydLMTNm +LhDNPyTDKEemTWTUuMGfBQxEz+lQKAqz/So4uA+fQzor/t8to+uioWQDYgAEaK8X +3KCyRDMpbACw2xG4UUe9OxyuGWFaGKPxhKJDyW5Z56gT5P1Q2y4CblL/X9VcDIMX +dcQqRNBkPQfy1+fJXwKO0ClfD6MIE3bv6PTZ55J6H2H1dpg38a2soRchz0FN +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP384t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP384t1.key new file mode 100644 index 000000000000..13a4e0c7b032 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP384t1.key @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIG6AgEAMBQGByqGSM49AgEGCSskAwMCCAEBDASBnjCBmwIBAQQwBGUaEvTtnxm8 +fOWj2c2cX4991rvGmfGviuWWQRblSii/v9FG4nQ4Q2IrgBy+hgK9oWQDYgAEQL0d +QoOTArIx70V/XxipoxxBeKT7zmIe7id5pQiw4O4nA2S2BFxQF9eW9ipnm6DaN6ja +X/+2k+cC4qIfqzeLcLUFXxz0qdec8lNNtr9QmwoQlv11beeHmQu9C1GwHmvG +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP512r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP512r1.key new file mode 100644 index 000000000000..790b619c365c --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP512r1.key @@ -0,0 +1,7 @@ +-----BEGIN PRIVATE KEY----- +MIHsAgEAMBQGByqGSM49AgEGCSskAwMCCAEBDQSB0DCBzQIBAQRAmEQNFMGIDLoj +Ktdg8V71WdSs7FiBkE6Bft25+yY8ohugk/u8aKeIKNVtSirMgQhGFJy/BIBkvM6V +1JfnrglkjqGBhQOBggAEYbjTnA0x42NdM7jVv7jAoZq0iOYopbwejlOEsx8/MqRa +Yt4Ef83holIsgOHWSeW+kw1oMDmieoCrhnkM/3KgGzV+BxCeieAWGxABsj9YhAmb +ATorRJ4q/pMxRq8gIUv05/dGuUttl1gdbKKnGQjxDBM4v5H+/4z00nzzj4Gbfx8= +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP512t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP512t1.key new file mode 100644 index 000000000000..e4343646b3fc --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/brainpoolP512t1.key @@ -0,0 +1,7 @@ +-----BEGIN PRIVATE KEY----- +MIHsAgEAMBQGByqGSM49AgEGCSskAwMCCAEBDgSB0DCBzQIBAQRATamyZ088BsIP +Scslwa0I1xfC0/6udycncr+i/QIFOXNr4OQiVb4KC/CS/2FPotVMFSHZfCS2bgi6 +Yvg3Mta5SKGBhQOBggAEm/uIqsytMZypsqCuL0jwZh8xCRVEkUd02YPXcOBhMzS9 +bhAao4CLAuXhWzplr5qk/7ttvczl7qFDOvBzNAIieZHwbFrouZ6Pew8pQXRcMDB+ +FnXwNgpljTNmz/f1ePjVKU1ZgbQ+xVf8Qt8OI9S0Pla8siTgbVweGMLtq0A8Wuo= +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/dsa-aes-128-cbc.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/dsa-aes-128-cbc.key new file mode 100644 index 000000000000..5ab8a9217ef0 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/dsa-aes-128-cbc.key @@ -0,0 +1,23 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIDzTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIJ2oQD0S0aMcCAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAECBBCNXluHkzV+EEdxlhmcIAWBBIID +cAWJ20CCQlOCxxCddujc5gPPotUyKTbXA7xI3J9DdjrqBaHrNY/Yii4Zxk9lpzPL +3x3M3O4C8nJjk4OEA0fiyBYOV1d+KZfa7UZojIe/e+7BuTH9WAvgVzORYYEFX6x7 +DTTmYH6VSej/RBdNTV1KeWA4+20Zn+vqCwcBG6R78cQDP3xGOmT6jOAQR/0kkqEv +GN22UGpuMlHb7SDiYeDRqQPdRMkpu1RZS37MWEZ//yuwqEyaowK0JgTVGKyibf3E +qXYV7TqEumdfrpZxPXkmJwswUSoFwE1wM0XU5WMg+lnNiroaVQjzqLEEqENpJ03c +Y27l0m83GRVvISvwLGOKY0Sbcb2d6NnqBjbVjbJopjBrww3iiTUqGiQZTFjiJ3CD +VNKdG3HPWEdjZG5xoF9BLF3ZVz/jrfLkK2RcZBs0U6SyENd3H1gOk3yv4Uw2VjXi +h/PA27oFJ2I5DN9bcHhbKVMFykc9JZbisDO0TNx6gbVxZUdNEER0nsP4/sZCwXp+ +K7rGvrUk17vBesp0K/tTfdBM2xVkV6oCMKPeQpsdekwCSAdNamSpxZn5LqUaX+Gw +bMf1FxTlIL0ujLiN6/U3VWxLuJuoJauFyM5wYlpqgBOQIszVREQqMOs/Zp1WT5uS +VUA7tdcIpSE7aA3q2rg1BkaiLMSEBMY/XWAI6SCj7iQyRD6GDse/ayJrQ4rUPvD4 +iRLQN9B1BYwAplGX3Cmi++Yos7tOq8D2HfTDsI0bHAi+oSDTRUAsiezx5QRLgrp1 +pO2dyBlJ5HOlK4SA8h5CMlk2fVgCLGCZ61VcqF1DHu5NKuCnCR73QrwuZAPlo19L +Jt1YAgcXBfFoSbjAvE+AXcxu2uw+t2kj6cjGRSRpBNSHCn3bJ2zu0qrPL3lOMhtt +DYp0QNWJkW/6/fpmXXAYQQv6bFY0Bia8Ima9LATcCwpYcRox1pL2rvU1EWLDVy6N +PdFdlzLM7UcrY9Vy40gEj1qz9epAXqzfPkmbyP3i41BjKlZfmmzpJEI6hIJMtT6T +xWU1Kgg+mAED6STAJ6nem2bIEzMfsNM00VrHXoLU4IWPCe8NMYOaVox1xBWs1mer +lu9dgGBAy4/gn6v55XzjQ4R16wyiiJn3ZQGrUD0AE6N2E/tfWiphVG1tYDjjWCLv +bXG/U6P6DjClkBocb4DgKBc= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/dsa.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/dsa.key new file mode 100644 index 000000000000..93a9ee56e4f2 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/dsa.key @@ -0,0 +1,21 @@ +-----BEGIN PRIVATE KEY----- +MIIDXQIBADCCAzYGByqGSM44BAEwggMpAoIBgQC1d6MOqEDLxjfjz1v7Vg44bBBX +VOoNdWhvJPl9NL2Js57UmYGrTqFit2VCLxbS5FVLyOZ25S0myQRsEtKyi4V9+ELI +0q3oQplm+l3tZqKjtO69ZlbzYSl9IG1254/FCwBnBTuN7Vl6A2vryIhY7cL4E053 +Yy0xqfP7swPgMYNBqjc9c53hNHKiseQJ8Q2wFKZqm13xgqnBqmWbm7yNmzKJbjMW +Zt3/WpJdjqfRnjSljFOkYPPBkGRUIKHcZ9fw4odVov2vblGzXwR+sFeE3lcF50WN +uppjszMXlqR4y937CUSFbCabatRHEcPTq/FxioERCrCdx3AKOfwAquahtvWb9V7A +47FlibDDeybh5jCH0j9HSjhjSiDZdadSgGKFynPNlVAlOETZKGqkeqAZZ+dsPkVO +n8tx+VXZJF00YSe1HLKJUWXaT1tEGF6vw/dXhhQVir4j63fN2tZdhTOW1ao/J/iT +VYEQQjYeMKKuZQveBKRBlpAjhmjOztbE8VL4O/cCHQCxPXlCpORbfOMEEGU0hbEE +HsxFHMXHCnURCJxVAoIBgQCBqsk+z57UndC1Ut6u19wILXs7UBgLo0ivId2QHtm5 +kY77P9/lNOyCIQkBnULbJ36lHm6yxLZ8imyC5Lc7wlFJpJ6PpiTJ3nPi3fzhbftB +2KCJVSwB3XfkjvyyS8bfwwqyrmce9el+AIFJuWPrFSkjNthq7U5vU5a+uNT9XZrs +EaDbjkjVJXRX1oDS3IfWXWpb9i/LOE9HU+NfDKfydasWASvwNX1F5BKXD0AH9adj +9Q7b0p4DVTh+UPWLBk9/e6gsA5HaRI1urAMNxs5Xnmd8UYF1I+AmjQ9Mi63Pa0YW +QjpdH2hoOQGLemQ/72woFVzLaHWBcTuSwjREilaAA5M8CWq4rpuA79MrcHgzSp2C +W1gtZa2/3SymcJ7Py2PHbncod8gR9dxHWVO07ccOXUG0iL9m4MzQ27uVvTh8Nrma +M+JET778E2FaAkAIT34eNMC6Yk2IDrxU9L66FFx3+3n0cOeWaJxIWrIQ6uWk+uIH +VzPsZAQU/V0/QBABlHuSj1cEHgIcYTbB5VrbIgust0jVvQCnlF4b1V0qz2iDJt6o +sA== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/ed25519-aes-256-cbc.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/ed25519-aes-256-cbc.key new file mode 100644 index 000000000000..138b58e56f64 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/ed25519-aes-256-cbc.key @@ -0,0 +1,6 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIGbMFcGCSqGSIb3DQEFDTBKMCkGCSqGSIb3DQEFDDAcBAi1t9NlcmE8TwICCAAw +DAYIKoZIhvcNAgkFADAdBglghkgBZQMEASoEEJacGnDl5HIWWbv604Vp0CUEQDEx +jZKBJnhmLTPMJbE1TgVe+9N8ZG1CVpSFz0xo9xCk15G4E9jgxXw/a8Sqy7NiDqRb +FLJrSStMU+ygP7wXIFo= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/ed25519.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/ed25519.key new file mode 100644 index 000000000000..a9bf1bfb8f98 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/ed25519.key @@ -0,0 +1,3 @@ +-----BEGIN PRIVATE KEY----- +MC4CAQAwBQYDK2VwBCIEIJ55hBE+FwS4M3k/c45ZJKPHtsklKrb6qJlER0cMJ2rn +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/ed448.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/ed448.key new file mode 100644 index 000000000000..934617d4c1cd --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/ed448.key @@ -0,0 +1,4 @@ +-----BEGIN PRIVATE KEY----- +MEcCAQAwBQYDK2VxBDsEOSSF8O0uKk5pRrjUNV+QgonwO+WeDRb/i1U7vM+TLzh7 +jAV58E6oglA53konKxGv+GC38dCb72gSeQ== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/ssl/pkcs8/key-rsa-encrypted.pem b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/key-rsa-encrypted.pem similarity index 100% rename from spring-boot-project/spring-boot/src/test/resources/ssl/pkcs8/key-rsa-encrypted.pem rename to spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/key-rsa-encrypted.pem diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/prime256v1-aes-256-cbc.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/prime256v1-aes-256-cbc.key new file mode 100644 index 000000000000..ec364223094d --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/prime256v1-aes-256-cbc.key @@ -0,0 +1,7 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIHsMFcGCSqGSIb3DQEFDTBKMCkGCSqGSIb3DQEFDDAcBAjZ2eXtLFXLdgICCAAw +DAYIKoZIhvcNAgkFADAdBglghkgBZQMEASoEEIlOTfeoLwq9Bs9TFtw7VSMEgZAU +RO9W+K3vvzRG4sACrcFaB7PMhv3+HUOcPFf09QHa7aSJMWsb8EXGFBK4xlFhkK0/ +N0C8sRtH2N1JdYj9hiwS7I8WyybaR2W0ZALNR57iLz3WsOGQ7nVECFprElboqnSW +BtjkKTD9pz3xX/6cMkDV/2WqbS6Y/dzWJTH8yTTqjzTjbs4vguEK1Io6dlIRVqA= +-----END ENCRYPTED PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/prime256v1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/prime256v1.key new file mode 100644 index 000000000000..775a7a0fcacf --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/prime256v1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQguc9upTMQn8b+loAx +6c8q20dHYBf3V9374I3kJIDmC1ShRANCAARnLuOxL7n7Gq12zd9vq2neAv6PYc1h +W6M2gJKSbfFYGhte382jOJ2TgwaTQL/J5IPSfuJKkmAPBIl8CdJKWlwA +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa-aes-256-cbc.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa-aes-256-cbc.key new file mode 100644 index 000000000000..638f6fd3fd43 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa-aes-256-cbc.key @@ -0,0 +1,54 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIJrTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIX1pl8K5MBZoCAggA +MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBDAZbI9gwQvuQp1MWqsGkJeBIIJ +UIsFUQY5CFVcTqF2wNDdyA/5X4YvQ1wKPwYdSIHhGAe4UjljSqUBG5StfZmdA4aT +DdrzdApbZxP8BUlIjrjfR1tsbgnvevEkWUTftA2jzOmKBmYQ44WmQV2JGz6rWcH1 +ZUc0ArKq1Jz2OU+JnE3Olrbf4QupcYCQ+qgB5Afkp78hMUWiGPXaW12Ankjk0qVU +6zKiLP7cpignOlDTth+pYe/ltFQr1cLSgTsas/9X565usS333s8P7RQQsPRa5+De +hsgZIGeJTX6RGG0ipxZjd97jle54T6UPnYQWmHHZuX0LNqThTeUHZxPaMLJ7jnFY +NtqNvlXydkWRqdVmP2L2uk4mECrQrKqcqLIdlEL+sB00t+hjNtyCh6dIaQ5rbYDS +1k7fNDx1m2k1u3ydtUUeN6/7OJ7X1Is8k3WDTxHguFDz1mmeCw0lgH9tWZ4peG0/ +hIP2p02icaoSx24K7b6yHShJ/+B6lp17tYe/FgVBzO75tB7ljH5bZjYcZ9iIGy9h +T9Jq53M/lAnsAADLt1fiYRTWq9G5w/wzl0vqNTVpnpE7nXTs7d6Di812k8uyf2G+ +RU8Bsv50SJEZzW4liXhGxJXaI2TKKa8o27vPm/hK6cL2uoS6d22+/dUL1yP0ZXl7 +LOgqnNS3e6wT5xfdbXXclGUER8jP1QRPTm3evI13BRWHswLTeHWmdivZFrCHHw6o +7f3LARYLkefwO/FsC9IJzpdgN3B4V/K0BIcVYwXYgrqUIei91b+3EHgqvB3cXLdG +r91IBTvV15V9Hz8FUmTo+0uRdP7nrQ9+4451p6RP8FUuaAV03/a47YWemkZtqmzd +zuWB/Eo1fzmxrbHyXZoN9D04ubOB9S/6jUy9N2IwQykeKy+go/FHltQr8l0JhkKs +ipbaRc719n2Fj/hBkaIzLl/nxK2KWR2kCAiVXo8WHJOzzRlgEMUCbgoNbvf7X+ek +7O2VXOR2ZrqDSXs0WsZsq2LeAXlN2rIS3TKVru1T+0YKe/z/qZFvdygkTGB0qX7n +G+v03iRVSGingsl3UiW/S0wLDxdxnBgERggD+YSwQ/pFQTPn4AOe7xStW/2/d95W +S6rA23ijN+U3O1yN1jCJjMZUFK4DDwKbIUyqcF+m8jvYLrvYxNuVh3pwwDbGARGF +q3rzm4K0UUeCZa3sBlV9EkVhIxdibO9fPFP/9o+pGHacZ9/B0QtCXLfb3RnRX3AW +uM5L3gMd14TeIaeTMyHz4H9epUNwph022TKV98au8diLNGtB8eNZuu4wAYTfwYfi +kUcS+Yp/EqwO8/evdCvWSe5xJ1QuLcl+Fr6XGEs+QmcGNDSq9VaqNu5QndZSBR26 +Zv5vGpukqwxGXdHmETvLavam4io4Q/2XUQgZLdCTKxs4Sf3BiAyrW0DWEFQ0vLXt +FFNQ6AXuVe7jvaGDox86RZ3bHDwWJePBAkQtOza/lFkvLd2h9bcjppeHxznr36Ha +AnVfIJ57sjBlQA0bpUmTGDkcC1FmRnM5ADQdCENu6ZCkgkVwpFeYfJX/Vk3wMH41 +DQwSF7gP75DDLBnwyb8WooMWEkULBzBEa6N6koZejmgEaULv0aWN0BhE8G1XxVq+ ++hOwgNMVm0d9UrceOUsyj4G7UpJbMO0jtLSt3PWE9xfCqDm7vVPf9sA3/Qa6YtXX +EkNCfItqqbYBWsNKzNpZXDpiS26DFhpww9JrwEL2KBRp247ANxZxG7dhk5H12+Zv +2c49np0/zAHAhREzuebnPZiWbEMPOM0y9WxIhbCN+u1E16nxZWDeNagDsOCkiNrR +c02C3U+MZd6S5oYT2h9kc5qq9NyCkJQTFO4012sBYn9LZ0aFUXIPPCilrr2dRMJG +CUMGrtMfbauEQ7iZYSCdg1PDNmtrv3sirJWZueMNQhEppdtYiV5gfCPVl0sa3fvP +4yLiPiMMrTjspyXq66jTR116Sm0ZdffDZHGDFUSFowEJZ5JbigUsQDvRwcGjoZ// +IKT3PPQ55tukuD2WmI2FT4j9SYr3YSBWcraY0povPanxwAIewZZW9BxrOgEDthkY +7VPeShzcJ4z8O60ioJTtR7gZYhcy9NoTHM8sbXhHS8QloWa22cwXACtPtuh7ErQZ +jPHIhb+KLFa7P7O6ceTYwZlqUnA+HFI9VHarrutxqRaUWa37JAEhd1bplmxBXDZo +/8S4pNVlxT9xQmuYpN5JvWCeUadV5SwHCGVHcIDVsDVAWF6zLYwb6zWF1i3uRYTP +FNwZx4DiskQhQu34QAnvvajZ1wZf3xJ6LS+exOoAZ8Z/qyxWmDwffSvf6Nx/Tw1r +wLFmKTcMGxBUzGMJ4txp0tiJIHYE8IQMYWNOBeB/GjRWxTEBl5doFpXpDdFz+mfP +k/wRUTkbuRg1KxXV2GPGB94m9elePD+Rf+m0Hl9rWPGsPR2JE6lr6k/kUYAWXuSh +o/3w85skoGcAe51EVvtrtqbPTTcd/ndigKI7U4shQnZCm8nUISYlIukor2vNlIuw +1MC94zP2sfWBreka5VAC3IsP67lkdJx6DLvv80GJ50O7u1oKjQCroEKGC22puTb9 +NZn0h8BepBrgY6eWA9eZyrJ+v0HfMKN0O4lBBhtcedHTGZmBhKffjS0KTqvztFyo +vnx86mIoiskANpfTn1QWSHxVJm5fNlRNK3DdCDzsQ8OcweIGc/omcg1MYp3Qav17 +E6HoYWVrYUhVbzrOPiW3SorE5c0Xk1tTZQXH212mt3RhMTPmrqc6+PVIwFfU/lzi +SABjj1Jws9QLbb74J8O5eP4+ZxAvkZtKaLTBibJhYOGtGIrsWzfmcsEzCH+YUPYz +3vMT6E6wB/KazfI3TWc2g0eHklu7mx1HDlR1V6BOfJ3tOMOqqOOpvAp8A3J+TULB +ZlQIOlMYH+fnQfRg2FcVHGCik32h7HdjeoZha/Qsogrg5j4LL0NkJf3k5E8I/c4L +o7yY0rPMKt6qmmZe4msO9wFGomWCms5LBV9K3H4bEtNdPs5rdP8wO8C9NaGRuUgZ +3pPm1AYRdxJNW3TGR+D7nTuDrRIKrxMkWyKOkwQteWAqI4OAiMezhpv8X0+pq5K8 +8rPROuQkq/znG8wktQ0V6P+JjL1oBayhrpadgYY/tc1+S8U/zeeCPnFtUXLLdk/K +stzs8gsvZCWWn6M5mlSrsyLaB1sgbxbuOlaH4FlUAYZC +-----END ENCRYPTED PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa-des-ede3-cbc.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa-des-ede3-cbc.key new file mode 100644 index 000000000000..a2144172fdda --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa-des-ede3-cbc.key @@ -0,0 +1,54 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIJnDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQInDrn6GvZlw8CAggA +MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECNwtOc3eKItmBIIJSNZzJs9X5vLX +1PNFSOjg2bDJFXWJ4X8vtnA8g0JsK0+kGmRxg+FlWXTqAGJbm0imoE4YSQ0NXkfj +6eFtgebm2zdRRfbABJX/drZMSIDYl5Le7B/zqIeI9cO16GDEbyDam+MXD+mRt3Bk +J4JyJPCin22nAtKb+D0zHs2F/9Iwi+3IYL1awvHspfOQVwARoj9Jc0K98qtGSa9M +KikC+0LGr4zw0fOSMzrhijg5mqi8wTsYn/9u5+TkQ8cwg6cBKCGCjNOi7ml6uyC5 +LE4dYAcSkFbbRRNOuM/RYiKxFpGAFrfxUVfHI3dLjDe6DUAN18ZmLitij2WI5TcU +azfFRYMnkmI12Tu6JeKrFrhQOt4gUq1W2h5KwvKvZAikRvc1pE+X8h08S/kAwsUb +PuxgAN54myeHIGoaxG/C1ImaRoSPquKVoayJoIwDQ2kKJJ5EdXFJ56SyA1kYk4y4 +Ohv+kvk47ZAwFZnNz+Lt+22uFOnrMZobv/jKsTRfJsz0QhwmTIaB9C5QehkAeZJD +6M/JVjRWoLALcNu/S7imzbzNBS4r1ctYLv2dkakzBhR4o5Yfn4sg48p1x5EBTTre +6X3/qWH9z1vtpJsjC7vA4ACkLaz0Vb9Tb9No+Sjjp2xi6arJphMwjuZ0LPf0EuVd +wzbkRHXzpYMACuaypNaTQrNCgpR19eV98SThrf8QkyyKD0qwtzwoTmGX45FnGFWy +H8HL+lZzfpA9zzRCjqLGeTkgQJLIMP0orD9kkVYCHtUorUQPr8MIu/o45PKCZtNd +++kaTm8x+wjXYNK+cyOnyda5rj3XsMYqPnMtdg42cHu4oODEV1JH2fl8sXpuGB4A +7qsSBORrZJiPEdayT9Gsve0A6Vi7gGK+9a5WRxqS2Hlbgr6lgqUr8zX1YYi6Ace3 +d2GhEqNvyAX+6Cp9FYH7JauKtrMf40LxCNTpTmhhrhwS61nd+ka/5e8v6G05eSTA +ESbBKo+QiE2Ek1xfrfKlsc8IcBXxmPF5QQ7Gb9eGI69myPRNTv/XN4mnvA8bZF8k +KqLp3lO6Y5jGKHToooViTDX0WRApJF94oaefuUbDJpW9foaOfZpBz4yhLnY7syTd +n8LNRYbMHbFbbe5eoGhb6goHD1R24/SeKumDpzyj1HewcoYGP00toDFxijY/AA96 ++4HlKJX7JJEDvORgVEZ+tOGo1xplagrndpKnX+WsFzvuPJ3RNFifbkp7iRP1W6HJ +Gq+oZ0ewj3z4MKi0s58BgTwQENRmLEdp0G1nyYY1nuRmaq+t1IlvR0bMYhTARqcY +GAdHdwJN6MXQWFyqTQ8L9N0OuCpENposKBvdUcrSFAIALafX+vJrB0aS0ZVM5w37 +yiskAa1KMqo20XTiH9z3awnKAVZqjY0oE2BTehdK/NWgaLH82AsxFIMFmN7GCyY9 +QOIlzceqRlltJ7PsTmvDN+pRaO6KdcbtO/7hsvUgZWOs6x21JRQHUShDNB765dlE +usuEl3T72TBlTdxQ1tj4fA0RUCAF1T6B/9aW/rBsPTQIBLyJEr/78m7lBKmgQ+2i +REjuQC8NYkzLLa+fOiIO9LTjPqdSpzMCqMIbjiR1eYMJHFoP+8E2gAqKZBDOaNoI +V5tfZk+/Uz5AIYQocd1aUEQCgyf2WJLp2B5boO2lS1qXBb4YML/D2L7Udz4JU3Qk +fkSlDC4zx01XdmmbGedBCGG3npf/pCerrHcaPJUWOjMk+M1tR3Mpmmm+/yJm4Xyu +bPcvV4pEqlfBsIjLCt6xyF18vuF458yB7djtZJ3wkx9lLbpLAh/z7ywoCF7B35nQ ++kUjFBsboV+1J+9sK4bULrtYOhjxAU1P7Mpq4BbWbRWBWK9/Kz8maeCrLEW/tpnk +EureG7aZtwQz6vHyeDDQTpFVdeSFO4qFy7Pouf/VVzX/eph/6y3ZDsjYfxFiUD6z +TV9aPs8WDDcWhd+voSQlBlBB4ttspQgZhefCScu6hhW5PNVFyNm/TSHleOEBXiEf +0Ab4FeFkQ+c1GwhtvsmGLBP/2VzkkDSunO2QDbpNYGzR2Lsn56JQjeKwiTHblzRy +AwSJ4DU/V7S2K4wu9QmP2SefrBJTlbLd8VFbwAGAHDeM5Xi/TnleaQvUPGz56F5l +moaYsXbDQGlyA+PYs+CCa9rSfvppX4EwDIftDqxAzEAIbQJir4VEiPpE/CrJtUc0 +JMI6ug1Cpp1p2U38y+POyv42Awk8M3KOPUvXxQkfU7leSClLh2zCAkC1CeUGLrZU +G/Fuob5ZjjJ6I6/+3jF91Y6bDvh9e71jys6eTnYNfXs23f7uwqv7G0VqhY3AjXKs +9YS81sdBNbZIObMeXA9w2kG+RLWB5C4hpkqgoRJHDyE06Vzy7zzWLBS6AY6/f2lX +lNVUETpf7j3PU2bGry865V5eGS43lTUnsMUDVQL1OuiWLg30JUH2AP8cqQqgN+O/ +mK44RfZIrGz7o3currsobXBMNaqFqVlCRtdqEVsiRprWiGlHtLEnAh/UNVp3h4ca +s9nGo0wA9bpHqAYzyJoDKRgjj4V7vk6rDNdJeRow9v4byVOpEXBY2WX+oRWYruyR ++ArU/zAeK/6oUb4yegc25SGTZxEHlZvZs9U8Ft3SmzGDtuiS8tgMgfLe23fN8mUv +pRwRqkRmPYRZpH23MTWVBGSAos9nlP5MxA7IgclRywpINOJpNsbPbihhcjd5oBhK +ZK6eqdpYUdSWHpUdSUi3DhirYXWQA3bGjhJ/IuvGpqdXm2P9rpUArEjwuG7De7QS +t65n15oECLzVg/3vZviKSC0RkW5p+pQEbVifxu3Azs8SrUlXsilcHMTnTVGK2wG2 +Fi4ReqftHwy1JIAsMEeAQAvuR86TFaHKasw2p+/IenHo/cTAyqEJjgGeTJWjUtCK +dUavMKA5ZYIP1E5/F0/QBNVToghoDgMVV870p7QWjgLVtPVCDPx3I7JKh9GBmNR5 +0dd3JMpO9Gkk8cBGwurrr/Ak8ynRLv0MRdB/8HDp66XiHR6tBl8ZoZ4ZsnME56Bc +F2+OmOuxVThpOxPlECU8XtI37ZlSxbG0X/s5eBy2mmrVDzGQDYXC3VuEp3lrk8QV +k1KU6zxzFLXnKEhZraP78TIKhvV7tiggyTBmx1emLigMqmd7AnVseY1LRlFQgUB1 +wloOOrNW1gpIoUUMVuRjFA== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa-pss.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa-pss.key new file mode 100644 index 000000000000..a0ecda8b2c11 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa-pss.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvAIBADALBgkqhkiG9w0BAQoEggSoMIIEpAIBAAKCAQEApfv1BYcLTl09aBmW +OnwUEKxByqBZeCXLp6Ck6/plp3GgC9gtFMfSk7mImkIt8BAFWK27A0/vOFDf7SDX +tFYtlL6ZukxSgaltyEjMVMX/oqB3vMsqzDX96So4UauDlQexWORT0LcUp3IcjA8L +JrrZS6j278y3ah/Xkex56IRpfFbdqPj/p4rJMw0WFtqvINV6C2xGxeoC1/LcHM/H +WQLpeRD5PgnIwUw/dqMYtV7nfUDU5wCJLe6I0ogdgmCGrAeogldFilakPs47yU03 +/b6qWFHaj7OwGZRV51R/GChS1HdVN42nsXHiIz26KPIf8BS6O/iAZlUaS8xhw5XB +je0uIQIDAQABAoIBAAh8WZn3Pfo7JRUJ3dbOmh4CGHj5+qj8Ua2XtmbEDediFTsV +ybQ6xQa9YQD16jBQOV2/wARa1VGNPO18FNsI3tqwZd6S4VL0rQKkyiF5X+jaCFUU +E/ONvRXrDScLvDXlx0jSn4BXo8wttszoRfssaUiHclxvHF9mEljI/LCI+HWdTAys ++3l/Yn1ewwA2iFFU+ZcwgvZHXjLjRLfImTfr7oQLeolpP9sxfwb2RdQ24ifgIh9N +Yv9KzFfFJNl+2o3q6XBKqvjXYWmTam/hwXhGnFNb3LgrOwkSUIVpUJl52F/fu+BD +AdJu0ELPUNIu2Ll0fBp3Efj80vcSZqtDSJ3Bl/sCgYEA6DZQm1L1Y2tPMcX+JLtV +BKC19YRTJLI+CQsU5YnD4DN6O3a8PITfRf+SHWI9slGGs4QU0rv6NLMj4c0Vxsbk +74LQArprdw768+hLH8z3r/fAZ0QrTJZSKMuGvs4To4dHvNSdc2lYDtadDysPxkKZ +23aL3ApmCqZpHvIUndOGKV8CgYEAtvzWJd6faGWUEbQI2qI4/H2w/t4oxIgVDOeu +qCjIfw3jj9QUQrzC/ckHEJrb9ILYuzxfe92qPf9qmqHyE3aKMCN4MFIz+PdfwM7F +P3/QSriS+PdCnS0ysmHrUdJRXOsl6SYDVnCfyhU6HtL4GFO5expMesogpw2xXkYk +gYOaWH8CgYAP0SNMcSoly3lpeoMFHX19AzVhs9G1/i4bj5WszOV6sAbzZfMMbECJ +FA9v0PFC5Cq4r5Z7hDJWxJz9FGsXTxTo+5APn4MSaQLO+lOjpuJ4KfgBELOiU9rk +zHgxJvhPezd3tUPESLimyheIoPZCGuc/+6MrKcopj4w5f2PIHFBXIQKBgQCN7qTn +8LpyTj/AT4WCl8tdxNxRg93ZOrghL18gnamOKyaz+8rPTPxtvsyVC5jKGeejqxtg +xzlyJzf3wt8yS4K5/fkOeeRIGxARTBBgxXG5U1rkc10e7tzg0eSlrV1glh/srIhw +NqEqLLbNC9RVgjNfEbH6l+clzBAkUIGmV36TXwKBgQCI9r8ZYR7xGYYDTpMSbGdL +XpWuNWwgZQsvBAH+pXaE3A/36tXdggA5nZH3SA+yIoJHGiXHeM8K9LOMAbAzHhsJ +ia/yFcH7lat92/28mrxoAkHHk5oUdIcP6pcPny3cE874sh/UPG7BNKrS+h2ll21e +OFsE0r+qLh68/S0HZM1/eA== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa-scrypt.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa-scrypt.key new file mode 100644 index 000000000000..775fc9dc662c --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa-scrypt.key @@ -0,0 +1,54 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIJpTBPBgkqhkiG9w0BBQ0wQjAhBgkrBgEEAdpHBAswFAQIXPgQcyUbFcgCAkAA +AgEIAgEBMB0GCWCGSAFlAwQBKgQQAEM4E1Gom8Gno5BsBlIbbgSCCVBXC6unomo8 +RViDXg/JbarYH5GAj7PJfOHMtYVGWSuysLnoANxqBLsmxvfnzkoI6hBVkU+FJwyG +4CZodJn/q7OxuK2VYtE2LV/2QgfBfhDpBSvcfoyfFy6QfBZaIP1rfp4cDucuHxn0 +5sab/On/lw2qALw5gS63uEJQ6GoTvTgkMiRVKLi/ozqg44mn7N/Rvbx58IUexcrm +ZsFCzJBNPp8Z4fKCTi1CE+Z7BemhAzL6JvE2IHBjaGsZyr6rKOYv7u1QC2KTUyEm +FLNthxOAqCTaWGYP9cstE38fL0zE24crfOJaRd+7oZu0LwwF2R8kewSKNze7+WbZ +hbDWu4qWTdHszDeLnEJTCX/xQr5uj/c6Xp89FR8ovsTY/nnt9cEhX+x2tzjxIuR1 +pTGrJvgwL/3PS+4d/O5w7SBpSUSjU8/gPLSU+pZq87+1JRZQpiBUouwpwE96/PjO +D4iQM7BcDLYaY+f4pP/K9N3fIBr5hDH+QeArfZ5/Fy96yXijlJIm18Z6xs+aoLbe +iL3coTVUc3sF7beKDE7Y5qlVBw/pTazmcwnUxP509j/W/+WLXFf6WjucH94ZchrG +5cgi8LGtP+jnrfyoIK7lLBsT66tK3cUxjhpiiHebEQ2RpHpvutoiC933oCZ3FLQf +3TzuuhWiY3ufIZ67xXZ+i13Gwt/f1OEk0hIecGbLheHKFykA2t36c+/3WZb3niPW +wdwAzhPaX+nvrk5vsHVgdFJNrXyYwEg/ygO/F/0yXbjYUX7tKyWbb4ikhJdxjgZv +ieDC+9RIAMpcC7Ac7G4c2vNgiJlLs81apP0LGQ3n+eibCz2VJWzsWohbMXBTcDfc +a8yJMRaiOSIQlEwes5k3vs993qL9nKSGHHGe2e7PMHuVinzEgkaDHlDfIuFn1KnA +/aQGbgU8jwK8VpOkjNZllaE2bPZibgQAcgctq/yGRbxfJcmX2HBKUoca1Z0ntLDb +L4Y/hZb7b577NlWsepxfZRlVqj0KXIzTc2XrMz2U+4D5fj4+KUkk1z75gE3o8wGa +dkfRSA+LFRCyExtoMSSSxIvlaHRVsL84kkcClh0IjRViGo2708HObkPrBxk8lMaU +x7lLB0IU1ENjcqrF4rfLwh2K/b9AcOv2zcZ/zgDYEeRXEHhw48+/PzdQ8GRsSanF +GNjZC9tJ6uCP/uVOcoUoHycD21WjSjZ9naGI0nXWbIUYb6uaQtwPKmNqQElwaXaJ +y/ncQkxYDrOEoUI8fZFnX1PXHEtP9LmB/MH11RguZn6ha0onFvSMqb9ZWPWZH9FL +L7tf2jMSHOXjwCKKGugjcj+RYg21P68PUpkCeKnDTpWe62Nx0CHGuylM9UvOS9AG +O9N7XW/nzPtgoAoWnZafiE4bFea1w65OszHDFuK+k5zrF79dxb8ajJ8XCbhh+Ywc +DAhNM2jMsK0Tx2rQylFzdl+KcTMiczeTSBxV/g78uoJ2H6/pks4AHkTZ5ZSe1mkM +qt8DIVhTyV0jUwSj12Fss0yAps51k9UjrQ0iQaeJ6VCCaePRHQ1YyBJT/UyDLlBD +OPgsUnC5CeN4sFfORAAhUq3jNZ8TmQ8d4RJIaqTrI3ItMz9kiBluq6uDQMJ8a0gl +JDv2aocsar1dri7TefouEkPUwbkfw+ahlerKiQcQHmaG4V/KWyu30N0axJKXLMHY +ticksi9RzJGthbkHTCru/Rs+va5b7Tdxla8r9krRamkjxG7RtDet2czWNLJTCC0q +VZAy4iMT9NeJTgvWkOhYzWPczkNiCDGSPJkyHezK6lYRbnkBR5KITiRsIjXHsH99 +LH/77bewFdyl2mNwy/0+6p+rLGnvPX1ZhxYYoKKKTmNsddVZh2xLSczvKi7Pd/9Q +kALBSxMPdt7klPXh5BGte9WA/4DEsiyvmUwNsySCtgcMj9xiSJM3COhcs1uhmGch +uv0Znl7VSE/1Y0yKQhW91QlA6JIGAh319t1VJYcbSiOt3FoCelu4ya/JmGLNtfKF +AlMJrj1dqxO0pGwpfKHfLeC7G430TPd6ukjFwy+jrPn+LGw0Wzw5BS2fc6E2JaAd +tfLM+AUlS7I/+O371e6V1g9+55KaGWsN1K99j7W9Md64BsqvGXeJwQtG+JLkPIiv ++ETwbPe4yrcJgslZ0CDocwfLIMfv7sU8PxFXdzYz96NDSYU5HN9l6XACfBkYc5DQ +tYqdcqDXIRAOpMhviZXkNW6HnaYugHIOIfIVDo1ZoZSNnQKAHt7jvjjQ/Kb+JvMB +KfCtyJvDl19S3XhslRViEc0LrvE3xZIP91QM1SyhnqagVY142QWyB6vd/yiMjndO +Tk0bH7wWdk6DiQTBKO3QV2SWPkTy5+O4uHKPO2S2ebIEzi5btsgTkwsBtzS+bo4f +54t1RvBqg9uHUHKg/PGBX+l/TNQnk8RBVXF3U/Tct2d2W14+YT/UbvxopFNizXHn +G+kZvv3iOAACfYlGgqarZ5i/O5eiMtOBxE2iCwFq6h7LBH3R28L1pZ0U/pMBWG/n +vadGNZQ5DGd82n15ieRqXeRNlFt9+jPW3T/eHDUEIqsCEkorGLzlyNWJrtn/0WyH +yLeiKBSfyBrS/IbDCQ80kVYaFF3+m77kjpFxSN4ugyruPEXL+ofZQyzt/k9cprlr +nPun523IiG+4bMWHQn8boYEWua28R9Cyn5q9C2HZskFAvEiglyEQTfrU6/lrhhei +yZU88IL7vwc+8ajToqnNngPedRDkXlOVP/YLuoSry7oEV9Vb5PETypLEvdIwaOcZ +iTp1EKt+ZD+ryJn+D4vrhNDAGYhEDEPiQY9nHC6/w1/O/oAmbhwiqChSxTXecw2m +KWZflrm53t0S1NsEvmzWKo5QgJlLbeMO/o9HE4xy1gLINXQQYDUBV4IVjYxsIRYd +3TERnB5bmL3Efsa+rKXmYy2zNg+RVl5iK56K3mSlCo4dD0yAYT/tD7lX8brCCahz +O35C+rkwdCIRr6CgCTRStqxJjndC+uyn7/SxfNMc57Mdb87UjO2DHiLAr4OUoq0+ +uOmNwygqpe7kzCD1q2AdueMCII5aaqVpVtJ//r+0iswlRaciWj/VMfTqTQDweSvw +w2gQo//1NRalhDYYWzr0PfggIIcEhQfXfPCk2kG/6mCBfXKRvBm9+WrQkKS6zdJ4 +oDEneepILtLCVoJewFPvdkpnL1xcdjveuw== +-----END ENCRYPTED PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa.key new file mode 100644 index 000000000000..fc4a4c7b8393 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/rsa.key @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCb/Jbg0D7zw7IF +DBzn/KZ0kjPf+vkOaZOxNG/PosID2/+OKHK9oXgnZcVbEtvJgR4KKjc4nrSMFtFa +BbwsvJWxUEqGjLQ5WahSe04R2yZ4LViGbFuBOHAWq9qtxRyDdkghrQvNy8cOr53K +O8/UAOJCgkYr7x562QLEQ+FUvpGqID2xWI5TUxVezmHdU/sZF8bRyH7TtEZ5zMqZ +Lt2hjD8CrzFt9aMv2eBldX8c2YTi1/3YPKi8mos21jsyRFa8gPeyi/TnKfA5mows +DWxCN2dvOw3ynKapFQV1QZief7KRxw3FGnUOdUfw/FqfpddZK7TJ3/AoaM6oNHy5 +aAqcVMqPqb4ZC0eO1R6+xIA4SoZBD+ZTJC2khoVQRRwfRyKQJpp9eWJ9+SOGCkCY +r+yZbcvGAuz7Y8SPp3kUWZwflofRCeE3p77U+icKkppkkmEJIb1iMm6qYoTjc5M/ +wTpI5qeQmGaftzz4dlWafTAbHT2jbwvSMgYFQQvW4RyV8Iu95PYl6aUg12mXwv6a +pYf0QuOPGCMP4UzfLfFTYDniS+34aaWkl77Lzmw98BRHa2Xjmn+iGQcHYjKvh7FM +bRBiFxcSEWjkh+mgDypV+8mqS6FOPC7WeCNvt1XGIRoKnlF4OarZjdI5KP9wKtV5 +hhx6GQpeuZSWyTBLKbVIsuUiGG2VxwIDAQABAoICAD24HM7JNw9mkCqVF17nRcl8 +C9CE0kTUm16TO+ZxJMk4JA7QjE3h9NPJ3ePiO1qonwUwnPbnPNLtOFqhSEp/N8+X +0FUamTjT89jm9wXzq24DqzJM74vak+c0imsVQen2RCYm/TOpfJKgBBP/xITC8MOW +HkPF8k5zTTfxD9hjKumgpihkvLPVfPAtQuW7E/BiywU4io4jl3sb/9HKjGEeR9Q9 +E5bJiY8mazZZ3jjBDGZhRgxoO++cSpcg/v0tsxAVC2z3GajZnDZ+oxXPHdW5bFDD +kgo712mxap5xnPyh1DsAAr/JbyWQXC3K++SNTv72Xys9Ux36EkLVub/2nbQrjJXb +Vc6eoJRpoeXwvfeqnJOaRUWqluSxqhxI7ngLtVxTAAM79H0GBdAEaB5DvU20zdu8 +7k3ggJ9Xoyu19KiCsC6L+Odix+vTyv+QmIQBGHB4Ts/4YrKMLF49HWpo2qjV9Zef +bCKjjzz8VrFk5FyFWJQk8o0P9NLn6+epD7n/ndjeUWy04pLc9i3ya7wmojZZbWKE +UpwcruX/el7A8t7cQjMKHO8/tzFVPsI7o2osqvfY/sZRBWuDe3iHgY40ROwvUvjr +6k6qwIHPmJqgywmMbv0KD+nnjGqIYThxuvh1n9gp/JlI/QWOs26Mvwk+QFMbA+6g +XfihMLpzLXWY+Z/7uT0ZAoIBAQDIFiDO/Z2VRS+vNlYOAAEYP0amVTH6Isza3bZe +O3nvC47Gj4/vcxJQdrMHEtI2/geLXDv9jexox8YvcxQ6KeJVPSNRFVHGIEWLUK29 +pEzPZDUl3xYFl/WTHLn6gxV7uqxO+Xz5TTCaMRCssbz69QZPryfdIZZ1+WXtKX6s +paRhwwizln9c7vHoN4lPO51Dk1iP6JqcJZdRzPXHSjYSBnuapWBy62+rkHQBbOFn +yv7WzhnbOEYM8GlvteDNH4xG0gcT4G81dOtGw4frtfpphU8k0Vy3LypjlVQr1Smd +dZdbC9TT8kC2hyB3saCp9vQUc1U48CHHW7BGBYTSyaRosndrAoIBAQDHk6IQuF1A +OM/FNwD2nao8I2bOJEYyPgaPFv/lUytC5fmCUuU/FKBdyW+0wtIQDxp/zG2Mq9L0 +le0E/L4WI1Zz4jt0tef7qDLm4tadK9foU4vFuFpfwnvgP8uAgzxgK45CTQU09X3N +PRfw4Jp6BK1giEqLhuxXrQvhTocswnIgB2s4LUv6g2LEGpyfXCLBoiyBNTYpxHYq +3E4VtOycxniwUWnR+PQOt9GwIDpjKHzZMHfEOOrOyac85N1s1JDxC1s5XftPII79 +jNxTDeN7O/BP1eEQN1U5Qbw36cjrNzgxNzK3L8NqZP0YlSHpm1s816Am0+TM0oF6 +mKV0VCYYcd4VAoIBAEWPa9iKUz6RzwIa4c/8MGU9mlI5TCap8o4khkI8ayev3PMq +9d9JIhTXL2ZGJM75gaXxaum7bXT//uaAG4gdB5KarqyBvOwkTAkjA0Pq2sk/DTsd +U4qeScHbOszcxZs+SqkqE0iYjU0Nwb5IDGsyw/7v5ev6wVRCYC0TP/bFn2BdbakB +qUWlzHPu2s2w6/uSPjfJpfajGvhVSRz/r8yUdGRPGjjZoPkEP1A/ih2LdQ04mcSc +y72z1vP/RygIz7vPSKagYAk1nJX9ZEOOAICu19T09Ea7HwF/6MNUWCNlvjjo5BTL +I7RRRfhWyIROVozFi9s/oH6uYZn2UTb24zGC2gECggEBALiIfECDh82a+hm7Cwv8 +qmwiu6r9hV5tVXk25fNv3D9mDzd+WHPkKYeuergjr0GkBXeHWP/J3CvE+Lw0yboE +gKpz00/N5qsdUbuEoLYA1Qj/PuzZ0c5bMFkgA5VXQxsVCtupBZh7KQ/9XkaeFped +/YWVX3/1iFBlM+fmyTwMqqOM2Im/8FG47Diw9oKvGX/66LWrsuIZwr1MqHKPsHwh +U3SMQpEgZOG6+4qjsfj/dbkIhKUNj6cWc6jtYQOA5GfMfVPk3zrBuxUcCphM7jqD +KGdZNlndH9LqQhNc+ibrDu0Kwbz5z/FvYUo6knnC6TCvm2hrYlI0jf4CaHHQYM0X +dCUCggEACvTEoQ7gZMeaqr+j8fhsisLoRRCtslqoU27jqWTriISlnlvjNHqYOWb/ +JXinuvpiYZG5jih6KXxa26H+Q5Pb4amVNPq/d6qBu5yv9qpD3mCJaHNHPByLScZ9 +G+pBW+y5JXHCdFJjo6G4ipLLpPglAPte/TmEnoShGsxtgOmupYSliNteAz0ykvSv +At+UfdzdSY2uHC7JLnJjB7SeOz8YeXyE8KCBOAokxCjs0CdBeZDK46sti9umMuIr +cDVIk/azvt5ex5sXP944Ds7tUs/qS1bdm5DsG4XYBkSKRhNqlkdxLumMPnGcwsZC +JSRSgO3qryi1B/PjFld2fmtKpkffCw== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp224r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp224r1.key new file mode 100644 index 000000000000..8c74cd9783d8 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp224r1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MHgCAQAwEAYHKoZIzj0CAQYFK4EEACEEYTBfAgEBBByDAgBh6UOQqYJSPoiNWrK0 +rA0rTMLw8JdCEveBoTwDOgAEABwjlgBV9PPpMfo8fo6yWRdT+sb1cUdEhobd+V/D +/i58cWpDqd4CApevJWtkGbwhU4J9mN0aYrk= +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp256k1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp256k1.key new file mode 100644 index 000000000000..05ab7d4dd065 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp256k1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgAjoYh3zy6gJciB7F/pHi +fU+IfPBeEhgQBFT3zNvox5ihRANCAATTIv3AIcnOXMvnURBseRspHsowmPAxPgsx +LH5+aU2mW06f2PsIe9F8gG/Nf2UOOuO+aqwEStIkfSBR+Fwpl2UR +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp256r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp256r1.key new file mode 100644 index 000000000000..2ff386caba17 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp256r1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgSFp08cP6os9Fxmky +o5VFi6woYEqvbhVNYTp9NvwzBCChRANCAAQo6UQaiHkZr7lxrKDZyL9Qinr4Vy0Q +W3K2EPFYbVIupvzW0RH8vBy+0/yoaNyUsw/IsmBO+A60mhBB4rTjmq6R +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp384r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp384r1.key new file mode 100644 index 000000000000..f662e85f76c6 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp384r1.key @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDCqdZTmuPvhbOVI/Vkk +yjowWmBb1+81m+ay2QF15TZns1iX4HQlaOZ1GzaqhJRS0R2hZANiAASYw9dep7R9 +IoC8Dzt6T0NYOOJE/TPdOXOH+M6uJvKAtmXGalFeLQX6HKlUDNPnBDTKp9p6Nu/o +2k/p2C9m0DaX70sNuyfOmh738Bw2Hlz3If+903Jj+hKSR4kWDkKYb/s= +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp521r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp521r1.key new file mode 100644 index 000000000000..e987b65b0e03 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/secp521r1.key @@ -0,0 +1,8 @@ +-----BEGIN PRIVATE KEY----- +MIHuAgEAMBAGByqGSM49AgEGBSuBBAAjBIHWMIHTAgEBBEIAdO/4HyMRu7/QcjYn +f8vynFJRVOKHVVmRFrAzZwkdusoqf9gkicCxcxhOpOGLezzTH4XBynbcmmMn4PNS +ZriTYO6hgYkDgYYABAAp8YOO/QeQoVEdzsOwZt1ta0/b5r0ESM/QNkBVgrRdCsJ+ +y3p/xis4wFlhv7lsrtuDoeuMimnvl+fAfptCzMKHugGBvSE0SjLgydEmUjh/y/a4 +O3cGqwUXnnxiLKJ98NFaooGYY+AwH4h77oCbQR1lf8jhe1qsJkR9mXpYuGnkaJ7l +qg== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/x25519.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/x25519.key new file mode 100644 index 000000000000..affde0dce116 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/x25519.key @@ -0,0 +1,3 @@ +-----BEGIN PRIVATE KEY----- +MC4CAQAwBQYDK2VuBCIEINAdGSXck38nDXMgbRKqKiBPVuxDirhOs9VDE+NaokZz +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/x448-aes-256-cbc.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/x448-aes-256-cbc.key new file mode 100644 index 000000000000..bb6e86a68f58 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/x448-aes-256-cbc.key @@ -0,0 +1,6 @@ +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIGrMFcGCSqGSIb3DQEFDTBKMCkGCSqGSIb3DQEFDDAcBAjrmjUn6y1PFwICCAAw +DAYIKoZIhvcNAgkFADAdBglghkgBZQMEASoEEJuU2Lvx741TqKFa9X8bRGkEUPYI +SNtLGe+fIcgz7rF8YaTnA0oeMsRp4RxBw/fsaEGrHUTM1ddjuyRzdKKNnghZIs0w +zy/O8QNXDzrss5bnxZyHZA2XEvftHTH1Mw9jCtwA +-----END ENCRYPTED PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/x448.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/x448.key new file mode 100644 index 000000000000..04b53654134e --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/pkcs8/x448.key @@ -0,0 +1,4 @@ +-----BEGIN PRIVATE KEY----- +MEYCAQAwBQYDK2VvBDoEOFRfvQhj134qZjH0wDbmPc90BADiqrpGZSae/sd8GG84 +au0ISBY6I7BJJZdiLLED+0abd0hLYAyl +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP256r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP256r1.key new file mode 100644 index 000000000000..d17b664d739e --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP256r1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGIAgEAMBQGByqGSM49AgEGCSskAwMCCAEBBwRtMGsCAQEEIBfCkWEWyc2tHIvS +Ao6hhcj09dnh8NOmtZeqGmcXHnIqoUQDQgAElux3elmSzb/WqEZXb1vdXx/tcIpC +Yq2vewG8H1SikMoACeFVRcjuy31gJ4Q8M7UQmrR4+WXSptV/UQ6Gkt3XuQ== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP256t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP256t1.key new file mode 100644 index 000000000000..2ef7cc4194e7 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP256t1.key @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHgCAQEEIILhgc3joEZDWMDm9TYgrENN7gbqtMpMw1e2MTLwlJhCoAsGCSskAwMC +CAEBCKFEA0IABIgzdtCT/Dvc0iuOrT+jJFyTzQH8jSENIToHEP/xcOVdMoklPgTx +ng6CA7FvC5xJUtYSGVqtCVUDWYHuXotm7IU= +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP320r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP320r1.key new file mode 100644 index 000000000000..e1bd06c2793b --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP320r1.key @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIGiAgEAMBQGByqGSM49AgEGCSskAwMCCAEBCQSBhjCBgwIBAQQoNifTnb4a5dOR +yr8QFVM7Zkw/f/AMm5T5PQ6iVTCzrnw/kZ8glwl+JKFUA1IABHSnWUC/tKXpNHGE +P89QVKEgvetwCQWFoOENAgXORniLiaLdAdsR80ouTsZiFgHG9su0l5ESEnFWQr5x +UMj/vPwwhSYm+YP5ucx5NezuBM4d +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP320t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP320t1.key new file mode 100644 index 000000000000..17e60c9549cd --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP320t1.key @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGQAgEBBCi0aeKsFfr17MTtr3IgFByp4IybuFzlgAbwPjf3rK0Fr/b87+WicOU6 +oAsGCSskAwMCCAEBCqFUA1IABDQHDepa3l/S8Gt9WrNCNpCPZNBXvmkGPnVXZchZ +I5BtUySwYxHX1tpatGs3jY7drVYm+NyxZE81pecYTvXR8bu7e3BIp2SwZmXEDxdY +p1fw +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP384r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP384r1.key new file mode 100644 index 000000000000..c248a0f0d448 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP384r1.key @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIG6AgEAMBQGByqGSM49AgEGCSskAwMCCAEBCwSBnjCBmwIBAQQwK6y6NydLMTNm +LhDNPyTDKEemTWTUuMGfBQxEz+lQKAqz/So4uA+fQzor/t8to+uioWQDYgAEaK8X +3KCyRDMpbACw2xG4UUe9OxyuGWFaGKPxhKJDyW5Z56gT5P1Q2y4CblL/X9VcDIMX +dcQqRNBkPQfy1+fJXwKO0ClfD6MIE3bv6PTZ55J6H2H1dpg38a2soRchz0FN +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP384t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP384t1.key new file mode 100644 index 000000000000..39a94e293b32 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP384t1.key @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGoAgEBBDAEZRoS9O2fGbx85aPZzZxfj33Wu8aZ8a+K5ZZBFuVKKL+/0UbidDhD +YiuAHL6GAr2gCwYJKyQDAwIIAQEMoWQDYgAEQL0dQoOTArIx70V/XxipoxxBeKT7 +zmIe7id5pQiw4O4nA2S2BFxQF9eW9ipnm6DaN6jaX/+2k+cC4qIfqzeLcLUFXxz0 +qdec8lNNtr9QmwoQlv11beeHmQu9C1GwHmvG +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP512r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP512r1.key new file mode 100644 index 000000000000..790b619c365c --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP512r1.key @@ -0,0 +1,7 @@ +-----BEGIN PRIVATE KEY----- +MIHsAgEAMBQGByqGSM49AgEGCSskAwMCCAEBDQSB0DCBzQIBAQRAmEQNFMGIDLoj +Ktdg8V71WdSs7FiBkE6Bft25+yY8ohugk/u8aKeIKNVtSirMgQhGFJy/BIBkvM6V +1JfnrglkjqGBhQOBggAEYbjTnA0x42NdM7jVv7jAoZq0iOYopbwejlOEsx8/MqRa +Yt4Ef83holIsgOHWSeW+kw1oMDmieoCrhnkM/3KgGzV+BxCeieAWGxABsj9YhAmb +ATorRJ4q/pMxRq8gIUv05/dGuUttl1gdbKKnGQjxDBM4v5H+/4z00nzzj4Gbfx8= +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP512t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP512t1.key new file mode 100644 index 000000000000..eedbcdb4b81c --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/brainpoolP512t1.key @@ -0,0 +1,7 @@ +-----BEGIN EC PRIVATE KEY----- +MIHaAgEBBEBNqbJnTzwGwg9JyyXBrQjXF8LT/q53Jydyv6L9AgU5c2vg5CJVvgoL +8JL/YU+i1UwVIdl8JLZuCLpi+Dcy1rlIoAsGCSskAwMCCAEBDqGBhQOBggAEm/uI +qsytMZypsqCuL0jwZh8xCRVEkUd02YPXcOBhMzS9bhAao4CLAuXhWzplr5qk/7tt +vczl7qFDOvBzNAIieZHwbFrouZ6Pew8pQXRcMDB+FnXwNgpljTNmz/f1ePjVKU1Z +gbQ+xVf8Qt8OI9S0Pla8siTgbVweGMLtq0A8Wuo= +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/prime256v1-aes-128-cbc.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/prime256v1-aes-128-cbc.key new file mode 100644 index 000000000000..ccecc24707e1 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/prime256v1-aes-128-cbc.key @@ -0,0 +1,8 @@ +-----BEGIN EC PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,3F26BBC4C7A6F3B5B3A5C03C7CC59B33 + +rp4qC+n+qIG+WKJp4BHQHk5z0oraaaLZvoVK5glESGx5IcR3mCsN7tdg2aZ7yEk+ +HnT4nQuM3R5pv248cmK0xDUje8N7FLe8lixVnEyQx3JdZfGdauowt9yaxL3AJypX +idWxNrxz1xff5RSMI6+PFv2SQpG0l794EpOjZxOUABM= +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/prime256v1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/prime256v1.key new file mode 100644 index 000000000000..775a7a0fcacf --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/prime256v1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQguc9upTMQn8b+loAx +6c8q20dHYBf3V9374I3kJIDmC1ShRANCAARnLuOxL7n7Gq12zd9vq2neAv6PYc1h +W6M2gJKSbfFYGhte382jOJ2TgwaTQL/J5IPSfuJKkmAPBIl8CdJKWlwA +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp224r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp224r1.key new file mode 100644 index 000000000000..8c74cd9783d8 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp224r1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MHgCAQAwEAYHKoZIzj0CAQYFK4EEACEEYTBfAgEBBByDAgBh6UOQqYJSPoiNWrK0 +rA0rTMLw8JdCEveBoTwDOgAEABwjlgBV9PPpMfo8fo6yWRdT+sb1cUdEhobd+V/D +/i58cWpDqd4CApevJWtkGbwhU4J9mN0aYrk= +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp256k1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp256k1.key new file mode 100644 index 000000000000..05ab7d4dd065 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp256k1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgAjoYh3zy6gJciB7F/pHi +fU+IfPBeEhgQBFT3zNvox5ihRANCAATTIv3AIcnOXMvnURBseRspHsowmPAxPgsx +LH5+aU2mW06f2PsIe9F8gG/Nf2UOOuO+aqwEStIkfSBR+Fwpl2UR +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp256r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp256r1.key new file mode 100644 index 000000000000..2ff386caba17 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp256r1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgSFp08cP6os9Fxmky +o5VFi6woYEqvbhVNYTp9NvwzBCChRANCAAQo6UQaiHkZr7lxrKDZyL9Qinr4Vy0Q +W3K2EPFYbVIupvzW0RH8vBy+0/yoaNyUsw/IsmBO+A60mhBB4rTjmq6R +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp384r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp384r1.key new file mode 100644 index 000000000000..f662e85f76c6 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp384r1.key @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDCqdZTmuPvhbOVI/Vkk +yjowWmBb1+81m+ay2QF15TZns1iX4HQlaOZ1GzaqhJRS0R2hZANiAASYw9dep7R9 +IoC8Dzt6T0NYOOJE/TPdOXOH+M6uJvKAtmXGalFeLQX6HKlUDNPnBDTKp9p6Nu/o +2k/p2C9m0DaX70sNuyfOmh738Bw2Hlz3If+903Jj+hKSR4kWDkKYb/s= +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp521r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp521r1.key new file mode 100644 index 000000000000..e987b65b0e03 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/sec1/secp521r1.key @@ -0,0 +1,8 @@ +-----BEGIN PRIVATE KEY----- +MIHuAgEAMBAGByqGSM49AgEGBSuBBAAjBIHWMIHTAgEBBEIAdO/4HyMRu7/QcjYn +f8vynFJRVOKHVVmRFrAzZwkdusoqf9gkicCxcxhOpOGLezzTH4XBynbcmmMn4PNS +ZriTYO6hgYkDgYYABAAp8YOO/QeQoVEdzsOwZt1ta0/b5r0ESM/QNkBVgrRdCsJ+ +y3p/xis4wFlhv7lsrtuDoeuMimnvl+fAfptCzMKHugGBvSE0SjLgydEmUjh/y/a4 +O3cGqwUXnnxiLKJ98NFaooGYY+AwH4h77oCbQR1lf8jhe1qsJkR9mXpYuGnkaJ7l +qg== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/test-cert-chain.pem b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/test-cert-chain.pem similarity index 100% rename from spring-boot-project/spring-boot/src/test/resources/test-cert-chain.pem rename to spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/test-cert-chain.pem diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/test-cert.pem b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/test-cert.pem new file mode 100644 index 000000000000..245cf8f8f86a --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/test-cert.pem @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDqzCCApOgAwIBAgIIFMqbpqvipw0wDQYJKoZIhvcNAQELBQAwbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDAgFw0yMzA1MDUxMTI2NThaGA8yMTIzMDQxMTExMjY1OFowbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPwHWxoE3xjRmNdD ++m+e/aFlr5wEGQUdWSDD613OB1w7kqO/audEp3c6HxDB3GPcEL0amJwXgY6CQMYu +sythuZX/EZSc2HdilTBu/5T+mbdWe5JkKThpiA0RYeucQfKuB7zv4ypioa4wiR4D +nPsZXjg95OF8pCzYEssv8wT49v+M3ohWUgfF0FPlMFCSo0YVTuzB1mhDlWKq/jhQ +11WpTmk/dQX+l6ts6bYIcJt4uItG+a68a4FutuSjZdTAE0f5SOYRBpGH96mjLwEP +fW8ZjzvKb9g4R2kiuoPxvCDs1Y/8V2yvKqLyn5Tx9x/DjFmOi0DRK/TgELvNceCb +UDJmhXMCAwEAAaNPME0wHQYDVR0OBBYEFMBIGU1nwix5RS3O5hGLLoMdR1+NMCwG +A1UdEQQlMCOCCWxvY2FsaG9zdIcQAAAAAAAAAAAAAAAAAAAAAYcEfwAAATANBgkq +hkiG9w0BAQsFAAOCAQEAhepfJgTFvqSccsT97XdAZfvB0noQx5NSynRV8NWmeOld +hHP6Fzj6xCxHSYvlUfmX8fVP9EOAuChgcbbuTIVJBu60rnDT21oOOnp8FvNonCV6 +gJ89sCL7wZ77dw2RKIeUFjXXEV3QJhx2wCOVmLxnJspDoKFIEVjfLyiPXKxqe/6b +dG8zzWDZ6z+M2JNCtVoOGpljpHqMPCmbDktncv6H3dDTZ83bmLj1nbpOU587gAJ8 +fl1PiUDyPRIl2cnOJd+wCHKsyym/FL7yzk0OSEZ81I92LpGd/0b2Ld3m/bpe+C4Z +ILzLXTnC6AhrLcDc9QN/EO+BiCL52n7EplNLtSn1LQ== +-----END CERTIFICATE----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/test-key.pem b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/test-key.pem new file mode 100644 index 000000000000..ebdcf202f31a --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/ssl/pem/test-key.pem @@ -0,0 +1,59 @@ +Bag Attributes + friendlyName: test-alias + localKeyID: 54 69 6D 65 20 31 36 38 33 32 38 36 31 31 34 30 37 31 +Key Attributes: +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQD8B1saBN8Y0ZjX +Q/pvnv2hZa+cBBkFHVkgw+tdzgdcO5Kjv2rnRKd3Oh8Qwdxj3BC9GpicF4GOgkDG +LrMrYbmV/xGUnNh3YpUwbv+U/pm3VnuSZCk4aYgNEWHrnEHyrge87+MqYqGuMIke +A5z7GV44PeThfKQs2BLLL/ME+Pb/jN6IVlIHxdBT5TBQkqNGFU7swdZoQ5Viqv44 +UNdVqU5pP3UF/perbOm2CHCbeLiLRvmuvGuBbrbko2XUwBNH+UjmEQaRh/epoy8B +D31vGY87ym/YOEdpIrqD8bwg7NWP/Fdsryqi8p+U8fcfw4xZjotA0Sv04BC7zXHg +m1AyZoVzAgMBAAECggEAfEqiZqANaF+BqXQIb4Dw42ZTJzWsIyYYnPySOGZRoe5t +QJ03uwtULYv34xtANe1DQgd6SMyc46ugBzzjtprQ3ET5Jhn99U6kdcjf+dpf85dO +hOEppP0CkDNI39nleinSfh6uIOqYgt/D143/nqQhn8oCdSOzkbwT9KnWh1bC9T7I +vFjGfElvt1/xl88qYgrWgYLgXaencNGgiv/4/M0FNhiHEGsVC7SCu6kapC/WIQpE +5IdV+HR+tiLoGZhXlhqorY7QC4xKC4wwafVSiFxqDOQAuK+SMD4TCEv0Aop+c+SE +YBigVTmgVeJkjK7IkTEhKkAEFmRF5/5w+bZD9FhTNQKBgQD+4fNG1ChSU8RdizZT +5dPlDyAxpETSCEXFFVGtPPh2j93HDWn7XugNyjn5FylTH507QlabC+5wZqltdIjK +GRB5MIinQ9/nR2fuwGc9s+0BiSEwNOUB1MWm7wWL/JUIiKq6sTi6sJIfsYg79zco +qxl5WE94aoINx9Utq1cdWhwJTQKBgQD9IjPksd4Jprz8zMrGLzR8k1gqHyhv24qY +EJ7jiHKKAP6xllTUYwh1IBSL6w2j5lfZPpIkb4Jlk2KUoX6fN81pWkBC/fTBUSIB +EHM9bL51+yKEYUbGIy/gANuRbHXsWg3sjUsFTNPN4hGTFk3w2xChCyl/f5us8Lo8 +Z633SNdpvwKBgQCGyDU9XzNzVZihXtx7wS0sE7OSjKtX5cf/UCbA1V0OVUWR3SYO +J0HPCQFfF0BjFHSwwYPKuaR9C8zMdLNhK5/qdh/NU7czNi9fsZ7moh7SkRFbzJzN +OxbKD9t/CzJEMQEXeF/nWTfsSpUgILqqZtAxuuFLbAcaAnJYlCKdAumQgQKBgQCK +mqjJh68pn7gJwGUjoYNe1xtGbSsqHI9F9ovZ0MPO1v6e5M7sQJHH+Fnnxzv/y8e8 +d6tz8e73iX1IHymDKv35uuZHCGF1XOR+qrA/KQUc+vcKf21OXsP/JtkTRs1HLoRD +S5aRf2DWcfvniyYARSNU2xTM8GWgi2ueWbMDHUp+ZwKBgA/swC+K+Jg5DEWm6Sau +e6y+eC6S+SoXEKkI3wf7m9aKoZo0y+jh8Gas6gratlc181pSM8O3vZG0n19b493I +apCFomMLE56zEzvyzfpsNhFhk5MBMCn0LPyzX6MiynRlGyWIj0c99fbHI3pOMufP +WgmVLTZ8uDcSW1MbdUCwFSk5 +-----END PRIVATE KEY----- +Bag Attributes + friendlyName: test-alias + localKeyID: 54 69 6D 65 20 31 36 38 33 32 38 36 31 31 34 30 37 31 +subject=C = US, ST = California, L = Palo Alto, O = VMware, OU = Spring, CN = localhost +issuer=C = US, ST = California, L = Palo Alto, O = VMware, OU = Spring, CN = localhost +-----BEGIN CERTIFICATE----- +MIIDqzCCApOgAwIBAgIIFMqbpqvipw0wDQYJKoZIhvcNAQELBQAwbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDAgFw0yMzA1MDUxMTI2NThaGA8yMTIzMDQxMTExMjY1OFowbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPwHWxoE3xjRmNdD ++m+e/aFlr5wEGQUdWSDD613OB1w7kqO/audEp3c6HxDB3GPcEL0amJwXgY6CQMYu +sythuZX/EZSc2HdilTBu/5T+mbdWe5JkKThpiA0RYeucQfKuB7zv4ypioa4wiR4D +nPsZXjg95OF8pCzYEssv8wT49v+M3ohWUgfF0FPlMFCSo0YVTuzB1mhDlWKq/jhQ +11WpTmk/dQX+l6ts6bYIcJt4uItG+a68a4FutuSjZdTAE0f5SOYRBpGH96mjLwEP +fW8ZjzvKb9g4R2kiuoPxvCDs1Y/8V2yvKqLyn5Tx9x/DjFmOi0DRK/TgELvNceCb +UDJmhXMCAwEAAaNPME0wHQYDVR0OBBYEFMBIGU1nwix5RS3O5hGLLoMdR1+NMCwG +A1UdEQQlMCOCCWxvY2FsaG9zdIcQAAAAAAAAAAAAAAAAAAAAAYcEfwAAATANBgkq +hkiG9w0BAQsFAAOCAQEAhepfJgTFvqSccsT97XdAZfvB0noQx5NSynRV8NWmeOld +hHP6Fzj6xCxHSYvlUfmX8fVP9EOAuChgcbbuTIVJBu60rnDT21oOOnp8FvNonCV6 +gJ89sCL7wZ77dw2RKIeUFjXXEV3QJhx2wCOVmLxnJspDoKFIEVjfLyiPXKxqe/6b +dG8zzWDZ6z+M2JNCtVoOGpljpHqMPCmbDktncv6H3dDTZ83bmLj1nbpOU587gAJ8 +fl1PiUDyPRIl2cnOJd+wCHKsyym/FL7yzk0OSEZ81I92LpGd/0b2Ld3m/bpe+C4Z +ILzLXTnC6AhrLcDc9QN/EO+BiCL52n7EplNLtSn1LQ== +-----END CERTIFICATE----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/client/test.jks b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/client/test.jks new file mode 100644 index 000000000000..74279d80fbac Binary files /dev/null and b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/client/test.jks differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/embedded/jetty/test.jks b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/embedded/jetty/test.jks new file mode 100644 index 000000000000..74279d80fbac Binary files /dev/null and b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/embedded/jetty/test.jks differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/embedded/netty/test.jks b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/embedded/netty/test.jks new file mode 100644 index 000000000000..74279d80fbac Binary files /dev/null and b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/embedded/netty/test.jks differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/embedded/tomcat/test.jks b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/embedded/tomcat/test.jks new file mode 100644 index 000000000000..74279d80fbac Binary files /dev/null and b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/embedded/tomcat/test.jks differ diff --git a/spring-boot-project/spring-boot/src/test/resources/restricted.jks b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/embedded/undertow/restricted.jks similarity index 100% rename from spring-boot-project/spring-boot/src/test/resources/restricted.jks rename to spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/embedded/undertow/restricted.jks diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/embedded/undertow/test.jks b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/embedded/undertow/test.jks new file mode 100644 index 000000000000..74279d80fbac Binary files /dev/null and b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/embedded/undertow/test.jks differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/result/view/template.html b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/result/view/template.html deleted file mode 100644 index fa22264e2356..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/result/view/template.html +++ /dev/null @@ -1 +0,0 @@ -Hello {{World}} diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/server/test-cert.pem b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/server/test-cert.pem new file mode 100644 index 000000000000..245cf8f8f86a --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/server/test-cert.pem @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDqzCCApOgAwIBAgIIFMqbpqvipw0wDQYJKoZIhvcNAQELBQAwbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDAgFw0yMzA1MDUxMTI2NThaGA8yMTIzMDQxMTExMjY1OFowbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPwHWxoE3xjRmNdD ++m+e/aFlr5wEGQUdWSDD613OB1w7kqO/audEp3c6HxDB3GPcEL0amJwXgY6CQMYu +sythuZX/EZSc2HdilTBu/5T+mbdWe5JkKThpiA0RYeucQfKuB7zv4ypioa4wiR4D +nPsZXjg95OF8pCzYEssv8wT49v+M3ohWUgfF0FPlMFCSo0YVTuzB1mhDlWKq/jhQ +11WpTmk/dQX+l6ts6bYIcJt4uItG+a68a4FutuSjZdTAE0f5SOYRBpGH96mjLwEP +fW8ZjzvKb9g4R2kiuoPxvCDs1Y/8V2yvKqLyn5Tx9x/DjFmOi0DRK/TgELvNceCb +UDJmhXMCAwEAAaNPME0wHQYDVR0OBBYEFMBIGU1nwix5RS3O5hGLLoMdR1+NMCwG +A1UdEQQlMCOCCWxvY2FsaG9zdIcQAAAAAAAAAAAAAAAAAAAAAYcEfwAAATANBgkq +hkiG9w0BAQsFAAOCAQEAhepfJgTFvqSccsT97XdAZfvB0noQx5NSynRV8NWmeOld +hHP6Fzj6xCxHSYvlUfmX8fVP9EOAuChgcbbuTIVJBu60rnDT21oOOnp8FvNonCV6 +gJ89sCL7wZ77dw2RKIeUFjXXEV3QJhx2wCOVmLxnJspDoKFIEVjfLyiPXKxqe/6b +dG8zzWDZ6z+M2JNCtVoOGpljpHqMPCmbDktncv6H3dDTZ83bmLj1nbpOU587gAJ8 +fl1PiUDyPRIl2cnOJd+wCHKsyym/FL7yzk0OSEZ81I92LpGd/0b2Ld3m/bpe+C4Z +ILzLXTnC6AhrLcDc9QN/EO+BiCL52n7EplNLtSn1LQ== +-----END CERTIFICATE----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/server/test-key.pem b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/server/test-key.pem new file mode 100644 index 000000000000..ebdcf202f31a --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/server/test-key.pem @@ -0,0 +1,59 @@ +Bag Attributes + friendlyName: test-alias + localKeyID: 54 69 6D 65 20 31 36 38 33 32 38 36 31 31 34 30 37 31 +Key Attributes: +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQD8B1saBN8Y0ZjX +Q/pvnv2hZa+cBBkFHVkgw+tdzgdcO5Kjv2rnRKd3Oh8Qwdxj3BC9GpicF4GOgkDG +LrMrYbmV/xGUnNh3YpUwbv+U/pm3VnuSZCk4aYgNEWHrnEHyrge87+MqYqGuMIke +A5z7GV44PeThfKQs2BLLL/ME+Pb/jN6IVlIHxdBT5TBQkqNGFU7swdZoQ5Viqv44 +UNdVqU5pP3UF/perbOm2CHCbeLiLRvmuvGuBbrbko2XUwBNH+UjmEQaRh/epoy8B +D31vGY87ym/YOEdpIrqD8bwg7NWP/Fdsryqi8p+U8fcfw4xZjotA0Sv04BC7zXHg +m1AyZoVzAgMBAAECggEAfEqiZqANaF+BqXQIb4Dw42ZTJzWsIyYYnPySOGZRoe5t +QJ03uwtULYv34xtANe1DQgd6SMyc46ugBzzjtprQ3ET5Jhn99U6kdcjf+dpf85dO +hOEppP0CkDNI39nleinSfh6uIOqYgt/D143/nqQhn8oCdSOzkbwT9KnWh1bC9T7I +vFjGfElvt1/xl88qYgrWgYLgXaencNGgiv/4/M0FNhiHEGsVC7SCu6kapC/WIQpE +5IdV+HR+tiLoGZhXlhqorY7QC4xKC4wwafVSiFxqDOQAuK+SMD4TCEv0Aop+c+SE +YBigVTmgVeJkjK7IkTEhKkAEFmRF5/5w+bZD9FhTNQKBgQD+4fNG1ChSU8RdizZT +5dPlDyAxpETSCEXFFVGtPPh2j93HDWn7XugNyjn5FylTH507QlabC+5wZqltdIjK +GRB5MIinQ9/nR2fuwGc9s+0BiSEwNOUB1MWm7wWL/JUIiKq6sTi6sJIfsYg79zco +qxl5WE94aoINx9Utq1cdWhwJTQKBgQD9IjPksd4Jprz8zMrGLzR8k1gqHyhv24qY +EJ7jiHKKAP6xllTUYwh1IBSL6w2j5lfZPpIkb4Jlk2KUoX6fN81pWkBC/fTBUSIB +EHM9bL51+yKEYUbGIy/gANuRbHXsWg3sjUsFTNPN4hGTFk3w2xChCyl/f5us8Lo8 +Z633SNdpvwKBgQCGyDU9XzNzVZihXtx7wS0sE7OSjKtX5cf/UCbA1V0OVUWR3SYO +J0HPCQFfF0BjFHSwwYPKuaR9C8zMdLNhK5/qdh/NU7czNi9fsZ7moh7SkRFbzJzN +OxbKD9t/CzJEMQEXeF/nWTfsSpUgILqqZtAxuuFLbAcaAnJYlCKdAumQgQKBgQCK +mqjJh68pn7gJwGUjoYNe1xtGbSsqHI9F9ovZ0MPO1v6e5M7sQJHH+Fnnxzv/y8e8 +d6tz8e73iX1IHymDKv35uuZHCGF1XOR+qrA/KQUc+vcKf21OXsP/JtkTRs1HLoRD +S5aRf2DWcfvniyYARSNU2xTM8GWgi2ueWbMDHUp+ZwKBgA/swC+K+Jg5DEWm6Sau +e6y+eC6S+SoXEKkI3wf7m9aKoZo0y+jh8Gas6gratlc181pSM8O3vZG0n19b493I +apCFomMLE56zEzvyzfpsNhFhk5MBMCn0LPyzX6MiynRlGyWIj0c99fbHI3pOMufP +WgmVLTZ8uDcSW1MbdUCwFSk5 +-----END PRIVATE KEY----- +Bag Attributes + friendlyName: test-alias + localKeyID: 54 69 6D 65 20 31 36 38 33 32 38 36 31 31 34 30 37 31 +subject=C = US, ST = California, L = Palo Alto, O = VMware, OU = Spring, CN = localhost +issuer=C = US, ST = California, L = Palo Alto, O = VMware, OU = Spring, CN = localhost +-----BEGIN CERTIFICATE----- +MIIDqzCCApOgAwIBAgIIFMqbpqvipw0wDQYJKoZIhvcNAQELBQAwbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDAgFw0yMzA1MDUxMTI2NThaGA8yMTIzMDQxMTExMjY1OFowbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPwHWxoE3xjRmNdD ++m+e/aFlr5wEGQUdWSDD613OB1w7kqO/audEp3c6HxDB3GPcEL0amJwXgY6CQMYu +sythuZX/EZSc2HdilTBu/5T+mbdWe5JkKThpiA0RYeucQfKuB7zv4ypioa4wiR4D +nPsZXjg95OF8pCzYEssv8wT49v+M3ohWUgfF0FPlMFCSo0YVTuzB1mhDlWKq/jhQ +11WpTmk/dQX+l6ts6bYIcJt4uItG+a68a4FutuSjZdTAE0f5SOYRBpGH96mjLwEP +fW8ZjzvKb9g4R2kiuoPxvCDs1Y/8V2yvKqLyn5Tx9x/DjFmOi0DRK/TgELvNceCb +UDJmhXMCAwEAAaNPME0wHQYDVR0OBBYEFMBIGU1nwix5RS3O5hGLLoMdR1+NMCwG +A1UdEQQlMCOCCWxvY2FsaG9zdIcQAAAAAAAAAAAAAAAAAAAAAYcEfwAAATANBgkq +hkiG9w0BAQsFAAOCAQEAhepfJgTFvqSccsT97XdAZfvB0noQx5NSynRV8NWmeOld +hHP6Fzj6xCxHSYvlUfmX8fVP9EOAuChgcbbuTIVJBu60rnDT21oOOnp8FvNonCV6 +gJ89sCL7wZ77dw2RKIeUFjXXEV3QJhx2wCOVmLxnJspDoKFIEVjfLyiPXKxqe/6b +dG8zzWDZ6z+M2JNCtVoOGpljpHqMPCmbDktncv6H3dDTZ83bmLj1nbpOU587gAJ8 +fl1PiUDyPRIl2cnOJd+wCHKsyym/FL7yzk0OSEZ81I92LpGd/0b2Ld3m/bpe+C4Z +ILzLXTnC6AhrLcDc9QN/EO+BiCL52n7EplNLtSn1LQ== +-----END CERTIFICATE----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/server/test.jks b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/server/test.jks new file mode 100644 index 000000000000..74279d80fbac Binary files /dev/null and b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/server/test.jks differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/server/test.p12 b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/server/test.p12 new file mode 100644 index 000000000000..e1255f26f665 Binary files /dev/null and b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/reactive/server/test.p12 differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test-cert-chain.pem b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test-cert-chain.pem new file mode 100644 index 000000000000..df103772cfe2 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test-cert-chain.pem @@ -0,0 +1,32 @@ +-----BEGIN TRUSTED CERTIFICATE----- +MIIClzCCAgACCQCPbjkRoMVEQDANBgkqhkiG9w0BAQUFADCBjzELMAkGA1UEBhMC +VVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28x +DTALBgNVBAoMBFRlc3QxDTALBgNVBAsMBFRlc3QxFDASBgNVBAMMC2V4YW1wbGUu +Y29tMR8wHQYJKoZIhvcNAQkBFhB0ZXN0QGV4YW1wbGUuY29tMB4XDTIwMDMyNzIx +NTgwNFoXDTIxMDMyNzIxNTgwNFowgY8xCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApD +YWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMQ0wCwYDVQQKDARUZXN0 +MQ0wCwYDVQQLDARUZXN0MRQwEgYDVQQDDAtleGFtcGxlLmNvbTEfMB0GCSqGSIb3 +DQEJARYQdGVzdEBleGFtcGxlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC +gYEA1YzixWEoyzrd20C2R1gjyPCoPfFLlG6UYTyT0tueNy6yjv6qbJ8lcZg7616O +3I9LuOHhZh9U+fCDCgPfiDdyJfDEW/P+dsOMFyMUXPrJPze2yPpOnvV8iJ5DM93u +fEVhCCyzLdYu0P2P3hU2W+T3/Im9DA7FOPA2vF1SrIJ2qtUCAwEAATANBgkqhkiG +9w0BAQUFAAOBgQBdShkwUv78vkn1jAdtfbB+7mpV9tufVdo29j7pmotTCz3ny5fc +zLEfeu6JPugAR71JYbc2CqGrMneSk1zT91EH6ohIz8OR5VNvzB7N7q65Ci7OFMPl +ly6k3rHpMCBtHoyNFhNVfPLxGJ9VlWFKLgIAbCmL4OIQm1l6Fr1MSM38Zw== +-----END TRUSTED CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICjzCCAfgCAQEwDQYJKoZIhvcNAQEFBQAwgY8xCzAJBgNVBAYTAlVTMRMwEQYD +VQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMQ0wCwYDVQQK +DARUZXN0MQ0wCwYDVQQLDARUZXN0MRQwEgYDVQQDDAtleGFtcGxlLmNvbTEfMB0G +CSqGSIb3DQEJARYQdGVzdEBleGFtcGxlLmNvbTAeFw0yMDAzMjcyMjAxNDZaFw0y +MTAzMjcyMjAxNDZaMIGPMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5p +YTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwEVGVzdDENMAsGA1UE +CwwEVGVzdDEUMBIGA1UEAwwLZXhhbXBsZS5jb20xHzAdBgkqhkiG9w0BCQEWEHRl +c3RAZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM7kd2cj +F49wm1+OQ7Q5GE96cXueWNPr/Nwei71tf6G4BmE0B+suXHEvnLpHTj9pdX/ZzBIK +8jIZ/x8RnSduK/Ky+zm1QMYUWZtWCAgCW8WzgB69Cn/hQG8KSX3S9bqODuQAvP54 +GQJD7+4kVuNBGjFb4DaD4nvMmPtALSZf8ZCZAgMBAAEwDQYJKoZIhvcNAQEFBQAD +gYEAOn6X8+0VVlDjF+TvTgI0KIasA6nDm+KXe7LVtfvqWqQZH4qyd2uiwcDM3Aux +a/OsPdOw0j+NqFDBd3mSMhSVgfvXdK6j9WaxY1VGXyaidLARgvn63wfzgr857sQW +c8eSxbwEQxwlMvVxW6Os4VhCfUQr8VrBrvPa2zs+6IlK+Ug= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test-cert.pem b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test-cert.pem new file mode 100644 index 000000000000..245cf8f8f86a --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test-cert.pem @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDqzCCApOgAwIBAgIIFMqbpqvipw0wDQYJKoZIhvcNAQELBQAwbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDAgFw0yMzA1MDUxMTI2NThaGA8yMTIzMDQxMTExMjY1OFowbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPwHWxoE3xjRmNdD ++m+e/aFlr5wEGQUdWSDD613OB1w7kqO/audEp3c6HxDB3GPcEL0amJwXgY6CQMYu +sythuZX/EZSc2HdilTBu/5T+mbdWe5JkKThpiA0RYeucQfKuB7zv4ypioa4wiR4D +nPsZXjg95OF8pCzYEssv8wT49v+M3ohWUgfF0FPlMFCSo0YVTuzB1mhDlWKq/jhQ +11WpTmk/dQX+l6ts6bYIcJt4uItG+a68a4FutuSjZdTAE0f5SOYRBpGH96mjLwEP +fW8ZjzvKb9g4R2kiuoPxvCDs1Y/8V2yvKqLyn5Tx9x/DjFmOi0DRK/TgELvNceCb +UDJmhXMCAwEAAaNPME0wHQYDVR0OBBYEFMBIGU1nwix5RS3O5hGLLoMdR1+NMCwG +A1UdEQQlMCOCCWxvY2FsaG9zdIcQAAAAAAAAAAAAAAAAAAAAAYcEfwAAATANBgkq +hkiG9w0BAQsFAAOCAQEAhepfJgTFvqSccsT97XdAZfvB0noQx5NSynRV8NWmeOld +hHP6Fzj6xCxHSYvlUfmX8fVP9EOAuChgcbbuTIVJBu60rnDT21oOOnp8FvNonCV6 +gJ89sCL7wZ77dw2RKIeUFjXXEV3QJhx2wCOVmLxnJspDoKFIEVjfLyiPXKxqe/6b +dG8zzWDZ6z+M2JNCtVoOGpljpHqMPCmbDktncv6H3dDTZ83bmLj1nbpOU587gAJ8 +fl1PiUDyPRIl2cnOJd+wCHKsyym/FL7yzk0OSEZ81I92LpGd/0b2Ld3m/bpe+C4Z +ILzLXTnC6AhrLcDc9QN/EO+BiCL52n7EplNLtSn1LQ== +-----END CERTIFICATE----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test-key.pem b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test-key.pem new file mode 100644 index 000000000000..ebdcf202f31a --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test-key.pem @@ -0,0 +1,59 @@ +Bag Attributes + friendlyName: test-alias + localKeyID: 54 69 6D 65 20 31 36 38 33 32 38 36 31 31 34 30 37 31 +Key Attributes: +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQD8B1saBN8Y0ZjX +Q/pvnv2hZa+cBBkFHVkgw+tdzgdcO5Kjv2rnRKd3Oh8Qwdxj3BC9GpicF4GOgkDG +LrMrYbmV/xGUnNh3YpUwbv+U/pm3VnuSZCk4aYgNEWHrnEHyrge87+MqYqGuMIke +A5z7GV44PeThfKQs2BLLL/ME+Pb/jN6IVlIHxdBT5TBQkqNGFU7swdZoQ5Viqv44 +UNdVqU5pP3UF/perbOm2CHCbeLiLRvmuvGuBbrbko2XUwBNH+UjmEQaRh/epoy8B +D31vGY87ym/YOEdpIrqD8bwg7NWP/Fdsryqi8p+U8fcfw4xZjotA0Sv04BC7zXHg +m1AyZoVzAgMBAAECggEAfEqiZqANaF+BqXQIb4Dw42ZTJzWsIyYYnPySOGZRoe5t +QJ03uwtULYv34xtANe1DQgd6SMyc46ugBzzjtprQ3ET5Jhn99U6kdcjf+dpf85dO +hOEppP0CkDNI39nleinSfh6uIOqYgt/D143/nqQhn8oCdSOzkbwT9KnWh1bC9T7I +vFjGfElvt1/xl88qYgrWgYLgXaencNGgiv/4/M0FNhiHEGsVC7SCu6kapC/WIQpE +5IdV+HR+tiLoGZhXlhqorY7QC4xKC4wwafVSiFxqDOQAuK+SMD4TCEv0Aop+c+SE +YBigVTmgVeJkjK7IkTEhKkAEFmRF5/5w+bZD9FhTNQKBgQD+4fNG1ChSU8RdizZT +5dPlDyAxpETSCEXFFVGtPPh2j93HDWn7XugNyjn5FylTH507QlabC+5wZqltdIjK +GRB5MIinQ9/nR2fuwGc9s+0BiSEwNOUB1MWm7wWL/JUIiKq6sTi6sJIfsYg79zco +qxl5WE94aoINx9Utq1cdWhwJTQKBgQD9IjPksd4Jprz8zMrGLzR8k1gqHyhv24qY +EJ7jiHKKAP6xllTUYwh1IBSL6w2j5lfZPpIkb4Jlk2KUoX6fN81pWkBC/fTBUSIB +EHM9bL51+yKEYUbGIy/gANuRbHXsWg3sjUsFTNPN4hGTFk3w2xChCyl/f5us8Lo8 +Z633SNdpvwKBgQCGyDU9XzNzVZihXtx7wS0sE7OSjKtX5cf/UCbA1V0OVUWR3SYO +J0HPCQFfF0BjFHSwwYPKuaR9C8zMdLNhK5/qdh/NU7czNi9fsZ7moh7SkRFbzJzN +OxbKD9t/CzJEMQEXeF/nWTfsSpUgILqqZtAxuuFLbAcaAnJYlCKdAumQgQKBgQCK +mqjJh68pn7gJwGUjoYNe1xtGbSsqHI9F9ovZ0MPO1v6e5M7sQJHH+Fnnxzv/y8e8 +d6tz8e73iX1IHymDKv35uuZHCGF1XOR+qrA/KQUc+vcKf21OXsP/JtkTRs1HLoRD +S5aRf2DWcfvniyYARSNU2xTM8GWgi2ueWbMDHUp+ZwKBgA/swC+K+Jg5DEWm6Sau +e6y+eC6S+SoXEKkI3wf7m9aKoZo0y+jh8Gas6gratlc181pSM8O3vZG0n19b493I +apCFomMLE56zEzvyzfpsNhFhk5MBMCn0LPyzX6MiynRlGyWIj0c99fbHI3pOMufP +WgmVLTZ8uDcSW1MbdUCwFSk5 +-----END PRIVATE KEY----- +Bag Attributes + friendlyName: test-alias + localKeyID: 54 69 6D 65 20 31 36 38 33 32 38 36 31 31 34 30 37 31 +subject=C = US, ST = California, L = Palo Alto, O = VMware, OU = Spring, CN = localhost +issuer=C = US, ST = California, L = Palo Alto, O = VMware, OU = Spring, CN = localhost +-----BEGIN CERTIFICATE----- +MIIDqzCCApOgAwIBAgIIFMqbpqvipw0wDQYJKoZIhvcNAQELBQAwbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDAgFw0yMzA1MDUxMTI2NThaGA8yMTIzMDQxMTExMjY1OFowbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPwHWxoE3xjRmNdD ++m+e/aFlr5wEGQUdWSDD613OB1w7kqO/audEp3c6HxDB3GPcEL0amJwXgY6CQMYu +sythuZX/EZSc2HdilTBu/5T+mbdWe5JkKThpiA0RYeucQfKuB7zv4ypioa4wiR4D +nPsZXjg95OF8pCzYEssv8wT49v+M3ohWUgfF0FPlMFCSo0YVTuzB1mhDlWKq/jhQ +11WpTmk/dQX+l6ts6bYIcJt4uItG+a68a4FutuSjZdTAE0f5SOYRBpGH96mjLwEP +fW8ZjzvKb9g4R2kiuoPxvCDs1Y/8V2yvKqLyn5Tx9x/DjFmOi0DRK/TgELvNceCb +UDJmhXMCAwEAAaNPME0wHQYDVR0OBBYEFMBIGU1nwix5RS3O5hGLLoMdR1+NMCwG +A1UdEQQlMCOCCWxvY2FsaG9zdIcQAAAAAAAAAAAAAAAAAAAAAYcEfwAAATANBgkq +hkiG9w0BAQsFAAOCAQEAhepfJgTFvqSccsT97XdAZfvB0noQx5NSynRV8NWmeOld +hHP6Fzj6xCxHSYvlUfmX8fVP9EOAuChgcbbuTIVJBu60rnDT21oOOnp8FvNonCV6 +gJ89sCL7wZ77dw2RKIeUFjXXEV3QJhx2wCOVmLxnJspDoKFIEVjfLyiPXKxqe/6b +dG8zzWDZ6z+M2JNCtVoOGpljpHqMPCmbDktncv6H3dDTZ83bmLj1nbpOU587gAJ8 +fl1PiUDyPRIl2cnOJd+wCHKsyym/FL7yzk0OSEZ81I92LpGd/0b2Ld3m/bpe+C4Z +ILzLXTnC6AhrLcDc9QN/EO+BiCL52n7EplNLtSn1LQ== +-----END CERTIFICATE----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test.jks b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test.jks new file mode 100644 index 000000000000..74279d80fbac Binary files /dev/null and b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test.jks differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test.p12 b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test.p12 new file mode 100644 index 000000000000..e1255f26f665 Binary files /dev/null and b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/test.p12 differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/context/conf.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/context/conf.properties deleted file mode 100644 index 0eb014d0ff22..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/context/conf.properties +++ /dev/null @@ -1 +0,0 @@ -context=/example diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/server/test-cert.pem b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/server/test-cert.pem new file mode 100644 index 000000000000..245cf8f8f86a --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/server/test-cert.pem @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDqzCCApOgAwIBAgIIFMqbpqvipw0wDQYJKoZIhvcNAQELBQAwbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDAgFw0yMzA1MDUxMTI2NThaGA8yMTIzMDQxMTExMjY1OFowbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPwHWxoE3xjRmNdD ++m+e/aFlr5wEGQUdWSDD613OB1w7kqO/audEp3c6HxDB3GPcEL0amJwXgY6CQMYu +sythuZX/EZSc2HdilTBu/5T+mbdWe5JkKThpiA0RYeucQfKuB7zv4ypioa4wiR4D +nPsZXjg95OF8pCzYEssv8wT49v+M3ohWUgfF0FPlMFCSo0YVTuzB1mhDlWKq/jhQ +11WpTmk/dQX+l6ts6bYIcJt4uItG+a68a4FutuSjZdTAE0f5SOYRBpGH96mjLwEP +fW8ZjzvKb9g4R2kiuoPxvCDs1Y/8V2yvKqLyn5Tx9x/DjFmOi0DRK/TgELvNceCb +UDJmhXMCAwEAAaNPME0wHQYDVR0OBBYEFMBIGU1nwix5RS3O5hGLLoMdR1+NMCwG +A1UdEQQlMCOCCWxvY2FsaG9zdIcQAAAAAAAAAAAAAAAAAAAAAYcEfwAAATANBgkq +hkiG9w0BAQsFAAOCAQEAhepfJgTFvqSccsT97XdAZfvB0noQx5NSynRV8NWmeOld +hHP6Fzj6xCxHSYvlUfmX8fVP9EOAuChgcbbuTIVJBu60rnDT21oOOnp8FvNonCV6 +gJ89sCL7wZ77dw2RKIeUFjXXEV3QJhx2wCOVmLxnJspDoKFIEVjfLyiPXKxqe/6b +dG8zzWDZ6z+M2JNCtVoOGpljpHqMPCmbDktncv6H3dDTZ83bmLj1nbpOU587gAJ8 +fl1PiUDyPRIl2cnOJd+wCHKsyym/FL7yzk0OSEZ81I92LpGd/0b2Ld3m/bpe+C4Z +ILzLXTnC6AhrLcDc9QN/EO+BiCL52n7EplNLtSn1LQ== +-----END CERTIFICATE----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/server/test-key.pem b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/server/test-key.pem new file mode 100644 index 000000000000..ebdcf202f31a --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/server/test-key.pem @@ -0,0 +1,59 @@ +Bag Attributes + friendlyName: test-alias + localKeyID: 54 69 6D 65 20 31 36 38 33 32 38 36 31 31 34 30 37 31 +Key Attributes: +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQD8B1saBN8Y0ZjX +Q/pvnv2hZa+cBBkFHVkgw+tdzgdcO5Kjv2rnRKd3Oh8Qwdxj3BC9GpicF4GOgkDG +LrMrYbmV/xGUnNh3YpUwbv+U/pm3VnuSZCk4aYgNEWHrnEHyrge87+MqYqGuMIke +A5z7GV44PeThfKQs2BLLL/ME+Pb/jN6IVlIHxdBT5TBQkqNGFU7swdZoQ5Viqv44 +UNdVqU5pP3UF/perbOm2CHCbeLiLRvmuvGuBbrbko2XUwBNH+UjmEQaRh/epoy8B +D31vGY87ym/YOEdpIrqD8bwg7NWP/Fdsryqi8p+U8fcfw4xZjotA0Sv04BC7zXHg +m1AyZoVzAgMBAAECggEAfEqiZqANaF+BqXQIb4Dw42ZTJzWsIyYYnPySOGZRoe5t +QJ03uwtULYv34xtANe1DQgd6SMyc46ugBzzjtprQ3ET5Jhn99U6kdcjf+dpf85dO +hOEppP0CkDNI39nleinSfh6uIOqYgt/D143/nqQhn8oCdSOzkbwT9KnWh1bC9T7I +vFjGfElvt1/xl88qYgrWgYLgXaencNGgiv/4/M0FNhiHEGsVC7SCu6kapC/WIQpE +5IdV+HR+tiLoGZhXlhqorY7QC4xKC4wwafVSiFxqDOQAuK+SMD4TCEv0Aop+c+SE +YBigVTmgVeJkjK7IkTEhKkAEFmRF5/5w+bZD9FhTNQKBgQD+4fNG1ChSU8RdizZT +5dPlDyAxpETSCEXFFVGtPPh2j93HDWn7XugNyjn5FylTH507QlabC+5wZqltdIjK +GRB5MIinQ9/nR2fuwGc9s+0BiSEwNOUB1MWm7wWL/JUIiKq6sTi6sJIfsYg79zco +qxl5WE94aoINx9Utq1cdWhwJTQKBgQD9IjPksd4Jprz8zMrGLzR8k1gqHyhv24qY +EJ7jiHKKAP6xllTUYwh1IBSL6w2j5lfZPpIkb4Jlk2KUoX6fN81pWkBC/fTBUSIB +EHM9bL51+yKEYUbGIy/gANuRbHXsWg3sjUsFTNPN4hGTFk3w2xChCyl/f5us8Lo8 +Z633SNdpvwKBgQCGyDU9XzNzVZihXtx7wS0sE7OSjKtX5cf/UCbA1V0OVUWR3SYO +J0HPCQFfF0BjFHSwwYPKuaR9C8zMdLNhK5/qdh/NU7czNi9fsZ7moh7SkRFbzJzN +OxbKD9t/CzJEMQEXeF/nWTfsSpUgILqqZtAxuuFLbAcaAnJYlCKdAumQgQKBgQCK +mqjJh68pn7gJwGUjoYNe1xtGbSsqHI9F9ovZ0MPO1v6e5M7sQJHH+Fnnxzv/y8e8 +d6tz8e73iX1IHymDKv35uuZHCGF1XOR+qrA/KQUc+vcKf21OXsP/JtkTRs1HLoRD +S5aRf2DWcfvniyYARSNU2xTM8GWgi2ueWbMDHUp+ZwKBgA/swC+K+Jg5DEWm6Sau +e6y+eC6S+SoXEKkI3wf7m9aKoZo0y+jh8Gas6gratlc181pSM8O3vZG0n19b493I +apCFomMLE56zEzvyzfpsNhFhk5MBMCn0LPyzX6MiynRlGyWIj0c99fbHI3pOMufP +WgmVLTZ8uDcSW1MbdUCwFSk5 +-----END PRIVATE KEY----- +Bag Attributes + friendlyName: test-alias + localKeyID: 54 69 6D 65 20 31 36 38 33 32 38 36 31 31 34 30 37 31 +subject=C = US, ST = California, L = Palo Alto, O = VMware, OU = Spring, CN = localhost +issuer=C = US, ST = California, L = Palo Alto, O = VMware, OU = Spring, CN = localhost +-----BEGIN CERTIFICATE----- +MIIDqzCCApOgAwIBAgIIFMqbpqvipw0wDQYJKoZIhvcNAQELBQAwbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDAgFw0yMzA1MDUxMTI2NThaGA8yMTIzMDQxMTExMjY1OFowbDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEP +MA0GA1UEChMGVk13YXJlMQ8wDQYDVQQLEwZTcHJpbmcxEjAQBgNVBAMTCWxvY2Fs +aG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPwHWxoE3xjRmNdD ++m+e/aFlr5wEGQUdWSDD613OB1w7kqO/audEp3c6HxDB3GPcEL0amJwXgY6CQMYu +sythuZX/EZSc2HdilTBu/5T+mbdWe5JkKThpiA0RYeucQfKuB7zv4ypioa4wiR4D +nPsZXjg95OF8pCzYEssv8wT49v+M3ohWUgfF0FPlMFCSo0YVTuzB1mhDlWKq/jhQ +11WpTmk/dQX+l6ts6bYIcJt4uItG+a68a4FutuSjZdTAE0f5SOYRBpGH96mjLwEP +fW8ZjzvKb9g4R2kiuoPxvCDs1Y/8V2yvKqLyn5Tx9x/DjFmOi0DRK/TgELvNceCb +UDJmhXMCAwEAAaNPME0wHQYDVR0OBBYEFMBIGU1nwix5RS3O5hGLLoMdR1+NMCwG +A1UdEQQlMCOCCWxvY2FsaG9zdIcQAAAAAAAAAAAAAAAAAAAAAYcEfwAAATANBgkq +hkiG9w0BAQsFAAOCAQEAhepfJgTFvqSccsT97XdAZfvB0noQx5NSynRV8NWmeOld +hHP6Fzj6xCxHSYvlUfmX8fVP9EOAuChgcbbuTIVJBu60rnDT21oOOnp8FvNonCV6 +gJ89sCL7wZ77dw2RKIeUFjXXEV3QJhx2wCOVmLxnJspDoKFIEVjfLyiPXKxqe/6b +dG8zzWDZ6z+M2JNCtVoOGpljpHqMPCmbDktncv6H3dDTZ83bmLj1nbpOU587gAJ8 +fl1PiUDyPRIl2cnOJd+wCHKsyym/FL7yzk0OSEZ81I92LpGd/0b2Ld3m/bpe+C4Z +ILzLXTnC6AhrLcDc9QN/EO+BiCL52n7EplNLtSn1LQ== +-----END CERTIFICATE----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/server/test.jks b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/server/test.jks new file mode 100644 index 000000000000..74279d80fbac Binary files /dev/null and b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/server/test.jks differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/server/test.p12 b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/server/test.p12 new file mode 100644 index 000000000000..e1255f26f665 Binary files /dev/null and b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/server/test.p12 differ diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/view/template.html b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/view/template.html deleted file mode 100644 index fa22264e2356..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/servlet/view/template.html +++ /dev/null @@ -1 +0,0 @@ -Hello {{World}} diff --git a/spring-boot-project/spring-boot/src/test/resources/other.yml b/spring-boot-project/spring-boot/src/test/resources/other.yml deleted file mode 100644 index b5bbd790764e..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/other.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -name: other diff --git a/spring-boot-project/spring-boot/src/test/resources/override.properties b/spring-boot-project/spring-boot/src/test/resources/override.properties deleted file mode 100644 index 6e30e3fc4dbb..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/override.properties +++ /dev/null @@ -1,4 +0,0 @@ -foo=bar -bar=override -SPAM=BUCKET -THE_NAME=NAME diff --git a/spring-boot-project/spring-boot/src/test/resources/schema.sql b/spring-boot-project/spring-boot/src/test/resources/schema.sql deleted file mode 100644 index 556b5e372a9f..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/schema.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE EXAMPLE ( - id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, - name VARCHAR(30) -); \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/some.properties b/spring-boot-project/spring-boot/src/test/resources/some.properties deleted file mode 100644 index a1e02b448092..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/some.properties +++ /dev/null @@ -1,4 +0,0 @@ -foo=spam -bar=some -spam=bucket -the-name=name diff --git a/spring-boot-project/spring-boot/src/test/resources/specific.properties b/spring-boot-project/spring-boot/src/test/resources/specific.properties deleted file mode 100644 index 81ea94880041..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/specific.properties +++ /dev/null @@ -1 +0,0 @@ -my.property=root diff --git a/spring-boot-project/spring-boot/src/test/resources/specificlocation.properties b/spring-boot-project/spring-boot/src/test/resources/specificlocation.properties deleted file mode 100644 index 25638d8453c6..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/specificlocation.properties +++ /dev/null @@ -1,2 +0,0 @@ -my.property=fromspecificlocation -the.property=fromspecificlocation diff --git a/spring-boot-project/spring-boot/src/test/resources/spring-application-config-property-source.properties b/spring-boot-project/spring-boot/src/test/resources/spring-application-config-property-source.properties deleted file mode 100644 index c1b09576e254..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/spring-application-config-property-source.properties +++ /dev/null @@ -1 +0,0 @@ -test.name=spring-application-config-property-source \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/test-banner-with-placeholder.txt b/spring-boot-project/spring-boot/src/test/resources/test-banner-with-placeholder.txt deleted file mode 100644 index 96a027ca9fc2..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/test-banner-with-placeholder.txt +++ /dev/null @@ -1,3 +0,0 @@ -Running a Test! - -${test.property} \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/test-banner.txt b/spring-boot-project/spring-boot/src/test/resources/test-banner.txt deleted file mode 100644 index d60fc28bdea9..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/test-banner.txt +++ /dev/null @@ -1 +0,0 @@ -Running a Test! \ No newline at end of file diff --git a/spring-boot-project/spring-boot/src/test/resources/testactiveprofiles.properties b/spring-boot-project/spring-boot/src/test/resources/testactiveprofiles.properties deleted file mode 100644 index 11cdae3b77e6..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/testactiveprofiles.properties +++ /dev/null @@ -1 +0,0 @@ -spring.profiles.active=${activeProfile:propertiesfile} diff --git a/spring-boot-project/spring-boot/src/test/resources/testprofiles-default.properties b/spring-boot-project/spring-boot/src/test/resources/testprofiles-default.properties deleted file mode 100644 index 841423aee6c2..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/testprofiles-default.properties +++ /dev/null @@ -1 +0,0 @@ -my.property=fromdefaultpropertiesfile diff --git a/spring-boot-project/spring-boot/src/test/resources/testprofiles-thedefault.properties b/spring-boot-project/spring-boot/src/test/resources/testprofiles-thedefault.properties deleted file mode 100644 index bc81eb60a66c..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/testprofiles-thedefault.properties +++ /dev/null @@ -1,2 +0,0 @@ -my.property=fromdefaultpropertiesfile -the.property=fromdefaultpropertiesfile diff --git a/spring-boot-project/spring-boot/src/test/resources/testprofiles.yml b/spring-boot-project/spring-boot/src/test/resources/testprofiles.yml deleted file mode 100644 index dbe7c5f27205..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/testprofiles.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -my: - property: fromyamlfile - other: notempty ---- -spring.config.activate.on-profile: dev -my: - property: fromdevprofile ---- -spring.config.activate.on-profile: other -my: - property: fromotherprofile diff --git a/spring-boot-project/spring-boot/src/test/resources/testproperties.properties b/spring-boot-project/spring-boot/src/test/resources/testproperties.properties deleted file mode 100644 index c523d5905871..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/testproperties.properties +++ /dev/null @@ -1,2 +0,0 @@ -my.property=frompropertiesfile -the.property=frompropertiesfile diff --git a/spring-boot-project/spring-boot/src/test/resources/testsetmultiprofiles.yml b/spring-boot-project/spring-boot/src/test/resources/testsetmultiprofiles.yml deleted file mode 100644 index 348c27211cd9..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/testsetmultiprofiles.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -spring: - profiles: - active: dev,healthcheck diff --git a/spring-boot-project/spring-boot/src/test/resources/testsetmultiprofileslist.yml b/spring-boot-project/spring-boot/src/test/resources/testsetmultiprofileslist.yml deleted file mode 100644 index f53736316044..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/testsetmultiprofileslist.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -spring: - profiles: - active: - - dev - - healthcheck diff --git a/spring-boot-project/spring-boot/src/test/resources/testsetmultiprofileswhitespace.yml b/spring-boot-project/spring-boot/src/test/resources/testsetmultiprofileswhitespace.yml deleted file mode 100644 index cbce97c51042..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/testsetmultiprofileswhitespace.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -spring: - profiles: - active: dev, healthcheck diff --git a/spring-boot-project/spring-boot/src/test/resources/testyaml.yml b/spring-boot-project/spring-boot/src/test/resources/testyaml.yml deleted file mode 100644 index ffce1bd30924..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/testyaml.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -my: - property: fromyamlfile - array: [1,2,3]