1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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());
}
}
|