use of org.apache.activemq.command.ActiveMQTextMessage in project brave by openzipkin.
the class TracingMessageListenerTest method listener_reports_span_if_fails.
@Test
public void listener_reports_span_if_fails() {
ActiveMQTextMessage message = new ActiveMQTextMessage();
RuntimeException error = new RuntimeException("Test exception");
onMessageConsumeFailed(message, error);
testSpanHandler.takeRemoteSpan(CONSUMER);
assertThat(testSpanHandler.takeLocalSpan().error()).isEqualTo(error);
}
use of org.apache.activemq.command.ActiveMQTextMessage in project brave by openzipkin.
the class TracingMessageListenerTest method consumer_has_remote_service_name.
@Test
public void consumer_has_remote_service_name() {
ActiveMQTextMessage message = new ActiveMQTextMessage();
onMessageConsumed(message);
assertThat(testSpanHandler.takeRemoteSpan(CONSUMER).remoteServiceName()).isEqualTo(jmsTracing.remoteServiceName);
testSpanHandler.takeLocalSpan();
}
use of org.apache.activemq.command.ActiveMQTextMessage in project brave by openzipkin.
the class TracingMessageListenerTest method retains_baggage_headers.
@Test
public void retains_baggage_headers() throws Exception {
ActiveMQTextMessage message = new ActiveMQTextMessage();
B3Propagation.B3_STRING.injector(SETTER).inject(parent, message);
message.setStringProperty(BAGGAGE_FIELD_KEY, "");
onMessageConsumed(message);
assertThat(message.getProperties()).hasSize(// clears b3
1).containsEntry(BAGGAGE_FIELD_KEY, "");
testSpanHandler.takeRemoteSpan(CONSUMER);
testSpanHandler.takeLocalSpan();
}
use of org.apache.activemq.command.ActiveMQTextMessage in project brave by openzipkin.
the class TracingMessageListenerTest method listener_continues_parent_trace_single_header.
@Test
public void listener_continues_parent_trace_single_header() {
tracingMessageListener = new TracingMessageListener(delegate, jmsTracing, false);
ActiveMQTextMessage message = new ActiveMQTextMessage();
setStringProperty(message, "b3", B3SingleFormat.writeB3SingleFormatWithoutParentId(parent));
onMessageConsumed(message);
// clearing headers ensures later work doesn't try to use the old parent
assertNoProperties(message);
assertChildOf(testSpanHandler.takeLocalSpan(), parent);
}
use of org.apache.activemq.command.ActiveMQTextMessage in project brave by openzipkin.
the class TracingMessageListenerTest method reports_span_if_consume_fails_with_no_message.
@Test
public void reports_span_if_consume_fails_with_no_message() {
ActiveMQTextMessage message = new ActiveMQTextMessage();
RuntimeException error = new RuntimeException("Test exception");
onMessageConsumeFailed(message, error);
testSpanHandler.takeRemoteSpan(CONSUMER);
assertThat(testSpanHandler.takeLocalSpan().error()).isEqualTo(error);
}
Aggregations