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

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

commit 392fc928f8a3109ddf3ff2a1355cd0b7124e5991
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sun May 24 14:23:43 2020 +0200

    CAMEL-15084: Move health implementation in camel-base into camel-health
---
 bom/camel-bom/pom.xml                              |  5 ++++
 components/camel-consul/pom.xml                    |  4 +++
 components/camel-microprofile-health/pom.xml       |  2 +-
 core/camel-health/pom.xml                          | 32 ++++++++++++++++++++
 .../health/DefaultHealthCheckRegistryTest.java     |  0
 .../impl/health/DefaultHealthCheckServiceTest.java |  0
 .../apache/camel/impl/health/HealthCheckTest.java  |  0
 .../camel/impl/health/RouteHealthCheckTest.java    | 27 +++++++++--------
 .../src/test/resources/log4j2.properties           | 35 ++++++++++++++++++++++
 9 files changed, 92 insertions(+), 13 deletions(-)

diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml
index 9220eca..466e472 100644
--- a/bom/camel-bom/pom.xml
+++ b/bom/camel-bom/pom.xml
@@ -859,6 +859,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-health</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-hipchat</artifactId>
         <version>${project.version}</version>
       </dependency>
diff --git a/components/camel-consul/pom.xml b/components/camel-consul/pom.xml
index 5ee4cb9..9a3191b 100644
--- a/components/camel-consul/pom.xml
+++ b/components/camel-consul/pom.xml
@@ -48,6 +48,10 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-cluster</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-health</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>com.orbitz.consul</groupId>
diff --git a/components/camel-microprofile-health/pom.xml 
b/components/camel-microprofile-health/pom.xml
index 602dbf0..6c5c499 100644
--- a/components/camel-microprofile-health/pom.xml
+++ b/components/camel-microprofile-health/pom.xml
@@ -41,7 +41,7 @@
 
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-base</artifactId>
+            <artifactId>camel-health</artifactId>
             <version>${project.version}</version>
         </dependency>
 
diff --git a/core/camel-health/pom.xml b/core/camel-health/pom.xml
index 1f4bd8d..ec2478c 100644
--- a/core/camel-health/pom.xml
+++ b/core/camel-health/pom.xml
@@ -51,6 +51,38 @@
             <artifactId>slf4j-api</artifactId>
         </dependency>
 
+        <!-- testing -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-core-languages</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-direct</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-log</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-mock</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-slf4j-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
 
 </project>
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/impl/health/DefaultHealthCheckRegistryTest.java
 
b/core/camel-health/src/test/java/org/apache/camel/impl/health/DefaultHealthCheckRegistryTest.java
similarity index 100%
rename from 
core/camel-core/src/test/java/org/apache/camel/impl/health/DefaultHealthCheckRegistryTest.java
rename to 
core/camel-health/src/test/java/org/apache/camel/impl/health/DefaultHealthCheckRegistryTest.java
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/impl/health/DefaultHealthCheckServiceTest.java
 
b/core/camel-health/src/test/java/org/apache/camel/impl/health/DefaultHealthCheckServiceTest.java
similarity index 100%
rename from 
core/camel-core/src/test/java/org/apache/camel/impl/health/DefaultHealthCheckServiceTest.java
rename to 
core/camel-health/src/test/java/org/apache/camel/impl/health/DefaultHealthCheckServiceTest.java
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/impl/health/HealthCheckTest.java
 
b/core/camel-health/src/test/java/org/apache/camel/impl/health/HealthCheckTest.java
similarity index 100%
rename from 
core/camel-core/src/test/java/org/apache/camel/impl/health/HealthCheckTest.java
rename to 
core/camel-health/src/test/java/org/apache/camel/impl/health/HealthCheckTest.java
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java
 
b/core/camel-health/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java
similarity index 78%
rename from 
core/camel-core/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java
rename to 
core/camel-health/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java
index 8cfa1ab..29a5e63 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java
+++ 
b/core/camel-health/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java
@@ -18,34 +18,37 @@ package org.apache.camel.impl.health;
 
 import java.util.Collections;
 
-import org.apache.camel.ContextTestSupport;
+import junit.framework.TestCase;
+import org.apache.camel.CamelContext;
 import org.apache.camel.Route;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.health.HealthCheckResultBuilder;
+import org.apache.camel.impl.DefaultCamelContext;
 import org.junit.Test;
 
-public class RouteHealthCheckTest extends ContextTestSupport {
+public class RouteHealthCheckTest extends TestCase {
 
     private static final String TEST_ROUTE_ID = "Test-Route";
 
     @Test
-    public void testDoCallDoesNotHaveNPEWhenJmxDisabled() {
+    public void testDoCallDoesNotHaveNPEWhenJmxDisabled() throws Exception{
+        CamelContext context = new DefaultCamelContext();
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:input").id(TEST_ROUTE_ID).log("Message");
+            }
+        });
+        context.start();
+
         Route route = context.getRoute(TEST_ROUTE_ID);
 
         RouteHealthCheck healthCheck = new RouteHealthCheck(route);
         final HealthCheckResultBuilder builder = 
HealthCheckResultBuilder.on(healthCheck);
 
         healthCheck.doCall(builder, Collections.emptyMap());
-    }
 
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:input").id(TEST_ROUTE_ID).log("Message");
-            }
-        };
+        context.stop();
     }
 
 }
diff --git a/core/camel-health/src/test/resources/log4j2.properties 
b/core/camel-health/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..ea3bee8
--- /dev/null
+++ b/core/camel-health/src/test/resources/log4j2.properties
@@ -0,0 +1,35 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+appender.console.type = Console
+appender.console.name = console
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-health-test.log
+appender.file.append = true
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+rootLogger.level = INFO
+
+rootLogger.appenderRef.file.ref = file
+#rootLogger.appenderRef.console.ref = console
+
+#logger.camel-core.name = org.apache.camel
+#logger.camel-core.level = TRACE

Reply via email to