X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Fstatistics%2FStatisticsContextImpMockInitiation.java;h=6ecd5863113401d0151fa3e345f98d2357b109d5;hb=3ee047a21cbd0754dabaab6d01708d5c20be80fd;hp=55b18f5600f7d8cbd508bfd3a132ea0ac7331f58;hpb=6e1e20dd97e1c7605cb5c8e619ace7dbb80f4781;p=openflowplugin.git diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpMockInitiation.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpMockInitiation.java index 55b18f5600..6ecd586311 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpMockInitiation.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpMockInitiation.java @@ -11,7 +11,6 @@ package org.opendaylight.openflowplugin.impl.statistics; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.math.BigInteger; import org.junit.Before; import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue; import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext; @@ -19,7 +18,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext; import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo; import org.opendaylight.openflowplugin.api.openflow.device.DeviceManager; import org.opendaylight.openflowplugin.api.openflow.device.DeviceState; -import org.opendaylight.openflowplugin.api.openflow.lifecycle.LifecycleService; +import org.opendaylight.openflowplugin.api.openflow.lifecycle.ContextChainMastershipWatcher; import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsManager; import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy; import org.opendaylight.openflowplugin.impl.statistics.services.dedicated.StatisticsGatheringOnTheFlyService; @@ -29,11 +28,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; +import org.opendaylight.yangtools.yang.common.Uint64; +import org.opendaylight.yangtools.yang.common.Uint8; - -class StatisticsContextImpMockInitiation { +public class StatisticsContextImpMockInitiation { Boolean isTable = false; Boolean isFlow = false; Boolean isGroup = false; @@ -44,14 +45,14 @@ class StatisticsContextImpMockInitiation { protected DeviceContext mockedDeviceContext; protected DeviceState mockedDeviceState; - StatisticsGatheringService mockedStatisticsGatheringService; - StatisticsGatheringOnTheFlyService mockedStatisticsOnFlyGatheringService; + StatisticsGatheringService mockedStatisticsGatheringService; + StatisticsGatheringOnTheFlyService mockedStatisticsOnFlyGatheringService; ConnectionContext mockedConnectionContext; DeviceInfo mockedDeviceInfo; StatisticsManager mockedStatisticsManager; - LifecycleService lifecycleService; + ContextChainMastershipWatcher mockedMastershipWatcher; - static final KeyedInstanceIdentifier dummyNodeII = InstanceIdentifier.create(Nodes.class) + static final KeyedInstanceIdentifier DUMMY_NODE_ID = InstanceIdentifier.create(Nodes.class) .child(Node.class, new NodeKey(new NodeId("dummyNodeId"))); @Before @@ -63,7 +64,7 @@ class StatisticsContextImpMockInitiation { mockedDeviceState = mock(DeviceState.class); mockedDeviceInfo = mock(DeviceInfo.class); mockedStatisticsManager = mock(StatisticsManager.class); - lifecycleService = mock(LifecycleService.class); + mockedMastershipWatcher = mock(ContextChainMastershipWatcher.class); final FeaturesReply mockedFeatures = mock(FeaturesReply.class); final MessageSpy mockedMessageSpy = mock(MessageSpy.class); @@ -75,25 +76,18 @@ class StatisticsContextImpMockInitiation { when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedConnectionContext); when(mockedDeviceContext.getMessageSpy()).thenReturn(mockedMessageSpy); - when(mockedDeviceState.isTableStatisticsAvailable()).thenReturn(isTable); - when(mockedDeviceState.isFlowStatisticsAvailable()).thenReturn(isFlow); - when(mockedDeviceState.isGroupAvailable()).thenReturn(isGroup); - when(mockedDeviceState.isMetersAvailable()).thenReturn(isMeter); - when(mockedDeviceState.isPortStatisticsAvailable()).thenReturn(isPort); - when(mockedDeviceState.isQueueStatisticsAvailable()).thenReturn(isQueue); - when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(dummyNodeII); - when(mockedDeviceInfo.getDatapathId()).thenReturn(BigInteger.TEN); + when(mockedDeviceInfo.getVersion()).thenReturn(Uint8.ONE); + when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(DUMMY_NODE_ID); + when(mockedDeviceInfo.getDatapathId()).thenReturn(Uint64.TEN); when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState); when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo); when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedConnectionContext); when(mockedDeviceContext.getMessageSpy()).thenReturn(mockedMessageSpy); - when(mockedDeviceInfo.getNodeId()).thenReturn(dummyNodeII.getKey().getId()); + when(mockedDeviceInfo.getNodeId()).thenReturn(DUMMY_NODE_ID.getKey().getId()); - when(mockedConnectionContext.getNodeId()).thenReturn(dummyNodeII.getKey().getId()); when(mockedConnectionContext.getFeatures()).thenReturn(mockedFeatures); when(mockedConnectionContext.getConnectionState()).thenReturn(ConnectionContext.CONNECTION_STATE.WORKING); - when(mockedConnectionContext.getOutboundQueueProvider()).thenReturn(mockedOutboundQueue); } }