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
54bea725
Commit
54bea725
authored
Mar 29, 2016
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish Jersey integration tests
parent
c752fac5
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
56 additions
and
107 deletions
+56
-107
JerseyAutoConfigurationCustomFilterContextPathTests.java
.../JerseyAutoConfigurationCustomFilterContextPathTests.java
+6
-11
JerseyAutoConfigurationCustomFilterPathTests.java
.../jersey/JerseyAutoConfigurationCustomFilterPathTests.java
+6
-11
JerseyAutoConfigurationCustomObjectMapperProviderTests.java
...rseyAutoConfigurationCustomObjectMapperProviderTests.java
+6
-11
JerseyAutoConfigurationCustomServletContextPathTests.java
...JerseyAutoConfigurationCustomServletContextPathTests.java
+6
-11
JerseyAutoConfigurationCustomServletPathTests.java
...jersey/JerseyAutoConfigurationCustomServletPathTests.java
+6
-11
JerseyAutoConfigurationDefaultFilterPathTests.java
...jersey/JerseyAutoConfigurationDefaultFilterPathTests.java
+6
-11
JerseyAutoConfigurationDefaultServletPathTests.java
...ersey/JerseyAutoConfigurationDefaultServletPathTests.java
+6
-11
JerseyAutoConfigurationObjectMapperProviderTests.java
...sey/JerseyAutoConfigurationObjectMapperProviderTests.java
+6
-11
JerseyAutoConfigurationServletContainerTests.java
.../jersey/JerseyAutoConfigurationServletContainerTests.java
+2
-8
JerseyAutoConfigurationWithoutApplicationPathTests.java
...y/JerseyAutoConfigurationWithoutApplicationPathTests.java
+6
-11
No files found.
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomFilterContextPathTests.java
View file @
54bea725
...
@@ -30,22 +30,20 @@ import org.glassfish.jersey.server.ResourceConfig;
...
@@ -30,22 +30,20 @@ import org.glassfish.jersey.server.ResourceConfig;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationCustomFilterContextPathTests.Application
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationCustomFilterContextPathTests.Application
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.context.IntegrationTest
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.
web.client.TestRestTemplate
;
import
org.springframework.boot.test.
context.web.WebIntegrationTest
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
@@ -58,20 +56,17 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -58,20 +56,17 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@DirtiesContext
@DirtiesContext
@SpringApplicationConfiguration
(
Application
.
class
)
@SpringApplicationConfiguration
(
Application
.
class
)
@
IntegrationTest
({
"server.port=0"
,
"spring.jersey.type=filter"
,
@
WebIntegrationTest
(
randomPort
=
true
,
value
=
{
"spring.jersey.type=filter"
,
"server.contextPath=/app"
})
"server.contextPath=/app"
})
@WebAppConfiguration
public
class
JerseyAutoConfigurationCustomFilterContextPathTests
{
public
class
JerseyAutoConfigurationCustomFilterContextPathTests
{
@LocalServerPort
@Autowired
private
int
port
;
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
@Test
@Test
public
void
contextLoads
()
{
public
void
contextLoads
()
{
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
"
http://localhost:"
+
this
.
port
+
"
/app/rest/hello"
,
String
.
class
);
"/app/rest/hello"
,
String
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomFilterPathTests.java
View file @
54bea725
...
@@ -30,22 +30,20 @@ import org.glassfish.jersey.server.ResourceConfig;
...
@@ -30,22 +30,20 @@ import org.glassfish.jersey.server.ResourceConfig;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationCustomFilterPathTests.Application
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationCustomFilterPathTests.Application
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.context.IntegrationTest
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.
web.client.TestRestTemplate
;
import
org.springframework.boot.test.
context.web.WebIntegrationTest
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
@@ -58,19 +56,16 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -58,19 +56,16 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@DirtiesContext
@DirtiesContext
@SpringApplicationConfiguration
(
Application
.
class
)
@SpringApplicationConfiguration
(
Application
.
class
)
@IntegrationTest
({
"server.port=0"
,
"spring.jersey.type=filter"
})
@WebIntegrationTest
(
randomPort
=
true
,
value
=
"spring.jersey.type=filter"
)
@WebAppConfiguration
public
class
JerseyAutoConfigurationCustomFilterPathTests
{
public
class
JerseyAutoConfigurationCustomFilterPathTests
{
@LocalServerPort
@Autowired
private
int
port
;
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
@Test
@Test
public
void
contextLoads
()
{
public
void
contextLoads
()
{
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
"
http://localhost:"
+
this
.
port
+
"
/rest/hello"
,
String
.
class
);
"/rest/hello"
,
String
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomObjectMapperProviderTests.java
View file @
54bea725
...
@@ -30,22 +30,20 @@ import org.glassfish.jersey.server.ResourceConfig;
...
@@ -30,22 +30,20 @@ import org.glassfish.jersey.server.ResourceConfig;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationObjectMapperProviderTests.Application
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationObjectMapperProviderTests.Application
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.context.IntegrationTest
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.
web.client.TestRestTemplate
;
import
org.springframework.boot.test.
context.web.WebIntegrationTest
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
@@ -58,19 +56,16 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -58,19 +56,16 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@DirtiesContext
@DirtiesContext
@SpringApplicationConfiguration
(
Application
.
class
)
@SpringApplicationConfiguration
(
Application
.
class
)
@IntegrationTest
({
"server.port=0"
,
"spring.jackson.serialization-inclusion=non_null"
})
@WebIntegrationTest
(
randomPort
=
true
,
value
=
"spring.jackson.serialization-inclusion=non_null"
)
@WebAppConfiguration
public
class
JerseyAutoConfigurationCustomObjectMapperProviderTests
{
public
class
JerseyAutoConfigurationCustomObjectMapperProviderTests
{
@LocalServerPort
@Autowired
private
int
port
;
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
@Test
@Test
public
void
contextLoads
()
{
public
void
contextLoads
()
{
ResponseEntity
<
String
>
response
=
this
.
restTemplate
.
getForEntity
(
ResponseEntity
<
String
>
response
=
this
.
restTemplate
.
getForEntity
(
"
http://localhost:"
+
this
.
port
+
"
/rest/message"
,
String
.
class
);
"/rest/message"
,
String
.
class
);
assertThat
(
HttpStatus
.
OK
).
isEqualTo
(
response
.
getStatusCode
());
assertThat
(
HttpStatus
.
OK
).
isEqualTo
(
response
.
getStatusCode
());
assertThat
(
"{\"subject\":\"Jersey\"}"
).
isEqualTo
(
response
.
getBody
());
assertThat
(
"{\"subject\":\"Jersey\"}"
).
isEqualTo
(
response
.
getBody
());
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomServletContextPathTests.java
View file @
54bea725
...
@@ -30,22 +30,20 @@ import org.glassfish.jersey.server.ResourceConfig;
...
@@ -30,22 +30,20 @@ import org.glassfish.jersey.server.ResourceConfig;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationCustomServletContextPathTests.Application
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationCustomServletContextPathTests.Application
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.context.IntegrationTest
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.
web.client.TestRestTemplate
;
import
org.springframework.boot.test.
context.web.WebIntegrationTest
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
@@ -58,19 +56,16 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -58,19 +56,16 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@DirtiesContext
@DirtiesContext
@SpringApplicationConfiguration
(
Application
.
class
)
@SpringApplicationConfiguration
(
Application
.
class
)
@IntegrationTest
({
"server.port=0"
,
"server.contextPath=/app"
})
@WebIntegrationTest
(
randomPort
=
true
,
value
=
"server.contextPath=/app"
)
@WebAppConfiguration
public
class
JerseyAutoConfigurationCustomServletContextPathTests
{
public
class
JerseyAutoConfigurationCustomServletContextPathTests
{
@LocalServerPort
@Autowired
private
int
port
;
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
@Test
@Test
public
void
contextLoads
()
{
public
void
contextLoads
()
{
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
"
http://localhost:"
+
this
.
port
+
"
/app/rest/hello"
,
String
.
class
);
"/app/rest/hello"
,
String
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomServletPathTests.java
View file @
54bea725
...
@@ -30,22 +30,20 @@ import org.glassfish.jersey.server.ResourceConfig;
...
@@ -30,22 +30,20 @@ import org.glassfish.jersey.server.ResourceConfig;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationCustomServletPathTests.Application
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationCustomServletPathTests.Application
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.context.IntegrationTest
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.
web.client.TestRestTemplate
;
import
org.springframework.boot.test.
context.web.WebIntegrationTest
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
@@ -58,19 +56,16 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -58,19 +56,16 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@DirtiesContext
@DirtiesContext
@SpringApplicationConfiguration
(
Application
.
class
)
@SpringApplicationConfiguration
(
Application
.
class
)
@IntegrationTest
(
"server.port=0"
)
@WebIntegrationTest
(
randomPort
=
true
)
@WebAppConfiguration
public
class
JerseyAutoConfigurationCustomServletPathTests
{
public
class
JerseyAutoConfigurationCustomServletPathTests
{
@LocalServerPort
@Autowired
private
int
port
;
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
@Test
@Test
public
void
contextLoads
()
{
public
void
contextLoads
()
{
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
"
http://localhost:"
+
this
.
port
+
"
/rest/hello"
,
String
.
class
);
"/rest/hello"
,
String
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultFilterPathTests.java
View file @
54bea725
...
@@ -29,22 +29,20 @@ import org.glassfish.jersey.server.ResourceConfig;
...
@@ -29,22 +29,20 @@ import org.glassfish.jersey.server.ResourceConfig;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationDefaultFilterPathTests.Application
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationDefaultFilterPathTests.Application
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.context.IntegrationTest
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.
web.client.TestRestTemplate
;
import
org.springframework.boot.test.
context.web.WebIntegrationTest
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
@@ -57,19 +55,16 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -57,19 +55,16 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@DirtiesContext
@DirtiesContext
@SpringApplicationConfiguration
(
Application
.
class
)
@SpringApplicationConfiguration
(
Application
.
class
)
@IntegrationTest
({
"server.port=0"
,
"spring.jersey.type=filter"
})
@WebIntegrationTest
(
randomPort
=
true
,
value
=
"spring.jersey.type=filter"
)
@WebAppConfiguration
public
class
JerseyAutoConfigurationDefaultFilterPathTests
{
public
class
JerseyAutoConfigurationDefaultFilterPathTests
{
@LocalServerPort
@Autowired
private
int
port
;
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
@Test
@Test
public
void
contextLoads
()
{
public
void
contextLoads
()
{
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
"
http://localhost:"
+
this
.
port
+
"
/hello"
,
String
.
class
);
.
getForEntity
(
"/hello"
,
String
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultServletPathTests.java
View file @
54bea725
...
@@ -29,22 +29,20 @@ import org.glassfish.jersey.server.ResourceConfig;
...
@@ -29,22 +29,20 @@ import org.glassfish.jersey.server.ResourceConfig;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationDefaultServletPathTests.Application
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationDefaultServletPathTests.Application
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.context.IntegrationTest
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.
web.client.TestRestTemplate
;
import
org.springframework.boot.test.
context.web.WebIntegrationTest
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
@@ -57,19 +55,16 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -57,19 +55,16 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@DirtiesContext
@DirtiesContext
@SpringApplicationConfiguration
(
Application
.
class
)
@SpringApplicationConfiguration
(
Application
.
class
)
@IntegrationTest
(
"server.port=0"
)
@WebIntegrationTest
(
randomPort
=
true
)
@WebAppConfiguration
public
class
JerseyAutoConfigurationDefaultServletPathTests
{
public
class
JerseyAutoConfigurationDefaultServletPathTests
{
@LocalServerPort
@Autowired
private
int
port
;
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
@Test
@Test
public
void
contextLoads
()
{
public
void
contextLoads
()
{
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
"
http://localhost:"
+
this
.
port
+
"
/hello"
,
String
.
class
);
.
getForEntity
(
"/hello"
,
String
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationObjectMapperProviderTests.java
View file @
54bea725
...
@@ -30,22 +30,20 @@ import org.glassfish.jersey.server.ResourceConfig;
...
@@ -30,22 +30,20 @@ import org.glassfish.jersey.server.ResourceConfig;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationObjectMapperProviderTests.Application
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationObjectMapperProviderTests.Application
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.context.IntegrationTest
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.
web.client.TestRestTemplate
;
import
org.springframework.boot.test.
context.web.WebIntegrationTest
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
@@ -58,19 +56,16 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -58,19 +56,16 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@DirtiesContext
@DirtiesContext
@SpringApplicationConfiguration
(
Application
.
class
)
@SpringApplicationConfiguration
(
Application
.
class
)
@IntegrationTest
(
"server.port=0"
)
@WebIntegrationTest
(
randomPort
=
true
)
@WebAppConfiguration
public
class
JerseyAutoConfigurationObjectMapperProviderTests
{
public
class
JerseyAutoConfigurationObjectMapperProviderTests
{
@LocalServerPort
@Autowired
private
int
port
;
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
@Test
@Test
public
void
contextLoads
()
{
public
void
contextLoads
()
{
ResponseEntity
<
String
>
response
=
this
.
restTemplate
.
getForEntity
(
ResponseEntity
<
String
>
response
=
this
.
restTemplate
.
getForEntity
(
"
http://localhost:"
+
this
.
port
+
"
/rest/message"
,
String
.
class
);
"/rest/message"
,
String
.
class
);
assertThat
(
HttpStatus
.
OK
).
isEqualTo
(
response
.
getStatusCode
());
assertThat
(
HttpStatus
.
OK
).
isEqualTo
(
response
.
getStatusCode
());
assertThat
(
"{\"subject\":\"Jersey\",\"body\":null}"
)
assertThat
(
"{\"subject\":\"Jersey\",\"body\":null}"
)
.
isEqualTo
(
response
.
getBody
());
.
isEqualTo
(
response
.
getBody
());
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationServletContainerTests.java
View file @
54bea725
...
@@ -34,16 +34,14 @@ import org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationServ
...
@@ -34,16 +34,14 @@ import org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationServ
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory
;
import
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.context.IntegrationTest
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.context.web.WebIntegrationTest
;
import
org.springframework.boot.test.rule.OutputCapture
;
import
org.springframework.boot.test.rule.OutputCapture
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
@@ -56,16 +54,12 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -56,16 +54,12 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@DirtiesContext
@DirtiesContext
@SpringApplicationConfiguration
(
Application
.
class
)
@SpringApplicationConfiguration
(
Application
.
class
)
@IntegrationTest
(
"server.port=0"
)
@WebIntegrationTest
(
randomPort
=
true
)
@WebAppConfiguration
public
class
JerseyAutoConfigurationServletContainerTests
{
public
class
JerseyAutoConfigurationServletContainerTests
{
@ClassRule
@ClassRule
public
static
OutputCapture
output
=
new
OutputCapture
();
public
static
OutputCapture
output
=
new
OutputCapture
();
@LocalServerPort
private
int
port
;
@Test
@Test
public
void
existingJerseyServletIsAmended
()
{
public
void
existingJerseyServletIsAmended
()
{
assertThat
(
output
.
toString
())
assertThat
(
output
.
toString
())
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationWithoutApplicationPathTests.java
View file @
54bea725
...
@@ -29,22 +29,20 @@ import org.glassfish.jersey.server.ResourceConfig;
...
@@ -29,22 +29,20 @@ import org.glassfish.jersey.server.ResourceConfig;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationCustomServletPathTests.Application
;
import
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationCustomServletPathTests.Application
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.context.IntegrationTest
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.context.SpringApplicationConfiguration
;
import
org.springframework.boot.test.
web.client.TestRestTemplate
;
import
org.springframework.boot.test.
context.web.WebIntegrationTest
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
@@ -57,19 +55,16 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -57,19 +55,16 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@DirtiesContext
@DirtiesContext
@SpringApplicationConfiguration
(
Application
.
class
)
@SpringApplicationConfiguration
(
Application
.
class
)
@IntegrationTest
({
"server.port=0"
,
"spring.jersey.application-path=/api"
})
@WebIntegrationTest
(
randomPort
=
true
,
value
=
"spring.jersey.application-path=/api"
)
@WebAppConfiguration
public
class
JerseyAutoConfigurationWithoutApplicationPathTests
{
public
class
JerseyAutoConfigurationWithoutApplicationPathTests
{
@LocalServerPort
@Autowired
private
int
port
;
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
@Test
@Test
public
void
contextLoads
()
{
public
void
contextLoads
()
{
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
ResponseEntity
<
String
>
entity
=
this
.
restTemplate
.
getForEntity
(
"
http://localhost:"
+
this
.
port
+
"
/api/hello"
,
String
.
class
);
"/api/hello"
,
String
.
class
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
assertThat
(
entity
.
getStatusCode
()).
isEqualTo
(
HttpStatus
.
OK
);
}
}
...
...
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