eab30a0aca077a2060876fadf80372d4e29fd28f
[ccsdk/features.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP : ccsdk feature sdnr wt
4  *  ================================================================================
5  * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
6  * All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21 package org.onap.ccsdk.features.sdnr.wt.devicemanager.test;
22
23 import static org.junit.Assert.assertFalse;
24 import static org.junit.Assert.assertTrue;
25
26 import java.util.Arrays;
27 import org.junit.Test;
28 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime;
29 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
30 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml;
31 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectDeletionNotificationXml;
32 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SourceType;
34 import org.slf4j.Logger;
35 import org.slf4j.LoggerFactory;
36
37 public class TestXmlNotification {
38
39     private static final Logger log = LoggerFactory.getLogger(TestXmlNotification.class);
40
41     @Test
42     public void test() {
43
44         ProblemNotificationXml notification = new ProblemNotificationXml("TestMointpoint", "network-element",
45                 "problemName", InternalSeverity.Critical, 123, InternalDateAndTime.getTestpattern());
46
47         notification.getFaultlog(SourceType.Unknown);
48
49         notification.getFaultcurrent();
50
51         notification.isNotManagedAsCurrentProblem();
52
53         ProblemNotificationXml.debugResultList(log, "uuid", Arrays.asList(notification), 0);
54
55     }
56
57     @Test
58     public void testNoAlarm() {
59
60         ProblemNotificationXml notification;
61         notification = new ProblemNotificationXml("TestMointpoint", "network-element", "problemName",
62                 InternalSeverity.Critical, 123, InternalDateAndTime.getTestpattern());
63
64         assertFalse("Critical", notification.isNoAlarmIndication());
65
66         notification = new ProblemNotificationXml("TestMointpoint", "network-element", "problemName",
67                 InternalSeverity.NonAlarmed, 123, InternalDateAndTime.getTestpattern());
68
69         assertTrue("NonAlarm", notification.isNoAlarmIndication());
70
71     }
72
73     @Test
74     public void testObjectCreationNotification() {
75
76         ObjectCreationNotificationXml notification;
77         notification =
78                 new ObjectCreationNotificationXml("TestMointpoint1", 1, InternalDateAndTime.getTestpattern(), "Id1");
79
80     }
81
82     @Test
83     public void testDeletionCreationNotification() {
84
85         ObjectDeletionNotificationXml notification;
86         notification =
87                 new ObjectDeletionNotificationXml("TestMointpoint2", 2, InternalDateAndTime.getTestpattern(), "Id2");
88
89     }
90
91
92 }