use of com.navercorp.pinpoint.profiler.context.active.DefaultActiveTraceRepository in project pinpoint by naver.
the class ActiveThreadServiceTest method serviceTest1.
@Test
public void serviceTest1() throws InterruptedException {
ActiveTraceRepository activeTraceRepository = new DefaultActiveTraceRepository();
addActiveTrace(activeTraceRepository, FAST_EXECUTION_TIME, FAST_COUNT);
addActiveTrace(activeTraceRepository, NORMAL_EXECUTION_TIME, NORMAL_COUNT);
addActiveTrace(activeTraceRepository, SLOW_EXECUTION_TIME, SLOW_COUNT);
addActiveTrace(activeTraceRepository, VERY_SLOW_EXECUTION_TIME, VERY_SLOW_COUNT);
ActiveThreadCountService service = new ActiveThreadCountService(activeTraceRepository);
TBase<?, ?> tBase = service.requestCommandService(new TCmdActiveThreadCount());
if (tBase instanceof TCmdActiveThreadCountRes) {
List<Integer> activeThreadCount = ((TCmdActiveThreadCountRes) tBase).getActiveThreadCount();
Assert.assertThat(activeThreadCount.get(0), is(FAST_COUNT));
Assert.assertThat(activeThreadCount.get(1), is(NORMAL_COUNT));
Assert.assertThat(activeThreadCount.get(2), is(SLOW_COUNT));
Assert.assertThat(activeThreadCount.get(3), is(VERY_SLOW_COUNT));
} else {
Assert.fail();
}
}
Aggregations