Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
366fec33
Commit
366fec33
authored
Sep 30, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt to API change in Spring Framework 5.3.0 snapshots
See gh-23534
parent
6254ad63
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
48 additions
and
45 deletions
+48
-45
ReactiveCloudFoundryActuatorAutoConfigurationTests.java
...e/ReactiveCloudFoundryActuatorAutoConfigurationTests.java
+6
-3
WebClientMetricsConfigurationTests.java
...etrics/web/client/WebClientMetricsConfigurationTests.java
+5
-3
WebMvcEndpointChildContextConfigurationIntegrationTests.java
...MvcEndpointChildContextConfigurationIntegrationTests.java
+15
-16
ElasticsearchReactiveHealthIndicator.java
...e/elasticsearch/ElasticsearchReactiveHealthIndicator.java
+1
-0
WebClientAutoConfigurationTests.java
...tive/function/client/WebClientAutoConfigurationTests.java
+4
-2
WebTestClientAutoConfigurationTests.java
...ure/web/reactive/WebTestClientAutoConfigurationTests.java
+1
-1
NettyReactiveWebServerFactoryTests.java
...eb/embedded/netty/NettyReactiveWebServerFactoryTests.java
+1
-1
UndertowReactiveWebServerFactoryTests.java
...edded/undertow/UndertowReactiveWebServerFactoryTests.java
+1
-2
AbstractReactiveWebServerFactoryTests.java
...eactive/server/AbstractReactiveWebServerFactoryTests.java
+14
-17
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfigurationTests.java
View file @
366fec33
...
...
@@ -67,6 +67,7 @@ import org.springframework.security.web.server.WebFilterChainProxy;
import
org.springframework.test.util.ReflectionTestUtils
;
import
org.springframework.test.web.reactive.server.WebTestClient
;
import
org.springframework.web.cors.CorsConfiguration
;
import
org.springframework.web.reactive.function.client.ClientResponse
;
import
org.springframework.web.reactive.function.client.WebClient
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
...
@@ -269,7 +270,8 @@ class ReactiveCloudFoundryActuatorAutoConfigurationTests {
"cloudFoundrySecurityService"
);
WebClient
webClient
=
(
WebClient
)
ReflectionTestUtils
.
getField
(
interceptorSecurityService
,
"webClient"
);
webClient
.
get
().
uri
(
"https://self-signed.badssl.com/"
).
exchange
().
block
(
Duration
.
ofSeconds
(
30
));
webClient
.
get
().
uri
(
"https://self-signed.badssl.com/"
).
exchangeToMono
(
ClientResponse:
:
releaseBody
)
.
block
(
Duration
.
ofSeconds
(
30
));
});
}
...
...
@@ -285,8 +287,9 @@ class ReactiveCloudFoundryActuatorAutoConfigurationTests {
"cloudFoundrySecurityService"
);
WebClient
webClient
=
(
WebClient
)
ReflectionTestUtils
.
getField
(
interceptorSecurityService
,
"webClient"
);
assertThatExceptionOfType
(
RuntimeException
.
class
).
isThrownBy
(()
->
webClient
.
get
()
.
uri
(
"https://self-signed.badssl.com/"
).
exchange
().
block
(
Duration
.
ofSeconds
(
30
)))
assertThatExceptionOfType
(
RuntimeException
.
class
)
.
isThrownBy
(()
->
webClient
.
get
().
uri
(
"https://self-signed.badssl.com/"
)
.
exchangeToMono
(
ClientResponse:
:
releaseBody
).
block
(
Duration
.
ofSeconds
(
30
)))
.
withCauseInstanceOf
(
SSLException
.
class
);
});
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/WebClientMetricsConfigurationTests.java
View file @
366fec33
...
...
@@ -38,6 +38,7 @@ import org.springframework.context.annotation.Configuration;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.client.reactive.ClientHttpConnector
;
import
org.springframework.mock.http.client.reactive.MockClientHttpResponse
;
import
org.springframework.web.reactive.function.client.ClientResponse
;
import
org.springframework.web.reactive.function.client.WebClient
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
...
@@ -111,7 +112,8 @@ class WebClientMetricsConfigurationTests {
WebClient
webClient
=
mockWebClient
(
context
.
getBean
(
WebClient
.
Builder
.
class
));
MeterRegistry
registry
=
context
.
getBean
(
MeterRegistry
.
class
);
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
webClient
.
get
().
uri
(
"https://example.org/projects/"
+
i
).
exchange
().
block
(
Duration
.
ofSeconds
(
30
));
webClient
.
get
().
uri
(
"https://example.org/projects/"
+
i
).
exchangeToMono
(
ClientResponse:
:
releaseBody
)
.
block
(
Duration
.
ofSeconds
(
30
));
}
return
registry
;
}
...
...
@@ -119,8 +121,8 @@ class WebClientMetricsConfigurationTests {
private
void
validateWebClient
(
WebClient
.
Builder
builder
,
MeterRegistry
registry
)
{
WebClient
webClient
=
mockWebClient
(
builder
);
assertThat
(
registry
.
find
(
"http.client.requests"
).
meter
()).
isNull
();
webClient
.
get
().
uri
(
"https://example.org/projects/{project}"
,
"spring-boot"
)
.
exchange
()
.
block
(
Duration
.
ofSeconds
(
30
));
webClient
.
get
().
uri
(
"https://example.org/projects/{project}"
,
"spring-boot"
)
.
exchangeToMono
(
ClientResponse:
:
releaseBody
).
block
(
Duration
.
ofSeconds
(
30
));
assertThat
(
registry
.
find
(
"http.client.requests"
).
tags
(
"uri"
,
"/projects/{project}"
).
meter
()).
isNotNull
();
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfigurationIntegrationTests.java
View file @
366fec33
...
...
@@ -19,11 +19,13 @@ package org.springframework.boot.actuate.autoconfigure.web.servlet;
import
java.util.Collections
;
import
java.util.Map
;
import
java.util.function.Consumer
;
import
java.util.function.Function
;
import
javax.validation.Valid
;
import
javax.validation.constraints.NotEmpty
;
import
org.junit.jupiter.api.Test
;
import
reactor.core.publisher.Mono
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration
;
...
...
@@ -40,6 +42,7 @@ import org.springframework.boot.test.context.runner.ContextConsumer;
import
org.springframework.boot.test.context.runner.WebApplicationContextRunner
;
import
org.springframework.boot.web.context.ServerPortInfoApplicationContextInitializer
;
import
org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext
;
import
org.springframework.core.ParameterizedTypeReference
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -74,9 +77,8 @@ class WebMvcEndpointChildContextConfigurationIntegrationTests {
@Test
// gh-17938
void
errorEndpointIsUsedWithEndpoint
()
{
this
.
runner
.
run
(
withWebTestClient
((
client
)
->
{
ClientResponse
response
=
client
.
get
().
uri
(
"actuator/fail"
).
accept
(
MediaType
.
APPLICATION_JSON
).
exchange
()
.
block
();
Map
<
String
,
?>
body
=
getResponseBody
(
response
);
Map
<
String
,
?>
body
=
client
.
get
().
uri
(
"actuator/fail"
).
accept
(
MediaType
.
APPLICATION_JSON
)
.
exchangeToMono
(
toResponseBody
()).
block
();
assertThat
(
body
).
hasEntrySatisfying
(
"exception"
,
(
value
)
->
assertThat
(
value
).
asString
().
contains
(
"IllegalStateException"
));
assertThat
(
body
).
hasEntrySatisfying
(
"message"
,
...
...
@@ -88,9 +90,8 @@ class WebMvcEndpointChildContextConfigurationIntegrationTests {
void
errorPageAndErrorControllerIncludeDetails
()
{
this
.
runner
.
withPropertyValues
(
"server.error.include-stacktrace=always"
,
"server.error.include-message=always"
)
.
run
(
withWebTestClient
((
client
)
->
{
ClientResponse
response
=
client
.
get
().
uri
(
"actuator/fail"
).
accept
(
MediaType
.
APPLICATION_JSON
)
.
exchange
().
block
();
Map
<
String
,
?>
body
=
getResponseBody
(
response
);
Map
<
String
,
?>
body
=
client
.
get
().
uri
(
"actuator/fail"
).
accept
(
MediaType
.
APPLICATION_JSON
)
.
exchangeToMono
(
toResponseBody
()).
block
();
assertThat
(
body
).
hasEntrySatisfying
(
"message"
,
(
value
)
->
assertThat
(
value
).
asString
().
contains
(
"Epic Fail"
));
assertThat
(
body
).
hasEntrySatisfying
(
"trace"
,
(
value
)
->
assertThat
(
value
).
asString
()
...
...
@@ -101,9 +102,8 @@ class WebMvcEndpointChildContextConfigurationIntegrationTests {
@Test
void
errorEndpointIsUsedWithRestControllerEndpoint
()
{
this
.
runner
.
run
(
withWebTestClient
((
client
)
->
{
ClientResponse
response
=
client
.
get
().
uri
(
"actuator/failController"
).
accept
(
MediaType
.
APPLICATION_JSON
)
.
exchange
().
block
();
Map
<
String
,
?>
body
=
getResponseBody
(
response
);
Map
<
String
,
?>
body
=
client
.
get
().
uri
(
"actuator/failController"
).
accept
(
MediaType
.
APPLICATION_JSON
)
.
exchangeToMono
(
toResponseBody
()).
block
();
assertThat
(
body
).
hasEntrySatisfying
(
"exception"
,
(
value
)
->
assertThat
(
value
).
asString
().
contains
(
"IllegalStateException"
));
assertThat
(
body
).
hasEntrySatisfying
(
"message"
,
...
...
@@ -114,10 +114,9 @@ class WebMvcEndpointChildContextConfigurationIntegrationTests {
@Test
void
errorEndpointIsUsedWithRestControllerEndpointOnBindingError
()
{
this
.
runner
.
run
(
withWebTestClient
((
client
)
->
{
ClientResponse
response
=
client
.
post
().
uri
(
"actuator/failController"
)
.
bodyValue
(
Collections
.
singletonMap
(
"content"
,
""
)).
accept
(
MediaType
.
APPLICATION_JSON
).
exchange
()
.
block
();
Map
<
String
,
?>
body
=
getResponseBody
(
response
);
Map
<
String
,
?>
body
=
client
.
post
().
uri
(
"actuator/failController"
)
.
bodyValue
(
Collections
.
singletonMap
(
"content"
,
""
)).
accept
(
MediaType
.
APPLICATION_JSON
)
.
exchangeToMono
(
toResponseBody
()).
block
();
assertThat
(
body
).
hasEntrySatisfying
(
"exception"
,
(
value
)
->
assertThat
(
value
).
asString
().
contains
(
"MethodArgumentNotValidException"
));
assertThat
(
body
).
hasEntrySatisfying
(
"message"
,
...
...
@@ -134,9 +133,9 @@ class WebMvcEndpointChildContextConfigurationIntegrationTests {
};
}
@SuppressWarnings
(
"unchecked"
)
private
Map
<
String
,
?>
getResponseBody
(
ClientResponse
response
)
{
return
response
.
bodyToMono
(
Map
.
class
).
block
(
);
private
Function
<
ClientResponse
,
?
extends
Mono
<
Map
<
String
,
?>>>
toResponseBody
()
{
return
((
clientResponse
)
->
clientResponse
.
bodyToMono
(
new
ParameterizedTypeReference
<
Map
<
String
,
?>>(
)
{
})
);
}
@Endpoint
(
id
=
"fail"
)
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchReactiveHealthIndicator.java
View file @
366fec33
...
...
@@ -56,6 +56,7 @@ public class ElasticsearchReactiveHealthIndicator extends AbstractReactiveHealth
return
this
.
client
.
execute
(
this
::
getHealth
).
flatMap
((
response
)
->
doHealthCheck
(
builder
,
response
));
}
@SuppressWarnings
(
"deprecation"
)
// Requires an update in ReactiveElasticsearchClient
private
Mono
<
ClientResponse
>
getHealth
(
WebClient
webClient
)
{
return
webClient
.
get
().
uri
(
"/_cluster/health/"
).
exchange
();
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/function/client/WebClientAutoConfigurationTests.java
View file @
366fec33
...
...
@@ -20,6 +20,7 @@ import java.net.URI;
import
java.time.Duration
;
import
org.junit.jupiter.api.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
...
...
@@ -88,6 +89,7 @@ class WebClientAutoConfigurationTests {
void
shouldGetPrototypeScopedBean
()
{
this
.
contextRunner
.
withUserConfiguration
(
WebClientCustomizerConfig
.
class
).
run
((
context
)
->
{
ClientHttpResponse
response
=
mock
(
ClientHttpResponse
.
class
);
given
(
response
.
getBody
()).
willReturn
(
Flux
.
empty
());
given
(
response
.
getHeaders
()).
willReturn
(
new
HttpHeaders
());
ClientHttpConnector
firstConnector
=
mock
(
ClientHttpConnector
.
class
);
given
(
firstConnector
.
connect
(
any
(),
any
(),
any
())).
willReturn
(
Mono
.
just
(
response
));
...
...
@@ -98,8 +100,8 @@ class WebClientAutoConfigurationTests {
WebClient
.
Builder
secondBuilder
=
context
.
getBean
(
WebClient
.
Builder
.
class
);
secondBuilder
.
clientConnector
(
secondConnector
).
baseUrl
(
"https://second.example.org"
);
assertThat
(
firstBuilder
).
isNotEqualTo
(
secondBuilder
);
firstBuilder
.
build
().
get
().
uri
(
"/foo"
).
exchange
().
block
(
Duration
.
ofSeconds
(
30
));
secondBuilder
.
build
().
get
().
uri
(
"/foo"
).
exchange
().
block
(
Duration
.
ofSeconds
(
30
));
firstBuilder
.
build
().
get
().
uri
(
"/foo"
).
retrieve
().
toBodilessEntity
().
block
(
Duration
.
ofSeconds
(
30
));
secondBuilder
.
build
().
get
().
uri
(
"/foo"
).
retrieve
().
toBodilessEntity
().
block
(
Duration
.
ofSeconds
(
30
));
verify
(
firstConnector
).
connect
(
eq
(
HttpMethod
.
GET
),
eq
(
URI
.
create
(
"https://first.example.org/foo"
)),
any
());
verify
(
secondConnector
).
connect
(
eq
(
HttpMethod
.
GET
),
eq
(
URI
.
create
(
"https://second.example.org/foo"
)),
any
());
...
...
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/WebTestClientAutoConfigurationTests.java
View file @
366fec33
...
...
@@ -74,7 +74,7 @@ class WebTestClientAutoConfigurationTests {
this
.
contextRunner
.
withUserConfiguration
(
BaseConfiguration
.
class
)
.
withPropertyValues
(
"spring.test.webtestclient.timeout=15m"
).
run
((
context
)
->
{
WebTestClient
webTestClient
=
context
.
getBean
(
WebTestClient
.
class
);
assertThat
(
webTestClient
).
hasFieldOrPropertyWithValue
(
"
t
imeout"
,
Duration
.
ofMinutes
(
15
));
assertThat
(
webTestClient
).
hasFieldOrPropertyWithValue
(
"
responseT
imeout"
,
Duration
.
ofMinutes
(
15
));
});
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactoryTests.java
View file @
366fec33
...
...
@@ -140,7 +140,7 @@ class NettyReactiveWebServerFactoryTests extends AbstractReactiveWebServerFactor
WebClient
client
=
WebClient
.
builder
().
baseUrl
(
"https://localhost:"
+
this
.
webServer
.
getPort
())
.
clientConnector
(
connector
).
build
();
return
client
.
post
().
uri
(
"/test"
).
contentType
(
MediaType
.
TEXT_PLAIN
).
body
(
BodyInserters
.
fromValue
(
"Hello World"
))
.
exchange
().
flatMap
((
response
)
->
response
.
bodyToMono
(
String
.
class
)
);
.
retrieve
().
bodyToMono
(
String
.
class
);
}
}
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactoryTests.java
View file @
366fec33
...
...
@@ -143,8 +143,7 @@ class UndertowReactiveWebServerFactoryTests extends AbstractReactiveWebServerFac
this
.
webServer
.
start
();
WebClient
client
=
getWebClient
(
this
.
webServer
.
getPort
()).
build
();
Mono
<
String
>
result
=
client
.
post
().
uri
(
"/test"
).
contentType
(
MediaType
.
TEXT_PLAIN
)
.
body
(
BodyInserters
.
fromValue
(
"Hello World"
)).
exchange
()
.
flatMap
((
response
)
->
response
.
bodyToMono
(
String
.
class
));
.
body
(
BodyInserters
.
fromValue
(
"Hello World"
)).
retrieve
().
bodyToMono
(
String
.
class
);
assertThat
(
result
.
block
(
Duration
.
ofSeconds
(
30
))).
isEqualTo
(
"Hello World"
);
File
accessLog
=
new
File
(
accessLogDirectory
,
expectedFile
);
awaitFile
(
accessLog
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java
View file @
366fec33
...
...
@@ -70,6 +70,7 @@ import org.springframework.http.server.reactive.ServerHttpResponse;
import
org.springframework.util.SocketUtils
;
import
org.springframework.util.unit.DataSize
;
import
org.springframework.web.reactive.function.BodyInserters
;
import
org.springframework.web.reactive.function.client.ClientResponse
;
import
org.springframework.web.reactive.function.client.WebClient
;
import
org.springframework.web.reactive.function.client.WebClientRequestException
;
...
...
@@ -110,8 +111,8 @@ public abstract class AbstractReactiveWebServerFactoryTests {
return
port
;
});
Mono
<
String
>
result
=
getWebClient
(
this
.
webServer
.
getPort
()).
build
().
post
().
uri
(
"/test"
)
.
contentType
(
MediaType
.
TEXT_PLAIN
).
body
(
BodyInserters
.
fromValue
(
"Hello World"
)).
exchang
e
()
.
flatMap
((
response
)
->
response
.
bodyToMono
(
String
.
class
)
);
.
contentType
(
MediaType
.
TEXT_PLAIN
).
body
(
BodyInserters
.
fromValue
(
"Hello World"
)).
retriev
e
()
.
bodyToMono
(
String
.
class
);
assertThat
(
result
.
block
(
Duration
.
ofSeconds
(
30
))).
isEqualTo
(
"Hello World"
);
assertThat
(
this
.
webServer
.
getPort
()).
isEqualTo
(
specificPort
);
}
...
...
@@ -139,8 +140,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
WebClient
client
=
WebClient
.
builder
().
baseUrl
(
"https://localhost:"
+
this
.
webServer
.
getPort
())
.
clientConnector
(
connector
).
build
();
Mono
<
String
>
result
=
client
.
post
().
uri
(
"/test"
).
contentType
(
MediaType
.
TEXT_PLAIN
)
.
body
(
BodyInserters
.
fromValue
(
"Hello World"
)).
exchange
()
.
flatMap
((
response
)
->
response
.
bodyToMono
(
String
.
class
));
.
body
(
BodyInserters
.
fromValue
(
"Hello World"
)).
retrieve
().
bodyToMono
(
String
.
class
);
assertThat
(
result
.
block
(
Duration
.
ofSeconds
(
30
))).
isEqualTo
(
"Hello World"
);
}
...
...
@@ -161,8 +161,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
.
clientConnector
(
connector
).
build
();
Mono
<
String
>
result
=
client
.
post
().
uri
(
"/test"
).
contentType
(
MediaType
.
TEXT_PLAIN
)
.
body
(
BodyInserters
.
fromValue
(
"Hello World"
)).
exchange
()
.
flatMap
((
response
)
->
response
.
bodyToMono
(
String
.
class
));
.
body
(
BodyInserters
.
fromValue
(
"Hello World"
)).
retrieve
().
bodyToMono
(
String
.
class
);
StepVerifier
.
setDefaultTimeout
(
Duration
.
ofSeconds
(
30
));
StepVerifier
.
create
(
result
).
expectNext
(
"Hello World"
).
verifyComplete
();
...
...
@@ -234,8 +233,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
WebClient
client
=
WebClient
.
builder
().
baseUrl
(
"https://localhost:"
+
this
.
webServer
.
getPort
())
.
clientConnector
(
clientConnector
).
build
();
Mono
<
String
>
result
=
client
.
post
().
uri
(
"/test"
).
contentType
(
MediaType
.
TEXT_PLAIN
)
.
body
(
BodyInserters
.
fromValue
(
"Hello World"
)).
exchange
()
.
flatMap
((
response
)
->
response
.
bodyToMono
(
String
.
class
));
.
body
(
BodyInserters
.
fromValue
(
"Hello World"
)).
retrieve
().
bodyToMono
(
String
.
class
);
assertThat
(
result
.
block
(
Duration
.
ofSeconds
(
30
))).
isEqualTo
(
"Hello World"
);
}
...
...
@@ -267,8 +265,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
WebClient
client
=
WebClient
.
builder
().
baseUrl
(
"https://localhost:"
+
this
.
webServer
.
getPort
())
.
clientConnector
(
clientConnector
).
build
();
Mono
<
String
>
result
=
client
.
post
().
uri
(
"/test"
).
contentType
(
MediaType
.
TEXT_PLAIN
)
.
body
(
BodyInserters
.
fromValue
(
"Hello World"
)).
exchange
()
.
flatMap
((
response
)
->
response
.
bodyToMono
(
String
.
class
));
.
body
(
BodyInserters
.
fromValue
(
"Hello World"
)).
retrieve
().
bodyToMono
(
String
.
class
);
StepVerifier
.
create
(
result
).
expectError
(
WebClientRequestException
.
class
).
verify
(
Duration
.
ofSeconds
(
10
));
}
...
...
@@ -285,7 +282,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
@Test
protected
void
compressionOfResponseToGetRequest
()
{
WebClient
client
=
prepareCompressionTest
();
ResponseEntity
<
Void
>
response
=
client
.
get
().
exchange
().
flatMap
((
res
)
->
res
.
toEntity
(
Void
.
class
)
)
ResponseEntity
<
Void
>
response
=
client
.
get
().
exchange
ToMono
(
ClientResponse:
:
toBodilessEntity
)
.
block
(
Duration
.
ofSeconds
(
30
));
assertResponseIsCompressed
(
response
);
}
...
...
@@ -293,7 +290,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
@Test
protected
void
compressionOfResponseToPostRequest
()
{
WebClient
client
=
prepareCompressionTest
();
ResponseEntity
<
Void
>
response
=
client
.
post
().
exchange
().
flatMap
((
res
)
->
res
.
toEntity
(
Void
.
class
)
)
ResponseEntity
<
Void
>
response
=
client
.
post
().
exchange
ToMono
(
ClientResponse:
:
toBodilessEntity
)
.
block
(
Duration
.
ofSeconds
(
30
));
assertResponseIsCompressed
(
response
);
}
...
...
@@ -304,7 +301,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
compression
.
setEnabled
(
true
);
compression
.
setMinResponseSize
(
DataSize
.
ofBytes
(
3001
));
WebClient
client
=
prepareCompressionTest
(
compression
);
ResponseEntity
<
Void
>
response
=
client
.
get
().
exchange
().
flatMap
((
res
)
->
res
.
toEntity
(
Void
.
class
)
)
ResponseEntity
<
Void
>
response
=
client
.
get
().
exchange
ToMono
(
ClientResponse:
:
toBodilessEntity
)
.
block
(
Duration
.
ofSeconds
(
30
));
assertResponseIsNotCompressed
(
response
);
}
...
...
@@ -315,7 +312,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
compression
.
setEnabled
(
true
);
compression
.
setMimeTypes
(
new
String
[]
{
"application/json"
});
WebClient
client
=
prepareCompressionTest
(
compression
);
ResponseEntity
<
Void
>
response
=
client
.
get
().
exchange
().
flatMap
((
res
)
->
res
.
toEntity
(
Void
.
class
)
)
ResponseEntity
<
Void
>
response
=
client
.
get
().
exchange
ToMono
(
ClientResponse:
:
toBodilessEntity
)
.
block
(
Duration
.
ofSeconds
(
30
));
assertResponseIsNotCompressed
(
response
);
}
...
...
@@ -326,8 +323,8 @@ public abstract class AbstractReactiveWebServerFactoryTests {
compression
.
setEnabled
(
true
);
compression
.
setExcludedUserAgents
(
new
String
[]
{
"testUserAgent"
});
WebClient
client
=
prepareCompressionTest
(
compression
);
ResponseEntity
<
Void
>
response
=
client
.
get
().
header
(
"User-Agent"
,
"testUserAgent"
)
.
exchange
()
.
flatMap
((
res
)
->
res
.
toEntity
(
Void
.
class
)
).
block
(
Duration
.
ofSeconds
(
30
));
ResponseEntity
<
Void
>
response
=
client
.
get
().
header
(
"User-Agent"
,
"testUserAgent"
)
.
exchangeToMono
(
ClientResponse:
:
toBodilessEntity
).
block
(
Duration
.
ofSeconds
(
30
));
assertResponseIsNotCompressed
(
response
);
}
...
...
@@ -337,7 +334,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
compression
.
setEnabled
(
true
);
compression
.
setMimeTypes
(
new
String
[]
{
"application/json"
});
WebClient
client
=
prepareCompressionTest
(
compression
,
"test~plain"
);
ResponseEntity
<
Void
>
response
=
client
.
get
().
exchange
().
flatMap
((
res
)
->
res
.
toEntity
(
Void
.
class
)
)
ResponseEntity
<
Void
>
response
=
client
.
get
().
exchange
ToMono
(
ClientResponse:
:
toBodilessEntity
)
.
block
(
Duration
.
ofSeconds
(
30
));
assertResponseIsNotCompressed
(
response
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment