use of org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier in project openflowplugin by opendaylight.
the class ResetEventTimesComandProviderTest method testDoExecute_dirty.
/**
* Test for {@link ResetEventTimesComandProvider#doExecute()} when stats were touched before.
*/
@Test
public void testDoExecute_dirty() throws Exception {
final EventIdentifier dummyEvent = new EventIdentifier("junit", "junitDevice");
Assert.assertTrue(checkNoActivity(EventsTimeCounter.provideTimes(), CHECK_NO_ACTIVITY_FUNCTION));
EventsTimeCounter.markStart(dummyEvent);
EventsTimeCounter.markEnd(dummyEvent);
Assert.assertFalse(checkNoActivity(EventsTimeCounter.provideTimes(), CHECK_NO_ACTIVITY_FUNCTION));
resetEventTimesComandProvider.execute(cmdSession);
Assert.assertTrue(checkNoActivity(EventsTimeCounter.provideTimes(), CHECK_NO_ACTIVITY_FUNCTION));
}
use of org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier in project openflowplugin by opendaylight.
the class ShowEventTimesComandProviderTest method testDoExecute_dirty.
/**
* Test for {@link ShowEventTimesComandProvider#doExecute()} when stats were touched before.
*/
@Test
public void testDoExecute_dirty() throws Exception {
final EventIdentifier dummyEvent = new EventIdentifier("junit", "junitDevice");
Assert.assertTrue(checkNoActivity(EventsTimeCounter.provideTimes(), CHECK_NO_ACTIVITY_FUNCTION));
EventsTimeCounter.markStart(dummyEvent);
EventsTimeCounter.markEnd(dummyEvent);
Assert.assertFalse(checkNoActivity(EventsTimeCounter.provideTimes(), CHECK_NO_ACTIVITY_FUNCTION));
showEventTimesComandProvider.execute(cmdSession);
Assert.assertFalse(checkNoActivity(EventsTimeCounter.provideTimes(), CHECK_NO_ACTIVITY_FUNCTION));
Mockito.verify(console).print(Matchers.contains("junitDevice"));
}
use of org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier in project openflowplugin by opendaylight.
the class StatisticsGatheringServiceTest method testGetStatisticsOfType.
@Test
public void testGetStatisticsOfType() throws Exception {
final EventIdentifier eventIdentifier = new EventIdentifier("ut-event", "ut-device-id:1");
for (MultipartType mpType : MultipartType.values()) {
statisticsGatheringService.getStatisticsOfType(eventIdentifier, mpType);
}
Mockito.verify(mockedRequestContextStack, Mockito.times(15)).createRequestContext();
}
use of org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier in project openflowplugin by opendaylight.
the class StatisticsGatheringOnTheFlyServiceTest method testGetStatisticsOfType.
@Test
public void testGetStatisticsOfType() throws Exception {
final EventIdentifier eventIdentifier = new EventIdentifier("ut-event", "ut-device-id:1");
statisticsGatheringService.getStatisticsOfType(eventIdentifier, MultipartType.OFPMPFLOW);
Mockito.verify(mockedRequestContextStack).createRequestContext();
}
use of org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier in project openflowplugin by opendaylight.
the class SalTableServiceImplTest method testUpdateTableSuccess.
@Test
public void testUpdateTableSuccess() throws ExecutionException, InterruptedException {
Mockito.doAnswer((Answer<Void>) invocation -> {
TableFeaturesBuilder tableFeaturesBld = new TableFeaturesBuilder().setTableId((short) 0).setName("Zafod").setMaxEntries(42L).setTableFeatureProperties(Collections.<TableFeatureProperties>emptyList());
MultipartReplyTableFeaturesBuilder mpTableFeaturesBld = new MultipartReplyTableFeaturesBuilder().setTableFeatures(Collections.singletonList(tableFeaturesBld.build()));
MultipartReplyTableFeaturesCaseBuilder mpBodyBld = new MultipartReplyTableFeaturesCaseBuilder().setMultipartReplyTableFeatures(mpTableFeaturesBld.build());
MultipartReplyMessageBuilder mpResultBld = new MultipartReplyMessageBuilder().setType(MultipartType.OFPMPTABLEFEATURES).setMultipartReplyBody(mpBodyBld.build()).setXid(21L);
final RpcResult<List<MultipartReply>> rpcResult = RpcResultBuilder.success(Collections.singletonList((MultipartReply) mpResultBld.build())).build();
handleResultFuture.set(rpcResult);
return null;
}).when(multiMessageCollector).endCollecting(Matchers.<EventIdentifier>any());
final Future<RpcResult<UpdateTableOutput>> rpcResultFuture = salTableService.updateTable(prepareUpdateTable());
Assert.assertNotNull(rpcResultFuture);
verify(mockedRequestContextStack).createRequestContext();
}
Aggregations