You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by fm...@apache.org on 2025/04/07 12:58:14 UTC
(camel) branch camel-4.10.x updated (9a4df7a464b -> 3e032ef6303)
This is an automated email from the ASF dual-hosted git repository.
fmariani pushed a change to branch camel-4.10.x
in repository https://gitbox.apache.org/repos/asf/camel.git
from 9a4df7a464b Bump for next version
new 94e481e2e36 health-check: Fixes Camel context health check (#17680)
new 3e032ef6303 Regen
The 2 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:
...hCheckTest.java => ContextHealthCheckTest.java} | 65 +++++++---------------
.../camel/impl/health/ContextHealthCheck.java | 2 +
2 files changed, 22 insertions(+), 45 deletions(-)
copy core/camel-core/src/test/java/org/apache/camel/impl/health/{HealthCheckTest.java => ContextHealthCheckTest.java} (52%)
(camel) 01/02: health-check: Fixes Camel context health check (#17680)
Posted by fm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
fmariani pushed a commit to branch camel-4.10.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 94e481e2e36360f683a669cb0427925ab6be6fe6
Author: Marco Carletti <mc...@redhat.com>
AuthorDate: Mon Apr 7 14:06:24 2025 +0200
health-check: Fixes Camel context health check (#17680)
---
.../camel/impl/health/ContextHealthCheckTest.java | 50 ++++++++++++++++++++++
.../camel/impl/health/ContextHealthCheck.java | 2 +
2 files changed, 52 insertions(+)
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/health/ContextHealthCheckTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/health/ContextHealthCheckTest.java
new file mode 100644
index 00000000000..e65ed8c9bc5
--- /dev/null
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/health/ContextHealthCheckTest.java
@@ -0,0 +1,50 @@
+package org.apache.camel.impl.health;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ServiceStatus;
+import org.apache.camel.health.HealthCheck;
+import org.apache.camel.health.HealthCheckResultBuilder;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.jupiter.api.Test;
+
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
+public class ContextHealthCheckTest {
+
+ @Test
+ public void testOverallStatusOnceTheContextIsStarted() {
+ CamelContext context = new DefaultCamelContext();
+ context.start();
+
+ ContextHealthCheck check = new ContextHealthCheck();
+ check.setCamelContext(context);
+
+ HealthCheck.Result result = check.call();
+
+ assertEquals(HealthCheck.State.UP, result.getState());
+ assertFalse(result.getMessage().isPresent());
+ assertFalse(result.getDetails().containsKey(AbstractHealthCheck.CHECK_ENABLED));
+ assertEquals(ServiceStatus.Started, result.getDetails().get("context.status"));
+ }
+
+ @Test
+ public void testOverallStatusOnceTheContextIsSuspended() {
+ CamelContext context = new DefaultCamelContext();
+ context.suspend();
+
+ ContextHealthCheck check = new ContextHealthCheck();
+ check.setCamelContext(context);
+
+ HealthCheck.Result result = check.call();
+
+ assertEquals(HealthCheck.State.DOWN, result.getState());
+ assertTrue(result.getMessage().isPresent());
+ assertFalse(result.getDetails().containsKey(AbstractHealthCheck.CHECK_ENABLED));
+ assertEquals(ServiceStatus.Suspended, result.getDetails().get("context.status"));
+ }
+
+
+}
diff --git a/core/camel-health/src/main/java/org/apache/camel/impl/health/ContextHealthCheck.java b/core/camel-health/src/main/java/org/apache/camel/impl/health/ContextHealthCheck.java
index aed5dc79c72..8315d9f4a66 100644
--- a/core/camel-health/src/main/java/org/apache/camel/impl/health/ContextHealthCheck.java
+++ b/core/camel-health/src/main/java/org/apache/camel/impl/health/ContextHealthCheck.java
@@ -71,6 +71,7 @@ public final class ContextHealthCheck extends AbstractHealthCheck {
break;
case Started:
builder.up();
+ break;
case Stopping:
case Stopped:
case Suspending:
@@ -78,6 +79,7 @@ public final class ContextHealthCheck extends AbstractHealthCheck {
builder.message("Camel Context '" + name + "' is shutting down. Status: '" + status + "', Phase: '" + phase
+ "'. Please check the debug log");
builder.down();
+ break;
default:
builder.message("Camel Context '" + name + "' has unknown Status: " + status);
builder.down();
(camel) 02/02: Regen
Posted by fm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
fmariani pushed a commit to branch camel-4.10.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3e032ef6303c9bcdb146fd7e258cf1c2dab46c94
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Apr 7 14:15:12 2025 +0200
Regen
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
.../camel/impl/health/ContextHealthCheckTest.java | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/health/ContextHealthCheckTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/health/ContextHealthCheckTest.java
index e65ed8c9bc5..36b3fe99790 100644
--- a/core/camel-core/src/test/java/org/apache/camel/impl/health/ContextHealthCheckTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/health/ContextHealthCheckTest.java
@@ -1,14 +1,27 @@
+/*
+ * 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 org.apache.camel.CamelContext;
import org.apache.camel.ServiceStatus;
import org.apache.camel.health.HealthCheck;
-import org.apache.camel.health.HealthCheckResultBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.junit.jupiter.api.Test;
-import java.util.Map;
-
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -46,5 +59,4 @@ public class ContextHealthCheckTest {
assertEquals(ServiceStatus.Suspended, result.getDetails().get("context.status"));
}
-
}