Fix some deprecations

See gh-20388
pull/20523/head
dreis2211 5 years ago committed by Stephane Nicoll
parent 743671fabe
commit f08a9db984

@ -69,7 +69,7 @@ class MetricsWebFilterTests {
MockServerWebExchange exchange = createExchange("/projects/spring-boot", "/projects/{project}"); MockServerWebExchange exchange = createExchange("/projects/spring-boot", "/projects/{project}");
this.webFilter.filter(exchange, (serverWebExchange) -> Mono.error(new IllegalStateException("test error"))) this.webFilter.filter(exchange, (serverWebExchange) -> Mono.error(new IllegalStateException("test error")))
.onErrorResume((t) -> { .onErrorResume((t) -> {
exchange.getResponse().setStatusCodeValue(500); exchange.getResponse().setRawStatusCode(500);
return exchange.getResponse().setComplete(); return exchange.getResponse().setComplete();
}).block(Duration.ofSeconds(30)); }).block(Duration.ofSeconds(30));
assertMetricsContainsTag("uri", "/projects/{project}"); assertMetricsContainsTag("uri", "/projects/{project}");
@ -84,7 +84,7 @@ class MetricsWebFilterTests {
MockServerWebExchange exchange = createExchange("/projects/spring-boot", "/projects/{project}"); MockServerWebExchange exchange = createExchange("/projects/spring-boot", "/projects/{project}");
this.webFilter.filter(exchange, (serverWebExchange) -> Mono.error(anonymous)).onErrorResume((t) -> { this.webFilter.filter(exchange, (serverWebExchange) -> Mono.error(anonymous)).onErrorResume((t) -> {
exchange.getResponse().setStatusCodeValue(500); exchange.getResponse().setRawStatusCode(500);
return exchange.getResponse().setComplete(); return exchange.getResponse().setComplete();
}).block(Duration.ofSeconds(30)); }).block(Duration.ofSeconds(30));
assertMetricsContainsTag("uri", "/projects/{project}"); assertMetricsContainsTag("uri", "/projects/{project}");
@ -96,7 +96,7 @@ class MetricsWebFilterTests {
void filterAddsTagsToRegistryForExceptionsAndCommittedResponse() { void filterAddsTagsToRegistryForExceptionsAndCommittedResponse() {
MockServerWebExchange exchange = createExchange("/projects/spring-boot", "/projects/{project}"); MockServerWebExchange exchange = createExchange("/projects/spring-boot", "/projects/{project}");
this.webFilter.filter(exchange, (serverWebExchange) -> { this.webFilter.filter(exchange, (serverWebExchange) -> {
exchange.getResponse().setStatusCodeValue(500); exchange.getResponse().setRawStatusCode(500);
return exchange.getResponse().setComplete().then(Mono.error(new IllegalStateException("test error"))); return exchange.getResponse().setComplete().then(Mono.error(new IllegalStateException("test error")));
}).onErrorResume((t) -> Mono.empty()).block(Duration.ofSeconds(30)); }).onErrorResume((t) -> Mono.empty()).block(Duration.ofSeconds(30));
assertMetricsContainsTag("uri", "/projects/{project}"); assertMetricsContainsTag("uri", "/projects/{project}");

@ -75,7 +75,7 @@ class WebFluxTagsTests {
@Test @Test
void uriTagToleratesCustomResponseStatus() { void uriTagToleratesCustomResponseStatus() {
this.exchange.getResponse().setStatusCodeValue(601); this.exchange.getResponse().setRawStatusCode(601);
Tag tag = WebFluxTags.uri(this.exchange); Tag tag = WebFluxTags.uri(this.exchange);
assertThat(tag.getValue()).isEqualTo("root"); assertThat(tag.getValue()).isEqualTo("root");
} }
@ -169,14 +169,14 @@ class WebFluxTagsTests {
@Test @Test
void outcomeTagIsClientErrorWhenResponseIsNonStandardInClientSeries() { void outcomeTagIsClientErrorWhenResponseIsNonStandardInClientSeries() {
this.exchange.getResponse().setStatusCodeValue(490); this.exchange.getResponse().setRawStatusCode(490);
Tag tag = WebFluxTags.outcome(this.exchange); Tag tag = WebFluxTags.outcome(this.exchange);
assertThat(tag.getValue()).isEqualTo("CLIENT_ERROR"); assertThat(tag.getValue()).isEqualTo("CLIENT_ERROR");
} }
@Test @Test
void outcomeTagIsUnknownWhenResponseStatusIsInUnknownSeries() { void outcomeTagIsUnknownWhenResponseStatusIsInUnknownSeries() {
this.exchange.getResponse().setStatusCodeValue(701); this.exchange.getResponse().setRawStatusCode(701);
Tag tag = WebFluxTags.outcome(this.exchange); Tag tag = WebFluxTags.outcome(this.exchange);
assertThat(tag.getValue()).isEqualTo("UNKNOWN"); assertThat(tag.getValue()).isEqualTo("UNKNOWN");
} }

@ -149,7 +149,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
.clientConnector(connector).build(); .clientConnector(connector).build();
Mono<String> result = client.post().uri("/test").contentType(MediaType.TEXT_PLAIN) Mono<String> result = client.post().uri("/test").contentType(MediaType.TEXT_PLAIN)
.body(BodyInserters.fromObject("Hello World")).exchange() .body(BodyInserters.fromValue("Hello World")).exchange()
.flatMap((response) -> response.bodyToMono(String.class)); .flatMap((response) -> response.bodyToMono(String.class));
StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); StepVerifier.setDefaultTimeout(Duration.ofSeconds(30));

Loading…
Cancel
Save