Search in sources :

Example 1 with DefaultMethodDescriptor

use of com.navercorp.pinpoint.profiler.context.DefaultMethodDescriptor in project pinpoint by naver.

the class DefaultApiMetaDataServiceTest method cacheApi.

@Test
public void cacheApi() throws Exception {
    EnhancedDataSender dataSender = mock(EnhancedDataSender.class);
    ApiMetaDataService apiMetaDataService = new DefaultApiMetaDataService("agentId", System.currentTimeMillis(), dataSender);
    MethodDescriptor methodDescriptor = new DefaultMethodDescriptor("clazz", "method", null, null);
    int first = apiMetaDataService.cacheApi(methodDescriptor);
    Assert.assertNotEquals("not exist", first, 0);
    verify(dataSender, times(1)).request(any(TBase.class));
    int second = apiMetaDataService.cacheApi(methodDescriptor);
    Assert.assertEquals("check cache", first, second);
    verify(dataSender, times(1)).request(any(TBase.class));
}
Also used : DefaultMethodDescriptor(com.navercorp.pinpoint.profiler.context.DefaultMethodDescriptor) EnhancedDataSender(com.navercorp.pinpoint.profiler.sender.EnhancedDataSender) TBase(org.apache.thrift.TBase) MethodDescriptor(com.navercorp.pinpoint.bootstrap.context.MethodDescriptor) DefaultMethodDescriptor(com.navercorp.pinpoint.profiler.context.DefaultMethodDescriptor) Test(org.junit.Test)

Aggregations

MethodDescriptor (com.navercorp.pinpoint.bootstrap.context.MethodDescriptor)1 DefaultMethodDescriptor (com.navercorp.pinpoint.profiler.context.DefaultMethodDescriptor)1 EnhancedDataSender (com.navercorp.pinpoint.profiler.sender.EnhancedDataSender)1 TBase (org.apache.thrift.TBase)1 Test (org.junit.Test)1