Search in sources :

Example 1 with ConnectionInfo

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

the class URLParserTest method testParseMysqlJDBCURLWithMultiHost.

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

Example 2 with ConnectionInfo

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

the class URLParserTest method testParseOracleJDBCURLWithUserNameAndPassword.

@Test
public void testParseOracleJDBCURLWithUserNameAndPassword() {
    ConnectionInfo connectionInfo = new URLParser().parser("jdbc:oracle:thin:scott/tiger@myhost:1521:orcl");
    assertThat(connectionInfo.getDBType(), is("Oracle"));
    assertThat(connectionInfo.getDatabaseName(), is("orcl"));
    assertThat(connectionInfo.getDatabasePeer(), is("myhost:1521"));
}
Also used : ConnectionInfo(org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo) Test(org.junit.Test)

Example 3 with ConnectionInfo

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

the class URLParserTest method testParseMysqlJDBCURLWithConnectorJs.

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

Example 4 with ConnectionInfo

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

the class URLParserTest method testParseOracleJDBCURLWithHost.

@Test
public void testParseOracleJDBCURLWithHost() {
    ConnectionInfo connectionInfo = new URLParser().parser("jdbc:oracle:thin:@localhost: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 5 with ConnectionInfo

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

the class URLParserTest method testParseOracleJDBCURLWithHostAndPort.

@Test
public void testParseOracleJDBCURLWithHostAndPort() {
    ConnectionInfo connectionInfo = new URLParser().parser("jdbc:oracle:thin:@localhost:1522:orcl");
    assertThat(connectionInfo.getDBType(), is("Oracle"));
    assertThat(connectionInfo.getDatabaseName(), is("orcl"));
    assertThat(connectionInfo.getDatabasePeer(), is("localhost:1522"));
}
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