Merge branch '2.2.x'

This commit is contained in:
Marcin Grzejszczak
2020-10-26 12:05:54 +01:00
5 changed files with 37 additions and 16 deletions

View File

@@ -281,7 +281,7 @@
<spring-cloud-function.version>3.1.0-SNAPSHOT</spring-cloud-function.version>
<spring-cloud-netflix.version>3.0.0-SNAPSHOT</spring-cloud-netflix.version>
<spring-cloud-openfeign.version>3.0.0-SNAPSHOT</spring-cloud-openfeign.version>
<brave.version>5.12.3</brave.version>
<brave.version>5.12.6</brave.version>
<opentracing.version>0.32.0</opentracing.version>
<opentelemetry.version>0.9.1</opentelemetry.version>
<!-- From maven local -->

View File

@@ -31,7 +31,7 @@
<name>spring-cloud-sleuth-dependencies</name>
<description>Spring Cloud Sleuth Dependencies</description>
<properties>
<brave.version>5.12.3</brave.version>
<brave.version>5.12.6</brave.version>
<brave.opentracing.version>0.37.2</brave.opentracing.version>
<grpc.spring.boot.version>4.0.0</grpc.spring.boot.version>
<opentelemetry.version>0.9.1</opentelemetry.version>

View File

@@ -97,6 +97,11 @@ abstract class ITSpringConfiguredReactorClient extends ITHttpAsyncClient<Annotat
getMono(context, pathIncludingQuery).block();
}
@Override
final protected void options(AnnotationConfigApplicationContext context, String path) {
optionsMono(context, path).block();
}
@Override
final protected void post(AnnotationConfigApplicationContext context, String pathIncludingQuery, String body) {
postMono(context, pathIncludingQuery, body).block();
@@ -108,12 +113,17 @@ abstract class ITSpringConfiguredReactorClient extends ITHttpAsyncClient<Annotat
TestHttpCallbackSubscriber.subscribe(getMono(context, path), callback);
}
/** Returns a {@link Mono} of the HTTP status code from the given "POST" request. */
abstract Mono<Integer> postMono(AnnotationConfigApplicationContext context, String pathIncludingQuery, String body);
/** Returns a {@link Mono} of the HTTP status code. */
abstract Mono<Integer> getMono(AnnotationConfigApplicationContext context, String pathIncludingQuery);
/**
* Returns a {@link Mono} of the HTTP status code from the given "OPTIONS" request.
*/
abstract Mono<Integer> optionsMono(AnnotationConfigApplicationContext context, String path);
/** Returns a {@link Mono} of the HTTP status code from the given "POST" request. */
abstract Mono<Integer> postMono(AnnotationConfigApplicationContext context, String pathIncludingQuery, String body);
/**
* This assumes that implementations do not issue an HTTP request until
* {@link Subscription#request(long)} is called. Since a client span is only for

View File

@@ -71,15 +71,20 @@ public class ReactorNettyHttpClientBraveTests extends ITSpringConfiguredReactorC
super(HttpClientBeanPostProcessor.class);
}
@Override
Mono<Integer> getMono(AnnotationConfigApplicationContext context, String pathIncludingQuery) {
return context.getBean(HttpClient.class).get().uri(pathIncludingQuery).response().map(r -> r.status().code());
}
@Override
Mono<Integer> optionsMono(AnnotationConfigApplicationContext context, String path) {
return context.getBean(HttpClient.class).options().uri(path).response().map(r -> r.status().code());
}
@Override
Mono<Integer> postMono(AnnotationConfigApplicationContext context, String pathIncludingQuery, String body) {
return context.getBean(HttpClient.class).post().send(ByteBufFlux.fromString(Mono.just(body)))
.uri(pathIncludingQuery).response().map(r -> r.status().code());
}
@Override
Mono<Integer> getMono(AnnotationConfigApplicationContext context, String pathIncludingQuery) {
return context.getBean(HttpClient.class).get().uri(pathIncludingQuery).response().map(r -> r.status().code());
}
}

View File

@@ -51,18 +51,24 @@ public class WebClientBraveTests extends ITSpringConfiguredReactorClient {
super(WebClientConfiguration.class, WebClientAutoConfiguration.class, TraceWebClientBeanPostProcessor.class);
}
@Override
Mono<Integer> postMono(AnnotationConfigApplicationContext context, String pathIncludingQuery, String body) {
return context.getBean(WebClient.Builder.class).build().post().uri(pathIncludingQuery)
.body(BodyInserters.fromValue(body)).exchange().map(ClientResponse::rawStatusCode);
}
@Override
Mono<Integer> getMono(AnnotationConfigApplicationContext context, String pathIncludingQuery) {
return context.getBean(WebClient.Builder.class).build().get().uri(pathIncludingQuery).exchange()
.map(ClientResponse::rawStatusCode);
}
@Override
Mono<Integer> optionsMono(AnnotationConfigApplicationContext context, String path) {
return context.getBean(WebClient.Builder.class).build().options().uri(path).exchange()
.map(ClientResponse::rawStatusCode);
}
@Override
Mono<Integer> postMono(AnnotationConfigApplicationContext context, String pathIncludingQuery, String body) {
return context.getBean(WebClient.Builder.class).build().post().uri(pathIncludingQuery)
.body(BodyInserters.fromValue(body)).exchange().map(ClientResponse::rawStatusCode);
}
@Test
@Ignore("WebClient is blind to the implementation of redirects")
@Override