when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo);
when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimConnectionContext);
when(mockedDeviceContext.getMessageSpy()).thenReturn(mockedMessagSpy);
- when(mockedDeviceContext.getDeviceFlowRegistry()).thenReturn(new DeviceFlowRegistryImpl(OFConstants.OFP_VERSION_1_3, dataBroker, nodePath));
+ when(mockedDeviceContext.getDeviceFlowRegistry())
+ .thenReturn(new DeviceFlowRegistryImpl(OFConstants.OFP_VERSION_1_3, dataBroker, nodePath));
when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
when(mockedDeviceContext.getMultiMsgCollector(
Matchers.<RequestContext<List<MultipartReply>>>any())).thenAnswer(
}
/**
- * switching to {@link StatisticsWorkMode#FULLYDISABLED}; no pollTimeout and no lifecycleRegistry
+ * Switching to {@link StatisticsWorkMode#FULLYDISABLED}; no pollTimeout and no lifecycleRegistry.
*
- * @throws Exception
+ * @throws Exception if work mode change failed
*/
@Test
public void testChangeStatisticsWorkMode1() throws Exception {
verify(statisticContext).stopGatheringData();
}
- private static void checkWorkModeChangeOutcome(Future<RpcResult<Void>> workMode) throws InterruptedException, ExecutionException {
+ private static void checkWorkModeChangeOutcome(Future<RpcResult<Void>> workMode)
+ throws InterruptedException, ExecutionException {
Assert.assertTrue(workMode.isDone());
Assert.assertTrue(workMode.get().isSuccessful());
}
-
/**
- * switching to {@link StatisticsWorkMode#FULLYDISABLED}; with pollTimeout and lifecycleRegistry
+ * Switching to {@link StatisticsWorkMode#FULLYDISABLED}; with pollTimeout and lifecycleRegistry.
*
- * @throws Exception
+ * @throws Exception if work mode change failed
*/
@Test
public void testChangeStatisticsWorkMode2() throws Exception {
new ChangeStatisticsWorkModeInputBuilder()
.setMode(StatisticsWorkMode.FULLYDISABLED);
- Future<RpcResult<Void>> workMode = statisticsManager.changeStatisticsWorkMode(changeStatisticsWorkModeInputBld.build());
+ Future<RpcResult<Void>> workMode =
+ statisticsManager.changeStatisticsWorkMode(changeStatisticsWorkModeInputBld.build());
checkWorkModeChangeOutcome(workMode);
verify(itemLifeCycleRegistry).getLifeCycleSources();
}
/**
- * switching to {@link StatisticsWorkMode#FULLYDISABLED} and back
- * to {@link StatisticsWorkMode#COLLECTALL}; with lifecycleRegistry and pollTimeout
+ * Switching to {@link StatisticsWorkMode#FULLYDISABLED} and back
+ * to {@link StatisticsWorkMode#COLLECTALL}; with lifecycleRegistry and pollTimeout.
*
- * @throws Exception
+ * @throws Exception if work mode change failed
*/
@Test
public void testChangeStatisticsWorkMode3() throws Exception {
final StatisticsContext statisticsContext = Mockito.mock(StatisticsContext.class);
final TimeCounter mockTimerCounter = Mockito.mock(TimeCounter.class);
- statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(), statisticsContext, mockTimerCounter, mockedDeviceInfo);
+ statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(),
+ statisticsContext,
+ mockTimerCounter,
+ mockedDeviceInfo);
verify(mockedDeviceContext).getDeviceState();
- statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(), statisticsContext, mockTimerCounter, mockedDeviceInfo);
+ statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(),
+ statisticsContext,
+ mockTimerCounter,
+ mockedDeviceInfo);
- statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(), statisticsContext, mockTimerCounter, mockedDeviceInfo);
+ statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(),
+ statisticsContext,
+ mockTimerCounter,
+ mockedDeviceInfo);
when(statisticsContext.gatherDynamicData()).thenReturn(Futures.immediateCheckedFuture(Boolean.TRUE));
when(statisticsContext.isSchedulingEnabled()).thenReturn(Boolean.TRUE);
- statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(), statisticsContext, mockTimerCounter, mockedDeviceInfo);
+ statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(),
+ statisticsContext,
+ mockTimerCounter,
+ mockedDeviceInfo);
verify(mockTimerCounter).markStart();
verify(mockTimerCounter).addTimeMark();
- when(statisticsContext.gatherDynamicData()).thenReturn(Futures.immediateFailedFuture(new Throwable("error msg")));
- statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(), statisticsContext, mockTimerCounter, mockedDeviceInfo);
+ when(statisticsContext.gatherDynamicData())
+ .thenReturn(Futures.immediateFailedFuture(new Throwable("error msg")));
+ statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(),
+ statisticsContext,
+ mockTimerCounter,
+ mockedDeviceInfo);
verify(mockTimerCounter,times(2)).addTimeMark();
}