mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish
See gh-25617
This commit is contained in:
parent
11649bc1f0
commit
09f4d4b9bf
@ -62,7 +62,7 @@ public class ToolchainPlugin implements Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJavaVersionSupported(ToolchainExtension toolchain, JavaLanguageVersion toolchainVersion) {
|
private boolean isJavaVersionSupported(ToolchainExtension toolchain, JavaLanguageVersion toolchainVersion) {
|
||||||
return toolchain.getMaximumCompatibleJavaVersion().map((version) -> version.canCompileOrRun(toolchainVersion))
|
return toolchain.getMaximumCompatibleJavaVersion().map((version) -> version.canCompileOrRun(toolchainVersion))
|
||||||
.getOrElse(true);
|
.getOrElse(true);
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,7 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAu
|
|||||||
import org.springframework.boot.actuate.autoconfigure.web.jersey.JerseySameManagementContextConfiguration;
|
import org.springframework.boot.actuate.autoconfigure.web.jersey.JerseySameManagementContextConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||||
import org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration;
|
import org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
|
|
||||||
import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration;
|
import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration;
|
||||||
import org.springframework.boot.logging.LogLevel;
|
|
||||||
import org.springframework.boot.test.context.FilteredClassLoader;
|
import org.springframework.boot.test.context.FilteredClassLoader;
|
||||||
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
|
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
|
||||||
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
|
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
|
||||||
@ -55,7 +53,6 @@ class JerseyWebEndpointIntegrationTests {
|
|||||||
JerseyWebEndpointManagementContextConfiguration.class))
|
JerseyWebEndpointManagementContextConfiguration.class))
|
||||||
.withUserConfiguration(ResourceConfigConfiguration.class)
|
.withUserConfiguration(ResourceConfigConfiguration.class)
|
||||||
.withClassLoader(new FilteredClassLoader(DispatcherServlet.class))
|
.withClassLoader(new FilteredClassLoader(DispatcherServlet.class))
|
||||||
.withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.INFO))
|
|
||||||
.withPropertyValues("spring.jersey.type=filter", "server.port=0").run((context) -> {
|
.withPropertyValues("spring.jersey.type=filter", "server.port=0").run((context) -> {
|
||||||
assertThat(context).hasNotFailed();
|
assertThat(context).hasNotFailed();
|
||||||
Set<Resource> resources = context.getBean(ResourceConfig.class).getResources();
|
Set<Resource> resources = context.getBean(ResourceConfig.class).getResources();
|
||||||
|
@ -19,8 +19,6 @@ package org.springframework.boot.autoconfigure.rsocket;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||||
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
|
|
||||||
import org.springframework.boot.logging.LogLevel;
|
|
||||||
import org.springframework.boot.rsocket.context.RSocketPortInfoApplicationContextInitializer;
|
import org.springframework.boot.rsocket.context.RSocketPortInfoApplicationContextInitializer;
|
||||||
import org.springframework.boot.rsocket.context.RSocketServerBootstrap;
|
import org.springframework.boot.rsocket.context.RSocketServerBootstrap;
|
||||||
import org.springframework.boot.rsocket.server.RSocketServerCustomizer;
|
import org.springframework.boot.rsocket.server.RSocketServerCustomizer;
|
||||||
@ -148,7 +146,6 @@ class RSocketServerAutoConfigurationTests {
|
|||||||
@Test
|
@Test
|
||||||
void whenSpringWebIsNotPresentThenEmbeddedServerConfigurationBacksOff() {
|
void whenSpringWebIsNotPresentThenEmbeddedServerConfigurationBacksOff() {
|
||||||
contextRunner().withClassLoader(new FilteredClassLoader(ReactorResourceFactory.class))
|
contextRunner().withClassLoader(new FilteredClassLoader(ReactorResourceFactory.class))
|
||||||
.withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.INFO))
|
|
||||||
.withPropertyValues("spring.rsocket.server.port=0")
|
.withPropertyValues("spring.rsocket.server.port=0")
|
||||||
.run((context) -> assertThat(context).doesNotHaveBean(RSocketServerFactory.class));
|
.run((context) -> assertThat(context).doesNotHaveBean(RSocketServerFactory.class));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2021 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -64,93 +64,77 @@ class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractConfigurat
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void severalRepositoriesNoConflict() throws IOException {
|
void severalRepositoriesNoConflict() throws IOException {
|
||||||
try (InputStream foo = getInputStreamFor("foo")) {
|
try (InputStream foo = getInputStreamFor("foo"); InputStream bar = getInputStreamFor("bar")) {
|
||||||
try (InputStream bar = getInputStreamFor("bar")) {
|
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, bar).build();
|
||||||
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, bar)
|
validateFoo(repo);
|
||||||
.build();
|
validateBar(repo);
|
||||||
validateFoo(repo);
|
assertThat(repo.getAllGroups()).hasSize(2);
|
||||||
validateBar(repo);
|
contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
|
||||||
assertThat(repo.getAllGroups()).hasSize(2);
|
"spring.bar.name", "spring.bar.description", "spring.bar.counter");
|
||||||
contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
|
assertThat(repo.getAllProperties()).hasSize(6);
|
||||||
"spring.bar.name", "spring.bar.description", "spring.bar.counter");
|
|
||||||
assertThat(repo.getAllProperties()).hasSize(6);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void repositoryWithRoot() throws IOException {
|
void repositoryWithRoot() throws IOException {
|
||||||
try (InputStream foo = getInputStreamFor("foo")) {
|
try (InputStream foo = getInputStreamFor("foo"); InputStream root = getInputStreamFor("root")) {
|
||||||
try (InputStream root = getInputStreamFor("root")) {
|
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, root).build();
|
||||||
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, root)
|
validateFoo(repo);
|
||||||
.build();
|
assertThat(repo.getAllGroups()).hasSize(2);
|
||||||
validateFoo(repo);
|
|
||||||
assertThat(repo.getAllGroups()).hasSize(2);
|
|
||||||
|
|
||||||
contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
|
contains(repo.getAllProperties(), "spring.foo.name", "spring.foo.description", "spring.foo.counter",
|
||||||
"spring.root.name", "spring.root2.name");
|
"spring.root.name", "spring.root2.name");
|
||||||
assertThat(repo.getAllProperties()).hasSize(5);
|
assertThat(repo.getAllProperties()).hasSize(5);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void severalRepositoriesIdenticalGroups() throws IOException {
|
void severalRepositoriesIdenticalGroups() throws IOException {
|
||||||
try (InputStream foo = getInputStreamFor("foo")) {
|
try (InputStream foo = getInputStreamFor("foo"); InputStream foo2 = getInputStreamFor("foo2")) {
|
||||||
try (InputStream foo2 = getInputStreamFor("foo2")) {
|
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo2).build();
|
||||||
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo2)
|
Iterable<String> allKeys = Arrays.asList("spring.foo.name", "spring.foo.description", "spring.foo.counter",
|
||||||
.build();
|
"spring.foo.enabled", "spring.foo.type");
|
||||||
Iterable<String> allKeys = Arrays.asList("spring.foo.name", "spring.foo.description",
|
assertThat(repo.getAllProperties()).containsOnlyKeys(allKeys);
|
||||||
"spring.foo.counter", "spring.foo.enabled", "spring.foo.type");
|
assertThat(repo.getAllGroups()).containsOnlyKeys("spring.foo");
|
||||||
assertThat(repo.getAllProperties()).containsOnlyKeys(allKeys);
|
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
|
||||||
assertThat(repo.getAllGroups()).containsOnlyKeys("spring.foo");
|
assertThat(group.getProperties()).containsOnlyKeys(allKeys);
|
||||||
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
|
assertThat(group.getSources()).containsOnlyKeys("org.acme.Foo", "org.acme.Foo2",
|
||||||
assertThat(group.getProperties()).containsOnlyKeys(allKeys);
|
"org.springframework.boot.FooProperties");
|
||||||
assertThat(group.getSources()).containsOnlyKeys("org.acme.Foo", "org.acme.Foo2",
|
assertThat(group.getSources().get("org.acme.Foo").getProperties()).containsOnlyKeys("spring.foo.name",
|
||||||
"org.springframework.boot.FooProperties");
|
"spring.foo.description");
|
||||||
assertThat(group.getSources().get("org.acme.Foo").getProperties()).containsOnlyKeys("spring.foo.name",
|
assertThat(group.getSources().get("org.acme.Foo2").getProperties()).containsOnlyKeys("spring.foo.enabled",
|
||||||
"spring.foo.description");
|
"spring.foo.type");
|
||||||
assertThat(group.getSources().get("org.acme.Foo2").getProperties())
|
assertThat(group.getSources().get("org.springframework.boot.FooProperties").getProperties())
|
||||||
.containsOnlyKeys("spring.foo.enabled", "spring.foo.type");
|
.containsOnlyKeys("spring.foo.name", "spring.foo.counter");
|
||||||
assertThat(group.getSources().get("org.springframework.boot.FooProperties").getProperties())
|
|
||||||
.containsOnlyKeys("spring.foo.name", "spring.foo.counter");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void severalRepositoriesIdenticalGroupsWithSameType() throws IOException {
|
void severalRepositoriesIdenticalGroupsWithSameType() throws IOException {
|
||||||
try (InputStream foo = getInputStreamFor("foo")) {
|
try (InputStream foo = getInputStreamFor("foo"); InputStream foo3 = getInputStreamFor("foo3")) {
|
||||||
try (InputStream foo3 = getInputStreamFor("foo3")) {
|
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo3).build();
|
||||||
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo3)
|
Iterable<String> allKeys = Arrays.asList("spring.foo.name", "spring.foo.description", "spring.foo.counter",
|
||||||
.build();
|
"spring.foo.enabled", "spring.foo.type");
|
||||||
Iterable<String> allKeys = Arrays.asList("spring.foo.name", "spring.foo.description",
|
assertThat(repo.getAllProperties()).containsOnlyKeys(allKeys);
|
||||||
"spring.foo.counter", "spring.foo.enabled", "spring.foo.type");
|
assertThat(repo.getAllGroups()).containsOnlyKeys("spring.foo");
|
||||||
assertThat(repo.getAllProperties()).containsOnlyKeys(allKeys);
|
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
|
||||||
assertThat(repo.getAllGroups()).containsOnlyKeys("spring.foo");
|
assertThat(group.getProperties()).containsOnlyKeys(allKeys);
|
||||||
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
|
assertThat(group.getSources()).containsOnlyKeys("org.acme.Foo", "org.springframework.boot.FooProperties");
|
||||||
assertThat(group.getProperties()).containsOnlyKeys(allKeys);
|
assertThat(group.getSources().get("org.acme.Foo").getProperties()).containsOnlyKeys("spring.foo.name",
|
||||||
assertThat(group.getSources()).containsOnlyKeys("org.acme.Foo",
|
"spring.foo.description", "spring.foo.enabled", "spring.foo.type");
|
||||||
"org.springframework.boot.FooProperties");
|
assertThat(group.getSources().get("org.springframework.boot.FooProperties").getProperties())
|
||||||
assertThat(group.getSources().get("org.acme.Foo").getProperties()).containsOnlyKeys("spring.foo.name",
|
.containsOnlyKeys("spring.foo.name", "spring.foo.counter");
|
||||||
"spring.foo.description", "spring.foo.enabled", "spring.foo.type");
|
|
||||||
assertThat(group.getSources().get("org.springframework.boot.FooProperties").getProperties())
|
|
||||||
.containsOnlyKeys("spring.foo.name", "spring.foo.counter");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void severalRepositoriesIdenticalGroupsWithSameTypeDoesNotOverrideSource() throws IOException {
|
void severalRepositoriesIdenticalGroupsWithSameTypeDoesNotOverrideSource() throws IOException {
|
||||||
try (InputStream foo = getInputStreamFor("foo")) {
|
try (InputStream foo = getInputStreamFor("foo"); InputStream foo3 = getInputStreamFor("foo3")) {
|
||||||
try (InputStream foo3 = getInputStreamFor("foo3")) {
|
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo3).build();
|
||||||
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo3)
|
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
|
||||||
.build();
|
ConfigurationMetadataSource fooSource = group.getSources().get("org.acme.Foo");
|
||||||
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
|
assertThat(fooSource.getSourceMethod()).isEqualTo("foo()");
|
||||||
ConfigurationMetadataSource fooSource = group.getSources().get("org.acme.Foo");
|
assertThat(fooSource.getDescription()).isEqualTo("This is Foo.");
|
||||||
assertThat(fooSource.getSourceMethod()).isEqualTo("foo()");
|
|
||||||
assertThat(fooSource.getDescription()).isEqualTo("This is Foo.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,22 +169,19 @@ class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractConfigurat
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void builderInstancesAreIsolated() throws IOException {
|
void builderInstancesAreIsolated() throws IOException {
|
||||||
try (InputStream foo = getInputStreamFor("foo")) {
|
try (InputStream foo = getInputStreamFor("foo"); InputStream bar = getInputStreamFor("bar")) {
|
||||||
try (InputStream bar = getInputStreamFor("bar")) {
|
ConfigurationMetadataRepositoryJsonBuilder builder = ConfigurationMetadataRepositoryJsonBuilder.create();
|
||||||
ConfigurationMetadataRepositoryJsonBuilder builder = ConfigurationMetadataRepositoryJsonBuilder
|
ConfigurationMetadataRepository firstRepo = builder.withJsonResource(foo).build();
|
||||||
.create();
|
validateFoo(firstRepo);
|
||||||
ConfigurationMetadataRepository firstRepo = builder.withJsonResource(foo).build();
|
ConfigurationMetadataRepository secondRepo = builder.withJsonResource(bar).build();
|
||||||
validateFoo(firstRepo);
|
validateFoo(secondRepo);
|
||||||
ConfigurationMetadataRepository secondRepo = builder.withJsonResource(bar).build();
|
validateBar(secondRepo);
|
||||||
validateFoo(secondRepo);
|
// first repo not impacted by second build
|
||||||
validateBar(secondRepo);
|
assertThat(secondRepo).isNotEqualTo(firstRepo);
|
||||||
// first repo not impacted by second build
|
assertThat(firstRepo.getAllGroups()).hasSize(1);
|
||||||
assertThat(secondRepo).isNotEqualTo(firstRepo);
|
assertThat(firstRepo.getAllProperties()).hasSize(3);
|
||||||
assertThat(firstRepo.getAllGroups()).hasSize(1);
|
assertThat(secondRepo.getAllGroups()).hasSize(2);
|
||||||
assertThat(firstRepo.getAllProperties()).hasSize(3);
|
assertThat(secondRepo.getAllProperties()).hasSize(6);
|
||||||
assertThat(secondRepo.getAllGroups()).hasSize(2);
|
|
||||||
assertThat(secondRepo.getAllProperties()).hasSize(6);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import org.testcontainers.junit.jupiter.Testcontainers;
|
|||||||
* @author Christoph Dreis
|
* @author Christoph Dreis
|
||||||
*/
|
*/
|
||||||
@Testcontainers(disabledWithoutDocker = true)
|
@Testcontainers(disabledWithoutDocker = true)
|
||||||
public class TomEEDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests {
|
class TomEEDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests {
|
||||||
|
|
||||||
@Container
|
@Container
|
||||||
static WarDeploymentContainer container = new WarDeploymentContainer("tomee:8-jre-8.0.2-webprofile",
|
static WarDeploymentContainer container = new WarDeploymentContainer("tomee:8-jre-8.0.2-webprofile",
|
||||||
|
@ -25,7 +25,7 @@ import org.testcontainers.junit.jupiter.Testcontainers;
|
|||||||
* @author Christoph Dreis
|
* @author Christoph Dreis
|
||||||
*/
|
*/
|
||||||
@Testcontainers(disabledWithoutDocker = true)
|
@Testcontainers(disabledWithoutDocker = true)
|
||||||
public class TomcatDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests {
|
class TomcatDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests {
|
||||||
|
|
||||||
@Container
|
@Container
|
||||||
static WarDeploymentContainer container = new WarDeploymentContainer("tomcat:9.0.37-jdk8-openjdk",
|
static WarDeploymentContainer container = new WarDeploymentContainer("tomcat:9.0.37-jdk8-openjdk",
|
||||||
|
@ -25,7 +25,7 @@ import org.testcontainers.junit.jupiter.Testcontainers;
|
|||||||
* @author Christoph Dreis
|
* @author Christoph Dreis
|
||||||
*/
|
*/
|
||||||
@Testcontainers(disabledWithoutDocker = true)
|
@Testcontainers(disabledWithoutDocker = true)
|
||||||
public class WildflyDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests {
|
class WildflyDeploymentIntegrationTests extends AbstractDeploymentIntegrationTests {
|
||||||
|
|
||||||
@Container
|
@Container
|
||||||
static WarDeploymentContainer container = new WarDeploymentContainer("jboss/wildfly:20.0.1.Final",
|
static WarDeploymentContainer container = new WarDeploymentContainer("jboss/wildfly:20.0.1.Final",
|
||||||
|
Loading…
Reference in New Issue
Block a user