diff options
author | Michael DÜrre <michael.duerre@highstreet-technologies.com> | 2021-04-08 06:34:22 +0200 |
---|---|---|
committer | Michael DÜrre <michael.duerre@highstreet-technologies.com> | 2021-04-08 06:34:46 +0200 |
commit | f3969004c6ccac18e742c5fc48c844e315991023 (patch) | |
tree | f5486a62e842bb16ca7d3af47a8663df08feef55 /sdnr/wt/devicemanager/provider/src/test | |
parent | a252be83694ae33260d99d5371ed48c1558aa2e8 (diff) |
update websocketmanager
update complete notification flow
Issue-ID: CCSDK-3252
Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com>
Change-Id: I87ba00f615707b942471fcace57bcda50ce37e61
Diffstat (limited to 'sdnr/wt/devicemanager/provider/src/test')
3 files changed, 4 insertions, 156 deletions
diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java index a089aa22c..ed7f56f4b 100644 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java +++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevicemanager.java @@ -39,6 +39,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.RpcProviderServic import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeConnectListener; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateListener; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNodeStateService; +import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; import org.opendaylight.mdsal.binding.api.DataBroker; import org.opendaylight.mdsal.binding.api.MountPointService; import org.opendaylight.mdsal.binding.api.NotificationPublishService; @@ -46,13 +47,13 @@ import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvid import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.MaintenanceBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ClearCurrentFaultByNodenameInputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.DevicemanagerService; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.GetRequiredNetworkElementKeysInputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushAttributeChangeNotificationInputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationInputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ShowRequiredNetworkElementInputBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketmanagerService; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.slf4j.Logger; @@ -89,7 +90,7 @@ public class TestDevicemanager extends Mockito { when(netconfNodeStateService.registerNetconfNodeStateListener(mock(NetconfNodeStateListener.class))) .thenReturn(lr2); - WebsocketmanagerService websocketmanagerService = mock(WebsocketmanagerService.class); + WebsocketManagerService websocketmanagerService = mock(WebsocketManagerService.class); IEntityDataProvider iEntityDataProvider = mock(IEntityDataProvider.class); doNothing().when(iEntityDataProvider).setReadyStatus(isA(Boolean.class)); @@ -152,7 +153,7 @@ public class TestDevicemanager extends Mockito { FaultService n = deviceManager.getFaultService(); FaultlogBuilder faultLogEntityBuilder = new FaultlogBuilder(); - n.faultNotification(faultLogEntityBuilder.setNodeId("node1") + n.faultNotification(faultLogEntityBuilder.setNodeId("node1").setSeverity(SeverityType.Critical) .setTimestamp(NetconfTimeStampImpl.getTestpatternDateAndTime()).build()); } diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlMapper.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlMapper.java deleted file mode 100644 index f79589f62..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlMapper.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * ONAP : ccsdk features - * ================================================================================ - * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * 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.ccsdk.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.fail; -import javax.xml.bind.JAXBException; -import org.eclipse.jdt.annotation.Nullable; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.AttributeValueChangedNotificationXml; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.XmlMapper; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.EventlogNotificationBuilder; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Eventlog; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; - -@SuppressWarnings("deprecation") -public class TestXmlMapper { - - @Test - public void test() { - XmlMapper xmlMapper = new XmlMapper(); - AttributeValueChangedNotificationXml event = getChangeNotification(new NodeId("NodeTest1"), 2, InternalDateAndTime.getTestpatternDateAndTime(), "ObjTest1", - "AtrributeTest1", "NewTest1"); - - try { - String result = xmlMapper.getXmlString(event); - System.out.println("Mappingresult = "+result); - } catch (JAXBException e) { - e.printStackTrace(); - fail("Problem with xml mapping."); - } - - } - - public AttributeValueChangedNotificationXml getChangeNotification(NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp, - @Nullable String objectId, @Nullable String attributeName, @Nullable String newValue) { - Eventlog eventlogEntity = new EventlogNotificationBuilder(nodeId, counter, timeStamp, objectId, attributeName, newValue).build(); - return new AttributeValueChangedNotificationXml(eventlogEntity); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlNotification.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlNotification.java deleted file mode 100644 index da3946041..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestXmlNotification.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - * All rights reserved. - * ================================================================================ - * 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.ccsdk.features.sdnr.wt.devicemanager.test; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.util.Arrays; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectDeletionNotificationXml; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class TestXmlNotification { - - private static final Logger log = LoggerFactory.getLogger(TestXmlNotification.class); - - @Test - public void test() { - - ProblemNotificationXml notification = new ProblemNotificationXml("TestMointpoint", "network-element", - "problemName", InternalSeverity.Critical, 123, InternalDateAndTime.getTestpattern()); - - notification.getFaultlog(SourceType.Unknown); - - notification.getFaultcurrent(); - - notification.isNotManagedAsCurrentProblem(); - - ProblemNotificationXml.debugResultList(log, "uuid", Arrays.asList(notification), 0); - - } - - @Test - public void testNoAlarm() { - - ProblemNotificationXml notification; - notification = new ProblemNotificationXml("TestMointpoint", "network-element", "problemName", - InternalSeverity.Critical, 123, InternalDateAndTime.getTestpattern()); - - assertFalse("Critical", notification.isNoAlarmIndication()); - - notification = new ProblemNotificationXml("TestMointpoint", "network-element", "problemName", - InternalSeverity.NonAlarmed, 123, InternalDateAndTime.getTestpattern()); - - assertTrue("NonAlarm", notification.isNoAlarmIndication()); - - } - - @Test - public void testObjectCreationNotification() { - - ObjectCreationNotificationXml notification; - notification = - new ObjectCreationNotificationXml("TestMointpoint1", 1, InternalDateAndTime.getTestpattern(), "Id1"); - - } - - @Test - public void testDeletionCreationNotification() { - - ObjectDeletionNotificationXml notification; - notification = - new ObjectDeletionNotificationXml("TestMointpoint2", 2, InternalDateAndTime.getTestpattern(), "Id2"); - - } - - -} |