X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Fstatistics%2Fservices%2FOpendaylightFlowStatisticsServiceImpl2Test.java;h=4e0425fac0fdf66702e1da7818108accd79d03c3;hb=f0c4018a26ed07b3783b1189f0be10a2d6ccf502;hp=3f093b0387335fcdb4a59c35baeb2e5393538973;hpb=6e1e20dd97e1c7605cb5c8e619ace7dbb80f4781;p=openflowplugin.git diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl2Test.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl2Test.java index 3f093b0387..4e0425fac0 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl2Test.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl2Test.java @@ -19,7 +19,6 @@ import org.mockito.Captor; import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.opendaylight.openflowplugin.api.OFConstants; import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator; @@ -40,7 +39,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; /** - * Test for {@link OpendaylightFlowStatisticsServiceImpl} - only not delegated method + * Test for {@link OpendaylightFlowStatisticsServiceImpl} - only not delegated method. */ public class OpendaylightFlowStatisticsServiceImpl2Test extends AbstractStatsServiceTest { @@ -56,7 +55,9 @@ public class OpendaylightFlowStatisticsServiceImpl2Test extends AbstractStatsSer public void setUp() { final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager(); - flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager); + flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, + deviceContext, + convertorManager); rqContextMp = new AbstractRequestContext>(42L) { @Override @@ -65,7 +66,8 @@ public class OpendaylightFlowStatisticsServiceImpl2Test extends AbstractStatsSer } }; Mockito.when(rqContextStack.>createRequestContext()).thenReturn(rqContextMp); - Mockito.when(translatorLibrary.lookupTranslator(Matchers.any(TranslatorKey.class))) + Mockito.when(translatorLibrary + .lookupTranslator(Matchers.any(TranslatorKey.class))) .thenReturn(translator); } @@ -73,22 +75,19 @@ public class OpendaylightFlowStatisticsServiceImpl2Test extends AbstractStatsSer public void testGetAggregateFlowStatisticsFromFlowTableForGivenMatch() throws Exception { Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider) .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class)); - Mockito.doAnswer(new Answer() { - @Override - public Void answer(InvocationOnMock invocation) throws Throwable { - final MultipartReplyMessageBuilder messageBuilder = new MultipartReplyMessageBuilder() - .setVersion(OFConstants.OFP_VERSION_1_3); - rqContextMp.setResult(RpcResultBuilder.success( - Collections.singletonList(messageBuilder.build())).build()); - return null; - } - } - ).when(multiMsgCollector).endCollecting(Matchers.any(EventIdentifier.class)); + Mockito.doAnswer((Answer) invocation -> { + final MultipartReplyMessageBuilder messageBuilder = new MultipartReplyMessageBuilder() + .setVersion(OFConstants.OFP_VERSION_1_3); + + rqContextMp.setResult(RpcResultBuilder + .success(Collections.singletonList(messageBuilder.build())) + .build()); + return null; + }).when(multiMsgCollector).endCollecting(Matchers.any(EventIdentifier.class)); Mockito.when(translator.translate( Matchers.any(MultipartReply.class), Matchers.same(deviceInfo), Matchers.isNull()) ).thenReturn(new AggregatedFlowStatisticsBuilder().build()); - GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder input = new GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder() .setNode(createNodeRef("unitProt:123")) @@ -104,6 +103,4 @@ public class OpendaylightFlowStatisticsServiceImpl2Test extends AbstractStatsSer Assert.assertEquals(1, rpcResult.getResult().getAggregatedFlowStatistics().size()); Assert.assertEquals(MultipartType.OFPMPAGGREGATE, requestInput.getValue().getType()); } - - } \ No newline at end of file