This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new a1699c9 CAMEL-17626: camel-health - SPI to plugin custom manipulation
of health check
a1699c9 is described below
commit a1699c9d3d9deb5f2ce78418a96e8469f3f63b49
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Feb 10 10:42:42 2022 +0100
CAMEL-17626: camel-health - SPI to plugin custom manipulation of health
check
---
.../src/main/java/org/apache/camel/health/HealthCheck.java | 2 +-
.../java/org/apache/camel/health/HealthCheckResultBuilder.java | 8 ++++----
.../apache/camel/impl/health/HealthCheckResultStrategyTest.java | 2 +-
.../java/org/apache/camel/impl/health/AbstractHealthCheck.java | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git
a/core/camel-api/src/main/java/org/apache/camel/health/HealthCheck.java
b/core/camel-api/src/main/java/org/apache/camel/health/HealthCheck.java
index 0baa787..958e5b6 100644
--- a/core/camel-api/src/main/java/org/apache/camel/health/HealthCheck.java
+++ b/core/camel-api/src/main/java/org/apache/camel/health/HealthCheck.java
@@ -135,7 +135,7 @@ public interface HealthCheck extends HasGroup, HasId,
Ordered {
/**
* A key/value combination of details.
*
- * @return a non null details map
+ * @return a non null details map (empty if no details)
*/
Map<String, Object> getDetails();
}
diff --git
a/core/camel-api/src/main/java/org/apache/camel/health/HealthCheckResultBuilder.java
b/core/camel-api/src/main/java/org/apache/camel/health/HealthCheckResultBuilder.java
index ed2fb15..3aee92b 100644
---
a/core/camel-api/src/main/java/org/apache/camel/health/HealthCheckResultBuilder.java
+++
b/core/camel-api/src/main/java/org/apache/camel/health/HealthCheckResultBuilder.java
@@ -29,7 +29,7 @@ import org.apache.camel.util.ObjectHelper;
*/
public final class HealthCheckResultBuilder implements
Builder<HealthCheck.Result> {
- private HealthCheck check;
+ private final HealthCheck check;
private String message;
private Throwable error;
private Map<String, Object> details;
@@ -107,8 +107,8 @@ public final class HealthCheckResultBuilder implements
Builder<HealthCheck.Resul
final HealthCheck.State responseState = this.state;
final Optional<String> responseMessage =
Optional.ofNullable(this.message);
final Optional<Throwable> responseError =
Optional.ofNullable(this.error);
- final Map<String, Object> responseDetails =
HealthCheckResultBuilder.this.details != null
- ? Collections.unmodifiableMap(new
HashMap<>(HealthCheckResultBuilder.this.details))
+ final Map<String, Object> responseDetails =
ObjectHelper.isNotEmpty(this.details)
+ ? Collections.unmodifiableMap(new HashMap<>(this.details))
: Collections.emptyMap();
return new HealthCheck.Result() {
@@ -145,6 +145,6 @@ public final class HealthCheckResultBuilder implements
Builder<HealthCheck.Resul
@Override
public String toString() {
- return "HealthCheck[" + check.getGroup() + "," + check.getId() + "]";
+ return "HealthCheck[" + check.getGroup() + "/" + check.getId() + "]";
}
}
diff --git
a/core/camel-core/src/test/java/org/apache/camel/impl/health/HealthCheckResultStrategyTest.java
b/core/camel-core/src/test/java/org/apache/camel/impl/health/HealthCheckResultStrategyTest.java
index 1afdc31..c333f25 100644
---
a/core/camel-core/src/test/java/org/apache/camel/impl/health/HealthCheckResultStrategyTest.java
+++
b/core/camel-core/src/test/java/org/apache/camel/impl/health/HealthCheckResultStrategyTest.java
@@ -24,8 +24,8 @@ import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.health.HealthCheck;
import org.apache.camel.health.HealthCheckHelper;
import org.apache.camel.health.HealthCheckRegistry;
-import org.apache.camel.health.HealthCheckResultStrategy;
import org.apache.camel.health.HealthCheckResultBuilder;
+import org.apache.camel.health.HealthCheckResultStrategy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
diff --git
a/core/camel-health/src/main/java/org/apache/camel/impl/health/AbstractHealthCheck.java
b/core/camel-health/src/main/java/org/apache/camel/impl/health/AbstractHealthCheck.java
index bb29f64..8ffa124 100644
---
a/core/camel-health/src/main/java/org/apache/camel/impl/health/AbstractHealthCheck.java
+++
b/core/camel-health/src/main/java/org/apache/camel/impl/health/AbstractHealthCheck.java
@@ -27,8 +27,8 @@ import java.util.concurrent.ConcurrentMap;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.health.HealthCheck;
-import org.apache.camel.health.HealthCheckResultStrategy;
import org.apache.camel.health.HealthCheckResultBuilder;
+import org.apache.camel.health.HealthCheckResultStrategy;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;