Search in sources :

Example 1 with CachingSqlNormalizer

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

the class DefaultCachingSqlNormalizerTest method testNormalizedSql_cache_expire.

@Test
public void testNormalizedSql_cache_expire() throws Exception {
    CachingSqlNormalizer normalizer = new DefaultCachingSqlNormalizer(1);
    ParsingResult parsingResult = normalizer.wrapSql("select * from table1");
    boolean newCache = normalizer.normalizedSql(parsingResult);
    Assert.assertTrue("newCacheState", newCache);
    // cache expire
    ParsingResult parsingResult2 = normalizer.wrapSql("select * from table2");
    boolean cached = normalizer.normalizedSql(parsingResult2);
    Assert.assertTrue(cached);
    ParsingResult parsingResult1_recached = normalizer.wrapSql("select * from table3");
    boolean newCache_parsingResult1_recached = normalizer.normalizedSql(parsingResult1_recached);
    Assert.assertTrue(newCache_parsingResult1_recached);
}
Also used : ParsingResult(com.navercorp.pinpoint.bootstrap.context.ParsingResult) CachingSqlNormalizer(com.navercorp.pinpoint.profiler.metadata.CachingSqlNormalizer) DefaultCachingSqlNormalizer(com.navercorp.pinpoint.profiler.metadata.DefaultCachingSqlNormalizer) DefaultCachingSqlNormalizer(com.navercorp.pinpoint.profiler.metadata.DefaultCachingSqlNormalizer) Test(org.junit.Test)

Example 2 with CachingSqlNormalizer

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

the class DefaultCachingSqlNormalizerTest method testNormalizedSql.

@Test
public void testNormalizedSql() throws Exception {
    CachingSqlNormalizer normalizer = new DefaultCachingSqlNormalizer(1);
    ParsingResult parsingResult = normalizer.wrapSql("select * from dual");
    boolean newCache = normalizer.normalizedSql(parsingResult);
    Assert.assertTrue("newCacheState", newCache);
    boolean notCached = normalizer.normalizedSql(parsingResult);
    Assert.assertFalse("alreadyCached", notCached);
    ParsingResult alreadyCached = normalizer.wrapSql("select * from dual");
    boolean notCached2 = normalizer.normalizedSql(alreadyCached);
    Assert.assertFalse("alreadyCached2", notCached2);
}
Also used : ParsingResult(com.navercorp.pinpoint.bootstrap.context.ParsingResult) CachingSqlNormalizer(com.navercorp.pinpoint.profiler.metadata.CachingSqlNormalizer) DefaultCachingSqlNormalizer(com.navercorp.pinpoint.profiler.metadata.DefaultCachingSqlNormalizer) DefaultCachingSqlNormalizer(com.navercorp.pinpoint.profiler.metadata.DefaultCachingSqlNormalizer) Test(org.junit.Test)

Aggregations

ParsingResult (com.navercorp.pinpoint.bootstrap.context.ParsingResult)2 CachingSqlNormalizer (com.navercorp.pinpoint.profiler.metadata.CachingSqlNormalizer)2 DefaultCachingSqlNormalizer (com.navercorp.pinpoint.profiler.metadata.DefaultCachingSqlNormalizer)2 Test (org.junit.Test)2