summaryrefslogtreecommitdiffstats
path: root/components/slice-analysis-ms/src
diff options
context:
space:
mode:
authorVijay Venkatesh Kumar <vv770d@att.com>2022-08-03 13:22:58 +0000
committerGerrit Code Review <gerrit@onap.org>2022-08-03 13:22:58 +0000
commit015b7529adc61181862c84a20ed7140a96e479dc (patch)
tree2e17dff026cef6a66f1e59a131f4b13b9113af5f /components/slice-analysis-ms/src
parentfcb17db482605d7d7b0c11505022d6bd3d899287 (diff)
parent0fa823de11b9b2d0980275247dfd9e597f9dc915 (diff)
Merge "Revert "Fix bug in handleNotification function and improve test code coverage""
Diffstat (limited to 'components/slice-analysis-ms/src')
-rw-r--r--components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallback.java7
-rw-r--r--components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallbackTest.java26
2 files changed, 12 insertions, 21 deletions
diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallback.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallback.java
index 485c3d96..584da7b7 100644
--- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallback.java
+++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallback.java
@@ -59,7 +59,6 @@ public class VesNotificationCallback implements NotificationCallback {
@PostConstruct
public void init(){
configuration = Configuration.getInstance();
- ccvpnPmDatastore = new CCVPNPmDatastore();
vesNotifChangeIdentifier = configuration.getVesNotifChangeIdentifier();
vesNotfiChangeType = configuration.getVesNotifChangeType();
}
@@ -74,7 +73,7 @@ public class VesNotificationCallback implements NotificationCallback {
}
/**
- * Parse Performance dmaap notification and save to DB
+ * Parse Performance dmaap notification and save to DB
* @param msg incoming message
*/
private void handleNotification(String msg) {
@@ -95,7 +94,7 @@ public class VesNotificationCallback implements NotificationCallback {
notifChangeIdentifier = output.getChangeIdentifier();
notifChangeType = output.getChangeType();
if (notifChangeType.equals(vesNotfiChangeType)
- && notifChangeIdentifier.equals(vesNotifChangeIdentifier)) {
+ && notifChangeIdentifier.equals(vesNotifChangeIdentifier)) {
cllId = output.getArrayOfNamedHashMap().get(0).getHashMap().getCllId();
uniId = output.getArrayOfNamedHashMap().get(0).getHashMap().getUniId();
bw = output.getArrayOfNamedHashMap().get(0).getHashMap().getBandwidthValue();
@@ -112,4 +111,4 @@ public class VesNotificationCallback implements NotificationCallback {
}
-} \ No newline at end of file
+}
diff --git a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallbackTest.java b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallbackTest.java
index beb11998..74f75a8c 100644
--- a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallbackTest.java
+++ b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/dmaap/VesNotificationCallbackTest.java
@@ -22,17 +22,14 @@
package org.onap.slice.analysis.ms.dmaap;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mockito;
import org.mockito.Spy;
-import org.onap.slice.analysis.ms.models.Configuration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
-import com.google.gson.Gson;
-import com.google.gson.JsonObject;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -46,26 +43,21 @@ public class VesNotificationCallbackTest {
@InjectMocks
VesNotificationCallback vesNotificationCallback;
- @Before
- public void init() throws IOException {
- Configuration configuration = Configuration.getInstance();
- String configAllJson = new String(Files.readAllBytes(Paths.get("src/test/resources/config_all.json")));
- JsonObject configAll = new Gson().fromJson(configAllJson, JsonObject.class);
- JsonObject config = configAll.getAsJsonObject("config");
- configuration.updateConfigurationFromJsonObject(config);
- vesNotificationCallback.init();
- }
-
@Test
public void initTest() {
+ vesNotificationCallback.init();
Mockito.verify(vesNotificationCallback, Mockito.atLeastOnce()).init();
}
@Test
- public void activateCallBackTest() throws Exception{
- String input = new String(Files.readAllBytes(Paths.get("src/test/resources/vesCCVPNNotiModel.json")));
+ public void activateCallBackTest() {
+ String input = null;
+ try {
+ input = new String(Files.readAllBytes(Paths.get("src/test/resources/vesCCVPNNotiModel.json")));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
vesNotificationCallback.activateCallBack(input);
Mockito.verify(vesNotificationCallback, Mockito.atLeastOnce()).activateCallBack(Mockito.anyString());
}
-
}