2 * ============LICENSE_START=======================================================
3 * ONAP : ccsdk feature sdnr wt
4 * ================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.ccsdk.features.sdnr.wt.devicemanager.test;
23 import static org.junit.Assert.assertFalse;
24 import static org.junit.Assert.assertTrue;
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;
37 public class TestXmlNotification {
39 private static final Logger log = LoggerFactory.getLogger(TestXmlNotification.class);
44 ProblemNotificationXml notification = new ProblemNotificationXml("TestMointpoint", "network-element",
45 "problemName", InternalSeverity.Critical, 123, InternalDateAndTime.getTestpattern());
47 notification.getFaultlog(SourceType.Unknown);
49 notification.getFaultcurrent();
51 notification.isNotManagedAsCurrentProblem();
53 ProblemNotificationXml.debugResultList(log, "uuid", Arrays.asList(notification), 0);
58 public void testNoAlarm() {
60 ProblemNotificationXml notification;
61 notification = new ProblemNotificationXml("TestMointpoint", "network-element", "problemName",
62 InternalSeverity.Critical, 123, InternalDateAndTime.getTestpattern());
64 assertFalse("Critical", notification.isNoAlarmIndication());
66 notification = new ProblemNotificationXml("TestMointpoint", "network-element", "problemName",
67 InternalSeverity.NonAlarmed, 123, InternalDateAndTime.getTestpattern());
69 assertTrue("NonAlarm", notification.isNoAlarmIndication());
74 public void testObjectCreationNotification() {
76 ObjectCreationNotificationXml notification;
78 new ObjectCreationNotificationXml("TestMointpoint1", 1, InternalDateAndTime.getTestpattern(), "Id1");
83 public void testDeletionCreationNotification() {
85 ObjectDeletionNotificationXml notification;
87 new ObjectDeletionNotificationXml("TestMointpoint2", 2, InternalDateAndTime.getTestpattern(), "Id2");