use of org.apache.camel.opentracing.SpanDecorator in project camel by apache.
the class JdbcSpanDecoratorTest method testPre.
@Test
public void testPre() {
Endpoint endpoint = Mockito.mock(Endpoint.class);
Exchange exchange = Mockito.mock(Exchange.class);
Message message = Mockito.mock(Message.class);
Mockito.when(endpoint.getEndpointUri()).thenReturn("test");
Mockito.when(exchange.getIn()).thenReturn(message);
Mockito.when(message.getBody()).thenReturn(SQL_STATEMENT);
SpanDecorator decorator = new JdbcSpanDecorator();
MockTracer tracer = new MockTracer();
MockSpan span = (MockSpan) tracer.buildSpan("TestSpan").start();
decorator.pre(span, exchange, endpoint);
assertEquals("sql", span.tags().get(Tags.DB_TYPE.getKey()));
assertEquals(SQL_STATEMENT, span.tags().get(Tags.DB_STATEMENT.getKey()));
}
use of org.apache.camel.opentracing.SpanDecorator in project camel by apache.
the class MongoDBSpanDecoratorTest method testGetOperationName.
@Test
public void testGetOperationName() {
Endpoint endpoint = Mockito.mock(Endpoint.class);
Mockito.when(endpoint.getEndpointUri()).thenReturn(MONGODB_STATEMENT);
SpanDecorator decorator = new MongoDBSpanDecorator();
assertEquals("findOneByQuery", decorator.getOperationName(null, endpoint));
}
use of org.apache.camel.opentracing.SpanDecorator in project camel by apache.
the class SqlSpanDecoratorTest method testPre.
@Test
public void testPre() {
Endpoint endpoint = Mockito.mock(Endpoint.class);
Exchange exchange = Mockito.mock(Exchange.class);
Message message = Mockito.mock(Message.class);
Mockito.when(endpoint.getEndpointUri()).thenReturn("test");
Mockito.when(exchange.getIn()).thenReturn(message);
Mockito.when(message.getHeader(SqlSpanDecorator.CAMEL_SQL_QUERY)).thenReturn(SQL_STATEMENT);
SpanDecorator decorator = new SqlSpanDecorator();
MockTracer tracer = new MockTracer();
MockSpan span = (MockSpan) tracer.buildSpan("TestSpan").start();
decorator.pre(span, exchange, endpoint);
assertEquals("sql", span.tags().get(Tags.DB_TYPE.getKey()));
assertEquals(SQL_STATEMENT, span.tags().get(Tags.DB_STATEMENT.getKey()));
}
Aggregations