diff options
author | Keguang He <hekeguang@chinamobile.com> | 2023-04-11 09:44:24 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2023-04-11 09:44:24 +0000 |
commit | 2782fb96825e56d01e1b6b4f426fae8e1e8815fb (patch) | |
tree | 0f7e6cd8d952b3ef68fe0597cf8c80bd37a35ca9 /intentanalysis/src/main/java | |
parent | a893668c5c913ccb6cc3189fdce3331f866cd700 (diff) | |
parent | d126dba33d4033e9f5af5e00d3830d2e05474b26 (diff) |
Merge "Fix some issues and Add UT"
Diffstat (limited to 'intentanalysis/src/main/java')
4 files changed, 13 insertions, 5 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dcae/dmaap/DCAENotificationCallback.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dcae/dmaap/DCAENotificationCallback.java index 158cf91..04f06ce 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dcae/dmaap/DCAENotificationCallback.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dcae/dmaap/DCAENotificationCallback.java @@ -18,13 +18,16 @@ package org.onap.usecaseui.intentanalysis.adapters.dcae.dmaap; import com.google.gson.Gson; import org.onap.usecaseui.intentanalysis.adapters.dmaap.NotificationCallback; import org.onap.usecaseui.intentanalysis.adapters.dmaap.NotificationEventModel; +import org.onap.usecaseui.intentanalysis.adapters.policy.dmaap.PolicyNotificationCallback; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class DCAENotificationCallback implements NotificationCallback { - + private static final Logger logger = LoggerFactory.getLogger(DCAENotificationCallback.class); @Override public void activateCallBack(String msg) { + logger.info("Received event from DCAE: \n" + msg); NotificationEventModel event = (new Gson()).fromJson(msg, NotificationEventModel.class); - //Todo analyze the event and Report to the Intent Flow; } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dmaap/MRTopicMonitor.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dmaap/MRTopicMonitor.java index 528805d..48047e1 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dmaap/MRTopicMonitor.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dmaap/MRTopicMonitor.java @@ -100,10 +100,9 @@ public class MRTopicMonitor implements Runnable { public void run() { while (running) { try { - logger.debug("Topic: {} getting new msg...", consumerWrapper.getTopicName()); List<JsonElement> dmaapMsgs = consumerWrapper.fetch(); for (JsonElement msg : dmaapMsgs) { - logger.debug("Received message: {}" + "\r\n and processing start", msg); + logger.debug("Event {} Received message: {}" + "\r\n and processing start", consumerWrapper.getTopicName(), msg); process(msg.toString()); } } catch (IOException | RuntimeException e) { diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dmaap/NotificationEventModel.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dmaap/NotificationEventModel.java index 2b4c44f..d465eba 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dmaap/NotificationEventModel.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dmaap/NotificationEventModel.java @@ -21,7 +21,7 @@ public class NotificationEventModel { private String source; - private Date timestamp; + private String timestamp; private NotificationEventEntity entity; } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/dmaap/PolicyNotificationCallback.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/dmaap/PolicyNotificationCallback.java index a93aac9..44ad9ca 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/dmaap/PolicyNotificationCallback.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/dmaap/PolicyNotificationCallback.java @@ -18,10 +18,16 @@ package org.onap.usecaseui.intentanalysis.adapters.policy.dmaap; import com.google.gson.Gson; import org.onap.usecaseui.intentanalysis.adapters.dmaap.NotificationCallback; import org.onap.usecaseui.intentanalysis.adapters.dmaap.NotificationEventModel; +import org.onap.usecaseui.intentanalysis.adapters.policy.impl.PolicyServiceImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class PolicyNotificationCallback implements NotificationCallback { + + private static final Logger logger = LoggerFactory.getLogger(PolicyNotificationCallback.class); @Override public void activateCallBack(String msg) { + logger.info("Received event from Policy: \n" + msg); NotificationEventModel event = (new Gson()).fromJson(msg, NotificationEventModel.class); //Todo analyze the event and Report to the Intent Flow; |