summaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/java/org/onap
diff options
context:
space:
mode:
authorChuanyuChen <chenchuanyu@huawei.com>2023-04-11 16:43:51 +0800
committerChuanyuChen <chenchuanyu@huawei.com>2023-04-11 16:43:51 +0800
commitd126dba33d4033e9f5af5e00d3830d2e05474b26 (patch)
tree6e141634a49ed58acf73a33bfe7584aaa447d3d0 /intentanalysis/src/main/java/org/onap
parentef6560bbb9bfa6248bf2afead5a9d02338aaf02f (diff)
Fix some issues and Add UT
Fix some issues and add UT Issue-ID: USECASEUI-794 Signed-off-by: ChuanyuChen <chenchuanyu@huawei.com> Change-Id: I013553ded90ff342653f01383cf4512885939479
Diffstat (limited to 'intentanalysis/src/main/java/org/onap')
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dcae/dmaap/DCAENotificationCallback.java7
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dmaap/MRTopicMonitor.java3
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/dmaap/NotificationEventModel.java2
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/dmaap/PolicyNotificationCallback.java6
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;