use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class PostgreSqlUrlParserTest method postgresqlParseCookierunSlave.
@Test
public void postgresqlParseCookierunSlave() {
DatabaseInfo dbInfo = jdbcUrlParser.parse("jdbc:postgresql:loadbalance://10.118.222.35:5605/db_cookierun?useUnicode=true&characterEncoding=UTF-8&noAccessToProcedureBodies=true&autoDeserialize=true&elideSetAutoCommits=true&sessionVariables=time_zone='%2B09:00',tx_isolation='READ-UNCOMMITTED'");
Assert.assertTrue(dbInfo.isParsingComplete());
Assert.assertEquals(dbInfo.getType(), PostgreSqlConstants.POSTGRESQL);
Assert.assertEquals(dbInfo.getHost().get(0), "10.118.222.35:5605");
Assert.assertEquals(dbInfo.getDatabaseId(), "db_cookierun");
Assert.assertEquals(dbInfo.getUrl(), "jdbc:postgresql:loadbalance://10.118.222.35:5605/db_cookierun");
logger.info(dbInfo.toString());
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class PostgreSqlUrlParserTest method parseFailTest2.
@Test
public void parseFailTest2() {
DatabaseInfo dbInfo = jdbcUrlParser.parse("jdbc:mysql://10.115.8.209:5605/db_cookierun?useUnicode=true&characterEncoding=UTF-8&noAccessToProcedureBodies=true&autoDeserialize=true&elideSetAutoCommits=true&sessionVariables=time_zone='%2B09:00',tx_isolation='READ-COMMITTED'");
Assert.assertFalse(dbInfo.isParsingComplete());
Assert.assertEquals(ServiceType.UNKNOWN_DB, dbInfo.getType());
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class DefaultJdbcUrlParsingService method getDatabaseInfo.
@Override
public DatabaseInfo getDatabaseInfo(ServiceType serviceType, String jdbcUrl) {
CacheKey cacheKey = new CacheKey(serviceType, jdbcUrl);
DatabaseInfo databaseInfo = eachServiceTypeCache.get(cacheKey);
if (databaseInfo != null && databaseInfo.isParsingComplete()) {
return databaseInfo;
}
return null;
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class DefaultJdbcUrlParsingServiceTest method cacheTest2.
@Test
public void cacheTest2() throws Exception {
JdbcUrlParsingService jdbcUrlParsingService = new DefaultJdbcUrlParsingService(Arrays.asList(jdbcUrlParser));
DatabaseInfo parsingResult = jdbcUrlParsingService.parseJdbcUrl(ServiceType.TEST, MYSQL_JDBC_URL);
Assert.assertTrue(parsingResult.isParsingComplete());
DatabaseInfo cache1 = jdbcUrlParsingService.getDatabaseInfo(ServiceType.TEST, MYSQL_JDBC_URL);
DatabaseInfo cache2 = jdbcUrlParsingService.getDatabaseInfo(ServiceType.UNKNOWN_DB, MYSQL_JDBC_URL);
Assert.assertNotEquals(cache1, cache2);
}
Aggregations