Search in sources :

Example 1 with TCmdActiveThreadCount

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);
}
Also used : TCmdActiveThreadCount(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCount) Test(org.junit.Test)

Example 2 with TCmdActiveThreadCount

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();
    }
}
Also used : ActiveTraceRepository(com.navercorp.pinpoint.profiler.context.active.ActiveTraceRepository) DefaultActiveTraceRepository(com.navercorp.pinpoint.profiler.context.active.DefaultActiveTraceRepository) DefaultActiveTraceRepository(com.navercorp.pinpoint.profiler.context.active.DefaultActiveTraceRepository) TCmdActiveThreadCountRes(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCountRes) TCmdActiveThreadCount(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCount) Test(org.junit.Test)

Aggregations

TCmdActiveThreadCount (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCount)2 Test (org.junit.Test)2 ActiveTraceRepository (com.navercorp.pinpoint.profiler.context.active.ActiveTraceRepository)1 DefaultActiveTraceRepository (com.navercorp.pinpoint.profiler.context.active.DefaultActiveTraceRepository)1 TCmdActiveThreadCountRes (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadCountRes)1