use of com.navercorp.pinpoint.profiler.sender.EnhancedDataSender 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));
}
use of com.navercorp.pinpoint.profiler.sender.EnhancedDataSender in project pinpoint by naver.
the class DefaultStringMetaDataServiceTest method cacheString.
@Test
public void cacheString() throws Exception {
EnhancedDataSender dataSender = mock(EnhancedDataSender.class);
StringMetaDataService stringMetaDataService = new DefaultStringMetaDataService("agentId", System.currentTimeMillis(), dataSender);
String str = "test";
int first = stringMetaDataService.cacheString(str);
Assert.assertNotEquals("not exist", first, 0);
verify(dataSender, times(1)).request(any(TBase.class));
int second = stringMetaDataService.cacheString(str);
Assert.assertEquals("check cache", first, second);
verify(dataSender, times(1)).request(any(TBase.class));
}
Aggregations