X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Fstatistics%2Fservices%2Fcompatibility%2FAbstractCompatibleStatServiceTest.java;h=598ddbcad2d596f49e0df0d6b907daaa8eebd50a;hb=6e2627630ebabb37526133a13deeb62adcc85d35;hp=501020b4389d5b7f20edde01d001ff5a7cb7710d;hpb=1bad84906fffbc4c3a901712f8a803680bcd064f;p=openflowplugin.git diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/AbstractCompatibleStatServiceTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/AbstractCompatibleStatServiceTest.java index 501020b438..598ddbcad2 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/AbstractCompatibleStatServiceTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/AbstractCompatibleStatServiceTest.java @@ -24,6 +24,7 @@ import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; import org.opendaylight.openflowplugin.api.OFConstants; +import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo; import org.opendaylight.openflowplugin.api.openflow.device.DeviceState; import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator; import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey; @@ -41,6 +42,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.g import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.aggregate.flow.statistics.from.flow.table._for.given.match.output.AggregatedFlowStatisticsBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput; @@ -63,7 +65,11 @@ public class AbstractCompatibleStatServiceTest extends AbstractStatsServiceTest @Mock private DeviceState deviceState; @Mock + private DeviceInfo deviceInfo; + @Mock private MessageTranslator translator; + @Mock + private GetFeaturesOutput featuresOutput; private AbstractRequestContext rqContext; @@ -89,10 +95,12 @@ public class AbstractCompatibleStatServiceTest extends AbstractStatsServiceTest } }; + Mockito.when(featuresOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); Mockito.when(rqContextStack.createRequestContext()).thenReturn(rqContext); Mockito.when(deviceContext.getDeviceState()).thenReturn(deviceState); - Mockito.when(deviceState.getNodeId()).thenReturn(NODE_ID); - Mockito.when(deviceState.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); + Mockito.when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo); + Mockito.when(deviceInfo.getNodeId()).thenReturn(NODE_ID); + Mockito.when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector).endCollecting(); Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector).endCollecting(Matchers.any(EventIdentifier.class)); @@ -101,7 +109,7 @@ public class AbstractCompatibleStatServiceTest extends AbstractStatsServiceTest Mockito.when(translatorLibrary.lookupTranslator(Matchers.any(TranslatorKey.class))).thenReturn(translator); - service = new AggregateFlowsInTableService(rqContextStack, deviceContext, new AtomicLong(20L)); + service = AggregateFlowsInTableService.createWithOook(rqContextStack, deviceContext, new AtomicLong(20L)); } @Test @@ -135,7 +143,7 @@ public class AbstractCompatibleStatServiceTest extends AbstractStatsServiceTest .setFlowCount(new Counter32(12L)) .setPacketCount(new Counter64(BigInteger.valueOf(13L))) .build(); - Mockito.when(translator.translate(Matchers.any(MultipartReply.class), Matchers.eq(deviceContext), Matchers.any())) + Mockito.when(translator.translate(Matchers.any(MultipartReply.class), Matchers.eq(deviceInfo), Matchers.any())) .thenReturn(aggregatedStats);