From f08a9db984f9f5982c79f35aceae59cc4fd30e7a Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Wed, 4 Mar 2020 16:08:21 +0100 Subject: [PATCH] Fix some deprecations See gh-20388 --- .../metrics/web/reactive/server/MetricsWebFilterTests.java | 6 +++--- .../metrics/web/reactive/server/WebFluxTagsTests.java | 6 +++--- .../server/AbstractReactiveWebServerFactoryTests.java | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilterTests.java index 4e093c995c..7f3008343d 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilterTests.java @@ -69,7 +69,7 @@ class MetricsWebFilterTests { MockServerWebExchange exchange = createExchange("/projects/spring-boot", "/projects/{project}"); this.webFilter.filter(exchange, (serverWebExchange) -> Mono.error(new IllegalStateException("test error"))) .onErrorResume((t) -> { - exchange.getResponse().setStatusCodeValue(500); + exchange.getResponse().setRawStatusCode(500); return exchange.getResponse().setComplete(); }).block(Duration.ofSeconds(30)); assertMetricsContainsTag("uri", "/projects/{project}"); @@ -84,7 +84,7 @@ class MetricsWebFilterTests { MockServerWebExchange exchange = createExchange("/projects/spring-boot", "/projects/{project}"); this.webFilter.filter(exchange, (serverWebExchange) -> Mono.error(anonymous)).onErrorResume((t) -> { - exchange.getResponse().setStatusCodeValue(500); + exchange.getResponse().setRawStatusCode(500); return exchange.getResponse().setComplete(); }).block(Duration.ofSeconds(30)); assertMetricsContainsTag("uri", "/projects/{project}"); @@ -96,7 +96,7 @@ class MetricsWebFilterTests { void filterAddsTagsToRegistryForExceptionsAndCommittedResponse() { MockServerWebExchange exchange = createExchange("/projects/spring-boot", "/projects/{project}"); this.webFilter.filter(exchange, (serverWebExchange) -> { - exchange.getResponse().setStatusCodeValue(500); + exchange.getResponse().setRawStatusCode(500); return exchange.getResponse().setComplete().then(Mono.error(new IllegalStateException("test error"))); }).onErrorResume((t) -> Mono.empty()).block(Duration.ofSeconds(30)); assertMetricsContainsTag("uri", "/projects/{project}"); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTagsTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTagsTests.java index fc82e9d902..6bc090c6f2 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTagsTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTagsTests.java @@ -75,7 +75,7 @@ class WebFluxTagsTests { @Test void uriTagToleratesCustomResponseStatus() { - this.exchange.getResponse().setStatusCodeValue(601); + this.exchange.getResponse().setRawStatusCode(601); Tag tag = WebFluxTags.uri(this.exchange); assertThat(tag.getValue()).isEqualTo("root"); } @@ -169,14 +169,14 @@ class WebFluxTagsTests { @Test void outcomeTagIsClientErrorWhenResponseIsNonStandardInClientSeries() { - this.exchange.getResponse().setStatusCodeValue(490); + this.exchange.getResponse().setRawStatusCode(490); Tag tag = WebFluxTags.outcome(this.exchange); assertThat(tag.getValue()).isEqualTo("CLIENT_ERROR"); } @Test void outcomeTagIsUnknownWhenResponseStatusIsInUnknownSeries() { - this.exchange.getResponse().setStatusCodeValue(701); + this.exchange.getResponse().setRawStatusCode(701); Tag tag = WebFluxTags.outcome(this.exchange); assertThat(tag.getValue()).isEqualTo("UNKNOWN"); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java index ec6756af88..2f0947eb4c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java @@ -149,7 +149,7 @@ public abstract class AbstractReactiveWebServerFactoryTests { .clientConnector(connector).build(); Mono 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)); StepVerifier.setDefaultTimeout(Duration.ofSeconds(30));