From cd66181b35300f020f197bb411d6bdf6ad2514fb Mon Sep 17 00:00:00 2001 From: PawelSzalapski Date: Tue, 26 Jun 2018 15:16:41 +0200 Subject: Prepare codebase for dynamic DMaaP configuration From now on, there is only one single place where we can create whole app core concerning sending events and it has a single entry point, based on DMaaP configuration. It can be used to rebuild part of app that is responsible for sending events dynamically. Changes are in scope for the dynamic DMaaP config feature. + bumped up code coverage a bit Change-Id: Iecc8c4e534ae9b781f47e3616409271ba83169c8 Signed-off-by: PawelSzalapski Issue-ID: DCAEGEN2-517 --- src/main/java/org/onap/dcae/commonFunction/EventProcessor.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main/java/org/onap/dcae/commonFunction/EventProcessor.java') diff --git a/src/main/java/org/onap/dcae/commonFunction/EventProcessor.java b/src/main/java/org/onap/dcae/commonFunction/EventProcessor.java index 06a27328..9d6ad360 100644 --- a/src/main/java/org/onap/dcae/commonFunction/EventProcessor.java +++ b/src/main/java/org/onap/dcae/commonFunction/EventProcessor.java @@ -27,6 +27,7 @@ import com.google.common.reflect.TypeToken; import com.google.gson.Gson; import java.util.Map; import org.json.JSONObject; +import org.onap.dcae.commonFunction.event.publishing.EventPublisher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,8 +53,10 @@ class EventProcessor implements Runnable { static Map streamidHash = new HashMap<>(); public JSONObject event; + private EventPublisher eventPublisher; - EventProcessor() { + public EventProcessor(EventPublisher eventPublisher) { + this.eventPublisher = eventPublisher; streamidHash = parseStreamIdToStreamHashMapping(CommonStartup.streamID); } @@ -128,7 +131,7 @@ class EventProcessor implements Runnable { for (String aStreamIdList : streamIdList) { log.info("Invoking publisher for streamId:" + aStreamIdList); this.overrideEvent(); - EventPublisherHash.getInstance().sendEvent(event, aStreamIdList); + eventPublisher.sendEvent(event, aStreamIdList); } } -- cgit 1.2.3-korg