You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ra...@apache.org on 2019/03/14 04:51:10 UTC

[camel] branch master updated: CAMEL-13120:camel-spring-boot - implemented suggestions

This is an automated email from the ASF dual-hosted git repository.

ramu12 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 6ec833b  CAMEL-13120:camel-spring-boot - implemented suggestions
6ec833b is described below

commit 6ec833b32e93395d3f82ae281377cf2a8f716246
Author: Ramu <kk...@redhat.com>
AuthorDate: Thu Mar 14 10:20:38 2019 +0530

    CAMEL-13120:camel-spring-boot - implemented suggestions
---
 components/camel-spring-boot/src/main/docs/spring-boot.adoc          | 2 +-
 .../camel/spring/boot/actuate/health/CamelHealthIndicator.java       | 2 +-
 .../camel/spring/boot/health/HealthCheckVerboseConfiguration.java    | 2 +-
 .../org/apache/camel/spring/boot/actuate/health/CamelHealthTest.java | 5 ++++-
 .../src/main/resources/application.properties                        | 3 +--
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/components/camel-spring-boot/src/main/docs/spring-boot.adoc b/components/camel-spring-boot/src/main/docs/spring-boot.adoc
index fa25d4f..e28993b 100644
--- a/components/camel-spring-boot/src/main/docs/spring-boot.adoc
+++ b/components/camel-spring-boot/src/main/docs/spring-boot.adoc
@@ -234,8 +234,8 @@ The component supports 140 options, which are listed below.
 | *management.endpoint.camelroutes.cache.time-to-live* | Maximum time that a response can be cached. | 0ms | Duration
 | *management.endpoint.camelroutes.enabled* | To turn on or off information about Camel Routes via actuator endpoint. | true | Boolean
 | *management.endpoint.camelroutes.read-only* | Whether Camel Routes actuator is in read-only mode. If not in read-only mode then operations to start/stop routes would be enabled. | true | Boolean
-| *management.endpoint.health.verbose* | Global option to enable/disable  health bean camel version info, default is true. | true | Boolean
 | *management.info.camel.enabled* | Whether to enable Camel info. | true | Boolean
+| *management.info.camel.verbose* | Global option to enable/disable  health bean camel version info, default is true. | true | Boolean
 | *camel.springboot.stream-caching* | Sets whether stream caching is enabled or not (deprecated use stream-caching-enabled instead). Default is false. | false | Boolean
 | *camel.springboot.use-m-d-c-logging* | To turn on MDC logging (deprecated use use-mdc-logging instead) | false | Boolean
 |===
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthIndicator.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthIndicator.java
index 15b28fa..1951e04 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthIndicator.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthIndicator.java
@@ -40,8 +40,8 @@ public class CamelHealthIndicator extends AbstractHealthIndicator {
         if (camelContext == null) {
             builder.unknown();
         } else {
-            builder.withDetail("name", camelContext.getName());
             if (properties.isVerbose()) {
+            	builder.withDetail("name", camelContext.getName());
                 builder.withDetail("version", camelContext.getVersion());
             }
             if (camelContext.getUptime() != null) {
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/health/HealthCheckVerboseConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/health/HealthCheckVerboseConfiguration.java
index 861efc0..e31122b 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/health/HealthCheckVerboseConfiguration.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/health/HealthCheckVerboseConfiguration.java
@@ -18,7 +18,7 @@ package org.apache.camel.spring.boot.health;
 
 import org.springframework.boot.context.properties.ConfigurationProperties;
 
-@ConfigurationProperties("management.endpoint.health")
+@ConfigurationProperties("management.info.camel")
 public class HealthCheckVerboseConfiguration {
     /**
      * Global option to enable/disable  health bean camel version info, default is true.
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthTest.java
index 892a03d..be84115 100644
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthTest.java
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthTest.java
@@ -33,7 +33,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 @SpringBootApplication
 @SpringBootTest(
     classes = {CamelAutoConfiguration.class, CamelHealthAutoConfiguration.class, MyCamelRoute.class},
-    properties = {"management.endpoint.health.verbose = true"}
+    properties = {"management.info.camel.verbose = true"}
     )
 public class CamelHealthTest extends Assert {
 
@@ -53,6 +53,9 @@ public class CamelHealthTest extends Assert {
         
         String version = (String) health.getDetails().get("version");
         assertEquals(camelContext.getVersion(), version);
+        
+        String name = (String) health.getDetails().get("name");
+        assertEquals(camelContext.getName(), name);
     }
 
 }
diff --git a/examples/camel-example-spring-boot/src/main/resources/application.properties b/examples/camel-example-spring-boot/src/main/resources/application.properties
index 66cc2ea..a970973 100644
--- a/examples/camel-example-spring-boot/src/main/resources/application.properties
+++ b/examples/camel-example-spring-boot/src/main/resources/application.properties
@@ -36,11 +36,10 @@ management.endpoints.web.exposure.include=info,health,camelroutes
 
 # show verbose health details (/actuator/info) so you can see Camel information also
 management.endpoint.health.show-details=always
-management.endpoint.health.verbose=false
 
 # to turn off Camel info in (/actuator/info)
 management.info.camel.enabled=true
-
+management.info.camel.verbose=true
 # allow to obtain basic information about Camel routes (read only mode)
 management.endpoint.camelroutes.enabled = true
 management.endpoint.camelroutes.read-only = true