use of com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCount in project pinpoint by naver.
the class AgentActiveThreadCountFactoryTest method invalidArgumentTest1.
@Test
public void invalidArgumentTest1() throws Exception {
TCmdActiveThreadCount response = new TCmdActiveThreadCount();
AgentActiveThreadCountFactory factory = new AgentActiveThreadCountFactory();
factory.setAgentId("test");
AgentActiveThreadCount agentActiveThreadCount = factory.create(response);
Assert.assertEquals(factory.INTERNAL_ERROR.getCode(), agentActiveThreadCount.getCode());
Assert.assertTrue(CollectionUtils.nullSafeSize(agentActiveThreadCount.getActiveThreadCountList()) == 0);
}
use of com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCount 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