You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gh...@apache.org on 2020/04/08 09:21:20 UTC
[felix-dev] 01/02: FELIX-6250 Use semantically correct event topic
with 'component'
This is an automated email from the ASF dual-hosted git repository.
ghenzler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
commit 51a3fd62fb9ee635d557984e3479dc590921886c
Author: georg.henzler <ge...@netcentric.biz>
AuthorDate: Wed Apr 8 11:14:21 2020 +0200
FELIX-6250 Use semantically correct event topic with 'component'
instead of 'class' (it's only the class by default but can be any name)
---
.../org/apache/felix/hc/core/impl/monitor/HealthCheckMonitor.java | 6 +++---
.../apache/felix/hc/core/impl/monitor/HealthCheckMonitorTest.java | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/healthcheck/core/src/main/java/org/apache/felix/hc/core/impl/monitor/HealthCheckMonitor.java b/healthcheck/core/src/main/java/org/apache/felix/hc/core/impl/monitor/HealthCheckMonitor.java
index 81a3e96..f687d68 100644
--- a/healthcheck/core/src/main/java/org/apache/felix/hc/core/impl/monitor/HealthCheckMonitor.java
+++ b/healthcheck/core/src/main/java/org/apache/felix/hc/core/impl/monitor/HealthCheckMonitor.java
@@ -341,10 +341,10 @@ public class HealthCheckMonitor implements Runnable {
LOG.debug("HealthCheckMonitor: Posted event for topic '{}': Status change from {} to {}", topic,
previousStatus, status);
if (!(executionResult instanceof CombinedExecutionResult)) {
- String componentClass = (String) executionResult.getHealthCheckMetadata().getServiceReference()
+ String componentName = (String) executionResult.getHealthCheckMetadata().getServiceReference()
.getProperty(ComponentConstants.COMPONENT_NAME);
- if (StringUtils.isNotBlank(componentClass)) {
- String topicClass = EVENT_TOPIC_PREFIX + "/class/" + componentClass.replace(".", "/");
+ if (StringUtils.isNotBlank(componentName)) {
+ String topicClass = EVENT_TOPIC_PREFIX + "/component/" + componentName.replace(".", "/");
eventAdmin.postEvent(new Event(topicClass, properties));
LOG.debug("HealthCheckMonitor: Posted event for topic '{}': Status change from {} to {}",
topicClass, previousStatus, status);
diff --git a/healthcheck/core/src/test/java/org/apache/felix/hc/core/impl/monitor/HealthCheckMonitorTest.java b/healthcheck/core/src/test/java/org/apache/felix/hc/core/impl/monitor/HealthCheckMonitorTest.java
index 70c3cd4..dfc770f 100644
--- a/healthcheck/core/src/test/java/org/apache/felix/hc/core/impl/monitor/HealthCheckMonitorTest.java
+++ b/healthcheck/core/src/test/java/org/apache/felix/hc/core/impl/monitor/HealthCheckMonitorTest.java
@@ -204,7 +204,7 @@ public class HealthCheckMonitorTest {
assertEquals(2, postedEvents.size());
assertEquals("org/apache/felix/healthchange/tag/test-tag", postedEvents.get(0).getTopic());
assertEquals(Result.Status.OK, postedEvents.get(0).getProperty(HealthCheckMonitor.EVENT_PROP_STATUS));
- assertEquals("org/apache/felix/healthchange/class/org/apache/felix/TestHealthCheck", postedEvents.get(1).getTopic());
+ assertEquals("org/apache/felix/healthchange/component/org/apache/felix/TestHealthCheck", postedEvents.get(1).getTopic());
reset(eventAdmin);
// without status change
@@ -222,7 +222,7 @@ public class HealthCheckMonitorTest {
assertEquals("org/apache/felix/healthchange/tag/test-tag", postedEvents.get(0).getTopic());
assertEquals(Result.Status.CRITICAL, postedEvents.get(0).getProperty(HealthCheckMonitor.EVENT_PROP_STATUS));
assertEquals(Result.Status.OK, postedEvents.get(0).getProperty(HealthCheckMonitor.EVENT_PROP_PREVIOUS_STATUS));
- assertEquals("org/apache/felix/healthchange/class/org/apache/felix/TestHealthCheck", postedEvents.get(1).getTopic());
+ assertEquals("org/apache/felix/healthchange/component/org/apache/felix/TestHealthCheck", postedEvents.get(1).getTopic());
reset(eventAdmin);
// without status change