diff options
Diffstat (limited to 'models-interactions/model-actors/actorServiceProvider')
3 files changed, 18 insertions, 0 deletions
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/Forwarder.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/Forwarder.java index 2d98b66fc..957185e47 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/Forwarder.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/Forwarder.java @@ -72,6 +72,8 @@ public class Forwarder { throw new IllegalArgumentException("key/value mismatch"); } + logger.info("register topic listener for key={} value={}", keys, values); + values2listeners.compute(values, (key, listeners) -> { Map<BiConsumer<String, StandardCoderObject>, String> map = listeners; if (map == null) { @@ -90,6 +92,8 @@ public class Forwarder { * @param listener listener to unregister */ public void unregister(List<String> values, BiConsumer<String, StandardCoderObject> listener) { + logger.info("unregister topic listener for key={} value={}", keys, values); + values2listeners.computeIfPresent(values, (key, listeners) -> { listeners.remove(listener); return (listeners.isEmpty() ? null : listeners); @@ -112,6 +116,7 @@ public class Forwarder { * No value for this field, so this message is not relevant to this * forwarder. */ + logger.info("message has no key={}", keys); return; } @@ -122,11 +127,13 @@ public class Forwarder { Map<BiConsumer<String, StandardCoderObject>, String> listeners = values2listeners.get(values); if (listeners == null) { // no listeners for this particular list of values + logger.info("no listener registered for key={} value={}", keys, values); return; } // forward the message to each listener + logger.info("forwarding message to listeners for key={} value={}", keys, values); for (BiConsumer<String, StandardCoderObject> listener : listeners.keySet()) { try { listener.accept(textMessage, scoMessage); diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/SelectorKey.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/SelectorKey.java index fc5727395..f1ec9e91b 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/SelectorKey.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/SelectorKey.java @@ -20,6 +20,7 @@ package org.onap.policy.controlloop.actorserviceprovider.topic; +import java.util.Arrays; import lombok.EqualsAndHashCode; import org.onap.policy.common.utils.coder.StandardCoderObject; @@ -54,4 +55,9 @@ public class SelectorKey { public String extractField(StandardCoderObject object) { return object.getString(fieldIdentifiers); } + + @Override + public String toString() { + return Arrays.toString(fieldIdentifiers); + } } diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/SelectorKeyTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/SelectorKeyTest.java index 19df9c2d8..5ffcbf7dc 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/SelectorKeyTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/SelectorKeyTest.java @@ -83,6 +83,11 @@ public class SelectorKeyTest { assertNull(new SelectorKey().extractField(sco)); } + @Test + public void testToString() { + assertEquals("[map, abc]", key.toString()); + } + @Getter @Setter @Builder |