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
fca6dbaf
Commit
fca6dbaf
authored
Mar 14, 2016
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5337 from anandshah123/feature/gh-5262-advance
* pr/5337: Polish contribution Add `@LocalServerPort`
parents
a3a38c6b
2526a54e
Changes
74
Hide whitespace changes
Inline
Side-by-side
Showing
74 changed files
with
193 additions
and
134 deletions
+193
-134
EndpointMvcIntegrationTests.java
...ot/actuate/autoconfigure/EndpointMvcIntegrationTests.java
+2
-2
HalBrowserMvcEndpointServerContextPathIntegrationTests.java
...lBrowserMvcEndpointServerContextPathIntegrationTests.java
+2
-2
JerseyAutoConfigurationCustomFilterContextPathTests.java
.../JerseyAutoConfigurationCustomFilterContextPathTests.java
+2
-1
JerseyAutoConfigurationCustomFilterPathTests.java
.../jersey/JerseyAutoConfigurationCustomFilterPathTests.java
+2
-1
JerseyAutoConfigurationCustomObjectMapperProviderTests.java
...rseyAutoConfigurationCustomObjectMapperProviderTests.java
+2
-2
JerseyAutoConfigurationCustomServletContextPathTests.java
...JerseyAutoConfigurationCustomServletContextPathTests.java
+2
-1
JerseyAutoConfigurationCustomServletPathTests.java
...jersey/JerseyAutoConfigurationCustomServletPathTests.java
+2
-1
JerseyAutoConfigurationDefaultFilterPathTests.java
...jersey/JerseyAutoConfigurationDefaultFilterPathTests.java
+2
-1
JerseyAutoConfigurationDefaultServletPathTests.java
...ersey/JerseyAutoConfigurationDefaultServletPathTests.java
+2
-1
JerseyAutoConfigurationObjectMapperProviderTests.java
...sey/JerseyAutoConfigurationObjectMapperProviderTests.java
+2
-2
JerseyAutoConfigurationServletContainerTests.java
.../jersey/JerseyAutoConfigurationServletContainerTests.java
+2
-1
JerseyAutoConfigurationWithoutApplicationPathTests.java
...y/JerseyAutoConfigurationWithoutApplicationPathTests.java
+2
-1
UserInfoTokenServicesRefreshTokenTests.java
...uth2/resource/UserInfoTokenServicesRefreshTokenTests.java
+2
-2
RemappedErrorViewIntegrationTests.java
.../autoconfigure/web/RemappedErrorViewIntegrationTests.java
+2
-2
howto.adoc
spring-boot-docs/src/main/asciidoc/howto.adoc
+6
-5
SampleActuatorLog4J2ApplicationTests.java
...actuator/log4j2/SampleActuatorLog4J2ApplicationTests.java
+2
-2
SampleActuatorUiApplicationPortTests.java
...ple/actuator/ui/SampleActuatorUiApplicationPortTests.java
+2
-1
SampleActuatorUiApplicationTests.java
.../sample/actuator/ui/SampleActuatorUiApplicationTests.java
+2
-2
EndpointsPropertiesSampleActuatorApplicationTests.java
...or/EndpointsPropertiesSampleActuatorApplicationTests.java
+2
-2
InsecureManagementPortAndPathSampleActuatorApplicationTests.java
...eManagementPortAndPathSampleActuatorApplicationTests.java
+2
-1
InsecureManagementSampleActuatorApplicationTests.java
...tor/InsecureManagementSampleActuatorApplicationTests.java
+2
-2
InsecureSampleActuatorApplicationTests.java
...mple/actuator/InsecureSampleActuatorApplicationTests.java
+2
-2
ManagementAddressActuatorApplicationTests.java
...e/actuator/ManagementAddressActuatorApplicationTests.java
+2
-1
ManagementPathSampleActuatorApplicationTests.java
...ctuator/ManagementPathSampleActuatorApplicationTests.java
+2
-2
ManagementPortAndPathSampleActuatorApplicationTests.java
.../ManagementPortAndPathSampleActuatorApplicationTests.java
+2
-1
ManagementPortSampleActuatorApplicationTests.java
...ctuator/ManagementPortSampleActuatorApplicationTests.java
+2
-1
NoManagementSampleActuatorApplicationTests.java
.../actuator/NoManagementSampleActuatorApplicationTests.java
+2
-2
NonSensitiveHealthTests.java
...rc/test/java/sample/actuator/NonSensitiveHealthTests.java
+2
-2
SampleActuatorApplicationTests.java
.../java/sample/actuator/SampleActuatorApplicationTests.java
+2
-2
ServletPathInsecureSampleActuatorApplicationTests.java
...or/ServletPathInsecureSampleActuatorApplicationTests.java
+2
-2
ServletPathSampleActuatorApplicationTests.java
...e/actuator/ServletPathSampleActuatorApplicationTests.java
+2
-2
ShutdownSampleActuatorApplicationTests.java
...mple/actuator/ShutdownSampleActuatorApplicationTests.java
+2
-2
SampleAtmosphereApplicationTests.java
...a/sample/atmosphere/SampleAtmosphereApplicationTests.java
+2
-1
SampleHateoasApplicationTests.java
...st/java/sample/hateoas/SampleHateoasApplicationTests.java
+2
-2
SampleHypermediaUiApplicationTests.java
...ple/hypermedia/ui/SampleHypermediaUiApplicationTests.java
+2
-2
SampleHypermediaApplicationHomePageTests.java
.../hypermedia/SampleHypermediaApplicationHomePageTests.java
+2
-2
SampleJerseyApplicationTests.java
...test/java/sample/jersey/SampleJerseyApplicationTests.java
+2
-2
SampleJersey1ApplicationTests.java
...st/java/sample/jersey1/SampleJersey1ApplicationTests.java
+2
-2
SampleJettySslApplicationTests.java
...java/sample/jetty/ssl/SampleJettySslApplicationTests.java
+2
-2
SampleJettyApplicationTests.java
...c/test/java/sample/jetty/SampleJettyApplicationTests.java
+2
-2
SampleJetty8SslApplicationTests.java
...va/sample/jetty8/ssl/SampleJetty8SslApplicationTests.java
+2
-2
SampleJetty8ApplicationTests.java
...test/java/sample/jetty8/SampleJetty8ApplicationTests.java
+2
-2
SampleJetty93ApplicationTests.java
...st/java/sample/jetty93/SampleJetty93ApplicationTests.java
+2
-2
SampleServletApplicationTests.java
...st/java/sample/servlet/SampleServletApplicationTests.java
+2
-2
SampleTestNGApplicationTests.java
...test/java/sample/testng/SampleTestNGApplicationTests.java
+2
-2
SampleWebJspApplicationTests.java
.../java/sample/tomcat/jsp/SampleWebJspApplicationTests.java
+2
-2
SampleTomcatTwoConnectorsApplicationTests.java
...iconnector/SampleTomcatTwoConnectorsApplicationTests.java
+2
-2
SampleTomcatSslApplicationTests.java
...va/sample/tomcat/ssl/SampleTomcatSslApplicationTests.java
+2
-3
NonAutoConfigurationSampleTomcatApplicationTests.java
...cat/NonAutoConfigurationSampleTomcatApplicationTests.java
+2
-2
SampleTomcatApplicationTests.java
...test/java/sample/tomcat/SampleTomcatApplicationTests.java
+2
-2
SampleWebJspApplicationTests.java
...java/sample/tomcat7/jsp/SampleWebJspApplicationTests.java
+2
-2
SampleTraditionalApplicationTests.java
...sample/traditional/SampleTraditionalApplicationTests.java
+2
-2
SampleUndertowSslApplicationTests.java
...ample/undertow/ssl/SampleUndertowSslApplicationTests.java
+2
-2
SampleUndertowApplicationTests.java
.../java/sample/undertow/SampleUndertowApplicationTests.java
+2
-2
SampleWebFreeMarkerApplicationTests.java
...ample/freemarker/SampleWebFreeMarkerApplicationTests.java
+2
-2
SampleGroovyTemplateApplicationTests.java
...groovytemplates/SampleGroovyTemplateApplicationTests.java
+2
-2
SampleWebJspApplicationTests.java
...rc/test/java/sample/jsp/SampleWebJspApplicationTests.java
+2
-2
SampleMethodSecurityApplicationTests.java
...security/method/SampleMethodSecurityApplicationTests.java
+2
-2
SampleWebMustacheApplicationTests.java
...va/sample/mustache/SampleWebMustacheApplicationTests.java
+2
-2
SampleWebSecureCustomApplicationTests.java
.../secure/custom/SampleWebSecureCustomApplicationTests.java
+2
-3
SampleGithubApplicationTests.java
...ample/web/secure/github/SampleGithubApplicationTests.java
+2
-2
SampleWebSecureCustomApplicationTests.java
...eb/secure/jdbc/SampleWebSecureCustomApplicationTests.java
+2
-2
SampleSecureApplicationTests.java
.../java/sample/web/secure/SampleSecureApplicationTests.java
+2
-2
SampleWebStaticApplicationTests.java
...le/web/staticcontent/SampleWebStaticApplicationTests.java
+2
-3
SampleWebUiApplicationTests.java
.../test/java/sample/web/ui/SampleWebUiApplicationTests.java
+2
-3
SampleWebVelocityApplicationTests.java
...ample/web/velocity/SampleWebVelocityApplicationTests.java
+2
-2
SampleWebSocketsApplicationTests.java
...les/websocket/jetty/SampleWebSocketsApplicationTests.java
+2
-1
SampleWebSocketsApplicationTests.java
...es/websocket/tomcat/SampleWebSocketsApplicationTests.java
+2
-1
SampleWebSocketsApplicationTests.java
.../websocket/undertow/SampleWebSocketsApplicationTests.java
+2
-1
SampleWsApplicationTests.java
...-ws/src/test/java/sample/ws/SampleWsApplicationTests.java
+3
-2
WebIntegrationTest.java
...ava/org/springframework/boot/test/WebIntegrationTest.java
+3
-2
SpringApplicationIntegrationTestTests.java
...work/boot/test/SpringApplicationIntegrationTestTests.java
+2
-1
SpringApplicationWebIntegrationTestTests.java
...k/boot/test/SpringApplicationWebIntegrationTestTests.java
+2
-1
LocalServerPort.java
...org/springframework/boot/context/web/LocalServerPort.java
+41
-0
No files found.
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointMvcIntegrationTests.java
View file @
fca6dbaf
...
@@ -34,7 +34,6 @@ import org.junit.Test;
...
@@ -34,7 +34,6 @@ 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.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.actuate.autoconfigure.EndpointMvcIntegrationTests.Application
;
import
org.springframework.boot.actuate.autoconfigure.EndpointMvcIntegrationTests.Application
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.actuate.endpoint.mvc.EndpointHandlerMapping
;
import
org.springframework.boot.actuate.endpoint.mvc.EndpointHandlerMapping
;
...
@@ -48,6 +47,7 @@ import org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration;
...
@@ -48,6 +47,7 @@ import org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration;
import
org.springframework.boot.autoconfigure.web.HttpMessageConverters
;
import
org.springframework.boot.autoconfigure.web.HttpMessageConverters
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
...
@@ -78,7 +78,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -78,7 +78,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
EndpointMvcIntegrationTests
{
public
class
EndpointMvcIntegrationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Autowired
@Autowired
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HalBrowserMvcEndpointServerContextPathIntegrationTests.java
View file @
fca6dbaf
...
@@ -21,9 +21,9 @@ import java.util.Arrays;
...
@@ -21,9 +21,9 @@ import java.util.Arrays;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.actuate.autoconfigure.MinimalActuatorHypermediaApplication
;
import
org.springframework.boot.actuate.autoconfigure.MinimalActuatorHypermediaApplication
;
import
org.springframework.boot.actuate.endpoint.mvc.HalBrowserMvcEndpointServerContextPathIntegrationTests.SpringBootHypermediaApplication
;
import
org.springframework.boot.actuate.endpoint.mvc.HalBrowserMvcEndpointServerContextPathIntegrationTests.SpringBootHypermediaApplication
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
...
@@ -57,7 +57,7 @@ import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
...
@@ -57,7 +57,7 @@ import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
@DirtiesContext
@DirtiesContext
public
class
HalBrowserMvcEndpointServerContextPathIntegrationTests
{
public
class
HalBrowserMvcEndpointServerContextPathIntegrationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomFilterContextPathTests.java
View file @
fca6dbaf
...
@@ -36,6 +36,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
...
@@ -36,6 +36,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
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.IntegrationTest
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
...
@@ -62,7 +63,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -62,7 +63,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebAppConfiguration
@WebAppConfiguration
public
class
JerseyAutoConfigurationCustomFilterContextPathTests
{
public
class
JerseyAutoConfigurationCustomFilterContextPathTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomFilterPathTests.java
View file @
fca6dbaf
...
@@ -36,6 +36,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
...
@@ -36,6 +36,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
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.IntegrationTest
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
...
@@ -61,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -61,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebAppConfiguration
@WebAppConfiguration
public
class
JerseyAutoConfigurationCustomFilterPathTests
{
public
class
JerseyAutoConfigurationCustomFilterPathTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomObjectMapperProviderTests.java
View file @
fca6dbaf
...
@@ -30,13 +30,13 @@ import org.glassfish.jersey.server.ResourceConfig;
...
@@ -30,13 +30,13 @@ 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.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.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.IntegrationTest
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
...
@@ -62,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -62,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebAppConfiguration
@WebAppConfiguration
public
class
JerseyAutoConfigurationCustomObjectMapperProviderTests
{
public
class
JerseyAutoConfigurationCustomObjectMapperProviderTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomServletContextPathTests.java
View file @
fca6dbaf
...
@@ -36,6 +36,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
...
@@ -36,6 +36,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
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.IntegrationTest
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
...
@@ -61,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -61,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebAppConfiguration
@WebAppConfiguration
public
class
JerseyAutoConfigurationCustomServletContextPathTests
{
public
class
JerseyAutoConfigurationCustomServletContextPathTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomServletPathTests.java
View file @
fca6dbaf
...
@@ -36,6 +36,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
...
@@ -36,6 +36,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
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.IntegrationTest
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
...
@@ -61,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -61,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebAppConfiguration
@WebAppConfiguration
public
class
JerseyAutoConfigurationCustomServletPathTests
{
public
class
JerseyAutoConfigurationCustomServletPathTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultFilterPathTests.java
View file @
fca6dbaf
...
@@ -35,6 +35,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
...
@@ -35,6 +35,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
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.IntegrationTest
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
...
@@ -60,7 +61,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -60,7 +61,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebAppConfiguration
@WebAppConfiguration
public
class
JerseyAutoConfigurationDefaultFilterPathTests
{
public
class
JerseyAutoConfigurationDefaultFilterPathTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationDefaultServletPathTests.java
View file @
fca6dbaf
...
@@ -35,6 +35,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
...
@@ -35,6 +35,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
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.IntegrationTest
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
...
@@ -60,7 +61,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -60,7 +61,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebAppConfiguration
@WebAppConfiguration
public
class
JerseyAutoConfigurationDefaultServletPathTests
{
public
class
JerseyAutoConfigurationDefaultServletPathTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationObjectMapperProviderTests.java
View file @
fca6dbaf
...
@@ -30,13 +30,13 @@ import org.glassfish.jersey.server.ResourceConfig;
...
@@ -30,13 +30,13 @@ 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.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.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.IntegrationTest
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
...
@@ -62,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -62,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebAppConfiguration
@WebAppConfiguration
public
class
JerseyAutoConfigurationObjectMapperProviderTests
{
public
class
JerseyAutoConfigurationObjectMapperProviderTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationServletContainerTests.java
View file @
fca6dbaf
...
@@ -34,6 +34,7 @@ import org.springframework.boot.autoconfigure.test.ImportAutoConfiguration;
...
@@ -34,6 +34,7 @@ import org.springframework.boot.autoconfigure.test.ImportAutoConfiguration;
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.IntegrationTest
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.OutputCapture
;
import
org.springframework.boot.test.OutputCapture
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
...
@@ -62,7 +63,7 @@ public class JerseyAutoConfigurationServletContainerTests {
...
@@ -62,7 +63,7 @@ public class JerseyAutoConfigurationServletContainerTests {
@ClassRule
@ClassRule
public
static
OutputCapture
output
=
new
OutputCapture
();
public
static
OutputCapture
output
=
new
OutputCapture
();
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationWithoutApplicationPathTests.java
View file @
fca6dbaf
...
@@ -35,6 +35,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
...
@@ -35,6 +35,7 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
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.IntegrationTest
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
...
@@ -60,7 +61,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -60,7 +61,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebAppConfiguration
@WebAppConfiguration
public
class
JerseyAutoConfigurationWithoutApplicationPathTests
{
public
class
JerseyAutoConfigurationWithoutApplicationPathTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServicesRefreshTokenTests.java
View file @
fca6dbaf
...
@@ -24,7 +24,6 @@ import org.junit.Test;
...
@@ -24,7 +24,6 @@ import org.junit.Test;
import
org.junit.rules.ExpectedException
;
import
org.junit.rules.ExpectedException
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServicesRefreshTokenTests.Application
;
import
org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServicesRefreshTokenTests.Application
;
import
org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration
;
...
@@ -32,6 +31,7 @@ import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoCo
...
@@ -32,6 +31,7 @@ import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoCo
import
org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -71,7 +71,7 @@ public class UserInfoTokenServicesRefreshTokenTests {
...
@@ -71,7 +71,7 @@ public class UserInfoTokenServicesRefreshTokenTests {
@Rule
@Rule
public
ExpectedException
expected
=
ExpectedException
.
none
();
public
ExpectedException
expected
=
ExpectedException
.
none
();
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
private
UserInfoTokenServices
services
;
private
UserInfoTokenServices
services
;
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/RemappedErrorViewIntegrationTests.java
View file @
fca6dbaf
...
@@ -19,13 +19,13 @@ package org.springframework.boot.autoconfigure.web;
...
@@ -19,13 +19,13 @@ package org.springframework.boot.autoconfigure.web;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.RemappedErrorViewIntegrationTests.TestConfiguration
;
import
org.springframework.boot.autoconfigure.web.RemappedErrorViewIntegrationTests.TestConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer
;
import
org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer
;
import
org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer
;
import
org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer
;
import
org.springframework.boot.context.embedded.ErrorPage
;
import
org.springframework.boot.context.embedded.ErrorPage
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.IntegrationTest
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
...
@@ -50,7 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -50,7 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
RemappedErrorViewIntegrationTests
{
public
class
RemappedErrorViewIntegrationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
private
RestTemplate
template
=
new
TestRestTemplate
();
private
RestTemplate
template
=
new
TestRestTemplate
();
...
...
spring-boot-docs/src/main/asciidoc/howto.adoc
View file @
fca6dbaf
...
@@ -454,7 +454,7 @@ that and be sure that it has initialized is to add a `@Bean` of type
...
@@ -454,7 +454,7 @@ that and be sure that it has initialized is to add a `@Bean` of type
out of the event when it is published.
out of the event when it is published.
A useful practice for use with `@WebIntegrationTest` is to set `server.port=0`
A useful practice for use with `@WebIntegrationTest` is to set `server.port=0`
and then inject the actual
('`local`') port as a `@Value`
. For example:
and then inject the actual
port
. For example:
[source,java,indent=0,subs="verbatim,quotes,attributes"]
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
----
...
@@ -466,7 +466,7 @@ and then inject the actual ('`local`') port as a `@Value`. For example:
...
@@ -466,7 +466,7 @@ and then inject the actual ('`local`') port as a `@Value`. For example:
@Autowired
@Autowired
EmbeddedWebApplicationContext server;
EmbeddedWebApplicationContext server;
@
Value("${local.server.port}")
@
LocalServerPort
int port;
int port;
// ...
// ...
...
@@ -476,9 +476,10 @@ and then inject the actual ('`local`') port as a `@Value`. For example:
...
@@ -476,9 +476,10 @@ and then inject the actual ('`local`') port as a `@Value`. For example:
[NOTE]
[NOTE]
====
====
Don't try to inject the port with `@Value` in a regular application. As we just saw, the
`@LocalServerPort` is a meta-annotation for `@Value("${local.server.port}")`. Don't try
value is only set once the container has initialized; contrary to a test, application code
to inject the port in a regular application. As we just saw, the value is only set once
callbacks are processed early (i.e. before the value is actually available).
the container has initialized; contrary to a test, application code callbacks are
processed early (i.e. before the value is actually available).
====
====
...
...
spring-boot-samples/spring-boot-sample-actuator-log4j2/src/test/java/sample/actuator/log4j2/SampleActuatorLog4J2ApplicationTests.java
View file @
fca6dbaf
...
@@ -21,7 +21,7 @@ import java.util.Map;
...
@@ -21,7 +21,7 @@ import java.util.Map;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleActuatorLog4J2ApplicationTests
{
public
class
SampleActuatorLog4J2ApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationPortTests.java
View file @
fca6dbaf
...
@@ -22,6 +22,7 @@ import org.junit.Test;
...
@@ -22,6 +22,7 @@ import org.junit.Test;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -43,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -43,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleActuatorUiApplicationPortTests
{
public
class
SampleActuatorUiApplicationPortTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
=
9010
;
private
int
port
=
9010
;
@Value
(
"${local.management.port}"
)
@Value
(
"${local.management.port}"
)
...
...
spring-boot-samples/spring-boot-sample-actuator-ui/src/test/java/sample/actuator/ui/SampleActuatorUiApplicationTests.java
View file @
fca6dbaf
...
@@ -22,7 +22,7 @@ import java.util.Map;
...
@@ -22,7 +22,7 @@ import java.util.Map;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleActuatorUiApplicationTests
{
public
class
SampleActuatorUiApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/EndpointsPropertiesSampleActuatorApplicationTests.java
View file @
fca6dbaf
...
@@ -22,8 +22,8 @@ import org.junit.Test;
...
@@ -22,8 +22,8 @@ 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.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -50,7 +50,7 @@ public class EndpointsPropertiesSampleActuatorApplicationTests {
...
@@ -50,7 +50,7 @@ public class EndpointsPropertiesSampleActuatorApplicationTests {
@Autowired
@Autowired
private
SecurityProperties
security
;
private
SecurityProperties
security
;
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementPortAndPathSampleActuatorApplicationTests.java
View file @
fca6dbaf
...
@@ -24,6 +24,7 @@ import org.junit.runner.RunWith;
...
@@ -24,6 +24,7 @@ import org.junit.runner.RunWith;
import
org.springframework.beans.factory.annotation.Autowired
;
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.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -49,7 +50,7 @@ public class InsecureManagementPortAndPathSampleActuatorApplicationTests {
...
@@ -49,7 +50,7 @@ public class InsecureManagementPortAndPathSampleActuatorApplicationTests {
@Autowired
@Autowired
private
SecurityProperties
security
;
private
SecurityProperties
security
;
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
=
9010
;
private
int
port
=
9010
;
@Value
(
"${local.management.port}"
)
@Value
(
"${local.management.port}"
)
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureManagementSampleActuatorApplicationTests.java
View file @
fca6dbaf
...
@@ -21,7 +21,7 @@ import java.util.Map;
...
@@ -21,7 +21,7 @@ import java.util.Map;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@ActiveProfiles
(
"unsecure-management"
)
@ActiveProfiles
(
"unsecure-management"
)
public
class
InsecureManagementSampleActuatorApplicationTests
{
public
class
InsecureManagementSampleActuatorApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/InsecureSampleActuatorApplicationTests.java
View file @
fca6dbaf
...
@@ -21,7 +21,7 @@ import java.util.Map;
...
@@ -21,7 +21,7 @@ import java.util.Map;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
InsecureSampleActuatorApplicationTests
{
public
class
InsecureSampleActuatorApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementAddressActuatorApplicationTests.java
View file @
fca6dbaf
...
@@ -22,6 +22,7 @@ import org.junit.Test;
...
@@ -22,6 +22,7 @@ import org.junit.Test;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -44,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -44,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
ManagementAddressActuatorApplicationTests
{
public
class
ManagementAddressActuatorApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
=
9010
;
private
int
port
=
9010
;
@Value
(
"${local.management.port}"
)
@Value
(
"${local.management.port}"
)
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPathSampleActuatorApplicationTests.java
View file @
fca6dbaf
...
@@ -21,7 +21,7 @@ import java.util.Map;
...
@@ -21,7 +21,7 @@ import java.util.Map;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
ManagementPathSampleActuatorApplicationTests
{
public
class
ManagementPathSampleActuatorApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortAndPathSampleActuatorApplicationTests.java
View file @
fca6dbaf
...
@@ -24,6 +24,7 @@ import org.junit.runner.RunWith;
...
@@ -24,6 +24,7 @@ import org.junit.runner.RunWith;
import
org.springframework.beans.factory.annotation.Autowired
;
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.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -49,7 +50,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
...
@@ -49,7 +50,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
@Autowired
@Autowired
private
SecurityProperties
security
;
private
SecurityProperties
security
;
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
=
9010
;
private
int
port
=
9010
;
@Value
(
"${local.management.port}"
)
@Value
(
"${local.management.port}"
)
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ManagementPortSampleActuatorApplicationTests.java
View file @
fca6dbaf
...
@@ -24,6 +24,7 @@ import org.junit.runner.RunWith;
...
@@ -24,6 +24,7 @@ import org.junit.runner.RunWith;
import
org.springframework.beans.factory.annotation.Autowired
;
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.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -48,7 +49,7 @@ public class ManagementPortSampleActuatorApplicationTests {
...
@@ -48,7 +49,7 @@ public class ManagementPortSampleActuatorApplicationTests {
@Autowired
@Autowired
private
SecurityProperties
security
;
private
SecurityProperties
security
;
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
=
9010
;
private
int
port
=
9010
;
@Value
(
"${local.management.port}"
)
@Value
(
"${local.management.port}"
)
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NoManagementSampleActuatorApplicationTests.java
View file @
fca6dbaf
...
@@ -22,8 +22,8 @@ import org.junit.Test;
...
@@ -22,8 +22,8 @@ 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.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -48,7 +48,7 @@ public class NoManagementSampleActuatorApplicationTests {
...
@@ -48,7 +48,7 @@ public class NoManagementSampleActuatorApplicationTests {
@Autowired
@Autowired
private
SecurityProperties
security
;
private
SecurityProperties
security
;
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
=
0
;
private
int
port
=
0
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/NonSensitiveHealthTests.java
View file @
fca6dbaf
...
@@ -19,7 +19,7 @@ package sample.actuator;
...
@@ -19,7 +19,7 @@ package sample.actuator;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
NonSensitiveHealthTests
{
public
class
NonSensitiveHealthTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java
View file @
fca6dbaf
...
@@ -24,9 +24,9 @@ import org.junit.Test;
...
@@ -24,9 +24,9 @@ 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.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceProperties
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceProperties
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -56,7 +56,7 @@ public class SampleActuatorApplicationTests {
...
@@ -56,7 +56,7 @@ public class SampleActuatorApplicationTests {
@Autowired
@Autowired
private
SecurityProperties
security
;
private
SecurityProperties
security
;
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathInsecureSampleActuatorApplicationTests.java
View file @
fca6dbaf
...
@@ -21,7 +21,7 @@ import java.util.Map;
...
@@ -21,7 +21,7 @@ import java.util.Map;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
ServletPathInsecureSampleActuatorApplicationTests
{
public
class
ServletPathInsecureSampleActuatorApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ServletPathSampleActuatorApplicationTests.java
View file @
fca6dbaf
...
@@ -21,7 +21,7 @@ import java.util.Map;
...
@@ -21,7 +21,7 @@ import java.util.Map;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
ServletPathSampleActuatorApplicationTests
{
public
class
ServletPathSampleActuatorApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/ShutdownSampleActuatorApplicationTests.java
View file @
fca6dbaf
...
@@ -22,8 +22,8 @@ import org.junit.Test;
...
@@ -22,8 +22,8 @@ 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.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -48,7 +48,7 @@ public class ShutdownSampleActuatorApplicationTests {
...
@@ -48,7 +48,7 @@ public class ShutdownSampleActuatorApplicationTests {
@Autowired
@Autowired
private
SecurityProperties
security
;
private
SecurityProperties
security
;
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java
View file @
fca6dbaf
...
@@ -29,6 +29,7 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -29,6 +29,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.ConfigurableApplicationContext
;
...
@@ -52,7 +53,7 @@ public class SampleAtmosphereApplicationTests {
...
@@ -52,7 +53,7 @@ public class SampleAtmosphereApplicationTests {
private
static
Log
logger
=
LogFactory
.
getLog
(
SampleAtmosphereApplicationTests
.
class
);
private
static
Log
logger
=
LogFactory
.
getLog
(
SampleAtmosphereApplicationTests
.
class
);
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
=
1234
;
private
int
port
=
1234
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java
View file @
fca6dbaf
...
@@ -21,7 +21,7 @@ import java.net.URI;
...
@@ -21,7 +21,7 @@ import java.net.URI;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebIntegrationTest
(
randomPort
=
true
)
@WebIntegrationTest
(
randomPort
=
true
)
public
class
SampleHateoasApplicationTests
{
public
class
SampleHateoasApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-hypermedia-ui/src/test/java/sample/hypermedia/ui/SampleHypermediaUiApplicationTests.java
View file @
fca6dbaf
...
@@ -22,7 +22,7 @@ import java.util.Arrays;
...
@@ -22,7 +22,7 @@ import java.util.Arrays;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebIntegrationTest
(
value
=
{
"management.context-path="
},
randomPort
=
true
)
@WebIntegrationTest
(
value
=
{
"management.context-path="
},
randomPort
=
true
)
public
class
SampleHypermediaUiApplicationTests
{
public
class
SampleHypermediaUiApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-hypermedia/src/test/java/sample/hypermedia/SampleHypermediaApplicationHomePageTests.java
View file @
fca6dbaf
...
@@ -22,7 +22,7 @@ import java.util.Arrays;
...
@@ -22,7 +22,7 @@ import java.util.Arrays;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebIntegrationTest
(
randomPort
=
true
)
@WebIntegrationTest
(
randomPort
=
true
)
public
class
SampleHypermediaApplicationHomePageTests
{
public
class
SampleHypermediaApplicationHomePageTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-jersey/src/test/java/sample/jersey/SampleJerseyApplicationTests.java
View file @
fca6dbaf
...
@@ -19,7 +19,7 @@ package sample.jersey;
...
@@ -19,7 +19,7 @@ package sample.jersey;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebIntegrationTest
(
randomPort
=
true
)
@WebIntegrationTest
(
randomPort
=
true
)
public
class
SampleJerseyApplicationTests
{
public
class
SampleJerseyApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
private
RestTemplate
restTemplate
=
new
TestRestTemplate
();
...
...
spring-boot-samples/spring-boot-sample-jersey1/src/test/java/sample/jersey1/SampleJersey1ApplicationTests.java
View file @
fca6dbaf
...
@@ -19,7 +19,7 @@ package sample.jersey1;
...
@@ -19,7 +19,7 @@ package sample.jersey1;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebIntegrationTest
(
randomPort
=
true
)
@WebIntegrationTest
(
randomPort
=
true
)
public
class
SampleJersey1ApplicationTests
{
public
class
SampleJersey1ApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java
View file @
fca6dbaf
...
@@ -24,7 +24,7 @@ import org.apache.http.ssl.SSLContextBuilder;
...
@@ -24,7 +24,7 @@ import org.apache.http.ssl.SSLContextBuilder;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleJettySslApplicationTests
{
public
class
SampleJettySslApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-jetty/src/test/java/sample/jetty/SampleJettyApplicationTests.java
View file @
fca6dbaf
...
@@ -23,7 +23,7 @@ import java.util.zip.GZIPInputStream;
...
@@ -23,7 +23,7 @@ import java.util.zip.GZIPInputStream;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleJettyApplicationTests
{
public
class
SampleJettyApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty8/ssl/SampleJetty8SslApplicationTests.java
View file @
fca6dbaf
...
@@ -24,7 +24,7 @@ import org.apache.http.ssl.SSLContextBuilder;
...
@@ -24,7 +24,7 @@ import org.apache.http.ssl.SSLContextBuilder;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleJetty8SslApplicationTests
{
public
class
SampleJetty8SslApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java
View file @
fca6dbaf
...
@@ -23,7 +23,7 @@ import java.util.zip.GZIPInputStream;
...
@@ -23,7 +23,7 @@ import java.util.zip.GZIPInputStream;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleJetty8ApplicationTests
{
public
class
SampleJetty8ApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-jetty93/src/test/java/sample/jetty93/SampleJetty93ApplicationTests.java
View file @
fca6dbaf
...
@@ -23,7 +23,7 @@ import java.util.zip.GZIPInputStream;
...
@@ -23,7 +23,7 @@ import java.util.zip.GZIPInputStream;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleJetty93ApplicationTests
{
public
class
SampleJetty93ApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java
View file @
fca6dbaf
...
@@ -20,8 +20,8 @@ import org.junit.Test;
...
@@ -20,8 +20,8 @@ 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.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleServletApplicationTests
{
public
class
SampleServletApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Autowired
@Autowired
...
...
spring-boot-samples/spring-boot-sample-testng/src/test/java/sample/testng/SampleTestNGApplicationTests.java
View file @
fca6dbaf
...
@@ -18,7 +18,7 @@ package sample.testng;
...
@@ -18,7 +18,7 @@ package sample.testng;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleTestNGApplicationTests
extends
AbstractTestNGSpringContextTests
{
public
class
SampleTestNGApplicationTests
extends
AbstractTestNGSpringContextTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java
View file @
fca6dbaf
...
@@ -19,7 +19,7 @@ package sample.tomcat.jsp;
...
@@ -19,7 +19,7 @@ package sample.tomcat.jsp;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleWebJspApplicationTests
{
public
class
SampleWebJspApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java
View file @
fca6dbaf
...
@@ -31,7 +31,7 @@ import org.junit.Test;
...
@@ -31,7 +31,7 @@ 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.Autowired
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContext
;
...
@@ -56,7 +56,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -56,7 +56,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleTomcatTwoConnectorsApplicationTests
{
public
class
SampleTomcatTwoConnectorsApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
String
port
;
private
String
port
;
@Autowired
@Autowired
...
...
spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/ssl/SampleTomcatSslApplicationTests.java
View file @
fca6dbaf
...
@@ -23,9 +23,8 @@ import org.apache.http.impl.client.HttpClients;
...
@@ -23,9 +23,8 @@ import org.apache.http.impl.client.HttpClients;
import
org.apache.http.ssl.SSLContextBuilder
;
import
org.apache.http.ssl.SSLContextBuilder
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
sample.tomcat.ssl.SampleTomcatSslApplication
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -43,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -43,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleTomcatSslApplicationTests
{
public
class
SampleTomcatSslApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java
View file @
fca6dbaf
...
@@ -22,7 +22,6 @@ import sample.tomcat.NonAutoConfigurationSampleTomcatApplicationTests.NonAutoCon
...
@@ -22,7 +22,6 @@ import sample.tomcat.NonAutoConfigurationSampleTomcatApplicationTests.NonAutoCon
import
sample.tomcat.service.HelloWorldService
;
import
sample.tomcat.service.HelloWorldService
;
import
sample.tomcat.web.SampleController
;
import
sample.tomcat.web.SampleController
;
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.web.DispatcherServletAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration
;
...
@@ -30,6 +29,7 @@ import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoCo
...
@@ -30,6 +29,7 @@ import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoCo
import
org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -54,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -54,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
NonAutoConfigurationSampleTomcatApplicationTests
{
public
class
NonAutoConfigurationSampleTomcatApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Configuration
@Configuration
...
...
spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java
View file @
fca6dbaf
...
@@ -23,7 +23,7 @@ import java.util.zip.GZIPInputStream;
...
@@ -23,7 +23,7 @@ import java.util.zip.GZIPInputStream;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleTomcatApplicationTests
{
public
class
SampleTomcatApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/tomcat7/jsp/SampleWebJspApplicationTests.java
View file @
fca6dbaf
...
@@ -19,7 +19,7 @@ package sample.tomcat7.jsp;
...
@@ -19,7 +19,7 @@ package sample.tomcat7.jsp;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleWebJspApplicationTests
{
public
class
SampleWebJspApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-traditional/src/test/java/sample/traditional/SampleTraditionalApplicationTests.java
View file @
fca6dbaf
...
@@ -19,7 +19,7 @@ package sample.traditional;
...
@@ -19,7 +19,7 @@ package sample.traditional;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleTraditionalApplicationTests
{
public
class
SampleTraditionalApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/ssl/SampleUndertowSslApplicationTests.java
View file @
fca6dbaf
...
@@ -24,7 +24,7 @@ import org.apache.http.ssl.SSLContextBuilder;
...
@@ -24,7 +24,7 @@ import org.apache.http.ssl.SSLContextBuilder;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleUndertowSslApplicationTests
{
public
class
SampleUndertowSslApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-undertow/src/test/java/sample/undertow/SampleUndertowApplicationTests.java
View file @
fca6dbaf
...
@@ -23,7 +23,7 @@ import java.util.zip.GZIPInputStream;
...
@@ -23,7 +23,7 @@ import java.util.zip.GZIPInputStream;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleUndertowApplicationTests
{
public
class
SampleUndertowApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-web-freemarker/src/test/java/sample/freemarker/SampleWebFreeMarkerApplicationTests.java
View file @
fca6dbaf
...
@@ -21,7 +21,7 @@ import java.util.Arrays;
...
@@ -21,7 +21,7 @@ import java.util.Arrays;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleWebFreeMarkerApplicationTests
{
public
class
SampleWebFreeMarkerApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java
View file @
fca6dbaf
...
@@ -21,7 +21,7 @@ import java.net.URI;
...
@@ -21,7 +21,7 @@ import java.net.URI;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleGroovyTemplateApplicationTests
{
public
class
SampleGroovyTemplateApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-web-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java
View file @
fca6dbaf
...
@@ -19,7 +19,7 @@ package sample.jsp;
...
@@ -19,7 +19,7 @@ package sample.jsp;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleWebJspApplicationTests
{
public
class
SampleWebJspApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java
View file @
fca6dbaf
...
@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
...
@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleMethodSecurityApplicationTests
{
public
class
SampleMethodSecurityApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-web-mustache/src/test/java/sample/mustache/SampleWebMustacheApplicationTests.java
View file @
fca6dbaf
...
@@ -21,7 +21,7 @@ import java.util.Arrays;
...
@@ -21,7 +21,7 @@ import java.util.Arrays;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleWebMustacheApplicationTests
{
public
class
SampleWebMustacheApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/web/secure/custom/SampleWebSecureCustomApplicationTests.java
View file @
fca6dbaf
...
@@ -22,9 +22,8 @@ import java.util.regex.Pattern;
...
@@ -22,9 +22,8 @@ import java.util.regex.Pattern;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
sample.web.secure.custom.SampleWebSecureCustomApplication
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -52,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -52,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleWebSecureCustomApplicationTests
{
public
class
SampleWebSecureCustomApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-web-secure-github/src/test/java/sample/web/secure/github/SampleGithubApplicationTests.java
View file @
fca6dbaf
...
@@ -21,7 +21,7 @@ import java.net.URI;
...
@@ -21,7 +21,7 @@ import java.net.URI;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleGithubApplicationTests
{
public
class
SampleGithubApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureCustomApplicationTests.java
View file @
fca6dbaf
...
@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
...
@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleWebSecureCustomApplicationTests
{
public
class
SampleWebSecureCustomApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java
View file @
fca6dbaf
...
@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
...
@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleSecureApplicationTests
{
public
class
SampleSecureApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-web-static/src/test/java/sample/web/staticcontent/SampleWebStaticApplicationTests.java
View file @
fca6dbaf
...
@@ -18,9 +18,8 @@ package sample.web.staticcontent;
...
@@ -18,9 +18,8 @@ package sample.web.staticcontent;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
sample.web.staticcontent.SampleWebStaticApplication
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -43,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -43,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleWebStaticApplicationTests
{
public
class
SampleWebStaticApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
=
0
;
private
int
port
=
0
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/SampleWebUiApplicationTests.java
View file @
fca6dbaf
...
@@ -20,9 +20,8 @@ import java.net.URI;
...
@@ -20,9 +20,8 @@ import java.net.URI;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
sample.web.ui.SampleWebUiApplication
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -46,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -46,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleWebUiApplicationTests
{
public
class
SampleWebUiApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-web-velocity/src/test/java/sample/web/velocity/SampleWebVelocityApplicationTests.java
View file @
fca6dbaf
...
@@ -21,7 +21,7 @@ import java.util.Arrays;
...
@@ -21,7 +21,7 @@ import java.util.Arrays;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@DirtiesContext
public
class
SampleWebVelocityApplicationTests
{
public
class
SampleWebVelocityApplicationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
private
int
port
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java
View file @
fca6dbaf
...
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.ConfigurableApplicationContext
;
...
@@ -52,7 +53,7 @@ public class SampleWebSocketsApplicationTests {
...
@@ -52,7 +53,7 @@ public class SampleWebSocketsApplicationTests {
private
static
Log
logger
=
LogFactory
.
getLog
(
SampleWebSocketsApplicationTests
.
class
);
private
static
Log
logger
=
LogFactory
.
getLog
(
SampleWebSocketsApplicationTests
.
class
);
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
=
1234
;
private
int
port
=
1234
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/SampleWebSocketsApplicationTests.java
View file @
fca6dbaf
...
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.ConfigurableApplicationContext
;
...
@@ -52,7 +53,7 @@ public class SampleWebSocketsApplicationTests {
...
@@ -52,7 +53,7 @@ public class SampleWebSocketsApplicationTests {
private
static
Log
logger
=
LogFactory
.
getLog
(
SampleWebSocketsApplicationTests
.
class
);
private
static
Log
logger
=
LogFactory
.
getLog
(
SampleWebSocketsApplicationTests
.
class
);
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
=
1234
;
private
int
port
=
1234
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/SampleWebSocketsApplicationTests.java
View file @
fca6dbaf
...
@@ -33,6 +33,7 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -33,6 +33,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.ConfigurableApplicationContext
;
...
@@ -53,7 +54,7 @@ public class SampleWebSocketsApplicationTests {
...
@@ -53,7 +54,7 @@ public class SampleWebSocketsApplicationTests {
private
static
Log
logger
=
LogFactory
.
getLog
(
SampleWebSocketsApplicationTests
.
class
);
private
static
Log
logger
=
LogFactory
.
getLog
(
SampleWebSocketsApplicationTests
.
class
);
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
=
1234
;
private
int
port
=
1234
;
@Test
@Test
...
...
spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java
View file @
fca6dbaf
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
package
sample
.
ws
;
package
sample
.
ws
;
import
java.io.StringReader
;
import
java.io.StringReader
;
...
@@ -25,7 +26,7 @@ import org.junit.Rule;
...
@@ -25,7 +26,7 @@ import org.junit.Rule;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.b
eans.factory.annotation.Value
;
import
org.springframework.b
oot.context.web.LocalServerPort
;
import
org.springframework.boot.test.OutputCapture
;
import
org.springframework.boot.test.OutputCapture
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.WebIntegrationTest
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
@@ -44,7 +45,7 @@ public class SampleWsApplicationTests {
...
@@ -44,7 +45,7 @@ public class SampleWsApplicationTests {
private
WebServiceTemplate
webServiceTemplate
=
new
WebServiceTemplate
();
private
WebServiceTemplate
webServiceTemplate
=
new
WebServiceTemplate
();
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
serverPort
;
private
int
serverPort
;
@Before
@Before
...
...
spring-boot-test/src/main/java/org/springframework/boot/test/WebIntegrationTest.java
View file @
fca6dbaf
...
@@ -23,6 +23,7 @@ import java.lang.annotation.Retention;
...
@@ -23,6 +23,7 @@ import java.lang.annotation.Retention;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
import
java.lang.annotation.Target
;
import
org.springframework.boot.context.web.LocalServerPort
;
import
org.springframework.core.env.Environment
;
import
org.springframework.core.env.Environment
;
import
org.springframework.test.context.BootstrapWith
;
import
org.springframework.test.context.BootstrapWith
;
...
@@ -56,8 +57,8 @@ public @interface WebIntegrationTest {
...
@@ -56,8 +57,8 @@ public @interface WebIntegrationTest {
/**
/**
* Convenience attribute that can be used to set a {@code server.port=0}
* Convenience attribute that can be used to set a {@code server.port=0}
* {@link Environment} property which usually triggers listening on a random port.
* {@link Environment} property which usually triggers listening on a random port.
* Often used in conjunction with a
<code>@Value("${local.server.port}")</code>
* Often used in conjunction with a
{@link LocalServerPort} injected field on the
*
injected field on the
test.
* test.
* @return if a random port should be used
* @return if a random port should be used
*/
*/
boolean
randomPort
()
default
false
;
boolean
randomPort
()
default
false
;
...
...
spring-boot-test/src/test/java/org/springframework/boot/test/SpringApplicationIntegrationTestTests.java
View file @
fca6dbaf
...
@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -25,6 +25,7 @@ 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.context.embedded.EmbeddedServletContainerFactory
;
import
org.springframework.boot.context.embedded.EmbeddedServletContainerFactory
;
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.SpringApplicationIntegrationTestTests.Config
;
import
org.springframework.boot.test.SpringApplicationIntegrationTestTests.Config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -54,7 +55,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -54,7 +55,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@IntegrationTest
({
"server.port=0"
,
"value=123"
})
@IntegrationTest
({
"server.port=0"
,
"value=123"
})
public
class
SpringApplicationIntegrationTestTests
{
public
class
SpringApplicationIntegrationTestTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
=
0
;
private
int
port
=
0
;
@Value
(
"${value}"
)
@Value
(
"${value}"
)
...
...
spring-boot-test/src/test/java/org/springframework/boot/test/SpringApplicationWebIntegrationTestTests.java
View file @
fca6dbaf
...
@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -25,6 +25,7 @@ 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.context.embedded.EmbeddedServletContainerFactory
;
import
org.springframework.boot.context.embedded.EmbeddedServletContainerFactory
;
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.SpringApplicationWebIntegrationTestTests.Config
;
import
org.springframework.boot.test.SpringApplicationWebIntegrationTestTests.Config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -52,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -52,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@WebIntegrationTest
({
"server.port=0"
,
"value=123"
})
@WebIntegrationTest
({
"server.port=0"
,
"value=123"
})
public
class
SpringApplicationWebIntegrationTestTests
{
public
class
SpringApplicationWebIntegrationTestTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
=
0
;
private
int
port
=
0
;
@Value
(
"${value}"
)
@Value
(
"${value}"
)
...
...
spring-boot/src/main/java/org/springframework/boot/context/web/LocalServerPort.java
0 → 100644
View file @
fca6dbaf
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
context
.
web
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
import
org.springframework.beans.factory.annotation.Value
;
/**
* Annotation at the field or method/constructor parameter level
* that injects the HTTP port that got allocated at runtime.
* <p>
* Convenient meta-annotation replacing {@code @LocalServerPort}.
*
* @author Anand Shah
* @author Stephane Nicoll
* @since 1.4.0
*/
@Value
(
"${local.server.port}"
)
@Target
({
ElementType
.
FIELD
,
ElementType
.
METHOD
,
ElementType
.
PARAMETER
,
ElementType
.
ANNOTATION_TYPE
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
LocalServerPort
{
}
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