From 38713c473f4a3ba6cdc6019bdb7d673b8db6b28a Mon Sep 17 00:00:00 2001 From: Oscar Utbult Date: Thu, 1 Dec 2016 23:34:04 +0100 Subject: [PATCH 1/5] Remove redundant array creation for calling varargs method Closes gh-7551 --- .../boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java | 2 +- .../autoconfigure/EndpointWebMvcAutoConfigurationTests.java | 2 +- .../mvc/HalBrowserMvcEndpointDisabledIntegrationTests.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) mode change 100644 => 100755 spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java mode change 100644 => 100755 spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java mode change 100644 => 100755 spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointDisabledIntegrationTests.java diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java old mode 100644 new mode 100755 index b6e2d3dc74..d484fc8b1e --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java @@ -139,7 +139,7 @@ public class EndpointMvcIntegrationTests { @Override public void customize(EndpointHandlerMapping mapping) { - mapping.setInterceptors(new Object[] { interceptor() }); + mapping.setInterceptors(interceptor()); } }; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java old mode 100644 new mode 100755 index ce8cfe0cdc..98ee319a15 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java @@ -850,7 +850,7 @@ public class EndpointWebMvcAutoConfigurationTests { @Override public void customize(EndpointHandlerMapping mapping) { - mapping.setInterceptors(new Object[] { interceptor() }); + mapping.setInterceptors(interceptor()); } }; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointDisabledIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointDisabledIntegrationTests.java old mode 100644 new mode 100755 index 351c9d8a50..2dc038995b --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointDisabledIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointDisabledIntegrationTests.java @@ -98,7 +98,7 @@ public class HalBrowserMvcEndpointDisabledIntegrationTests { public static void main(String[] args) { SpringApplication.run(SpringBootHypermediaApplication.class, - new String[] { "--endpoints.hypermedia.enabled=false" }); + "--endpoints.hypermedia.enabled=false"); } } From 6d1b752ffeb23424a93a977bcbdd2f9dd4fed9ec Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Fri, 2 Dec 2016 10:40:54 +0900 Subject: [PATCH 2/5] Polish Closes gh-7552 --- .../src/main/asciidoc/loggers.adoc | 10 +++++----- .../MetricFilterAutoConfigurationTests.java | 2 +- .../boot/devtools/tests/DevToolsIntegrationTests.java | 4 ++-- .../boot/devtools/tests/JvmLauncher.java | 2 +- .../boot/loader/tools/LibraryCallback.java | 2 +- .../springframework/boot/logging/LoggingSystem.java | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spring-boot-actuator-docs/src/main/asciidoc/loggers.adoc b/spring-boot-actuator-docs/src/main/asciidoc/loggers.adoc index 735fec1104..7a0b2cc68d 100644 --- a/spring-boot-actuator-docs/src/main/asciidoc/loggers.adoc +++ b/spring-boot-actuator-docs/src/main/asciidoc/loggers.adoc @@ -2,7 +2,7 @@ This endpoint allows you to view and modify the log levels for the loggers in your application. It builds on top of the `LoggingSystem` abstraction and supports the same logging frameworks. The logging levels are defined by the `LogLevel` enumeration and -consists of the following values (although not all logging systems support the full set): +consist of the following values (although not all logging systems support the full set): * `TRACE` * `DEBUG` @@ -25,7 +25,7 @@ configuration defined. Example curl request: include::{generated}/loggers/curl-request.adoc[] -Example HTTP request: [small]##link:../health[icon:external-link[role="silver"]]## +Example HTTP request: [small]##link:../loggers[icon:external-link[role="silver"]]## include::{generated}/loggers/http-request.adoc[] Example HTTP response: @@ -37,7 +37,7 @@ include::{generated}/loggers/http-response.adoc[] Example curl request: include::{generated}/single-logger/curl-request.adoc[] -Example HTTP request: [small]##link:../health[icon:external-link[role="silver"]]## +Example HTTP request: [small]##link:../loggers[icon:external-link[role="silver"]]## include::{generated}/single-logger/http-request.adoc[] Example HTTP response: @@ -49,12 +49,12 @@ include::{generated}/single-logger/http-response.adoc[] Setting the `configuredLevel` of a logger requires `POSTing` a partial payload to the resource. The `configuredLevel` property must contain a string representation of the enumeration described above. `null` indicates that the log level should be unset, -allowing it to inherit configuration from it's parent. +allowing it to inherit configuration from its parent. Example curl request: include::{generated}/set-logger/curl-request.adoc[] -Example HTTP request: [small]##link:../health[icon:external-link[role="silver"]]## +Example HTTP request: [small]##link:../loggers[icon:external-link[role="silver"]]## include::{generated}/set-logger/http-request.adoc[] Example HTTP response: diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java index 22ff1412bf..d45b16cafd 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfigurationTests.java @@ -145,7 +145,7 @@ public class MetricFilterAutoConfigurationTests { } @Test - public void recordsHttpInteractionsWithWilcardMapping() throws Exception { + public void recordsHttpInteractionsWithWildcardMapping() throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( Config.class, MetricFilterAutoConfiguration.class); Filter filter = context.getBean(Filter.class); diff --git a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java index 648b39cc5a..32050fda00 100644 --- a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java +++ b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java @@ -85,7 +85,7 @@ public class DevToolsIntegrationTests { @Test public void addARequestMappingToAnExistingController() throws Exception { TestRestTemplate template = new TestRestTemplate(); - String urlBase = "http://localhost:" + awaitServerPort() + "/"; + String urlBase = "http://localhost:" + awaitServerPort(); assertThat(template.getForObject(urlBase + "/one", String.class)) .isEqualTo("one"); assertThat(template.getForEntity(urlBase + "/two", String.class).getStatusCode()) @@ -111,7 +111,7 @@ public class DevToolsIntegrationTests { @Test public void createAController() throws Exception { TestRestTemplate template = new TestRestTemplate(); - String urlBase = "http://localhost:" + awaitServerPort() + "/"; + String urlBase = "http://localhost:" + awaitServerPort(); assertThat(template.getForObject(urlBase + "/one", String.class)) .isEqualTo("one"); assertThat(template.getForEntity(urlBase + "/two", String.class).getStatusCode()) diff --git a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JvmLauncher.java b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JvmLauncher.java index a21206d788..3704b9d6ea 100644 --- a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JvmLauncher.java +++ b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JvmLauncher.java @@ -38,7 +38,7 @@ class JvmLauncher implements TestRule { @Override public Statement apply(Statement base, Description description) { - this.outputDirectory = new File("target/output/" + "/" + this.outputDirectory = new File("target/output/" + description.getMethodName().replaceAll("[^A-Za-z]+", "")); this.outputDirectory.mkdirs(); return base; diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LibraryCallback.java b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LibraryCallback.java index 17262c3834..675f4157f6 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LibraryCallback.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LibraryCallback.java @@ -27,7 +27,7 @@ import java.io.IOException; public interface LibraryCallback { /** - * Callback to for a single library backed by a {@link File}. + * Callback for a single library backed by a {@link File}. * @param library the library * @throws IOException if the operation fails */ diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java index fc1d0ca009..6f4c32d2ca 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java @@ -48,7 +48,7 @@ public abstract class LoggingSystem { public static final String NONE = "none"; /** - * The name used to for the root logger. LoggingSystem implementations should ensure + * The name used for the root logger. LoggingSystem implementations should ensure * that this is the name used to represent the root logger, regardless of the * underlying implementation. */ From fc09a23991d07e21540d5707cb3cdd2572915ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez?= Date: Mon, 12 Dec 2016 22:17:20 -0500 Subject: [PATCH 3/5] Add missing actuator metadata Health metadata for cassandra and couchbase is added. See gh-7632 --- ...itional-spring-configuration-metadata.json | 12 ++++++++ ...HealthIndicatorAutoConfigurationTests.java | 30 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json index c9a68e3651..b2320acd6b 100644 --- a/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -85,6 +85,18 @@ "type": "java.util.Map", "description": "Arbitrary properties to add to the info endpoint." }, + { + "name": "management.health.cassandra.enabled", + "type": "java.lang.Boolean", + "description": "Enable cassandra health check.", + "defaultValue": true + }, + { + "name": "management.health.couchbase.enabled", + "type": "java.lang.Boolean", + "description": "Enable couchbase health check.", + "defaultValue": true + }, { "name": "management.health.db.enabled", "type": "java.lang.Boolean", diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java index 937ab513a1..c678ba66af 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java @@ -457,6 +457,21 @@ public class HealthIndicatorAutoConfigurationTests { .isEqualTo(CassandraHealthIndicator.class); } + @Test + public void notCassandraHealthIndicator() throws Exception { + EnvironmentTestUtils.addEnvironment(this.context, + "management.health.diskspace.enabled:false", + "management.health.cassandra.enabled:false"); + this.context.register(CassandraConfiguration.class, + ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); + this.context.refresh(); + Map beans = this.context + .getBeansOfType(HealthIndicator.class); + assertThat(beans).hasSize(1); + assertThat(beans.values().iterator().next().getClass()) + .isEqualTo(ApplicationHealthIndicator.class); + } + @Test public void couchbaseHealthIndicator() throws Exception { EnvironmentTestUtils.addEnvironment(this.context, @@ -471,6 +486,21 @@ public class HealthIndicatorAutoConfigurationTests { .isEqualTo(CouchbaseHealthIndicator.class); } + @Test + public void notCouchbaseHealthIndicator() throws Exception { + EnvironmentTestUtils.addEnvironment(this.context, + "management.health.diskspace.enabled:false", + "management.health.couchbase.enabled:false"); + this.context.register(CouchbaseConfiguration.class, + ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); + this.context.refresh(); + Map beans = this.context + .getBeansOfType(HealthIndicator.class); + assertThat(beans.size()).isEqualTo(1); + assertThat(beans.values().iterator().next().getClass()) + .isEqualTo(ApplicationHealthIndicator.class); + } + @Configuration @EnableConfigurationProperties protected static class DataSourceConfig { From e5f2c58a7a7bcbd1510e2b3a7963ebf17e0965a8 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 14 Dec 2016 19:18:36 +0100 Subject: [PATCH 4/5] Polish Closes gh-7632 --- .../src/main/asciidoc/appendix-application-properties.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index 6f9065ccde..0d62c5472c 100644 --- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -1067,6 +1067,8 @@ content into your application; rather pick only the properties that you need. # HEALTH INDICATORS (previously health.*) management.health.db.enabled=true # Enable database health check. + management.health.cassandra.enabled=true # Enable cassandra health check. + management.health.couchbase.enabled=true # Enable couchbase health check. management.health.defaults.enabled=true # Enable default health indicators. management.health.diskspace.enabled=true # Enable disk space health check. management.health.diskspace.path= # Path used to compute the available disk space. From 703ed901feb938b3ab1b239b6986f2975955e7b4 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 14 Dec 2016 19:19:19 +0100 Subject: [PATCH 5/5] Polish doc --- .../src/main/asciidoc/appendix-application-properties.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index 0d62c5472c..5b8d7fac96 100644 --- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -1065,7 +1065,7 @@ content into your application; rather pick only the properties that you need. management.ssl.trust-store-provider= # Provider for the trust store. Requires a custom management.port. management.ssl.trust-store-type= # Type of the trust store. Requires a custom management.port. - # HEALTH INDICATORS (previously health.*) + # HEALTH INDICATORS management.health.db.enabled=true # Enable database health check. management.health.cassandra.enabled=true # Enable cassandra health check. management.health.couchbase.enabled=true # Enable couchbase health check.