use of org.apache.skywalking.apm.agent.core.context.trace.TraceSegment in project incubator-skywalking by apache.
the class SWConnectionTest method testCloseWithException.
@Test(expected = SQLException.class)
public void testCloseWithException() throws SQLException {
doThrow(new SQLException()).when(jdbcConnection).close();
swConnection.close();
assertThat(segmentStorage.getTraceSegments().size(), is(1));
TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0);
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment);
assertThat(spans.size(), is(1));
assertDBSpan(spans.get(0), "Mysql/JDBI/Connection/close");
assertDBSpanLog(SpanHelper.getLogs(spans.get(0)).get(0));
}
use of org.apache.skywalking.apm.agent.core.context.trace.TraceSegment in project incubator-skywalking by apache.
the class SWConnectionTest method testRollBackWithException.
@Test(expected = SQLException.class)
public void testRollBackWithException() throws SQLException {
doThrow(new SQLException()).when(jdbcConnection).rollback();
swConnection.rollback();
assertThat(segmentStorage.getTraceSegments().size(), is(1));
TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0);
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment);
assertThat(spans.size(), is(1));
assertDBSpan(spans.get(0), "Mysql/JDBI/Connection/rollback");
}
use of org.apache.skywalking.apm.agent.core.context.trace.TraceSegment in project incubator-skywalking by apache.
the class SWConnectionTest method testRollBackWithSavePointWithException.
@Test(expected = SQLException.class)
public void testRollBackWithSavePointWithException() throws SQLException {
doThrow(new SQLException()).when(jdbcConnection).rollback(any(Savepoint.class));
swConnection.rollback(savepoint);
assertThat(segmentStorage.getTraceSegments().size(), is(1));
TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0);
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment);
assertThat(spans.size(), is(1));
assertDBSpan(spans.get(0), "Mysql/JDBI/Connection/rollback to savepoint");
assertDBSpanLog(SpanHelper.getLogs(spans.get(0)).get(0));
}
use of org.apache.skywalking.apm.agent.core.context.trace.TraceSegment in project incubator-skywalking by apache.
the class SWConnectionTest method testMultiHostReleaseSavePoint.
@Test
public void testMultiHostReleaseSavePoint() throws SQLException {
multiHostConnection.releaseSavepoint(savepoint);
assertThat(segmentStorage.getTraceSegments().size(), is(1));
TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0);
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment);
assertThat(spans.size(), is(1));
assertDBSpan(spans.get(0), "Mysql/JDBI/Connection/releaseSavepoint savepoint");
}
use of org.apache.skywalking.apm.agent.core.context.trace.TraceSegment in project incubator-skywalking by apache.
the class SWConnectionTest method testMultiHostRollBack.
@Test
public void testMultiHostRollBack() throws SQLException {
PreparedStatement preparedStatement = swConnection.prepareStatement("SELECT * FROM test", 1, 1, 1);
multiHostConnection.rollback();
assertThat(segmentStorage.getTraceSegments().size(), is(1));
TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0);
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment);
assertThat(spans.size(), is(1));
assertDBSpan(spans.get(0), "Mysql/JDBI/Connection/rollback");
}
Aggregations