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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new 2cb8306  CAMEL-17436: Disabling health check for single route or 
consumer is not possible (#428)
2cb8306 is described below

commit 2cb8306083a3acbfd8b4ea515f2f8575480eb8b3
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Jan 5 14:00:34 2022 +0100

    CAMEL-17436: Disabling health check for single route or consumer is not 
possible (#428)
---
 .../spring/boot/actuate/health/CamelHealthCheckConfigurationTest.java | 4 +++-
 .../org/apache/camel/spring/boot/actuate/health/CamelHealthTest.java  | 4 +++-
 .../org/apache/camel/spring/boot/actuate/health/MyCamelRoute.java     | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckConfigurationTest.java
 
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckConfigurationTest.java
index 2543c38..c3b475f 100644
--- 
a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckConfigurationTest.java
+++ 
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthCheckConfigurationTest.java
@@ -29,10 +29,12 @@ import org.springframework.boot.actuate.health.Status;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
 
 @CamelSpringBootTest
 @EnableAutoConfiguration
 @SpringBootApplication
+@DirtiesContext
 @SpringBootTest(
     classes = {CamelAutoConfiguration.class, 
CamelHealthCheckAutoConfiguration.class, DownRoute.class, MyCamelRoute.class},
     properties = 
{"camel.health.config[consumer\\:down-route].parent=consumers",
@@ -67,7 +69,7 @@ class CamelHealthCheckConfigurationTest {
             .get()
             .matches(hc -> !hc.getConfiguration().isEnabled());
 
-        assertThat(registry.getCheck("consumer:route1"))
+        assertThat(registry.getCheck("consumer:foo-route"))
             .as("other route health check is enabled")
             .isPresent()
             .get()
diff --git 
a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthTest.java
 
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthTest.java
index b0c318d..91ad6a4 100644
--- 
a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthTest.java
+++ 
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthTest.java
@@ -26,12 +26,14 @@ import 
org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
 
 @CamelSpringBootTest
 @EnableAutoConfiguration
 @SpringBootApplication
 @SpringBootTest(
-    classes = {CamelAutoConfiguration.class, 
CamelHealthCheckAutoConfiguration.class, MyCamelRoute.class})
+    classes = {CamelAutoConfiguration.class, 
CamelHealthCheckAutoConfiguration.class, MyCamelRoute.class},
+    properties = 
{"camel.springboot.java-routes-include-pattern=**/MyCamelRoute*"})
 public class CamelHealthTest {
 
     @Autowired
diff --git 
a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/MyCamelRoute.java
 
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/MyCamelRoute.java
index 06a5b11..12eb501 100644
--- 
a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/MyCamelRoute.java
+++ 
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/MyCamelRoute.java
@@ -24,6 +24,6 @@ public class MyCamelRoute extends RouteBuilder {
 
     @Override
     public void configure() throws Exception {
-        from("timer:foo").to("log:foo");
+        from("timer:foo").routeId("foo-route").to("log:foo");
     }
 }

Reply via email to