Skip to content

Commit 09f4d4b

Browse files
izeyesnicoll
authored andcommitted
Polish
See gh-25617
1 parent 11649bc commit 09f4d4b

File tree

7 files changed

+68
-93
lines changed

7 files changed

+68
-93
lines changed

buildSrc/src/main/java/org/springframework/boot/build/toolchain/ToolchainPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private void configure(Project project, ToolchainExtension toolchain) {
6262
}
6363
}
6464

65-
public boolean isJavaVersionSupported(ToolchainExtension toolchain, JavaLanguageVersion toolchainVersion) {
65+
private boolean isJavaVersionSupported(ToolchainExtension toolchain, JavaLanguageVersion toolchainVersion) {
6666
return toolchain.getMaximumCompatibleJavaVersion().map((version) -> version.canCompileOrRun(toolchainVersion))
6767
.getOrElse(true);
6868
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/jersey/JerseyWebEndpointIntegrationTests.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@
2727
import org.springframework.boot.actuate.autoconfigure.web.jersey.JerseySameManagementContextConfiguration;
2828
import org.springframework.boot.autoconfigure.AutoConfigurations;
2929
import org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration;
30-
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
3130
import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration;
32-
import org.springframework.boot.logging.LogLevel;
3331
import org.springframework.boot.test.context.FilteredClassLoader;
3432
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
3533
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
@@ -55,7 +53,6 @@ void whenJerseyIsConfiguredToUseAFilterThenResourceRegistrationSucceeds() {
5553
JerseyWebEndpointManagementContextConfiguration.class))
5654
.withUserConfiguration(ResourceConfigConfiguration.class)
5755
.withClassLoader(new FilteredClassLoader(DispatcherServlet.class))
58-
.withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.INFO))
5956
.withPropertyValues("spring.jersey.type=filter", "server.port=0").run((context) -> {
6057
assertThat(context).hasNotFailed();
6158
Set<Resource> resources = context.getBean(ResourceConfig.class).getResources();

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/rsocket/RSocketServerAutoConfigurationTests.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
import org.junit.jupiter.api.Test;
2020

2121
import org.springframework.boot.autoconfigure.AutoConfigurations;
22-
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
23-
import org.springframework.boot.logging.LogLevel;
2422
import org.springframework.boot.rsocket.context.RSocketPortInfoApplicationContextInitializer;
2523
import org.springframework.boot.rsocket.context.RSocketServerBootstrap;
2624
import org.springframework.boot.rsocket.server.RSocketServerCustomizer;
@@ -148,7 +146,6 @@ void shouldUseCustomNettyRouteProvider() {
148146
@Test
149147
void whenSpringWebIsNotPresentThenEmbeddedServerConfigurationBacksOff() {
150148
contextRunner().withClassLoader(new FilteredClassLoader(ReactorResourceFactory.class))
151-
.withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.INFO))
152149
.withPropertyValues("spring.rsocket.server.port=0")
153150
.run((context) -> assertThat(context).doesNotHaveBean(RSocketServerFactory.class));
154151
}

spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilderTests.java

Lines changed: 64 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2021 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.
@@ -64,93 +64,77 @@ void hintsOnMaps() throws IOException {
6464

6565
@Test
6666
void severalRepositoriesNoConflict() throws IOException {
67-
try (InputStream foo = getInputStreamFor("foo")) {
68-
try (InputStream bar = getInputStreamFor("bar")) {
69-
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, bar)
70-
.build();
71-
validateFoo(repo);
72-
validateBar(repo);
73-
assertThat(repo.getAllGroups()).hasSize(2);
74-
contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
75-
"spring.bar.name", "spring.bar.description", "spring.bar.counter");
76-
assertThat(repo.getAllProperties()).hasSize(6);
77-
}
67+
try (InputStream foo = getInputStreamFor("foo"); InputStream bar = getInputStreamFor("bar")) {
68+
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, bar).build();
69+
validateFoo(repo);
70+
validateBar(repo);
71+
assertThat(repo.getAllGroups()).hasSize(2);
72+
contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
73+
"spring.bar.name", "spring.bar.description", "spring.bar.counter");
74+
assertThat(repo.getAllProperties()).hasSize(6);
7875
}
7976
}
8077

8178
@Test
8279
void repositoryWithRoot() throws IOException {
83-
try (InputStream foo = getInputStreamFor("foo")) {
84-
try (InputStream root = getInputStreamFor("root")) {
85-
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, root)
86-
.build();
87-
validateFoo(repo);
88-
assertThat(repo.getAllGroups()).hasSize(2);
80+
try (InputStream foo = getInputStreamFor("foo"); InputStream root = getInputStreamFor("root")) {
81+
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, root).build();
82+
validateFoo(repo);
83+
assertThat(repo.getAllGroups()).hasSize(2);
8984

90-
contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
91-
"spring.root.name", "spring.root2.name");
92-
assertThat(repo.getAllProperties()).hasSize(5);
93-
}
85+
contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
86+
"spring.root.name", "spring.root2.name");
87+
assertThat(repo.getAllProperties()).hasSize(5);
9488
}
9589
}
9690

9791
@Test
9892
void severalRepositoriesIdenticalGroups() throws IOException {
99-
try (InputStream foo = getInputStreamFor("foo")) {
100-
try (InputStream foo2 = getInputStreamFor("foo2")) {
101-
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo2)
102-
.build();
103-
Iterable<String> allKeys = Arrays.asList("spring.foo.name", "spring.foo.description",
104-
"spring.foo.counter", "spring.foo.enabled", "spring.foo.type");
105-
assertThat(repo.getAllProperties()).containsOnlyKeys(allKeys);
106-
assertThat(repo.getAllGroups()).containsOnlyKeys("spring.foo");
107-
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
108-
assertThat(group.getProperties()).containsOnlyKeys(allKeys);
109-
assertThat(group.getSources()).containsOnlyKeys("org.acme.Foo", "org.acme.Foo2",
110-
"org.springframework.boot.FooProperties");
111-
assertThat(group.getSources().get("org.acme.Foo").getProperties()).containsOnlyKeys("spring.foo.name",
112-
"spring.foo.description");
113-
assertThat(group.getSources().get("org.acme.Foo2").getProperties())
114-
.containsOnlyKeys("spring.foo.enabled", "spring.foo.type");
115-
assertThat(group.getSources().get("org.springframework.boot.FooProperties").getProperties())
116-
.containsOnlyKeys("spring.foo.name", "spring.foo.counter");
117-
}
93+
try (InputStream foo = getInputStreamFor("foo"); InputStream foo2 = getInputStreamFor("foo2")) {
94+
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo2).build();
95+
Iterable<String> allKeys = Arrays.asList("spring.foo.name", "spring.foo.description", "spring.foo.counter",
96+
"spring.foo.enabled", "spring.foo.type");
97+
assertThat(repo.getAllProperties()).containsOnlyKeys(allKeys);
98+
assertThat(repo.getAllGroups()).containsOnlyKeys("spring.foo");
99+
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
100+
assertThat(group.getProperties()).containsOnlyKeys(allKeys);
101+
assertThat(group.getSources()).containsOnlyKeys("org.acme.Foo", "org.acme.Foo2",
102+
"org.springframework.boot.FooProperties");
103+
assertThat(group.getSources().get("org.acme.Foo").getProperties()).containsOnlyKeys("spring.foo.name",
104+
"spring.foo.description");
105+
assertThat(group.getSources().get("org.acme.Foo2").getProperties()).containsOnlyKeys("spring.foo.enabled",
106+
"spring.foo.type");
107+
assertThat(group.getSources().get("org.springframework.boot.FooProperties").getProperties())
108+
.containsOnlyKeys("spring.foo.name", "spring.foo.counter");
118109
}
119110
}
120111

121112
@Test
122113
void severalRepositoriesIdenticalGroupsWithSameType() throws IOException {
123-
try (InputStream foo = getInputStreamFor("foo")) {
124-
try (InputStream foo3 = getInputStreamFor("foo3")) {
125-
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo3)
126-
.build();
127-
Iterable<String> allKeys = Arrays.asList("spring.foo.name", "spring.foo.description",
128-
"spring.foo.counter", "spring.foo.enabled", "spring.foo.type");
129-
assertThat(repo.getAllProperties()).containsOnlyKeys(allKeys);
130-
assertThat(repo.getAllGroups()).containsOnlyKeys("spring.foo");
131-
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
132-
assertThat(group.getProperties()).containsOnlyKeys(allKeys);
133-
assertThat(group.getSources()).containsOnlyKeys("org.acme.Foo",
134-
"org.springframework.boot.FooProperties");
135-
assertThat(group.getSources().get("org.acme.Foo").getProperties()).containsOnlyKeys("spring.foo.name",
136-
"spring.foo.description", "spring.foo.enabled", "spring.foo.type");
137-
assertThat(group.getSources().get("org.springframework.boot.FooProperties").getProperties())
138-
.containsOnlyKeys("spring.foo.name", "spring.foo.counter");
139-
}
114+
try (InputStream foo = getInputStreamFor("foo"); InputStream foo3 = getInputStreamFor("foo3")) {
115+
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo3).build();
116+
Iterable<String> allKeys = Arrays.asList("spring.foo.name", "spring.foo.description", "spring.foo.counter",
117+
"spring.foo.enabled", "spring.foo.type");
118+
assertThat(repo.getAllProperties()).containsOnlyKeys(allKeys);
119+
assertThat(repo.getAllGroups()).containsOnlyKeys("spring.foo");
120+
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
121+
assertThat(group.getProperties()).containsOnlyKeys(allKeys);
122+
assertThat(group.getSources()).containsOnlyKeys("org.acme.Foo", "org.springframework.boot.FooProperties");
123+
assertThat(group.getSources().get("org.acme.Foo").getProperties()).containsOnlyKeys("spring.foo.name",
124+
"spring.foo.description", "spring.foo.enabled", "spring.foo.type");
125+
assertThat(group.getSources().get("org.springframework.boot.FooProperties").getProperties())
126+
.containsOnlyKeys("spring.foo.name", "spring.foo.counter");
140127
}
141128
}
142129

