Search in sources :

Example 11 with ParsingResult

use of com.navercorp.pinpoint.bootstrap.context.ParsingResult in project pinpoint by naver.

the class DefaultSqlMetaDataServiceTest method cacheSql.

@Test
public void cacheSql() throws Exception {
    final EnhancedDataSender dataSender = mock(EnhancedDataSender.class);
    final SqlMetaDataService sqlMetaDataService = new DefaultSqlMetaDataService("agentId", System.currentTimeMillis(), dataSender, 100);
    final String sql = "select * from A";
    final ParsingResult parsingResult = sqlMetaDataService.parseSql(sql);
    boolean newValue = sqlMetaDataService.cacheSql(parsingResult);
    Assert.assertTrue(newValue);
    verify(dataSender, times(1)).request(any(TBase.class));
    boolean notNewValue = sqlMetaDataService.cacheSql(parsingResult);
    Assert.assertFalse(notNewValue);
    verify(dataSender, times(1)).request(any(TBase.class));
}
Also used : ParsingResult(com.navercorp.pinpoint.bootstrap.context.ParsingResult) EnhancedDataSender(com.navercorp.pinpoint.profiler.sender.EnhancedDataSender) TBase(org.apache.thrift.TBase) Test(org.junit.Test)

Aggregations

ParsingResult (com.navercorp.pinpoint.bootstrap.context.ParsingResult)11 ParsingResultAccessor (com.navercorp.pinpoint.bootstrap.plugin.jdbc.ParsingResultAccessor)6 DatabaseInfo (com.navercorp.pinpoint.bootstrap.context.DatabaseInfo)4 DatabaseInfoAccessor (com.navercorp.pinpoint.bootstrap.plugin.jdbc.DatabaseInfoAccessor)4 UnKnownDatabaseInfo (com.navercorp.pinpoint.bootstrap.plugin.jdbc.UnKnownDatabaseInfo)4 Test (org.junit.Test)3 RegularStatement (com.datastax.driver.core.RegularStatement)2 SpanEventRecorder (com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder)2 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)2 BindValueAccessor (com.navercorp.pinpoint.bootstrap.plugin.jdbc.BindValueAccessor)2 CachingSqlNormalizer (com.navercorp.pinpoint.profiler.metadata.CachingSqlNormalizer)2 DefaultCachingSqlNormalizer (com.navercorp.pinpoint.profiler.metadata.DefaultCachingSqlNormalizer)2 BoundStatement (com.datastax.driver.core.BoundStatement)1 EnhancedDataSender (com.navercorp.pinpoint.profiler.sender.EnhancedDataSender)1 TBase (org.apache.thrift.TBase)1