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
d93c7931
Commit
d93c7931
authored
Jul 09, 2019
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Align with body method changes in RequestBodySpec
Closes gh-17460
parent
3e6c15c4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
12 deletions
+11
-12
AbstractWebEndpointIntegrationTests.java
...t/web/annotation/AbstractWebEndpointIntegrationTests.java
+2
-2
ControllerEndpointHandlerMappingIntegrationTests.java
...ive/ControllerEndpointHandlerMappingIntegrationTests.java
+1
-1
ControllerEndpointHandlerMappingIntegrationTests.java
...let/ControllerEndpointHandlerMappingIntegrationTests.java
+1
-1
LoggersEndpointWebIntegrationTests.java
...t/actuate/logging/LoggersEndpointWebIntegrationTests.java
+5
-6
AbstractErrorWebExceptionHandler.java
.../web/reactive/error/AbstractErrorWebExceptionHandler.java
+1
-1
DefaultErrorWebExceptionHandlerIntegrationTests.java
...rror/DefaultErrorWebExceptionHandlerIntegrationTests.java
+1
-1
No files found.
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/AbstractWebEndpointIntegrationTests.java
View file @
d93c7931
...
@@ -163,7 +163,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
...
@@ -163,7 +163,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
Map
<
String
,
Object
>
body
=
new
HashMap
<>();
Map
<
String
,
Object
>
body
=
new
HashMap
<>();
body
.
put
(
"foo"
,
"one"
);
body
.
put
(
"foo"
,
"one"
);
body
.
put
(
"bar"
,
"two"
);
body
.
put
(
"bar"
,
"two"
);
client
.
post
().
uri
(
"/test"
).
syncB
ody
(
body
).
exchange
().
expectStatus
().
isNoContent
().
expectBody
().
isEmpty
();
client
.
post
().
uri
(
"/test"
).
b
ody
(
body
).
exchange
().
expectStatus
().
isNoContent
().
expectBody
().
isEmpty
();
});
});
}
}
...
@@ -194,7 +194,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
...
@@ -194,7 +194,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
load
(
TestEndpointConfiguration
.
class
,
(
context
,
client
)
->
{
load
(
TestEndpointConfiguration
.
class
,
(
context
,
client
)
->
{
Map
<
String
,
Object
>
body
=
new
HashMap
<>();
Map
<
String
,
Object
>
body
=
new
HashMap
<>();
body
.
put
(
"foo"
,
"one"
);
body
.
put
(
"foo"
,
"one"
);
client
.
post
().
uri
(
"/test"
).
syncB
ody
(
body
).
exchange
().
expectStatus
().
isNoContent
().
expectBody
().
isEmpty
();
client
.
post
().
uri
(
"/test"
).
b
ody
(
body
).
exchange
().
expectStatus
().
isNoContent
().
expectBody
().
isEmpty
();
verify
(
context
.
getBean
(
EndpointDelegate
.
class
)).
write
(
"one"
,
null
);
verify
(
context
.
getBean
(
EndpointDelegate
.
class
)).
write
(
"one"
,
null
);
});
});
}
}
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingIntegrationTests.java
View file @
d93c7931
...
@@ -80,7 +80,7 @@ class ControllerEndpointHandlerMappingIntegrationTests {
...
@@ -80,7 +80,7 @@ class ControllerEndpointHandlerMappingIntegrationTests {
@Test
@Test
void
post
()
{
void
post
()
{
this
.
contextRunner
.
run
(
withWebTestClient
((
webTestClient
)
->
webTestClient
.
post
().
uri
(
"/actuator/example/two"
)
this
.
contextRunner
.
run
(
withWebTestClient
((
webTestClient
)
->
webTestClient
.
post
().
uri
(
"/actuator/example/two"
)
.
syncB
ody
(
Collections
.
singletonMap
(
"id"
,
"test"
)).
exchange
().
expectStatus
().
isCreated
().
expectHeader
()
.
b
ody
(
Collections
.
singletonMap
(
"id"
,
"test"
)).
exchange
().
expectStatus
().
isCreated
().
expectHeader
()
.
valueEquals
(
HttpHeaders
.
LOCATION
,
"/example/test"
)));
.
valueEquals
(
HttpHeaders
.
LOCATION
,
"/example/test"
)));
}
}
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingIntegrationTests.java
View file @
d93c7931
...
@@ -79,7 +79,7 @@ class ControllerEndpointHandlerMappingIntegrationTests {
...
@@ -79,7 +79,7 @@ class ControllerEndpointHandlerMappingIntegrationTests {
@Test
@Test
void
post
()
{
void
post
()
{
this
.
contextRunner
.
run
(
withWebTestClient
((
webTestClient
)
->
webTestClient
.
post
().
uri
(
"/actuator/example/two"
)
this
.
contextRunner
.
run
(
withWebTestClient
((
webTestClient
)
->
webTestClient
.
post
().
uri
(
"/actuator/example/two"
)
.
syncB
ody
(
Collections
.
singletonMap
(
"id"
,
"test"
)).
exchange
().
expectStatus
().
isCreated
().
expectHeader
()
.
b
ody
(
Collections
.
singletonMap
(
"id"
,
"test"
)).
exchange
().
expectStatus
().
isCreated
().
expectHeader
()
.
valueEquals
(
HttpHeaders
.
LOCATION
,
"/example/test"
)));
.
valueEquals
(
HttpHeaders
.
LOCATION
,
"/example/test"
)));
}
}
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointWebIntegrationTests.java
View file @
d93c7931
...
@@ -95,7 +95,7 @@ class LoggersEndpointWebIntegrationTests {
...
@@ -95,7 +95,7 @@ class LoggersEndpointWebIntegrationTests {
@WebEndpointTest
@WebEndpointTest
void
setLoggerUsingApplicationJsonShouldSetLogLevel
()
{
void
setLoggerUsingApplicationJsonShouldSetLogLevel
()
{
this
.
client
.
post
().
uri
(
"/actuator/loggers/ROOT"
).
contentType
(
MediaType
.
APPLICATION_JSON
)
this
.
client
.
post
().
uri
(
"/actuator/loggers/ROOT"
).
contentType
(
MediaType
.
APPLICATION_JSON
)
.
syncB
ody
(
Collections
.
singletonMap
(
"configuredLevel"
,
"debug"
)).
exchange
().
expectStatus
().
isNoContent
();
.
b
ody
(
Collections
.
singletonMap
(
"configuredLevel"
,
"debug"
)).
exchange
().
expectStatus
().
isNoContent
();
verify
(
this
.
loggingSystem
).
setLogLevel
(
"ROOT"
,
LogLevel
.
DEBUG
);
verify
(
this
.
loggingSystem
).
setLogLevel
(
"ROOT"
,
LogLevel
.
DEBUG
);
}
}
...
@@ -103,15 +103,14 @@ class LoggersEndpointWebIntegrationTests {
...
@@ -103,15 +103,14 @@ class LoggersEndpointWebIntegrationTests {
void
setLoggerUsingActuatorV2JsonShouldSetLogLevel
()
{
void
setLoggerUsingActuatorV2JsonShouldSetLogLevel
()
{
this
.
client
.
post
().
uri
(
"/actuator/loggers/ROOT"
)
this
.
client
.
post
().
uri
(
"/actuator/loggers/ROOT"
)
.
contentType
(
MediaType
.
parseMediaType
(
ActuatorMediaType
.
V2_JSON
))
.
contentType
(
MediaType
.
parseMediaType
(
ActuatorMediaType
.
V2_JSON
))
.
syncB
ody
(
Collections
.
singletonMap
(
"configuredLevel"
,
"debug"
)).
exchange
().
expectStatus
().
isNoContent
();
.
b
ody
(
Collections
.
singletonMap
(
"configuredLevel"
,
"debug"
)).
exchange
().
expectStatus
().
isNoContent
();
verify
(
this
.
loggingSystem
).
setLogLevel
(
"ROOT"
,
LogLevel
.
DEBUG
);
verify
(
this
.
loggingSystem
).
setLogLevel
(
"ROOT"
,
LogLevel
.
DEBUG
);
}
}
@WebEndpointTest
@WebEndpointTest
void
setLoggerWithWrongLogLevelResultInBadRequestResponse
()
{
void
setLoggerWithWrongLogLevelResultInBadRequestResponse
()
{
this
.
client
.
post
().
uri
(
"/actuator/loggers/ROOT"
).
contentType
(
MediaType
.
APPLICATION_JSON
)
this
.
client
.
post
().
uri
(
"/actuator/loggers/ROOT"
).
contentType
(
MediaType
.
APPLICATION_JSON
)
.
syncBody
(
Collections
.
singletonMap
(
"configuredLevel"
,
"other"
)).
exchange
().
expectStatus
()
.
body
(
Collections
.
singletonMap
(
"configuredLevel"
,
"other"
)).
exchange
().
expectStatus
().
isBadRequest
();
.
isBadRequest
();
verifyZeroInteractions
(
this
.
loggingSystem
);
verifyZeroInteractions
(
this
.
loggingSystem
);
}
}
...
@@ -119,14 +118,14 @@ class LoggersEndpointWebIntegrationTests {
...
@@ -119,14 +118,14 @@ class LoggersEndpointWebIntegrationTests {
void
setLoggerWithNullLogLevel
()
{
void
setLoggerWithNullLogLevel
()
{
this
.
client
.
post
().
uri
(
"/actuator/loggers/ROOT"
)
this
.
client
.
post
().
uri
(
"/actuator/loggers/ROOT"
)
.
contentType
(
MediaType
.
parseMediaType
(
ActuatorMediaType
.
V2_JSON
))
.
contentType
(
MediaType
.
parseMediaType
(
ActuatorMediaType
.
V2_JSON
))
.
syncB
ody
(
Collections
.
singletonMap
(
"configuredLevel"
,
null
)).
exchange
().
expectStatus
().
isNoContent
();
.
b
ody
(
Collections
.
singletonMap
(
"configuredLevel"
,
null
)).
exchange
().
expectStatus
().
isNoContent
();
verify
(
this
.
loggingSystem
).
setLogLevel
(
"ROOT"
,
null
);
verify
(
this
.
loggingSystem
).
setLogLevel
(
"ROOT"
,
null
);
}
}
@WebEndpointTest
@WebEndpointTest
void
setLoggerWithNoLogLevel
()
{
void
setLoggerWithNoLogLevel
()
{
this
.
client
.
post
().
uri
(
"/actuator/loggers/ROOT"
)
this
.
client
.
post
().
uri
(
"/actuator/loggers/ROOT"
)
.
contentType
(
MediaType
.
parseMediaType
(
ActuatorMediaType
.
V2_JSON
)).
syncB
ody
(
Collections
.
emptyMap
())
.
contentType
(
MediaType
.
parseMediaType
(
ActuatorMediaType
.
V2_JSON
)).
b
ody
(
Collections
.
emptyMap
())
.
exchange
().
expectStatus
().
isNoContent
();
.
exchange
().
expectStatus
().
isNoContent
();
verify
(
this
.
loggingSystem
).
setLogLevel
(
"ROOT"
,
null
);
verify
(
this
.
loggingSystem
).
setLogLevel
(
"ROOT"
,
null
);
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java
View file @
d93c7931
...
@@ -222,7 +222,7 @@ public abstract class AbstractErrorWebExceptionHandler implements ErrorWebExcept
...
@@ -222,7 +222,7 @@ public abstract class AbstractErrorWebExceptionHandler implements ErrorWebExcept
builder
.
append
(
"<div style='white-space:pre-wrap;'>"
).
append
(
htmlEscape
(
trace
)).
append
(
"</div>"
);
builder
.
append
(
"<div style='white-space:pre-wrap;'>"
).
append
(
htmlEscape
(
trace
)).
append
(
"</div>"
);
}
}
builder
.
append
(
"</body></html>"
);
builder
.
append
(
"</body></html>"
);
return
responseBody
.
syncB
ody
(
builder
.
toString
());
return
responseBody
.
b
ody
(
builder
.
toString
());
}
}
private
String
htmlEscape
(
Object
input
)
{
private
String
htmlEscape
(
Object
input
)
{
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTests.java
View file @
d93c7931
...
@@ -111,7 +111,7 @@ class DefaultErrorWebExceptionHandlerIntegrationTests {
...
@@ -111,7 +111,7 @@ class DefaultErrorWebExceptionHandlerIntegrationTests {
void
bindingResultError
()
{
void
bindingResultError
()
{
this
.
contextRunner
.
run
((
context
)
->
{
this
.
contextRunner
.
run
((
context
)
->
{
WebTestClient
client
=
getWebClient
(
context
);
WebTestClient
client
=
getWebClient
(
context
);
client
.
post
().
uri
(
"/bind"
).
contentType
(
MediaType
.
APPLICATION_JSON
).
syncB
ody
(
"{}"
).
exchange
().
expectStatus
()
client
.
post
().
uri
(
"/bind"
).
contentType
(
MediaType
.
APPLICATION_JSON
).
b
ody
(
"{}"
).
exchange
().
expectStatus
()
.
isBadRequest
().
expectBody
().
jsonPath
(
"status"
).
isEqualTo
(
"400"
).
jsonPath
(
"error"
)
.
isBadRequest
().
expectBody
().
jsonPath
(
"status"
).
isEqualTo
(
"400"
).
jsonPath
(
"error"
)
.
isEqualTo
(
HttpStatus
.
BAD_REQUEST
.
getReasonPhrase
()).
jsonPath
(
"path"
).
isEqualTo
((
"/bind"
))
.
isEqualTo
(
HttpStatus
.
BAD_REQUEST
.
getReasonPhrase
()).
jsonPath
(
"path"
).
isEqualTo
((
"/bind"
))
.
jsonPath
(
"exception"
).
doesNotExist
().
jsonPath
(
"errors"
).
isArray
().
jsonPath
(
"message"
).
isNotEmpty
()
.
jsonPath
(
"exception"
).
doesNotExist
().
jsonPath
(
"errors"
).
isArray
().
jsonPath
(
"message"
).
isNotEmpty
()
...
...
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