camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [camel] branch camel-2.20.x updated: CAMEL-12113: Camel healthcheck spring-boot actuators don't honor endpoints.*.enabled property
Date Wed, 03 Jan 2018 11:29:32 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/camel-2.20.x by this push:
     new 83280c7  CAMEL-12113: Camel healthcheck spring-boot actuators don't honor endpoints.*.enabled
property
83280c7 is described below

commit 83280c75ed0c6dbfc490a9d0fb9c1d659aff7d6e
Author: Andrea Tarocchi <atarocch@redhat.com>
AuthorDate: Wed Jan 3 10:35:51 2018 +0100

    CAMEL-12113: Camel healthcheck spring-boot actuators don't honor endpoints.*.enabled property
---
 .../CamelHealthCheckEndpointAutoConfiguration.java | 16 ++++++
 ...elRouteControllerEndpointAutoConfiguration.java | 16 ++++++
 .../CamelRoutesEndpointAutoConfiguration.java      | 16 ++++++
 .../boot/actuate/endpoint/ActuatorTestRoute.java   |  4 ++
 .../CamelEndpointsGloballyDisabledTest.java        | 64 +++++++++++++++++++++
 .../CamelHealthCheckEndpointDisabledTest.java      | 48 ++++++++++++++++
 ...ckEndpointGloballyDisabledAndReenabledTest.java | 49 ++++++++++++++++
 .../CamelRouteControllerEndpointDisabledTest.java  | 59 ++++++++++++++++++++
 ...erEndpointGloballyDisabledAndReenabledTest.java | 60 ++++++++++++++++++++
 .../endpoint/CamelRouteControllerEndpointTest.java | 62 +++++++++++++++++++++
 .../CamelRouteControllerMvcEndpointTest.java       | 65 ++++++++++++++++++++++
 .../endpoint/CamelRoutesEndpointDisabledTest.java  | 63 +++++++++++++++++++++
 ...esEndpointGloballyDisabledAndReenabledTest.java | 60 ++++++++++++++++++++
 .../actuate/health/CamelHealthDisabledTest.java    | 49 ++++++++++++++++
 14 files changed, 631 insertions(+)

diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelHealthCheckEndpointAutoConfiguration.java
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelHealthCheckEndpointAutoConfiguration.java
index 72b8569..a005cf2 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelHealthCheckEndpointAutoConfiguration.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelHealthCheckEndpointAutoConfiguration.java
@@ -18,12 +18,14 @@ package org.apache.camel.spring.boot.actuate.endpoint;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.spring.boot.util.GroupCondition;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
 import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
 
 /**
@@ -33,6 +35,7 @@ import org.springframework.context.annotation.Configuration;
 @ConditionalOnClass(CamelHealthCheckEndpoint.class)
 @ConditionalOnBean(CamelAutoConfiguration.class)
 @AutoConfigureAfter(CamelAutoConfiguration.class)
+@Conditional(CamelHealthCheckEndpointAutoConfiguration.Condition.class)
 public class CamelHealthCheckEndpointAutoConfiguration {
     @Bean
     @ConditionalOnBean(CamelContext.class)
@@ -48,4 +51,17 @@ public class CamelHealthCheckEndpointAutoConfiguration {
     public CamelHealthCheckMvcEndpoint healthChecksMvcEndpoint(CamelHealthCheckEndpoint delegate)
{
         return new CamelHealthCheckMvcEndpoint(delegate);
     }
+
+    // ***************************************
+    // Condition
+    // ***************************************
+
+    public static class Condition extends GroupCondition {
+        public Condition() {
+            super(
+                    "endpoints",
+                    "endpoints." + CamelHealthCheckEndpoint.ENDPOINT_ID
+            );
+        }
+    }
 }
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointAutoConfiguration.java
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointAutoConfiguration.java
index ca75ed4..44d5f1e 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointAutoConfiguration.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointAutoConfiguration.java
@@ -18,12 +18,14 @@ package org.apache.camel.spring.boot.actuate.endpoint;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.spring.boot.util.GroupCondition;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
 import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
 
 /**
@@ -33,6 +35,7 @@ import org.springframework.context.annotation.Configuration;
 @ConditionalOnClass({CamelRouteControllerEndpoint.class})
 @ConditionalOnBean(CamelAutoConfiguration.class)
 @AutoConfigureAfter(CamelAutoConfiguration.class)
+@Conditional(CamelRouteControllerEndpointAutoConfiguration.Condition.class)
 public class CamelRouteControllerEndpointAutoConfiguration {
     @Bean
     @ConditionalOnClass(CamelContext.class)
@@ -48,4 +51,17 @@ public class CamelRouteControllerEndpointAutoConfiguration {
     public CamelRouteControllerMvcEndpoint routeControllerMvcEndpoint(CamelRouteControllerEndpoint
delegate) {
         return new CamelRouteControllerMvcEndpoint(delegate);
     }
+
+    // ***************************************
+    // Condition
+    // ***************************************
+
+    public static class Condition extends GroupCondition {
+        public Condition() {
+            super(
+                    "endpoints",
+                    "endpoints." + CamelRouteControllerEndpoint.ENDPOINT_ID
+            );
+        }
+    }
 }
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRoutesEndpointAutoConfiguration.java
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRoutesEndpointAutoConfiguration.java
index fdf49f0..85070dd 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRoutesEndpointAutoConfiguration.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRoutesEndpointAutoConfiguration.java
@@ -18,12 +18,14 @@ package org.apache.camel.spring.boot.actuate.endpoint;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.spring.boot.util.GroupCondition;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
 import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
 
 /**
@@ -33,6 +35,7 @@ import org.springframework.context.annotation.Configuration;
 @ConditionalOnClass({CamelRoutesEndpoint.class})
 @ConditionalOnBean(CamelAutoConfiguration.class)
 @AutoConfigureAfter(CamelAutoConfiguration.class)
+@Conditional(CamelRoutesEndpointAutoConfiguration.Condition.class)
 public class CamelRoutesEndpointAutoConfiguration {
     @Bean
     @ConditionalOnClass(CamelContext.class)
@@ -48,4 +51,17 @@ public class CamelRoutesEndpointAutoConfiguration {
     public CamelRoutesMvcEndpoint camelMvcEndpoint(CamelRoutesEndpoint delegate) {
         return new CamelRoutesMvcEndpoint(delegate);
     }
+
+    // ***************************************
+    // Condition
+    // ***************************************
+
+    public static class Condition extends GroupCondition {
+        public Condition() {
+            super(
+                    "endpoints",
+                    "endpoints." + CamelRoutesEndpoint.ENDPOINT_ID
+            );
+        }
+    }
 }
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/ActuatorTestRoute.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/ActuatorTestRoute.java
index 599f940..96b4c0a 100644
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/ActuatorTestRoute.java
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/ActuatorTestRoute.java
@@ -16,7 +16,9 @@
  */
 package org.apache.camel.spring.boot.actuate.endpoint;
 
+import org.apache.camel.Route;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.SupervisingRouteController;
 import org.springframework.stereotype.Component;
 
 @Component
