import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.aggregate.flow.statistics.from.flow.table._for.given.match.output.AggregatedFlowStatistics;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
/**
- * Test for {@link OpendaylightFlowStatisticsServiceImpl}
+ * Test for {@link OpendaylightFlowStatisticsServiceImpl} - only not delegated method.
*/
public class OpendaylightFlowStatisticsServiceImpl2Test extends AbstractStatsServiceTest {
public void setUp() {
- flowStatisticsService = new OpendaylightFlowStatisticsServiceImpl(rqContextStack, deviceContext);
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack,
+ deviceContext,
+ convertorManager);
rqContextMp = new AbstractRequestContext<List<MultipartReply>>(42L) {
@Override
}
};
Mockito.when(rqContextStack.<List<MultipartReply>>createRequestContext()).thenReturn(rqContextMp);
- Mockito.when(translatorLibrary.<MultipartReply, AggregatedFlowStatistics>lookupTranslator(Matchers.any(TranslatorKey.class)))
+ Mockito.when(translatorLibrary
+ .<MultipartReply, AggregatedFlowStatistics>lookupTranslator(Matchers.any(TranslatorKey.class)))
.thenReturn(translator);
}
public void testGetAggregateFlowStatisticsFromFlowTableForGivenMatch() throws Exception {
Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider)
.commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
- Mockito.doAnswer(new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) throws Throwable {
- final MultipartReplyMessageBuilder messageBuilder = new MultipartReplyMessageBuilder()
- .setVersion(OFConstants.OFP_VERSION_1_3);
- rqContextMp.setResult(RpcResultBuilder.success(
- Collections.<MultipartReply>singletonList(messageBuilder.build())).build());
- return null;
- }
- }
- ).when(multiMsgCollector).endCollecting(Matchers.any(EventIdentifier.class));
+ Mockito.doAnswer((Answer<Void>) invocation -> {
+ final MultipartReplyMessageBuilder messageBuilder = new MultipartReplyMessageBuilder()
+ .setVersion(OFConstants.OFP_VERSION_1_3);
+
+ rqContextMp.setResult(RpcResultBuilder
+ .success(Collections.<MultipartReply>singletonList(messageBuilder.build()))
+ .build());
+ return null;
+ }).when(multiMsgCollector).endCollecting(Matchers.any(EventIdentifier.class));
Mockito.when(translator.translate(
- Matchers.any(MultipartReply.class), Matchers.same(deviceContext), Matchers.isNull())
+ Matchers.any(MultipartReply.class), Matchers.same(deviceInfo), Matchers.isNull())
).thenReturn(new AggregatedFlowStatisticsBuilder().build());
-
GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder input =
new GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder()
.setNode(createNodeRef("unitProt:123"))
Assert.assertEquals(1, rpcResult.getResult().getAggregatedFlowStatistics().size());
Assert.assertEquals(MultipartType.OFPMPAGGREGATE, requestInput.getValue().getType());
}
-
-
}
\ No newline at end of file