From 7d0a3ddcce42b101d32f568e9ca90ffadfc540c6 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 11 Aug 2014 08:57:35 -0700 Subject: [PATCH] Rename VanillaHealthIndicator to Application... Rename `VanillaHealthIndicator` to `ApplicationHealthIndicator` and changed the exposed bean name from `statusHealthIndicator` to `applicationHealthIndicator`. This provides less confusing JSON output: {"status":"UP","application":{"status":"UP"}} vs: {"status":"UP","status":{"status":"UP"}} Fixes gh-1291 --- .../HealthIndicatorAutoConfiguration.java | 6 +++--- ...icator.java => ApplicationHealthIndicator.java} | 2 +- .../boot/actuate/health/HealthIndicator.java | 2 +- .../HealthIndicatorAutoConfigurationTests.java | 14 +++++++------- ...s.java => ApplicationHealthIndicatorTests.java} | 6 +++--- .../ui/SampleActuatorUiApplicationPortTests.java | 3 ++- 6 files changed, 17 insertions(+), 16 deletions(-) rename spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/{VanillaHealthIndicator.java => ApplicationHealthIndicator.java} (92%) rename spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/{VanillaHealthIndicatorTests.java => ApplicationHealthIndicatorTests.java} (83%) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java index f474eea14b..404cae5b84 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java @@ -34,7 +34,7 @@ import org.springframework.boot.actuate.health.OrderedHealthAggregator; import org.springframework.boot.actuate.health.RabbitHealthIndicator; import org.springframework.boot.actuate.health.RedisHealthIndicator; import org.springframework.boot.actuate.health.SolrHealthIndicator; -import org.springframework.boot.actuate.health.VanillaHealthIndicator; +import org.springframework.boot.actuate.health.ApplicationHealthIndicator; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -81,8 +81,8 @@ public class HealthIndicatorAutoConfiguration { @Bean @ConditionalOnMissingBean(HealthIndicator.class) - public HealthIndicator statusHealthIndicator() { - return new VanillaHealthIndicator(); + public HealthIndicator applicationHealthIndicator() { + return new ApplicationHealthIndicator(); } @Configuration diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/VanillaHealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ApplicationHealthIndicator.java similarity index 92% rename from spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/VanillaHealthIndicator.java rename to spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ApplicationHealthIndicator.java index f03383bc0f..d2b5353071 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/VanillaHealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ApplicationHealthIndicator.java @@ -23,7 +23,7 @@ package org.springframework.boot.actuate.health; * @author Christian Dupuis * @see Status#UP */ -public class VanillaHealthIndicator extends AbstractHealthIndicator { +public class ApplicationHealthIndicator extends AbstractHealthIndicator { @Override protected void doHealthCheck(Health.Builder builder) throws Exception { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicator.java index a39f572498..816cf37b84 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicator.java @@ -20,7 +20,7 @@ package org.springframework.boot.actuate.health; * Strategy interface used to provide an indication of application health. * * @author Dave Syer - * @see VanillaHealthIndicator + * @see ApplicationHealthIndicator */ public interface HealthIndicator { 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 1c8b6b1cb7..3620cb12ee 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 @@ -27,7 +27,7 @@ import org.springframework.boot.actuate.health.MongoHealthIndicator; import org.springframework.boot.actuate.health.RabbitHealthIndicator; import org.springframework.boot.actuate.health.RedisHealthIndicator; import org.springframework.boot.actuate.health.SolrHealthIndicator; -import org.springframework.boot.actuate.health.VanillaHealthIndicator; +import org.springframework.boot.actuate.health.ApplicationHealthIndicator; import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration; import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; @@ -70,7 +70,7 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(VanillaHealthIndicator.class, beans.values().iterator().next() + assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() .getClass()); } @@ -97,7 +97,7 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(VanillaHealthIndicator.class, beans.values().iterator().next() + assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() .getClass()); } @@ -124,7 +124,7 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(VanillaHealthIndicator.class, beans.values().iterator().next() + assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() .getClass()); } @@ -163,7 +163,7 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(VanillaHealthIndicator.class, beans.values().iterator().next() + assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() .getClass()); } @@ -190,7 +190,7 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(VanillaHealthIndicator.class, beans.values().iterator().next() + assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() .getClass()); } @@ -217,7 +217,7 @@ public class HealthIndicatorAutoConfigurationTests { Map beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); - assertEquals(VanillaHealthIndicator.class, beans.values().iterator().next() + assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next() .getClass()); } } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/VanillaHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ApplicationHealthIndicatorTests.java similarity index 83% rename from spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/VanillaHealthIndicatorTests.java rename to spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ApplicationHealthIndicatorTests.java index af167bee49..4c0eab893b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/VanillaHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/ApplicationHealthIndicatorTests.java @@ -21,15 +21,15 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; /** - * Tests for {@link VanillaHealthIndicator}. + * Tests for {@link ApplicationHealthIndicator}. * * @author Phillip Webb */ -public class VanillaHealthIndicatorTests { +public class ApplicationHealthIndicatorTests { @Test public void indicatesUp() throws Exception { - VanillaHealthIndicator healthIndicator = new VanillaHealthIndicator(); + ApplicationHealthIndicator healthIndicator = new ApplicationHealthIndicator(); assertEquals(Status.UP, healthIndicator.health().getStatus()); } diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java index 6434f583dd..0036df8fa3 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java @@ -75,7 +75,8 @@ public class SampleActuatorUiApplicationPortTests { ResponseEntity entity = new TestRestTemplate().getForEntity( "http://localhost:" + this.managementPort + "/health", String.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertEquals("{\"status\":\"UP\"}", entity.getBody()); + assertEquals("{\"status\":\"UP\",\"application\":{\"status\":\"UP\"}}", + entity.getBody()); } }