aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-08-31 11:45:05 +0530
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-08-31 11:45:19 +0530
commitd2ef8edac288371db8bf049a7a82b3e084862743 (patch)
treeb4f5ef4f6cf91aae05656e9766c3ef88e9075c0a
parent8e683ffdb67a8c9e254c7f6dafa857b903d7dffb (diff)
Fix Sonar reported bugs
Improve code coverage Issue-ID: SDNC-1603 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> Change-Id: Icb38a02ce62f327c114054c2a1db40d4cb242b6c Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/ONFCoreNetworkElementFactory.java27
-rw-r--r--sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java14
-rw-r--r--sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElement.java8
-rw-r--r--sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14DomInterfacePacManager.java8
-rw-r--r--sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterfaceNotificationListener.java2
-rw-r--r--sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14DomInterfacePacManager.java184
6 files changed, 218 insertions, 25 deletions
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/ONFCoreNetworkElementFactory.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/ONFCoreNetworkElementFactory.java
index 06558ad5a..b0125f4f0 100644
--- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/ONFCoreNetworkElementFactory.java
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/ONFCoreNetworkElementFactory.java
@@ -61,19 +61,24 @@ public class ONFCoreNetworkElementFactory implements NetworkElementFactory {
if (capabilities.isSupportingNamespaceAndRevision(NetworkElement.QNAME)) {
OnfMicrowaveModel onfMicrowaveModel = null;
Optional<NetconfBindingAccessor> bindingAccessor = accessor.getNetconfBindingAccessor();
- if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) {
- onfMicrowaveModel = new WrapperMicrowaveModelRev170324(bindingAccessor.get(), serviceProvider);
- } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) {
- onfMicrowaveModel = new WrapperMicrowaveModelRev180907(bindingAccessor.get(), serviceProvider);
- } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) {
- onfMicrowaveModel = new WrapperMicrowaveModelRev181010(bindingAccessor.get(), serviceProvider);
- }
+ if (bindingAccessor.isPresent()) {
+ if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) {
+ onfMicrowaveModel = new WrapperMicrowaveModelRev170324(bindingAccessor.get(), serviceProvider);
+ } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) {
+ onfMicrowaveModel = new WrapperMicrowaveModelRev180907(bindingAccessor.get(), serviceProvider);
+ } else if (capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) {
+ onfMicrowaveModel = new WrapperMicrowaveModelRev181010(bindingAccessor.get(), serviceProvider);
+ }
- if (onfMicrowaveModel != null) {
- return Optional.of(new ONFCoreNetworkElement12Microwave(bindingAccessor.get(), serviceProvider, configuration,
- onfMicrowaveModel));
+ if (onfMicrowaveModel != null) {
+ return Optional.of(new ONFCoreNetworkElement12Microwave(bindingAccessor.get(), serviceProvider,
+ configuration, onfMicrowaveModel));
+ } else {
+ return Optional.of(
+ new ONFCoreNetworkElement12Basic(bindingAccessor.get(), serviceProvider, configuration));
+ }
} else {
- return Optional.of(new ONFCoreNetworkElement12Basic(bindingAccessor.get(), serviceProvider, configuration));
+ log.error("Netconf Bindingaccessor is not present. This is a fatal issue and needs to be corrected for devicemanagers to work correctly.");
}
}
diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java
index 836f36214..736fd4742 100644
--- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java
+++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java
@@ -380,11 +380,15 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas
LOG.info("Begin registration listener for Mountpoint");
final Optional<NotificationService> optionalNotificationService =
mountPoint.getService(NotificationService.class);
- final NotificationService notificationService = optionalNotificationService.get();
- // notificationService.registerNotificationListener(microwaveEventListener);
- listenerRegistrationresult =
- notificationService.registerNotificationListener(microwaveModel.getNotificationListener());
- LOG.info("End registration listener for Mountpoint Result: {}", listenerRegistrationresult);
+ if (optionalNotificationService.isPresent()) {
+ final NotificationService notificationService = optionalNotificationService.get();
+ // notificationService.registerNotificationListener(microwaveEventListener);
+ listenerRegistrationresult =
+ notificationService.registerNotificationListener(microwaveModel.getNotificationListener());
+ LOG.info("End registration listener for Mountpoint Result: {}", listenerRegistrationresult);
+ } else {
+ LOG.error("Could not get NotificationService, hence microwave notification listener not registered");
+ }
}
/*------------------------------------------------------------
diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElement.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElement.java
index 0a98a0736..4a23b6b3c 100644
--- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElement.java
+++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/Onf14NetworkElement.java
@@ -351,7 +351,7 @@ public class Onf14NetworkElement implements NetworkElement {
Class<? extends LAYERPROTOCOLNAMETYPE> layerProtocolName = lp.getLayerProtocolName();
if (layerProtocolName != null) {
// if the LTP has an airInterface technology extension, the layer protocol name is air-layer
- if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEAIRLAYER.class.getName()) {
+ if (layerProtocolName.getTypeName().equals(LAYERPROTOCOLNAMETYPEAIRLAYER.class.getName())) {
TechnologySpecificPacKeys airInterfaceKey =
new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
airInterfaceList.add(airInterfaceKey);
@@ -359,14 +359,14 @@ public class Onf14NetworkElement implements NetworkElement {
ltp.getUuid().getValue(), lp.getLocalId());
}
// if the LTP has an ethernetContainier technology extension, the layer protocol name is ethernet-container-layer
- else if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEETHERNETCONTAINERLAYER.class
- .getName()) {
+ else if (layerProtocolName.getTypeName().equals(LAYERPROTOCOLNAMETYPEETHERNETCONTAINERLAYER.class
+ .getName())) {
TechnologySpecificPacKeys ethernetContainerKey =
new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
ethernetContainerList.add(ethernetContainerKey);
log.debug("Adding Ltp with uuid {} and local-id {} to the ethernet-contatinier list",
ltp.getUuid().getValue(), lp.getLocalId());
- } else if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEWIRELAYER.class.getName()) {
+ } else if (layerProtocolName.getTypeName().equals(LAYERPROTOCOLNAMETYPEWIRELAYER.class.getName())) {
TechnologySpecificPacKeys wireInterfaceKey =
new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
wireInterfaceList.add(wireInterfaceKey);
diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14DomInterfacePacManager.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14DomInterfacePacManager.java
index 7fca996e9..422f6b0fa 100644
--- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14DomInterfacePacManager.java
+++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14DomInterfacePacManager.java
@@ -194,7 +194,7 @@ public class Onf14DomInterfacePacManager implements DOMNotificationListener {
Class<? extends LAYERPROTOCOLNAMETYPE> layerProtocolName = lp.getLayerProtocolName();
if (layerProtocolName != null) {
// if the LTP has an airInterface technology extension, the layer protocol name is air-layer
- if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEAIRLAYER.class.getName()) {
+ if (layerProtocolName.getTypeName().equals(LAYERPROTOCOLNAMETYPEAIRLAYER.class.getName())) {
TechnologySpecificPacKeys airInterfaceKey =
new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
airInterfaceList.add(airInterfaceKey);
@@ -202,14 +202,14 @@ public class Onf14DomInterfacePacManager implements DOMNotificationListener {
ltp.getUuid().getValue(), lp.getLocalId());
}
// if the LTP has an ethernetContainier technology extension, the layer protocol name is ethernet-container-layer
- else if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEETHERNETCONTAINERLAYER.class
- .getName()) {
+ else if (layerProtocolName.getTypeName().equals(LAYERPROTOCOLNAMETYPEETHERNETCONTAINERLAYER.class
+ .getName())) {
TechnologySpecificPacKeys ethernetContainerKey =
new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
ethernetContainerList.add(ethernetContainerKey);
log.debug("Adding Ltp with uuid {} and local-id {} to the ethernet-contatinier list",
ltp.getUuid().getValue(), lp.getLocalId());
- } else if (layerProtocolName.getTypeName() == LAYERPROTOCOLNAMETYPEWIRELAYER.class.getName()) {
+ } else if (layerProtocolName.getTypeName().equals(LAYERPROTOCOLNAMETYPEWIRELAYER.class.getName())) {
TechnologySpecificPacKeys wireInterfaceKey =
new TechnologySpecificPacKeys(ltp.getUuid(), lp.getLocalId());
wireInterfaceList.add(wireInterfaceKey);
diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterfaceNotificationListener.java
index 840f2c328..6848e6765 100644
--- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterfaceNotificationListener.java
+++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/impl/interfaces/Onf14WireInterfaceNotificationListener.java
@@ -95,7 +95,7 @@ public class Onf14WireInterfaceNotificationListener implements WireInterface20Li
FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue())
.setProblem(notification.getProblem()).setTimestamp(notification.getTimestamp())
.setNodeId(this.netconfAccessor.getNodeId().getValue()).setSourceType(SourceType.Netconf)
- .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter().intValue())
+ .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter())
.build();
serviceProvider.getFaultService().faultNotification(faultAlarm);
serviceProvider.getWebsocketService().sendNotification( notification, netconfAccessor.getNodeId(),
diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14DomInterfacePacManager.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14DomInterfacePacManager.java
new file mode 100644
index 000000000..e0384e72b
--- /dev/null
+++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/TestOnf14DomInterfacePacManager.java
@@ -0,0 +1,184 @@
+/*
+ * ============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.onf14;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.impl.interfaces.Onf14DomInterfacePacManager;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider;
+import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor;
+import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
+import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
+import org.opendaylight.mdsal.dom.api.DOMNotification;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.AttributeValueChangedNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.LAYERPROTOCOLNAMETYPEAIRLAYER;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.ObjectCreationNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.ObjectDeletionNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.air._interface._2._0.rev200121.ProblemNotification;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.ControlConstruct;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.UniversalId;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.LogicalTerminationPoint;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.LogicalTerminationPointBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.control.construct.LogicalTerminationPointKey;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.logical.termination.point.LayerProtocol;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.logical.termination.point.LayerProtocolBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.core.model._1._4.rev191127.logical.termination.point.LayerProtocolKey;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.ethernet.container._2._0.rev200121.LAYERPROTOCOLNAMETYPEETHERNETCONTAINERLAYER;
+import org.opendaylight.yang.gen.v1.urn.onf.yang.wire._interface._2._0.rev200123.LAYERPROTOCOLNAMETYPEWIRELAYER;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+
+@RunWith(MockitoJUnitRunner.class)
+public class TestOnf14DomInterfacePacManager {
+
+ private static String NODEIDSTRING = "nSky";
+
+ @Mock
+ NetconfDomAccessor netconfDomAccessor;
+ @Mock
+ DeviceManagerServiceProvider serviceProvider;
+ @Mock
+ ControlConstruct controlConstruct;
+ @Mock
+ BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer;
+ @Mock
+ FaultService faultService;
+ @Mock
+ WebsocketManagerService websocketService;
+ @Mock
+ DataProvider databaseService;
+
+ Onf14DomInterfacePacManager domPacManager;
+ NodeId nodeId = new NodeId(NODEIDSTRING);
+
+ @Before
+ public void init() {
+ when(netconfDomAccessor.getNodeId()).thenReturn(nodeId);
+ when(netconfDomAccessor.getBindingNormalizedNodeSerializer()).thenReturn(bindingNormalizedNodeSerializer);
+ when(serviceProvider.getFaultService()).thenReturn(faultService);
+ when(serviceProvider.getWebsocketService()).thenReturn(websocketService);
+ when(serviceProvider.getDataProvider()).thenReturn(databaseService);
+
+ domPacManager = new Onf14DomInterfacePacManager(netconfDomAccessor, serviceProvider);
+
+ UniversalId uuid = new UniversalId("0Aabcdef-0abc-0cfD-0abC-0123456789AB");
+ @NonNull Map<LogicalTerminationPointKey, LogicalTerminationPoint> lptMap = new HashMap<LogicalTerminationPointKey, LogicalTerminationPoint>();
+ var lpMap = new HashMap<LayerProtocolKey, LayerProtocol>();
+
+ LayerProtocol lp = new LayerProtocolBuilder().setLayerProtocolName(LAYERPROTOCOLNAMETYPEAIRLAYER.class).setLocalId("TESTAIRLAYER").build();
+ LayerProtocolKey lpKey = new LayerProtocolKey("AIRPROTOCOL");
+ lpMap.put(lpKey, lp);
+ LogicalTerminationPoint ltp = new LogicalTerminationPointBuilder().setLayerProtocol(lpMap).setUuid(uuid).build();
+ UniversalId ltpUuid = new UniversalId("1Aabcdef-1abc-1cfD-1abc-0123456789AB");
+ LogicalTerminationPointKey ltpKey = new LogicalTerminationPointKey(ltpUuid);
+
+ lptMap.put(ltpKey, ltp);
+
+ lp = new LayerProtocolBuilder().setLayerProtocolName(LAYERPROTOCOLNAMETYPEETHERNETCONTAINERLAYER.class).setLocalId("TESTETHCONTAINERLAYER").build();
+ lpKey = new LayerProtocolKey("ETHERNETCONTAINERPROTOCOL");
+ lpMap = new HashMap<LayerProtocolKey, LayerProtocol>();
+ lpMap.put(lpKey, lp);
+ ltp = new LogicalTerminationPointBuilder().setLayerProtocol(lpMap).setUuid(uuid).build();
+ ltpUuid = new UniversalId("1Aabcdef-1abc-1cfD-1abc-0123456789BC");
+ ltpKey = new LogicalTerminationPointKey(ltpUuid);
+
+ lptMap.put(ltpKey, ltp);
+
+ lp = new LayerProtocolBuilder().setLayerProtocolName(LAYERPROTOCOLNAMETYPEWIRELAYER.class).setLocalId("TESTWIRELAYER").build();
+ lpKey = new LayerProtocolKey("WIREPROTOCOL");
+ lpMap = new HashMap<LayerProtocolKey, LayerProtocol>();
+ lpMap.put(lpKey, lp);
+ ltp = new LogicalTerminationPointBuilder().setLayerProtocol(lpMap).setUuid(uuid).build();
+ ltpUuid = new UniversalId("1Aabcdef-1abc-1cfD-1abc-0123456789CD");
+ ltpKey = new LogicalTerminationPointKey(ltpUuid);
+
+ lptMap.put(ltpKey, ltp);
+
+ when(Optional.of(controlConstruct).get().nonnullLogicalTerminationPoint()).thenReturn(lptMap);
+ }
+
+ @Test
+ public void test() {
+ domPacManager.readKeys(controlConstruct);
+ }
+
+ @Test
+ public void testProblemNotification() {
+ DOMNotification domNotif = mock(DOMNotification.class);
+ ProblemNotification problemNotif = mock(ProblemNotification.class);
+ when(bindingNormalizedNodeSerializer.fromNormalizedNodeNotification(domNotif.getType(), domNotif.getBody())).thenReturn(problemNotif);
+ when(problemNotif.getCounter()).thenReturn(10);
+ when(problemNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
+ when(problemNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-0abc-abcd-0123456789AB"));
+ when(problemNotif.getProblem()).thenReturn("modulationIsDownShifted");
+
+ domPacManager.onNotification(domNotif);
+ }
+
+ @Test
+ public void testAVCNotification() {
+ DOMNotification domNotif = mock(DOMNotification.class);
+ AttributeValueChangedNotification attrValChangedNotif = mock(AttributeValueChangedNotification.class);
+ when(bindingNormalizedNodeSerializer.fromNormalizedNodeNotification(domNotif.getType(), domNotif.getBody())).thenReturn(attrValChangedNotif);
+ when(attrValChangedNotif.getAttributeName()).thenReturn("12345678-0123-2345-abcd-0123456789AB");
+ when(attrValChangedNotif.getCounter()).thenReturn(20);
+ when(attrValChangedNotif.getNewValue()).thenReturn("new-value");
+ when(attrValChangedNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-1234-abcd-0123456789AB"));
+ when(attrValChangedNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
+ domPacManager.onNotification(domNotif);
+ }
+
+ @Test
+ public void testObjectDeletionNotification() {
+ DOMNotification domNotif = mock(DOMNotification.class);
+ ObjectDeletionNotification deletionNotif = mock(ObjectDeletionNotification.class);
+ when(bindingNormalizedNodeSerializer.fromNormalizedNodeNotification(domNotif.getType(), domNotif.getBody())).thenReturn(deletionNotif);
+ when(deletionNotif.getCounter()).thenReturn(20);
+ when(deletionNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-1234-abcd-0123456789AB"));
+ when(deletionNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
+ domPacManager.onNotification(domNotif);
+ }
+
+ @Test
+ public void testObjectCreationNotification() {
+ DOMNotification domNotif = mock(DOMNotification.class);
+ ObjectCreationNotification creationNotif = mock(ObjectCreationNotification.class);
+ when(bindingNormalizedNodeSerializer.fromNormalizedNodeNotification(domNotif.getType(), domNotif.getBody())).thenReturn(creationNotif);
+ when(creationNotif.getObjectType()).thenReturn("air-interface-name");
+ when(creationNotif.getCounter()).thenReturn(20);
+ when(creationNotif.getObjectIdRef()).thenReturn(new UniversalId("12345678-0123-1234-abcd-0123456789AB"));
+ when(creationNotif.getTimestamp()).thenReturn(new DateAndTime("2020-02-05T12:30:45.283Z"));
+ domPacManager.onNotification(domNotif);
+ }
+
+}