Search in sources :

Example 16 with ConnectionInfo

use of org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo in project incubator-skywalking by apache.

the class URLParserTest method testParseH2JDBCURLWithMemoryMode.

@Test
public void testParseH2JDBCURLWithMemoryMode() {
    ConnectionInfo connectionInfo = new URLParser().parser("jdbc:h2:mem:test_mem");
    assertThat(connectionInfo.getDBType(), is("H2"));
    assertThat(connectionInfo.getDatabaseName(), is("test_mem"));
    assertThat(connectionInfo.getDatabasePeer(), is("localhost:-1"));
}
Also used : ConnectionInfo(org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo) Test(org.junit.Test)

Example 17 with ConnectionInfo

use of org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo in project incubator-skywalking by apache.

the class URLParserTest method testParseOracleTNSName.

@Test
public void testParseOracleTNSName() {
    ConnectionInfo connectionInfo = new URLParser().parser("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST= localhost )(PORT= 1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)))");
    assertThat(connectionInfo.getDBType(), is("Oracle"));
    assertThat(connectionInfo.getDatabaseName(), is("orcl"));
    assertThat(connectionInfo.getDatabasePeer(), is("localhost:1521"));
}
Also used : ConnectionInfo(org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo) Test(org.junit.Test)

Example 18 with ConnectionInfo

use of org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo in project incubator-skywalking by apache.

the class URLParserTest method testParseMysqlJDBCURLWithHost.

@Test
public void testParseMysqlJDBCURLWithHost() {
    ConnectionInfo connectionInfo = new URLParser().parser("jdbc:mysql//primaryhost/test");
    assertThat(connectionInfo.getDBType(), is("Mysql"));
    assertThat(connectionInfo.getDatabaseName(), is("test"));
    assertThat(connectionInfo.getDatabasePeer(), is("primaryhost:3306"));
}
Also used : ConnectionInfo(org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo) Test(org.junit.Test)

Example 19 with ConnectionInfo

use of org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo in project incubator-skywalking by apache.

the class URLParserTest method testParseH2JDBCURLWithEmbedded.

@Test
public void testParseH2JDBCURLWithEmbedded() {
    ConnectionInfo connectionInfo = new URLParser().parser("jdbc:h2:file:/data/sample");
    assertThat(connectionInfo.getDBType(), is("H2"));
    assertThat(connectionInfo.getDatabaseName(), is("/data/sample"));
    assertThat(connectionInfo.getDatabasePeer(), is("localhost:-1"));
}
Also used : ConnectionInfo(org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo) Test(org.junit.Test)

Example 20 with ConnectionInfo

use of org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo in project incubator-skywalking by apache.

the class URLParserTest method testParseH2JDBCURLWithEmbeddedRunningInWindows.

@Test
public void testParseH2JDBCURLWithEmbeddedRunningInWindows() {
    ConnectionInfo connectionInfo = new URLParser().parser("jdbc:h2:file:C:/data/sample");
    assertThat(connectionInfo.getDBType(), is("H2"));
    assertThat(connectionInfo.getDatabaseName(), is("C:/data/sample"));
    assertThat(connectionInfo.getDatabasePeer(), is("localhost:-1"));
}
Also used : ConnectionInfo(org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo) Test(org.junit.Test)

Aggregations

ConnectionInfo (org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo)21 Test (org.junit.Test)14 AbstractSpan (org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan)7 StatementEnhanceInfos (org.apache.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos)6