Skip to content

Commit 61fbb12

Browse files
committed
Polish
1 parent a9e50d6 commit 61fbb12

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ssl/SslAutoConfigurationTests.java

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -53,29 +53,22 @@ void sslBundlesCreatedWithNoConfiguration() {
5353
@Test
5454
void sslBundlesCreatedWithCertificates() {
5555
List<String> propertyValues = new ArrayList<>();
56+
String location = "classpath:org/springframework/boot/autoconfigure/ssl/";
5657
propertyValues.add("spring.ssl.bundle.pem.first.key.alias=alias1");
5758
propertyValues.add("spring.ssl.bundle.pem.first.key.password=secret1");
58-
propertyValues.add(
59-
"spring.ssl.bundle.pem.first.keystore.certificate=classpath:org/springframework/boot/autoconfigure/ssl/rsa-cert.pem");
60-
propertyValues.add(
61-
"spring.ssl.bundle.pem.first.keystore.private-key=classpath:org/springframework/boot/autoconfigure/ssl/rsa-key.pem");
59+
propertyValues.add("spring.ssl.bundle.pem.first.keystore.certificate=" + location + "rsa-cert.pem");
60+
propertyValues.add("spring.ssl.bundle.pem.first.keystore.private-key=" + location + "rsa-key.pem");
6261
propertyValues.add("spring.ssl.bundle.pem.first.keystore.type=PKCS12");
6362
propertyValues.add("spring.ssl.bundle.pem.first.truststore.type=PKCS12");
64-
propertyValues.add(
65-
"spring.ssl.bundle.pem.first.truststore.certificate=classpath:org/springframework/boot/autoconfigure/ssl/rsa-cert.pem");
66-
propertyValues.add(
67-
"spring.ssl.bundle.pem.first.truststore.private-key=classpath:org/springframework/boot/autoconfigure/ssl/rsa-key.pem");
63+
propertyValues.add("spring.ssl.bundle.pem.first.truststore.certificate=" + location + "rsa-cert.pem");
64+
propertyValues.add("spring.ssl.bundle.pem.first.truststore.private-key=" + location + "rsa-key.pem");
6865
propertyValues.add("spring.ssl.bundle.pem.second.key.alias=alias2");
6966
propertyValues.add("spring.ssl.bundle.pem.second.key.password=secret2");
70-
propertyValues.add(
71-
"spring.ssl.bundle.pem.second.keystore.certificate=classpath:org/springframework/boot/autoconfigure/ssl/ed25519-cert.pem");
72-
propertyValues.add(
73-
"spring.ssl.bundle.pem.second.keystore.private-key=classpath:org/springframework/boot/autoconfigure/ssl/ed25519-key.pem");
67+
propertyValues.add("spring.ssl.bundle.pem.second.keystore.certificate=" + location + "ed25519-cert.pem");
68+
propertyValues.add("spring.ssl.bundle.pem.second.keystore.private-key=" + location + "ed25519-key.pem");
7469
propertyValues.add("spring.ssl.bundle.pem.second.keystore.type=PKCS12");
75-
propertyValues.add(
76-
"spring.ssl.bundle.pem.second.truststore.certificate=classpath:org/springframework/boot/autoconfigure/ssl/ed25519-cert.pem");
77-
propertyValues.add(
78-
"spring.ssl.bundle.pem.second.truststore.private-key=classpath:org/springframework/boot/autoconfigure/ssl/ed25519-key.pem");
70+
propertyValues.add("spring.ssl.bundle.pem.second.truststore.certificate=" + location + "ed25519-cert.pem");
71+
propertyValues.add("spring.ssl.bundle.pem.second.truststore.private-key=" + location + "ed25519-key.pem");
7972
propertyValues.add("spring.ssl.bundle.pem.second.truststore.type=PKCS12");
8073
this.contextRunner.withPropertyValues(propertyValues.toArray(String[]::new)).run((context) -> {
8174
assertThat(context).hasSingleBean(SslBundles.class);
@@ -102,14 +95,12 @@ void sslBundlesCreatedWithCertificates() {
10295
@Test
10396
void sslBundlesCreatedWithCustomSslBundle() {
10497
List<String> propertyValues = new ArrayList<>();
98+
String location = "classpath:org/springframework/boot/autoconfigure/ssl/";
10599
propertyValues.add("custom.ssl.key.alias=alias1");
106100
propertyValues.add("custom.ssl.key.password=secret1");
107-
propertyValues
108-
.add("custom.ssl.keystore.certificate=classpath:org/springframework/boot/autoconfigure/ssl/rsa-cert.pem");
109-
propertyValues.add(
110-
"custom.ssl.keystore.keystore.private-key=classpath:org/springframework/boot/autoconfigure/ssl/rsa-key.pem");
111-
propertyValues
112-
.add("custom.ssl.truststore.certificate=classpath:org/springframework/boot/autoconfigure/ssl/rsa-cert.pem");
101+
propertyValues.add("custom.ssl.keystore.certificate=" + location + "rsa-cert.pem");
102+
propertyValues.add("custom.ssl.keystore.keystore.private-key=" + location + "rsa-key.pem");
103+
propertyValues.add("custom.ssl.truststore.certificate=" + location + "rsa-cert.pem");
113104
propertyValues.add("custom.ssl.keystore.type=PKCS12");
114105
propertyValues.add("custom.ssl.truststore.type=PKCS12");
115106
this.contextRunner.withUserConfiguration(CustomSslBundleConfiguration.class)

0 commit comments

Comments
 (0)