Include missing mapping of O-RAN fault fields
[ccsdk/features.git] / sdnr / wt / devicemanager-o-ran-sc / o-ran / ru-fh / provider / src / test / java / org / onap / ccsdk / features / sdnr / wt / devicemanager / oran / impl / TestORanNetworkElement.java
@@ -15,7 +15,7 @@
  * the License.
  * ============LICENSE_END==========================================================================
  */
-package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.test;
+package org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -23,12 +23,13 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 import java.io.IOException;
 import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
 import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement;
-import org.onap.ccsdk.features.sdnr.wt.devicemanager.oran.impl.ORanNetworkElementFactory;
 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.devicemanager.service.NotificationProxyParser;
 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorCfgService;
 import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.VESCollectorService;
@@ -36,6 +37,7 @@ import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
+import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService;
 import org.opendaylight.yang.gen.v1.urn.o.ran.hardware._1._0.rev190328.ORANHWCOMPONENT;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -44,18 +46,19 @@ public class TestORanNetworkElement {
 
     private static final QName OneCell =
             QName.create("urn:onf:otcc:wireless:yang:radio-access:commscope-onecell", "2020-06-22", "onecell").intern();
+    private static final @NonNull QName OnapSystem = QName.create("urn:onap:system", "2020-10-26", "onap-system").intern();
     private static String NODEIDSTRING = "nSky";
     private static NodeId nodeId = new NodeId(NODEIDSTRING);
-    private static NodeId nNodeId = new NodeId("nSky");
 
     private static NetconfAccessor accessor;
     private static DeviceManagerServiceProvider serviceProvider;
     private static Capabilities capabilities;
     private static TransactionUtils transactionUtils;
-    private static NetconfBindingAccessor bindingCommunicator;
+    private static NetconfBindingAccessor bindingAccessor;
     private static VESCollectorService vesCollectorService;
     private static NotificationProxyParser notificationProxyParser;
     private static VESCollectorCfgService vesCfgService;
+    private static WebsocketManagerService websocketManagerService;
 
     @BeforeClass
     public static void init() throws InterruptedException, IOException {
@@ -63,19 +66,24 @@ public class TestORanNetworkElement {
         accessor = mock(NetconfAccessor.class);
         serviceProvider = mock(DeviceManagerServiceProvider.class);
         transactionUtils = mock(TransactionUtils.class);
-        bindingCommunicator = mock(NetconfBindingAccessor.class);
+        bindingAccessor = mock(NetconfBindingAccessor.class);
         vesCollectorService = mock(VESCollectorService.class);
         notificationProxyParser = mock(NotificationProxyParser.class);
         vesCfgService = mock(VESCollectorCfgService.class);
+        websocketManagerService = mock(WebsocketManagerService.class);
 
         when(accessor.getCapabilites()).thenReturn(capabilities);
-        when(accessor.getNodeId()).thenReturn(nNodeId);
-        when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(bindingCommunicator));
-        when(bindingCommunicator.getTransactionUtils()).thenReturn(transactionUtils);
-        when(bindingCommunicator.getNodeId()).thenReturn(nodeId);
+        when(accessor.getNodeId()).thenReturn(nodeId);
+        when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(bindingAccessor));
+        when(bindingAccessor.getCapabilites()).thenReturn(capabilities);
+        when(bindingAccessor.getTransactionUtils()).thenReturn(transactionUtils);
+        when(bindingAccessor.getNodeId()).thenReturn(nodeId);
         when(vesCollectorService.getNotificationProxyParser()).thenReturn(notificationProxyParser);
 
         DataProvider dataProvider = mock(DataProvider.class);
+        FaultService faultService = mock(FaultService.class);
+        when(serviceProvider.getWebsocketService()).thenReturn(websocketManagerService);
+        when(serviceProvider.getFaultService()).thenReturn(faultService);
         when(serviceProvider.getDataProvider()).thenReturn(dataProvider);
         when(serviceProvider.getVESCollectorService()).thenReturn(vesCollectorService);
         when(vesCollectorService.getConfig()).thenReturn(vesCfgService);
@@ -85,14 +93,11 @@ public class TestORanNetworkElement {
 
     @Test
     public void test() {
-
-        NodeId nodeId = new NodeId(NODEIDSTRING);
-        when(bindingCommunicator.getTransactionUtils()).thenReturn(mock(TransactionUtils.class));
-        when(bindingCommunicator.getNodeId()).thenReturn(nodeId);
-
         Optional<NetworkElement> oRanNe;
         when(capabilities.isSupportingNamespace(ORANHWCOMPONENT.QNAME)).thenReturn(true);
         when(capabilities.isSupportingNamespace(OneCell)).thenReturn(false);
+        when(capabilities.isSupportingNamespace(OnapSystem)).thenReturn(false);
+
         ORanNetworkElementFactory factory = new ORanNetworkElementFactory();
         oRanNe = factory.create(accessor, serviceProvider);
         assertTrue(factory.create(accessor, serviceProvider).isPresent());