Search in sources :

Example 1 with Result

use of com.navercorp.pinpoint.profiler.metadata.Result in project pinpoint by naver.

the class SimpleCacheTest method startKey1.

@Test
public void startKey1() {
    SimpleCache<String> cache = new SimpleCache<String>(1);
    Result test = cache.put("test");
    Assert.assertEquals(-1, test.getId());
}
Also used : SimpleCache(com.navercorp.pinpoint.profiler.metadata.SimpleCache) Result(com.navercorp.pinpoint.profiler.metadata.Result) Test(org.junit.Test)

Example 2 with Result

use of com.navercorp.pinpoint.profiler.metadata.Result in project pinpoint by naver.

the class SimpleCacheTest method startKey0.

@Test
public void startKey0() {
    SimpleCache<String> cache = new SimpleCache<String>(1024, 0);
    Result test = cache.put("test");
    Assert.assertEquals(0, test.getId());
}
Also used : SimpleCache(com.navercorp.pinpoint.profiler.metadata.SimpleCache) Result(com.navercorp.pinpoint.profiler.metadata.Result) Test(org.junit.Test)

Example 3 with Result

use of com.navercorp.pinpoint.profiler.metadata.Result in project pinpoint by naver.

the class SimpleCacheTest method put.

@Test
public void put() {
    SimpleCache<String> cache = new SimpleCache<String>();
    Result test = cache.put("test");
    Assert.assertEquals(-1, test.getId());
    Assert.assertTrue(test.isNewValue());
    Result recheck = cache.put("test");
    Assert.assertEquals(test.getId(), recheck.getId());
    Assert.assertFalse(recheck.isNewValue());
    Result newValue = cache.put("new");
    Assert.assertEquals(1, newValue.getId());
    Assert.assertTrue(newValue.isNewValue());
}
Also used : SimpleCache(com.navercorp.pinpoint.profiler.metadata.SimpleCache) Result(com.navercorp.pinpoint.profiler.metadata.Result) Test(org.junit.Test)

Example 4 with Result

use of com.navercorp.pinpoint.profiler.metadata.Result in project pinpoint by naver.

the class MockApiMetaDataService method cacheApi.

@Override
public int cacheApi(final MethodDescriptor methodDescriptor) {
    final String fullName = methodDescriptor.getFullName();
    final Result result = this.apiCache.put(fullName);
    methodDescriptor.setApiId(result.getId());
    final ApiMetaData apiMetadata = new ApiMetaData(result.getId(), methodDescriptor.getApiDescriptor(), methodDescriptor.getLineNumber(), methodDescriptor.getType());
    this.enhancedDataSender.request(apiMetadata);
    return result.getId();
}
Also used : ApiMetaData(com.navercorp.pinpoint.profiler.metadata.ApiMetaData) Result(com.navercorp.pinpoint.profiler.metadata.Result)

Aggregations

Result (com.navercorp.pinpoint.profiler.metadata.Result)4 SimpleCache (com.navercorp.pinpoint.profiler.metadata.SimpleCache)3 Test (org.junit.Test)3 ApiMetaData (com.navercorp.pinpoint.profiler.metadata.ApiMetaData)1