@@ -24,6 +26,8 @@ public class ActuatorTestRoute extends RouteBuilder {
 
     @Override
     public void configure() throws Exception {
+//        SupervisingRouteController src = new SupervisingRouteController();
+//        src.addFilter(route -> new SupervisingRouteController.FilterResult(true, "Catch
all Filter"));
         from("timer:foo").routeId("foo-route").to("log:foo");
     }
 
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelEndpointsGloballyDisabledTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelEndpointsGloballyDisabledTest.java
new file mode 100644
index 0000000..430fcab
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelEndpointsGloballyDisabledTest.java
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.spring.boot.actuate.endpoint;
+
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@DirtiesContext
+@RunWith(SpringRunner.class)
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        CamelHealthCheckEndpointAutoConfiguration.class
+    },
+    properties = {
+        "endpoints.enabled = false"
+    }
+)
+public class CamelEndpointsGloballyDisabledTest {
+    @Autowired(required = false)
+    private CamelHealthCheckEndpoint healthCheckEndpoint;
+
+    @Autowired(required = false)
+    private CamelRouteControllerEndpoint routeControllerEndpoint;
+
+    @Autowired(required = false)
+    private CamelRouteControllerMvcEndpoint routeControllerMvcEndpoint;
+
+    @Autowired(required = false)
+    private CamelRoutesEndpoint routesEndpoint;
+
+    @Autowired(required = false)
+    private CamelRoutesMvcEndpoint routesMvcEndpoint;
+
+    @Test
+    public void testHealthCheckEndpointNotPresent() throws Exception {
+        Assert.assertNull(healthCheckEndpoint);
+        Assert.assertNull(routeControllerEndpoint);
+        Assert.assertNull(routeControllerMvcEndpoint);
+        Assert.assertNull(routesEndpoint);
+        Assert.assertNull(routesMvcEndpoint);
+    }
+}
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelHealthCheckEndpointDisabledTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelHealthCheckEndpointDisabledTest.java
new file mode 100644
index 0000000..39b397a
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelHealthCheckEndpointDisabledTest.java
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.spring.boot.actuate.endpoint;
+
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@DirtiesContext
+@RunWith(SpringRunner.class)
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        CamelHealthCheckEndpointAutoConfiguration.class
+    },
+    properties = {
+        "endpoints.camelhealthcheck.enabled = false"
+    }
+)
+public class CamelHealthCheckEndpointDisabledTest {
+    @Autowired(required = false)
+    private CamelHealthCheckEndpoint endpoint;
+
+    @Test
+    public void testHealthCheckEndpointNotPresent() throws Exception {
+        Assert.assertNull(endpoint);
+    }
+}
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelHealthCheckEndpointGloballyDisabledAndReenabledTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelHealthCheckEndpointGloballyDisabledAndReenabledTest.java
new file mode 100644
index 0000000..506e9d1
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelHealthCheckEndpointGloballyDisabledAndReenabledTest.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.spring.boot.actuate.endpoint;
+
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@DirtiesContext
+@RunWith(SpringRunner.class)
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        CamelHealthCheckEndpointAutoConfiguration.class
+    },
+    properties = {
+        "endpoints.enabled = false",
+        "endpoints.camelhealthcheck.enabled = true"
+    }
+)
+public class CamelHealthCheckEndpointGloballyDisabledAndReenabledTest {
+    @Autowired
+    private CamelHealthCheckEndpoint endpoint;
+
+    @Test
+    public void testHealthCheckEndpointPresent() throws Exception {
+        Assert.assertNotNull(endpoint);
+    }
+}
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointDisabledTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointDisabledTest.java
new file mode 100644
index 0000000..75ccc33
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointDisabledTest.java
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.actuate.endpoint;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+import org.springframework.test.context.junit4.SpringRunner;
+
+/**
+ * Test for the {@link CamelRoutesEndpoint} actuator endpoint.
+ */
+@DirtiesContext
+@RunWith(SpringRunner.class)
+@EnableAutoConfiguration
+@SpringBootApplication
+@SpringBootTest(classes = {CamelAutoConfiguration.class, CamelRoutesEndpointAutoConfiguration.class,
ActuatorTestRoute.class},
+        properties = {
+                "endpoints.camelroutecontroller.enabled = false"
+        })
+public class CamelRouteControllerEndpointDisabledTest extends Assert {
+
+    @Autowired(required = false)
+    CamelRouteControllerEndpoint routeControllerEndpoint;
+
+    @Autowired(required = false)
+    CamelRouteControllerMvcEndpoint routeControllerMvcEndpoint;
+
+    @Autowired
+    CamelContext camelContext;
+
+    @Test
+    public void testRoutesEndpointNotPresent() throws Exception {
+        Assert.assertNull(routeControllerEndpoint);
+        Assert.assertNull(routeControllerMvcEndpoint);
+    }
+
+}
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointGloballyDisabledAndReenabledTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointGloballyDisabledAndReenabledTest.java
new file mode 100644
index 0000000..ff00296
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointGloballyDisabledAndReenabledTest.java
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.actuate.endpoint;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+import org.springframework.test.context.junit4.SpringRunner;
+
+/**
+ * Test for the {@link CamelRoutesEndpoint} actuator endpoint.
+ */
+@DirtiesContext
+@RunWith(SpringRunner.class)
+@EnableAutoConfiguration
+@SpringBootApplication
+@SpringBootTest(classes = {CamelAutoConfiguration.class, CamelRoutesEndpointAutoConfiguration.class,
ActuatorTestRoute.class},
+        properties = {
+                "endpoints.enabled = false",
+                "endpoints.camelroutecontroller.enabled = true"
+        })
+public class CamelRouteControllerEndpointGloballyDisabledAndReenabledTest extends Assert
{
+
+    @Autowired
+    CamelRouteControllerEndpoint routeControllerEndpoint;
+
+    @Autowired
+    CamelRouteControllerMvcEndpoint routeControllerMvcEndpoint;
+
+    @Autowired
+    CamelContext camelContext;
+
+    @Test
+    public void testRoutesEndpointPresent() throws Exception {
+        Assert.assertNotNull(routeControllerEndpoint);
+        Assert.assertNotNull(routeControllerMvcEndpoint);
+    }
+
+}
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointTest.java
new file mode 100644
index 0000000..67eb14e
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointTest.java
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.actuate.endpoint;
+
+import java.util.List;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+import org.springframework.test.context.junit4.SpringRunner;
+
+
+/**
+ * Test for the {@link CamelRouteControllerEndpoint} actuator endpoint.
+ */
+@DirtiesContext
+@RunWith(SpringRunner.class)
+@EnableAutoConfiguration
+@SpringBootApplication
+@SpringBootTest(classes = {CamelAutoConfiguration.class, CamelRouteControllerEndpointAutoConfiguration.class,
ActuatorTestRoute.class},
+        properties = {
+                "camel.supervising.controller.enabled = true"
+        })
+public class CamelRouteControllerEndpointTest extends Assert {
+
+    @Autowired
+    CamelRouteControllerEndpoint endpoint;
+
+    @Autowired
+    CamelContext camelContext;
+
+    @Test
+    public void testRouteControllerEndpoint() throws Exception {
+        List<String> routesId = endpoint.invoke();
+
+        assertFalse(routesId.isEmpty());
+        assertEquals(routesId.size(), camelContext.getRoutes().size());
+        assertTrue(routesId.stream().anyMatch(r -> "foo-route".equals(r)));
+    }
+
+}
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerMvcEndpointTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerMvcEndpointTest.java
new file mode 100644
index 0000000..25f839c
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerMvcEndpointTest.java
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.actuate.endpoint;
+
+import java.util.List;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.spring.boot.model.RouteDetailsInfo;
+import org.apache.camel.spring.boot.model.RouteInfo;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+import org.springframework.test.context.junit4.SpringRunner;
+
+
+/**
+ * Test for the {@link CamelRouteControllerMvcEndpoint} actuator endpoint.
+ */
+@DirtiesContext
+@RunWith(SpringRunner.class)
+@EnableAutoConfiguration
+@SpringBootApplication
+@SpringBootTest(classes = {CamelAutoConfiguration.class, CamelRouteControllerEndpointAutoConfiguration.class,
ActuatorTestRoute.class},
+        properties = {
+                "camel.supervising.controller.enabled = true"
+        })
+public class CamelRouteControllerMvcEndpointTest extends Assert {
+
+    @Autowired
+    CamelRouteControllerMvcEndpoint endpoint;
+
+    @Autowired
+    CamelContext camelContext;
+
+    @Test
+    public void testRouteControllerEndpoint() throws Exception {
+        List<String> routesId = (List<String>)endpoint.invoke();
+
+        assertFalse(routesId.isEmpty());
+        assertEquals(routesId.size(), camelContext.getRoutes().size());
+        assertTrue(routesId.stream().anyMatch(r -> "foo-route".equals(r)));
+    }
+
+
+}
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRoutesEndpointDisabledTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRoutesEndpointDisabledTest.java
new file mode 100644
index 0000000..681baa5
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRoutesEndpointDisabledTest.java
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.actuate.endpoint;
+
+import java.util.List;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.spring.boot.model.RouteInfo;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+import org.springframework.test.context.junit4.SpringRunner;
+
+
+/**
+ * Test for the {@link CamelRoutesEndpoint} actuator endpoint.
+ */
+@DirtiesContext
+@RunWith(SpringRunner.class)
+@EnableAutoConfiguration
+@SpringBootApplication
+@SpringBootTest(classes = {CamelAutoConfiguration.class, CamelRoutesEndpointAutoConfiguration.class,
ActuatorTestRoute.class},
+        properties = {
+                "endpoints.camelroutes.enabled = false"
+        })
+public class CamelRoutesEndpointDisabledTest extends Assert {
+
+    @Autowired(required = false)
+    CamelRoutesEndpoint routesEndpoint;
+
+    @Autowired(required = false)
+    CamelRoutesMvcEndpoint routesMvcEndpoint;
+
+    @Autowired
+    CamelContext camelContext;
+
+    @Test
+    public void testRoutesEndpointNotPresent() throws Exception {
+        Assert.assertNull(routesEndpoint);
+        Assert.assertNull(routesMvcEndpoint);
+    }
+
+}
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRoutesEndpointGloballyDisabledAndReenabledTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRoutesEndpointGloballyDisabledAndReenabledTest.java
new file mode 100644
index 0000000..c0f8537
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/endpoint/CamelRoutesEndpointGloballyDisabledAndReenabledTest.java
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.actuate.endpoint;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+import org.springframework.test.context.junit4.SpringRunner;
+
+/**
+ * Test for the {@link CamelRoutesEndpoint} actuator endpoint.
+ */
+@DirtiesContext
+@RunWith(SpringRunner.class)
+@EnableAutoConfiguration
+@SpringBootApplication
+@SpringBootTest(classes = {CamelAutoConfiguration.class, CamelRoutesEndpointAutoConfiguration.class,
ActuatorTestRoute.class},
+        properties = {
+                "endpoints.enabled = false",
+                "endpoints.camelroutes.enabled = true"
+        })
+public class CamelRoutesEndpointGloballyDisabledAndReenabledTest extends Assert {
+
+    @Autowired
+    CamelRoutesEndpoint routesEndpoint;
+
+    @Autowired
+    CamelRoutesMvcEndpoint routesMvcEndpoint;
+
+    @Autowired
+    CamelContext camelContext;
+
+    @Test
+    public void testRoutesEndpointPresent() throws Exception {
+        Assert.assertNotNull(routesEndpoint);
+        Assert.assertNotNull(routesMvcEndpoint);
+    }
+
+}
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthDisabledTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthDisabledTest.java
new file mode 100644
index 0000000..649fb65
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthDisabledTest.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.actuate.health;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@EnableAutoConfiguration
+@SpringBootApplication
+@SpringBootTest(classes = {CamelAutoConfiguration.class, CamelHealthAutoConfiguration.class,
MyCamelRoute.class},
+        properties = {
+            "camel.health.enabled = false"
+        })
+public class CamelHealthDisabledTest extends Assert {
+    @Autowired(required = false)
+    CamelHealthIndicator indicator;
+
+    @Autowired
+    CamelContext camelContext;
+
+    @Test
+    public void shouldNotHaveHealth() throws Exception {
+        assertNull(indicator);
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <commits@camel.apache.org>'].

Mime
View raw message