You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/08/21 06:51:44 UTC

[camel] branch master updated (4b9b619 -> 199715f)

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

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


    from 4b9b619  CAMEL-13886: camel-servlet + camel-http4 with null body causes "Stream closed" IOException
     new 4fba2be  CAMEL-13877 fix NPE in RouteHealthCheck
     new 83854ec  CAMEL-13877 correct formatting
     new 199715f  CAMEL-13877 - Fixed CS

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/camel/impl/health/RouteHealthCheck.java | 16 ++--
 .../health/RouteHealthCheckTest.java}              | 98 +++++++++++-----------
 2 files changed, 60 insertions(+), 54 deletions(-)
 copy core/camel-core/src/test/java/org/apache/camel/{model/RouteGroupTest.java => impl/health/RouteHealthCheckTest.java} (62%)


[camel] 03/03: CAMEL-13877 - Fixed CS

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 199715fd3872f2ef570b48215ce4ab5af06f57d5
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Aug 21 08:51:05 2019 +0200

    CAMEL-13877 - Fixed CS
---
 .../camel/impl/health/RouteHealthCheckTest.java    | 50 ++++++++++++++--------
 1 file changed, 33 insertions(+), 17 deletions(-)

diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java
index fd723bc..355bd28 100644
--- a/core/camel-core/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java
@@ -1,3 +1,19 @@
+/*
+ * 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.impl.health;
 
 import java.util.Collections;
@@ -10,26 +26,26 @@ import org.junit.Test;
 
 public class RouteHealthCheckTest extends ContextTestSupport {
 
-	private static final String TEST_ROUTE_ID = "Test-Route";
+    private static final String TEST_ROUTE_ID = "Test-Route";
 
-	@Test
-	public void testDoCallDoesNotHaveNPEWhenJmxDisabled() {
-		Route route = context.getRoute(TEST_ROUTE_ID);
+    @Test
+    public void testDoCallDoesNotHaveNPEWhenJmxDisabled() {
+        Route route = context.getRoute(TEST_ROUTE_ID);
 
-		RouteHealthCheck healthCheck = new RouteHealthCheck(route);
-		final HealthCheckResultBuilder builder = HealthCheckResultBuilder.on(healthCheck);
+        RouteHealthCheck healthCheck = new RouteHealthCheck(route);
+        final HealthCheckResultBuilder builder = HealthCheckResultBuilder.on(healthCheck);
 
-		healthCheck.doCall(builder, Collections.emptyMap());
-	}
+        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");
-			}
-		};
-	}
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:input").id(TEST_ROUTE_ID).log("Message");
+            }
+        };
+    }
 
 }


[camel] 02/03: CAMEL-13877 correct formatting

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 83854ec5fd067dd49d5fad09b91ceb1a256ba566
Author: Paul Heaberlin <pa...@jetisre.com>
AuthorDate: Tue Aug 20 11:19:10 2019 -0500

    CAMEL-13877 correct formatting
---
 .../apache/camel/impl/health/RouteHealthCheck.java | 34 +++++++++++-----------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/health/RouteHealthCheck.java b/core/camel-base/src/main/java/org/apache/camel/impl/health/RouteHealthCheck.java
index 3b47302..fb8713a 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/health/RouteHealthCheck.java
+++ b/core/camel-base/src/main/java/org/apache/camel/impl/health/RouteHealthCheck.java
@@ -84,23 +84,23 @@ public class RouteHealthCheck extends AbstractHealthCheck {
                 builder.up();
             }
 
-			if (builder.state() != State.DOWN) {
-				// If JMX is enabled, use the Managed MBeans to determine route
-				// health based on performance counters.
-				ManagedCamelContext managedCamelContext = context.getExtension(ManagedCamelContext.class);
-				if (managedCamelContext != null) {
-					ManagedRouteMBean managedRoute = managedCamelContext.getManagedRoute(route.getId());
-					if (managedRoute != null && !evaluators.isEmpty()) {
-						for (PerformanceCounterEvaluator<ManagedRouteMBean> evaluator : evaluators) {
-							evaluator.test(managedRoute, builder, options);
+            if (builder.state() != State.DOWN) {
+                // If JMX is enabled, use the Managed MBeans to determine route
+                // health based on performance counters.
+                ManagedCamelContext managedCamelContext = context.getExtension(ManagedCamelContext.class);
+                if (managedCamelContext != null) {
+                    ManagedRouteMBean managedRoute = managedCamelContext.getManagedRoute(route.getId());
+                    if (managedRoute != null && !evaluators.isEmpty()) {
+                        for (PerformanceCounterEvaluator<ManagedRouteMBean> evaluator : evaluators) {
+                            evaluator.test(managedRoute, builder, options);
 
-							if (builder.state() == State.DOWN) {
-								break;
-							}
-						}
-					}
-				}
-			}
-		}
+                            if (builder.state() == State.DOWN) { 
+                                break;
+                            }
+                        }
+                    }
+                }
+            }
+        }
     }
 }


[camel] 01/03: CAMEL-13877 fix NPE in RouteHealthCheck

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4fba2be69d675a0bd177813cf283b1dbb3289978
Author: Paul Heaberlin <pa...@jetisre.com>
AuthorDate: Mon Aug 19 16:09:44 2019 -0500

    CAMEL-13877 fix NPE in RouteHealthCheck
---
 .../apache/camel/impl/health/RouteHealthCheck.java | 32 ++++++++++----------
 .../camel/impl/health/RouteHealthCheckTest.java    | 35 ++++++++++++++++++++++
 2 files changed, 52 insertions(+), 15 deletions(-)

diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/health/RouteHealthCheck.java b/core/camel-base/src/main/java/org/apache/camel/impl/health/RouteHealthCheck.java
index 3d773eb..3b47302 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/health/RouteHealthCheck.java
+++ b/core/camel-base/src/main/java/org/apache/camel/impl/health/RouteHealthCheck.java
@@ -84,21 +84,23 @@ public class RouteHealthCheck extends AbstractHealthCheck {
                 builder.up();
             }
 
-            if (builder.state() != State.DOWN) {
-                // If JMX is enabled, use the Managed MBeans to determine route
-                // health based on performance counters.
-                ManagedRouteMBean managedRoute = context.getExtension(ManagedCamelContext.class).getManagedRoute(route.getId());
+			if (builder.state() != State.DOWN) {
+				// If JMX is enabled, use the Managed MBeans to determine route
+				// health based on performance counters.
+				ManagedCamelContext managedCamelContext = context.getExtension(ManagedCamelContext.class);
+				if (managedCamelContext != null) {
+					ManagedRouteMBean managedRoute = managedCamelContext.getManagedRoute(route.getId());
+					if (managedRoute != null && !evaluators.isEmpty()) {
+						for (PerformanceCounterEvaluator<ManagedRouteMBean> evaluator : evaluators) {
+							evaluator.test(managedRoute, builder, options);
 
-                if (managedRoute != null && !evaluators.isEmpty()) {
-                    for (PerformanceCounterEvaluator<ManagedRouteMBean> evaluator : evaluators) {
-                        evaluator.test(managedRoute, builder, options);
-
-                        if (builder.state() == State.DOWN) {
-                            break;
-                        }
-                    }
-                }
-            }
-        }
+							if (builder.state() == State.DOWN) {
+								break;
+							}
+						}
+					}
+				}
+			}
+		}
     }
 }
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java
new file mode 100644
index 0000000..fd723bc
--- /dev/null
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/health/RouteHealthCheckTest.java
@@ -0,0 +1,35 @@
+package org.apache.camel.impl.health;
+
+import java.util.Collections;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Route;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.health.HealthCheckResultBuilder;
+import org.junit.Test;
+
+public class RouteHealthCheckTest extends ContextTestSupport {
+
+	private static final String TEST_ROUTE_ID = "Test-Route";
+
+	@Test
+	public void testDoCallDoesNotHaveNPEWhenJmxDisabled() {
+		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");
+			}
+		};
+	}
+
+}