use of org.apache.camel.Endpoint in project camel by apache.
the class KafkaSpanDecoratorTest method testGetDestinationNoHeaderTopic.
@Test
public void testGetDestinationNoHeaderTopic() {
Exchange exchange = Mockito.mock(Exchange.class);
Message message = Mockito.mock(Message.class);
Endpoint endpoint = Mockito.mock(Endpoint.class);
Mockito.when(exchange.getIn()).thenReturn(message);
Mockito.when(endpoint.getEndpointUri()).thenReturn("kafka:localhost:9092?topic=test&groupId=testing&consumersCount=1");
KafkaSpanDecorator decorator = new KafkaSpanDecorator();
assertEquals("test", decorator.getDestination(exchange, endpoint));
}
use of org.apache.camel.Endpoint in project camel by apache.
the class KafkaSpanDecoratorTest method testPre.
@Test
public void testPre() {
String testKey = "TestKey";
String testOffset = "TestOffset";
String testPartition = "TestPartition";
String testPartitionKey = "TestPartitionKey";
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(KafkaSpanDecorator.KEY)).thenReturn(testKey);
Mockito.when(message.getHeader(KafkaSpanDecorator.OFFSET)).thenReturn(testOffset);
Mockito.when(message.getHeader(KafkaSpanDecorator.PARTITION)).thenReturn(testPartition);
Mockito.when(message.getHeader(KafkaSpanDecorator.PARTITION_KEY)).thenReturn(testPartitionKey);
SpanDecorator decorator = new KafkaSpanDecorator();
MockTracer tracer = new MockTracer();
MockSpan span = tracer.buildSpan("TestSpan").start();
decorator.pre(span, exchange, endpoint);
assertEquals(testKey, span.tags().get(KafkaSpanDecorator.KAFKA_KEY_TAG));
assertEquals(testOffset, span.tags().get(KafkaSpanDecorator.KAFKA_OFFSET_TAG));
assertEquals(testPartition, span.tags().get(KafkaSpanDecorator.KAFKA_PARTITION_TAG));
assertEquals(testPartitionKey, span.tags().get(KafkaSpanDecorator.KAFKA_PARTITION_KEY_TAG));
}
use of org.apache.camel.Endpoint in project camel by apache.
the class MongoDBSpanDecoratorTest method testPre.
@Test
public void testPre() {
Endpoint endpoint = Mockito.mock(Endpoint.class);
Mockito.when(endpoint.getEndpointUri()).thenReturn(MONGODB_STATEMENT);
SpanDecorator decorator = new MongoDBSpanDecorator();
MockTracer tracer = new MockTracer();
MockSpan span = (MockSpan) tracer.buildSpan("TestSpan").start();
decorator.pre(span, null, endpoint);
assertEquals("mongodb", span.tags().get(Tags.DB_TYPE.getKey()));
assertEquals("flights", span.tags().get(Tags.DB_INSTANCE.getKey()));
assertTrue(span.tags().containsKey(Tags.DB_STATEMENT.getKey()));
}
use of org.apache.camel.Endpoint in project camel by apache.
the class MqttSpanDecoratorTest method testGetDestinationPublish.
@Test
public void testGetDestinationPublish() {
Endpoint endpoint = Mockito.mock(Endpoint.class);
Mockito.when(endpoint.getEndpointUri()).thenReturn("mqtt://hello?publishTopicName=world");
MqttSpanDecorator decorator = new MqttSpanDecorator();
assertEquals("world", decorator.getDestination(null, endpoint));
}
use of org.apache.camel.Endpoint in project camel by apache.
the class StompSpanDecoratorTest method testGetDestination.
@Test
public void testGetDestination() {
Endpoint endpoint = Mockito.mock(Endpoint.class);
Mockito.when(endpoint.getEndpointUri()).thenReturn("stomp:queue:test");
StompSpanDecorator decorator = new StompSpanDecorator();
assertEquals("test", decorator.getDestination(null, endpoint));
}
Aggregations