You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gz...@apache.org on 2017/07/09 19:40:02 UTC
camel git commit: Move health indicator to actuate.health package
Repository: camel
Updated Branches:
refs/heads/master 220be66af -> 103a4f0fe
Move health indicator to actuate.health package
Signed-off-by: Gregor Zurowski <gr...@zurowski.org>
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/103a4f0f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/103a4f0f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/103a4f0f
Branch: refs/heads/master
Commit: 103a4f0fe45d1f97f9f38f54c2ecf25639072f45
Parents: 220be66
Author: Gregor Zurowski <gr...@zurowski.org>
Authored: Sun Jul 9 21:34:20 2017 +0200
Committer: Gregor Zurowski <gr...@zurowski.org>
Committed: Sun Jul 9 21:34:20 2017 +0200
----------------------------------------------------------------------
.../health/CamelHealthAutoConfiguration.java | 46 ++++++++++++++++
.../actuate/health/CamelHealthIndicator.java | 52 ++++++++++++++++++
.../health/CamelHealthAutoConfiguration.java | 46 ----------------
.../boot/health/CamelHealthIndicator.java | 52 ------------------
.../main/resources/META-INF/spring.factories | 2 +-
.../boot/actuate/health/CamelHealthTest.java | 55 ++++++++++++++++++++
.../boot/actuate/health/MyCamelRoute.java | 29 +++++++++++
.../spring/boot/health/CamelHealthTest.java | 55 --------------------
.../camel/spring/boot/health/MyCamelRoute.java | 29 -----------
9 files changed, 183 insertions(+), 183 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/103a4f0f/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthAutoConfiguration.java
new file mode 100644
index 0000000..3b59f26
--- /dev/null
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthAutoConfiguration.java
@@ -0,0 +1,46 @@
+/**
+ * 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.springframework.boot.actuate.health.HealthIndicator;
+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.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ConditionalOnClass({HealthIndicator.class})
+@ConditionalOnBean(CamelAutoConfiguration.class)
+@AutoConfigureAfter(CamelAutoConfiguration.class)
+public class CamelHealthAutoConfiguration {
+
+ @ConditionalOnClass({CamelContext.class})
+ @ConditionalOnMissingBean(CamelHealthIndicator.class)
+ protected static class CamelHealthIndicatorInitializer {
+
+ @Bean
+ public HealthIndicator camelHealthIndicator(CamelContext camelContext) {
+ return new CamelHealthIndicator(camelContext);
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/103a4f0f/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthIndicator.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..1968068
--- /dev/null
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/health/CamelHealthIndicator.java
@@ -0,0 +1,52 @@
+/**
+ * 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.springframework.boot.actuate.health.AbstractHealthIndicator;
+import org.springframework.boot.actuate.health.Health;
+import org.springframework.boot.actuate.health.HealthIndicator;
+
+/**
+ * Camel {@link HealthIndicator}.
+ */
+public class CamelHealthIndicator extends AbstractHealthIndicator {
+
+ private CamelContext camelContext;
+
+ public CamelHealthIndicator(CamelContext camelContext) {
+ this.camelContext = camelContext;
+ }
+
+ @Override
+ protected void doHealthCheck(Health.Builder builder) throws Exception {
+ if (camelContext == null) {
+ builder.unknown();
+ } else {
+ builder.withDetail("name", camelContext.getName());
+ builder.withDetail("version", camelContext.getVersion());
+ builder.withDetail("contextStatus", camelContext.getStatus().name());
+ if (camelContext.getStatus().isStarted()) {
+ builder.up();
+ } else if (camelContext.getStatus().isStopped()) {
+ builder.down();
+ } else {
+ builder.unknown();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/103a4f0f/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/health/CamelHealthAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/health/CamelHealthAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/health/CamelHealthAutoConfiguration.java
deleted file mode 100644
index 3f691c3..0000000
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/health/CamelHealthAutoConfiguration.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.health;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.spring.boot.CamelAutoConfiguration;
-import org.springframework.boot.actuate.health.HealthIndicator;
-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.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-@ConditionalOnClass({HealthIndicator.class})
-@ConditionalOnBean(CamelAutoConfiguration.class)
-@AutoConfigureAfter(CamelAutoConfiguration.class)
-public class CamelHealthAutoConfiguration {
-
- @ConditionalOnClass({CamelContext.class})
- @ConditionalOnMissingBean(CamelHealthIndicator.class)
- protected static class CamelHealthIndicatorInitializer {
-
- @Bean
- public HealthIndicator camelHealthIndicator(CamelContext camelContext) {
- return new CamelHealthIndicator(camelContext);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/103a4f0f/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/health/CamelHealthIndicator.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/health/CamelHealthIndicator.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/health/CamelHealthIndicator.java
deleted file mode 100644
index 67ca02d..0000000
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/health/CamelHealthIndicator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.health;
-
-import org.apache.camel.CamelContext;
-import org.springframework.boot.actuate.health.AbstractHealthIndicator;
-import org.springframework.boot.actuate.health.Health;
-import org.springframework.boot.actuate.health.HealthIndicator;
-
-/**
- * Camel {@link HealthIndicator}.
- */
-public class CamelHealthIndicator extends AbstractHealthIndicator {
-
- private CamelContext camelContext;
-
- public CamelHealthIndicator(CamelContext camelContext) {
- this.camelContext = camelContext;
- }
-
- @Override
- protected void doHealthCheck(Health.Builder builder) throws Exception {
- if (camelContext == null) {
- builder.unknown();
- } else {
- builder.withDetail("name", camelContext.getName());
- builder.withDetail("version", camelContext.getVersion());
- builder.withDetail("contextStatus", camelContext.getStatus().name());
- if (camelContext.getStatus().isStarted()) {
- builder.up();
- } else if (camelContext.getStatus().isStopped()) {
- builder.down();
- } else {
- builder.unknown();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/103a4f0f/components/camel-spring-boot/src/main/resources/META-INF/spring.factories
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/resources/META-INF/spring.factories b/components/camel-spring-boot/src/main/resources/META-INF/spring.factories
index 48be2f1..15dd1a7 100644
--- a/components/camel-spring-boot/src/main/resources/META-INF/spring.factories
+++ b/components/camel-spring-boot/src/main/resources/META-INF/spring.factories
@@ -18,10 +18,10 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.apache.camel.spring.boot.CamelAutoConfiguration,\
org.apache.camel.spring.boot.actuate.endpoint.CamelRoutesEndpointAutoConfiguration,\
+org.apache.camel.spring.boot.actuate.health.CamelHealthAutoConfiguration,\
org.apache.camel.spring.boot.cloud.CamelCloudAutoConfiguration,\
org.apache.camel.spring.boot.cloud.CamelCloudServiceCallConfigurationAutoConfiguration,\
org.apache.camel.spring.boot.cloud.CamelCloudServiceDiscoveryAutoConfiguration,\
org.apache.camel.spring.boot.cloud.CamelCloudServiceFilterAutoConfiguration,\
org.apache.camel.spring.boot.cloud.CamelCloudServiceChooserAutoConfiguration,\
-org.apache.camel.spring.boot.health.CamelHealthAutoConfiguration,\
org.apache.camel.spring.boot.security.CamelSSLAutoConfiguration
http://git-wip-us.apache.org/repos/asf/camel/blob/103a4f0f/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthTest.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..3e6b118
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/CamelHealthTest.java
@@ -0,0 +1,55 @@
+/**
+ * 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.actuate.health.Health;
+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})
+public class CamelHealthTest extends Assert {
+
+ @Autowired
+ CamelHealthIndicator indicator;
+
+ @Autowired
+ CamelContext camelContext;
+
+ @Test
+ public void shouldHaveHealth() throws Exception {
+ Health health = indicator.health();
+ assertNotNull(health);
+
+ String code = health.getStatus().getCode();
+ assertEquals("UP", code);
+
+ String version = (String) health.getDetails().get("version");
+ assertEquals(camelContext.getVersion(), version);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/103a4f0f/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/MyCamelRoute.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/MyCamelRoute.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/MyCamelRoute.java
new file mode 100644
index 0000000..060165d
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/actuate/health/MyCamelRoute.java
@@ -0,0 +1,29 @@
+/**
+ * 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.builder.RouteBuilder;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MyCamelRoute extends RouteBuilder {
+
+ @Override
+ public void configure() throws Exception {
+ from("timer:foo").to("log:foo");
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/103a4f0f/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/health/CamelHealthTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/health/CamelHealthTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/health/CamelHealthTest.java
deleted file mode 100644
index 0f0fed0..0000000
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/health/CamelHealthTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.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.actuate.health.Health;
-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})
-public class CamelHealthTest extends Assert {
-
- @Autowired
- CamelHealthIndicator indicator;
-
- @Autowired
- CamelContext camelContext;
-
- @Test
- public void shouldHaveHealth() throws Exception {
- Health health = indicator.health();
- assertNotNull(health);
-
- String code = health.getStatus().getCode();
- assertEquals("UP", code);
-
- String version = (String) health.getDetails().get("version");
- assertEquals(camelContext.getVersion(), version);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/103a4f0f/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/health/MyCamelRoute.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/health/MyCamelRoute.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/health/MyCamelRoute.java
deleted file mode 100644
index 2bdd6d2..0000000
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/health/MyCamelRoute.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * 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.health;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.springframework.stereotype.Component;
-
-@Component
-public class MyCamelRoute extends RouteBuilder {
-
- @Override
- public void configure() throws Exception {
- from("timer:foo").to("log:foo");
- }
-}