Revert "Fixed the build"

This reverts commit 3107d3f3
This commit is contained in:
Marcin Grzejszczak
2019-02-07 13:12:21 +01:00
parent 5d03cddb07
commit 8c82c8aa9f
15 changed files with 132 additions and 115 deletions

View File

@@ -25,7 +25,7 @@ package org.springframework.cloud.sleuth.annotation;
class NoOpTagValueResolver implements TagValueResolver {
@Override
public String resolve() {
public String resolve(Object parameter) {
return null;
}

View File

@@ -151,7 +151,7 @@ class SpanTagAnnotationHandler {
if (annotation.resolver() != NoOpTagValueResolver.class) {
TagValueResolver tagValueResolver = this.beanFactory
.getBean(annotation.resolver());
return tagValueResolver.resolve();
return tagValueResolver.resolve(argument);
}
else if (StringUtils.hasText(annotation.expression())) {
return this.beanFactory.getBean(TagValueExpressionResolver.class)

View File

@@ -26,8 +26,9 @@ public interface TagValueResolver {
/**
* Returns the tag value for the given parameter.
* @param parameter - parameter annotated with {@link SpanTag}
* @return the value of the tag
*/
String resolve();
String resolve(Object parameter);
}

View File

@@ -141,7 +141,7 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
headers.setImmutable();
Span result = this.tracer.nextSpan(extracted);
if (extracted.context() == null && !result.isNoop()) {
addTags(result, null);
addTags(message, result, null);
}
if (log.isDebugEnabled()) {
log.debug("Created a new span " + result);
@@ -167,7 +167,7 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
if (!span.isNoop()) {
span.kind(Span.Kind.PRODUCER).name("send").start();
span.remoteServiceName(REMOTE_SERVICE_NAME);
addTags(span, channel);
addTags(message, span, channel);
}
if (log.isDebugEnabled()) {
log.debug("Created a new span in pre send" + span);
@@ -253,7 +253,7 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
if (!span.isNoop()) {
span.kind(Span.Kind.CONSUMER).name("receive").start();
span.remoteServiceName(REMOTE_SERVICE_NAME);
addTags(span, channel);
addTags(message, span, channel);
}
if (log.isDebugEnabled()) {
log.debug("Created a new span in post receive " + span);
@@ -292,7 +292,7 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
if (!consumerSpan.isNoop()) {
consumerSpan.kind(Span.Kind.CONSUMER).start();
consumerSpan.remoteServiceName(REMOTE_SERVICE_NAME);
addTags(consumerSpan, channel);
addTags(message, consumerSpan, channel);
consumerSpan.finish();
}
// create and scope a span for the message processor
@@ -331,7 +331,7 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
/**
* When an upstream context was not present, lookup keys are unlikely added
*/
void addTags(SpanCustomizer result, MessageChannel channel) {
void addTags(Message<?> message, SpanCustomizer result, MessageChannel channel) {
// TODO topic etc
if (channel != null) {
result.tag("channel", messageChannelName(channel));

View File

@@ -106,6 +106,8 @@ class HttpClientBeanPostProcessor implements BeanPostProcessor {
HttpTracing httpTracing;
Tracer tracer;
HttpClientHandler<HttpClientRequest, HttpClientResponse> handler;
TraceContext.Injector<HttpHeaders> injector;

View File

@@ -27,7 +27,7 @@ public class NoOpTagValueResolverTests {
@Test
public void should_return_null() throws Exception {
then(new NoOpTagValueResolver().resolve()).isNull();
then(new NoOpTagValueResolver().resolve("")).isNull();
}
}

View File

@@ -131,7 +131,7 @@ public class SleuthSpanCreatorAspectFluxTests {
@Test
public void shouldCreateSpanWithTagWhenAnnotationOnInterfaceMethod() {
// tag::execution[]
Flux<String> flux = this.testBean.testMethod5();
Flux<String> flux = this.testBean.testMethod5("test");
// end::execution[]
verifyNoSpansUntilFluxComplete(flux);
@@ -148,7 +148,7 @@ public class SleuthSpanCreatorAspectFluxTests {
@Test
public void shouldCreateSpanWithTagWhenAnnotationOnClassMethod() {
Flux<String> flux = this.testBean.testMethod6();
Flux<String> flux = this.testBean.testMethod6("test");
verifyNoSpansUntilFluxComplete(flux);
@@ -164,7 +164,7 @@ public class SleuthSpanCreatorAspectFluxTests {
@Test
public void shouldCreateSpanWithLogWhenAnnotationOnInterfaceMethod() {
Flux<String> flux = this.testBean.testMethod8();
Flux<String> flux = this.testBean.testMethod8("test");
verifyNoSpansUntilFluxComplete(flux);
@@ -179,7 +179,7 @@ public class SleuthSpanCreatorAspectFluxTests {
@Test
public void shouldCreateSpanWithLogWhenAnnotationOnClassMethod() {
Flux<String> flux = this.testBean.testMethod9();
Flux<String> flux = this.testBean.testMethod9("test");
verifyNoSpansUntilFluxComplete(flux);
@@ -199,7 +199,7 @@ public class SleuthSpanCreatorAspectFluxTests {
Span span = this.tracer.nextSpan().name("foo");
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
Flux<String> flux = this.testBean.testMethod10();
Flux<String> flux = this.testBean.testMethod10("test");
verifyNoSpansUntilFluxComplete(flux);
}
@@ -222,7 +222,7 @@ public class SleuthSpanCreatorAspectFluxTests {
@Test
public void shouldStartAndCloseSpanOnContinueSpanIfSpanNotSet() {
Flux<String> flux = this.testBean.testMethod10();
Flux<String> flux = this.testBean.testMethod10("test");
verifyNoSpansUntilFluxComplete(flux);
Awaitility.await().untilAsserted(() -> {
@@ -243,7 +243,7 @@ public class SleuthSpanCreatorAspectFluxTests {
Span span = this.tracer.nextSpan().name("foo");
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
Flux<String> flux = this.testBean.testMethod10_v2();
Flux<String> flux = this.testBean.testMethod10_v2("test");
verifyNoSpansUntilFluxComplete(flux);
}
@@ -270,7 +270,7 @@ public class SleuthSpanCreatorAspectFluxTests {
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
// tag::continue_span_execution[]
Flux<String> flux = this.testBean.testMethod11();
Flux<String> flux = this.testBean.testMethod11("test");
// end::continue_span_execution[]
verifyNoSpansUntilFluxComplete(flux);
}
@@ -296,7 +296,7 @@ public class SleuthSpanCreatorAspectFluxTests {
@Test
public void shouldAddErrorTagWhenExceptionOccurredInNewSpan() {
try {
Flux<String> flux = this.testBean.testMethod12();
Flux<String> flux = this.testBean.testMethod12("test");
then(this.reporter.getSpans()).isEmpty();
@@ -428,38 +428,38 @@ public class SleuthSpanCreatorAspectFluxTests {
// tag::custom_name_and_tag_on_annotated_method[]
@NewSpan(name = "customNameOnTestMethod5")
Flux<String> testMethod5();
Flux<String> testMethod5(@SpanTag("testTag") String param);
// end::custom_name_and_tag_on_annotated_method[]
Flux<String> testMethod6();
Flux<String> testMethod6(String test);
Flux<String> testMethod7();
@NewSpan(name = "customNameOnTestMethod8")
Flux<String> testMethod8();
Flux<String> testMethod8(String param);
@NewSpan(name = "testMethod9")
Flux<String> testMethod9();
Flux<String> testMethod9(String param);
@ContinueSpan(log = "customTest")
Flux<String> testMethod10();
Flux<String> testMethod10(@SpanTag(value = "testTag10") String param);
@ContinueSpan(log = "customTest")
Flux<String> testMethod10_v2();
Flux<String> testMethod10_v2(@SpanTag(key = "testTag10") String param);
// tag::continue_span[]
@ContinueSpan(log = "testMethod11")
Flux<String> testMethod11();
Flux<String> testMethod11(@SpanTag("testTag11") String param);
// end::continue_span[]
@NewSpan
Flux<String> testMethod12();
Flux<String> testMethod12(@SpanTag("testTag12") String param);
@ContinueSpan(log = "testMethod13")
Flux<String> testMethod13();
@ContinueSpan
Flux<String> testMethod14();
Flux<String> testMethod14(String param);
@NewSpan(name = "spanInTraceContext")
Flux<Long> newSpanInTraceContext();
@@ -527,13 +527,13 @@ public class SleuthSpanCreatorAspectFluxTests {
}
@Override
public Flux<String> testMethod5() {
public Flux<String> testMethod5(String test) {
return this.testFlux;
}
@NewSpan(name = "customNameOnTestMethod6")
@Override
public Flux<String> testMethod6() {
public Flux<String> testMethod6(@SpanTag("testTag6") String test) {
return this.testFlux;
}
@@ -543,34 +543,36 @@ public class SleuthSpanCreatorAspectFluxTests {
}
@Override
public Flux<String> testMethod8() {
public Flux<String> testMethod8(String param) {
return this.testFlux;
}
@NewSpan(name = "customNameOnTestMethod9")
@Override
public Flux<String> testMethod9() {
public Flux<String> testMethod9(String param) {
return this.testFlux;
}
@Override
public Flux<String> testMethod10() {
public Flux<String> testMethod10(
@SpanTag(value = "customTestTag10") String param) {
return this.testFlux;
}
@Override
public Flux<String> testMethod10_v2() {
public Flux<String> testMethod10_v2(
@SpanTag(key = "customTestTag10") String param) {
return this.testFlux;
}
@ContinueSpan(log = "customTest")
@Override
public Flux<String> testMethod11() {
public Flux<String> testMethod11(@SpanTag("customTestTag11") String param) {
return this.testFlux;
}
@Override
public Flux<String> testMethod12() {
public Flux<String> testMethod12(String param) {
return Flux
.defer(() -> Flux.error(new RuntimeException("test exception 12")));
}
@@ -582,7 +584,7 @@ public class SleuthSpanCreatorAspectFluxTests {
}
@Override
public Flux<String> testMethod14() {
public Flux<String> testMethod14(String param) {
return Flux.just(TEST_STRING1, TEST_STRING2);
}

View File

@@ -44,12 +44,11 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.BDDAssertions.then;
import static org.springframework.cloud.sleuth.annotation.SleuthSpanCreatorAspectMonoTests.TestBean.TEST_STRING;
import static org.springframework.test.annotation.DirtiesContext.MethodMode.BEFORE_METHOD;
import static reactor.core.publisher.Mono.just;
@SpringBootTest(classes = SleuthSpanCreatorAspectMonoTests.TestConfiguration.class)
@RunWith(SpringRunner.class)
@DirtiesContext(methodMode = BEFORE_METHOD)
@DirtiesContext
public class SleuthSpanCreatorAspectMonoTests {
@Autowired
@@ -141,7 +140,7 @@ public class SleuthSpanCreatorAspectMonoTests {
@Test
public void shouldCreateSpanWithTagWhenAnnotationOnInterfaceMethod() {
// tag::execution[]
Mono<String> mono = this.testBean.testMethod5();
Mono<String> mono = this.testBean.testMethod5("test");
// end::execution[]
then(this.reporter.getSpans()).isEmpty();
@@ -160,7 +159,7 @@ public class SleuthSpanCreatorAspectMonoTests {
@Test
public void shouldCreateSpanWithTagWhenAnnotationOnClassMethod() {
Mono<String> mono = this.testBean.testMethod6();
Mono<String> mono = this.testBean.testMethod6("test");
then(this.reporter.getSpans()).isEmpty();
@@ -178,7 +177,7 @@ public class SleuthSpanCreatorAspectMonoTests {
@Test
public void shouldCreateSpanWithLogWhenAnnotationOnInterfaceMethod() {
Mono<String> mono = this.testBean.testMethod8();
Mono<String> mono = this.testBean.testMethod8("test");
then(this.reporter.getSpans()).isEmpty();
@@ -195,7 +194,7 @@ public class SleuthSpanCreatorAspectMonoTests {
@Test
public void shouldCreateSpanWithLogWhenAnnotationOnClassMethod() {
Mono<String> mono = this.testBean.testMethod9();
Mono<String> mono = this.testBean.testMethod9("test");
then(this.reporter.getSpans()).isEmpty();
@@ -217,7 +216,7 @@ public class SleuthSpanCreatorAspectMonoTests {
Span span = this.tracer.nextSpan().name("foo");
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
Mono<String> mono = this.testBean.testMethod10();
Mono<String> mono = this.testBean.testMethod10("test");
then(this.reporter.getSpans()).isEmpty();
@@ -242,7 +241,7 @@ public class SleuthSpanCreatorAspectMonoTests {
@Test
public void shouldStartAndCloseSpanOnContinueSpanIfSpanNotSet() {
this.testBean.testMethod10().block();
this.testBean.testMethod10("test").block();
Awaitility.await().untilAsserted(() -> {
List<zipkin2.Span> spans = this.reporter.getSpans();
@@ -262,7 +261,7 @@ public class SleuthSpanCreatorAspectMonoTests {
Span span = this.tracer.nextSpan().name("foo");
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
Mono<String> mono = this.testBean.testMethod10_v2();
Mono<String> mono = this.testBean.testMethod10_v2("test");
then(this.reporter.getSpans()).isEmpty();
@@ -291,7 +290,7 @@ public class SleuthSpanCreatorAspectMonoTests {
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
// tag::continue_span_execution[]
Mono<String> mono = this.testBean.testMethod11();
Mono<String> mono = this.testBean.testMethod11("test");
// end::continue_span_execution[]
then(this.reporter.getSpans()).isEmpty();
@@ -319,7 +318,7 @@ public class SleuthSpanCreatorAspectMonoTests {
@Test
public void shouldAddErrorTagWhenExceptionOccurredInNewSpan() {
try {
Mono<String> mono = this.testBean.testMethod12();
Mono<String> mono = this.testBean.testMethod12("test");
then(this.reporter.getSpans()).isEmpty();
@@ -490,32 +489,32 @@ public class SleuthSpanCreatorAspectMonoTests {
// tag::custom_name_and_tag_on_annotated_method[]
@NewSpan(name = "customNameOnTestMethod5")
Mono<String> testMethod5();
Mono<String> testMethod5(@SpanTag("testTag") String param);
// end::custom_name_and_tag_on_annotated_method[]
Mono<String> testMethod6();
Mono<String> testMethod6(String test);
Mono<String> testMethod7();
@NewSpan(name = "customNameOnTestMethod8")
Mono<String> testMethod8();
Mono<String> testMethod8(String param);
@NewSpan(name = "testMethod9")
Mono<String> testMethod9();
Mono<String> testMethod9(String param);
@ContinueSpan(log = "customTest")
Mono<String> testMethod10();
Mono<String> testMethod10(@SpanTag(value = "testTag10") String param);
@ContinueSpan(log = "customTest")
Mono<String> testMethod10_v2();
Mono<String> testMethod10_v2(@SpanTag(key = "testTag10") String param);
// tag::continue_span[]
@ContinueSpan(log = "testMethod11")
Mono<String> testMethod11();
Mono<String> testMethod11(@SpanTag("testTag11") String param);
// end::continue_span[]
@NewSpan
Mono<String> testMethod12();
Mono<String> testMethod12(@SpanTag("testTag12") String param);
@ContinueSpan(log = "testMethod13")
Mono<String> testMethod13();
@@ -565,13 +564,13 @@ public class SleuthSpanCreatorAspectMonoTests {
}
@Override
public Mono<String> testMethod5() {
public Mono<String> testMethod5(String test) {
return TEST_MONO;
}
@NewSpan(name = "customNameOnTestMethod6")
@Override
public Mono<String> testMethod6() {
public Mono<String> testMethod6(@SpanTag("testTag6") String test) {
return TEST_MONO;
}
@@ -581,34 +580,36 @@ public class SleuthSpanCreatorAspectMonoTests {
}
@Override
public Mono<String> testMethod8() {
public Mono<String> testMethod8(String param) {
return TEST_MONO;
}
@NewSpan(name = "customNameOnTestMethod9")
@Override
public Mono<String> testMethod9() {
public Mono<String> testMethod9(String param) {
return TEST_MONO;
}
@Override
public Mono<String> testMethod10() {
public Mono<String> testMethod10(
@SpanTag(value = "customTestTag10") String param) {
return TEST_MONO;
}
@Override
public Mono<String> testMethod10_v2() {
public Mono<String> testMethod10_v2(
@SpanTag(key = "customTestTag10") String param) {
return TEST_MONO;
}
@ContinueSpan(log = "customTest")
@Override
public Mono<String> testMethod11() {
public Mono<String> testMethod11(@SpanTag("customTestTag11") String param) {
return TEST_MONO;
}
@Override
public Mono<String> testMethod12() {
public Mono<String> testMethod12(String param) {
return Mono
.defer(() -> Mono.error(new RuntimeException("test exception 12")));
}

View File

@@ -95,9 +95,9 @@ public class SleuthSpanCreatorAspectNegativeTests {
void testMethod4();
@NewSpan(name = "testMethod5")
void testMethod5();
void testMethod5(@SpanTag("testTag") String test);
void testMethod6();
void testMethod6(String test);
void testMethod7();
@@ -124,12 +124,12 @@ public class SleuthSpanCreatorAspectNegativeTests {
}
@Override
public void testMethod5() {
public void testMethod5(String test) {
}
@NewSpan(name = "testMethod6")
@Override
public void testMethod6() {
public void testMethod6(@SpanTag("testTag6") String test) {
}

View File

@@ -105,7 +105,7 @@ public class SleuthSpanCreatorAspectTests {
@Test
public void shouldCreateSpanWithTagWhenAnnotationOnInterfaceMethod() {
// tag::execution[]
this.testBean.testMethod5();
this.testBean.testMethod5("test");
// end::execution[]
List<zipkin2.Span> spans = this.reporter.getSpans();
@@ -118,7 +118,7 @@ public class SleuthSpanCreatorAspectTests {
@Test
public void shouldCreateSpanWithTagWhenAnnotationOnClassMethod() {
this.testBean.testMethod6();
this.testBean.testMethod6("test");
List<zipkin2.Span> spans = this.reporter.getSpans();
then(spans).hasSize(1);
@@ -130,7 +130,7 @@ public class SleuthSpanCreatorAspectTests {
@Test
public void shouldCreateSpanWithLogWhenAnnotationOnInterfaceMethod() {
this.testBean.testMethod8();
this.testBean.testMethod8("test");
List<zipkin2.Span> spans = this.reporter.getSpans();
then(spans).hasSize(1);
@@ -141,7 +141,7 @@ public class SleuthSpanCreatorAspectTests {
@Test
public void shouldCreateSpanWithLogWhenAnnotationOnClassMethod() {
this.testBean.testMethod9();
this.testBean.testMethod9("test");
List<zipkin2.Span> spans = this.reporter.getSpans();
then(spans).hasSize(1);
@@ -157,7 +157,7 @@ public class SleuthSpanCreatorAspectTests {
Span span = this.tracer.nextSpan().name("foo");
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
this.testBean.testMethod10();
this.testBean.testMethod10("test");
}
finally {
span.finish();
@@ -176,7 +176,7 @@ public class SleuthSpanCreatorAspectTests {
@Test
public void shouldStartAndCloseSpanOnContinueSpanIfSpanNotSet() {
this.testBean.testMethod10();
this.testBean.testMethod10("test");
List<zipkin2.Span> spans = this.reporter.getSpans();
then(spans).hasSize(1);
@@ -194,7 +194,7 @@ public class SleuthSpanCreatorAspectTests {
Span span = this.tracer.nextSpan().name("foo");
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
this.testBean.testMethod10_v2();
this.testBean.testMethod10_v2("test");
}
finally {
span.finish();
@@ -217,7 +217,7 @@ public class SleuthSpanCreatorAspectTests {
try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
// tag::continue_span_execution[]
this.testBean.testMethod11();
this.testBean.testMethod11("test");
// end::continue_span_execution[]
}
finally {
@@ -240,7 +240,7 @@ public class SleuthSpanCreatorAspectTests {
@Test
public void shouldAddErrorTagWhenExceptionOccurredInNewSpan() {
try {
this.testBean.testMethod12();
this.testBean.testMethod12("test");
}
catch (RuntimeException ignored) {
}
@@ -308,32 +308,32 @@ public class SleuthSpanCreatorAspectTests {
// tag::custom_name_and_tag_on_annotated_method[]
@NewSpan(name = "customNameOnTestMethod5")
void testMethod5();
void testMethod5(@SpanTag("testTag") String param);
// end::custom_name_and_tag_on_annotated_method[]
void testMethod6();
void testMethod6(String test);
void testMethod7();
@NewSpan(name = "customNameOnTestMethod8")
void testMethod8();
void testMethod8(String param);
@NewSpan(name = "testMethod9")
void testMethod9();
void testMethod9(String param);
@ContinueSpan(log = "customTest")
void testMethod10();
void testMethod10(@SpanTag(value = "testTag10") String param);
@ContinueSpan(log = "customTest")
void testMethod10_v2();
void testMethod10_v2(@SpanTag(key = "testTag10") String param);
// tag::continue_span[]
@ContinueSpan(log = "testMethod11")
void testMethod11();
void testMethod11(@SpanTag("testTag11") String param);
// end::continue_span[]
@NewSpan
void testMethod12();
void testMethod12(@SpanTag("testTag12") String param);
@ContinueSpan(log = "testMethod13")
void testMethod13();
@@ -363,12 +363,12 @@ public class SleuthSpanCreatorAspectTests {
}
@Override
public void testMethod5() {
public void testMethod5(String test) {
}
@NewSpan(name = "customNameOnTestMethod6")
@Override
public void testMethod6() {
public void testMethod6(@SpanTag("testTag6") String test) {
}
@@ -377,34 +377,34 @@ public class SleuthSpanCreatorAspectTests {
}
@Override
public void testMethod8() {
public void testMethod8(String param) {
}
@NewSpan(name = "customNameOnTestMethod9")
@Override
public void testMethod9() {
public void testMethod9(String param) {
}
@Override
public void testMethod10() {
public void testMethod10(@SpanTag(value = "customTestTag10") String param) {
}
@Override
public void testMethod10_v2() {
public void testMethod10_v2(@SpanTag(key = "customTestTag10") String param) {
}
@ContinueSpan(log = "customTest")
@Override
public void testMethod11() {
public void testMethod11(@SpanTag("customTestTag11") String param) {
}
@Override
public void testMethod12() {
public void testMethod12(String param) {
throw new RuntimeException("test exception 12");
}

View File

@@ -103,19 +103,21 @@ public class SpanTagAnnotationHandlerTests {
// tag::resolver_bean[]
@NewSpan
public void getAnnotationForTagValueResolver() {
public void getAnnotationForTagValueResolver(
@SpanTag(key = "test", resolver = TagValueResolver.class) String test) {
}
// end::resolver_bean[]
// tag::spel[]
@NewSpan
public void getAnnotationForTagValueExpression() {
public void getAnnotationForTagValueExpression(
@SpanTag(key = "test", expression = "'hello' + ' characters'") String test) {
}
// end::spel[]
// tag::toString[]
@NewSpan
public void getAnnotationForArgumentToString() {
public void getAnnotationForArgumentToString(@SpanTag("test") Long param) {
}
// end::toString[]
@@ -128,7 +130,7 @@ public class SpanTagAnnotationHandlerTests {
// tag::custom_resolver[]
@Bean(name = "myCustomTagValueResolver")
public TagValueResolver tagValueResolver() {
return () -> "Value from myCustomTagValueResolver";
return parameter -> "Value from myCustomTagValueResolver";
}
// end::custom_resolver[]

View File

@@ -71,7 +71,8 @@ public class TraceableScheduledExecutorServiceTest {
this.traceableScheduledExecutorService.schedule(aRunnable(), 1L, TimeUnit.DAYS);
then(this.scheduledExecutorService).should().schedule(
(Runnable) BDDMockito.argThat(matcher(instanceOf(TraceRunnable.class))),
BDDMockito.argThat(
matcher(Runnable.class, instanceOf(TraceRunnable.class))),
anyLong(), any(TimeUnit.class));
}
@@ -80,7 +81,8 @@ public class TraceableScheduledExecutorServiceTest {
this.traceableScheduledExecutorService.schedule(aCallable(), 1L, TimeUnit.DAYS);
then(this.scheduledExecutorService).should().schedule(
(Callable) BDDMockito.argThat(matcher(instanceOf(TraceCallable.class))),
BDDMockito.argThat(
matcher(Callable.class, instanceOf(TraceCallable.class))),
anyLong(), any(TimeUnit.class));
}
@@ -90,8 +92,9 @@ public class TraceableScheduledExecutorServiceTest {
TimeUnit.DAYS);
then(this.scheduledExecutorService).should().scheduleAtFixedRate(
BDDMockito.argThat(matcher(instanceOf(TraceRunnable.class))), anyLong(),
anyLong(), any(TimeUnit.class));
BDDMockito.argThat(
matcher(Runnable.class, instanceOf(TraceRunnable.class))),
anyLong(), anyLong(), any(TimeUnit.class));
}
@Test
@@ -100,8 +103,9 @@ public class TraceableScheduledExecutorServiceTest {
TimeUnit.DAYS);
then(this.scheduledExecutorService).should().scheduleWithFixedDelay(
BDDMockito.argThat(matcher(instanceOf(TraceRunnable.class))), anyLong(),
anyLong(), any(TimeUnit.class));
BDDMockito.argThat(
matcher(Runnable.class, instanceOf(TraceRunnable.class))),
anyLong(), anyLong(), any(TimeUnit.class));
}
@Test
@@ -111,7 +115,8 @@ public class TraceableScheduledExecutorServiceTest {
this.traceableScheduledExecutorService.schedule(aRunnable(), 1L, TimeUnit.DAYS);
then(this.scheduledExecutorService).should(never()).schedule(
(Runnable) BDDMockito.argThat(matcher(instanceOf(TraceRunnable.class))),
BDDMockito.argThat(
matcher(Runnable.class, instanceOf(TraceRunnable.class))),
anyLong(), any(TimeUnit.class));
}
@@ -122,7 +127,8 @@ public class TraceableScheduledExecutorServiceTest {
this.traceableScheduledExecutorService.schedule(aCallable(), 1L, TimeUnit.DAYS);
then(this.scheduledExecutorService).should(never()).schedule(
(Callable) BDDMockito.argThat(matcher(instanceOf(TraceCallable.class))),
BDDMockito.argThat(
matcher(Callable.class, instanceOf(TraceCallable.class))),
anyLong(), any(TimeUnit.class));
}
@@ -134,8 +140,9 @@ public class TraceableScheduledExecutorServiceTest {
TimeUnit.DAYS);
then(this.scheduledExecutorService).should(never()).scheduleAtFixedRate(
BDDMockito.argThat(matcher(instanceOf(TraceRunnable.class))), anyLong(),
anyLong(), any(TimeUnit.class));
BDDMockito.argThat(
matcher(Runnable.class, instanceOf(TraceRunnable.class))),
anyLong(), anyLong(), any(TimeUnit.class));
}
@Test
@@ -146,15 +153,16 @@ public class TraceableScheduledExecutorServiceTest {
TimeUnit.DAYS);
then(this.scheduledExecutorService).should(never()).scheduleWithFixedDelay(
BDDMockito.argThat(matcher(instanceOf(TraceRunnable.class))), anyLong(),
anyLong(), any(TimeUnit.class));
BDDMockito.argThat(
matcher(Runnable.class, instanceOf(TraceRunnable.class))),
anyLong(), anyLong(), any(TimeUnit.class));
}
Predicate<Object> instanceOf(Class clazz) {
return (argument) -> argument.getClass().isAssignableFrom(clazz);
}
<T> ArgumentMatcher<T> matcher(Predicate predicate) {
<T> ArgumentMatcher<T> matcher(Class<T> clazz, Predicate predicate) {
return predicate::test;
}

View File

@@ -21,12 +21,13 @@ public final class HelloServiceOuterClass {
private HelloServiceOuterClass() {
}
public static void registerAllExtensions() {
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions();
registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry);
}
static final com.google.protobuf.Descriptors.Descriptor internal_static_sample_grpc_HelloRequest_descriptor;

View File

@@ -112,7 +112,7 @@ class ParticipantsBean {
return this.participantsClient.getParticipants(raceId);
}
public List<Object> defaultParticipants() {
public List<Object> defaultParticipants(String raceId) {
return new ArrayList<>();
}

View File

@@ -114,7 +114,7 @@ class ZipkinRestTemplateSenderConfiguration {
ZipkinUrlExtractor zipkinUrlExtractor(final ZipkinLoadBalancer zipkinLoadBalancer) {
return new ZipkinUrlExtractor() {
@Override
public URI zipkinUrl() {
public URI zipkinUrl(ZipkinProperties zipkinProperties) {
return zipkinLoadBalancer.instance();
}
};
@@ -145,7 +145,7 @@ class ZipkinRestTemplateWrapper extends RestTemplate {
protected <T> T doExecute(URI originalUrl, HttpMethod method,
RequestCallback requestCallback, ResponseExtractor<T> responseExtractor)
throws RestClientException {
URI uri = this.extractor.zipkinUrl();
URI uri = this.extractor.zipkinUrl(this.zipkinProperties);
URI newUri = resolvedZipkinUri(originalUrl, uri);
return super.doExecute(newUri, method, requestCallback, responseExtractor);
}
@@ -175,7 +175,7 @@ class ZipkinRestTemplateWrapper extends RestTemplate {
*/
interface ZipkinUrlExtractor {
URI zipkinUrl();
URI zipkinUrl(ZipkinProperties zipkinProperties);
}