summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/wipro/www/sonhms/ApplicationTest.java24
-rw-r--r--src/test/java/com/wipro/www/sonhms/ChildStatusUpdateStateTest.java25
-rw-r--r--src/test/java/com/wipro/www/sonhms/ConfigPolicyTest.java43
-rw-r--r--src/test/java/com/wipro/www/sonhms/SdnrNotificationHandlingStateTest.java31
-rw-r--r--src/test/java/com/wipro/www/sonhms/SonContextTest.java59
-rw-r--r--src/test/java/com/wipro/www/sonhms/WaitStateTest.java24
-rw-r--r--src/test/java/com/wipro/www/sonhms/child/TestClusterModification.java188
-rw-r--r--src/test/java/com/wipro/www/sonhms/model/CellConfigTest.java44
-rw-r--r--src/test/java/com/wipro/www/sonhms/model/CellNeighbourListTest.java41
-rw-r--r--src/test/java/com/wipro/www/sonhms/model/NotificationPayloadTest.java32
-rw-r--r--src/test/java/com/wipro/www/sonhms/model/PayloadTest.java71
-rw-r--r--src/test/java/com/wipro/www/sonhms/model/ResponseTest.java38
-rw-r--r--src/test/java/com/wipro/www/sonhms/restclient/CellInfoTest.java45
-rw-r--r--src/test/java/com/wipro/www/sonhms/restclient/OofRestClientTest.java25
-rw-r--r--src/test/java/com/wipro/www/sonhms/restclient/PciSolutionsTest.java40
-rw-r--r--src/test/java/com/wipro/www/sonhms/restclient/PolicyRequestBodyTest.java43
-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.java (renamed from src/test/java/com/wipro/www/sonhms/BufferNotificationComponentTest.java)58
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/ClusterDetailsComponentTest.java (renamed from src/test/java/com/wipro/www/sonhms/ClusterDetailsComponentTest.java)56
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/ConfigPolicyTest.java43
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/ConfigurationTest.java (renamed from src/test/java/com/wipro/www/sonhms/ConfigurationTest.java)39
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/DmaapNotificationsComponentTest.java108
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/EventHandlerTest.java150
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/MainThreadTest.java26
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/TopicTest.java41
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/child/GraphTest.java (renamed from src/test/java/com/wipro/www/sonhms/child/GraphTest.java)45
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/child/TestChildThreadUtils.java111
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/child/TestDetection.java (renamed from src/test/java/com/wipro/www/sonhms/child/TestDetection.java)48
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/child/TestPnfUtils.java157
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/dmaap/DmaapClientTest.java112
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/dmaap/NotificationProducerTest.java71
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/entity/BufferedNotificationsTest.java44
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/entity/CellInfoTest.java38
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/entity/DmaapNotificationsTest.java43
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/entity/PciRequestsTest.java38
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/model/CellConfigTest.java45
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/model/CellNeighbourListTest.java42
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/model/NotificationPayloadTest.java33
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/model/NotificationTest.java (renamed from src/test/java/com/wipro/www/sonhms/model/NotificationTest.java)59
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/model/PayloadTest.java71
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/model/PolicyNotificationTest.java121
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/model/ResponseTest.java39
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/model/SdnrResponseTest.java44
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/model/ThreadIdTest.java38
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/AsyncResponseBodyTest.java (renamed from src/test/java/com/wipro/www/sonhms/restclient/AsyncResponseBodyTest.java)46
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CellInfoTest.java45
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRequestBodyTest.java (renamed from src/test/java/com/wipro/www/sonhms/restclient/OofRequestBodyTest.java)46
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRestClientTest.java131
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PciSolutionsTest.java40
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRequestBodyTest.java43
-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.java (renamed from src/test/java/com/wipro/www/sonhms/restclient/RequestInfoTest.java)42
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClientTest.java158
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SolutionsTest.java (renamed from src/test/java/com/wipro/www/sonhms/restclient/SolutionsTest.java)43
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/utils/ClusterUtilsTest.java270
-rw-r--r--src/test/resources/ClusterDetailsTest.json10
-rw-r--r--src/test/resources/clusterInfo1.json1
-rw-r--r--src/test/resources/clusterInfo2.json1
-rw-r--r--src/test/resources/clusterInfo3.json1
-rw-r--r--src/test/resources/clusterInfo4.json1
-rw-r--r--src/test/resources/clusterInfo5.json1
-rw-r--r--src/test/resources/clusterInfo6.json1
-rw-r--r--src/test/resources/clusterInfo7.json1
-rw-r--r--src/test/resources/notification1.json45
-rw-r--r--src/test/resources/notification2.json55
-rw-r--r--src/test/resources/notification3.json45
-rw-r--r--src/test/resources/policy_notification.json20
-rw-r--r--src/test/resources/solutions.json1
68 files changed, 2660 insertions, 1022 deletions
diff --git a/src/test/java/com/wipro/www/sonhms/ApplicationTest.java b/src/test/java/com/wipro/www/sonhms/ApplicationTest.java
deleted file mode 100644
index 892e0c2..0000000
--- a/src/test/java/com/wipro/www/sonhms/ApplicationTest.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms;
-
-public class ApplicationTest {
-
-}
diff --git a/src/test/java/com/wipro/www/sonhms/ChildStatusUpdateStateTest.java b/src/test/java/com/wipro/www/sonhms/ChildStatusUpdateStateTest.java
deleted file mode 100644
index ea426bf..0000000
--- a/src/test/java/com/wipro/www/sonhms/ChildStatusUpdateStateTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms;
-
-public class ChildStatusUpdateStateTest {
-
-}
diff --git a/src/test/java/com/wipro/www/sonhms/ConfigPolicyTest.java b/src/test/java/com/wipro/www/sonhms/ConfigPolicyTest.java
deleted file mode 100644
index 85b1c44..0000000
--- a/src/test/java/com/wipro/www/sonhms/ConfigPolicyTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms;
-
-import static org.junit.Assert.assertEquals;
-
-import com.wipro.www.sonhms.ConfigPolicy;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Test;
-
-
-public class ConfigPolicyTest {
-
- @Test
- public void configPolicyTest() {
- ConfigPolicy configPolicy = ConfigPolicy.getInstance();
- Map<String, Object> config = new HashMap<String, Object>();
- config.put("policyName", "pcims_policy");
- configPolicy.setConfig(config);
- assertEquals(config, configPolicy.getConfig());
- }
-}
diff --git a/src/test/java/com/wipro/www/sonhms/SdnrNotificationHandlingStateTest.java b/src/test/java/com/wipro/www/sonhms/SdnrNotificationHandlingStateTest.java
deleted file mode 100644
index d6e2dfc..0000000
--- a/src/test/java/com/wipro/www/sonhms/SdnrNotificationHandlingStateTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms;
-
-import org.junit.Test;
-
-public class SdnrNotificationHandlingStateTest {
-
- @Test
- public void sdnrNotificationHandlingState() {
-
- }
-}
diff --git a/src/test/java/com/wipro/www/sonhms/SonContextTest.java b/src/test/java/com/wipro/www/sonhms/SonContextTest.java
deleted file mode 100644
index e7e6790..0000000
--- a/src/test/java/com/wipro/www/sonhms/SonContextTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import com.wipro.www.sonhms.SdnrNotificationHandlingState;
-import com.wipro.www.sonhms.SonContext;
-
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-
-import org.junit.Test;
-
-
-
-public class SonContextTest {
-
- private BlockingQueue<List<String>> childStatusUpdate;
-
- @Test
- public void sonContextTest() {
- SonContext sonContext = new SonContext();
- sonContext.setChildThreadId(1);
- sonContext.setNotifToBeProcessed(true);
- sonContext.setSdnrNotification("notification");
- sonContext.setChildStatusUpdate(childStatusUpdate);
- NewNotification newNotification = new NewNotification(true);
- sonContext.setNewNotification(newNotification);
- SdnrNotificationHandlingState pciState = new SdnrNotificationHandlingState();
- sonContext.setPciState(pciState);
- assertEquals(1, sonContext.getChildThreadId());
- assertTrue(sonContext.isNotifToBeProcessed());
- assertEquals("notification", sonContext.getSdnrNotification());
- assertEquals(pciState, sonContext.getPciState());
- assertEquals(childStatusUpdate, sonContext.getChildStatusUpdate());
- assertEquals(newNotification, sonContext.getNewNotification());
-
- }
-}
diff --git a/src/test/java/com/wipro/www/sonhms/WaitStateTest.java b/src/test/java/com/wipro/www/sonhms/WaitStateTest.java
deleted file mode 100644
index 10ae3d7..0000000
--- a/src/test/java/com/wipro/www/sonhms/WaitStateTest.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms;
-
-public class WaitStateTest {
-
-}
diff --git a/src/test/java/com/wipro/www/sonhms/child/TestClusterModification.java b/src/test/java/com/wipro/www/sonhms/child/TestClusterModification.java
deleted file mode 100644
index 148663e..0000000
--- a/src/test/java/com/wipro/www/sonhms/child/TestClusterModification.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.child;
-
-import static org.junit.Assert.assertNotEquals;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.wipro.www.sonhms.child.ClusterModification;
-import com.wipro.www.sonhms.child.Graph;
-import com.wipro.www.sonhms.model.CellPciPair;
-import com.wipro.www.sonhms.model.FapServiceList;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.ConcurrentModificationException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Test;
-
-public class TestClusterModification {
- @Test
- public void testClusterModification() {
-
- CellPciPair cpPair = new CellPciPair();
- cpPair.setCellId("32");
- cpPair.setPhysicalCellId(26);
-
- CellPciPair cpPair1 = new CellPciPair();
- cpPair1.setCellId("25");
- cpPair1.setPhysicalCellId(23);
-
- CellPciPair cpPair2 = new CellPciPair();
- cpPair2.setCellId("42");
- cpPair2.setPhysicalCellId(12);
-
- CellPciPair cpPair3 = new CellPciPair();
- cpPair3.setCellId("56");
- cpPair3.setPhysicalCellId(200);
-
- CellPciPair cpPair4 = new CellPciPair();
- cpPair4.setCellId("21");
- cpPair4.setPhysicalCellId(6);
-
- CellPciPair cpPair5 = new CellPciPair();
- cpPair5.setCellId("24");
- cpPair5.setPhysicalCellId(5);
-
- CellPciPair cpPair6 = new CellPciPair();
- cpPair6.setCellId("38");
- cpPair6.setPhysicalCellId(126);
-
- CellPciPair cpPair7 = new CellPciPair();
- cpPair7.setCellId("67");
- cpPair7.setPhysicalCellId(300);
-
- CellPciPair cpPair8 = new CellPciPair();
- cpPair8.setCellId("69");
- cpPair8.setPhysicalCellId(129);
-
- CellPciPair cpPair9 = new CellPciPair();
- cpPair9.setCellId("78");
- cpPair9.setPhysicalCellId(147);
-
- ArrayList<CellPciPair> al = new ArrayList<CellPciPair>();
- al.add(cpPair1);
- al.add(cpPair2);
- al.add(cpPair3);
-
- ArrayList<CellPciPair> al1 = new ArrayList<CellPciPair>();
- al1.add(cpPair4);
- al1.add(cpPair5);
- al1.add(cpPair6);
-
- ArrayList<CellPciPair> al2 = new ArrayList<CellPciPair>();
- al2.add(cpPair7);
- al2.add(cpPair8);
- al2.add(cpPair9);
-
- Map<CellPciPair, ArrayList<CellPciPair>> map = new HashMap<CellPciPair, ArrayList<CellPciPair>>();
-
- map.put(cpPair, al);
- map.put(cpPair1, al1);
- map.put(cpPair2, al2);
- map.put(cpPair3, new ArrayList<CellPciPair>());
- map.put(cpPair4, new ArrayList<CellPciPair>());
- map.put(cpPair5, new ArrayList<CellPciPair>());
- map.put(cpPair6, new ArrayList<CellPciPair>());
- map.put(cpPair7, new ArrayList<CellPciPair>());
- map.put(cpPair8, new ArrayList<CellPciPair>());
- map.put(cpPair9, new ArrayList<CellPciPair>());
- Graph cluster = new Graph();
-
- cluster.setCellPciNeighbourMap(map);
-
- System.out.println("map before" + cluster.getCellPciNeighbourMap());
-
- String notif = "{ \n" + "\"alias\":\"Cell1\",\n" + "\"X0005b9Lte\":{ \n" + "\"phyCellIdInUse\":\"89\",\n"
- + "\"pnfName\":\"DU-1\"\n" + "},\n" + "\"CellConfig\":{ \n" + "\"LTE\":{ \n" + "\"RAN\":{ \n"
- + "\"CellIdentity\":\"6\",\n" + "\"NeighborListInUse\":{ \n" + "\"LTECellNumberOfEntries\":\"2\",\n"
- + "\"LTENeighborListInUseLTECell\":[ \n" + "{ \n" + "\"pnfName\":\"DU-2\",\n"
- + "\"enable\":\"true\",\n" + "\"alias\":\"Cell10\",\n" + "\"mustInclude\":\"true\",\n"
- + "\"plmnid\":\"123456\",\n" + "\"cid\":\"2\",\n" + "\"phyCellId\":\"22\",\n"
- + "\"blacklisted\":\"false\"\n" + "},\n" + "{ \n" + "\"pnfName\":\"DU-3\",\n"
- + "\"enable\":\"true\",\n" + "\"alias\":\"Cell15\",\n" + "\"mustInclude\":\"true\",\n"
- + "\"plmnid\":\"123456\",\n" + "\"cid\":\"25\",\n" + "\"phyCellId\":\"35\",\n"
- + "\"blacklisted\":\"false\"\n" + "}\n" + "]\n" + "}\n" + "}\n" + "}\n" + "}\n" + "}";
-
- ObjectMapper mapper = new ObjectMapper();
- FapServiceList fapser = new FapServiceList();
- try {
- fapser = mapper.readValue(notif, FapServiceList.class);
- } catch (JsonParseException e) {
- e.printStackTrace();
- } catch (JsonMappingException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- CellPciPair cpPair11 = new CellPciPair();
- cpPair11.setCellId("2");
- cpPair11.setPhysicalCellId(22);
-
- CellPciPair cpPair12 = new CellPciPair();
-
- cpPair12.setCellId("5");
- cpPair12.setPhysicalCellId(24);
-
- ArrayList<CellPciPair> al4 = new ArrayList<CellPciPair>();
-
- al4.add(cpPair11);
- al4.add(cpPair12);
-
- Map<CellPciPair, ArrayList<CellPciPair>> newMap = new HashMap<CellPciPair, ArrayList<CellPciPair>>();
- newMap.put(cpPair, al);
- newMap.put(cpPair1, al4);
- newMap.put(cpPair2, al2);
- newMap.put(cpPair3, new ArrayList<CellPciPair>());
- newMap.put(cpPair4, new ArrayList<CellPciPair>());
- newMap.put(cpPair5, new ArrayList<CellPciPair>());
- newMap.put(cpPair6, new ArrayList<CellPciPair>());
- newMap.put(cpPair7, new ArrayList<CellPciPair>());
- newMap.put(cpPair8, new ArrayList<CellPciPair>());
- newMap.put(cpPair9, new ArrayList<CellPciPair>());
- newMap.put(cpPair11, new ArrayList<CellPciPair>());
- newMap.put(cpPair12, new ArrayList<CellPciPair>());
-
- Graph newCluster = new Graph();
- newCluster.setCellPciNeighbourMap(newMap);
- System.out.print("newCluster" + newCluster.getCellPciNeighbourMap());
-
- ClusterModification mod = new ClusterModification();
- try {
- // System.out.print("Cluster" + mod.clustermod(cluster,
- // fapser).getCellPciNeighbourMap().toString());
-
- assertNotEquals(newCluster, mod.clustermod(cluster, fapser));
-
- } catch (NullPointerException e) {
- e.printStackTrace();
- } catch (ConcurrentModificationException e) {
- System.out.println("Concureent execption" + e);
-
- }
- }
-
-}
diff --git a/src/test/java/com/wipro/www/sonhms/model/CellConfigTest.java b/src/test/java/com/wipro/www/sonhms/model/CellConfigTest.java
deleted file mode 100644
index 68f8b40..0000000
--- a/src/test/java/com/wipro/www/sonhms/model/CellConfigTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.model;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class CellConfigTest {
-
- @Test
- public void cellConfigTest() {
-
- Common common = new Common();
- common.setCellIdentity("cellIdentity");
- Ran ran = new Ran();
- ran.setCommon(common);
- Lte lte = new Lte();
- lte.setRan(ran);
- CellConfig cellConfig = new CellConfig();
- cellConfig.setLte(lte);
- assertEquals(lte, cellConfig.getLte());
- assertEquals(ran, lte.getRan());
- assertEquals(common, ran.getCommon());
- }
-}
diff --git a/src/test/java/com/wipro/www/sonhms/model/CellNeighbourListTest.java b/src/test/java/com/wipro/www/sonhms/model/CellNeighbourListTest.java
deleted file mode 100644
index 8acc0e8..0000000
--- a/src/test/java/com/wipro/www/sonhms/model/CellNeighbourListTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.model;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class CellNeighbourListTest {
-
- @Test
- public void cellNeighbourListTest() {
- CellNeighbourList cellNeighbourList = new CellNeighbourList();
- cellNeighbourList.setCellId("cellId");
- cellNeighbourList.setNeighbours("neighbour");
- cellNeighbourList.setPhysicalCellId(1);
- assertEquals("cellId",cellNeighbourList.getCellId() );
- assertEquals("neighbour",cellNeighbourList.getNeighbours() );
- assertEquals(1,cellNeighbourList.getPhysicalCellId() );
-
- }
-
-}
diff --git a/src/test/java/com/wipro/www/sonhms/model/NotificationPayloadTest.java b/src/test/java/com/wipro/www/sonhms/model/NotificationPayloadTest.java
deleted file mode 100644
index d1134fa..0000000
--- a/src/test/java/com/wipro/www/sonhms/model/NotificationPayloadTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.model;
-
-import org.junit.Test;
-
-public class NotificationPayloadTest {
-
- @Test
- public void notificationPayloadTest() {
-
- }
-
-}
diff --git a/src/test/java/com/wipro/www/sonhms/model/PayloadTest.java b/src/test/java/com/wipro/www/sonhms/model/PayloadTest.java
deleted file mode 100644
index 1c006f9..0000000
--- a/src/test/java/com/wipro/www/sonhms/model/PayloadTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.model;
-
-import static org.junit.Assert.assertEquals;
-
-import com.wipro.www.sonhms.model.CellConfig;
-import com.wipro.www.sonhms.model.Common;
-import com.wipro.www.sonhms.model.Configurations;
-import com.wipro.www.sonhms.model.Data;
-import com.wipro.www.sonhms.model.FapService;
-import com.wipro.www.sonhms.model.Lte;
-import com.wipro.www.sonhms.model.Payload;
-import com.wipro.www.sonhms.model.Ran;
-import com.wipro.www.sonhms.model.X0005b9Lte;
-
-import java.util.ArrayList;
-
-import org.junit.Test;
-
-
-
-public class PayloadTest {
-
- @Test
- public void payloadTest() {
- Common common = new Common("cell1");
-
- Ran ran = new Ran(common);
-
- Lte lte = new Lte(ran);
-
- CellConfig cellConfig = new CellConfig(lte);
-
- X0005b9Lte x0005b9Lte = new X0005b9Lte(0, "pnf2");
-
- FapService fapService = new FapService("cell6", x0005b9Lte, cellConfig);
-
- Data data = new Data(fapService);
-
- Configurations config = new Configurations(data);
- ArrayList<Configurations> al = new ArrayList<>();
- al.add(config);
-
- Payload payload = new Payload(al);
-
- assertEquals("pnf2", payload.getConfiguration().get(0).getData().getFapservice().getX0005b9Lte().getPnfName());
-
- assertEquals("cell6", payload.getConfiguration().get(0).getData().getFapservice().getAlias());
-
- }
-
-}
diff --git a/src/test/java/com/wipro/www/sonhms/model/ResponseTest.java b/src/test/java/com/wipro/www/sonhms/model/ResponseTest.java
deleted file mode 100644
index c413791..0000000
--- a/src/test/java/com/wipro/www/sonhms/model/ResponseTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.model;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class ResponseTest {
-
- @Test
- public void respomseTest() {
- Response response = new Response();
- response.setCellId("cellId");
- response.setPci(1);
- assertEquals("cellId", response.getCellId());
- assertEquals(1, response.getPci());
- }
-
-}
diff --git a/src/test/java/com/wipro/www/sonhms/restclient/CellInfoTest.java b/src/test/java/com/wipro/www/sonhms/restclient/CellInfoTest.java
deleted file mode 100644
index b686f93..0000000
--- a/src/test/java/com/wipro/www/sonhms/restclient/CellInfoTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.restclient;
-
-import static org.junit.Assert.assertEquals;
-
-import com.wipro.www.sonhms.restclient.CellInfo;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Test;
-
-
-public class CellInfoTest {
- @Test
- public void cellInfoTest() {
- List<String> cellIdLists = new ArrayList<>();
- cellIdLists.add("cell1");
-
- CellInfo cellInfo = new CellInfo();
- cellInfo.setNetworkId("NTWK001");
- cellInfo.setCellIdList(cellIdLists);
- assertEquals("NTWK001", cellInfo.getNetworkId());
- assertEquals(cellIdLists, cellInfo.getCellIdList());
-
- }
-}
diff --git a/src/test/java/com/wipro/www/sonhms/restclient/OofRestClientTest.java b/src/test/java/com/wipro/www/sonhms/restclient/OofRestClientTest.java
deleted file mode 100644
index 2f06f0a..0000000
--- a/src/test/java/com/wipro/www/sonhms/restclient/OofRestClientTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.restclient;
-
-public class OofRestClientTest {
-
-}
diff --git a/src/test/java/com/wipro/www/sonhms/restclient/PciSolutionsTest.java b/src/test/java/com/wipro/www/sonhms/restclient/PciSolutionsTest.java
deleted file mode 100644
index e7aac21..0000000
--- a/src/test/java/com/wipro/www/sonhms/restclient/PciSolutionsTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.restclient;
-
-import static org.junit.Assert.assertEquals;
-
-import com.wipro.www.sonhms.restclient.SonSolution;
-
-import org.junit.Test;
-
-
-public class PciSolutionsTest {
- @Test
- public void pciSolutionsTest() {
- SonSolution pciSolutions = new SonSolution();
- pciSolutions.setCellId("EXP001");
- pciSolutions.setPci(101);
- assertEquals("EXP001", pciSolutions.getCellId());
- assertEquals(101, pciSolutions.getPci());
- }
-
-}
diff --git a/src/test/java/com/wipro/www/sonhms/restclient/PolicyRequestBodyTest.java b/src/test/java/com/wipro/www/sonhms/restclient/PolicyRequestBodyTest.java
deleted file mode 100644
index 0726c31..0000000
--- a/src/test/java/com/wipro/www/sonhms/restclient/PolicyRequestBodyTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
- * ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.restclient;
-
-import static org.junit.Assert.assertEquals;
-
-import com.wipro.www.sonhms.restclient.PolicyRequestBody;
-
-import org.junit.Test;
-
-
-public class PolicyRequestBodyTest {
- @Test
- public void policyRequestBodyTest() {
- PolicyRequestBody policyRequestBody = new PolicyRequestBody();
- policyRequestBody.setConfigName("PCIMS_CONFIG_POLICY");
- policyRequestBody.setPolicyName("com.PCIMS_CONFIG_POLICY");
- policyRequestBody.setRequestId("60fe7fe6-2649-4f6c-8468-30eb03fd0527");
- assertEquals("PCIMS_CONFIG_POLICY", policyRequestBody.getConfigName());
- assertEquals("com.PCIMS_CONFIG_POLICY", policyRequestBody.getPolicyName());
- assertEquals("60fe7fe6-2649-4f6c-8468-30eb03fd0527", policyRequestBody.getRequestId());
-
- }
-
-}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/ApplicationTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/ApplicationTest.java
new file mode 100644
index 0000000..1b3453a
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/ApplicationTest.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * ============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/com/wipro/www/sonhms/BufferNotificationComponentTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/BufferNotificationComponentTest.java
index 08779e4..19fe536 100644
--- a/src/test/java/com/wipro/www/sonhms/BufferNotificationComponentTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/BufferNotificationComponentTest.java
@@ -1,61 +1,52 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * Copyright (C) 2018 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=========================================================
- ******************************************************************************/
+ * 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 com.wipro.www.sonhms;
+package org.onap.dcaegen2.services.sonhms;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import com.wipro.www.sonhms.dao.BufferedNotificationsRepository;
-import com.wipro.www.sonhms.entity.BufferedNotifications;
-import com.wipro.www.sonhms.utils.BeanUtil;
-
import java.util.ArrayList;
import java.util.List;
-import java.util.Optional;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.onap.dcaegen2.services.sonhms.dao.BufferedNotificationsRepository;
+import org.onap.dcaegen2.services.sonhms.entity.BufferedNotifications;
+import org.onap.dcaegen2.services.sonhms.utils.BeanUtil;
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.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.mock.mockito.MockBean;
-import org.springframework.data.web.ProjectedPayload;
import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.web.client.RestTemplate;
@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(SpringRunner.class)
@PrepareForTest({ BeanUtil.class })
@SpringBootTest(classes = BufferNotificationComponent.class)
-public class BufferNotificationComponentTest {
+public class BufferNotificationComponentTest {
@Mock
private BufferedNotificationsRepository bufferedNotificationsRepositoryMock;
@@ -68,7 +59,7 @@ public class BufferNotificationComponentTest {
MockitoAnnotations.initMocks(this);
}
- @Test
+ @Test
public void bufferNotificationTest() {
BufferedNotifications bufferedNotifications = new BufferedNotifications();
bufferedNotifications.setClusterId("clusterId");
@@ -77,7 +68,6 @@ public class BufferNotificationComponentTest {
PowerMockito.when(BeanUtil.getBean(BufferedNotificationsRepository.class))
.thenReturn(bufferedNotificationsRepositoryMock);
when(bufferedNotificationsRepositoryMock.save(bufferedNotifications)).thenReturn(bufferedNotifications);
- BufferedNotifications bufferedNotificationsResult = new BufferedNotifications();
bufferNotificationComponent.bufferNotification("notification", "clusterId");
assertEquals(bufferedNotifications, bufferedNotificationsRepositoryMock.save(bufferedNotifications));
diff --git a/src/test/java/com/wipro/www/sonhms/ClusterDetailsComponentTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/ClusterDetailsComponentTest.java
index 4be6339..22d0ccf 100644
--- a/src/test/java/com/wipro/www/sonhms/ClusterDetailsComponentTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/ClusterDetailsComponentTest.java
@@ -1,56 +1,46 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms;
+ * 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;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
-import com.wipro.www.sonhms.dao.ClusterDetailsRepository;
-import com.wipro.www.sonhms.entity.ClusterDetails;
-import com.wipro.www.sonhms.utils.BeanUtil;
-
import java.util.ArrayList;
import java.util.List;
-import java.util.Optional;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.onap.dcaegen2.services.sonhms.dao.ClusterDetailsRepository;
+import org.onap.dcaegen2.services.sonhms.entity.ClusterDetails;
+import org.onap.dcaegen2.services.sonhms.utils.BeanUtil;
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.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.mock.mockito.MockBean;
-import org.springframework.data.web.ProjectedPayload;
import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.web.client.RestTemplate;
@RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(SpringRunner.class)
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/ConfigPolicyTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/ConfigPolicyTest.java
new file mode 100644
index 0000000..ca12095
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/ConfigPolicyTest.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * ============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;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.onap.dcaegen2.services.sonhms.ConfigPolicy;
+
+
+public class ConfigPolicyTest {
+
+ @Test
+ public void configPolicyTest() {
+ ConfigPolicy configPolicy = ConfigPolicy.getInstance();
+ Map<String, Object> config = new HashMap<String, Object>();
+ config.put("policyName", "pcims_policy");
+ configPolicy.setConfig(config);
+ assertEquals(config, configPolicy.getConfig());
+ }
+}
diff --git a/src/test/java/com/wipro/www/sonhms/ConfigurationTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/ConfigurationTest.java
index 06294dd..02a4f07 100644
--- a/src/test/java/com/wipro/www/sonhms/ConfigurationTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/ConfigurationTest.java
@@ -1,32 +1,33 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * Copyright (C) 2018 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=========================================================
- ******************************************************************************/
+ * 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 com.wipro.www.sonhms;
+package org.onap.dcaegen2.services.sonhms;
import static org.junit.Assert.assertEquals;
-import com.wipro.www.sonhms.Configuration;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
+import org.onap.dcaegen2.services.sonhms.Configuration;
public class ConfigurationTest {
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/DmaapNotificationsComponentTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/DmaapNotificationsComponentTest.java
new file mode 100644
index 0000000..cc4d3ad
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/DmaapNotificationsComponentTest.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * ============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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.when;
+
+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;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.onap.dcaegen2.services.sonhms.dao.DmaapNotificationsRepository;
+import org.onap.dcaegen2.services.sonhms.model.Notification;
+import org.onap.dcaegen2.services.sonhms.utils.BeanUtil;
+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.test.context.junit4.SpringRunner;
+
+@RunWith(PowerMockRunner.class)
+@PowerMockRunnerDelegate(SpringRunner.class)
+@PrepareForTest({ BeanUtil.class })
+@SpringBootTest(classes = DmaapNotificationsComponentTest.class)
+
+public class DmaapNotificationsComponentTest {
+
+ @Mock
+ DmaapNotificationsRepository dmaapNotificationsRepositoryMock;
+
+ @InjectMocks
+ DmaapNotificationsComponent component;
+
+ static String notificationString;
+
+ @BeforeClass
+ public static void setupTest() {
+
+ notificationString = readFromFile("/notification1.json");
+ }
+
+ @Test
+ public void getDmaapNotificationsTestforLeft() {
+ PowerMockito.mockStatic(BeanUtil.class);
+ PowerMockito.when(BeanUtil.getBean(DmaapNotificationsRepository.class))
+ .thenReturn(dmaapNotificationsRepositoryMock);
+ when(dmaapNotificationsRepositoryMock.getNotificationFromQueue()).thenReturn(notificationString);
+
+
+ Either<Notification, Integer> result = component.getDmaapNotifications();
+ //assertTrue(result.isLeft());
+ assertNotNull(result.left().value());
+
+ when(dmaapNotificationsRepositoryMock.getNotificationFromQueue()).thenReturn("notification");
+
+ result = component.getDmaapNotifications();
+ int resultRight = result.right().value();
+ assertEquals(400, resultRight);
+
+ }
+
+ private static String readFromFile(String file) {
+ String content = new String();
+ try {
+
+ InputStream is = DmaapNotificationsComponentTest.class.getResourceAsStream(file);
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
+ content = bufferedReader.readLine();
+ String temp;
+ while ((temp = bufferedReader.readLine()) != null) {
+ content = content.concat(temp);
+ }
+ content = content.trim();
+ bufferedReader.close();
+ } catch (Exception e) {
+ content = null;
+ }
+ return content;
+ }
+
+}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/EventHandlerTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/EventHandlerTest.java
new file mode 100644
index 0000000..a79e368
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/EventHandlerTest.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * pcims
+ * ================================================================================
+ * Copyright (C) 2018 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;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+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;
+import org.junit.runner.RunWith;
+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;
+import org.onap.dcaegen2.services.sonhms.model.FapServiceList;
+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;
+
+@RunWith(MockitoJUnitRunner.class)
+@SpringBootTest(classes = EventHandler.class)
+public class EventHandlerTest {
+
+ @Mock
+ ClusterUtils clusterutilsMock;
+
+ @Mock
+ ExecutorService pool;
+
+ @Mock
+ ThreadUtils threadUtilsMock;
+
+ private static Notification notification;
+ private static List<ClusterDetails> clusterDetails = new ArrayList<>();
+
+ @InjectMocks
+ EventHandler eventHandler;
+
+ @Before
+ public void setup() {
+
+ notification = new Notification();
+ String notificationString = readFromFile("/notification3.json");
+ String clusterInfo1 = readFromFile("/clusterInfo1.json");
+ String clusterInfo2 = readFromFile("/clusterInfo2.json");
+ String clusterInfo3 = readFromFile("/clusterInfo3.json");
+ String clusterInfo4 = readFromFile("/clusterInfo4.json");
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ notification = mapper.readValue(notificationString, Notification.class);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ System.out.println(notification.toString());
+
+ clusterDetails.add(new ClusterDetails("1", clusterInfo1, 35));
+ clusterDetails.add(new ClusterDetails("2", clusterInfo2, 36));
+ clusterDetails.add(new ClusterDetails("3", clusterInfo3, 37));
+ clusterDetails.add(new ClusterDetails("4", clusterInfo4, 38));
+
+ }
+
+ @Test
+ public void handleSdnrNotificationTest() {
+
+ String clusterInfo7 = readFromFile("/clusterInfo7.json");
+ Graph cluster = new Graph(clusterInfo7);
+ NotificationToClusterMapping mapping = new NotificationToClusterMapping();
+ Map<FapServiceList, String> cellsinCluster = new HashMap<>();
+ List<FapServiceList> newCells = new ArrayList<>();
+ newCells.add(notification.getPayload().getRadioAccess().getFapServiceList().get(0));
+ mapping.setCellsinCluster(cellsinCluster);
+ mapping.setNewCells(newCells);
+ Either<Graph, Integer> existingCluster = Either.right(404);
+
+
+ Mockito.when(clusterutilsMock.getAllClusters()).thenReturn(clusterDetails);
+ Mockito.when(clusterutilsMock.getClustersForNotification(notification, clusterDetails)).thenReturn(mapping);
+ Mockito.when(clusterutilsMock.getClusterForCell(Mockito.any(), Mockito.any())).thenReturn(existingCluster);
+ Mockito.when(threadUtilsMock.createNewThread(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(true);
+
+ try {
+ Mockito.when(clusterutilsMock.createCluster(Mockito.any())).thenReturn(cluster);
+ } catch (ConfigDbNotFoundException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+
+
+ Assert.assertEquals(true, eventHandler.handleSdnrNotification(notification));
+
+
+
+ }
+
+ private static String readFromFile(String file) {
+ String content = new String();
+ try {
+
+ InputStream is = ClusterUtilsTest.class.getResourceAsStream(file);
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
+ content = bufferedReader.readLine();
+ String temp;
+ while((temp = bufferedReader.readLine()) != null) {
+ content = content.concat(temp);
+ }
+ content = content.trim();
+ bufferedReader.close();
+ }
+ catch(Exception e) {
+ content = null;
+ }
+ return content;
+ }
+}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/MainThreadTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/MainThreadTest.java
new file mode 100644
index 0000000..d06abbf
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/MainThreadTest.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * ============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 MainThreadTest {
+
+}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/TopicTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/TopicTest.java
new file mode 100644
index 0000000..6ac6e75
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/TopicTest.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * ============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;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class TopicTest {
+
+ @Test
+ public void topicTest() {
+ Topic topic=new Topic();
+ topic.setConsumer("consumer");
+ topic.setName("name");
+ topic.setProducer("producer");
+ assertEquals("consumer", topic.getConsumer());
+ assertEquals("name", topic.getName());
+ assertEquals("producer", topic.getProducer());
+
+ }
+}
diff --git a/src/test/java/com/wipro/www/sonhms/child/GraphTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/child/GraphTest.java
index 2132f22..3df7f93 100644
--- a/src/test/java/com/wipro/www/sonhms/child/GraphTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/child/GraphTest.java
@@ -1,35 +1,35 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.child;
+ * 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.child;
import static org.junit.Assert.assertNotEquals;
-import com.wipro.www.sonhms.child.Graph;
-import com.wipro.www.sonhms.model.CellPciPair;
-
import java.util.ArrayList;
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;
@@ -56,6 +56,7 @@ public class GraphTest {
log.debug("graph {}", graph.getCellPciNeighbourMap());
System.out.println("graph" + graph.getCellPciNeighbourMap());
+ System.out.println("graphJSON" + graph.getPciNeighbourJson());
assertNotEquals(map, graph.getCellPciNeighbourMap());
}
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
new file mode 100644
index 0000000..03e735f
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestChildThreadUtils.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * ============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.child;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+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;
+import org.onap.dcaegen2.services.sonhms.utils.ClusterUtilsTest;
+
+public class TestChildThreadUtils {
+
+ ChildThreadUtils childThreadUtils;
+
+ @Before
+ public void setup() {
+
+ ConfigPolicy configPolicy = ConfigPolicy.getInstance();
+
+ Map<String, Object> configPolicyMap = new HashMap<>();
+ configPolicyMap.put("PCI_MODCONFIG_POLICY_NAME", "ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459");
+ configPolicy.setConfig(configPolicyMap);
+ childThreadUtils = new ChildThreadUtils(configPolicy);
+ }
+
+ @Test
+ public void getNotificationStringTest() {
+
+ String policy_notif = readFromFile("/policy_notification.json");
+ PolicyNotification expected = new PolicyNotification();
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ expected = mapper.readValue(policy_notif, PolicyNotification.class);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String pnfName = "ncserver23";
+ List<CellPciPair> cellPciPairs = new ArrayList<>();
+
+ cellPciPairs.add(new CellPciPair("Chn0330", 6));
+ cellPciPairs.add(new CellPciPair("Chn0331", 7));
+ String requestId = "a4130fd5-2291-4a83-8992-04e4c9f32731";
+ Long alarmStart = Long.parseLong("1542445563201");
+
+ String result = childThreadUtils.getNotificationString(pnfName, cellPciPairs, requestId, alarmStart);
+ PolicyNotification actual = new PolicyNotification();
+ try {
+ actual = mapper.readValue(result, PolicyNotification.class);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ Assert.assertEquals(expected.hashCode(), actual.hashCode());
+ }
+
+ private static String readFromFile(String file) {
+ String content = new String();
+ try {
+
+ InputStream is = ClusterUtilsTest.class.getResourceAsStream(file);
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
+ content = bufferedReader.readLine();
+ String temp;
+ while((temp = bufferedReader.readLine()) != null) {
+ content = content.concat(temp);
+ }
+ content = content.trim();
+ bufferedReader.close();
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ content = null;
+ }
+ return content;
+ }
+}
diff --git a/src/test/java/com/wipro/www/sonhms/child/TestDetection.java b/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestDetection.java
index 03ed787..6e42cce 100644
--- a/src/test/java/com/wipro/www/sonhms/child/TestDetection.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestDetection.java
@@ -1,35 +1,35 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.child;
-
-
-import com.wipro.www.sonhms.child.Detection;
-import com.wipro.www.sonhms.child.Graph;
-import com.wipro.www.sonhms.model.CellPciPair;
+ * 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.child;
+
import java.util.ArrayList;
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;
public class TestDetection {
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
new file mode 100644
index 0000000..e7f822f
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/child/TestPnfUtils.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * ============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.child;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+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;
+import org.onap.dcaegen2.services.sonhms.model.CellPciPair;
+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;
+
+@RunWith(PowerMockRunner.class)
+@PowerMockRunnerDelegate(SpringRunner.class)
+@PrepareForTest({BeanUtil.class, SdnrRestClient.class })
+@SpringBootTest(classes = PnfUtils.class)
+public class TestPnfUtils {
+
+ @Mock
+ private CellInfoRepository cellInfoRepositoryMock;
+
+ private static final Logger log = org.slf4j.LoggerFactory.getLogger(TestPnfUtils.class);
+ private static List<Solution> solutions = new ArrayList<>();
+ private static Optional<CellInfo> cellInfo;
+ private static Optional<CellInfo> cellInfoNull;
+
+
+ @InjectMocks
+ PnfUtils pnfUtils;
+
+ @BeforeClass
+ public static void setup() {
+
+
+ String solutionsString=readFromFile("/solutions.json");
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ solutions=mapper.readValue(solutionsString,new TypeReference<List<Solution>>(){});
+ } catch (IOException e) {
+ log.debug("Exception in StateOof Test "+e);
+ e.printStackTrace();
+ }
+
+ }
+ @Before
+ public void setupTest() {
+ cellInfo = Optional.of(new CellInfo("EXP001","ncserver1"));
+ cellInfoNull = Optional.ofNullable(null);
+ pnfUtils = new PnfUtils();
+ MockitoAnnotations.initMocks(this);
+ }
+ @Test
+ public void getPnfsTest() {
+ Map<String, List<CellPciPair>> pnfs = new HashMap<>();
+ List<CellPciPair> cellpciPairList1=new ArrayList<>();
+ cellpciPairList1.add(new CellPciPair("EXP001",101));
+ List<CellPciPair> cellpciPairList2=new ArrayList<>();
+ cellpciPairList2.add(new CellPciPair("EXP002",102));
+ String pnfName="ncserver2";
+ String cellId="EXP002";
+ PowerMockito.mockStatic(BeanUtil.class);
+ PowerMockito.mockStatic(SdnrRestClient.class);
+
+ PowerMockito.when(BeanUtil.getBean(CellInfoRepository.class))
+ .thenReturn(cellInfoRepositoryMock);
+
+ Mockito.when(cellInfoRepositoryMock.findById("EXP001"))
+ .thenReturn(cellInfo);
+ Mockito.when(cellInfoRepositoryMock.findById(cellId))
+ .thenReturn(cellInfoNull);
+ try {
+ PowerMockito.when(SdnrRestClient.getPnfName(cellId))
+ .thenReturn(pnfName);
+ PowerMockito.when(cellInfoRepositoryMock.save(new CellInfo(cellId, pnfName))).thenReturn(new CellInfo());
+ } catch (ConfigDbNotFoundException e) {
+ e.printStackTrace();
+ }
+ pnfs.put(pnfName, cellpciPairList2);
+ pnfs.put("ncserver1", cellpciPairList1);
+ System.out.println(solutions);
+ try {
+ assertEquals(pnfs,pnfUtils.getPnfs(solutions));
+ } catch (ConfigDbNotFoundException e) {
+ log.debug("exception in stateOof test {}", e);
+ e.printStackTrace();
+ }
+ }
+ private static String readFromFile(String file) {
+ String content = new String();
+ try {
+
+ InputStream is = ClusterUtilsTest.class.getResourceAsStream(file);
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
+ content = bufferedReader.readLine();
+ String temp;
+ while((temp = bufferedReader.readLine()) != null) {
+ content = content.concat(temp);
+ }
+ content = content.trim();
+ bufferedReader.close();
+ }
+ catch(Exception e) {
+ content = null;
+ }
+ return content;
+ }
+} \ No newline at end of file
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
new file mode 100644
index 0000000..63ba5bd
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/dmaap/DmaapClientTest.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * ============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.dmaap;
+
+import com.att.nsa.cambria.client.CambriaTopicManager;
+
+import static org.mockito.Mockito.when;
+
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+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.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = DmaapClientTest.class)
+public class DmaapClientTest {
+
+ @Mock
+ private CambriaTopicManager topicManager;
+
+
+ @InjectMocks
+ DmaapClient client;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ private Boolean newNotif;
+
+ @Test
+ public void getAllTopicsTest() {
+ Set<String> topics = new HashSet<String>();
+ topics.add("topic1");
+ topics.add("topic2");
+ 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.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");
+ NewNotification newNotification = new NewNotification(newNotif);
+
+ try {
+ when(topicManager.getTopics()).thenReturn(topics);
+ client=Mockito.mock(DmaapClient.class);
+ client.initClient(newNotification);
+ Mockito.verify(client).initClient(newNotification);
+ // Mockito.verifycreateAndConfigureTopics();
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
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
new file mode 100644
index 0000000..c76b953
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/dmaap/NotificationProducerTest.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * ============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.dmaap;
+
+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;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@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();
+ }
+
+
+ }
+}
+
+
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/entity/BufferedNotificationsTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/entity/BufferedNotificationsTest.java
new file mode 100644
index 0000000..12a3d4d
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/entity/BufferedNotificationsTest.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * ============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.entity;
+
+import static org.junit.Assert.assertEquals;
+
+import java.sql.Timestamp;
+
+import org.junit.Test;
+
+public class BufferedNotificationsTest {
+
+ private Timestamp createdAt;
+
+ @Test
+ public void bufferedNotificationsTest() {
+ BufferedNotifications bufferedNotifications=new BufferedNotifications();
+ bufferedNotifications.setClusterId("clusterId");
+ bufferedNotifications.setNotification("notification");
+ bufferedNotifications.setCreatedAt(createdAt);
+ assertEquals("clusterId", bufferedNotifications.getClusterId());
+ assertEquals("notification", bufferedNotifications.getNotification());
+ assertEquals(createdAt, bufferedNotifications.getCreatedAt());
+ }
+}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/entity/CellInfoTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/entity/CellInfoTest.java
new file mode 100644
index 0000000..6732cb6
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/entity/CellInfoTest.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * ============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.entity;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class CellInfoTest {
+
+ @Test
+ public void cellInfoTest() {
+ CellInfo cellInfo=new CellInfo();
+ cellInfo.setCellId("cellId");
+ cellInfo.setPnfName("pnfName");
+ assertEquals("cellId", cellInfo.getCellId());
+ assertEquals("pnfName", cellInfo.getPnfName());
+ }
+
+}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/entity/DmaapNotificationsTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/entity/DmaapNotificationsTest.java
new file mode 100644
index 0000000..05ea72e
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/entity/DmaapNotificationsTest.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * ============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.entity;
+
+import static org.junit.Assert.assertEquals;
+
+import java.sql.Timestamp;
+
+import org.junit.Test;
+
+public class DmaapNotificationsTest {
+
+ private Timestamp createdAt;
+
+ @Test
+ public void dmaapNotififcationsTest() {
+ DmaapNotifications dmaapNotifications = new DmaapNotifications();
+ dmaapNotifications.setNotification("notification");
+ dmaapNotifications.setCreatedAt(createdAt);
+ assertEquals("notification", dmaapNotifications.getNotification());
+ assertEquals(createdAt, dmaapNotifications.getCreatedAt());
+ }
+
+}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/entity/PciRequestsTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/entity/PciRequestsTest.java
new file mode 100644
index 0000000..bf22fd6
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/entity/PciRequestsTest.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * ============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.entity;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class PciRequestsTest {
+
+ @Test
+ public void pciRequestsTest() {
+ PciRequests pciRequests=new PciRequests();
+ pciRequests.setChildThreadId(1L);
+ pciRequests.setTransactionId("transactionId");
+ assertEquals(1L, pciRequests.getChildThreadId());
+ assertEquals("transactionId", pciRequests.getTransactionId());
+ }
+}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/model/CellConfigTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/model/CellConfigTest.java
new file mode 100644
index 0000000..94f58b1
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/model/CellConfigTest.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * ============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.model;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class CellConfigTest {
+
+ @Test
+ public void cellConfigTest() {
+
+ Common common = new Common();
+ common.setCellIdentity("cellIdentity");
+ Ran ran = new Ran();
+ ran.setCommon(common);
+ Lte lte = new Lte();
+ lte.setRan(ran);
+ CellConfig cellConfig = new CellConfig();
+ cellConfig.setLte(lte);
+ assertEquals(lte, cellConfig.getLte());
+ assertEquals(ran, lte.getRan());
+ assertEquals(common, ran.getCommon());
+ }
+}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/model/CellNeighbourListTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/model/CellNeighbourListTest.java
new file mode 100644
index 0000000..d9684dd
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/model/CellNeighbourListTest.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * ============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.model;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class CellNeighbourListTest {
+
+ @Test
+ public void cellNeighbourListTest() {
+ CellNeighbourList cellNeighbourList = new CellNeighbourList();
+ cellNeighbourList.setCellId("cellId");
+ cellNeighbourList.setNeighbours("neighbour");
+ cellNeighbourList.setPhysicalCellId(1);
+ assertEquals("cellId",cellNeighbourList.getCellId() );
+ assertEquals("neighbour",cellNeighbourList.getNeighbours() );
+ assertEquals(1,cellNeighbourList.getPhysicalCellId() );
+
+ }
+
+}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/model/NotificationPayloadTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/model/NotificationPayloadTest.java
new file mode 100644
index 0000000..4505bff
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/model/NotificationPayloadTest.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * ============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.model;
+
+import org.junit.Test;
+
+public class NotificationPayloadTest {
+
+ @Test
+ public void notificationPayloadTest() {
+
+ }
+
+}
diff --git a/src/test/java/com/wipro/www/sonhms/model/NotificationTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/model/NotificationTest.java
index 09c6c0a..8ef4778 100644
--- a/src/test/java/com/wipro/www/sonhms/model/NotificationTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/model/NotificationTest.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.model;
+ * 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.model;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
@@ -26,21 +27,21 @@ import static org.junit.Assert.assertNotEquals;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.wipro.www.sonhms.model.FapServiceList;
-import com.wipro.www.sonhms.model.LteNeighborListInUseLteCell;
-import com.wipro.www.sonhms.model.NeighborListInUse;
-import com.wipro.www.sonhms.model.Notification;
-import com.wipro.www.sonhms.model.NotificationCellConfig;
-import com.wipro.www.sonhms.model.NotificationLte;
-import com.wipro.www.sonhms.model.NotificationPayload;
-import com.wipro.www.sonhms.model.NotificationRan;
-import com.wipro.www.sonhms.model.RadioAccess;
-import com.wipro.www.sonhms.model.X0005b9Lte;
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
new file mode 100644
index 0000000..a7f0a79
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/model/PayloadTest.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * ============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.model;
+
+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;
+
+
+
+public class PayloadTest {
+
+ @Test
+ public void payloadTest() {
+ Common common = new Common("cell1");
+
+ Ran ran = new Ran(common);
+
+ Lte lte = new Lte(ran);
+
+ CellConfig cellConfig = new CellConfig(lte);
+
+ X0005b9Lte x0005b9Lte = new X0005b9Lte(0, "pnf2");
+
+ FapService fapService = new FapService("cell6", x0005b9Lte, cellConfig);
+
+ Data data = new Data(fapService);
+
+ Configurations config = new Configurations(data);
+ ArrayList<Configurations> al = new ArrayList<>();
+ al.add(config);
+
+ Payload payload = new Payload(al);
+
+ assertEquals("pnf2", payload.getConfiguration().get(0).getData().getFapservice().getX0005b9Lte().getPnfName());
+
+ assertEquals("cell6", payload.getConfiguration().get(0).getData().getFapservice().getAlias());
+
+ }
+
+}
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
new file mode 100644
index 0000000..b99a9d7
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/model/PolicyNotificationTest.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * ============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.model;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+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 {
+ @Test
+ public void policyNotificationTest() {
+ PolicyNotification policyNotification=new PolicyNotification();
+ Map<String, String> aai=new HashMap<>();
+ aai.put("test","test");
+ String target="test";
+ String targetType="targetType";
+ String payload="payload";
+ String closedLoopControlName="closedLoopControlName";
+ String action="action";
+ String version="version";
+ String from="from";
+ String requestId="requestId";
+ String closedLoopEventStatus="closedLoopEventStatus";
+ String closedLoopEventClient="closedLoopEventClient";
+ long closedLoopAlarmStart=96587958;
+ policyNotification.setAai(aai);
+ assertEquals(aai,policyNotification.getAai());
+ policyNotification.setTarget(target);
+ assertEquals(target,policyNotification.getTarget());
+ policyNotification.setTargetType(targetType);
+ assertEquals(targetType,policyNotification.getTargetType());
+ policyNotification.setPayload(payload);
+ assertEquals(payload,policyNotification.getPayload());
+ policyNotification.setClosedLoopControlName(closedLoopControlName);
+ assertEquals(closedLoopControlName,policyNotification.getClosedLoopControlName());
+ policyNotification.setAction(action);
+ assertEquals(action,policyNotification.getAction());
+ policyNotification.setVersion(version);
+ assertEquals(version,policyNotification.getVersion());
+ policyNotification.setFrom(from);
+ assertEquals(from,policyNotification.getFrom());
+ policyNotification.setRequestId(requestId);
+ assertEquals(requestId,policyNotification.getRequestId());
+ policyNotification.setClosedLoopEventStatus(closedLoopEventStatus);
+ assertEquals(closedLoopEventStatus,policyNotification.getClosedLoopEventStatus());
+ policyNotification.setClosedLoopEventClient(closedLoopEventClient);
+ assertEquals(closedLoopEventClient,policyNotification.getClosedLoopEventClient());
+ policyNotification.setClosedLoopAlarmStart(closedLoopAlarmStart);
+ assertEquals(closedLoopAlarmStart,policyNotification.getClosedLoopAlarmStart());
+
+ String notif1 = readFromFile("/policy_notification.json");
+ String notif2 = readFromFile("/policy_notification.json");
+ PolicyNotification policyNotification1 = new PolicyNotification();
+ PolicyNotification policyNotification2 = new PolicyNotification();
+ PolicyNotification policyNotification3 = new PolicyNotification();
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ policyNotification1 = mapper.readValue(notif1, PolicyNotification.class);
+ policyNotification2 = mapper.readValue(notif2, PolicyNotification.class);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ Assert.assertEquals(policyNotification1.hashCode(), policyNotification2.hashCode());
+ Assert.assertNotEquals(policyNotification1.hashCode(), policyNotification3.hashCode());
+
+ }
+
+ private static String readFromFile(String file) {
+ String content = new String();
+ try {
+
+ InputStream is = ClusterUtilsTest.class.getResourceAsStream(file);
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
+ content = bufferedReader.readLine();
+ String temp;
+ while((temp = bufferedReader.readLine()) != null) {
+ content = content.concat(temp);
+ }
+ content = content.trim();
+ bufferedReader.close();
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ content = null;
+ }
+ return content;
+ }
+}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/model/ResponseTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/model/ResponseTest.java
new file mode 100644
index 0000000..0fcdb1b
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/model/ResponseTest.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * ============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.model;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class ResponseTest {
+
+ @Test
+ public void respomseTest() {
+ Response response = new Response();
+ response.setCellId("cellId");
+ response.setPci(1);
+ assertEquals("cellId", response.getCellId());
+ assertEquals(1, response.getPci());
+ }
+
+}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/model/SdnrResponseTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/model/SdnrResponseTest.java
new file mode 100644
index 0000000..a65f51b
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/model/SdnrResponseTest.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * ============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.model;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+public class SdnrResponseTest {
+
+ @Test
+ public void sdnrResponseTest() {
+ SdnrResponse sdnrResponse=new SdnrResponse();
+ Response response=new Response();
+ response.setCellId("cellId");
+ response.setPci(2);
+ List<Response> responseList=new ArrayList<>();
+ responseList.add(response);
+ sdnrResponse.setResponse(responseList);
+ assertEquals(responseList,sdnrResponse.getResponse());
+ }
+
+}
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/model/ThreadIdTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/model/ThreadIdTest.java
new file mode 100644
index 0000000..ad23c3a
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/model/ThreadIdTest.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * ============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.model;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class ThreadIdTest {
+
+ @Test
+ public void threadIdtest() {
+ ThreadId threadId=new ThreadId();
+ long Id=987957948;
+ threadId.setChildThreadId(Id);
+ assertEquals(Id,threadId.getChildThreadId());
+ }
+
+}
diff --git a/src/test/java/com/wipro/www/sonhms/restclient/AsyncResponseBodyTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/AsyncResponseBodyTest.java
index 95afd77..085abbb 100644
--- a/src/test/java/com/wipro/www/sonhms/restclient/AsyncResponseBodyTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/AsyncResponseBodyTest.java
@@ -1,33 +1,33 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.restclient;
-
-import com.wipro.www.sonhms.restclient.AsyncResponseBody;
-import com.wipro.www.sonhms.restclient.Solution;
-import com.wipro.www.sonhms.restclient.SonSolution;
+ * 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 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
new file mode 100644
index 0000000..24ba1ae
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CellInfoTest.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * ============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.Test;
+import org.onap.dcaegen2.services.sonhms.restclient.CellInfo;
+
+
+public class CellInfoTest {
+ @Test
+ public void cellInfoTest() {
+ List<String> cellIdLists = new ArrayList<>();
+ cellIdLists.add("cell1");
+
+ CellInfo cellInfo = new CellInfo();
+ cellInfo.setNetworkId("NTWK001");
+ cellInfo.setCellIdList(cellIdLists);
+ assertEquals("NTWK001", cellInfo.getNetworkId());
+ assertEquals(cellIdLists, cellInfo.getCellIdList());
+
+ }
+}
diff --git a/src/test/java/com/wipro/www/sonhms/restclient/OofRequestBodyTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRequestBodyTest.java
index 493095b..eb0d189 100644
--- a/src/test/java/com/wipro/www/sonhms/restclient/OofRequestBodyTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRequestBodyTest.java
@@ -1,34 +1,34 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.restclient;
+ * 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 com.wipro.www.sonhms.restclient.CellInfo;
-import com.wipro.www.sonhms.restclient.OofRequestBody;
-import com.wipro.www.sonhms.restclient.RequestInfo;
-
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
new file mode 100644
index 0000000..4a9fed5
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/OofRestClientTest.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * ============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.exceptions.OofNotFoundException;
+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 = OofRestClientTest.class)
+public class OofRestClientTest {
+ Configuration configuration = Configuration.getInstance();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ 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.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" +
+ " \"transactionId\": \"xxx-xxx-xxxx\",\n" +
+ " \"requestId\": \"yyy-yyy-yyyy\",\n" +
+ " \"requestStatus\": \"accepted\",\n" +
+ " \"statusMessage\": \"\"\n" +
+ "}";
+ List<String> cellIdList=new ArrayList<String>();
+ cellIdList.add("EXP001");
+ List<String> optimizers=new ArrayList<String>();
+ optimizers.add("pci");
+
+ PowerMockito.mockStatic(SonHandlerRestTemplate.class);
+ PowerMockito.mockStatic(Configuration.class);
+ PowerMockito.when(Configuration.getInstance()).thenReturn(configuration);
+ PowerMockito.when(SonHandlerRestTemplate.sendPostRequestToOof(Mockito.anyString(),Mockito.anyString() ,Matchers.<ParameterizedTypeReference<String>>any()))
+ .thenReturn(ResponseEntity.ok(responseBody));
+
+
+ try {
+ String result=OofRestClient.queryOof(1, "xxx-xxx-xxxx", "create", cellIdList, "NTWK005", optimizers);
+ assertEquals(ResponseEntity.ok(responseBody).getBody(), result);
+
+
+ } catch (OofNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ PowerMockito.when(SonHandlerRestTemplate.sendPostRequestToOof(Mockito.anyString(),Mockito.anyString() ,Matchers.<ParameterizedTypeReference<String>>any()))
+ .thenReturn(null);
+ try {
+ String result=OofRestClient.queryOof(1, "xxx-xxx-xxxx", "create", cellIdList, "NTWK005", optimizers);
+ assertEquals(ResponseEntity.ok(responseBody).getBody(), result);
+
+
+ } catch (OofNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ }
+
+}
+
+
+
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
new file mode 100644
index 0000000..4f59435
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PciSolutionsTest.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * ============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 org.junit.Test;
+import org.onap.dcaegen2.services.sonhms.restclient.SonSolution;
+
+
+public class PciSolutionsTest {
+ @Test
+ public void pciSolutionsTest() {
+ SonSolution pciSolutions = new SonSolution();
+ pciSolutions.setCellId("EXP001");
+ pciSolutions.setPci(101);
+ assertEquals("EXP001", pciSolutions.getCellId());
+ assertEquals(101, pciSolutions.getPci());
+ }
+
+}
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
new file mode 100644
index 0000000..5de8951
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRequestBodyTest.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * ============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 org.junit.Test;
+import org.onap.dcaegen2.services.sonhms.restclient.PolicyRequestBody;
+
+
+public class PolicyRequestBodyTest {
+ @Test
+ public void policyRequestBodyTest() {
+ PolicyRequestBody policyRequestBody = new PolicyRequestBody();
+ policyRequestBody.setConfigName("PCIMS_CONFIG_POLICY");
+ policyRequestBody.setPolicyName("com.PCIMS_CONFIG_POLICY");
+ policyRequestBody.setRequestId("60fe7fe6-2649-4f6c-8468-30eb03fd0527");
+ assertEquals("PCIMS_CONFIG_POLICY", policyRequestBody.getConfigName());
+ assertEquals("com.PCIMS_CONFIG_POLICY", policyRequestBody.getPolicyName());
+ assertEquals("60fe7fe6-2649-4f6c-8468-30eb03fd0527", policyRequestBody.getRequestId());
+
+ }
+
+}
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
new file mode 100644
index 0000000..387b958
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRestClientTest.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * ============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/com/wipro/www/sonhms/restclient/RequestInfoTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/RequestInfoTest.java
index f21971b..4d360d8 100644
--- a/src/test/java/com/wipro/www/sonhms/restclient/RequestInfoTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/RequestInfoTest.java
@@ -1,33 +1,33 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.restclient;
+ * 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 com.wipro.www.sonhms.restclient.RequestInfo;
-
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
new file mode 100644
index 0000000..c13b698
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClientTest.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * ============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.json.JSONArray;
+import org.json.JSONObject;
+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.exceptions.ConfigDbNotFoundException;
+import org.onap.dcaegen2.services.sonhms.model.CellPciPair;
+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;
+import org.slf4j.Logger;
+
+@RunWith(PowerMockRunner.class)
+@PowerMockRunnerDelegate(SpringRunner.class)
+@PrepareForTest({ SonHandlerRestTemplate.class,Configuration.class })
+@SpringBootTest(classes = SdnrRestClientTest.class)
+public class SdnrRestClientTest {
+
+ Configuration configuration = Configuration.getInstance();
+ private static final Logger log = org.slf4j.LoggerFactory.getLogger(SdnrRestClient.class);
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void getCellListTest() {
+
+ String responseBody="[\n" +
+ " \"string\"\n" +
+ "]";
+ PowerMockito.mockStatic(SonHandlerRestTemplate.class);
+ PowerMockito.mockStatic(Configuration.class);
+ PowerMockito.when(Configuration.getInstance()).thenReturn(configuration);
+ PowerMockito.when(SonHandlerRestTemplate.sendGetRequest(Mockito.anyString(),Matchers.<ParameterizedTypeReference<String>>any()))
+ .thenReturn(ResponseEntity.ok(responseBody));
+ try {
+ String result=SdnrRestClient.getCellList("12345");
+ assertEquals(ResponseEntity.ok(responseBody).getBody(),result);
+ } catch (ConfigDbNotFoundException e) {
+ log.debug("ConfigDbNotFoundException {}",e.toString());;
+ }
+
+ }
+
+ @Test
+ public void getNbrListTest() {
+
+ String responseBody="[\n" +
+ " {\n" +
+ " \"cellId\": \"string\",\n" +
+ " \"pciValue\": 0\n" +
+ " }\n" +
+ "]";
+ PowerMockito.mockStatic(SonHandlerRestTemplate.class);
+ PowerMockito.mockStatic(Configuration.class);
+ PowerMockito.when(Configuration.getInstance()).thenReturn(configuration);
+ PowerMockito.when(SonHandlerRestTemplate.sendGetRequest(Mockito.anyString(),Matchers.<ParameterizedTypeReference<String>>any()))
+ .thenReturn(ResponseEntity.ok(responseBody));
+ try {
+ List<CellPciPair> result=SdnrRestClient.getNbrList("1");
+ List<CellPciPair> nbrList = new ArrayList<>();
+ String response=ResponseEntity.ok(responseBody).getBody();
+ JSONArray nbrListObj = new JSONArray(response);
+ for (int i = 0; i < nbrListObj.length(); i++) {
+ JSONObject cellObj = nbrListObj.getJSONObject(i);
+ CellPciPair cell = new CellPciPair(cellObj.getString("cellId"), cellObj.getInt("pciValue"));
+ nbrList.add(cell);
+ }
+ assertEquals(nbrList,result);
+ } catch (ConfigDbNotFoundException e) {
+ log.debug("ConfigDbNotFoundException {}",e.toString());;
+ }
+
+ }
+ @Test
+ public void getPciTest() {
+
+ String responseBody="{\n" +
+ " \"attribute-name\": \"string\",\n" +
+ " \"value\": 0\n" +
+ "}";
+ PowerMockito.mockStatic(SonHandlerRestTemplate.class);
+ PowerMockito.mockStatic(Configuration.class);
+ PowerMockito.when(Configuration.getInstance()).thenReturn(configuration);
+ PowerMockito.when(SonHandlerRestTemplate.sendGetRequest(Mockito.anyString(),Matchers.<ParameterizedTypeReference<String>>any()))
+ .thenReturn(ResponseEntity.ok(responseBody));
+ try {
+ int result=SdnrRestClient.getPci("1");
+ String response=ResponseEntity.ok(responseBody).getBody();
+ JSONObject respObj = new JSONObject(response);
+ assertEquals(respObj.getInt("value"),result);
+ } catch (ConfigDbNotFoundException e) {
+ log.debug("ConfigDbNotFoundException {}",e.toString());;
+ }
+
+ }
+ @Test
+ public void getPnfNameTest() {
+
+ String responseBody="{\n" +
+ " \"attribute-name\": \"string\",\n" +
+ " \"value\": \"string\"\n" +
+ "}";
+ PowerMockito.mockStatic(SonHandlerRestTemplate.class);
+ PowerMockito.mockStatic(Configuration.class);
+ PowerMockito.when(Configuration.getInstance()).thenReturn(configuration);
+ PowerMockito.when(SonHandlerRestTemplate.sendGetRequest(Mockito.anyString(),Matchers.<ParameterizedTypeReference<String>>any()))
+ .thenReturn(ResponseEntity.ok(responseBody));
+ try {
+ String result=SdnrRestClient.getPnfName("1");
+ String response=ResponseEntity.ok(responseBody).getBody();
+ JSONObject respObj = new JSONObject(response);
+ assertEquals(respObj.getString("value"),result);
+ } catch (ConfigDbNotFoundException e) {
+ log.debug("ConfigDbNotFoundException {}",e.toString());;
+ }
+
+ }
+}
diff --git a/src/test/java/com/wipro/www/sonhms/restclient/SolutionsTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SolutionsTest.java
index 64985f6..9decce0 100644
--- a/src/test/java/com/wipro/www/sonhms/restclient/SolutionsTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/SolutionsTest.java
@@ -1,32 +1,33 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * Copyright (C) 2018 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 com.wipro.www.sonhms.restclient;
+ * 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 com.wipro.www.sonhms.restclient.Solution;
-import com.wipro.www.sonhms.restclient.SonSolution;
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
new file mode 100644
index 0000000..dd3059a
--- /dev/null
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/utils/ClusterUtilsTest.java
@@ -0,0 +1,270 @@
+/*******************************************************************************
+ * ============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.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+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;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.dcaegen2.services.sonhms.NotificationToClusterMapping;
+import org.onap.dcaegen2.services.sonhms.child.Graph;
+import org.onap.dcaegen2.services.sonhms.dao.ClusterDetailsRepository;
+import org.onap.dcaegen2.services.sonhms.entity.ClusterDetails;
+import org.onap.dcaegen2.services.sonhms.exceptions.ConfigDbNotFoundException;
+import org.onap.dcaegen2.services.sonhms.model.CellPciPair;
+import org.onap.dcaegen2.services.sonhms.model.FapServiceList;
+import org.onap.dcaegen2.services.sonhms.model.Notification;
+import org.onap.dcaegen2.services.sonhms.restclient.SdnrRestClient;
+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.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 })
+@SpringBootTest(classes = ClusterUtils.class)
+public class ClusterUtilsTest {
+
+ @Mock
+ private ClusterDetailsRepository clusterDetailsRepositoryMock;
+
+ @InjectMocks
+ ClusterUtils clusterUtils;
+
+ private static Notification notification1;
+ private static Notification notification2;
+ private static List<ClusterDetails> clusterDetailsForGetClusterDetailsFromClusterIdTest;
+ private static Graph cluster;
+ private static List<ClusterDetails> clusterDetails = new ArrayList<>();
+
+ @BeforeClass
+ public static void setup() {
+
+ notification1 = new Notification();
+ notification2 = new Notification();
+ clusterDetailsForGetClusterDetailsFromClusterIdTest = new ArrayList<ClusterDetails>();
+
+ String notificationString1 = readFromFile("/notification1.json");
+ String notificationString2 = readFromFile("/notification2.json");
+ String clusterDetailsListString=readFromFile("/ClusterDetailsTest.json");
+
+ String clusterInfo1 = readFromFile("/clusterInfo1.json");
+ String clusterInfo2 = readFromFile("/clusterInfo2.json");
+ String clusterInfo3 = readFromFile("/clusterInfo3.json");
+ String clusterInfo4 = readFromFile("/clusterInfo4.json");
+ String clusterInfo = readFromFile("/clusterInfo5.json");
+ cluster=new Graph(clusterInfo);
+
+ clusterDetails.add(new ClusterDetails("1", clusterInfo1, 35));
+ clusterDetails.add(new ClusterDetails("2", clusterInfo2, 36));
+ clusterDetails.add(new ClusterDetails("3", clusterInfo3, 37));
+ clusterDetails.add(new ClusterDetails("4", clusterInfo4, 38));
+
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ notification1 = mapper.readValue(notificationString1, Notification.class);
+ notification2 = mapper.readValue(notificationString2, Notification.class);
+ clusterDetailsForGetClusterDetailsFromClusterIdTest=mapper.readValue(clusterDetailsListString,new TypeReference<List<ClusterDetails>>(){});
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+
+ }
+
+ @Before
+ public void setupTest() {
+ clusterUtils = new ClusterUtils();
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void getClustersForNotificationTest(){
+
+ NotificationToClusterMapping expected = new NotificationToClusterMapping();
+ Map<FapServiceList, String> cellsinCluster = new HashMap<>();
+ cellsinCluster.put(notification1.getPayload().getRadioAccess().getFapServiceList().get(0), "2");
+ expected.setCellsinCluster(cellsinCluster);
+ expected.setNewCells(new ArrayList<FapServiceList>());
+
+ NotificationToClusterMapping result = clusterUtils.getClustersForNotification(notification1, clusterDetails);
+ assertEquals(expected, result);
+
+ expected = new NotificationToClusterMapping();
+ List<FapServiceList> newCells = new ArrayList<>();
+ newCells.add(notification2.getPayload().getRadioAccess().getFapServiceList().get(0));
+ expected.setCellsinCluster(new HashMap<>());
+ expected.setNewCells(newCells);
+
+ result = clusterUtils.getClustersForNotification(notification2, clusterDetails);
+ assertEquals(expected, result);
+ }
+
+ @Test
+ public void createClusterTest() throws ConfigDbNotFoundException {
+
+ FapServiceList fapServiceList = notification1.getPayload().getRadioAccess().getFapServiceList().get(0);
+
+ List<CellPciPair> nbrList = new ArrayList<>();
+
+ nbrList.add(new CellPciPair("44", 3));
+
+ PowerMockito.mockStatic(SdnrRestClient.class);
+
+ PowerMockito.when(SdnrRestClient.getNbrList(Mockito.anyString())).thenReturn(nbrList);
+
+ assertEquals(cluster, clusterUtils.createCluster(fapServiceList));
+
+
+
+ }
+
+ @Test
+ public void getClusterDetailsFromClusterIdTest() {
+ ClusterDetails responseValue=null;
+ Integer responseVal = null;
+ Integer expectedValue=404;
+ Either<ClusterDetails, Integer> response=clusterUtils.getClusterDetailsFromClusterId("0",clusterDetailsForGetClusterDetailsFromClusterIdTest);
+ assertTrue(response.isLeft());
+ if(response.isLeft()) {
+ responseValue=response.left().value();
+ }
+ assertEquals(clusterDetailsForGetClusterDetailsFromClusterIdTest.get(0),responseValue);
+ response=clusterUtils.getClusterDetailsFromClusterId("1",clusterDetailsForGetClusterDetailsFromClusterIdTest);
+ assertTrue(response.isLeft());
+ if(response.isLeft()) {
+ responseValue=response.left().value();
+ }
+ assertEquals(clusterDetailsForGetClusterDetailsFromClusterIdTest.get(1),responseValue);
+ response=clusterUtils.getClusterDetailsFromClusterId("9",clusterDetailsForGetClusterDetailsFromClusterIdTest);
+ assertTrue(response.isRight());
+ if(response.isRight()) {
+ responseVal=response.right().value();
+ }
+ assertEquals(expectedValue,responseVal);
+
+ }
+
+ @Test
+ public void saveClusterTest() {
+ ClusterDetails details = new ClusterDetails();
+ details.setClusterId("123e4567-e89b-12d3-a456-426655440000");
+ details.setClusterInfo("cellPciNeighbourString");
+ details.setChildThreadId(978668);
+ PowerMockito.mockStatic(BeanUtil.class);
+ PowerMockito.when(BeanUtil.getBean(ClusterDetailsRepository.class))
+ .thenReturn(clusterDetailsRepositoryMock);
+ Mockito.when(clusterDetailsRepositoryMock.save(details)).thenReturn(details);
+ Long threadId=(long) 978668;
+ clusterUtils.saveCluster(cluster, UUID.fromString("123e4567-e89b-12d3-a456-426655440000"),threadId);
+ assertEquals(details, clusterDetailsRepositoryMock.save(details));
+
+ }
+
+ @Test
+ public void getClusterForCellTest() {
+ FapServiceList fapServiceList= notification1.getPayload().getRadioAccess().getFapServiceList().get(0);
+ String clusterInfo1=readFromFile("/clusterInfo1.json");
+ String clusterInfo2=readFromFile("/clusterInfo2.json");
+ Graph graph1=new Graph(clusterInfo1);
+ Graph graph2=new Graph(clusterInfo2);
+ List<Graph> newClusters=new ArrayList<Graph>();
+ newClusters.add(graph1);
+ newClusters.add(graph2);
+ Either<Graph, Integer> result=clusterUtils.getClusterForCell(fapServiceList, newClusters);
+ assertTrue(result.isLeft());
+
+ newClusters = new ArrayList<>();
+ newClusters.add(graph1);
+ result=clusterUtils.getClusterForCell(fapServiceList, newClusters);
+ assertTrue(result.isRight());
+ int resultRight=result.right().value();
+ assertEquals(404, resultRight);
+
+ List<Graph> emptyList=new ArrayList<Graph>();
+
+ result=clusterUtils.getClusterForCell(fapServiceList, emptyList);
+ assertTrue(result.isRight());
+ resultRight=result.right().value();
+ assertEquals(404, resultRight);
+
+ }
+
+ @Test
+ public void modifyClusterTest() {
+
+ String clusterInfo = readFromFile("/clusterInfo2.json");
+ String clusterInfo2 = readFromFile("/clusterInfo6.json");
+
+ Graph cluster = new Graph(clusterInfo);
+ Graph expected = new Graph(clusterInfo2);
+
+ assertEquals(expected, clusterUtils.modifyCluster(cluster, notification1.getPayload().getRadioAccess().getFapServiceList().get(0)));
+ }
+
+ private static String readFromFile(String file) {
+ String content = new String();
+ try {
+
+ InputStream is = ClusterUtilsTest.class.getResourceAsStream(file);
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
+ content = bufferedReader.readLine();
+ String temp;
+ while((temp = bufferedReader.readLine()) != null) {
+ content = content.concat(temp);
+ }
+ content = content.trim();
+ bufferedReader.close();
+ }
+ catch(Exception e) {
+ content = null;
+ }
+ return content;
+ }
+}
diff --git a/src/test/resources/ClusterDetailsTest.json b/src/test/resources/ClusterDetailsTest.json
new file mode 100644
index 0000000..01839ae
--- /dev/null
+++ b/src/test/resources/ClusterDetailsTest.json
@@ -0,0 +1,10 @@
+[{"clusterId":"0",
+"clusterInfo":"",
+ "childThreadId":986476
+},
+{"clusterId":"1",
+"clusterInfo":"",
+ "childThreadId":986475
+}
+]
+
diff --git a/src/test/resources/clusterInfo1.json b/src/test/resources/clusterInfo1.json
new file mode 100644
index 0000000..685d923
--- /dev/null
+++ b/src/test/resources/clusterInfo1.json
@@ -0,0 +1 @@
+[{"cellId":"29","physicalCellId":209,"neighbours":"[]"},{"cellId":"25","physicalCellId":32,"neighbours":"[{\"physicalCellId\":209,\"cellId\":\"29\"}]"}]
diff --git a/src/test/resources/clusterInfo2.json b/src/test/resources/clusterInfo2.json
new file mode 100644
index 0000000..6fe6d5e
--- /dev/null
+++ b/src/test/resources/clusterInfo2.json
@@ -0,0 +1 @@
+[{"cellId":"45","physicalCellId":310,"neighbours":"[]"},{"cellId":"47","physicalCellId":302,"neighbours":"[{\"physicalCellId\":310,\"cellId\":\"45\"}]"}]
diff --git a/src/test/resources/clusterInfo3.json b/src/test/resources/clusterInfo3.json
new file mode 100644
index 0000000..71e7736
--- /dev/null
+++ b/src/test/resources/clusterInfo3.json
@@ -0,0 +1 @@
+[{"cellId":"72","physicalCellId":2,"neighbours":"[]"},{"cellId":"63","physicalCellId":5,"neighbours":"[{\"physicalCellId\":2,\"cellId\":\"72\"}]"}]
diff --git a/src/test/resources/clusterInfo4.json b/src/test/resources/clusterInfo4.json
new file mode 100644
index 0000000..4da8c07
--- /dev/null
+++ b/src/test/resources/clusterInfo4.json
@@ -0,0 +1 @@
+[{"cellId":"2","physicalCellId":20,"neighbours":"[]"},{"cellId":"5","physicalCellId":30,"neighbours":"[{\"physicalCellId\":20,\"cellId\":\"2\"}]"}]
diff --git a/src/test/resources/clusterInfo5.json b/src/test/resources/clusterInfo5.json
new file mode 100644
index 0000000..7612d10
--- /dev/null
+++ b/src/test/resources/clusterInfo5.json
@@ -0,0 +1 @@
+[{"cellId":"44","physicalCellId":3,"neighbours":"[]"},{"cellId":"48","physicalCellId":0,"neighbours":"[{\"physicalCellId\":3,\"cellId\":\"44\"}]"},{"cellId":"45","physicalCellId":310,"neighbours":"[{\"physicalCellId\":0,\"cellId\":\"48\"}]"}]
diff --git a/src/test/resources/clusterInfo6.json b/src/test/resources/clusterInfo6.json
new file mode 100644
index 0000000..88e0763
--- /dev/null
+++ b/src/test/resources/clusterInfo6.json
@@ -0,0 +1 @@
+[{"cellId":"48","physicalCellId":0,"neighbours":"[]"},{"cellId":"45","physicalCellId":310,"neighbours":"[{\"physicalCellId\":0,\"cellId\":\"48\"}]"},{"cellId":"47","physicalCellId":302,"neighbours":"[{\"physicalCellId\":310,\"cellId\":\"45\"}]"}]
diff --git a/src/test/resources/clusterInfo7.json b/src/test/resources/clusterInfo7.json
new file mode 100644
index 0000000..1d8dc7d
--- /dev/null
+++ b/src/test/resources/clusterInfo7.json
@@ -0,0 +1 @@
+[{"cellId":"82","physicalCellId":32,"neighbours":"[]"},{"cellId":"81","physicalCellId":31,"neighbours":"[{\"physicalCellId\":32,\"cellId\":\"82\"}]"}]
diff --git a/src/test/resources/notification1.json b/src/test/resources/notification1.json
new file mode 100644
index 0000000..87f60e6
--- /dev/null
+++ b/src/test/resources/notification1.json
@@ -0,0 +1,45 @@
+{
+ "requestID":"9d2d790e-a5f0-11e8-98d0-529269fb1459",
+ "AAI":{
+
+ },
+ "from":"SDNR",
+ "version":"1.0.2",
+ "Action":"NeighborListModified",
+ "Payload":{
+ "RadioAccess":{
+ "FAPServiceNumberOfEntries":"1",
+ "FAPServiceList":[
+ {
+ "alias":"45",
+ "X0005b9Lte":{
+ "phyCellIdInUse":"310",
+ "pnfName":"ncserver2"
+ },
+ "CellConfig":{
+ "LTE":{
+ "RAN":{
+ "CellIdentity":"45",
+ "NeighborListInUse":{
+ "LTECellNumberOfEntries":"1",
+ "LTENeighborListInUseLTECell":[
+ {
+ "pnfName":"ncserver1",
+ "enable":"true",
+ "alias":"48",
+ "mustInclude":"true",
+ "plmnid":"ran-1",
+ "cid":"48",
+ "phyCellId":"0",
+ "blacklisted":"false"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+}
diff --git a/src/test/resources/notification2.json b/src/test/resources/notification2.json
new file mode 100644
index 0000000..702b643
--- /dev/null
+++ b/src/test/resources/notification2.json
@@ -0,0 +1,55 @@
+{
+ "requestID":"9d2d790e-a5f0-11e8-98d0-529269fb1459",
+ "AAI":{
+
+ },
+ "from":"SDNR",
+ "version":"1.0.2",
+ "Action":"NeighborListModified",
+ "Payload":{
+ "RadioAccess":{
+ "FAPServiceNumberOfEntries":"1",
+ "FAPServiceList":[
+ {
+ "alias":"120",
+ "X0005b9Lte":{
+ "phyCellIdInUse":"2",
+ "pnfName":"ncserver2"
+ },
+ "CellConfig":{
+ "LTE":{
+ "RAN":{
+ "CellIdentity":"120",
+ "NeighborListInUse":{
+ "LTECellNumberOfEntries":"3",
+ "LTENeighborListInUseLTECell":[
+ {
+ "pnfName":"ncserver1",
+ "enable":"true",
+ "alias":"123",
+ "mustInclude":"true",
+ "plmnid":"ran-1",
+ "cid":"123",
+ "phyCellId":"6",
+ "blacklisted":"false"
+ },
+ {
+ "pnfName":"ncserver1",
+ "enable":"true",
+ "alias":"49",
+ "mustInclude":"true",
+ "plmnid":"ran-1",
+ "cid":"124",
+ "phyCellId":"4",
+ "blacklisted":"false"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+}
diff --git a/src/test/resources/notification3.json b/src/test/resources/notification3.json
new file mode 100644
index 0000000..4a3a2a0
--- /dev/null
+++ b/src/test/resources/notification3.json
@@ -0,0 +1,45 @@
+{
+ "requestID":"9d2d790e-a5f0-11e8-98d0-529269fb1459",
+ "AAI":{
+
+ },
+ "from":"SDNR",
+ "version":"1.0.2",
+ "Action":"NeighborListModified",
+ "Payload":{
+ "RadioAccess":{
+ "FAPServiceNumberOfEntries":"1",
+ "FAPServiceList":[
+ {
+ "alias":"81",
+ "X0005b9Lte":{
+ "phyCellIdInUse":"31",
+ "pnfName":"ncserver2"
+ },
+ "CellConfig":{
+ "LTE":{
+ "RAN":{
+ "CellIdentity":"81",
+ "NeighborListInUse":{
+ "LTECellNumberOfEntries":"1",
+ "LTENeighborListInUseLTECell":[
+ {
+ "pnfName":"ncserver1",
+ "enable":"true",
+ "alias":"82",
+ "mustInclude":"true",
+ "plmnid":"ran-1",
+ "cid":"82",
+ "phyCellId":"32",
+ "blacklisted":"false"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+}
diff --git a/src/test/resources/policy_notification.json b/src/test/resources/policy_notification.json
new file mode 100644
index 0000000..b9a6910
--- /dev/null
+++ b/src/test/resources/policy_notification.json
@@ -0,0 +1,20 @@
+{
+
+ "closedLoopControlName":"ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459",
+ "closedLoopAlarmStart":1542445563201,
+ "closedLoopEventClient":"microservice.PCI",
+ "closedLoopEventStatus":"ONSET",
+ "target_type":"VNF",
+ "target":"generic-vnf.vnf-id",
+ "requestID":"a4130fd5-2291-4a83-8992-04e4c9f32731",
+ "from":"PCIMS",
+ "version":"1.0.2",
+ "payload":"{\"Configurations\":[{\"data\":{\"FAPService\":{\"alias\":\"Chn0330\",\"X0005b9Lte\":{\"phyCellIdInUse\":6,\"pnfName\":\"ncserver23\"},\"CellConfig\":{\"LTE\":{\"RAN\":{\"Common\":{\"CellIdentity\":\"Chn0330\"}}}}}}},{\"data\":{\"FAPService\":{\"alias\":\"Chn0331\",\"X0005b9Lte\":{\"phyCellIdInUse\":7,\"pnfName\":\"ncserver23\"},\"CellConfig\":{\"LTE\":{\"RAN\":{\"Common\":{\"CellIdentity\":\"Chn0331\"}}}}}}}]}",
+ "AAI":{
+ "generic-vnf.prov-status":"ACTIVE",
+ "generic-vnf.is-closed-loop-disabled":"false",
+ "generic-vnf.vnf-id":"ncserver23"
+ },
+ "Action":"ModifyConfig"
+
+}
diff --git a/src/test/resources/solutions.json b/src/test/resources/solutions.json
new file mode 100644
index 0000000..cf82283
--- /dev/null
+++ b/src/test/resources/solutions.json
@@ -0,0 +1 @@
+[{"startTime":"2016-10-01T00:30+01:00","finishTime":"2016-10-01T00:40+01.00","networkId":"NTWK005","pciSolutions":[{"cellId":"EXP001","pci":"101"},{"cellId":"EXP002","pci":"102"}]}]