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
1222a73d
Commit
1222a73d
authored
Oct 01, 2019
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
557d1876
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
JerseyManagementPortTests.java
...test/java/smoketest/jersey/JerseyManagementPortTests.java
+6
-9
No files found.
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jersey/src/test/java/smoketest/jersey/JerseyManagementPortTests.java
View file @
1222a73d
...
...
@@ -14,14 +14,13 @@
* limitations under the License.
*/
package
s
ample
.
jersey
;
package
s
moketest
.
jersey
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.Path
;
import
org.glassfish.jersey.server.ResourceConfig
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.autoconfigure.web.server.LocalManagementPort
;
...
...
@@ -33,7 +32,6 @@ import org.springframework.boot.web.server.LocalServerPort;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
...
@@ -42,9 +40,8 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Madhura Bhave
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
,
properties
=
"management.server.port=0"
)
public
class
JerseyManagementPortTests
{
class
JerseyManagementPortTests
{
@LocalServerPort
private
int
port
;
...
...
@@ -56,7 +53,7 @@ public class JerseyManagementPortTests {
private
TestRestTemplate
testRestTemplate
;
@Test
public
void
resourceShouldBeAvailableOnMainPort
()
{
void
resourceShouldBeAvailableOnMainPort
()
{
ResponseEntity
<
String
>
entity
=
this
.
testRestTemplate
.
getForEntity
(
"http://localhost:"
+
this
.
port
+
"/test"
,
String
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
...
...
@@ -64,7 +61,7 @@ public class JerseyManagementPortTests {
}
@Test
public
void
resourceShouldNotBeAvailableOnManagementPort
()
{
void
resourceShouldNotBeAvailableOnManagementPort
()
{
ResponseEntity
<
String
>
entity
=
this
.
testRestTemplate
.
getForEntity
(
"http://localhost:"
+
this
.
managementPort
+
"/test"
,
String
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
NOT_FOUND
);
...
...
@@ -74,7 +71,7 @@ public class JerseyManagementPortTests {
static
class
ResourceConfigConfiguration
{
@Bean
public
ResourceConfigCustomizer
customizer
()
{
ResourceConfigCustomizer
customizer
()
{
return
new
ResourceConfigCustomizer
()
{
@Override
public
void
customize
(
ResourceConfig
config
)
{
...
...
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