Search in sources :

Example 1 with SimpleCache

use of com.navercorp.pinpoint.profiler.metadata.SimpleCache 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 SimpleCache

use of com.navercorp.pinpoint.profiler.metadata.SimpleCache 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 SimpleCache

use of com.navercorp.pinpoint.profiler.metadata.SimpleCache 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)

Aggregations

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