diff options
author | Jim Hahn <jrh3@att.com> | 2020-03-05 16:41:15 -0500 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-03-05 23:06:01 -0500 |
commit | aedb286b0683e9ac24c5160e9d47f596a243697f (patch) | |
tree | 39359f801252f24521a55a2057a1fec8b39c2434 /models-interactions/model-actors/actorServiceProvider/src | |
parent | 2358a161a4bbd0f0c97696b61fd725c33f7267e6 (diff) |
Add other APPC-LCM operations
Also added legacy ModifyConfig as an operation within APPC-LCM.
Added logging to topic registration keys.
Issue-ID: POLICY-2403
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: Ia54a573fd6218a8afe870184b9a3baebc05b766a
Diffstat (limited to 'models-interactions/model-actors/actorServiceProvider/src')
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 |