PerfTest perfTest = mock(PerfTest.class);
when(perfTest.getTargetHostIP()).thenReturn(Lists.newArrayList("127.0.0.1"));
when(perfTest.getSamplingInterval()).thenReturn(2);
SingleConsole singleConsole = mock(SingleConsole.class);
when(singleConsole.getReportPath()).thenReturn(tempReport);
MonitorCollectorPlugin monitorCollectorPlugin = new MonitorCollectorPlugin(config, scheduledTaskService,
perfTestService, 1L) {
@Override
protected int getPort(IConfig config) {
return 13243;
}
};
monitorCollectorPlugin.startSampling(singleConsole, perfTest, perfTestService);
ThreadUtils.sleep(2400);
monitorCollectorPlugin.sampling(null, null, null, null, null);
monitorCollectorPlugin.endSampling(null, null, null);
}