diff options
author | Ramya Ravichandran <ramya.ravichandran5@wipro.com> | 2019-02-15 16:26:45 +0530 |
---|---|---|
committer | Ramya Ravichandran <ramya.ravichandran5@wipro.com> | 2019-02-15 16:28:41 +0530 |
commit | 43467ecc6a1624b7fd695883c5c6c214782f6bcd (patch) | |
tree | 13d9bc07475d63fb1e29e44b7e82b33c54df09e7 /src/test/java/com/wipro/www/sonhms/model | |
parent | 8b5b35c5a7dfe7213e0d1ef824fc7ae5b6c82758 (diff) |
Son-handler microservice seed code
Change-Id: If4000e26044fe267bdd5fae3a1b2599182423950
Issue-ID: DCAEGEN2-1219
Signed-off-by: Ramya Ravichandran<ramya.ravichandran5@wipro.com>
Diffstat (limited to 'src/test/java/com/wipro/www/sonhms/model')
6 files changed, 353 insertions, 0 deletions
diff --git a/src/test/java/com/wipro/www/sonhms/model/CellConfigTest.java b/src/test/java/com/wipro/www/sonhms/model/CellConfigTest.java new file mode 100644 index 0000000..68f8b40 --- /dev/null +++ b/src/test/java/com/wipro/www/sonhms/model/CellConfigTest.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * ============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 new file mode 100644 index 0000000..8acc0e8 --- /dev/null +++ b/src/test/java/com/wipro/www/sonhms/model/CellNeighbourListTest.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * ============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 new file mode 100644 index 0000000..d1134fa --- /dev/null +++ b/src/test/java/com/wipro/www/sonhms/model/NotificationPayloadTest.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * ============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/NotificationTest.java b/src/test/java/com/wipro/www/sonhms/model/NotificationTest.java new file mode 100644 index 0000000..09c6c0a --- /dev/null +++ b/src/test/java/com/wipro/www/sonhms/model/NotificationTest.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * ============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 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; + +public class NotificationTest { + + @Test + public void notificationTest() { + + Notification notif = new Notification(); + LteNeighborListInUseLteCell lteNeighborListInUseLteCell = new LteNeighborListInUseLteCell("pnf1", "true", + "Cell10", "true", "123456", "5", 22, "false"); + + ArrayList<LteNeighborListInUseLteCell> list = new ArrayList<>(); + list.add(lteNeighborListInUseLteCell); + + NeighborListInUse neighborListInUse = new NeighborListInUse(list, "1"); + + NotificationRan notificationRan = new NotificationRan(neighborListInUse, "Cell25"); + NotificationLte notificationLte = new NotificationLte(notificationRan); + NotificationCellConfig notificationCell = new NotificationCellConfig(notificationLte); + X0005b9Lte lte = new X0005b9Lte(126, "pnf2"); + FapServiceList fap = new FapServiceList("Cell1", lte, notificationCell); + + ArrayList<FapServiceList> al = new ArrayList<>(); + al.add(fap); + + RadioAccess radioAccess = new RadioAccess("1", al); + NotificationPayload payload = new NotificationPayload(radioAccess); + + notif.setRequestId("9d2d790e-a5f0-11e8-98d0-529269fb1459"); + notif.setAai("{}"); + notif.setAction("NeighborListModified"); + notif.setFrom("SDNR"); + notif.setVersion("1.0.2"); + notif.setPayload(payload); + assertNotEquals("159", notif.getRequestId()); + + String test = "{\n" + " \"requestID\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459\",\n" + " \"AAI\": {},\n" + + " \"from\": \"SDNR\",\n" + " \"version\": \"1.0.2\",\n" + + " \"Action\": \"NeighborListModified\",\n" + " \"Payload\": {\n" + "\n" + " \"RadioAccess\":{ \n" + + " \"FAPServiceNumberOfEntries\":\"2\",\n" + " \"FAPServiceList\":[ \n" + " { \n" + + " \"alias\":\"Cell1\",\n" + " \"X0005b9Lte\":{ \n" + + " \"phyCellIdInUse\":\"35\",\n" + " \"pnfName\":\"DU-1\"\n" + + " },\n" + " \"CellConfig\":{ \n" + " \"LTE\":{ \n" + + " \"RAN\":{ \n" + " \"CellIdentity\":\"Cell1\",\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\":\"5\",\n" + + " \"phyCellId\":\"24\",\n" + + " \"blacklisted\":\"false\"\n" + " }\n" + + " ]\n" + " }\n" + " }\n" + + " }\n" + " }\n" + " }\n" + " ]\n" + " }\n" + "}\n" + "}"; + + ObjectMapper mapper = new ObjectMapper(); + Notification notif1 = new Notification(); + try { + notif1 = mapper.readValue(test, Notification.class); + } catch (JsonParseException e) { + e.printStackTrace(); + } catch (JsonMappingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + assertNotEquals(notif, notif1); + assertEquals(notif.getAction(), notif1.getAction()); + assertEquals(notif.getAai().toString(), notif1.getAai().toString()); + + } + +} diff --git a/src/test/java/com/wipro/www/sonhms/model/PayloadTest.java b/src/test/java/com/wipro/www/sonhms/model/PayloadTest.java new file mode 100644 index 0000000..1c006f9 --- /dev/null +++ b/src/test/java/com/wipro/www/sonhms/model/PayloadTest.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * ============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 new file mode 100644 index 0000000..c413791 --- /dev/null +++ b/src/test/java/com/wipro/www/sonhms/model/ResponseTest.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * ============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()); + } + +} |