143130
@Test
144131
void severalRepositoriesIdenticalGroupsWithSameTypeDoesNotOverrideSource() throws IOException {
145-
try (InputStream foo = getInputStreamFor("foo")) {
146-
try (InputStream foo3 = getInputStreamFor("foo3")) {
147-
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo3)
148-
.build();
149-
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
150-
ConfigurationMetadataSource fooSource = group.getSources().get("org.acme.Foo");
151-
assertThat(fooSource.getSourceMethod()).isEqualTo("foo()");
152-
assertThat(fooSource.getDescription()).isEqualTo("This is Foo.");
153-
}
132+
try (InputStream foo = getInputStreamFor("foo"); InputStream foo3 = getInputStreamFor("foo3")) {
133+
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo3).build();
134+
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
135+
ConfigurationMetadataSource fooSource = group.getSources().get("org.acme.Foo");
136+
assertThat(fooSource.getSourceMethod()).isEqualTo("foo()");
137+
assertThat(fooSource.getDescription()).isEqualTo("This is Foo.");
154138
}
155139
}
156140

@@ -185,22 +169,19 @@ void multiGroups() throws IOException {
185169

186170
@Test
187171
void builderInstancesAreIsolated() throws IOException {
188-
try (InputStream foo = getInputStreamFor("foo")) {
189-
try (InputStream bar = getInputStreamFor("bar")) {
190-
ConfigurationMetadataRepositoryJsonBuilder builder = ConfigurationMetadataRepositoryJsonBuilder
191-
.create();
192-
ConfigurationMetadataRepository firstRepo = builder.withJsonResource(foo).build();
193-
validateFoo(firstRepo);
194-
ConfigurationMetadataRepository secondRepo = builder.withJsonResource(bar).build();
195-
validateFoo(secondRepo);
196-
validateBar(secondRepo);
197-
// first repo not impacted by second build
198-
assertThat(secondRepo).isNotEqualTo(firstRepo);
199-
assertThat(firstRepo.getAllGroups()).hasSize(1);
200-
assertThat(firstRepo.getAllProperties()).hasSize(3);
201-
assertThat(secondRepo.getAllGroups()).hasSize(2);
202-
assertThat(secondRepo.getAllProperties()).hasSize(6);
203-
}
172+
try (InputStream foo = getInputStreamFor("foo"); InputStream bar = getInputStreamFor("bar")) {
173+
ConfigurationMetadataRepositoryJsonBuilder builder = ConfigurationMetadataRepositoryJsonBuilder.create();
174+
ConfigurationMetadataRepository firstRepo = builder.withJsonResource(foo).build();
175+
validateFoo(firstRepo);
176+
ConfigurationMetadataRepository secondRepo = builder.withJsonResource(bar).build();
177+
validateFoo(secondRepo);
178+
validateBar(secondRepo);
179+
// first repo not impacted by second build
180+
assertThat(secondRepo).isNotEqualTo(firstRepo);
181+
assertThat(firstRepo.getAllGroups()).hasSize(1);
182+
assertThat(firstRepo.getAllProperties()).hasSize(3);
183+
assertThat(secondRepo.getAllGroups()).hasSize(2);
184+
assertThat(secondRepo.getAllProperties()).hasSize(6);
204185
}
205186
}
206187

spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/TomEEDeploymentIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* @author Christoph Dreis
2626
*/
2727
@Testcontainers(disabledWithoutDocker = true)
28-
public class TomEEDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests {
28+
class TomEEDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests {
2929

3030
@Container
3131
static WarDeploymentContainer container = new WarDeploymentContainer("tomee:8-jre-8.0.2-webprofile",

spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/TomcatDeploymentIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* @author Christoph Dreis
2626
*/
2727
@Testcontainers(disabledWithoutDocker = true)
28-
public class TomcatDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests {
28+
class TomcatDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests {
2929

3030
@Container
3131
static WarDeploymentContainer container = new WarDeploymentContainer("tomcat:9.0.37-jdk8-openjdk",

spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/WildflyDeploymentIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* @author Christoph Dreis
2626
*/
2727
@Testcontainers(disabledWithoutDocker = true)
28-
public class WildflyDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests {
28+
class WildflyDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests {
2929

3030
@Container
3131
static WarDeploymentContainer container = new WarDeploymentContainer("jboss/wildfly:20.0.1.Final",

0 commit comments

Comments
 (0)