Merge pull request #10636 from izeye:polish-20171014

* pr/10636:
  Polish
This commit is contained in:
Stephane Nicoll 2017-10-17 15:29:56 +02:00
commit 3e18213362
18 changed files with 28 additions and 39 deletions

View File

@ -153,7 +153,7 @@ public class EndpointEnablementProviderTests {
} }
@Test @Test
public void defaultEnablementNeutralWebWithTechDisablement() { public void defaultEnablementNeutralJmxWithTechDisablement() {
EndpointEnablement enablement = getEndpointEnablement("biz", EndpointEnablement enablement = getEndpointEnablement("biz",
DefaultEnablement.NEUTRAL, EndpointExposure.JMX, DefaultEnablement.NEUTRAL, EndpointExposure.JMX,
"endpoints.default.jmx.enabled=false"); "endpoints.default.jmx.enabled=false");
@ -177,7 +177,7 @@ public class EndpointEnablementProviderTests {
} }
@Test @Test
public void defaultEnablementNeutralWebWithUnrelatedTechDisablement() { public void defaultEnablementNeutralJmxWithUnrelatedTechDisablement() {
EndpointEnablement enablement = getEndpointEnablement("biz", EndpointEnablement enablement = getEndpointEnablement("biz",
DefaultEnablement.NEUTRAL, EndpointExposure.JMX, DefaultEnablement.NEUTRAL, EndpointExposure.JMX,
"endpoints.default.web.enabled=false"); "endpoints.default.web.enabled=false");
@ -235,20 +235,20 @@ public class EndpointEnablementProviderTests {
} }
private EndpointEnablement getEndpointEnablement(String id, private EndpointEnablement getEndpointEnablement(String id,
DefaultEnablement enabledByDefault, String... environment) { DefaultEnablement defaultEnablement, String... environment) {
return getEndpointEnablement(id, enabledByDefault, null, environment); return getEndpointEnablement(id, defaultEnablement, null, environment);
} }
private EndpointEnablement getEndpointEnablement(String id, private EndpointEnablement getEndpointEnablement(String id,
DefaultEnablement enabledByDefault, EndpointExposure exposure, DefaultEnablement defaultEnablement, EndpointExposure exposure,
String... environment) { String... environment) {
MockEnvironment env = new MockEnvironment(); MockEnvironment env = new MockEnvironment();
TestPropertyValues.of(environment).applyTo(env); TestPropertyValues.of(environment).applyTo(env);
EndpointEnablementProvider provider = new EndpointEnablementProvider(env); EndpointEnablementProvider provider = new EndpointEnablementProvider(env);
if (exposure != null) { if (exposure != null) {
return provider.getEndpointEnablement(id, enabledByDefault, exposure); return provider.getEndpointEnablement(id, defaultEnablement, exposure);
} }
return provider.getEndpointEnablement(id, enabledByDefault); return provider.getEndpointEnablement(id, defaultEnablement);
} }
private void validate(EndpointEnablement enablement, boolean enabled, private void validate(EndpointEnablement enablement, boolean enabled,

View File

@ -89,7 +89,7 @@ public class HealthEndpointAutoConfigurationTests {
} }
@Test @Test
public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() public void runWhenEnabledPropertyIsFalseShouldNotHaveStatusEndpointBean()
throws Exception { throws Exception {
this.contextRunner.withPropertyValues("endpoints.status.enabled:false").run( this.contextRunner.withPropertyValues("endpoints.status.enabled:false").run(
(context) -> assertThat(context).doesNotHaveBean(StatusEndpoint.class)); (context) -> assertThat(context).doesNotHaveBean(StatusEndpoint.class));

View File

@ -108,7 +108,7 @@ public class WebFluxEndpointHandlerMapping extends RequestMappingInfoHandlerMapp
/** /**
* Creates a new {@code WebEndpointHandlerMapping} that provides mappings for the * Creates a new {@code WebEndpointHandlerMapping} that provides mappings for the
* operations of the given {@code webEndpoints}. * operations of the given {@code webEndpoints}.
* @param endpointMapping the path beneath which all endpoints should be mapped * @param endpointMapping the base mapping for all endpoints
* @param webEndpoints the web endpoints * @param webEndpoints the web endpoints
* @param endpointMediaTypes media types consumed and produced by the endpoints * @param endpointMediaTypes media types consumed and produced by the endpoints
* @param corsConfiguration the CORS configuration for the endpoints * @param corsConfiguration the CORS configuration for the endpoints

View File

@ -68,7 +68,7 @@ public class AnnotationEndpointDiscovererTests {
} }
@Test @Test
public void endpointIsInParentContextIsDiscovered() { public void endpointInParentContextIsDiscovered() {
AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext( AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext(
TestEndpointConfiguration.class); TestEndpointConfiguration.class);
loadWithParent(parent, EmptyConfiguration.class, hasTestEndpoint()); loadWithParent(parent, EmptyConfiguration.class, hasTestEndpoint());

View File

@ -37,12 +37,12 @@ public class OAuth2ClientProperties {
/** /**
* OAuth provider details. * OAuth provider details.
*/ */
private Map<String, Provider> provider = new HashMap<>(); private final Map<String, Provider> provider = new HashMap<>();
/** /**
* OAuth client registrations. * OAuth client registrations.
*/ */
private Map<String, Registration> registration = new HashMap<>(); private final Map<String, Registration> registration = new HashMap<>();
public Map<String, Provider> getProvider() { public Map<String, Provider> getProvider() {
return this.provider; return this.provider;
@ -92,28 +92,28 @@ public class OAuth2ClientProperties {
private String clientSecret; private String clientSecret;
/** /**
* Client authentication method. May be left bank then using a pre-defined * Client authentication method. May be left blank then using a pre-defined
* provider. * provider.
*/ */
private String clientAuthenticationMethod; private String clientAuthenticationMethod;
/** /**
* Authorization grant type. May be left bank then using a pre-defined provider. * Authorization grant type. May be left blank then using a pre-defined provider.
*/ */
private String authorizationGrantType; private String authorizationGrantType;
/** /**
* Redirect URI. May be left bank then using a pre-defined provider. * Redirect URI. May be left blank then using a pre-defined provider.
*/ */
private String redirectUri; private String redirectUri;
/** /**
* Authorization scopes. May be left bank then using a pre-defined provider. * Authorization scopes. May be left blank then using a pre-defined provider.
*/ */
private Set<String> scope; private Set<String> scope;
/** /**
* Client name. May be left bank then using a pre-defined provider. * Client name. May be left blank then using a pre-defined provider.
*/ */
private String clientName; private String clientName;

View File

@ -20,7 +20,7 @@ import org.springframework.boot.diagnostics.AbstractFailureAnalyzer;
import org.springframework.boot.diagnostics.FailureAnalysis; import org.springframework.boot.diagnostics.FailureAnalysis;
/** /**
* A {@link AbstractFailureAnalyzer} for {@link NonUniqueSessionRepositoryException}. * An {@link AbstractFailureAnalyzer} for {@link NonUniqueSessionRepositoryException}.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */

View File

@ -29,9 +29,7 @@ import org.apache.tomcat.jdbc.pool.DataSource;
import org.apache.tomcat.jdbc.pool.DataSourceProxy; import org.apache.tomcat.jdbc.pool.DataSourceProxy;
import org.apache.tomcat.jdbc.pool.jmx.ConnectionPool; import org.apache.tomcat.jdbc.pool.jmx.ConnectionPool;
import org.junit.After; import org.junit.After;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration; import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration;
import org.springframework.boot.test.util.TestPropertyValues; import org.springframework.boot.test.util.TestPropertyValues;
@ -47,9 +45,6 @@ import static org.assertj.core.api.Assertions.assertThat;
*/ */
public class DataSourceJmxConfigurationTests { public class DataSourceJmxConfigurationTests {
@Rule
public ExpectedException thrown = ExpectedException.none();
private ConfigurableApplicationContext context; private ConfigurableApplicationContext context;
@After @After

View File

@ -23,9 +23,7 @@ import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress; import com.mongodb.ServerAddress;
import com.mongodb.connection.Cluster; import com.mongodb.connection.Cluster;
import com.mongodb.connection.ClusterSettings; import com.mongodb.connection.ClusterSettings;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -45,9 +43,6 @@ import static org.assertj.core.api.Assertions.assertThat;
*/ */
public class MongoClientFactoryTests { public class MongoClientFactoryTests {
@Rule
public ExpectedException thrown = ExpectedException.none();
private MockEnvironment environment = new MockEnvironment(); private MockEnvironment environment = new MockEnvironment();
@Test @Test

View File

@ -48,7 +48,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
provider.setAuthorizationUri("http://example.com/auth"); provider.setAuthorizationUri("http://example.com/auth");
provider.setTokenUri("http://example.com/token"); provider.setTokenUri("http://example.com/token");
provider.setUserInfoUri("http://example.com/info"); provider.setUserInfoUri("http://example.com/info");
provider.setJwkSetUri("http://example.com/jkw"); provider.setJwkSetUri("http://example.com/jwk");
Registration registration = new Registration(); Registration registration = new Registration();
registration.setProvider("provider"); registration.setProvider("provider");
registration.setClientId("clientId"); registration.setClientId("clientId");
@ -69,7 +69,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
assertThat(adaptedProvider.getTokenUri()).isEqualTo("http://example.com/token"); assertThat(adaptedProvider.getTokenUri()).isEqualTo("http://example.com/token");
assertThat(adaptedProvider.getUserInfoEndpoint().getUri()) assertThat(adaptedProvider.getUserInfoEndpoint().getUri())
.isEqualTo("http://example.com/info"); .isEqualTo("http://example.com/info");
assertThat(adaptedProvider.getJwkSetUri()).isEqualTo("http://example.com/jkw"); assertThat(adaptedProvider.getJwkSetUri()).isEqualTo("http://example.com/jwk");
assertThat(adapted.getRegistrationId()).isEqualTo("registration"); assertThat(adapted.getRegistrationId()).isEqualTo("registration");
assertThat(adapted.getClientId()).isEqualTo("clientId"); assertThat(adapted.getClientId()).isEqualTo("clientId");
assertThat(adapted.getClientSecret()).isEqualTo("clientSecret"); assertThat(adapted.getClientSecret()).isEqualTo("clientSecret");

View File

@ -123,7 +123,7 @@ When you're ready to push your Spring Boot application to production, we've got
<<production-ready-features.adoc#production-ready-customizing-endpoints, Customization>> <<production-ready-features.adoc#production-ready-customizing-endpoints, Customization>>
* *Connection options:* * *Connection options:*
<<production-ready-features.adoc#production-ready-monitoring, HTTP>> | <<production-ready-features.adoc#production-ready-monitoring, HTTP>> |
<<production-ready-features.adoc#production-ready-jmx, JMX>> | <<production-ready-features.adoc#production-ready-jmx, JMX>>
* *Monitoring:* * *Monitoring:*
<<production-ready-features.adoc#production-ready-metrics, Metrics>> | <<production-ready-features.adoc#production-ready-metrics, Metrics>> |
<<production-ready-features.adoc#production-ready-auditing, Auditing>> | <<production-ready-features.adoc#production-ready-auditing, Auditing>> |

View File

@ -252,7 +252,7 @@ endif::[]
[[getting-started-installing-the-cli]] [[getting-started-installing-the-cli]]
=== Installing the Spring Boot CLI === Installing the Spring Boot CLI
The Spring Boot CLI is a command line tool that can be used if you want to quickly The Spring Boot CLI is a command line tool that can be used if you want to quickly
prototype with Spring. It allows you to run http://groovy.codehaus.org/[Groovy] scripts, prototype with Spring. It allows you to run http://groovy-lang.org/[Groovy] scripts,
which means that you have a familiar Java-like syntax, without so much boilerplate code. which means that you have a familiar Java-like syntax, without so much boilerplate code.
You don't need to use the CLI to work with Spring Boot but it's definitely the quickest You don't need to use the CLI to work with Spring Boot but it's definitely the quickest

View File

@ -581,7 +581,7 @@ The `application.properties` example above will change the endpoint from `/appli
NOTE: Unless the management port has been configured to NOTE: Unless the management port has been configured to
<<production-ready-customizing-management-server-port,expose endpoints using a different <<production-ready-customizing-management-server-port,expose endpoints using a different
HTTP port>>, `management.endpoints.web.base-path` is relative to `server.context-path`. If `management.server.port` HTTP port>>, `management.endpoints.web.base-path` is relative to `server.context-path`. If `management.server.port`
is configured, `management.endpoints.web.base-path`, is relative to `management.server.context-path`. is configured, `management.endpoints.web.base-path`, is relative to `management.server.servlet.context-path`.

View File

@ -27,7 +27,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
/** /**
* A {@link AbstractApplicationContextRunner ApplicationContext runner} for a standard, * An {@link AbstractApplicationContextRunner ApplicationContext runner} for a standard,
* non-web environment {@link ConfigurableApplicationContext}. * non-web environment {@link ConfigurableApplicationContext}.
* <p> * <p>
* See {@link AbstractApplicationContextRunner} for details. * See {@link AbstractApplicationContextRunner} for details.

View File

@ -27,7 +27,7 @@ import org.springframework.boot.web.reactive.context.GenericReactiveWebApplicati
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
/** /**
* A {@link AbstractApplicationContextRunner ApplicationContext runner} for a * An {@link AbstractApplicationContextRunner ApplicationContext runner} for a
* {@link ConfigurableReactiveWebApplicationContext}. * {@link ConfigurableReactiveWebApplicationContext}.
* <p> * <p>
* See {@link AbstractApplicationContextRunner} for details. * See {@link AbstractApplicationContextRunner} for details.

View File

@ -29,7 +29,7 @@ import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
/** /**
* A {@link AbstractApplicationContextRunner ApplicationContext runner} for a Servlet * An {@link AbstractApplicationContextRunner ApplicationContext runner} for a Servlet
* based {@link ConfigurableWebApplicationContext}. * based {@link ConfigurableWebApplicationContext}.
* <p> * <p>
* See {@link AbstractApplicationContextRunner} for details. * See {@link AbstractApplicationContextRunner} for details.

View File

@ -74,7 +74,6 @@ public class ApplicationContextAssertTests {
@Test @Test
public void hasBeanWhenNotStartedShouldFail() { public void hasBeanWhenNotStartedShouldFail() {
this.thrown.expect(AssertionError.class); this.thrown.expect(AssertionError.class);
this.thrown.expectMessage("failed to start");
this.thrown.expectMessage(String this.thrown.expectMessage(String
.format("but context failed to start:%n java.lang.RuntimeException")); .format("but context failed to start:%n java.lang.RuntimeException"));
assertThat(getAssert(this.failure)).hasBean("foo"); assertThat(getAssert(this.failure)).hasBean("foo");

View File

@ -20,7 +20,7 @@ import org.springframework.boot.configurationsample.DefaultEnablement;
import org.springframework.boot.configurationsample.Endpoint; import org.springframework.boot.configurationsample.Endpoint;
/** /**
* An endpoint that is enabled unless configured explicitly.. * An endpoint that is enabled unless configured explicitly.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */

View File

@ -52,7 +52,7 @@ class UnresolvedDependenciesAnalyzer {
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();
message.append("\nDuring the build, one or more dependencies that were " message.append("\nDuring the build, one or more dependencies that were "
+ "declared without a version failed to resolve:\n"); + "declared without a version failed to resolve:\n");
this.dependenciesWithNoVersion.stream() this.dependenciesWithNoVersion
.forEach((dependency) -> message.append(" " + dependency + "\n")); .forEach((dependency) -> message.append(" " + dependency + "\n"));
message.append("\nDid you forget to apply the " message.append("\nDid you forget to apply the "
+ "io.spring.dependency-management plugin to the " + project.getName() + "io.spring.dependency-management plugin to the " + project.getName()