OPNFLWPLUG-1032: Neon-MRI: Bump odlparent, yangtools, mdsal
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / statistics / services / direct / AbstractDirectStatisticsServiceTest.java
old mode 100644 (file)
new mode 100755 (executable)
index eee08fe..1df959a
@@ -8,7 +8,8 @@
 
 package org.opendaylight.openflowplugin.impl.statistics.services.direct;
 
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.lenient;
 import static org.mockito.Mockito.when;
 
 import java.math.BigInteger;
@@ -27,6 +28,9 @@ import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.TranslatorLibrary;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.api.openflow.registry.flow.DeviceFlowRegistry;
+import org.opendaylight.openflowplugin.api.openflow.registry.group.DeviceGroupRegistry;
+import org.opendaylight.openflowplugin.api.openflow.registry.meter.DeviceMeterRegistry;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
 import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProvider;
 import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProviderFactory;
@@ -54,6 +58,12 @@ public abstract class AbstractDirectStatisticsServiceTest {
     @Mock
     protected RequestContextStack requestContextStack;
     @Mock
+    protected DeviceFlowRegistry deviceFlowRegistry;
+    @Mock
+    protected DeviceGroupRegistry deviceGroupRegistry;
+    @Mock
+    protected DeviceMeterRegistry deviceMeterRegistry;
+    @Mock
     protected DeviceContext deviceContext;
     @Mock
     protected ConnectionContext connectionContext;
@@ -78,6 +88,7 @@ public abstract class AbstractDirectStatisticsServiceTest {
     protected KeyedInstanceIdentifier<Node, NodeKey> nodeInstanceIdentifier;
     protected ConvertorManager convertorManager;
     protected MultipartWriterProvider multipartWriterProvider;
+
     protected static NodeRef createNodeRef(String nodeIdValue) {
         InstanceIdentifier<Node> nodePath = InstanceIdentifier.create(Nodes.class)
                 .child(Node.class, new NodeKey(new NodeId(nodeIdValue)));
@@ -95,22 +106,25 @@ public abstract class AbstractDirectStatisticsServiceTest {
                 .child(Node.class, new NodeKey(new NodeId(NODE_ID)));
 
         convertorManager = ConvertorManagerFactory.createDefaultManager();
+        lenient().when(deviceContext.getDeviceFlowRegistry()).thenReturn(deviceFlowRegistry);
+        lenient().when(deviceContext.getDeviceGroupRegistry()).thenReturn(deviceGroupRegistry);
+        lenient().when(deviceContext.getDeviceMeterRegistry()).thenReturn(deviceMeterRegistry);
         when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
         when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
-        when(deviceContext.getMultiMsgCollector(any())).thenReturn(multiMsgCollector);
-        when(deviceContext.oook()).thenReturn(translatorLibrary);
-        when(deviceContext.getDeviceState()).thenReturn(deviceState);
+        lenient().when(deviceContext.getMultiMsgCollector(any())).thenReturn(multiMsgCollector);
+        lenient().when(deviceContext.oook()).thenReturn(translatorLibrary);
+        lenient().when(deviceContext.getDeviceState()).thenReturn(deviceState);
         when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
         when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier);
-        when(deviceInfo.getNodeId()).thenReturn(new NodeId(NODE_ID));
+        lenient().when(deviceInfo.getNodeId()).thenReturn(new NodeId(NODE_ID));
         when(deviceInfo.getVersion()).thenReturn(OF_VERSION);
         when(deviceInfo.getDatapathId()).thenReturn(DATAPATH_ID);
-        when(getFeaturesOutput.getVersion()).thenReturn(OF_VERSION);
-        when(getFeaturesOutput.getDatapathId()).thenReturn(DATAPATH_ID);
+        lenient().when(getFeaturesOutput.getVersion()).thenReturn(OF_VERSION);
+        lenient().when(getFeaturesOutput.getDatapathId()).thenReturn(DATAPATH_ID);
         when(connectionContext.getFeatures()).thenReturn(features);
-        when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider);
-        when(features.getVersion()).thenReturn(OF_VERSION);
-        when(features.getDatapathId()).thenReturn(DATAPATH_ID);
+        lenient().when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider);
+        lenient().when(features.getVersion()).thenReturn(OF_VERSION);
+        lenient().when(features.getDatapathId()).thenReturn(DATAPATH_ID);
         multipartWriterProvider = MultipartWriterProviderFactory.createDefaultProvider(deviceContext);
         setUp();
     }