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 16929ca..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,7 +28,12 @@ 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;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
@@ -47,11 +53,17 @@ public abstract class AbstractDirectStatisticsServiceTest {
     protected static final Long PORT_NO = 1L;
     protected static final BigInteger DATAPATH_ID = BigInteger.TEN;
     protected static final short OF_VERSION = OFConstants.OFP_VERSION_1_3;
-    protected static final String NODE_ID = "openflow:1";
+    protected static final String NODE_ID = "openflow:10";
 
     @Mock
     protected RequestContextStack requestContextStack;
     @Mock
+    protected DeviceFlowRegistry deviceFlowRegistry;
+    @Mock
+    protected DeviceGroupRegistry deviceGroupRegistry;
+    @Mock
+    protected DeviceMeterRegistry deviceMeterRegistry;
+    @Mock
     protected DeviceContext deviceContext;
     @Mock
     protected ConnectionContext connectionContext;
@@ -75,6 +87,7 @@ public abstract class AbstractDirectStatisticsServiceTest {
     protected NodeConnectorId nodeConnectorId;
     protected KeyedInstanceIdentifier<Node, NodeKey> nodeInstanceIdentifier;
     protected ConvertorManager convertorManager;
+    protected MultipartWriterProvider multipartWriterProvider;
 
     protected static NodeRef createNodeRef(String nodeIdValue) {
         InstanceIdentifier<Node> nodePath = InstanceIdentifier.create(Nodes.class)
@@ -93,23 +106,26 @@ 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();
     }
 
@@ -123,4 +139,4 @@ public abstract class AbstractDirectStatisticsServiceTest {
 
     @Test
     public abstract void testStoreStatistics() throws Exception;
-}
\ No newline at end of file
+}