use of org.apache.camel.Endpoint in project camel by apache.
the class AbstractSpanDecoratorTest method testStripSchemeNoOptionsWithSlashes.
@Test
public void testStripSchemeNoOptionsWithSlashes() {
Endpoint endpoint = Mockito.mock(Endpoint.class);
Mockito.when(endpoint.getEndpointUri()).thenReturn("direct://hello");
assertEquals("hello", AbstractSpanDecorator.stripSchemeAndOptions(endpoint));
}
use of org.apache.camel.Endpoint in project camel by apache.
the class AbstractSpanDecoratorTest method testStripSchemeAndOptions.
@Test
public void testStripSchemeAndOptions() {
Endpoint endpoint = Mockito.mock(Endpoint.class);
Mockito.when(endpoint.getEndpointUri()).thenReturn("direct:hello?world=true");
assertEquals("hello", AbstractSpanDecorator.stripSchemeAndOptions(endpoint));
}
use of org.apache.camel.Endpoint in project camel by apache.
the class CometdSpanDecoratorTest method testGetDestination.
@Test
public void testGetDestination() {
Endpoint endpoint = Mockito.mock(Endpoint.class);
Mockito.when(endpoint.getEndpointUri()).thenReturn("cometd://localhost:8080/MyQueue?hello=world");
CometdSpanDecorator decorator = new CometdSpanDecorator();
assertEquals("MyQueue", decorator.getDestination(null, endpoint));
}
use of org.apache.camel.Endpoint in project camel by apache.
the class CqlSpanDecoratorTest method testPreCqlFromHeader.
@Test
public void testPreCqlFromHeader() {
String cql = "select * from users";
Endpoint endpoint = Mockito.mock(Endpoint.class);
Exchange exchange = Mockito.mock(Exchange.class);
Message message = Mockito.mock(Message.class);
Mockito.when(endpoint.getEndpointUri()).thenReturn("cql://host1,host2?consistencyLevel=quorum");
Mockito.when(exchange.getIn()).thenReturn(message);
Mockito.when(message.getHeader(CqlSpanDecorator.CAMEL_CQL_QUERY)).thenReturn(cql);
SpanDecorator decorator = new CqlSpanDecorator();
MockTracer tracer = new MockTracer();
MockSpan span = (MockSpan) tracer.buildSpan("TestSpan").start();
decorator.pre(span, exchange, endpoint);
assertEquals(CqlSpanDecorator.CASSANDRA_DB_TYPE, span.tags().get(Tags.DB_TYPE.getKey()));
assertEquals(cql, span.tags().get(Tags.DB_STATEMENT.getKey()));
assertNull(span.tags().get(Tags.DB_INSTANCE.getKey()));
}
use of org.apache.camel.Endpoint in project camel by apache.
the class ElasticsearchSpanDecoratorTest method testOperationName.
@Test
public void testOperationName() {
String opName = "INDEX";
Endpoint endpoint = Mockito.mock(Endpoint.class);
Mockito.when(endpoint.getEndpointUri()).thenReturn("elasticsearch://local?operation=" + opName + "&indexName=twitter&indexType=tweet");
SpanDecorator decorator = new ElasticsearchSpanDecorator();
assertEquals(opName, decorator.getOperationName(null, endpoint));
}
Aggregations