use of io.opentracing.mock.MockTracer 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 io.opentracing.mock.MockTracer 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()));
}
use of io.opentracing.mock.MockTracer in project tomee by apache.
the class MicroProfileOpenTracingTCKDeploymentPackager method generateDeployment.
@Override
public Archive<?> generateDeployment(final TestDeployment testDeployment, final Collection<ProtocolArchiveProcessor> processors) {
final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "microprofile-opentracing.war").merge(testDeployment.getApplicationArchive());
// opentracing-api jar added by Geronimo Impl. Also added by TCK causes issues with same classes in different Classloaders
final Map<ArchivePath, Node> content = webArchive.getContent(object -> object.get().matches(".*opentracing-api.*jar.*"));
content.forEach((archivePath, node) -> webArchive.delete(archivePath));
// TCK expects a MockTracer. Check org/eclipse/microprofile/opentracing/tck/application/TracerWebService.java:133
webArchive.addAsLibrary(jarLocation(MockTracer.class));
webArchive.addAsLibrary(jarLocation(ThreadLocalScopeManager.class));
webArchive.addAsWebInfResource("META-INF/beans.xml");
webArchive.addClass(MicroProfileOpenTracingTCKTracer.class);
System.out.println(webArchive.toString(true));
return super.generateDeployment(new TestDeployment(null, webArchive, testDeployment.getAuxiliaryArchives()), processors);
}
use of io.opentracing.mock.MockTracer in project cxf by apache.
the class OpenTracingContextTest method setUp.
@Before
public void setUp() {
tracer = new MockTracer();
context = new OpenTracingContext(tracer);
}
use of io.opentracing.mock.MockTracer in project ballerina by ballerina-lang.
the class GetFinishedSpansCount method execute.
@Override
public void execute(Context context) {
List<MockTracer> mockTracer = BMockTracer.getTracerMap();
final int[] count = { 0 };
mockTracer.forEach((tracer) -> count[0] += tracer.finishedSpans().size());
context.setReturnValues(new BInteger(count[0]));
}
Aggregations