summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/ApplicationTest.java25
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/BufferNotificationComponentTest.java1
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/ClusterDetailsComponentTest.java1
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/ConfigPolicyTest.java1
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/ConfigurationTest.java29
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/DmaapNotificationsComponentTest.java1
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/EventHandlerTest.java10
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/child/GraphTest.java1
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/child/TestChildThreadUtils.java4
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/child/TestDetection.java2
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/child/TestPnfUtils.java20
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/dmaap/DmaapClientTest.java27
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/dmaap/NotificationProducerTest.java37
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/entity/FaultNotificationsTest.java (renamed from src/test/java/org/onap/dcaegen2/services/sonhms/MainThreadTest.java)23
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/model/NotificationTest.java10
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/model/PayloadTest.java9
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/model/PolicyNotificationTest.java7
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/AsyncResponseBodyTest.java3
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CellInfoTest.java2
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRequestBodyTest.java4
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRestClientTest.java14
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PciSolutionsTest.java1
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRequestBodyTest.java1
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRestClientTest.java117
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/RequestInfoTest.java1
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClientTest.java2
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SolutionsTest.java3
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/utils/ClusterUtilsTest.java14
28 files changed, 89 insertions, 281 deletions
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/ApplicationTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/ApplicationTest.java
deleted file mode 100644
index 1b3453a..0000000
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/ApplicationTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * son-handler
- * ================================================================================
- * Copyright (C) 2019 Wipro Limited.
- * ==============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- *******************************************************************************/
-package org.onap.dcaegen2.services.sonhms;
-
-public class ApplicationTest {
-
-}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/BufferNotificationComponentTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/BufferNotificationComponentTest.java
index 19fe536..d2480d2 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/BufferNotificationComponentTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/BufferNotificationComponentTest.java
@@ -26,6 +26,7 @@ import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/ClusterDetailsComponentTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/ClusterDetailsComponentTest.java
index 22d0ccf..18bde74 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/ClusterDetailsComponentTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/ClusterDetailsComponentTest.java
@@ -26,6 +26,7 @@ import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/ConfigPolicyTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/ConfigPolicyTest.java
index ca12095..6fe1ffc 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/ConfigPolicyTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/ConfigPolicyTest.java
@@ -27,7 +27,6 @@ import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
-import org.onap.dcaegen2.services.sonhms.ConfigPolicy;
public class ConfigPolicyTest {
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/ConfigurationTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/ConfigurationTest.java
index 02a4f07..851920d 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/ConfigurationTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/ConfigurationTest.java
@@ -27,7 +27,6 @@ import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
-import org.onap.dcaegen2.services.sonhms.Configuration;
public class ConfigurationTest {
@@ -37,53 +36,39 @@ public class ConfigurationTest {
public void configurationTest() {
configuration.setBufferTime(60);
configuration.setCallbackUrl("/callbackUrl");
- configuration.setConfigName("configName");
List<String> list = new ArrayList<String>();
list.add("server");
- configuration.setServers(list);
+ configuration.setDmaapServers(list);
configuration.setCg("cg");
configuration.setCid("cid");
- configuration.setManagerApiKey("managerApiKey");
- configuration.setManagerSecretKey("managerSecretKey");
+
configuration.setMaximumClusters(5);
configuration.setMinCollision(5);
configuration.setMinConfusion(5);
configuration.setNumSolutions(1);
configuration.setOofService("oofService");
configuration.setOptimizers(list);
- configuration.setPcimsApiKey("pcimsApiKey");
- configuration.setPcimsSecretKey("pcimsSecretKey");
- configuration.setPolicyName("policyName");
- configuration.setPolicyService("policyService");
- configuration.setPolicyTopic("policyTopic");
configuration.setPollingInterval(30);
configuration.setPollingTimeout(100);
- configuration.setSdnrService("sdnrService");
- configuration.setSdnrTopic("sdnrTopic");
+ configuration.setConfigDbService("sdnrService");
configuration.setSourceId("sourceId");
assertEquals(60, configuration.getBufferTime());
assertEquals("/callbackUrl", configuration.getCallbackUrl());
assertEquals("cg", configuration.getCg());
assertEquals("cid", configuration.getCid());
- assertEquals("managerApiKey", configuration.getManagerApiKey());
- assertEquals("managerSecretKey", configuration.getManagerSecretKey());
+
assertEquals(5, configuration.getMaximumClusters());
assertEquals(5, configuration.getMinCollision());
assertEquals(5, configuration.getMinConfusion());
assertEquals(1, configuration.getNumSolutions());
assertEquals("oofService", configuration.getOofService());
assertEquals(list, configuration.getOptimizers());
- assertEquals("pcimsApiKey", configuration.getPcimsApiKey());
- assertEquals("pcimsSecretKey", configuration.getPcimsSecretKey());
- assertEquals("policyName", configuration.getPolicyName());
- assertEquals("policyService", configuration.getPolicyService());
- assertEquals("policyTopic", configuration.getPolicyTopic());
+
assertEquals(30, configuration.getPollingInterval());
assertEquals(100, configuration.getPollingTimeout());
- assertEquals("sdnrService", configuration.getSdnrService());
- assertEquals("sdnrTopic", configuration.getSdnrTopic());
- assertEquals(list, configuration.getServers());
+ assertEquals("sdnrService", configuration.getConfigDbService());
+ assertEquals(list, configuration.getDmaapServers());
assertEquals("sourceId", configuration.getSourceId());
}
}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/DmaapNotificationsComponentTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/DmaapNotificationsComponentTest.java
index cc4d3ad..bf5ef97 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/DmaapNotificationsComponentTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/DmaapNotificationsComponentTest.java
@@ -30,6 +30,7 @@ import fj.data.Either;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
+
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/EventHandlerTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/EventHandlerTest.java
index a79e368..5032799 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/EventHandlerTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/EventHandlerTest.java
@@ -20,6 +20,10 @@
package org.onap.dcaegen2.services.sonhms;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import fj.data.Either;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -29,6 +33,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -37,8 +42,6 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
-import org.springframework.boot.test.context.SpringBootTest;
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.onap.dcaegen2.services.sonhms.child.Graph;
import org.onap.dcaegen2.services.sonhms.entity.ClusterDetails;
import org.onap.dcaegen2.services.sonhms.exceptions.ConfigDbNotFoundException;
@@ -47,8 +50,7 @@ import org.onap.dcaegen2.services.sonhms.model.Notification;
import org.onap.dcaegen2.services.sonhms.utils.ClusterUtils;
import org.onap.dcaegen2.services.sonhms.utils.ClusterUtilsTest;
import org.onap.dcaegen2.services.sonhms.utils.ThreadUtils;
-
-import fj.data.Either;
+import org.springframework.boot.test.context.SpringBootTest;
@RunWith(MockitoJUnitRunner.class)
@SpringBootTest(classes = EventHandler.class)
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/child/GraphTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/child/GraphTest.java
index 3df7f93..16c3ad9 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/child/GraphTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/child/GraphTest.java
@@ -28,7 +28,6 @@ import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
-import org.onap.dcaegen2.services.sonhms.child.Graph;
import org.onap.dcaegen2.services.sonhms.model.CellPciPair;
import org.slf4j.Logger;
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestChildThreadUtils.java b/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestChildThreadUtils.java
index 03e735f..ca5f5fd 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestChildThreadUtils.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestChildThreadUtils.java
@@ -21,6 +21,8 @@
package org.onap.dcaegen2.services.sonhms.child;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -33,8 +35,6 @@ import java.util.Map;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.onap.dcaegen2.services.sonhms.ConfigPolicy;
import org.onap.dcaegen2.services.sonhms.model.CellPciPair;
import org.onap.dcaegen2.services.sonhms.model.PolicyNotification;
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestDetection.java b/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestDetection.java
index 6e42cce..05d3e79 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestDetection.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestDetection.java
@@ -27,8 +27,6 @@ import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
-import org.onap.dcaegen2.services.sonhms.child.Detection;
-import org.onap.dcaegen2.services.sonhms.child.Graph;
import org.onap.dcaegen2.services.sonhms.model.CellPciPair;
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestPnfUtils.java b/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestPnfUtils.java
index e7f822f..0349521 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestPnfUtils.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestPnfUtils.java
@@ -22,6 +22,9 @@ package org.onap.dcaegen2.services.sonhms.child;
import static org.junit.Assert.assertEquals;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -40,16 +43,6 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.powermock.modules.junit4.PowerMockRunnerDelegate;
-import org.slf4j.Logger;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.onap.dcaegen2.services.sonhms.dao.CellInfoRepository;
import org.onap.dcaegen2.services.sonhms.entity.CellInfo;
import org.onap.dcaegen2.services.sonhms.exceptions.ConfigDbNotFoundException;
@@ -58,6 +51,13 @@ import org.onap.dcaegen2.services.sonhms.restclient.SdnrRestClient;
import org.onap.dcaegen2.services.sonhms.restclient.Solution;
import org.onap.dcaegen2.services.sonhms.utils.BeanUtil;
import org.onap.dcaegen2.services.sonhms.utils.ClusterUtilsTest;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.powermock.modules.junit4.PowerMockRunnerDelegate;
+import org.slf4j.Logger;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(SpringRunner.class)
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/dmaap/DmaapClientTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/dmaap/DmaapClientTest.java
index 63ba5bd..4f28e35 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/dmaap/DmaapClientTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/dmaap/DmaapClientTest.java
@@ -21,10 +21,9 @@
package org.onap.dcaegen2.services.sonhms.dmaap;
-import com.att.nsa.cambria.client.CambriaTopicManager;
-
import static org.mockito.Mockito.when;
+import com.att.nsa.cambria.client.CambriaTopicManager;
import java.io.IOException;
import java.util.ArrayList;
@@ -38,10 +37,8 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
-
-import org.onap.dcaegen2.services.sonhms.Configuration;
-import org.onap.dcaegen2.services.sonhms.NewNotification;
import org.mockito.MockitoAnnotations;
+import org.onap.dcaegen2.services.sonhms.Configuration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@@ -61,8 +58,6 @@ public class DmaapClientTest {
MockitoAnnotations.initMocks(this);
}
- private Boolean newNotif;
-
@Test
public void getAllTopicsTest() {
Set<String> topics = new HashSet<String>();
@@ -71,37 +66,27 @@ public class DmaapClientTest {
Configuration configuration = Configuration.getInstance();
configuration.setBufferTime(60);
configuration.setCallbackUrl("/callbackUrl");
- configuration.setConfigName("configName");
List<String> list = new ArrayList<String>();
list.add("server");
- configuration.setServers(list);
+ configuration.setDmaapServers(list);
configuration.setCg("cg");
configuration.setCid("cid");
- configuration.setManagerApiKey("managerApiKey");
- configuration.setManagerSecretKey("managerSecretKey");
configuration.setMaximumClusters(5);
configuration.setMinCollision(5);
configuration.setMinConfusion(5);
configuration.setNumSolutions(1);
configuration.setOofService("oofService");
configuration.setOptimizers(list);
- configuration.setPcimsApiKey("pcimsApiKey");
- configuration.setPcimsSecretKey("pcimsSecretKey");
- configuration.setPolicyName("policyName");
- configuration.setPolicyService("policyService");
- configuration.setPolicyTopic("policyTopic");
configuration.setPollingInterval(30);
configuration.setPollingTimeout(100);
- configuration.setSdnrService("sdnrService");
- configuration.setSdnrTopic("sdnrTopic");
+ configuration.setConfigDbService("sdnrService");
configuration.setSourceId("sourceId");
- NewNotification newNotification = new NewNotification(newNotif);
try {
when(topicManager.getTopics()).thenReturn(topics);
client=Mockito.mock(DmaapClient.class);
- client.initClient(newNotification);
- Mockito.verify(client).initClient(newNotification);
+ client.initClient();
+ Mockito.verify(client).initClient();
// Mockito.verifycreateAndConfigureTopics();
} catch (IOException e) {
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/dmaap/NotificationProducerTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/dmaap/NotificationProducerTest.java
index c76b953..4fa8227 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/dmaap/NotificationProducerTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/dmaap/NotificationProducerTest.java
@@ -25,8 +25,8 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
import com.att.nsa.cambria.client.CambriaBatchingPublisher;
+
import java.io.IOException;
-import java.security.GeneralSecurityException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
@@ -39,33 +39,24 @@ import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = NotificationProducerTest.class)
public class NotificationProducerTest {
-
@Mock
CambriaBatchingPublisher cambriaBatchingPublisher;
-
+
@InjectMocks
NotificationProducer notificationProducer;
-
+
@Test
public void notificationProducerTest() {
-
-
-
- try {
-
- when(cambriaBatchingPublisher.send(Mockito.anyString(), Mockito.anyString())).thenReturn(0);
- int result=notificationProducer.sendNotification("msg");
- assertEquals(0, result);
- } catch (GeneralSecurityException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
-
- }
-}
+ try {
+
+ when(cambriaBatchingPublisher.send(Mockito.anyString(), Mockito.anyString())).thenReturn(0);
+ int result = notificationProducer.sendNotification("msg");
+ assertEquals(0, result);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/MainThreadTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/entity/FaultNotificationsTest.java
index d06abbf..e83e9b9 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/MainThreadTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/entity/FaultNotificationsTest.java
@@ -19,8 +19,27 @@
*
*******************************************************************************/
-package org.onap.dcaegen2.services.sonhms;
+package org.onap.dcaegen2.services.sonhms.entity;
-public class MainThreadTest {
+import static org.junit.Assert.assertEquals;
+
+import java.sql.Timestamp;
+
+import org.junit.Test;
+
+public class FaultNotificationsTest {
+ private Timestamp createdAt;
+
+ @Test
+ public void faultNotififcationsTest() {
+ FaultNotifications faultNotifications = new FaultNotifications();
+ faultNotifications.setNotification("notification");
+ faultNotifications.setCreatedAt(createdAt);
+ assertEquals("notification", faultNotifications.getNotification());
+ assertEquals(createdAt, faultNotifications.getCreatedAt());
+ }
+
}
+
+
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/model/NotificationTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/model/NotificationTest.java
index 8ef4778..29590f9 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/model/NotificationTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/model/NotificationTest.java
@@ -32,16 +32,6 @@ import java.io.IOException;
import java.util.ArrayList;
import org.junit.Test;
-import org.onap.dcaegen2.services.sonhms.model.FapServiceList;
-import org.onap.dcaegen2.services.sonhms.model.LteNeighborListInUseLteCell;
-import org.onap.dcaegen2.services.sonhms.model.NeighborListInUse;
-import org.onap.dcaegen2.services.sonhms.model.Notification;
-import org.onap.dcaegen2.services.sonhms.model.NotificationCellConfig;
-import org.onap.dcaegen2.services.sonhms.model.NotificationLte;
-import org.onap.dcaegen2.services.sonhms.model.NotificationPayload;
-import org.onap.dcaegen2.services.sonhms.model.NotificationRan;
-import org.onap.dcaegen2.services.sonhms.model.RadioAccess;
-import org.onap.dcaegen2.services.sonhms.model.X0005b9Lte;
public class NotificationTest {
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/model/PayloadTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/model/PayloadTest.java
index a7f0a79..1aae8c2 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/model/PayloadTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/model/PayloadTest.java
@@ -26,15 +26,6 @@ import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import org.junit.Test;
-import org.onap.dcaegen2.services.sonhms.model.CellConfig;
-import org.onap.dcaegen2.services.sonhms.model.Common;
-import org.onap.dcaegen2.services.sonhms.model.Configurations;
-import org.onap.dcaegen2.services.sonhms.model.Data;
-import org.onap.dcaegen2.services.sonhms.model.FapService;
-import org.onap.dcaegen2.services.sonhms.model.Lte;
-import org.onap.dcaegen2.services.sonhms.model.Payload;
-import org.onap.dcaegen2.services.sonhms.model.Ran;
-import org.onap.dcaegen2.services.sonhms.model.X0005b9Lte;
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/model/PolicyNotificationTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/model/PolicyNotificationTest.java
index b99a9d7..12b0771 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/model/PolicyNotificationTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/model/PolicyNotificationTest.java
@@ -23,6 +23,8 @@ package org.onap.dcaegen2.services.sonhms.model;
import static org.junit.Assert.assertEquals;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -32,8 +34,6 @@ import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.onap.dcaegen2.services.sonhms.utils.ClusterUtilsTest;
public class PolicyNotificationTest {
@@ -94,6 +94,9 @@ public class PolicyNotificationTest {
}
Assert.assertEquals(policyNotification1.hashCode(), policyNotification2.hashCode());
+ Assert.assertEquals(policyNotification1, policyNotification2);
+ Assert.assertTrue(policyNotification1.equals(policyNotification2));
+ Assert.assertFalse(policyNotification1.equals(null));
Assert.assertNotEquals(policyNotification1.hashCode(), policyNotification3.hashCode());
}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/AsyncResponseBodyTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/AsyncResponseBodyTest.java
index 085abbb..fcc2c31 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/AsyncResponseBodyTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/AsyncResponseBodyTest.java
@@ -25,9 +25,6 @@ import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
-import org.onap.dcaegen2.services.sonhms.restclient.AsyncResponseBody;
-import org.onap.dcaegen2.services.sonhms.restclient.Solution;
-import org.onap.dcaegen2.services.sonhms.restclient.SonSolution;
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CellInfoTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CellInfoTest.java
index 24ba1ae..9f21f8d 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CellInfoTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CellInfoTest.java
@@ -25,8 +25,8 @@ import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
+
import org.junit.Test;
-import org.onap.dcaegen2.services.sonhms.restclient.CellInfo;
public class CellInfoTest {
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRequestBodyTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRequestBodyTest.java
index eb0d189..0e2b59c 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRequestBodyTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRequestBodyTest.java
@@ -25,10 +25,8 @@ import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
+
import org.junit.Test;
-import org.onap.dcaegen2.services.sonhms.restclient.CellInfo;
-import org.onap.dcaegen2.services.sonhms.restclient.OofRequestBody;
-import org.onap.dcaegen2.services.sonhms.restclient.RequestInfo;
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRestClientTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRestClientTest.java
index 4a9fed5..75af4fe 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRestClientTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRestClientTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -59,29 +60,20 @@ public class OofRestClientTest {
public void queryOofTest() {
configuration.setBufferTime(60);
configuration.setCallbackUrl("/callbackUrl");
- configuration.setConfigName("configName");
List<String> list = new ArrayList<String>();
list.add("server");
- configuration.setServers(list);
+ configuration.setDmaapServers(list);
configuration.setCg("cg");
configuration.setCid("cid");
- configuration.setManagerApiKey("managerApiKey");
- configuration.setManagerSecretKey("managerSecretKey");
configuration.setMaximumClusters(5);
configuration.setMinCollision(5);
configuration.setMinConfusion(5);
configuration.setNumSolutions(1);
configuration.setOofService("oofService");
configuration.setOptimizers(list);
- configuration.setPcimsApiKey("pcimsApiKey");
- configuration.setPcimsSecretKey("pcimsSecretKey");
- configuration.setPolicyName("policyName");
- configuration.setPolicyService("policyService");
- configuration.setPolicyTopic("policyTopic");
configuration.setPollingInterval(30);
configuration.setPollingTimeout(100);
- configuration.setSdnrService("sdnrService");
- configuration.setSdnrTopic("sdnrTopic");
+ configuration.setConfigDbService("sdnrService");
configuration.setSourceId("sourceId");
String responseBody="{\n" +
" \"transactionId\": \"xxx-xxx-xxxx\",\n" +
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PciSolutionsTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PciSolutionsTest.java
index 4f59435..79d27ad 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PciSolutionsTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PciSolutionsTest.java
@@ -24,7 +24,6 @@ package org.onap.dcaegen2.services.sonhms.restclient;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.onap.dcaegen2.services.sonhms.restclient.SonSolution;
public class PciSolutionsTest {
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRequestBodyTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRequestBodyTest.java
index 5de8951..4578fd1 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRequestBodyTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRequestBodyTest.java
@@ -24,7 +24,6 @@ package org.onap.dcaegen2.services.sonhms.restclient;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.onap.dcaegen2.services.sonhms.restclient.PolicyRequestBody;
public class PolicyRequestBodyTest {
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRestClientTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRestClientTest.java
deleted file mode 100644
index 387b958..0000000
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRestClientTest.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * son-handler
- * ================================================================================
- * Copyright (C) 2019 Wipro Limited.
- * ==============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- *******************************************************************************/
-
-package org.onap.dcaegen2.services.sonhms.restclient;
-
-import static org.junit.Assert.assertEquals;
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Matchers;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.onap.dcaegen2.services.sonhms.Configuration;
-import org.onap.dcaegen2.services.sonhms.restclient.PolicyRestClient;
-import org.onap.dcaegen2.services.sonhms.utils.SonHandlerRestTemplate;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.powermock.modules.junit4.PowerMockRunnerDelegate;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.core.ParameterizedTypeReference;
-import org.springframework.http.ResponseEntity;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(PowerMockRunner.class)
-@PowerMockRunnerDelegate(SpringRunner.class)
-@PrepareForTest({ SonHandlerRestTemplate.class, Configuration.class })
-@SpringBootTest(classes = PolicyRestClientTest.class)
-public class PolicyRestClientTest {
-
- Configuration configuration = Configuration.getInstance();
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void fetchConfigFromPolicyTest() {
-
- configuration.setBufferTime(60);
- configuration.setCallbackUrl("/callbackUrl");
- configuration.setConfigName("configName");
- List<String> list = new ArrayList<String>();
- list.add("server");
- configuration.setServers(list);
- configuration.setCg("cg");
- configuration.setCid("cid");
- configuration.setManagerApiKey("managerApiKey");
- configuration.setManagerSecretKey("managerSecretKey");
- configuration.setMaximumClusters(5);
- configuration.setMinCollision(5);
- configuration.setMinConfusion(5);
- configuration.setNumSolutions(1);
- configuration.setOofService("oofService");
- configuration.setOptimizers(list);
- configuration.setPcimsApiKey("pcimsApiKey");
- configuration.setPcimsSecretKey("pcimsSecretKey");
- configuration.setPolicyName("policyName");
- configuration.setPolicyService("policyService");
- configuration.setPolicyTopic("policyTopic");
- configuration.setPollingInterval(30);
- configuration.setPollingTimeout(100);
- configuration.setSdnrService("sdnrService");
- configuration.setSdnrTopic("sdnrTopic");
- configuration.setSourceId("sourceId");
- String responseBody="{\n" +
- "\"policyName\": \"com.Config_PCIMS_CONFIG_POLICY\",\n" +
- "\"policyVersion\": \"1\",\n" +
- "\"configBody\": \"{ \\\"PCI_NEIGHBOR_CHANGE_CLUSTER_TIMEOUT_IN_SECS\\\":60,\n" +
- "\\\"PCI_MODCONFIG_POLICY_NAME\\\":\\\"ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-\n" +
- "529269fb1459\\\", \\\"PCI_OPTMIZATION_ALGO_CATEGORY_IN_OOF\\\":\\\"OOF-PCI-\n" +
- "OPTIMIZATION\\\", \\\"PCI_SDNR_TARGET_NAME\\\":\\\"SDNR\\\" }\",\n" +
- "\"policyClass\": \"Config\",\n" +
- "\"policyConfigType\": \"Base\",\n" +
- "\"ttlDate\": \"2018-08-29T06:28:16.830Z\",\n" +
- "\"onapName\": \"DCAE\",\n" +
- "\"configName\": \"PCIMS_CONFIG_POLICY\",\n" +
- "\"configBodyType\": \"JSON\"\n" +
- "}\n" +
- "";
- PowerMockito.mockStatic(SonHandlerRestTemplate.class);
- PowerMockito.mockStatic(Configuration.class);
- PowerMockito.when(Configuration.getInstance()).thenReturn(configuration);
-
- PowerMockito.when(SonHandlerRestTemplate.sendPostToPolicy(Mockito.anyString(),Mockito.anyString() ,Matchers.<ParameterizedTypeReference<String>>any()))
- .thenReturn(ResponseEntity.ok(responseBody));
- String result=PolicyRestClient.fetchConfigFromPolicy();
- assertEquals(ResponseEntity.ok(responseBody).getBody(), result);
-
-
-
-
-
- }
-
-}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/RequestInfoTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/RequestInfoTest.java
index 4d360d8..cbb29a7 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/RequestInfoTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/RequestInfoTest.java
@@ -27,7 +27,6 @@ import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
-import org.onap.dcaegen2.services.sonhms.restclient.RequestInfo;
public class RequestInfoTest {
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClientTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClientTest.java
index c13b698..bffccfc 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClientTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClientTest.java
@@ -42,11 +42,11 @@ import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
+import org.slf4j.Logger;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
-import org.slf4j.Logger;
@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(SpringRunner.class)
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SolutionsTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SolutionsTest.java
index 9decce0..9286629 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SolutionsTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SolutionsTest.java
@@ -25,9 +25,8 @@ import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
+
import org.junit.Test;
-import org.onap.dcaegen2.services.sonhms.restclient.Solution;
-import org.onap.dcaegen2.services.sonhms.restclient.SonSolution;
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/utils/ClusterUtilsTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/utils/ClusterUtilsTest.java
index dd3059a..48813e1 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/utils/ClusterUtilsTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/utils/ClusterUtilsTest.java
@@ -21,6 +21,14 @@
package org.onap.dcaegen2.services.sonhms.utils;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import fj.data.Either;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -31,7 +39,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
-import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -56,11 +63,6 @@ import org.powermock.modules.junit4.PowerMockRunnerDelegate;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import fj.data.Either;
-
@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(SpringRunner.class)
@PrepareForTest({ SdnrRestClient.class, BeanUtil.class })