}
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceSpringIntegrationAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceSpringIntegrationAutoConfiguration.java
index 0512b09e8..c54eff54e 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceSpringIntegrationAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TraceSpringIntegrationAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.instrument.messaging;
import brave.Tracing;
import brave.propagation.Propagation;
+
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptor.java
index e8c720a0b..a8ef63337 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptor.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@ import brave.propagation.TraceContext;
import brave.propagation.TraceContextOrSamplingFlags;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.util.SpanNameUtil;
@@ -55,10 +56,18 @@ import org.springframework.util.ClassUtils;
* This implementation uses {@link ThreadLocalSpan} to propagate context between
* callbacks. This is an alternative to {@code ThreadStatePropagationChannelInterceptor}
* which is less sensitive to message manipulation by other interceptors.
+ *
+ * @author Marcin Grzejszczak
*/
public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
implements ExecutorChannelInterceptor {
+ /**
+ * Name of the class in Spring Cloud Stream that is a direct channel.
+ */
+ public static final String STREAM_DIRECT_CHANNEL = "org.springframework."
+ + "cloud.stream.messaging.DirectWithAttributesChannel";
+
private static final Log log = LogFactory.getLog(TracingChannelInterceptor.class);
/**
@@ -81,8 +90,6 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
*/
private static final String REMOTE_SERVICE_NAME = "broker";
- public static final String STREAM_DIRECT_CHANNEL = "org.springframework.cloud.stream.messaging.DirectWithAttributesChannel";
-
final Tracing tracing;
final Tracer tracer;
@@ -134,6 +141,8 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
*
* This creates a child from identifiers extracted from the message headers, or a new
* span if one couldn't be extracted.
+ * @param message message to use for span creation
+ * @return span to be created
*/
public Span nextSpan(Message> message) {
MessageHeaderAccessor headers = mutableHeaderAccessor(message);
@@ -329,7 +338,10 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
}
/**
- * When an upstream context was not present, lookup keys are unlikely added
+ * When an upstream context was not present, lookup keys are unlikely added.
+ * @param message a message to append tags to
+ * @param result span to customize
+ * @param channel channel to which a message was sent
*/
void addTags(Message> message, SpanCustomizer result, MessageChannel channel) {
// TODO topic etc
@@ -360,12 +372,14 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
void finishSpan(Exception error) {
Span span = this.threadLocalSpan.remove();
- if (span == null || span.isNoop())
+ if (span == null || span.isNoop()) {
return;
+ }
if (error != null) { // an error occurred, adding error to span
String message = error.getMessage();
- if (message == null)
+ if (message == null) {
message = error.getClass().getSimpleName();
+ }
span.tag("error", message);
}
span.finish();
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingConnectionFactoryBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingConnectionFactoryBeanPostProcessor.java
index 9943ff9e6..718a3209e 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingConnectionFactoryBeanPostProcessor.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingConnectionFactoryBeanPostProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ import org.springframework.jms.listener.endpoint.JmsMessageEndpointManager;
import org.springframework.lang.Nullable;
/**
- * {@link BeanPostProcessor} wrapping around JMS {@link ConnectionFactory}
+ * {@link BeanPostProcessor} wrapping around JMS {@link ConnectionFactory}.
*
* @author Adrian Cole
* @since 2.1.0
@@ -134,14 +134,16 @@ class LazyXAConnectionFactory implements XAConnectionFactory {
if (this.jmsTracing != null) {
return this.jmsTracing;
}
- return this.jmsTracing = this.beanFactory.getBean(JmsTracing.class);
+ this.jmsTracing = this.beanFactory.getBean(JmsTracing.class);
+ return this.jmsTracing;
}
private XAConnectionFactory wrappedDelegate() {
if (this.wrappedDelegate != null) {
return this.wrappedDelegate;
}
- return this.wrappedDelegate = jmsTracing().xaConnectionFactory(this.delegate);
+ this.wrappedDelegate = jmsTracing().xaConnectionFactory(this.delegate);
+ return this.wrappedDelegate;
}
}
@@ -195,14 +197,16 @@ class LazyConnectionFactory implements ConnectionFactory {
if (this.jmsTracing != null) {
return this.jmsTracing;
}
- return this.jmsTracing = this.beanFactory.getBean(JmsTracing.class);
+ this.jmsTracing = this.beanFactory.getBean(JmsTracing.class);
+ return this.jmsTracing;
}
private ConnectionFactory wrappedDelegate() {
if (this.wrappedDelegate != null) {
return this.wrappedDelegate;
}
- return this.wrappedDelegate = jmsTracing().connectionFactory(this.delegate);
+ this.wrappedDelegate = jmsTracing().connectionFactory(this.delegate);
+ return this.wrappedDelegate;
}
}
@@ -229,7 +233,8 @@ class LazyMessageListener implements MessageListener {
if (this.jmsTracing != null) {
return this.jmsTracing;
}
- return this.jmsTracing = this.beanFactory.getBean(JmsTracing.class);
+ this.jmsTracing = this.beanFactory.getBean(JmsTracing.class);
+ return this.jmsTracing;
}
private MessageListener wrappedDelegate() {
@@ -242,7 +247,7 @@ class LazyMessageListener implements MessageListener {
/**
* This ensures listeners end up continuing the trace from
- * {@link MessageConsumer#receive()}
+ * {@link MessageConsumer#receive()}.
*/
class TracingJmsListenerEndpointRegistry extends JmsListenerEndpointRegistry {
@@ -295,11 +300,14 @@ class TracingJmsListenerEndpointRegistry extends JmsListenerEndpointRegistry {
/**
* This wraps the {@link SimpleJmsListenerEndpoint#getMessageListener()} delegate in a
* new span.
+ * @param source jms endpoint
+ * @return wrapped endpoint
*/
SimpleJmsListenerEndpoint trace(SimpleJmsListenerEndpoint source) {
MessageListener delegate = source.getMessageListener();
- if (delegate == null)
+ if (delegate == null) {
return source;
+ }
source.setMessageListener(this.jmsTracing.messageListener(delegate, false));
return source;
}
@@ -315,6 +323,8 @@ class TracingJmsListenerEndpointRegistry extends JmsListenerEndpointRegistry {
* subtype could hold state we aren't aware of, or change behavior. We can consider
* checking that input is not a subtype, and most conservatively leaving unknown
* subtypes untraced.
+ * @param source jms endpoint
+ * @return wrapped endpoint
*/
MethodJmsListenerEndpoint trace(MethodJmsListenerEndpoint source) {
// Skip out rather than incompletely copying the source
@@ -360,7 +370,7 @@ class TracingJmsListenerEndpointRegistry extends JmsListenerEndpointRegistry {
}
/**
- * This wraps the message listener in a child span
+ * This wraps the message listener in a child span.
*/
final class TracingMessagingMessageListenerAdapter
extends MessagingMessageListenerAdapter {
@@ -390,4 +400,4 @@ final class TracingMessagingMessageListenerAdapter
}
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfiguration.java
index 076f9b9f4..ae590df42 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.springframework.cloud.sleuth.instrument.messaging.websocket;
import brave.Tracing;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
@@ -68,4 +69,4 @@ public class TraceWebSocketAutoConfiguration
registration.setInterceptors(TracingChannelInterceptor.create(this.tracing));
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/OpentracingAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/OpentracingAutoConfiguration.java
index 5961db938..fd0017066 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/OpentracingAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/OpentracingAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.cloud.sleuth.instrument.opentracing;
import brave.Tracing;
import brave.opentracing.BraveTracer;
import io.opentracing.Tracer;
+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/SleuthOpentracingProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/SleuthOpentracingProperties.java
index c4d157944..bbf7401eb 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/SleuthOpentracingProperties.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/opentracing/SleuthOpentracingProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/LazySpanSubscriber.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/LazySpanSubscriber.java
index 6634ae69e..ef477834e 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/LazySpanSubscriber.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/LazySpanSubscriber.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ReactorSleuth.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ReactorSleuth.java
index 82b5840b3..114bb33ef 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ReactorSleuth.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ReactorSleuth.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,15 +24,15 @@ import brave.Tracing;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.reactivestreams.Publisher;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.context.ConfigurableApplicationContext;
-
import reactor.core.CoreSubscriber;
import reactor.core.Fuseable;
import reactor.core.Scannable;
import reactor.core.publisher.Operators;
import reactor.util.context.Context;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.context.ConfigurableApplicationContext;
+
/**
* Reactive Span pointcuts factories.
*
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriber.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriber.java
index fc9b02d67..7f5a5b4be 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriber.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriber.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ package org.springframework.cloud.sleuth.instrument.reactor;
import javax.annotation.Nullable;
import brave.Span;
-import brave.Tracer;
import brave.Tracing;
import brave.propagation.CurrentTraceContext;
import brave.propagation.TraceContext;
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SleuthReactorProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SleuthReactorProperties.java
index 20b3ac634..76ab5ee3d 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SleuthReactorProperties.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SleuthReactorProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriber.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriber.java
index 8bad7e2dd..85dd4b050 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriber.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriber.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscription.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscription.java
index ce412d26e..1c7b81072 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscription.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscription.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,8 +25,8 @@ import reactor.core.Fuseable;
* (implementing {@link reactor.core.Fuseable.QueueSubscription} with default no-op
* methods and always negotiating fusion to be {@link Fuseable#NONE}).
*
+ * @param - type of the subscription
* @author Marcin Grzejszczak
- * @param - type of the subsciption
*/
interface SpanSubscription
extends Subscription, CoreSubscriber, Fuseable.QueueSubscription {
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriptionProvider.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriptionProvider.java
index d2a13ac8b..5e013cfc4 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriptionProvider.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriptionProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,9 +23,10 @@ import brave.Tracing;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.reactivestreams.Subscriber;
-import org.springframework.beans.factory.BeanFactory;
import reactor.util.context.Context;
+import org.springframework.beans.factory.BeanFactory;
+
/**
* Supplier to lazily start a {@link SpanSubscription}.
*
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfiguration.java
index 7b0a1b23a..035dbe3eb 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,11 +62,11 @@ public class TraceReactorAutoConfiguration {
@ConditionalOnBean(Tracing.class)
static class TraceReactorConfiguration {
- private static final Log log = LogFactory.getLog(TraceReactorConfiguration.class);
-
static final String SLEUTH_TRACE_REACTOR_KEY = TraceReactorConfiguration.class
.getName();
+ private static final Log log = LogFactory.getLog(TraceReactorConfiguration.class);
+
@Bean
// for tests
@ConditionalOnMissingBean
@@ -131,4 +131,4 @@ class HookRegisteringBeanDefinitionRegistryPostProcessor
};
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/RxJavaAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/RxJavaAutoConfiguration.java
index e95016566..b7fbd44cb 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/RxJavaAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/RxJavaAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,8 @@ import java.util.Arrays;
import brave.Tracer;
import brave.Tracing;
+import rx.plugins.RxJavaSchedulersHook;
+
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
@@ -28,7 +30,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import rx.plugins.RxJavaSchedulersHook;
/**
* {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHook.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHook.java
index 8125822cd..a498528d9 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHook.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHook.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersProperties.java
index a58424008..167019f45 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersProperties.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/SleuthSchedulingProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/SleuthSchedulingProperties.java
index d546d2b37..d91de8e64 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/SleuthSchedulingProperties.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/SleuthSchedulingProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAspect.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAspect.java
index 6ff3d0139..22c3f51a4 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAspect.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAspect.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import brave.Tracing;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
+
import org.springframework.cloud.sleuth.util.SpanNameUtil;
/**
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAutoConfiguration.java
index bb9190c66..dd3e81f44 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/scheduling/TraceSchedulingAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import java.util.regex.Pattern;
import brave.Tracer;
import brave.Tracing;
+
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ClientSampler.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ClientSampler.java
index c4c125715..cd21a8c1e 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ClientSampler.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ClientSampler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ExceptionLoggingFilter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ExceptionLoggingFilter.java
index 69105cbab..c0f80cab3 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ExceptionLoggingFilter.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ExceptionLoggingFilter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServerSampler.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServerSampler.java
index 16389185e..e0f1cccfe 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServerSampler.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServerSampler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServletUtils.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServletUtils.java
index 0809e0704..2f0859128 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServletUtils.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ServletUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SingleSkipPattern.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SingleSkipPattern.java
index eeb9821b5..280be6adc 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SingleSkipPattern.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SingleSkipPattern.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProvider.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProvider.java
index 8607798ab..6acae125a 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProvider.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParser.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParser.java
index ff72da893..aa710a265 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParser.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import java.net.URI;
import brave.SpanCustomizer;
import brave.http.HttpAdapter;
import brave.http.HttpClientParser;
+
import org.springframework.cloud.sleuth.util.SpanNameUtil;
/**
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpLegacyProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpLegacyProperties.java
index c6ccc6fc0..3052a74a9 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpLegacyProperties.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpLegacyProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpProperties.java
index 5bf2937ae..adc7a1258 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpProperties.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSampler.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSampler.java
index 134afd662..2f7deced1 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSampler.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSampler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpServerParser.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpServerParser.java
index d283db9a6..ed8401ab1 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpServerParser.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpServerParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -84,4 +84,4 @@ class SleuthHttpServerParser extends HttpServerParser {
error(httpStatus, error, customizer);
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthWebProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthWebProperties.java
index 7ccc2df77..545705a08 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthWebProperties.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthWebProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,8 @@ public class SleuthWebProperties {
/**
* Default set of skip patterns.
*/
- public static final String DEFAULT_SKIP_PATTERN = "/api-docs.*|/swagger.*|.*\\.png|.*\\.css|.*\\.js|.*\\.html|/favicon.ico|/hystrix.stream";
+ public static final String DEFAULT_SKIP_PATTERN = "/api-docs.*|/swagger.*|"
+ + ".*\\.png|.*\\.css|.*\\.js|.*\\.html|/favicon.ico|/hystrix.stream";
/**
* When true enables instrumentation for web applications.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.java
index aceef1673..7962ef898 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import brave.http.HttpClientParser;
import brave.http.HttpSampler;
import brave.http.HttpServerParser;
import brave.http.HttpTracing;
+
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceKeys.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceKeys.java
index 303316a81..c970ea320 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceKeys.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceKeys.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceSpringDataBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceSpringDataBeanPostProcessor.java
index 8378b135f..dd5c48b63 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceSpringDataBeanPostProcessor.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceSpringDataBeanPostProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import javax.servlet.http.HttpServletRequest;
import brave.spring.webmvc.SpanCustomizingAsyncHandlerInterceptor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.ApplicationContext;
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAspect.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAspect.java
index d3ecceaaa..1eca40f2b 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAspect.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAspect.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
+
import org.springframework.cloud.sleuth.SpanNamer;
import org.springframework.cloud.sleuth.instrument.async.TraceCallable;
import org.springframework.web.context.request.async.WebAsyncTask;
@@ -74,7 +75,7 @@ public class TraceWebAspect {
@Pointcut("@within(org.springframework.web.bind.annotation.RestController)")
private void anyRestControllerAnnotated() {
- }// NOSONAR
+ } // NOSONAR
@Pointcut("@within(org.springframework.stereotype.Controller)")
private void anyControllerAnnotated() {
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.java
index 15088cb21..bc43135d8 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.cloud.sleuth.instrument.web;
import java.util.ArrayList;
@@ -23,6 +24,7 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import brave.Tracing;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties;
@@ -74,9 +76,10 @@ public class TraceWebAutoConfiguration {
protected static class ManagementSkipPatternProviderConfig {
/**
- * Sets or appends
- * {@link ManagementServerProperties#getServlet()#getContextPath()} to the skip
+ * Sets or appends {@link ManagementServerProperties#getServlet()} to the skip
* pattern. If neither is available then sets the default one
+ * @param managementServerProperties properties
+ * @return optional skip pattern
*/
static Optional getPatternForManagementServerProperties(
ManagementServerProperties managementServerProperties) {
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFilter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFilter.java
index 164a29c41..9b1cd4329 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFilter.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFilter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -147,6 +147,11 @@ public final class TraceWebFilter implements WebFilter, Ordered {
return new MonoWebFilterTrace(chain.filter(exchange), exchange, this);
}
+ @Override
+ public int getOrder() {
+ return sleuthWebProperties().getFilterOrder();
+ }
+
private static class MonoWebFilterTrace extends MonoOperator {
final ServerWebExchange exchange;
@@ -176,6 +181,37 @@ public final class TraceWebFilter implements WebFilter, Ordered {
findOrCreateSpan(context), this));
}
+ private Span findOrCreateSpan(Context c) {
+ Span span;
+ if (c.hasKey(Span.class)) {
+ Span parent = c.get(Span.class);
+ span = this.tracer
+ .nextSpan(TraceContextOrSamplingFlags.create(parent.context()))
+ .start();
+ if (log.isDebugEnabled()) {
+ log.debug("Found span in reactor context" + span);
+ }
+ }
+ else {
+ if (this.attrSpan != null) {
+ span = this.attrSpan;
+ if (log.isDebugEnabled()) {
+ log.debug("Found span in attribute " + span);
+ }
+ }
+ else {
+ span = this.handler.handleReceive(this.extractor,
+ this.exchange.getRequest().getHeaders(),
+ this.exchange.getRequest());
+ if (log.isDebugEnabled()) {
+ log.debug("Handled receive of span " + span);
+ }
+ }
+ this.exchange.getAttributes().put(TRACE_REQUEST_ATTR, span);
+ }
+ return span;
+ }
+
static final class WebFilterTraceSubscriber implements CoreSubscriber {
final CoreSubscriber super Void> actual;
@@ -288,47 +324,13 @@ public final class TraceWebFilter implements WebFilter, Ordered {
}
- private Span findOrCreateSpan(Context c) {
- Span span;
- if (c.hasKey(Span.class)) {
- Span parent = c.get(Span.class);
- span = this.tracer
- .nextSpan(TraceContextOrSamplingFlags.create(parent.context()))
- .start();
- if (log.isDebugEnabled()) {
- log.debug("Found span in reactor context" + span);
- }
- }
- else {
- if (this.attrSpan != null) {
- span = this.attrSpan;
- if (log.isDebugEnabled()) {
- log.debug("Found span in attribute " + span);
- }
- }
- else {
- span = this.handler.handleReceive(this.extractor,
- this.exchange.getRequest().getHeaders(),
- this.exchange.getRequest());
- if (log.isDebugEnabled()) {
- log.debug("Handled receive of span " + span);
- }
- }
- this.exchange.getAttributes().put(TRACE_REQUEST_ATTR, span);
- }
- return span;
- }
-
- }
-
- @Override
- public int getOrder() {
- return sleuthWebProperties().getFilterOrder();
}
static final class DecoratedServerHttpResponse extends ServerHttpResponseDecorator {
- final String method, httpRoute;
+ final String method;
+
+ final String httpRoute;
DecoratedServerHttpResponse(ServerHttpResponse delegate, String method,
String httpRoute) {
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxAutoConfiguration.java
index 1ed70c4ee..d0fcb93e8 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,9 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.cloud.sleuth.instrument.web;
import brave.Tracing;
+
import org.springframework.beans.factory.BeanFactory;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebMvcConfigurer.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebMvcConfigurer.java
index f26fda9ec..60348b3ce 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebMvcConfigurer.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebMvcConfigurer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.springframework.cloud.sleuth.instrument.web;
import brave.spring.webmvc.SpanCustomizingAsyncHandlerInterceptor;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
@@ -25,7 +26,7 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
- * MVC Adapter that adds the {@link SpanCustomizingAsyncHandlerInterceptor}
+ * MVC Adapter that adds the {@link SpanCustomizingAsyncHandlerInterceptor}.
*
* @author Marcin Grzejszczak
* @since 1.0.3
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java
index f8c4bec3a..0adab6616 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ import brave.Tracing;
import brave.http.HttpTracing;
import brave.servlet.TracingFilter;
import brave.spring.webmvc.SpanCustomizingAsyncHandlerInterceptor;
+
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/HttpClientBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/HttpClientBeanPostProcessor.java
index f25cd9a76..c76421739 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/HttpClientBeanPostProcessor.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/HttpClientBeanPostProcessor.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.cloud.sleuth.instrument.web.client;
import java.util.concurrent.atomic.AtomicReference;
@@ -118,6 +119,10 @@ class HttpClientBeanPostProcessor implements BeanPostProcessor {
this.beanFactory = beanFactory;
}
+ static TracingDoOnRequest create(BeanFactory beanFactory) {
+ return new TracingDoOnRequest(beanFactory);
+ }
+
private HttpTracing httpTracing() {
if (this.httpTracing == null) {
this.httpTracing = this.beanFactory.getBean(HttpTracing.class);
@@ -146,10 +151,6 @@ class HttpClientBeanPostProcessor implements BeanPostProcessor {
return this.handler;
}
- static TracingDoOnRequest create(BeanFactory beanFactory) {
- return new TracingDoOnRequest(beanFactory);
- }
-
@Override
public void accept(HttpClientRequest req, Connection connection) {
if (propagation().keys().stream()
@@ -285,4 +286,4 @@ class HttpClientBeanPostProcessor implements BeanPostProcessor {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/SleuthWebClientEnabled.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/SleuthWebClientEnabled.java
index 444445eae..1a23bc4a7 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/SleuthWebClientEnabled.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/SleuthWebClientEnabled.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilter.java
index 76ec6f2a8..ec613fa79 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilter.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilter.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.cloud.sleuth.instrument.web.client;
import brave.Span;
@@ -30,18 +31,18 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.web.server.ServerWebExchange;
-class TraceRequestHttpHeadersFilter extends AbstractHttpHeadersFilter {
+final class TraceRequestHttpHeadersFilter extends AbstractHttpHeadersFilter {
private static final Log log = LogFactory.getLog(TraceRequestHttpHeadersFilter.class);
- static HttpHeadersFilter create(HttpTracing httpTracing) {
- return new TraceRequestHttpHeadersFilter(httpTracing);
- }
-
private TraceRequestHttpHeadersFilter(HttpTracing httpTracing) {
super(httpTracing);
}
+ static HttpHeadersFilter create(HttpTracing httpTracing) {
+ return new TraceRequestHttpHeadersFilter(httpTracing);
+ }
+
@Override
public HttpHeaders filter(HttpHeaders input, ServerWebExchange exchange) {
if (log.isDebugEnabled()) {
@@ -68,19 +69,19 @@ class TraceRequestHttpHeadersFilter extends AbstractHttpHeadersFilter {
}
-class TraceResponseHttpHeadersFilter extends AbstractHttpHeadersFilter {
+final class TraceResponseHttpHeadersFilter extends AbstractHttpHeadersFilter {
private static final Log log = LogFactory
.getLog(TraceResponseHttpHeadersFilter.class);
- static HttpHeadersFilter create(HttpTracing httpTracing) {
- return new TraceResponseHttpHeadersFilter(httpTracing);
- }
-
private TraceResponseHttpHeadersFilter(HttpTracing httpTracing) {
super(httpTracing);
}
+ static HttpHeadersFilter create(HttpTracing httpTracing) {
+ return new TraceResponseHttpHeadersFilter(httpTracing);
+ }
+
@Override
public HttpHeaders filter(HttpHeaders input, ServerWebExchange exchange) {
Object storedSpan = exchange.getAttribute(SPAN_ATTRIBUTE);
@@ -162,4 +163,4 @@ abstract class AbstractHttpHeadersFilter implements HttpHeadersFilter {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfiguration.java
index 1b550d531..a9a08daa4 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import javax.annotation.PostConstruct;
import brave.http.HttpTracing;
import brave.spring.web.TracingAsyncClientHttpRequestInterceptor;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
@@ -39,7 +40,7 @@ import org.springframework.web.client.AsyncRestTemplate;
/**
* {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration
* Auto-configuration} enables span information propagation for
- * {@link AsyncClientHttpRequestFactory} and {@link AsyncRestTemplate}
+ * {@link AsyncClientHttpRequestFactory} and {@link AsyncRestTemplate}.
*
* @author Marcin Grzejszczak
* @since 1.0.0
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfiguration.java
index b440e63b7..33305ec45 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ import org.springframework.web.reactive.function.client.WebClient;
/**
* {@link org.springframework.boot.autoconfigure.EnableAutoConfiguration
* Auto-configuration} enables span information propagation when using
- * {@link RestTemplate}
+ * {@link RestTemplate}.
*
* @author Marcin Grzejszczak
* @since 1.0.0
@@ -296,7 +296,7 @@ class LazyTracingClientHttpRequestInterceptor implements ClientHttpRequestInterc
private TracingClientHttpRequestInterceptor interceptor;
- public LazyTracingClientHttpRequestInterceptor(BeanFactory beanFactory) {
+ LazyTracingClientHttpRequestInterceptor(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
@@ -342,4 +342,4 @@ class TraceUserInfoRestTemplateCustomizer implements UserInfoRestTemplateCustomi
}
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessor.java
index 015e5f96b..1c841fbc2 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessor.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ import org.springframework.web.reactive.function.client.WebClient;
/**
* {@link BeanPostProcessor} to wrap a {@link WebClient} instance into its trace
- * representation
+ * representation.
*
* @author Marcin Grzejszczak
* @since 2.0.0
@@ -99,11 +99,6 @@ final class TraceWebClientBeanPostProcessor implements BeanPostProcessor {
final class TraceExchangeFilterFunction implements ExchangeFilterFunction {
private static final Log log = LogFactory.getLog(TraceExchangeFilterFunction.class);
-
- private static final String CLIENT_SPAN_KEY = "sleuth.webclient.clientSpan";
-
- private static final String CANCELLED_SUBSCRIPTION_ERROR = "CANCELLED";
-
static final Propagation.Setter SETTER = new Propagation.Setter() {
@Override
public void put(ClientRequest.Builder carrier, String key, String value) {
@@ -122,9 +117,9 @@ final class TraceExchangeFilterFunction implements ExchangeFilterFunction {
}
};
- public static ExchangeFilterFunction create(BeanFactory beanFactory) {
- return new TraceExchangeFilterFunction(beanFactory);
- }
+ private static final String CLIENT_SPAN_KEY = "sleuth.webclient.clientSpan";
+
+ private static final String CANCELLED_SUBSCRIPTION_ERROR = "CANCELLED";
final BeanFactory beanFactory;
@@ -144,6 +139,10 @@ final class TraceExchangeFilterFunction implements ExchangeFilterFunction {
.scopePassingSpanOperator(beanFactory);
}
+ public static ExchangeFilterFunction create(BeanFactory beanFactory) {
+ return new TraceExchangeFilterFunction(beanFactory);
+ }
+
@Override
public Mono filter(ClientRequest request, ExchangeFunction next) {
ClientRequest.Builder builder = ClientRequest.from(request);
@@ -159,6 +158,38 @@ final class TraceExchangeFilterFunction implements ExchangeFilterFunction {
return new MonoWebClientTrace(next, builder.build(), this, span);
}
+ @SuppressWarnings("unchecked")
+ HttpClientHandler handler() {
+ if (this.handler == null) {
+ this.handler = HttpClientHandler.create(
+ this.beanFactory.getBean(HttpTracing.class),
+ new TraceExchangeFilterFunction.HttpAdapter());
+ }
+ return this.handler;
+ }
+
+ Tracer tracer() {
+ if (this.tracer == null) {
+ this.tracer = httpTracing().tracing().tracer();
+ }
+ return this.tracer;
+ }
+
+ HttpTracing httpTracing() {
+ if (this.httpTracing == null) {
+ this.httpTracing = this.beanFactory.getBean(HttpTracing.class);
+ }
+ return this.httpTracing;
+ }
+
+ TraceContext.Injector injector() {
+ if (this.injector == null) {
+ this.injector = this.beanFactory.getBean(HttpTracing.class).tracing()
+ .propagation().injector(SETTER);
+ }
+ return this.injector;
+ }
+
private static final class MonoWebClientTrace extends Mono {
final ExchangeFunction next;
@@ -343,38 +374,6 @@ final class TraceExchangeFilterFunction implements ExchangeFilterFunction {
}
- @SuppressWarnings("unchecked")
- HttpClientHandler handler() {
- if (this.handler == null) {
- this.handler = HttpClientHandler.create(
- this.beanFactory.getBean(HttpTracing.class),
- new TraceExchangeFilterFunction.HttpAdapter());
- }
- return this.handler;
- }
-
- Tracer tracer() {
- if (this.tracer == null) {
- this.tracer = httpTracing().tracing().tracer();
- }
- return this.tracer;
- }
-
- HttpTracing httpTracing() {
- if (this.httpTracing == null) {
- this.httpTracing = this.beanFactory.getBean(HttpTracing.class);
- }
- return this.httpTracing;
- }
-
- TraceContext.Injector injector() {
- if (this.injector == null) {
- this.injector = this.beanFactory.getBean(HttpTracing.class).tracing()
- .propagation().injector(SETTER);
- }
- return this.injector;
- }
-
static final class HttpAdapter
extends brave.http.HttpClientAdapter {
@@ -401,4 +400,4 @@ final class TraceExchangeFilterFunction implements ExchangeFilterFunction {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignContextBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignContextBeanPostProcessor.java
index 1efd61f46..735998d93 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignContextBeanPostProcessor.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignContextBeanPostProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyClient.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyClient.java
index f050f714a..c7e9441e5 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyClient.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import java.io.IOException;
import feign.Client;
import feign.Request;
import feign.Response;
+
import org.springframework.beans.factory.BeanFactory;
/**
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyTracingFeignClient.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyTracingFeignClient.java
index 1bee39d8f..057ecbcde 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyTracingFeignClient.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/LazyTracingFeignClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import feign.Request;
import feign.Response;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.beans.factory.BeanFactory;
/**
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/NeverRetry.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/NeverRetry.java
index 3c6f2115e..cf63dccf6 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/NeverRetry.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/NeverRetry.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/OkHttpFeignClientBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/OkHttpFeignClientBeanPostProcessor.java
index f7b155e2d..3d519b102 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/OkHttpFeignClientBeanPostProcessor.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/OkHttpFeignClientBeanPostProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.instrument.web.client.feign;
import feign.Client;
import feign.okhttp.OkHttpClient;
+
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.config.BeanPostProcessor;
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignBuilder.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignBuilder.java
index b25207b8f..fa8cb3032 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignBuilder.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import brave.http.HttpTracing;
import feign.Client;
import feign.Feign;
import feign.Retryer;
+
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignProperties.java
index f538a8294..2493772ad 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignProperties.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthFeignProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthHystrixFeignBuilder.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthHystrixFeignBuilder.java
index 9ec11f609..1df7ca06c 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthHystrixFeignBuilder.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/SleuthHystrixFeignBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import feign.Client;
import feign.Feign;
import feign.Retryer;
import feign.hystrix.HystrixFeign;
+
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspect.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspect.java
index 1af56b3f6..7efb611a2 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspect.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspect.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
+
import org.springframework.beans.factory.BeanFactory;
/**
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignClientAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignClientAutoConfiguration.java
index 28b4d805f..81acda472 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignClientAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignClientAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import brave.http.HttpTracing;
import feign.Client;
import feign.Feign;
import feign.okhttp.OkHttpClient;
+
import org.springframework.beans.factory.BeanFactory;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignContext.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignContext.java
index d0eb6ace8..bafacb781 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignContext.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignObjectWrapper.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignObjectWrapper.java
index 20fd3e278..0ac890ac1 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignObjectWrapper.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignObjectWrapper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.springframework.cloud.sleuth.instrument.web.client.feign;
import feign.Client;
+
import org.springframework.beans.factory.BeanFactory;
import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory;
@@ -24,7 +25,7 @@ import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;
import org.springframework.util.ClassUtils;
/**
- * Class that wraps Feign related classes into their Trace representative
+ * Class that wraps Feign related classes into their Trace representative.
*
* @author Marcin Grzejszczak
* @since 1.0.1
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceLoadBalancerFeignClient.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceLoadBalancerFeignClient.java
index b9d28e215..bb54dac20 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceLoadBalancerFeignClient.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceLoadBalancerFeignClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import feign.Request;
import feign.Response;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.beans.factory.BeanFactory;
import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory;
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClient.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClient.java
index 4b64ff696..51db2d67f 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClient.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
- * Feign client wrapper
+ * Feign client wrapper.
*
* @author Marcin Grzejsczak
* @since 2.0.0
@@ -97,8 +97,8 @@ final class TracingFeignClient implements Client {
Response response = null;
Throwable error = null;
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span)) {
- return response = this.delegate.execute(modifiedRequest(request, headers),
- options);
+ response = this.delegate.execute(modifiedRequest(request, headers), options);
+ return response;
}
catch (IOException | RuntimeException | Error e) {
error = e;
@@ -160,4 +160,4 @@ final class TracingFeignClient implements Client {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilter.java
index 545067a7a..d7fc7d3da 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilter.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,10 +27,11 @@ import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.http.HttpStatus;
/**
- * A post request {@link ZuulFilter}
+ * A post request {@link ZuulFilter}.
*
* @author Dave Syer
* @since 1.0.0
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulAutoConfiguration.java
index 86736c3ee..8bb7ce7ab 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,10 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.cloud.sleuth.instrument.zuul;
import brave.http.HttpTracing;
import com.netflix.zuul.ZuulFilter;
+
import org.springframework.beans.factory.BeanFactory;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulHandlerMappingBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulHandlerMappingBeanPostProcessor.java
index 7f9a5d4bd..b7e6aa98c 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulHandlerMappingBeanPostProcessor.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceZuulHandlerMappingBeanPostProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import java.lang.invoke.MethodHandles;
import brave.spring.webmvc.SpanCustomizingAsyncHandlerInterceptor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.config.BeanPostProcessor;
@@ -39,7 +40,7 @@ class TraceZuulHandlerMappingBeanPostProcessor implements BeanPostProcessor {
private final BeanFactory beanFactory;
- public TraceZuulHandlerMappingBeanPostProcessor(BeanFactory beanFactory) {
+ TraceZuulHandlerMappingBeanPostProcessor(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthLogAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthLogAutoConfiguration.java
index f27e44991..091d9d21d 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthLogAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthLogAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.log;
import brave.propagation.CurrentTraceContext;
import org.slf4j.MDC;
+
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -43,7 +44,7 @@ import org.springframework.context.annotation.Configuration;
public class SleuthLogAutoConfiguration {
/**
- * Configuration for Slfj4
+ * Configuration for Slfj4.
*/
@Configuration
@ConditionalOnClass(MDC.class)
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthSlf4jProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthSlf4jProperties.java
index b4eccab3c..9781948c4 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthSlf4jProperties.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/SleuthSlf4jProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jCurrentTraceContext.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jCurrentTraceContext.java
index afb9af85e..29cb3ed0b 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jCurrentTraceContext.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jCurrentTraceContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,6 +54,15 @@ public final class Slf4jCurrentTraceContext extends CurrentTraceContext {
private static final Logger log = LoggerFactory
.getLogger(Slf4jCurrentTraceContext.class);
+ final CurrentTraceContext delegate;
+
+ Slf4jCurrentTraceContext(CurrentTraceContext delegate) {
+ if (delegate == null) {
+ throw new NullPointerException("delegate == null");
+ }
+ this.delegate = delegate;
+ }
+
public static Slf4jCurrentTraceContext create() {
return create(CurrentTraceContext.Default.inheritable());
}
@@ -62,13 +71,13 @@ public final class Slf4jCurrentTraceContext extends CurrentTraceContext {
return new Slf4jCurrentTraceContext(delegate);
}
- final CurrentTraceContext delegate;
-
- Slf4jCurrentTraceContext(CurrentTraceContext delegate) {
- if (delegate == null) {
- throw new NullPointerException("delegate == null");
+ static void replace(String key, @Nullable String value) {
+ if (value != null) {
+ MDC.put(key, value);
+ }
+ else {
+ MDC.remove(key);
}
- this.delegate = delegate;
}
@Override
@@ -155,13 +164,4 @@ public final class Slf4jCurrentTraceContext extends CurrentTraceContext {
}
}
- static void replace(String key, @Nullable String value) {
- if (value != null) {
- MDC.put(key, value);
- }
- else {
- MDC.remove(key);
- }
- }
-
}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jScopeDecorator.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jScopeDecorator.java
index 4419b941b..806fb5552 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jScopeDecorator.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/log/Slf4jScopeDecorator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ import brave.propagation.TraceContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
+
import org.springframework.cloud.sleuth.autoconfig.SleuthProperties;
import org.springframework.util.StringUtils;
@@ -65,6 +66,15 @@ final class Slf4jScopeDecorator implements CurrentTraceContext.ScopeDecorator {
this.sleuthSlf4jProperties = sleuthSlf4jProperties;
}
+ static void replace(String key, @Nullable String value) {
+ if (value != null) {
+ MDC.put(key, value);
+ }
+ else {
+ MDC.remove(key);
+ }
+ }
+
@Override
public CurrentTraceContext.Scope decorateScope(TraceContext currentSpan,
CurrentTraceContext.Scope scope) {
@@ -181,13 +191,4 @@ final class Slf4jScopeDecorator implements CurrentTraceContext.ScopeDecorator {
}
}
- static void replace(String key, @Nullable String value) {
- if (value != null) {
- MDC.put(key, value);
- }
- else {
- MDC.remove(key);
- }
- }
-
}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationAutoConfiguration.java
index 7fb1d0108..88e524cf9 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.springframework.cloud.sleuth.propagation;
import brave.handler.FinishedSpanHandler;
+
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -40,7 +41,7 @@ public class SleuthTagPropagationAutoConfiguration {
protected static class TagPropagationConfiguration {
@Bean
- @ConditionalOnProperty(value = "spring.sleuth.propagation.tag.whitelisted-keys")
+ @ConditionalOnProperty("spring.sleuth.propagation.tag.whitelisted-keys")
public FinishedSpanHandler finishedSpanHandler(SleuthProperties sleuthProperties,
SleuthTagPropagationProperties tagPropagationProperties) {
return new TagPropagationFinishedSpanHandler(sleuthProperties,
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationProperties.java
index c81319e90..43836a9d7 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationProperties.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/SleuthTagPropagationProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/TagPropagationFinishedSpanHandler.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/TagPropagationFinishedSpanHandler.java
index a2e975c7d..938f016c0 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/TagPropagationFinishedSpanHandler.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/propagation/TagPropagationFinishedSpanHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/ProbabilityBasedSampler.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/ProbabilityBasedSampler.java
index 3abdec633..94c911e5c 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/ProbabilityBasedSampler.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/ProbabilityBasedSampler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,8 @@ import brave.sampler.Sampler;
* Implementation
*
*
- * Taken from Zipkin
- * project
+ * Taken from Zipkin project
*
*
*
@@ -58,31 +57,13 @@ public class ProbabilityBasedSampler extends Sampler {
this.configuration = configuration;
}
- @Override
- public boolean isSampled(long traceId) {
- if (this.configuration.getProbability() == 0) {
- return false;
- }
- else if (this.configuration.getProbability() == 1.0f) {
- return true;
- }
- synchronized (this) {
- final int i = this.counter.getAndIncrement();
- boolean result = this.sampleDecisions.get(i);
- if (i == 99) {
- this.counter.set(0);
- }
- return result;
- }
- }
-
/**
* Reservoir sampling algorithm borrowed from Stack Overflow.
*
* http://stackoverflow.com/questions/12817946/generate-a-random-bitset-with-n-1s
- * @param size
- * @param cardinality
- * @param rnd
+ * @param size size of the bit set
+ * @param cardinality cardinality of the bit set
+ * @param rnd random generator
* @return a random bitset
*/
static BitSet randomBitSet(int size, int cardinality, Random rnd) {
@@ -104,4 +85,22 @@ public class ProbabilityBasedSampler extends Sampler {
return result;
}
+ @Override
+ public boolean isSampled(long traceId) {
+ if (this.configuration.getProbability() == 0) {
+ return false;
+ }
+ else if (this.configuration.getProbability() == 1.0f) {
+ return true;
+ }
+ synchronized (this) {
+ final int i = this.counter.getAndIncrement();
+ boolean result = this.sampleDecisions.get(i);
+ if (i == 99) {
+ this.counter.set(0);
+ }
+ return result;
+ }
+ }
+
}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/RateLimitingSampler.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/RateLimitingSampler.java
index b7c18c8da..288d8c3d8 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/RateLimitingSampler.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/RateLimitingSampler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ class RateLimitingSampler extends Sampler {
private final Sampler sampler;
- public RateLimitingSampler(SamplerProperties configuration) {
+ RateLimitingSampler(SamplerProperties configuration) {
this.sampler = brave.sampler.RateLimitingSampler.create(rateLimit(configuration));
}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerAutoConfiguration.java
index 4e226a74f..267a7a4b9 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.cloud.sleuth.sampler;
import brave.sampler.Sampler;
@@ -37,6 +38,13 @@ import org.springframework.context.annotation.Configuration;
@EnableConfigurationProperties(SamplerProperties.class)
public class SamplerAutoConfiguration {
+ static Sampler samplerFromProps(SamplerProperties config) {
+ if (config.getRate() != null) {
+ return new RateLimitingSampler(config);
+ }
+ return new ProbabilityBasedSampler(config);
+ }
+
@Configuration
@ConditionalOnBean(type = "org.springframework.cloud.context.scope.refresh.RefreshScope")
protected static class RefreshScopedSamplerConfiguration {
@@ -62,11 +70,4 @@ public class SamplerAutoConfiguration {
}
- static Sampler samplerFromProps(SamplerProperties config) {
- if (config.getRate() != null) {
- return new RateLimitingSampler(config);
- }
- return new ProbabilityBasedSampler(config);
- }
-
}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerProperties.java
index 07e78228f..fc21ef4bf 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerProperties.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/ArrayListSpanReporter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/ArrayListSpanReporter.java
index 7b3d0e117..ff2d8f356 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/ArrayListSpanReporter.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/ArrayListSpanReporter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/SpanNameUtil.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/SpanNameUtil.java
index 6bf043af1..0e4ad950f 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/SpanNameUtil.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/util/SpanNameUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-sleuth-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json
index 63b54b3fa..8c3f68828 100644
--- a/spring-cloud-sleuth-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json
+++ b/spring-cloud-sleuth-core/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -1,56 +1,58 @@
-{"properties": [
- {
- "name": "spring.sleuth.integration.enabled",
- "type": "java.lang.Boolean",
- "description": "Enable Spring Integration sleuth instrumentation.",
- "defaultValue": true
- },
- {
- "name": "spring.sleuth.integration.websockets.enabled",
- "type": "java.lang.Boolean",
- "description": "Enable tracing for WebSockets.",
- "defaultValue": true
- },
- {
- "name": "spring.sleuth.async.enabled",
- "type": "java.lang.Boolean",
- "description": "Enable instrumenting async related components so that the tracing information is passed between threads.",
- "defaultValue": true
- },
- {
- "name": "spring.sleuth.async.configurer.enabled",
- "type": "java.lang.Boolean",
- "description": "Enable default AsyncConfigurer.",
- "defaultValue": true
- },
- {
- "name": "spring.sleuth.hystrix.strategy.enabled",
- "type": "java.lang.Boolean",
- "description": "Enable custom HystrixConcurrencyStrategy that wraps all Callable instances into their Sleuth representative - the TraceCallable.",
- "defaultValue": true
- },
- {
- "name": "spring.sleuth.feign.enabled",
- "type": "java.lang.Boolean",
- "description": "Enable span information propagation when using Feign.",
- "defaultValue": true
- },
- {
- "name": "spring.sleuth.feign.processor.enabled",
- "type": "java.lang.Boolean",
- "description": "Enable post processor that wraps Feign Context in its tracing representations.",
- "defaultValue": true
- },
- {
- "name": "spring.sleuth.zuul.enabled",
- "type": "java.lang.Boolean",
- "description": "Enable span information propagation when using Zuul.",
- "defaultValue": true
- },
- {
- "name": "spring.sleuth.grpc.enabled",
- "type": "java.lang.Boolean",
- "description": "Enable span information propagation when using GRPC.",
- "defaultValue": true
- }
-]}
\ No newline at end of file
+{
+ "properties": [
+ {
+ "name": "spring.sleuth.integration.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Enable Spring Integration sleuth instrumentation.",
+ "defaultValue": true
+ },
+ {
+ "name": "spring.sleuth.integration.websockets.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Enable tracing for WebSockets.",
+ "defaultValue": true
+ },
+ {
+ "name": "spring.sleuth.async.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Enable instrumenting async related components so that the tracing information is passed between threads.",
+ "defaultValue": true
+ },
+ {
+ "name": "spring.sleuth.async.configurer.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Enable default AsyncConfigurer.",
+ "defaultValue": true
+ },
+ {
+ "name": "spring.sleuth.hystrix.strategy.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Enable custom HystrixConcurrencyStrategy that wraps all Callable instances into their Sleuth representative - the TraceCallable.",
+ "defaultValue": true
+ },
+ {
+ "name": "spring.sleuth.feign.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Enable span information propagation when using Feign.",
+ "defaultValue": true
+ },
+ {
+ "name": "spring.sleuth.feign.processor.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Enable post processor that wraps Feign Context in its tracing representations.",
+ "defaultValue": true
+ },
+ {
+ "name": "spring.sleuth.zuul.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Enable span information propagation when using Zuul.",
+ "defaultValue": true
+ },
+ {
+ "name": "spring.sleuth.grpc.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Enable span information propagation when using GRPC.",
+ "defaultValue": true
+ }
+ ]
+}
diff --git a/spring-cloud-sleuth-core/src/main/resources/META-INF/spring.factories b/spring-cloud-sleuth-core/src/main/resources/META-INF/spring.factories
index 28f45d8c5..db0e76446 100644
--- a/spring-cloud-sleuth-core/src/main/resources/META-INF/spring.factories
+++ b/spring-cloud-sleuth-core/src/main/resources/META-INF/spring.factories
@@ -25,7 +25,6 @@ org.springframework.cloud.sleuth.instrument.messaging.TraceMessagingAutoConfigur
org.springframework.cloud.sleuth.instrument.messaging.TraceSpringIntegrationAutoConfiguration,\
org.springframework.cloud.sleuth.instrument.messaging.websocket.TraceWebSocketAutoConfiguration,\
org.springframework.cloud.sleuth.instrument.opentracing.OpentracingAutoConfiguration
-
# Environment Post Processor
org.springframework.boot.env.EnvironmentPostProcessor=\
org.springframework.cloud.sleuth.autoconfig.TraceEnvironmentPostProcessor
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableSecurity.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableSecurity.java
index 59dc47460..176500829 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableSecurity.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableSecurity.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableWebFluxSecurity.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableWebFluxSecurity.java
index fd3d579d8..b59a29dd3 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableWebFluxSecurity.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/DisableWebFluxSecurity.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/FinishedSpanHandlerTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/FinishedSpanHandlerTests.java
index 417bbf8a6..a168644ed 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/FinishedSpanHandlerTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/FinishedSpanHandlerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,8 @@ import brave.sampler.Sampler;
import org.assertj.core.api.BDDAssertions;
import org.junit.Test;
import org.junit.runner.RunWith;
+import zipkin2.reporter.Reporter;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration;
@@ -33,13 +35,14 @@ import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.junit4.SpringRunner;
-import zipkin2.reporter.Reporter;
+
+import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.NONE;
/**
* @author Marcin Grzejszczak
*/
@RunWith(SpringRunner.class)
-@SpringBootTest(classes = FinishedSpanHandlerTests.FinishedSpanHandlerAspectTestsConfig.class, webEnvironment = SpringBootTest.WebEnvironment.NONE)
+@SpringBootTest(classes = FinishedSpanHandlerTests.FinishedSpanHandlerAspectTestsConfig.class, webEnvironment = NONE)
public class FinishedSpanHandlerTests {
@Autowired
@@ -98,4 +101,4 @@ public class FinishedSpanHandlerTests {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllServletConfiguration.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllServletConfiguration.java
index d395bce77..fe9eb2289 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllServletConfiguration.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllServletConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,4 +32,4 @@ public class PermitAllServletConfiguration extends WebSecurityConfigurerAdapter
http.authorizeRequests().antMatchers("/*").permitAll();
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllWebFluxSecurityConfiguration.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllWebFluxSecurityConfiguration.java
index 0c4e8b10c..30526b3dd 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllWebFluxSecurityConfiguration.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/PermitAllWebFluxSecurityConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,4 +31,4 @@ public class PermitAllWebFluxSecurityConfiguration {
.build();
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SleuthTestAutoConfiguration.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SleuthTestAutoConfiguration.java
index f6125e883..c7bc2b733 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SleuthTestAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SleuthTestAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SpanAdjusterTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SpanAdjusterTests.java
index e1ad49ede..cbd4389ec 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SpanAdjusterTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/SpanAdjusterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,8 @@ import brave.sampler.Sampler;
import org.assertj.core.api.BDDAssertions;
import org.junit.Test;
import org.junit.runner.RunWith;
+import zipkin2.reporter.Reporter;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration;
@@ -30,7 +32,6 @@ import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.junit4.SpringRunner;
-import zipkin2.reporter.Reporter;
/**
* @author Marcin Grzejszczak
@@ -83,4 +84,4 @@ public class SpanAdjusterTests {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/NoOpTagValueResolverTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/NoOpTagValueResolverTests.java
index aa7dd19f6..f5ace13df 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/NoOpTagValueResolverTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/NoOpTagValueResolverTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,4 +30,4 @@ public class NoOpTagValueResolverTests {
then(new NoOpTagValueResolver().resolve("")).isNull();
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationDisableTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationDisableTests.java
index d49986b67..1c165f20e 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationDisableTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationDisableTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.annotation;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationNoSleuthTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationNoSleuthTests.java
index 33ae0d816..47437c866 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationNoSleuthTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthNewSpanParserAnnotationNoSleuthTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.cloud.sleuth.annotation;
import brave.Tracing;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectFluxTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectFluxTests.java
index 720331509..d15b80cdf 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectFluxTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectFluxTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,6 +62,25 @@ public class SleuthSpanCreatorAspectFluxTests {
@Autowired
ArrayListSpanReporter reporter;
+ private static String toHexString(Long value) {
+ then(value).isNotNull();
+ return StringUtils.leftPad(Long.toHexString(value), 16, '0');
+ }
+
+ protected static Long id(Tracer tracer) {
+ if (tracer.currentSpan() == null) {
+ throw new IllegalStateException("Current Span is supposed to have a value!");
+ }
+ return tracer.currentSpan().context().spanId();
+ }
+
+ protected static Long id(Context context, Tracer tracer) {
+ if (context.hasKey(Span.class)) {
+ return context.get(Span.class).context().spanId();
+ }
+ return id(tracer);
+ }
+
@Before
public void setup() {
this.reporter.clear();
@@ -388,11 +407,6 @@ public class SleuthSpanCreatorAspectFluxTests {
});
}
- private static String toHexString(Long value) {
- then(value).isNotNull();
- return StringUtils.leftPad(Long.toHexString(value), 16, '0');
- }
-
private void verifyNoSpansUntilFluxComplete(Flux flux) {
Iterator iterator = flux.toIterable().iterator();
@@ -442,7 +456,7 @@ public class SleuthSpanCreatorAspectFluxTests {
Flux testMethod9(String param);
@ContinueSpan(log = "customTest")
- Flux testMethod10(@SpanTag(value = "testTag10") String param);
+ Flux testMethod10(@SpanTag("testTag10") String param);
@ContinueSpan(log = "customTest")
Flux testMethod10_v2(@SpanTag(key = "testTag10") String param);
@@ -554,8 +568,7 @@ public class SleuthSpanCreatorAspectFluxTests {
}
@Override
- public Flux testMethod10(
- @SpanTag(value = "customTestTag10") String param) {
+ public Flux testMethod10(@SpanTag("customTestTag10") String param) {
return this.testFlux;
}
@@ -601,20 +614,6 @@ public class SleuthSpanCreatorAspectFluxTests {
}
- protected static Long id(Tracer tracer) {
- if (tracer.currentSpan() == null) {
- throw new IllegalStateException("Current Span is supposed to have a value!");
- }
- return tracer.currentSpan().context().spanId();
- }
-
- protected static Long id(Context context, Tracer tracer) {
- if (context.hasKey(Span.class)) {
- return context.get(Span.class).context().spanId();
- }
- return id(tracer);
- }
-
@Configuration
@EnableAutoConfiguration
protected static class TestConfiguration {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectMonoTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectMonoTests.java
index 027133e3f..b5107f6ed 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectMonoTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectMonoTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -64,6 +64,17 @@ public class SleuthSpanCreatorAspectMonoTests {
@Autowired
ArrayListSpanReporter reporter;
+ private static String toHexString(long value) {
+ return StringUtils.leftPad(Long.toHexString(value), 16, '0');
+ }
+
+ protected static Long id(Tracer tracer) {
+ if (tracer.currentSpan() == null) {
+ throw new IllegalStateException("Current Span is supposed to have a value!");
+ }
+ return tracer.currentSpan().context().spanId();
+ }
+
@Before
public void setup() {
this.reporter.clear();
@@ -467,10 +478,6 @@ public class SleuthSpanCreatorAspectMonoTests {
});
}
- private static String toHexString(long value) {
- return StringUtils.leftPad(Long.toHexString(value), 16, '0');
- }
-
protected interface TestBeanInterface {
// tag::annotated_method[]
@@ -504,7 +511,7 @@ public class SleuthSpanCreatorAspectMonoTests {
Mono testMethod9(String param);
@ContinueSpan(log = "customTest")
- Mono testMethod10(@SpanTag(value = "testTag10") String param);
+ Mono testMethod10(@SpanTag("testTag10") String param);
@ContinueSpan(log = "customTest")
Mono testMethod10_v2(@SpanTag(key = "testTag10") String param);
@@ -592,8 +599,7 @@ public class SleuthSpanCreatorAspectMonoTests {
}
@Override
- public Mono testMethod10(
- @SpanTag(value = "customTestTag10") String param) {
+ public Mono testMethod10(@SpanTag("customTestTag10") String param) {
return TEST_MONO;
}
@@ -664,13 +670,6 @@ public class SleuthSpanCreatorAspectMonoTests {
}
- protected static Long id(Tracer tracer) {
- if (tracer.currentSpan() == null) {
- throw new IllegalStateException("Current Span is supposed to have a value!");
- }
- return tracer.currentSpan().context().spanId();
- }
-
@Configuration
@EnableAutoConfiguration
protected static class TestConfiguration {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectNegativeTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectNegativeTests.java
index 27af6fccd..84a2cc290 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectNegativeTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectNegativeTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,11 +19,12 @@ package org.springframework.cloud.sleuth.annotation;
import java.util.List;
import brave.sampler.Sampler;
-import zipkin2.Span;
-import zipkin2.reporter.Reporter;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import zipkin2.Span;
+import zipkin2.reporter.Reporter;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
@@ -74,14 +75,6 @@ public class SleuthSpanCreatorAspectNegativeTests {
}
- protected static class NotAnnotatedTestBean implements NotAnnotatedTestBeanInterface {
-
- @Override
- public void testMethod() {
- }
-
- }
-
protected interface TestBeanInterface {
@NewSpan
@@ -103,6 +96,14 @@ public class SleuthSpanCreatorAspectNegativeTests {
}
+ protected static class NotAnnotatedTestBean implements NotAnnotatedTestBeanInterface {
+
+ @Override
+ public void testMethod() {
+ }
+
+ }
+
protected static class TestBean implements TestBeanInterface {
@Override
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectTests.java
index 0212fe4f3..ee76c08fb 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorAspectTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,11 +22,12 @@ import java.util.stream.Collectors;
import brave.Span;
import brave.Tracer;
import brave.sampler.Sampler;
-import zipkin2.Annotation;
-import zipkin2.reporter.Reporter;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import zipkin2.Annotation;
+import zipkin2.reporter.Reporter;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
@@ -322,10 +323,10 @@ public class SleuthSpanCreatorAspectTests {
void testMethod9(String param);
@ContinueSpan(log = "customTest")
- void testMethod10(@SpanTag(value = "testTag10") String param);
+ void testMethod10(@SpanTag("testTag10") String param);
@ContinueSpan(log = "customTest")
- void testMethod10_v2(@SpanTag(key = "testTag10") String param);
+ void testMethod10_v2(@SpanTag("testTag10") String param);
// tag::continue_span[]
@ContinueSpan(log = "testMethod11")
@@ -388,7 +389,7 @@ public class SleuthSpanCreatorAspectTests {
}
@Override
- public void testMethod10(@SpanTag(value = "customTestTag10") String param) {
+ public void testMethod10(@SpanTag("customTestTag10") String param) {
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorCircularDependencyTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorCircularDependencyTests.java
index b1c8cf4a2..34e97b006 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorCircularDependencyTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SleuthSpanCreatorCircularDependencyTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,12 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.cloud.sleuth.annotation;
-import zipkin2.Span;
-import zipkin2.reporter.Reporter;
import org.junit.Test;
import org.junit.runner.RunWith;
+import zipkin2.Span;
+import zipkin2.reporter.Reporter;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
@@ -78,4 +80,4 @@ public class SleuthSpanCreatorCircularDependencyTests {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpanTagAnnotationHandlerTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpanTagAnnotationHandlerTests.java
index 94a613f97..f4b21ece6 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpanTagAnnotationHandlerTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpanTagAnnotationHandlerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import brave.sampler.Sampler;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -99,6 +100,24 @@ public class SpanTagAnnotationHandlerTests {
}
}
+ @Configuration
+ @EnableAutoConfiguration
+ protected static class TestConfiguration {
+
+ // tag::custom_resolver[]
+ @Bean(name = "myCustomTagValueResolver")
+ public TagValueResolver tagValueResolver() {
+ return parameter -> "Value from myCustomTagValueResolver";
+ }
+ // end::custom_resolver[]
+
+ @Bean
+ Sampler alwaysSampler() {
+ return Sampler.ALWAYS_SAMPLE;
+ }
+
+ }
+
protected class AnnotationMockClass {
// tag::resolver_bean[]
@@ -123,22 +142,4 @@ public class SpanTagAnnotationHandlerTests {
}
- @Configuration
- @EnableAutoConfiguration
- protected static class TestConfiguration {
-
- // tag::custom_resolver[]
- @Bean(name = "myCustomTagValueResolver")
- public TagValueResolver tagValueResolver() {
- return parameter -> "Value from myCustomTagValueResolver";
- }
- // end::custom_resolver[]
-
- @Bean
- Sampler alwaysSampler() {
- return Sampler.ALWAYS_SAMPLE;
- }
-
- }
-
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpelTagValueExpressionResolverTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpelTagValueExpressionResolverTests.java
index 3f36324b9..dee3fd7cf 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpelTagValueExpressionResolverTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/annotation/SpelTagValueExpressionResolverTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,12 +36,6 @@ public class SpelTagValueExpressionResolverTests {
then(resolved).isEqualTo("hello world");
}
- public static class MyObject {
-
- public String name;
-
- }
-
@Test
public void should_use_to_string_if_expression_is_not_analyzed_properly()
throws Exception {
@@ -52,6 +46,12 @@ public class SpelTagValueExpressionResolverTests {
then(resolved).isEqualTo("BAR");
}
+ public static class MyObject {
+
+ public String name;
+
+ }
+
}
class Foo {
@@ -61,4 +61,4 @@ class Foo {
return "BAR";
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationPropagationCustomizationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationPropagationCustomizationTests.java
index a6a373575..b60220651 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationPropagationCustomizationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationPropagationCustomizationTests.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.sleuth.autoconfig;
import brave.propagation.B3Propagation;
@@ -6,6 +22,7 @@ import brave.propagation.ExtraFieldPropagation;
import brave.propagation.Propagation;
import org.assertj.core.api.BDDAssertions;
import org.junit.Test;
+
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.cloud.sleuth.instrument.web.TraceHttpAutoConfiguration;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationWithDisabledSleuthTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationWithDisabledSleuthTests.java
index e3c6db5b5..b72ca5e08 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationWithDisabledSleuthTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfigurationWithDisabledSleuthTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.cloud.sleuth.autoconfig;
import java.security.SecureRandom;
@@ -24,6 +25,7 @@ import org.assertj.core.api.BDDAssertions;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/documentation/SpringCloudSleuthDocTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/documentation/SpringCloudSleuthDocTests.java
index bbadd7fc6..d28a05587 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/documentation/SpringCloudSleuthDocTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/documentation/SpringCloudSleuthDocTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@ import brave.sampler.Sampler;
import org.assertj.core.api.BDDAssertions;
import org.junit.Before;
import org.junit.Test;
+
import org.springframework.cloud.sleuth.DefaultSpanNamer;
import org.springframework.cloud.sleuth.SpanName;
import org.springframework.cloud.sleuth.SpanNamer;
@@ -46,7 +47,7 @@ import static org.assertj.core.api.BDDAssertions.then;
/**
* Test class to be embedded in the
- * {@code docs/src/main/asciidoc/spring-cloud-sleuth.adoc} file
+ * {@code docs/src/main/asciidoc/spring-cloud-sleuth.adoc} file.
*
* @author Marcin Grzejszczak
*/
@@ -66,30 +67,6 @@ public class SpringCloudSleuthDocTests {
this.reporter.clear();
}
- @Configuration
- public class SamplingConfiguration {
-
- // tag::always_sampler[]
- @Bean
- public Sampler defaultSampler() {
- return Sampler.ALWAYS_SAMPLE;
- }
- // end::always_sampler[]
-
- }
-
- // tag::span_name_annotation[]
- @SpanName("calculateTax")
- class TaxCountingRunnable implements Runnable {
-
- @Override
- public void run() {
- // perform logic
- }
-
- }
- // end::span_name_annotation[]
-
@Test
public void should_set_runnable_name_to_annotated_value()
throws ExecutionException, InterruptedException {
@@ -137,6 +114,7 @@ public class SpringCloudSleuthDocTests {
then(spans.get(0).name()).isEqualTo("calculatetax");
executorService.shutdown();
}
+ // end::span_name_annotation[]
@Test
public void should_create_a_span_with_tracer() {
@@ -305,4 +283,27 @@ public class SpringCloudSleuthDocTests {
return "some logic";
}
+ @Configuration
+ public class SamplingConfiguration {
+
+ // tag::always_sampler[]
+ @Bean
+ public Sampler defaultSampler() {
+ return Sampler.ALWAYS_SAMPLE;
+ }
+ // end::always_sampler[]
+
+ }
+
+ // tag::span_name_annotation[]
+ @SpanName("calculateTax")
+ class TaxCountingRunnable implements Runnable {
+
+ @Override
+ public void run() {
+ // perform logic
+ }
+
+ }
+
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/DefaultTestAutoConfiguration.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/DefaultTestAutoConfiguration.java
index 652dfc9ec..38ac509dc 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/DefaultTestAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/DefaultTestAutoConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/AsyncCustomAutoConfigurationTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/AsyncCustomAutoConfigurationTest.java
index 523ddd2c6..bedb92092 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/AsyncCustomAutoConfigurationTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/AsyncCustomAutoConfigurationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.springframework.cloud.sleuth.instrument.async;
import org.junit.Test;
+
import org.springframework.scheduling.annotation.AsyncConfigurer;
import static org.assertj.core.api.BDDAssertions.then;
@@ -48,4 +49,4 @@ public class AsyncCustomAutoConfigurationTest {
then(bean).isInstanceOf(LazyTraceAsyncCustomizer.class);
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ContextRefreshedListenerAccessor.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ContextRefreshedListenerAccessor.java
index 5c9905470..bfaee0a31 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ContextRefreshedListenerAccessor.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ContextRefreshedListenerAccessor.java
@@ -13,15 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.cloud.sleuth.instrument.async;
import org.springframework.beans.factory.BeanFactory;
-public class ContextRefreshedListenerAccessor {
+public final class ContextRefreshedListenerAccessor {
+
+ private ContextRefreshedListenerAccessor() {
+ throw new IllegalStateException("Can't instantiate a utility class");
+ }
public static void set(BeanFactory beanFactory, boolean refreshed) {
ContextRefreshedListener.CACHE.put(beanFactory,
new ContextRefreshedListener(refreshed));
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ExecutorBeanPostProcessorTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ExecutorBeanPostProcessorTests.java
index 138c2583f..2b473adb8 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ExecutorBeanPostProcessorTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/ExecutorBeanPostProcessorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -85,15 +85,6 @@ public class ExecutorBeanPostProcessorTests {
then(ClassUtils.isCglibProxy(o)).isTrue();
}
- class Foo implements Executor {
-
- @Override
- public void execute(Runnable command) {
-
- }
-
- }
-
@Test
public void should_fallback_to_sleuth_implementation_when_cglib_cannot_be_created()
throws Exception {
@@ -135,10 +126,6 @@ public class ExecutorBeanPostProcessorTests {
then(ClassUtils.isCglibProxy(o)).isTrue();
}
- class FooThreadPoolTaskExecutor extends ThreadPoolTaskExecutor {
-
- }
-
@Test
public void should_throw_exception_when_it_is_not_possible_to_create_any_proxy_for_ThreadPoolTaskExecutor()
throws Exception {
@@ -302,6 +289,19 @@ public class ExecutorBeanPostProcessorTests {
})).isInstanceOf(RejectedExecutionException.class).hasMessage("rejected");
}
+ class Foo implements Executor {
+
+ @Override
+ public void execute(Runnable command) {
+
+ }
+
+ }
+
+ class FooThreadPoolTaskExecutor extends ThreadPoolTaskExecutor {
+
+ }
+
class RejectedExecutionExecutor implements Executor {
@Override
@@ -311,4 +311,4 @@ public class ExecutorBeanPostProcessorTests {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceAsyncCustomizerTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceAsyncCustomizerTest.java
index c6fc6f8b8..338b612db 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceAsyncCustomizerTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/LazyTraceAsyncCustomizerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+
import org.springframework.scheduling.annotation.AsyncConfigurer;
import static org.assertj.core.api.BDDAssertions.then;
@@ -50,4 +51,4 @@ public class LazyTraceAsyncCustomizerTest {
then(executor).isExactlyInstanceOf(LazyTraceExecutor.class);
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncAspectTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncAspectTest.java
index 29648f764..07507096c 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncAspectTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncAspectTest.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.sleuth.instrument.async;
import brave.Tracing;
@@ -10,6 +26,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.BDDMockito;
import org.mockito.Mockito;
+
import org.springframework.cloud.sleuth.DefaultSpanNamer;
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
@@ -55,4 +72,4 @@ public class TraceAsyncAspectTest {
BDDAssertions.then(this.reporter.getSpans().get(0).timestamp()).isPositive();
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncIntegrationTests.java
index def16c789..b2e073acf 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncIntegrationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncIntegrationTests.java
@@ -1,6 +1,5 @@
-
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +28,7 @@ import org.awaitility.Awaitility;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.sleuth.SpanName;
@@ -211,10 +211,10 @@ public class TraceAsyncIntegrationTests {
static class ClassPerformingAsyncLogic {
- AtomicReference span = new AtomicReference<>();
-
private final Tracer tracer;
+ AtomicReference span = new AtomicReference<>();
+
ClassPerformingAsyncLogic(Tracer tracer) {
this.tracer = tracer;
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncListenableTaskExecutorTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncListenableTaskExecutorTest.java
index ce1f3a399..d717b413d 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncListenableTaskExecutorTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceAsyncListenableTaskExecutorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import brave.propagation.ThreadLocalCurrentTraceContext;
import org.assertj.core.api.BDDAssertions;
import org.awaitility.Awaitility;
import org.junit.Test;
+
import org.springframework.core.task.AsyncListenableTaskExecutor;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
@@ -161,4 +162,4 @@ public class TraceAsyncListenableTaskExecutorTest {
return () -> tracing.tracer().currentSpan();
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceCallableTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceCallableTests.java
index c38a5aab6..4e6e8c0c8 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceCallableTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceCallableTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
+
import org.springframework.cloud.sleuth.DefaultSpanNamer;
import org.springframework.cloud.sleuth.SpanName;
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
@@ -162,4 +163,4 @@ public class TraceCallableTests {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceRunnableTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceRunnableTests.java
index 29207c411..5c6dabe48 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceRunnableTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceRunnableTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
+
import org.springframework.cloud.sleuth.DefaultSpanNamer;
import org.springframework.cloud.sleuth.SpanName;
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
@@ -170,4 +171,4 @@ public class TraceRunnableTests {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorServiceTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorServiceTests.java
index b75696bbb..9951d5131 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorServiceTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableExecutorServiceTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,6 +44,7 @@ import org.mockito.BDDMockito;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
+
import org.springframework.beans.factory.BeanFactory;
import org.springframework.cloud.sleuth.DefaultSpanNamer;
import org.springframework.cloud.sleuth.SpanNamer;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableScheduledExecutorServiceTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableScheduledExecutorServiceTest.java
index 2fdf8364c..f46eeae02 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableScheduledExecutorServiceTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/TraceableScheduledExecutorServiceTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@ import org.mockito.BDDMockito;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+
import org.springframework.beans.factory.BeanFactory;
import org.springframework.cloud.sleuth.DefaultSpanNamer;
import org.springframework.cloud.sleuth.SpanNamer;
@@ -184,4 +185,4 @@ public class TraceableScheduledExecutorServiceTest {
return this.beanFactory;
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue410/Issue410Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue410/Issue410Tests.java
index 79d0c875d..ec8dec6a8 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue410/Issue410Tests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue410/Issue410Tests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +30,7 @@ import org.apache.commons.logging.LogFactory;
import org.awaitility.Awaitility;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -76,7 +77,7 @@ public class Issue410Tests {
RestTemplate restTemplate;
/**
- * Related to issue #445
+ * Related to issue #445.
*/
@Autowired
Application.MyService executorService;
@@ -126,7 +127,7 @@ public class Issue410Tests {
}
/**
- * Related to issue #423
+ * Related to issue #423.
*/
@Test
public void should_pass_tracing_info_for_completable_futures_with_executor() {
@@ -151,7 +152,7 @@ public class Issue410Tests {
}
/**
- * Related to issue #423
+ * Related to issue #423.
*/
@Test
public void should_pass_tracing_info_for_completable_futures_with_task_scheduler() {
@@ -209,8 +210,6 @@ class AsyncTask {
private static final Log log = LogFactory.getLog(AsyncTask.class);
- private AtomicReference span = new AtomicReference<>();
-
@Autowired
Tracer tracer;
@@ -225,6 +224,8 @@ class AsyncTask {
@Autowired
BeanFactory beanFactory;
+ private AtomicReference span = new AtomicReference<>();
+
@Async("poolTaskExecutor")
public void runWithPool() {
log.info("This task is running with a pool.");
@@ -335,7 +336,8 @@ class Application {
}
/**
- * Related to issue #445
+ * Related to issue #445.
+ * @return service bean
*/
@Bean
public MyService executorService() {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue546/Issue546Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue546/Issue546Tests.java
index 21555fc30..7c7763e57 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue546/Issue546Tests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/async/issues/issue546/Issue546Tests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -85,21 +86,21 @@ class Controller {
private final Tracing tracer;
- public Controller(AsyncRestTemplate traceAsyncRestTemplate, Tracing tracer) {
+ @Value("${server.port}")
+ private String port;
+
+ Controller(AsyncRestTemplate traceAsyncRestTemplate, Tracing tracer) {
this.traceAsyncRestTemplate = traceAsyncRestTemplate;
this.tracer = tracer;
}
- @Value("${server.port}")
- private String port;
-
- @RequestMapping(value = "/bean")
+ @RequestMapping("/bean")
public HogeBean bean() {
log.info("(/bean) I got a request!");
return new HogeBean("test", 18);
}
- @RequestMapping(value = "/trace-async-rest-template")
+ @RequestMapping("/trace-async-rest-template")
public void asyncTest(@RequestParam(required = false) boolean isSleep)
throws InterruptedException {
log.info("(/trace-async-rest-template) I got a request!");
@@ -132,7 +133,7 @@ class HogeBean {
private int age;
- public HogeBean(String name, int age) {
+ HogeBean(String name, int age) {
this.name = name;
this.age = age;
}
@@ -153,4 +154,4 @@ class HogeBean {
this.age = age;
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/GrpcTracingIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/GrpcTracingIntegrationTests.java
index 46f3a006d..8a0e7198d 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/GrpcTracingIntegrationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/GrpcTracingIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,7 +60,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* This class uses stubs and skeletons that were generated originally by the gRPC maven
* plugin and copied into a "stubs" sub-package.
*
- * @author tyler.vangorder
+ * @author Tyler Van Gorder
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = GrpcTracingIntegrationTests.TestConfiguration.class, webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = {
@@ -123,6 +123,12 @@ public class GrpcTracingIntegrationTests {
assertThat(clientInterceptors).hasSize(1);
}
+ public interface HelloServiceClient {
+
+ String sayHello(String name) throws Exception;
+
+ }
+
@Configuration
@EnableAutoConfiguration
@Import(HelloGrpcService.class)
@@ -172,12 +178,6 @@ public class GrpcTracingIntegrationTests {
}
- public static interface HelloServiceClient {
-
- String sayHello(String name) throws Exception;
-
- }
-
public static class HelloServiceGrpcClient implements HelloServiceClient {
private ManagedChannel managedChannel;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReply.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReply.java
index 6e3968e58..0d6d64632 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReply.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReply.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,17 +18,41 @@ package org.springframework.cloud.sleuth.instrument.grpc.stubs;
/**
*
- * The response message containing the greetings
+ * The response message containing the greetings.
*
*
* Protobuf type {@code HelloReply}
+ *
+ * @author Tyler Van Gorder
*/
public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:HelloReply)
HelloReplyOrBuilder {
+ public static final int MESSAGE_FIELD_NUMBER = 1;
+
private static final long serialVersionUID = 0L;
+ // @@protoc_insertion_point(class_scope:HelloReply)
+ private static final HelloReply DEFAULT_INSTANCE;
+
+ private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() {
+ @Override
+ public HelloReply parsePartialFrom(com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new HelloReply(input, extensionRegistry);
+ }
+ };
+
+ static {
+ DEFAULT_INSTANCE = new HelloReply();
+ }
+
+ private volatile java.lang.Object message_;
+
+ private byte memoizedIsInitialized = -1;
+
// Use HelloReply.newBuilder() to construct.
private HelloReply(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
@@ -38,11 +62,6 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
this.message_ = "";
}
- @java.lang.Override
- public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
- return this.unknownFields;
- }
-
private HelloReply(com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -61,20 +80,17 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
case 0:
done = true;
break;
- default: {
+ default:
if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry,
tag)) {
done = true;
}
break;
- }
- case 10: {
- java.lang.String s = input.readStringRequireUtf8();
-
+ case 10:
+ String s = input.readStringRequireUtf8();
this.message_ = s;
break;
}
- }
}
}
catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -94,123 +110,6 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
return HelloServiceOuterClass.internal_static_sample_grpc_HelloReply_descriptor;
}
- @Override
- protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() {
- return HelloServiceOuterClass.internal_static_sample_grpc_HelloReply_fieldAccessorTable
- .ensureFieldAccessorsInitialized(HelloReply.class,
- HelloReply.Builder.class);
- }
-
- public static final int MESSAGE_FIELD_NUMBER = 1;
-
- private volatile java.lang.Object message_;
-
- /**
- * string message = 1;
- */
- @Override
- public java.lang.String getMessage() {
- java.lang.Object ref = this.message_;
- if (ref instanceof java.lang.String) {
- return (java.lang.String) ref;
- }
- else {
- com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
- java.lang.String s = bs.toStringUtf8();
- this.message_ = s;
- return s;
- }
- }
-
- /**
- * string message = 1;
- */
- @Override
- public com.google.protobuf.ByteString getMessageBytes() {
- java.lang.Object ref = this.message_;
- if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b = com.google.protobuf.ByteString
- .copyFromUtf8((java.lang.String) ref);
- this.message_ = b;
- return b;
- }
- else {
- return (com.google.protobuf.ByteString) ref;
- }
- }
-
- private byte memoizedIsInitialized = -1;
-
- @Override
- public final boolean isInitialized() {
- byte isInitialized = this.memoizedIsInitialized;
- if (isInitialized == 1) {
- return true;
- }
- if (isInitialized == 0) {
- return false;
- }
-
- this.memoizedIsInitialized = 1;
- return true;
- }
-
- @Override
- public void writeTo(com.google.protobuf.CodedOutputStream output)
- throws java.io.IOException {
- if (!getMessageBytes().isEmpty()) {
- com.google.protobuf.GeneratedMessageV3.writeString(output, 1, this.message_);
- }
- this.unknownFields.writeTo(output);
- }
-
- @Override
- public int getSerializedSize() {
- int size = this.memoizedSize;
- if (size != -1) {
- return size;
- }
-
- size = 0;
- if (!getMessageBytes().isEmpty()) {
- size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1,
- this.message_);
- }
- size += this.unknownFields.getSerializedSize();
- this.memoizedSize = size;
- return size;
- }
-
- @java.lang.Override
- public boolean equals(final java.lang.Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof HelloReply)) {
- return super.equals(obj);
- }
- HelloReply other = (HelloReply) obj;
-
- boolean result = true;
- result = result && getMessage().equals(other.getMessage());
- result = result && this.unknownFields.equals(other.unknownFields);
- return result;
- }
-
- @java.lang.Override
- public int hashCode() {
- if (this.memoizedHashCode != 0) {
- return this.memoizedHashCode;
- }
- int hash = 41;
- hash = (19 * hash) + getDescriptor().hashCode();
- hash = (37 * hash) + MESSAGE_FIELD_NUMBER;
- hash = (53 * hash) + getMessage().hashCode();
- hash = (29 * hash) + this.unknownFields.hashCode();
- this.memoizedHashCode = hash;
- return hash;
- }
-
public static HelloReply parseFrom(java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
@@ -281,11 +180,6 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
extensionRegistry);
}
- @Override
- public Builder newBuilderForType() {
- return newBuilder();
- }
-
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
@@ -294,6 +188,135 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
+ public static HelloReply getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
+ return this.unknownFields;
+ }
+
+ @Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() {
+ return HelloServiceOuterClass.internal_static_sample_grpc_HelloReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(HelloReply.class,
+ HelloReply.Builder.class);
+ }
+
+ /**
+ * string message = 1;
+ */
+ @Override
+ public java.lang.String getMessage() {
+ java.lang.Object ref = this.message_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ }
+ else {
+ com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ this.message_ = s;
+ return s;
+ }
+ }
+
+ /**
+ * string message = 1;
+ */
+ @Override
+ public com.google.protobuf.ByteString getMessageBytes() {
+ java.lang.Object ref = this.message_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b = com.google.protobuf.ByteString
+ .copyFromUtf8((java.lang.String) ref);
+ this.message_ = b;
+ return b;
+ }
+ else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ @Override
+ public final boolean isInitialized() {
+ byte isInitialized = this.memoizedIsInitialized;
+ if (isInitialized == 1) {
+ return true;
+ }
+ if (isInitialized == 0) {
+ return false;
+ }
+
+ this.memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!getMessageBytes().isEmpty()) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, this.message_);
+ }
+ this.unknownFields.writeTo(output);
+ }
+
+ @Override
+ public int getSerializedSize() {
+ int size = this.memoizedSize;
+ if (size != -1) {
+ return size;
+ }
+
+ size = 0;
+ if (!getMessageBytes().isEmpty()) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1,
+ this.message_);
+ }
+ size += this.unknownFields.getSerializedSize();
+ this.memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof HelloReply)) {
+ return super.equals(obj);
+ }
+ HelloReply other = (HelloReply) obj;
+
+ boolean result = true;
+ result = result && getMessage().equals(other.getMessage());
+ result = result && this.unknownFields.equals(other.unknownFields);
+ return result;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (this.memoizedHashCode != 0) {
+ return this.memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + MESSAGE_FIELD_NUMBER;
+ hash = (53 * hash) + getMessage().hashCode();
+ hash = (29 * hash) + this.unknownFields.hashCode();
+ this.memoizedHashCode = hash;
+ return hash;
+ }
+
+ @Override
+ public Builder newBuilderForType() {
+ return newBuilder();
+ }
+
@Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
@@ -306,6 +329,16 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
return builder;
}
+ @java.lang.Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @Override
+ public HelloReply getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
/**
*
* The response message containing the greetings
@@ -318,16 +351,7 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
// @@protoc_insertion_point(builder_implements:HelloReply)
HelloReplyOrBuilder {
- public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
- return HelloServiceOuterClass.internal_static_sample_grpc_HelloReply_descriptor;
- }
-
- @Override
- protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() {
- return HelloServiceOuterClass.internal_static_sample_grpc_HelloReply_fieldAccessorTable
- .ensureFieldAccessorsInitialized(HelloReply.class,
- HelloReply.Builder.class);
- }
+ private java.lang.Object message_ = "";
// Construct using HelloReply.newBuilder()
private Builder() {
@@ -339,6 +363,17 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
maybeForceBuilderInitialization();
}
+ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
+ return HelloServiceOuterClass.internal_static_sample_grpc_HelloReply_descriptor;
+ }
+
+ @Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() {
+ return HelloServiceOuterClass.internal_static_sample_grpc_HelloReply_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(HelloReply.class,
+ HelloReply.Builder.class);
+ }
+
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {
}
@@ -463,8 +498,6 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
return this;
}
- private java.lang.Object message_ = "";
-
/**
* string message = 1;
*/
@@ -482,6 +515,19 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
}
}
+ /**
+ * string message = 1;
+ */
+ public Builder setMessage(java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ this.message_ = value;
+ onChanged();
+ return this;
+ }
+
/**
* string message = 1;
*/
@@ -502,10 +548,11 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
/**
* string message = 1;
*/
- public Builder setMessage(java.lang.String value) {
+ public Builder setMessageBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
+ checkByteStringIsUtf8(value);
this.message_ = value;
onChanged();
@@ -522,20 +569,6 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
return this;
}
- /**
- * string message = 1;
- */
- public Builder setMessageBytes(com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- checkByteStringIsUtf8(value);
-
- this.message_ = value;
- onChanged();
- return this;
- }
-
@Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
@@ -552,37 +585,4 @@ public final class HelloReply extends com.google.protobuf.GeneratedMessageV3 imp
}
- // @@protoc_insertion_point(class_scope:HelloReply)
- private static final HelloReply DEFAULT_INSTANCE;
- static {
- DEFAULT_INSTANCE = new HelloReply();
- }
-
- public static HelloReply getDefaultInstance() {
- return DEFAULT_INSTANCE;
- }
-
- private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() {
- @Override
- public HelloReply parsePartialFrom(com.google.protobuf.CodedInputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return new HelloReply(input, extensionRegistry);
- }
- };
-
- public static com.google.protobuf.Parser parser() {
- return PARSER;
- }
-
- @java.lang.Override
- public com.google.protobuf.Parser getParserForType() {
- return PARSER;
- }
-
- @Override
- public HelloReply getDefaultInstanceForType() {
- return DEFAULT_INSTANCE;
- }
-
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReplyOrBuilder.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReplyOrBuilder.java
index 71f62c257..a06a65cae 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReplyOrBuilder.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloReplyOrBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequest.java
index 4384dd4f0..ed55091e6 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,8 +27,30 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
// @@protoc_insertion_point(message_implements:HelloRequest)
HelloRequestOrBuilder {
+ public static final int NAME_FIELD_NUMBER = 1;
+
private static final long serialVersionUID = 0L;
+ // @@protoc_insertion_point(class_scope:HelloRequest)
+ private static final HelloRequest DEFAULT_INSTANCE;
+
+ private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() {
+ @Override
+ public HelloRequest parsePartialFrom(com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new HelloRequest(input, extensionRegistry);
+ }
+ };
+
+ static {
+ DEFAULT_INSTANCE = new HelloRequest();
+ }
+
+ private volatile java.lang.Object name_;
+
+ private byte memoizedIsInitialized = -1;
+
// Use HelloRequest.newBuilder() to construct.
private HelloRequest(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
@@ -38,11 +60,6 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
this.name_ = "";
}
- @java.lang.Override
- public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
- return this.unknownFields;
- }
-
private HelloRequest(com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -61,20 +78,18 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
case 0:
done = true;
break;
- default: {
+ default:
if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry,
tag)) {
done = true;
}
break;
- }
- case 10: {
- java.lang.String s = input.readStringRequireUtf8();
+ case 10:
+ String s = input.readStringRequireUtf8();
this.name_ = s;
break;
}
- }
}
}
catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -94,123 +109,6 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
return HelloServiceOuterClass.internal_static_sample_grpc_HelloRequest_descriptor;
}
- @Override
- protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() {
- return HelloServiceOuterClass.internal_static_sample_grpc_HelloRequest_fieldAccessorTable
- .ensureFieldAccessorsInitialized(HelloRequest.class,
- HelloRequest.Builder.class);
- }
-
- public static final int NAME_FIELD_NUMBER = 1;
-
- private volatile java.lang.Object name_;
-
- /**
- * string name = 1;
- */
- @Override
- public java.lang.String getName() {
- java.lang.Object ref = this.name_;
- if (ref instanceof java.lang.String) {
- return (java.lang.String) ref;
- }
- else {
- com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
- java.lang.String s = bs.toStringUtf8();
- this.name_ = s;
- return s;
- }
- }
-
- /**
- * string name = 1;
- */
- @Override
- public com.google.protobuf.ByteString getNameBytes() {
- java.lang.Object ref = this.name_;
- if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b = com.google.protobuf.ByteString
- .copyFromUtf8((java.lang.String) ref);
- this.name_ = b;
- return b;
- }
- else {
- return (com.google.protobuf.ByteString) ref;
- }
- }
-
- private byte memoizedIsInitialized = -1;
-
- @Override
- public final boolean isInitialized() {
- byte isInitialized = this.memoizedIsInitialized;
- if (isInitialized == 1) {
- return true;
- }
- if (isInitialized == 0) {
- return false;
- }
-
- this.memoizedIsInitialized = 1;
- return true;
- }
-
- @Override
- public void writeTo(com.google.protobuf.CodedOutputStream output)
- throws java.io.IOException {
- if (!getNameBytes().isEmpty()) {
- com.google.protobuf.GeneratedMessageV3.writeString(output, 1, this.name_);
- }
- this.unknownFields.writeTo(output);
- }
-
- @Override
- public int getSerializedSize() {
- int size = this.memoizedSize;
- if (size != -1) {
- return size;
- }
-
- size = 0;
- if (!getNameBytes().isEmpty()) {
- size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1,
- this.name_);
- }
- size += this.unknownFields.getSerializedSize();
- this.memoizedSize = size;
- return size;
- }
-
- @java.lang.Override
- public boolean equals(final java.lang.Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof HelloRequest)) {
- return super.equals(obj);
- }
- HelloRequest other = (HelloRequest) obj;
-
- boolean result = true;
- result = result && getName().equals(other.getName());
- result = result && this.unknownFields.equals(other.unknownFields);
- return result;
- }
-
- @java.lang.Override
- public int hashCode() {
- if (this.memoizedHashCode != 0) {
- return this.memoizedHashCode;
- }
- int hash = 41;
- hash = (19 * hash) + getDescriptor().hashCode();
- hash = (37 * hash) + NAME_FIELD_NUMBER;
- hash = (53 * hash) + getName().hashCode();
- hash = (29 * hash) + this.unknownFields.hashCode();
- this.memoizedHashCode = hash;
- return hash;
- }
-
public static HelloRequest parseFrom(java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
@@ -281,11 +179,6 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
extensionRegistry);
}
- @Override
- public Builder newBuilderForType() {
- return newBuilder();
- }
-
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
@@ -294,6 +187,135 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
+ public static HelloRequest getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
+ return this.unknownFields;
+ }
+
+ @Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() {
+ return HelloServiceOuterClass.internal_static_sample_grpc_HelloRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(HelloRequest.class,
+ HelloRequest.Builder.class);
+ }
+
+ /**
+ * string name = 1;
+ */
+ @Override
+ public java.lang.String getName() {
+ java.lang.Object ref = this.name_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ }
+ else {
+ com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ this.name_ = s;
+ return s;
+ }
+ }
+
+ /**
+ * string name = 1;
+ */
+ @Override
+ public com.google.protobuf.ByteString getNameBytes() {
+ java.lang.Object ref = this.name_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b = com.google.protobuf.ByteString
+ .copyFromUtf8((java.lang.String) ref);
+ this.name_ = b;
+ return b;
+ }
+ else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ @Override
+ public final boolean isInitialized() {
+ byte isInitialized = this.memoizedIsInitialized;
+ if (isInitialized == 1) {
+ return true;
+ }
+ if (isInitialized == 0) {
+ return false;
+ }
+
+ this.memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!getNameBytes().isEmpty()) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, this.name_);
+ }
+ this.unknownFields.writeTo(output);
+ }
+
+ @Override
+ public int getSerializedSize() {
+ int size = this.memoizedSize;
+ if (size != -1) {
+ return size;
+ }
+
+ size = 0;
+ if (!getNameBytes().isEmpty()) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1,
+ this.name_);
+ }
+ size += this.unknownFields.getSerializedSize();
+ this.memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof HelloRequest)) {
+ return super.equals(obj);
+ }
+ HelloRequest other = (HelloRequest) obj;
+
+ boolean result = true;
+ result = result && getName().equals(other.getName());
+ result = result && this.unknownFields.equals(other.unknownFields);
+ return result;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (this.memoizedHashCode != 0) {
+ return this.memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + NAME_FIELD_NUMBER;
+ hash = (53 * hash) + getName().hashCode();
+ hash = (29 * hash) + this.unknownFields.hashCode();
+ this.memoizedHashCode = hash;
+ return hash;
+ }
+
+ @Override
+ public Builder newBuilderForType() {
+ return newBuilder();
+ }
+
@Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
@@ -306,6 +328,16 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
return builder;
}
+ @java.lang.Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @Override
+ public HelloRequest getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
/**
*
* The request message containing the user's name.
@@ -318,16 +350,7 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
// @@protoc_insertion_point(builder_implements:HelloRequest)
HelloRequestOrBuilder {
- public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
- return HelloServiceOuterClass.internal_static_sample_grpc_HelloRequest_descriptor;
- }
-
- @Override
- protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() {
- return HelloServiceOuterClass.internal_static_sample_grpc_HelloRequest_fieldAccessorTable
- .ensureFieldAccessorsInitialized(HelloRequest.class,
- HelloRequest.Builder.class);
- }
+ private java.lang.Object name_ = "";
// Construct using HelloRequest.newBuilder()
private Builder() {
@@ -339,6 +362,17 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
maybeForceBuilderInitialization();
}
+ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
+ return HelloServiceOuterClass.internal_static_sample_grpc_HelloRequest_descriptor;
+ }
+
+ @Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() {
+ return HelloServiceOuterClass.internal_static_sample_grpc_HelloRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(HelloRequest.class,
+ HelloRequest.Builder.class);
+ }
+
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {
}
@@ -463,8 +497,6 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
return this;
}
- private java.lang.Object name_ = "";
-
/**
* string name = 1;
*/
@@ -482,6 +514,19 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
}
}
+ /**
+ * string name = 1;
+ */
+ public Builder setName(java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ this.name_ = value;
+ onChanged();
+ return this;
+ }
+
/**
* string name = 1;
*/
@@ -502,10 +547,11 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
/**
* string name = 1;
*/
- public Builder setName(java.lang.String value) {
+ public Builder setNameBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
+ checkByteStringIsUtf8(value);
this.name_ = value;
onChanged();
@@ -522,20 +568,6 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
return this;
}
- /**
- * string name = 1;
- */
- public Builder setNameBytes(com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- checkByteStringIsUtf8(value);
-
- this.name_ = value;
- onChanged();
- return this;
- }
-
@Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
@@ -552,37 +584,4 @@ public final class HelloRequest extends com.google.protobuf.GeneratedMessageV3 i
}
- // @@protoc_insertion_point(class_scope:HelloRequest)
- private static final HelloRequest DEFAULT_INSTANCE;
- static {
- DEFAULT_INSTANCE = new HelloRequest();
- }
-
- public static HelloRequest getDefaultInstance() {
- return DEFAULT_INSTANCE;
- }
-
- private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() {
- @Override
- public HelloRequest parsePartialFrom(com.google.protobuf.CodedInputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws com.google.protobuf.InvalidProtocolBufferException {
- return new HelloRequest(input, extensionRegistry);
- }
- };
-
- public static com.google.protobuf.Parser parser() {
- return PARSER;
- }
-
- @java.lang.Override
- public com.google.protobuf.Parser getParserForType() {
- return PARSER;
- }
-
- @Override
- public HelloRequest getDefaultInstanceForType() {
- return DEFAULT_INSTANCE;
- }
-
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequestOrBuilder.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequestOrBuilder.java
index 272583fdc..483d71cbd 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequestOrBuilder.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloRequestOrBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceGrpc.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceGrpc.java
index 7e4437c6a..2dac5608a 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceGrpc.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceGrpc.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,14 +31,18 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
@javax.annotation.Generated(value = "by gRPC proto compiler (version 1.15.1)", comments = "Source: HelloService.proto")
public final class HelloServiceGrpc {
- private HelloServiceGrpc() {
- }
-
public static final String SERVICE_NAME = "HelloService";
+ private static final int METHODID_SAY_HELLO = 0;
+
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor getSayHelloMethod;
+ private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
+
+ private HelloServiceGrpc() {
+ }
+
@io.grpc.stub.annotations.RpcMethod(fullMethodName = SERVICE_NAME + '/'
+ "SayHello", requestType = HelloRequest.class, responseType = HelloReply.class, methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor getSayHelloMethod() {
@@ -87,6 +91,22 @@ public final class HelloServiceGrpc {
return new HelloServiceFutureStub(channel);
}
+ public static io.grpc.ServiceDescriptor getServiceDescriptor() {
+ io.grpc.ServiceDescriptor result = serviceDescriptor;
+ if (result == null) {
+ synchronized (HelloServiceGrpc.class) {
+ result = serviceDescriptor;
+ if (result == null) {
+ serviceDescriptor = result = io.grpc.ServiceDescriptor
+ .newBuilder(SERVICE_NAME)
+ .setSchemaDescriptor(new HelloServiceFileDescriptorSupplier())
+ .addMethod(getSayHelloMethod()).build();
+ }
+ }
+ }
+ return result;
+ }
+
/**
*
* The Hello service definition.
@@ -222,8 +242,6 @@ public final class HelloServiceGrpc {
}
- private static final int METHODID_SAY_HELLO = 0;
-
private static final class MethodHandlers
implements io.grpc.stub.ServerCalls.UnaryMethod,
io.grpc.stub.ServerCalls.ServerStreamingMethod,
@@ -309,22 +327,4 @@ public final class HelloServiceGrpc {
}
- private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
-
- public static io.grpc.ServiceDescriptor getServiceDescriptor() {
- io.grpc.ServiceDescriptor result = serviceDescriptor;
- if (result == null) {
- synchronized (HelloServiceGrpc.class) {
- result = serviceDescriptor;
- if (result == null) {
- serviceDescriptor = result = io.grpc.ServiceDescriptor
- .newBuilder(SERVICE_NAME)
- .setSchemaDescriptor(new HelloServiceFileDescriptorSupplier())
- .addMethod(getSayHelloMethod()).build();
- }
- }
- }
- return result;
- }
-
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceOuterClass.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceOuterClass.java
index 3e6e6b798..40bb478f2 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceOuterClass.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/grpc/stubs/HelloServiceOuterClass.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 the original author or authors.
+ * Copyright 2018-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,28 +18,13 @@ package org.springframework.cloud.sleuth.instrument.grpc.stubs;
public final class HelloServiceOuterClass {
- private HelloServiceOuterClass() {
- }
-
- public static void registerAllExtensions(
- com.google.protobuf.ExtensionRegistryLite registry) {
- }
-
- public static void registerAllExtensions(
- com.google.protobuf.ExtensionRegistry registry) {
- registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry);
- }
-
static final com.google.protobuf.Descriptors.Descriptor internal_static_sample_grpc_HelloRequest_descriptor;
static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_sample_grpc_HelloRequest_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor internal_static_sample_grpc_HelloReply_descriptor;
static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_sample_grpc_HelloReply_fieldAccessorTable;
- public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
- return descriptor;
- }
-
private static com.google.protobuf.Descriptors.FileDescriptor descriptor;
+
static {
java.lang.String[] descriptorData = {
"\n\022HelloService.proto\022\013sample.grpc\"\034\n\014Hel"
@@ -70,6 +55,22 @@ public final class HelloServiceOuterClass {
new java.lang.String[] { "Message", });
}
+ private HelloServiceOuterClass() {
+ }
+
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistryLite registry) {
+ }
+
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry);
+ }
+
+ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ return descriptor;
+ }
+
// @@protoc_insertion_point(outer_class_scope)
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/HystrixAnnotationsIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/HystrixAnnotationsIntegrationTests.java
index f81eda831..b188acedc 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/HystrixAnnotationsIntegrationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/HystrixAnnotationsIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,23 +21,23 @@ import java.util.concurrent.atomic.AtomicReference;
import brave.Span;
import brave.Tracing;
import brave.sampler.Sampler;
+import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
+import com.netflix.hystrix.strategy.HystrixPlugins;
import org.awaitility.Awaitility;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.sleuth.instrument.DefaultTestAutoConfiguration;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
+import org.springframework.cloud.sleuth.instrument.DefaultTestAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
-import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
-import com.netflix.hystrix.strategy.HystrixPlugins;
-
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.BDDAssertions.then;
@@ -103,10 +103,10 @@ public class HystrixAnnotationsIntegrationTests {
public static class HystrixCommandInvocationSpanCatcher {
- AtomicReference spanCaughtFromHystrixThread;
-
private final Tracing tracing;
+ AtomicReference spanCaughtFromHystrixThread;
+
public HystrixCommandInvocationSpanCatcher(Tracing tracing) {
this.tracing = tracing;
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixConcurrencyStrategyTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixConcurrencyStrategyTest.java
index 8290d7227..7eea66d8e 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixConcurrencyStrategyTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/SleuthHystrixConcurrencyStrategyTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,15 +23,6 @@ import java.util.concurrent.TimeUnit;
import brave.Tracing;
import brave.propagation.StrictScopeDecorator;
import brave.propagation.ThreadLocalCurrentTraceContext;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.BDDMockito;
-import org.mockito.Mockito;
-import org.springframework.cloud.sleuth.DefaultSpanNamer;
-import org.springframework.cloud.sleuth.instrument.async.TraceCallable;
-import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
-
import com.netflix.hystrix.HystrixThreadPoolKey;
import com.netflix.hystrix.HystrixThreadPoolProperties;
import com.netflix.hystrix.strategy.HystrixPlugins;
@@ -42,6 +33,15 @@ import com.netflix.hystrix.strategy.executionhook.HystrixCommandExecutionHook;
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisher;
import com.netflix.hystrix.strategy.properties.HystrixPropertiesStrategy;
import com.netflix.hystrix.strategy.properties.HystrixProperty;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.BDDMockito;
+import org.mockito.Mockito;
+
+import org.springframework.cloud.sleuth.DefaultSpanNamer;
+import org.springframework.cloud.sleuth.instrument.async.TraceCallable;
+import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
import static org.assertj.core.api.BDDAssertions.then;
@@ -182,4 +182,4 @@ public class SleuthHystrixConcurrencyStrategyTest {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/TraceCommandTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/TraceCommandTests.java
index c114c4b9d..99cfd3a69 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/TraceCommandTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/hystrix/TraceCommandTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,9 +22,9 @@ import java.util.concurrent.atomic.AtomicReference;
import brave.Span;
import brave.Tracer;
import brave.Tracing;
-import brave.sampler.Sampler;
import brave.propagation.StrictScopeDecorator;
import brave.propagation.ThreadLocalCurrentTraceContext;
+import brave.sampler.Sampler;
import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandKey;
import com.netflix.hystrix.HystrixCommandProperties;
@@ -33,6 +33,7 @@ import com.netflix.hystrix.strategy.HystrixPlugins;
import org.assertj.core.api.BDDAssertions;
import org.junit.Before;
import org.junit.Test;
+
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
import static com.netflix.hystrix.HystrixCommand.Setter.withGroupKey;
@@ -194,4 +195,4 @@ public class TraceCommandTests {
class FooException extends RuntimeException {
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/ITTracingChannelInterceptor.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/ITTracingChannelInterceptor.java
index c16f72980..77d376f02 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/ITTracingChannelInterceptor.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/ITTracingChannelInterceptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+
import javax.annotation.PreDestroy;
import brave.Span;
@@ -31,6 +32,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -53,6 +55,8 @@ import static org.assertj.core.api.Assertions.assertThat;
* Ported from
* org.springframework.cloud.sleuth.instrument.messaging.TraceChannelInterceptorTest to
* allow sleuth to decommission its implementation.
+ *
+ * @author Marcin Grzejszczak
*/
@SpringBootTest(classes = ITTracingChannelInterceptor.App.class, webEnvironment = SpringBootTest.WebEnvironment.NONE)
@RunWith(SpringRunner.class)
@@ -141,6 +145,8 @@ public class ITTracingChannelInterceptor implements MessageHandler {
@EnableAutoConfiguration
static class App {
+ ExecutorService service = Executors.newSingleThreadExecutor();
+
@Bean
List spans() {
return new ArrayList<>();
@@ -159,8 +165,6 @@ public class ITTracingChannelInterceptor implements MessageHandler {
return tracing().tracer();
}
- ExecutorService service = Executors.newSingleThreadExecutor();
-
@Bean
ExecutorChannel executorChannel() {
return new ExecutorChannel(this.service);
@@ -183,4 +187,4 @@ public class ITTracingChannelInterceptor implements MessageHandler {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/JmsTracingConfigurationTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/JmsTracingConfigurationTest.java
index 53caff3d3..fa2f33001 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/JmsTracingConfigurationTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/JmsTracingConfigurationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,6 +78,38 @@ public class JmsTracingConfigurationTest {
JcaJmsListenerConfiguration.class,
JmsTestTracingConfiguration.class));
+ static void clearSpans(AssertableApplicationContext ctx) throws JMSException {
+ ctx.getBean(JmsTestTracingConfiguration.class).clearSpan();
+ }
+
+ static void checkConnection(AssertableApplicationContext ctx) throws JMSException {
+ // Not using try-with-resources as that doesn't exist in JMS 1.1
+ Connection con = ctx.getBean(ConnectionFactory.class).createConnection();
+ try {
+ con.setExceptionListener(exception -> {
+ });
+ assertThat(con.getExceptionListener().getClass().getName())
+ .startsWith("brave.jms.TracingExceptionListener");
+ }
+ finally {
+ con.close();
+ }
+ }
+
+ static void checkXAConnection(AssertableApplicationContext ctx) throws JMSException {
+ // Not using try-with-resources as that doesn't exist in JMS 1.1
+ XAConnection con = ctx.getBean(XAConnectionFactory.class).createXAConnection();
+ try {
+ con.setExceptionListener(exception -> {
+ });
+ assertThat(con.getExceptionListener().getClass().getName())
+ .startsWith("brave.jms.TracingExceptionListener");
+ }
+ finally {
+ con.close();
+ }
+ }
+
@Test
public void tracesConnectionFactory() {
this.contextRunner.run(JmsTracingConfigurationTest::checkConnection);
@@ -92,16 +124,6 @@ public class JmsTracingConfigurationTest {
});
}
- @AutoConfigureBefore(ActiveMQAutoConfiguration.class)
- static class XAConfiguration {
-
- @Bean
- XAConnectionFactoryWrapper xaConnectionFactoryWrapper() {
- return connectionFactory -> (ConnectionFactory) connectionFactory;
- }
-
- }
-
@Test
public void tracesListener_jmsMessageListener() {
this.contextRunner.withUserConfiguration(SimpleJmsListenerConfiguration.class)
@@ -120,6 +142,52 @@ public class JmsTracingConfigurationTest {
});
}
+ @Test
+ public void tracesListener_annotationMessageListener() {
+ this.contextRunner.withUserConfiguration(AnnotationJmsListenerConfiguration.class)
+ .run(ctx -> {
+ clearSpans(ctx);
+ ctx.getBean(JmsTemplate.class).convertAndSend("myQueue", "foo");
+
+ Callable takeSpan = ctx.getBean("takeSpan", Callable.class);
+ List trace = Arrays.asList(takeSpan.call(), takeSpan.call(),
+ takeSpan.call());
+
+ assertThat(trace).allSatisfy(s -> assertThat(s.traceId())
+ .isEqualTo(trace.get(0).traceId()));
+ assertThat(trace).extracting(Span::name)
+ .containsExactlyInAnyOrder("send", "receive", "on-message");
+ });
+ }
+
+ @Test
+ public void tracesListener_jcaMessageListener() {
+ this.contextRunner.withUserConfiguration(JcaJmsListenerConfiguration.class)
+ .run(ctx -> {
+ clearSpans(ctx);
+ ctx.getBean(JmsTemplate.class).convertAndSend("myQueue", "foo");
+
+ Callable takeSpan = ctx.getBean("takeSpan", Callable.class);
+ List trace = Arrays.asList(takeSpan.call(), takeSpan.call(),
+ takeSpan.call());
+
+ assertThat(trace).allSatisfy(s -> assertThat(s.traceId())
+ .isEqualTo(trace.get(0).traceId()));
+ assertThat(trace).extracting(Span::name)
+ .containsExactlyInAnyOrder("send", "receive", "on-message");
+ });
+ }
+
+ @AutoConfigureBefore(ActiveMQAutoConfiguration.class)
+ static class XAConfiguration {
+
+ @Bean
+ XAConnectionFactoryWrapper xaConnectionFactoryWrapper() {
+ return connectionFactory -> (ConnectionFactory) connectionFactory;
+ }
+
+ }
+
@Configuration
@EnableJms
static class SimpleJmsListenerConfiguration implements JmsListenerConfigurer {
@@ -147,24 +215,6 @@ public class JmsTracingConfigurationTest {
}
- @Test
- public void tracesListener_annotationMessageListener() {
- this.contextRunner.withUserConfiguration(AnnotationJmsListenerConfiguration.class)
- .run(ctx -> {
- clearSpans(ctx);
- ctx.getBean(JmsTemplate.class).convertAndSend("myQueue", "foo");
-
- Callable takeSpan = ctx.getBean("takeSpan", Callable.class);
- List trace = Arrays.asList(takeSpan.call(), takeSpan.call(),
- takeSpan.call());
-
- assertThat(trace).allSatisfy(s -> assertThat(s.traceId())
- .isEqualTo(trace.get(0).traceId()));
- assertThat(trace).extracting(Span::name)
- .containsExactlyInAnyOrder("send", "receive", "on-message");
- });
- }
-
@Configuration
@EnableJms
static class AnnotationJmsListenerConfiguration {
@@ -180,24 +230,6 @@ public class JmsTracingConfigurationTest {
}
- @Test
- public void tracesListener_jcaMessageListener() {
- this.contextRunner.withUserConfiguration(JcaJmsListenerConfiguration.class)
- .run(ctx -> {
- clearSpans(ctx);
- ctx.getBean(JmsTemplate.class).convertAndSend("myQueue", "foo");
-
- Callable takeSpan = ctx.getBean("takeSpan", Callable.class);
- List trace = Arrays.asList(takeSpan.call(), takeSpan.call(),
- takeSpan.call());
-
- assertThat(trace).allSatisfy(s -> assertThat(s.traceId())
- .isEqualTo(trace.get(0).traceId()));
- assertThat(trace).extracting(Span::name)
- .containsExactlyInAnyOrder("send", "receive", "on-message");
- });
- }
-
@Configuration
static class JcaJmsListenerConfiguration {
@@ -241,38 +273,6 @@ public class JmsTracingConfigurationTest {
}
- static void clearSpans(AssertableApplicationContext ctx) throws JMSException {
- ctx.getBean(JmsTestTracingConfiguration.class).clearSpan();
- }
-
- static void checkConnection(AssertableApplicationContext ctx) throws JMSException {
- // Not using try-with-resources as that doesn't exist in JMS 1.1
- Connection con = ctx.getBean(ConnectionFactory.class).createConnection();
- try {
- con.setExceptionListener(exception -> {
- });
- assertThat(con.getExceptionListener().getClass().getName())
- .startsWith("brave.jms.TracingExceptionListener");
- }
- finally {
- con.close();
- }
- }
-
- static void checkXAConnection(AssertableApplicationContext ctx) throws JMSException {
- // Not using try-with-resources as that doesn't exist in JMS 1.1
- XAConnection con = ctx.getBean(XAConnectionFactory.class).createXAConnection();
- try {
- con.setExceptionListener(exception -> {
- });
- assertThat(con.getExceptionListener().getClass().getName())
- .startsWith("brave.jms.TracingExceptionListener");
- }
- finally {
- con.close();
- }
- }
-
}
@Configuration
@@ -295,7 +295,8 @@ class JmsTestTracingConfiguration {
}
/**
- * Call this to block until a span was reported
+ * Call this to block until a span was reported.
+ * @return span from queue
*/
@Bean
Callable takeSpan() {
@@ -332,4 +333,4 @@ class JmsTestTracingConfiguration {
}).currentTraceContext(currentTraceContext).build();
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagationTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagationTest.java
index 2c19c87ac..1a9554ae8 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagationTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,11 @@ import java.util.Collections;
import brave.propagation.Propagation;
import org.junit.Test;
+
import org.springframework.messaging.support.MessageHeaderAccessor;
import org.springframework.messaging.support.NativeMessageHeaderAccessor;
-import static org.junit.Assert.*;
+import static org.assertj.core.api.Assertions.assertThat;
public class MessageHeaderPropagationTest
extends PropagationSetterTest {
@@ -58,7 +59,7 @@ public class MessageHeaderPropagationTest
carrier.setHeader("X-B3-TraceId", "48485a3953bb6124".getBytes());
carrier.setHeader("X-B3-TraceId", "48485a3953bb6124000000".getBytes());
String value = MessageHeaderPropagation.INSTANCE.get(carrier, "X-B3-TraceId");
- assertEquals("48485a3953bb6124000000", value);
+ assertThat(value).isEqualTo("48485a3953bb6124000000");
}
@Test
@@ -67,7 +68,7 @@ public class MessageHeaderPropagationTest
carrier.setHeader("X-B3-TraceId", "48485a3953bb6124");
carrier.setHeader("X-B3-TraceId", "48485a3953bb61240000000");
String value = MessageHeaderPropagation.INSTANCE.get(carrier, "X-B3-TraceId");
- assertEquals("48485a3953bb61240000000", value);
+ assertThat(value).isEqualTo("48485a3953bb61240000000");
}
@Test
@@ -76,7 +77,7 @@ public class MessageHeaderPropagationTest
carrier.setHeader("X-B3-TraceId", "48485a3953bb6124");
carrier.setHeader("X-B3-TraceId", "48485a3953bb61240000000");
String value = MessageHeaderPropagation.INSTANCE.get(carrier, "non existent key");
- assertNull(value);
+ assertThat(value).isNull();
}
@Test
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagation_NativeTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagation_NativeTest.java
index f20fd7234..1e1b29a4c 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagation_NativeTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/MessageHeaderPropagation_NativeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,11 +17,14 @@
package org.springframework.cloud.sleuth.instrument.messaging;
import brave.propagation.Propagation;
+
import org.springframework.messaging.support.MessageHeaderAccessor;
import org.springframework.messaging.support.NativeMessageHeaderAccessor;
/**
- * Tests that native headers are redundantly added
+ * Tests that native headers are redundantly added.
+ *
+ * @author Marcin Grzejszczak
*/
public class MessageHeaderPropagation_NativeTest
extends PropagationSetterTest {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/PropagationSetterTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/PropagationSetterTest.java
index 2531e0b75..48c36f865 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/PropagationSetterTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/PropagationSetterTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,11 @@ import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
- * Taken from Brave
+ * Taken from Brave.
+ *
+ * @param carrier type
+ * @param key type
+ * @author Marcin Grzejszczak
*/
public abstract class PropagationSetterTest {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceContextPropagationChannelInterceptorTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceContextPropagationChannelInterceptorTests.java
index 515bb0f34..01b1f3897 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceContextPropagationChannelInterceptorTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceContextPropagationChannelInterceptorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import brave.sampler.Sampler;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -38,9 +39,7 @@ import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Spencer Gibb
@@ -77,20 +76,21 @@ public class TraceContextPropagationChannelInterceptorTests {
}
Message> message = this.channel.receive(0);
- assertNotNull("message was null", message);
+ assertThat(message).as("message was null").isNotNull();
String spanId = message.getHeaders().get(TraceMessageHeaders.SPAN_ID_NAME,
String.class);
- assertNotEquals("spanId was equal to parent's id", expectedSpanId, spanId);
+ assertThat(spanId).as("spanId was equal to parent's id")
+ .isNotEqualTo(expectedSpanId);
String traceId = message.getHeaders().get(TraceMessageHeaders.TRACE_ID_NAME,
String.class);
- assertNotNull("traceId was null", traceId);
+ assertThat(traceId).as("traceId was null").isNotNull();
String parentId = message.getHeaders().get(TraceMessageHeaders.PARENT_ID_NAME,
String.class);
- assertEquals("parentId was not equal to parent's id",
- this.reporter.getSpans().get(0).id(), parentId);
+ assertThat(parentId).as("parentId was not equal to parent's id")
+ .isEqualTo(this.reporter.getSpans().get(0).id());
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessagingAutoConfigurationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessagingAutoConfigurationTests.java
index 66cfae806..0e2420636 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessagingAutoConfigurationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TraceMessagingAutoConfigurationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
+
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
@@ -199,4 +200,4 @@ class TestSleuthJmsBeanPostProcessor extends TracingConnectionFactoryBeanPostPro
return super.postProcessAfterInitialization(bean, beanName);
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorAutowireTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorAutowireTest.java
index 4e75aaae6..c5ca297ed 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorAutowireTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorAutowireTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.cloud.sleuth.instrument.messaging;
import brave.Tracing;
import org.junit.After;
import org.junit.Test;
+
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -26,16 +27,6 @@ import org.springframework.messaging.support.ChannelInterceptor;
public class TracingChannelInterceptorAutowireTest {
- @Configuration
- static class TracingConfiguration {
-
- @Bean
- Tracing tracing() {
- return Tracing.newBuilder().build();
- }
-
- }
-
@Test
public void autowiredWithBeanConfig() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
@@ -51,4 +42,14 @@ public class TracingChannelInterceptorAutowireTest {
Tracing.current().close();
}
+ @Configuration
+ static class TracingConfiguration {
+
+ @Bean
+ Tracing tracing() {
+ return Tracing.newBuilder().build();
+ }
+
+ }
+
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorTest.java
index 649c0bdea..7bdd4f90c 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,8 @@ import brave.propagation.StrictScopeDecorator;
import brave.propagation.ThreadLocalCurrentTraceContext;
import org.junit.After;
import org.junit.Test;
+import zipkin2.Span;
+
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.messaging.Message;
@@ -41,7 +43,6 @@ import org.springframework.messaging.support.ExecutorChannelInterceptor;
import org.springframework.messaging.support.ExecutorSubscribableChannel;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.messaging.support.NativeMessageHeaderAccessor;
-import zipkin2.Span;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.messaging.support.NativeMessageHeaderAccessor.NATIVE_HEADERS;
@@ -151,7 +152,7 @@ public class TracingChannelInterceptorTest {
/**
* We have to inject headers on a polling receive as any future processor will come
- * later
+ * later.
*/
@Test
public void pollingReceive_injectsConsumerSpan() {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/CustomExecutorConfig.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/CustomExecutorConfig.java
index 3f9188a87..df4c1c136 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/CustomExecutorConfig.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/CustomExecutorConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,4 +46,4 @@ public class CustomExecutorConfig extends AsyncConfigurerSupport {
return new LazyTraceExecutor(this.beanFactory, executor);
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloSpringIntegration.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloSpringIntegration.java
index 4e0c65cd8..70adffd15 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloSpringIntegration.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloSpringIntegration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.springframework.cloud.sleuth.instrument.messaging.issues.issue_943;
import brave.sampler.Sampler;
+
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldImpl.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldImpl.java
index 3b25d1c20..e0f818182 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldImpl.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldRestController.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldRestController.java
index 786f0e2ed..a15f14f3a 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldRestController.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/HelloWorldRestController.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpStatus;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/Issue943Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/Issue943Tests.java
index 79b1cccda..7a4545bcd 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/Issue943Tests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/Issue943Tests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import java.util.stream.Collectors;
import brave.Span;
import brave.Tracer;
import org.junit.Test;
+
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
import org.springframework.context.ConfigurableApplicationContext;
@@ -29,7 +30,9 @@ import org.springframework.web.client.RestTemplate;
import static org.assertj.core.api.BDDAssertions.then;
/**
- * Example taken from https://github.com/spring-cloud/spring-cloud-sleuth/issues/943
+ * Example taken from https://github.com/spring-cloud/spring-cloud-sleuth/issues/943 .
+ *
+ * @author Marcin Grzejszczak
*/
public class Issue943Tests {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/MessagingGateway.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/MessagingGateway.java
index 8c39b98d8..58843c787 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/MessagingGateway.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/issues/issue_943/MessagingGateway.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfigurationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfigurationTests.java
index 317b63362..60cc22c56 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfigurationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/websocket/TraceWebSocketAutoConfigurationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.cloud.sleuth.instrument.messaging.websocket;
import brave.sampler.Sampler;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
@@ -80,4 +81,4 @@ public class TraceWebSocketAutoConfigurationTests {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/DemoApplication.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/DemoApplication.java
index 6c9bd2b74..9d734b20d 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/DemoApplication.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/DemoApplication.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import brave.Span;
import brave.Tracer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.integration.annotation.Aggregator;
@@ -38,6 +39,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
+@MessagingGateway(name = "greeter")
+interface Sender {
+
+ @Gateway(requestChannel = "greetings")
+ void send(String message);
+
+}
+
@RestController
@MessageEndpoint
@IntegrationComponentScan
@@ -108,14 +117,6 @@ public class DemoApplication {
}
-@MessagingGateway(name = "greeter")
-interface Sender {
-
- @Gateway(requestChannel = "greetings")
- void send(String message);
-
-}
-
class Greeting {
private String message;
@@ -123,7 +124,7 @@ class Greeting {
Greeting() {
}
- public Greeting(String message) {
+ Greeting(String message) {
super();
this.message = message;
}
@@ -136,4 +137,4 @@ class Greeting {
this.message = message;
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/MultipleHopsIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/MultipleHopsIntegrationTests.java
index 8cf42cafd..6f2203f52 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/MultipleHopsIntegrationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/multiple/MultipleHopsIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import brave.sampler.Sampler;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration;
@@ -50,11 +51,12 @@ import static java.util.concurrent.TimeUnit.SECONDS;
import static java.util.stream.Collectors.toList;
import static org.assertj.core.api.BDDAssertions.then;
import static org.awaitility.Awaitility.await;
+import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@RunWith(SpringJUnit4ClassRunner.class)
@TestPropertySource(properties = { "spring.application.name=multiplehopsintegrationtests",
"spring.sleuth.http.legacy.enabled=true" })
-@SpringBootTest(classes = MultipleHopsIntegrationTests.Config.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@SpringBootTest(classes = MultipleHopsIntegrationTests.Config.class, webEnvironment = RANDOM_PORT)
@ActiveProfiles("baggage")
public class MultipleHopsIntegrationTests {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/opentracing/BraveTracerTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/opentracing/BraveTracerTest.java
index 1a1b9cf63..fee4f60af 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/opentracing/BraveTracerTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/opentracing/BraveTracerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.cloud.sleuth.instrument.opentracing;
import java.util.LinkedHashMap;
@@ -33,6 +34,8 @@ import io.opentracing.propagation.TextMapInjectAdapter;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import zipkin2.Annotation;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
@@ -40,11 +43,10 @@ import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.junit4.SpringRunner;
-import zipkin2.Annotation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.data.MapEntry.entry;
-import static org.junit.Assert.assertEquals;
+import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.NONE;
/**
* This shows how one might make an OpenTracing adapter for Brave, and how to navigate in
@@ -52,9 +54,11 @@ import static org.junit.Assert.assertEquals;
*
* Adopted from:
* https://github.com/openzipkin-contrib/brave-opentracing/tree/master/src/test/java/brave/opentracing
+ *
+ * @author Marcin Grzejszczak
*/
@RunWith(SpringRunner.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = "spring.sleuth.baggage-keys=country-code,user-id")
+@SpringBootTest(webEnvironment = NONE, properties = "spring.sleuth.baggage-keys=country-code,user-id")
public class BraveTracerTest {
@Autowired
@@ -66,6 +70,10 @@ public class BraveTracerTest {
@Autowired
BraveTracer opentracing;
+ private static TraceContext getTraceContext(Scope scope) {
+ return ((BraveSpanContext) scope.span().context()).unwrap();
+ }
+
@Test
public void startWithOpenTracingAndFinishWithBrave() {
io.opentracing.Span openTracingSpan = this.opentracing.buildSpan("encode")
@@ -188,12 +196,16 @@ public class BraveTracerTest {
}
}
- assertEquals("SpanA should have been active again after closing B", idOfSpanA,
- shouldBeIdOfSpanA);
- assertEquals("SpanB should have been active prior to its closure", idOfSpanB,
- shouldBeIdOfSpanB);
- assertEquals("SpanB's parent should be SpanA", idOfSpanA, parentIdOfSpanB);
- assertEquals("SpanC's parent should be SpanA", idOfSpanA, parentIdOfSpanC);
+ assertThat(shouldBeIdOfSpanA)
+ .as("SpanA should have been active again after closing B")
+ .isEqualTo(idOfSpanA);
+ assertThat(shouldBeIdOfSpanB)
+ .as("SpanB should have been active prior to its closure")
+ .isEqualTo(idOfSpanB);
+ assertThat(parentIdOfSpanB).as("SpanB's parent should be SpanA")
+ .isEqualTo(idOfSpanA);
+ assertThat(parentIdOfSpanC).as("SpanC's parent should be SpanA")
+ .isEqualTo(idOfSpanA);
}
@Test
@@ -239,12 +251,16 @@ public class BraveTracerTest {
spanA.finish();
}
- assertEquals("SpanA should have been active again after closing B", idOfSpanA,
- shouldBeIdOfSpanA);
- assertEquals("SpanB should have been active prior to its closure", idOfSpanB,
- shouldBeIdOfSpanB);
- assertEquals("SpanB's parent should be SpanA", idOfSpanA, parentIdOfSpanB);
- assertEquals("SpanC's parent should be SpanA", idOfSpanA, parentIdOfSpanC);
+ assertThat(shouldBeIdOfSpanA)
+ .as("SpanA should have been active again after closing B")
+ .isEqualTo(idOfSpanA);
+ assertThat(shouldBeIdOfSpanB)
+ .as("SpanB should have been active prior to its closure")
+ .isEqualTo(idOfSpanB);
+ assertThat(parentIdOfSpanB).as("SpanB's parent should be SpanA")
+ .isEqualTo(idOfSpanA);
+ assertThat(parentIdOfSpanC).as("SpanC's parent should be SpanA")
+ .isEqualTo(idOfSpanA);
}
@Test
@@ -299,10 +315,6 @@ public class BraveTracerTest {
assertThat(this.spans.getSpans().get(0).tags()).isEmpty();
}
- private static TraceContext getTraceContext(Scope scope) {
- return ((BraveSpanContext) scope.span().context()).unwrap();
- }
-
@Before
public void clear() {
this.spans.clear();
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/Issue866Configuration.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/Issue866Configuration.java
index 73438d971..5c8abf781 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/Issue866Configuration.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/Issue866Configuration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriberTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriberTests.java
index 68e559af6..0a2fd71a5 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriberTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/ScopePassingSpanSubscriberTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,4 +66,4 @@ public class ScopePassingSpanSubscriberTests {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriberTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriberTests.java
index 36a63cee4..a53685190 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriberTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/SpanSubscriberTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -308,4 +308,4 @@ public class SpanSubscriberTests {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfigurationAccessorConfiguration.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfigurationAccessorConfiguration.java
index fa66082e6..11d6dc3cb 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfigurationAccessorConfiguration.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfigurationAccessorConfiguration.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.sleuth.instrument.reactor;
import org.apache.commons.logging.Log;
@@ -8,7 +24,11 @@ import reactor.core.scheduler.Schedulers;
/**
* @author Marcin Grzejszczak
*/
-public class TraceReactorAutoConfigurationAccessorConfiguration {
+public final class TraceReactorAutoConfigurationAccessorConfiguration {
+
+ private TraceReactorAutoConfigurationAccessorConfiguration() {
+ throw new IllegalStateException("Can't instantiate a utility class");
+ }
private static final Log log = LogFactory
.getLog(TraceReactorAutoConfigurationAccessorConfiguration.class);
@@ -23,4 +43,4 @@ public class TraceReactorAutoConfigurationAccessorConfiguration {
Schedulers.resetFactory();
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/FlatMapTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/FlatMapTests.java
index 51f7ac94d..3f0ccb4b7 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/FlatMapTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/FlatMapTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,12 @@ import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Hooks;
+import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
+import zipkin2.Span;
+
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
@@ -44,11 +50,6 @@ import org.springframework.web.reactive.function.client.ClientResponse;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Hooks;
-import reactor.core.publisher.Mono;
-import reactor.core.scheduler.Schedulers;
-import zipkin2.Span;
import static org.assertj.core.api.BDDAssertions.then;
import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
@@ -59,6 +60,9 @@ public class FlatMapTests {
private static final Logger LOGGER = LoggerFactory.getLogger(FlatMapTests.class);
+ @Rule
+ public OutputCapture capture = new OutputCapture();
+
@BeforeClass
public static void setup() {
Hooks.resetOnLastOperator();
@@ -71,9 +75,6 @@ public class FlatMapTests {
Issue866Configuration.hook = null;
}
- @Rule
- public OutputCapture capture = new OutputCapture();
-
@Test
public void should_work_with_flat_maps() {
// given
@@ -229,4 +230,4 @@ class FactoryUser {
this.wasSchedulerWrapped = hook != null && hook.executed;
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/RequestSender.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/RequestSender.java
index b43400e8b..790fa29c4 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/RequestSender.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/reactor/sample/RequestSender.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,11 +20,12 @@ import brave.Span;
import brave.Tracer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.http.HttpMethod;
-import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
+import org.springframework.http.HttpMethod;
+import org.springframework.web.reactive.function.client.WebClient;
+
class RequestSender {
private static final Logger LOGGER = LoggerFactory.getLogger(RequestSender.class);
@@ -37,7 +38,7 @@ class RequestSender {
Span span;
- public RequestSender(WebClient webClient, Tracer tracer) {
+ RequestSender(WebClient webClient, Tracer tracer) {
this.webClient = webClient;
this.tracer = tracer;
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHookTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHookTests.java
index 1fbdaf76a..9419f74b9 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHookTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHookTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,14 +30,15 @@ import brave.Tracer;
import brave.Tracing;
import brave.propagation.StrictScopeDecorator;
import brave.propagation.ThreadLocalCurrentTraceContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import rx.functions.Action0;
import rx.plugins.RxJavaErrorHandler;
import rx.plugins.RxJavaObservableExecutionHook;
import rx.plugins.RxJavaPlugins;
import rx.plugins.RxJavaSchedulersHook;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
import static org.assertj.core.api.BDDAssertions.then;
@@ -47,6 +48,8 @@ import static org.assertj.core.api.BDDAssertions.then;
*/
public class SleuthRxJavaSchedulersHookTests {
+ private static StringBuilder caller;
+
List threadsToIgnore = new ArrayList<>();
ArrayListSpanReporter reporter = new ArrayListSpanReporter();
@@ -64,8 +67,6 @@ public class SleuthRxJavaSchedulersHookTests {
this.reporter.clear();
}
- private static StringBuilder caller;
-
@Before
@After
public void setup() {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaTests.java
index 2b1ddfd5f..769c59dd5 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,11 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import rx.Observable;
+import rx.functions.Action0;
+import rx.plugins.RxJavaPlugins;
+import rx.schedulers.Schedulers;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
@@ -32,10 +37,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
-import rx.Observable;
-import rx.functions.Action0;
-import rx.plugins.RxJavaPlugins;
-import rx.schedulers.Schedulers;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.BDDAssertions.then;
@@ -54,17 +55,17 @@ public class SleuthRxJavaTests {
StringBuffer caller = new StringBuffer();
- @Before
- public void clean() {
- this.reporter.clear();
- }
-
@BeforeClass
@AfterClass
public static void cleanUp() {
RxJavaPlugins.getInstance().reset();
}
+ @Before
+ public void clean() {
+ this.reporter.clear();
+ }
+
@Test
public void should_create_new_span_when_rx_java_action_is_executed_and_there_was_no_span() {
Observable
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/scheduling/TracingOnScheduledTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/scheduling/TracingOnScheduledTests.java
index b7ea48a38..50f4db38e 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/scheduling/TracingOnScheduledTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/scheduling/TracingOnScheduledTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,8 @@ import org.apache.commons.logging.LogFactory;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import zipkin2.reporter.Reporter;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.sleuth.instrument.DefaultTestAutoConfiguration;
@@ -37,7 +39,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
-import zipkin2.reporter.Reporter;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.BDDAssertions.then;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/AbstractMvcIntegrationTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/AbstractMvcIntegrationTest.java
index 4a314d9ec..cb091ee78 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/AbstractMvcIntegrationTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/AbstractMvcIntegrationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.instrument.web;
import brave.Tracing;
import org.junit.Before;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.autoconfig.SleuthProperties;
import org.springframework.context.ApplicationContext;
@@ -34,7 +35,7 @@ import org.springframework.web.context.WebApplicationContext;
*
* @see WebApplicationContext
* @see ApplicationContext
- * @author 4financeIT
+ * @author 4finance IT
*/
@WebAppConfiguration
public abstract class AbstractMvcIntegrationTest {
@@ -62,6 +63,7 @@ public abstract class AbstractMvcIntegrationTest {
* Override in a subclass to modify mockMvcBuilder configuration (e.g. add filter).
*
* The method from super class should be called.
+ * @param mockMvcBuilder builder to configure
*/
protected void configureMockMvcBuilder(DefaultMockMvcBuilder mockMvcBuilder) {
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/CompositeHttpSamplerTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/CompositeHttpSamplerTests.java
index c91c0220a..67d1e9ddf 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/CompositeHttpSamplerTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/CompositeHttpSamplerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,10 @@ public class CompositeHttpSamplerTests {
HttpAdapter adapter;
@Mock
- HttpSampler left, right;
+ HttpSampler left;
+
+ @Mock
+ HttpSampler right;
HttpSampler sampler;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/IgnoreAutoConfiguredSkipPatternsIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/IgnoreAutoConfiguredSkipPatternsIntegrationTests.java
index 3555d784b..ec51a3ae7 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/IgnoreAutoConfiguredSkipPatternsIntegrationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/IgnoreAutoConfiguredSkipPatternsIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,13 @@
package org.springframework.cloud.sleuth.instrument.web;
+import brave.Tracer;
+import brave.sampler.Sampler;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
@@ -30,13 +37,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
-import brave.Tracer;
-import brave.sampler.Sampler;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import static org.assertj.core.api.BDDAssertions.then;
@RunWith(SpringRunner.class)
@@ -118,4 +118,4 @@ public class IgnoreAutoConfiguredSkipPatternsIntegrationTests {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithBasePath.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithBasePath.java
index 4421490d8..2805608b5 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithBasePath.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithBasePath.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
@@ -102,4 +103,4 @@ public class SkipEndPointsIntegrationTestsWithContextPathWithBasePath {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithoutBasePath.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithoutBasePath.java
index 18c648024..9ed8bea41 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithoutBasePath.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithContextPathWithoutBasePath.java
@@ -1,5 +1,28 @@
+/*
+ * Copyright 2013-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.sleuth.instrument.web;
+import brave.Tracer;
+import brave.sampler.Sampler;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
@@ -14,13 +37,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
-import brave.Tracer;
-import brave.sampler.Sampler;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import static org.assertj.core.api.BDDAssertions.then;
@RunWith(SpringRunner.class)
@@ -31,15 +47,15 @@ import static org.assertj.core.api.BDDAssertions.then;
"management.endpoints.web.base-path:/" })
public class SkipEndPointsIntegrationTestsWithContextPathWithoutBasePath {
+ @LocalServerPort
+ int port;
+
@Autowired
private ArrayListSpanReporter spanReporter;
@Autowired
private Tracer tracer;
- @LocalServerPort
- int port;
-
@Before
@After
public void clearSpans() {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithBasePath.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithBasePath.java
index 6f2d88b6d..c44dbc68c 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithBasePath.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithBasePath.java
@@ -1,5 +1,28 @@
+/*
+ * Copyright 2013-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.sleuth.instrument.web;
+import brave.Tracer;
+import brave.sampler.Sampler;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
@@ -14,13 +37,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
-import brave.Tracer;
-import brave.sampler.Sampler;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import static org.assertj.core.api.BDDAssertions.then;
@RunWith(SpringRunner.class)
@@ -29,15 +45,15 @@ import static org.assertj.core.api.BDDAssertions.then;
"spring.sleuth.http.legacy.enabled:true" })
public class SkipEndPointsIntegrationTestsWithoutContextPathWithBasePath {
+ @LocalServerPort
+ int port;
+
@Autowired
private ArrayListSpanReporter spanReporter;
@Autowired
private Tracer tracer;
- @LocalServerPort
- int port;
-
@Before
@After
public void clearSpans() {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithoutBasePath.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithoutBasePath.java
index 9c74496f1..9933d8ffa 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithoutBasePath.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipEndPointsIntegrationTestsWithoutContextPathWithoutBasePath.java
@@ -1,5 +1,28 @@
+/*
+ * Copyright 2013-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.sleuth.instrument.web;
+import brave.Tracer;
+import brave.sampler.Sampler;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
@@ -14,13 +37,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
-import brave.Tracer;
-import brave.sampler.Sampler;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import static org.assertj.core.api.BDDAssertions.then;
@RunWith(SpringRunner.class)
@@ -30,15 +46,15 @@ import static org.assertj.core.api.BDDAssertions.then;
"management.endpoints.web.base-path:/" })
public class SkipEndPointsIntegrationTestsWithoutContextPathWithoutBasePath {
+ @LocalServerPort
+ int port;
+
@Autowired
private ArrayListSpanReporter spanReporter;
@Autowired
private Tracer tracer;
- @LocalServerPort
- int port;
-
@Before
@After
public void clearSpans() {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProviderConfigTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProviderConfigTest.java
index bd5e3466d..6dbab83f2 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProviderConfigTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SkipPatternProviderConfigTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -227,4 +227,4 @@ public class SkipPatternProviderConfigTest {
};
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParserTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParserTests.java
index 72f1a409d..706ab38c7 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParserTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpClientParserTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,20 +16,19 @@
package org.springframework.cloud.sleuth.instrument.web;
-import static org.assertj.core.api.BDDAssertions.then;
-
import java.net.URL;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Test;
-
import brave.SpanCustomizer;
import brave.http.HttpClientAdapter;
+import org.junit.Test;
+
+import static org.assertj.core.api.BDDAssertions.then;
/**
- * Test case for HttpTraceKeysInjector
+ * Test case for HttpTraceKeysInjector.
*
* @author Sven Zethelius
*/
@@ -103,4 +102,4 @@ class TestSpanCustomizer implements SpanCustomizer {
return this;
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpParserAccessor.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpParserAccessor.java
index c7496631e..1eab4e34d 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpParserAccessor.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpParserAccessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,11 @@ import brave.http.HttpServerParser;
* @author Marcin Grzejszczak
* @since
*/
-public class SleuthHttpParserAccessor {
+public final class SleuthHttpParserAccessor {
+
+ private SleuthHttpParserAccessor() {
+ throw new IllegalStateException("Can't instantiate a utility class");
+ }
public static HttpClientParser getClient() {
return new SleuthHttpClientParser(new TraceKeys());
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSamplerTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSamplerTests.java
index d4b72658b..d94b926dd 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSamplerTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SleuthHttpSamplerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,4 +54,4 @@ public class SleuthHttpSamplerTests {
then(sampler.trySample(this.adapter, new Object())).isFalse();
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SpringDataInstrumentationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SpringDataInstrumentationTests.java
index 2f29d79a5..479587e75 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SpringDataInstrumentationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SpringDataInstrumentationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,6 +55,11 @@ import org.springframework.web.client.RestTemplate;
import static org.assertj.core.api.Assertions.tuple;
import static org.assertj.core.api.BDDAssertions.then;
+@RepositoryRestResource
+interface ReservationRepository extends JpaRepository {
+
+}
+
/**
* @author Marcin Grzejszczak
*/
@@ -146,7 +151,7 @@ class SampleRecords {
private final ReservationRepository reservationRepository;
- public SampleRecords(ReservationRepository reservationRepository) {
+ SampleRecords(ReservationRepository reservationRepository) {
this.reservationRepository = reservationRepository;
}
@@ -160,11 +165,6 @@ class SampleRecords {
}
-@RepositoryRestResource
-interface ReservationRepository extends JpaRepository {
-
-}
-
@Entity
class Reservation {
@@ -174,6 +174,14 @@ class Reservation {
private String reservationName; // reservation_name
+ Reservation() { // why JPA why???
+ }
+
+ Reservation(String reservationName) {
+
+ this.reservationName = reservationName;
+ }
+
public Long getId() {
return this.id;
}
@@ -188,12 +196,4 @@ class Reservation {
+ this.reservationName + '\'' + '}';
}
- Reservation() {// why JPA why???
- }
-
- public Reservation(String reservationName) {
-
- this.reservationName = reservationName;
- }
-
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceAsyncIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceAsyncIntegrationTests.java
index ee8c58c00..4226d749f 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceAsyncIntegrationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceAsyncIntegrationTests.java
@@ -1,6 +1,5 @@
-
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +26,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.sleuth.SpanName;
@@ -193,10 +193,10 @@ public class TraceAsyncIntegrationTests {
static class ClassPerformingAsyncLogic {
- AtomicReference span = new AtomicReference<>();
-
private final Tracer tracer;
+ AtomicReference span = new AtomicReference<>();
+
ClassPerformingAsyncLogic(Tracer tracer) {
this.tracer = tracer;
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceCustomFilterResponseInjectorTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceCustomFilterResponseInjectorTests.java
index 48bd3e9b3..30358bdb2 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceCustomFilterResponseInjectorTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceCustomFilterResponseInjectorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,20 +16,22 @@
package org.springframework.cloud.sleuth.instrument.web;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
+
import brave.Span;
import brave.http.HttpTracing;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
@@ -50,9 +52,10 @@ import org.springframework.web.client.RestTemplate;
import org.springframework.web.filter.GenericFilterBean;
import static org.assertj.core.api.BDDAssertions.then;
+import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@RunWith(SpringJUnit4ClassRunner.class)
-@SpringBootTest(classes = TraceCustomFilterResponseInjectorTests.Config.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@SpringBootTest(classes = TraceCustomFilterResponseInjectorTests.Config.class, webEnvironment = RANDOM_PORT)
@DirtiesContext
public class TraceCustomFilterResponseInjectorTests {
@@ -119,7 +122,7 @@ public class TraceCustomFilterResponseInjectorTests {
private final HttpTracing httpTracing;
- public HttpResponseInjectingTraceFilter(HttpTracing httpTracing) {
+ HttpResponseInjectingTraceFilter(HttpTracing httpTracing) {
this.httpTracing = httpTracing;
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterIntegrationTests.java
index 746220b48..8938a7e23 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterIntegrationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,16 +16,17 @@
package org.springframework.cloud.sleuth.instrument.web;
+import java.io.IOException;
+import java.util.Optional;
+import java.util.Random;
+import java.util.concurrent.CompletableFuture;
+
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Optional;
-import java.util.Random;
-import java.util.concurrent.CompletableFuture;
import brave.Span;
import brave.Tracer;
@@ -38,6 +39,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.MDC;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties;
import org.springframework.boot.test.context.SpringBootTest;
@@ -76,6 +78,8 @@ public class TraceFilterIntegrationTests extends AbstractMvcIntegrationTest {
private static Log logger = LogFactory.getLog(TraceFilterIntegrationTests.class);
+ private static Span span;
+
@Autowired
TracingFilter traceFilter;
@@ -88,8 +92,6 @@ public class TraceFilterIntegrationTests extends AbstractMvcIntegrationTest {
@Autowired
Tracer tracer;
- private static Span span;
-
@Before
@After
public void clearSpans() {
@@ -319,6 +321,22 @@ public class TraceFilterIntegrationTests extends AbstractMvcIntegrationTest {
private static final Log log = LogFactory.getLog(Config.class);
+ @Bean
+ public ArrayListSpanReporter testSpanReporter() {
+ return new ArrayListSpanReporter();
+ }
+
+ @Bean
+ Sampler alwaysSampler() {
+ return Sampler.ALWAYS_SAMPLE;
+ }
+
+ @Bean
+ @Order(TraceWebServletAutoConfiguration.TRACING_FILTER_ORDER + 1)
+ Filter myFilter(Tracer tracer) {
+ return new MyFilter(tracer);
+ }
+
@RestController
public static class TestController {
@@ -369,22 +387,6 @@ public class TraceFilterIntegrationTests extends AbstractMvcIntegrationTest {
}
- @Bean
- public ArrayListSpanReporter testSpanReporter() {
- return new ArrayListSpanReporter();
- }
-
- @Bean
- Sampler alwaysSampler() {
- return Sampler.ALWAYS_SAMPLE;
- }
-
- @Bean
- @Order(TraceWebServletAutoConfiguration.TRACING_FILTER_ORDER + 1)
- Filter myFilter(Tracer tracer) {
- return new MyFilter(tracer);
- }
-
}
}
@@ -417,4 +419,4 @@ class MyFilter extends GenericFilterBean {
}
}
-// end::response_headers[]
\ No newline at end of file
+// end::response_headers[]
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterTests.java
index e18f177e2..49206b0bc 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.instrument.web;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;
+
import javax.servlet.Filter;
import brave.ErrorParser;
@@ -32,6 +33,7 @@ import brave.servlet.TracingFilter;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
import org.springframework.cloud.sleuth.util.SpanUtil;
import org.springframework.http.HttpMethod;
@@ -43,8 +45,8 @@ import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.BDDAssertions.then;
-import static org.junit.Assert.assertEquals;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
/**
@@ -296,7 +298,7 @@ public class TraceFilterTests {
this.filter.doFilter(this.request, this.response, this.filterChain);
}
catch (RuntimeException e) {
- assertEquals("Planned", e.getMessage());
+ assertThat(e.getMessage()).isEqualTo("Planned");
}
then(Tracing.current().tracer().currentSpan()).isNull();
@@ -460,6 +462,7 @@ public class TraceFilterTests {
/**
* Shows the expansion of {@link import
* org.springframework.cloud.sleuth.instrument.TraceKeys}.
+ * @param status http status
*/
public void verifyParentSpanHttpTags(HttpStatus status) {
then(this.reporter.getSpans().size()).isGreaterThan(0);
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationMultipleFiltersTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationMultipleFiltersTests.java
index de746335e..35b0d2b0e 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationMultipleFiltersTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationMultipleFiltersTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicReference;
+
import javax.annotation.PreDestroy;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
@@ -32,6 +33,7 @@ import brave.Tracing;
import brave.sampler.Sampler;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -161,10 +163,10 @@ public class TraceFilterWebIntegrationMultipleFiltersTests {
static class MyFilter extends GenericFilterBean {
- AtomicReference span = new AtomicReference<>();
-
private final Tracing tracer;
+ AtomicReference span = new AtomicReference<>();
+
MyFilter(Tracing tracer) {
this.tracer = tracer;
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationTests.java
index 0e0fbd5a2..5d6380779 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceFilterWebIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,6 +32,8 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
+import zipkin2.Span;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
@@ -49,7 +51,6 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
-import zipkin2.Span;
import static org.assertj.core.api.Assertions.fail;
import static org.assertj.core.api.BDDAssertions.then;
@@ -61,6 +62,9 @@ import static org.assertj.core.api.BDDAssertions.then;
@SpringBootTest(classes = TraceFilterWebIntegrationTests.Config.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = "spring.sleuth.http.legacy.enabled=true")
public class TraceFilterWebIntegrationTests {
+ @Rule
+ public OutputCapture capture = new OutputCapture();
+
@Autowired
Tracing tracer;
@@ -74,9 +78,6 @@ public class TraceFilterWebIntegrationTests {
@Autowired
Environment environment;
- @Rule
- public OutputCapture capture = new OutputCapture();
-
@Before
@After
public void cleanup() {
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceNoWebEnvironmentTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceNoWebEnvironmentTests.java
index 15bc56588..2272cd987 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceNoWebEnvironmentTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceNoWebEnvironmentTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.springframework.cloud.sleuth.instrument.web;
import org.junit.Test;
+
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceRestTemplateInterceptorTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceRestTemplateInterceptorTests.java
index 831f547e8..686619a72 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceRestTemplateInterceptorTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceRestTemplateInterceptorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,15 +25,15 @@ import brave.Span;
import brave.Tracer;
import brave.Tracing;
import brave.http.HttpTracing;
-import brave.sampler.Sampler;
import brave.propagation.StrictScopeDecorator;
import brave.propagation.ThreadLocalCurrentTraceContext;
+import brave.sampler.Sampler;
import brave.spring.web.TracingClientHttpRequestInterceptor;
import org.apache.commons.lang3.StringUtils;
import org.junit.After;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
import org.springframework.cloud.sleuth.util.SpanUtil;
import org.springframework.http.HttpHeaders;
@@ -46,6 +46,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
+import static org.assertj.core.api.Assertions.fail;
import static org.assertj.core.api.BDDAssertions.then;
/**
@@ -54,14 +55,6 @@ import static org.assertj.core.api.BDDAssertions.then;
*/
public class TraceRestTemplateInterceptorTests {
- private TestController testController = new TestController();
-
- private MockMvc mockMvc = MockMvcBuilders.standaloneSetup(this.testController)
- .build();
-
- private RestTemplate template = new RestTemplate(
- new MockMvcClientHttpRequestFactory(this.mockMvc));
-
ArrayListSpanReporter reporter = new ArrayListSpanReporter();
Tracing tracing = Tracing.newBuilder()
@@ -73,6 +66,14 @@ public class TraceRestTemplateInterceptorTests {
TraceKeys traceKeys = new TraceKeys();
+ private TestController testController = new TestController();
+
+ private MockMvc mockMvc = MockMvcBuilders.standaloneSetup(this.testController)
+ .build();
+
+ private RestTemplate template = new RestTemplate(
+ new MockMvcClientHttpRequestFactory(this.mockMvc));
+
@Before
public void setup() {
setInterceptors(HttpTracing.create(this.tracing));
@@ -167,7 +168,7 @@ public class TraceRestTemplateInterceptorTests {
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
this.template.getForEntity("/exception", Map.class).getBody();
- Assert.fail("should throw an exception");
+ fail("should throw an exception");
}
catch (RuntimeException e) {
then(e).hasMessage("500 Internal Server Error");
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebDisabledTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebDisabledTests.java
index 91d7e3c75..698bbaa2b 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebDisabledTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebDisabledTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.springframework.cloud.sleuth.instrument.web;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Configuration;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxTests.java
index 748d746d1..03b8c890f 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebFluxTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -254,10 +254,10 @@ public class TraceWebFluxTests {
@RestController
static class Controller2 {
- Span span;
-
private final Tracer tracer;
+ Span span;
+
Controller2(Tracer tracer) {
this.tracer = tracer;
}
@@ -339,6 +339,10 @@ class SleuthSpanCreatorAspectWebFlux {
private final ArrayListSpanReporter reporter;
+ int port;
+
+ private WebTestClient webClient;
+
SleuthSpanCreatorAspectWebFlux(Tracer tracer,
AccessLoggingHttpTraceRepository repository, ArrayListSpanReporter reporter) {
this.tracer = tracer;
@@ -346,19 +350,15 @@ class SleuthSpanCreatorAspectWebFlux {
this.reporter = reporter;
}
- private WebTestClient webClient;
-
- int port;
-
- void setPort(int port) {
- this.port = port;
- }
-
private static String toHexString(Long value) {
BDDAssertions.then(value).isNotNull();
return StringUtils.leftPad(Long.toHexString(value), 16, '0');
}
+ void setPort(int port) {
+ this.port = port;
+ }
+
public void setup() {
this.reporter.clear();
this.repository.clear();
@@ -558,4 +558,4 @@ class TestBean {
() -> Mono.just(this.tracer.currentSpan().context().spanId())));
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfigurationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfigurationTests.java
index 8baa570f1..426d4dfc9 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfigurationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfigurationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.springframework.cloud.sleuth.instrument.web;
import org.junit.Test;
+
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH1102Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH1102Tests.java
index 09b8f9ec7..e952c6f6c 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH1102Tests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH1102Tests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH846Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH846Tests.java
index 1b363b170..cf22a50cc 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH846Tests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/GH846Tests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +18,9 @@ package org.springframework.cloud.sleuth.instrument.web.client;
import javax.annotation.PostConstruct;
-import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
@@ -31,6 +31,8 @@ import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.client.RestTemplate;
+import static org.assertj.core.api.Assertions.assertThat;
+
@SpringBootTest(classes = GH846Tests.App.class, webEnvironment = WebEnvironment.NONE)
@RunWith(SpringRunner.class)
public class GH846Tests {
@@ -41,9 +43,9 @@ public class GH846Tests {
@Test
public void doit() throws Exception {
int count = this.myBean.listAndCount();
- Assert.assertEquals(
- "Change detected in RestTemplate interceptor *after* @PostConstruct",
- count, this.myBean.getCountAtPostConstruct());
+ assertThat(this.myBean.getCountAtPostConstruct())
+ .as("Change detected in RestTemplate interceptor *after* @PostConstruct")
+ .isEqualTo(count);
}
@EnableAutoConfiguration
@@ -67,7 +69,9 @@ public class GH846Tests {
@Autowired
private RestTemplate restTemplate;
- /** Number of interceptors registered in the RestTemplate during @PostConstruct */
+ /**
+ * Number of interceptors registered in the RestTemplate during @PostConstruct.
+ */
private int countAtPostConstruct;
@PostConstruct
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/MultipleAsyncRestTemplateTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/MultipleAsyncRestTemplateTests.java
index 59de1a03c..5d6fce48b 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/MultipleAsyncRestTemplateTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/MultipleAsyncRestTemplateTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -239,7 +239,7 @@ class CustomAsyncClientHttpRequestFactory implements AsyncClientHttpRequestFacto
private final SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
- public CustomAsyncClientHttpRequestFactory() {
+ CustomAsyncClientHttpRequestFactory() {
this.factory.setTaskExecutor(new SimpleAsyncTaskExecutor());
}
@@ -265,4 +265,4 @@ class MyRestController {
return this.tracer.currentSpan().context().traceIdString();
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/RestTemplateTraceAspectIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/RestTemplateTraceAspectIntegrationTests.java
index 77c4b6266..64ce0ca1c 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/RestTemplateTraceAspectIntegrationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/RestTemplateTraceAspectIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,11 +24,12 @@ import java.util.stream.Collectors;
import brave.Tracing;
import brave.sampler.Sampler;
import brave.spring.web.TracingAsyncClientHttpRequestInterceptor;
-import zipkin2.Span;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import zipkin2.Span;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.sleuth.instrument.DefaultTestAutoConfiguration;
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilterTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilterTests.java
index 211f002e0..bcffdc52a 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilterTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRequestHttpHeadersFilterTests.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.sleuth.instrument.web.client;
import java.util.Collections;
@@ -85,4 +101,4 @@ public class TraceRequestHttpHeadersFilterTests {
return headers;
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceResponseHttpHeadersFilterTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceResponseHttpHeadersFilterTests.java
index 6386b2170..144624190 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceResponseHttpHeadersFilterTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceResponseHttpHeadersFilterTests.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.sleuth.instrument.web.client;
import brave.Tracing;
@@ -58,4 +74,4 @@ public class TraceResponseHttpHeadersFilterTests {
BDDAssertions.then(this.reporter.getSpans()).isNotEmpty();
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRestTemplateInterceptorIntegrationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRestTemplateInterceptorIntegrationTests.java
index 283f12be3..5dd313f16 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRestTemplateInterceptorIntegrationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRestTemplateInterceptorIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,18 +20,6 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
-import org.assertj.core.api.BDDAssertions;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
-import org.springframework.http.client.ClientHttpRequestFactory;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
-import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
-import org.springframework.web.client.RestTemplate;
-
import brave.Span;
import brave.Tracer;
import brave.Tracing;
@@ -42,6 +30,19 @@ import brave.spring.web.TracingClientHttpRequestInterceptor;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.SocketPolicy;
+import org.assertj.core.api.BDDAssertions;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
+import org.springframework.http.client.ClientHttpRequestFactory;
+import org.springframework.http.client.ClientHttpRequestInterceptor;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.web.client.RestTemplate;
+
+import static org.assertj.core.api.Assertions.fail;
/**
* @author Marcin Grzejszczak
@@ -51,8 +52,6 @@ public class TraceRestTemplateInterceptorIntegrationTests {
@Rule
public final MockWebServer mockWebServer = new MockWebServer();
- private RestTemplate template = new RestTemplate(clientHttpRequestFactory());
-
ArrayListSpanReporter reporter = new ArrayListSpanReporter();
Tracing tracing = Tracing.newBuilder()
@@ -62,6 +61,8 @@ public class TraceRestTemplateInterceptorIntegrationTests {
Tracer tracer = this.tracing.tracer();
+ private RestTemplate template = new RestTemplate(clientHttpRequestFactory());
+
@Before
public void setup() {
this.template.setInterceptors(Arrays
@@ -85,7 +86,7 @@ public class TraceRestTemplateInterceptorIntegrationTests {
this.template.getForEntity(
"http://localhost:" + this.mockWebServer.getPort() + "/exception",
Map.class).getBody();
- Assert.fail("should throw an exception");
+ fail("should throw an exception");
}
catch (RuntimeException e) {
BDDAssertions.then(e).hasRootCauseInstanceOf(IOException.class);
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfigurationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfigurationTests.java
index 0022de023..909dda85c 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfigurationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebAsyncClientAutoConfigurationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,16 +23,17 @@ import java.util.concurrent.TimeUnit;
import brave.Tracer;
import brave.Tracing;
import brave.sampler.Sampler;
-import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration;
-import zipkin2.Span;
import org.assertj.core.api.BDDAssertions;
import org.awaitility.Awaitility;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import zipkin2.Span;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration;
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -172,4 +173,4 @@ public class TraceWebAsyncClientAutoConfigurationTests {
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfigurationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfigurationTests.java
index 6d6bc4674..e825f95a8 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfigurationTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfigurationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import java.util.List;
import brave.spring.web.TracingClientHttpRequestInterceptor;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -156,4 +157,4 @@ class MySecondClientHttpRequestInterceptor implements ClientHttpRequestIntercept
return execution.execute(request, body);
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessorTest.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessorTest.java
index 1b04f158c..fcad994ee 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessorTest.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientBeanPostProcessorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,9 +16,6 @@
package org.springframework.cloud.sleuth.instrument.web.client;
-import java.net.URI;
-
-import brave.propagation.Propagation;
import org.assertj.core.api.BDDAssertions;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -26,8 +23,6 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.beans.factory.BeanFactory;
-import org.springframework.http.HttpMethod;
-import org.springframework.web.reactive.function.client.ClientRequest;
import org.springframework.web.reactive.function.client.WebClient;
/**
@@ -73,4 +68,4 @@ public class TraceWebClientBeanPostProcessorTest {
});
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/discoveryexception/WebClientDiscoveryExceptionTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/discoveryexception/WebClientDiscoveryExceptionTests.java
index 7af568704..bb2c88b97 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/discoveryexception/WebClientDiscoveryExceptionTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/discoveryexception/WebClientDiscoveryExceptionTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,22 +23,23 @@ import java.util.Map;
import brave.Span;
import brave.Tracer;
import brave.sampler.Sampler;
-import zipkin2.reporter.Reporter;
import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import zipkin2.reporter.Reporter;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration;
-import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration;
+import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.cloud.netflix.ribbon.RibbonClient;
+import org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration;
+import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.ResponseEntity;
@@ -121,6 +122,13 @@ public class WebClientDiscoveryExceptionTests {
}
+ @FunctionalInterface
+ interface ResponseEntityProvider {
+
+ ResponseEntity> get(WebClientDiscoveryExceptionTests webClientTests);
+
+ }
+
@Configuration
@EnableAutoConfiguration(exclude = { EurekaClientAutoConfiguration.class,
TraceWebServletAutoConfiguration.class })
@@ -147,11 +155,4 @@ public class WebClientDiscoveryExceptionTests {
}
- @FunctionalInterface
- interface ResponseEntityProvider {
-
- ResponseEntity> get(WebClientDiscoveryExceptionTests webClientTests);
-
- }
-
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exception/WebClientExceptionTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exception/WebClientExceptionTests.java
index 37f1775f9..e20067f60 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exception/WebClientExceptionTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exception/WebClientExceptionTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,25 +25,28 @@ import brave.Span;
import brave.Tracer;
import brave.Tracing;
import brave.sampler.Sampler;
+import com.netflix.loadbalancer.BaseLoadBalancer;
+import com.netflix.loadbalancer.ILoadBalancer;
+import com.netflix.loadbalancer.Server;
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.rule.OutputCapture;
-import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
+import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.cloud.netflix.ribbon.RibbonClient;
+import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.ResponseEntity;
@@ -54,10 +57,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.client.RestTemplate;
-import com.netflix.loadbalancer.BaseLoadBalancer;
-import com.netflix.loadbalancer.ILoadBalancer;
-import com.netflix.loadbalancer.Server;
-
+import static org.assertj.core.api.Assertions.fail;
import static org.assertj.core.api.BDDAssertions.then;
@RunWith(JUnitParamsRunner.class)
@@ -67,12 +67,12 @@ import static org.assertj.core.api.BDDAssertions.then;
"spring.application.name=exceptionservice" }, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class WebClientExceptionTests {
- private static final Log log = LogFactory
- .getLog(MethodHandles.lookup().lookupClass());
-
@ClassRule
public static final SpringClassRule SCR = new SpringClassRule();
+ private static final Log log = LogFactory
+ .getLog(MethodHandles.lookup().lookupClass());
+
@Rule
public final SpringMethodRule springMethodRule = new SpringMethodRule();
@@ -107,7 +107,7 @@ public class WebClientExceptionTests {
try (Tracer.SpanInScope ws = this.tracer.tracer().withSpanInScope(span)) {
log.info("Started new span " + span);
provider.get(this);
- Assert.fail("should throw an exception");
+ fail("should throw an exception");
}
catch (RuntimeException e) {
// SleuthAssertions.then(e).hasRootCauseInstanceOf(IOException.class);
@@ -137,6 +137,13 @@ public class WebClientExceptionTests {
}
+ @FunctionalInterface
+ interface ResponseEntityProvider {
+
+ ResponseEntity> get(WebClientExceptionTests webClientTests);
+
+ }
+
@Configuration
@EnableAutoConfiguration
@EnableFeignClients
@@ -177,11 +184,4 @@ public class WebClientExceptionTests {
}
- @FunctionalInterface
- interface ResponseEntityProvider {
-
- ResponseEntity> get(WebClientExceptionTests webClientTests);
-
- }
-
}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exceptionresolver/Issue585Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exceptionresolver/Issue585Tests.java
index 55283b778..a4e1d2885 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exceptionresolver/Issue585Tests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/exceptionresolver/Issue585Tests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package org.springframework.cloud.sleuth.instrument.web.client.exceptionresolver;
import java.time.Instant;
+
import javax.servlet.http.HttpServletRequest;
import brave.Span;
@@ -27,6 +28,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
@@ -114,7 +116,7 @@ class CustomExceptionHandler extends ResponseEntityExceptionHandler {
@Autowired
private Tracing tracer;
- @ExceptionHandler(value = { Exception.class })
+ @ExceptionHandler(Exception.class)
protected ResponseEntity handleDefaultError(Exception ex,
HttpServletRequest request) {
ExceptionResponse exceptionResponse = new ExceptionResponse("ERR-01",
@@ -195,4 +197,4 @@ class ExceptionResponse {
this.epochTime = epochTime;
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignRetriesTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignRetriesTests.java
index d878f455f..2a15054e9 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignRetriesTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/FeignRetriesTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspectTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspectTests.java
index d3dfe9c55..ef217be34 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspectTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceFeignAspectTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+
import org.springframework.beans.factory.BeanFactory;
import org.springframework.cloud.sleuth.instrument.web.SleuthHttpParserAccessor;
@@ -105,4 +106,4 @@ public class TraceFeignAspectTests {
verify(this.pjp).proceed();
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClientTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClientTests.java
index 2d2f778b6..5b03cce80 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClientTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignClientTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@ import org.junit.runner.RunWith;
import org.mockito.BDDMockito;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+
import org.springframework.beans.factory.BeanFactory;
import org.springframework.cloud.sleuth.instrument.web.SleuthHttpParserAccessor;
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
@@ -136,4 +137,4 @@ public class TracingFeignClientTests {
return sb.toString();
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignObjectWrapperTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignObjectWrapperTests.java
index 5f6cc53ef..7e1dd3885 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignObjectWrapperTests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TracingFeignObjectWrapperTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+
import org.springframework.beans.factory.BeanFactory;
import static org.assertj.core.api.BDDAssertions.then;
@@ -58,4 +59,4 @@ public class TracingFeignObjectWrapperTests {
.isSameAs(notFeignRelatedObject);
}
-}
\ No newline at end of file
+}
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue307/Issue307Tests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue307/Issue307Tests.java
index e3741d521..0bec5c77e 100644
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue307/Issue307Tests.java
+++ b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/client/feign/issues/issue307/Issue307Tests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2018 the original author or authors.
+ * Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,9 +20,11 @@ import java.util.ArrayList;
import java.util.List;
import brave.sampler.Sampler;
+import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -40,7 +42,13 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
-import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
+@FeignClient("participants")
+interface ParticipantsClient {
+
+ @RequestMapping(method = RequestMethod.GET, value = "/races/{raceId}")
+ List