Merge pull request #10548 from isopov:samples-cleanup
* pr/10548: Polish "Samples cleanup" Samples cleanup
This commit is contained in:
		
						commit
						1370e9dbaf
					
				|  | @ -1,3 +1,19 @@ | |||
| /* | ||||
|  * Copyright 2012-2017 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 sample.actuator.customsecurity; | ||||
| 
 | ||||
| import java.net.URI; | ||||
|  | @ -16,7 +32,6 @@ import org.springframework.http.HttpStatus; | |||
| import org.springframework.http.RequestEntity; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.ActiveProfiles; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.web.client.RestTemplate; | ||||
|  | @ -30,7 +45,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| @ActiveProfiles("cors") | ||||
| public class CorsSampleActuatorApplicationTests { | ||||
| 
 | ||||
|  |  | |||
|  | @ -26,7 +26,6 @@ import org.springframework.boot.test.web.client.TestRestTemplate; | |||
| import org.springframework.boot.web.server.LocalServerPort; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -40,7 +39,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { | ||||
| 		"management.server.port=0", "management.server.context-path=/management" }) | ||||
| @DirtiesContext | ||||
| public class InsecureManagementPortAndPathSampleActuatorApplicationTests { | ||||
| 
 | ||||
| 	@LocalServerPort | ||||
|  |  | |||
|  | @ -1,3 +1,19 @@ | |||
| /* | ||||
|  * Copyright 2012-2017 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 sample.actuator.customsecurity; | ||||
| 
 | ||||
| import java.util.Map; | ||||
|  | @ -10,7 +26,6 @@ import org.springframework.boot.test.context.SpringBootTest; | |||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -20,7 +35,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleActuatorCustomSecurityApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -28,7 +28,6 @@ import org.springframework.boot.test.web.client.TestRestTemplate; | |||
| import org.springframework.boot.web.server.LocalServerPort; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -41,7 +40,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { | ||||
| 		"management.server.port:0" }) | ||||
| @DirtiesContext | ||||
| public class SampleActuatorUiApplicationPortTests { | ||||
| 
 | ||||
| 	@LocalServerPort | ||||
|  |  | |||
|  | @ -32,7 +32,6 @@ import org.springframework.http.HttpMethod; | |||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.MediaType; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -44,7 +43,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleActuatorUiApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -27,7 +27,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | |||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.ActiveProfiles; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
|  | @ -40,7 +39,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| @ActiveProfiles("endpoints") | ||||
| public class EndpointsPropertiesSampleActuatorApplicationTests { | ||||
| 
 | ||||
|  |  | |||
|  | @ -28,7 +28,6 @@ import org.springframework.boot.test.web.client.TestRestTemplate; | |||
| import org.springframework.boot.web.server.LocalServerPort; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -42,7 +41,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { | ||||
| 		"management.server.port=0", "management.server.address=127.0.0.1", | ||||
| 		"management.server.context-path:/admin" }) | ||||
| @DirtiesContext | ||||
| public class ManagementAddressActuatorApplicationTests { | ||||
| 
 | ||||
| 	@LocalServerPort | ||||
|  |  | |||
|  | @ -27,7 +27,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | |||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -40,7 +39,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { | ||||
| 		"management.endpoints.web.base-path=/admin" }) | ||||
| @DirtiesContext | ||||
| public class ManagementPathSampleActuatorApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -28,7 +28,6 @@ import org.springframework.boot.test.web.client.TestRestTemplate; | |||
| import org.springframework.boot.web.server.LocalServerPort; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -41,7 +40,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { | ||||
| 		"management.server.port=0", "management.endpoints.web.base-path=/admin" }) | ||||
| @DirtiesContext | ||||
| public class ManagementPortAndPathSampleActuatorApplicationTests { | ||||
| 
 | ||||
| 	@LocalServerPort | ||||
|  |  | |||
|  | @ -28,7 +28,6 @@ import org.springframework.boot.test.web.client.TestRestTemplate; | |||
| import org.springframework.boot.web.server.LocalServerPort; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -41,7 +40,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { | ||||
| 		"management.server.port=0" }) | ||||
| @DirtiesContext | ||||
| public class ManagementPortSampleActuatorApplicationTests { | ||||
| 
 | ||||
| 	@LocalServerPort | ||||
|  |  | |||
|  | @ -27,7 +27,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | |||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -40,7 +39,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { | ||||
| 		"management.server.port=-1" }) | ||||
| @DirtiesContext | ||||
| public class NoManagementSampleActuatorApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -34,7 +34,6 @@ import org.springframework.http.HttpMethod; | |||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.MediaType; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -47,7 +46,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleActuatorApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -27,7 +27,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | |||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -40,7 +39,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { | ||||
| 		"server.servlet.path=/spring" }) | ||||
| @DirtiesContext | ||||
| public class ServletPathSampleActuatorApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -27,7 +27,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | |||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -39,7 +38,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class ShutdownSampleActuatorApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -35,7 +35,6 @@ import org.springframework.boot.web.server.LocalServerPort; | |||
| import org.springframework.context.ConfigurableApplicationContext; | ||||
| import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.context.annotation.Configuration; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.web.socket.TextMessage; | ||||
| import org.springframework.web.socket.WebSocketSession; | ||||
|  | @ -47,7 +46,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| 
 | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(classes = SampleAtmosphereApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleAtmosphereApplicationTests { | ||||
| 
 | ||||
| 	private static Log logger = LogFactory.getLog(SampleAtmosphereApplicationTests.class); | ||||
|  |  | |||
|  | @ -25,7 +25,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | |||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -38,7 +37,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleDevToolsApplicationIntegrationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -28,16 +28,6 @@ | |||
| 				</exclusion> | ||||
| 			</exclusions> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
| 			<artifactId>spring-boot-starter-validation</artifactId> | ||||
| 			<exclusions> | ||||
| 				<exclusion> | ||||
| 					<groupId>org.apache.tomcat.embed</groupId> | ||||
| 					<artifactId>tomcat-embed-el</artifactId> | ||||
| 				</exclusion> | ||||
| 			</exclusions> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>javax.servlet</groupId> | ||||
| 			<artifactId>jstl</artifactId> | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| /* | ||||
|  * Copyright 2012-2016 the original author or authors. | ||||
|  * Copyright 2012-2017 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. | ||||
|  | @ -25,7 +25,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | |||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -37,7 +36,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleWebJspApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -18,16 +18,18 @@ | |||
| 		<!-- Compile --> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
| 			<artifactId>spring-boot-starter</artifactId> | ||||
| 			<artifactId>spring-boot-starter-web</artifactId> | ||||
| 			<exclusions> | ||||
| 				<exclusion> | ||||
| 					<groupId>org.springframework.boot</groupId> | ||||
| 					<artifactId>spring-boot-starter-tomcat</artifactId> | ||||
| 				</exclusion> | ||||
| 			</exclusions> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
| 			<artifactId>spring-boot-starter-jetty</artifactId> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework</groupId> | ||||
| 			<artifactId>spring-webmvc</artifactId> | ||||
| 		</dependency> | ||||
| 		<!-- Test --> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
|  |  | |||
|  | @ -1,32 +0,0 @@ | |||
| /* | ||||
|  * Copyright 2012-2015 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 sample.jetty.ssl.service; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Value; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| @Component | ||||
| public class HelloWorldService { | ||||
| 
 | ||||
| 	@Value("${name:World}") | ||||
| 	private String name; | ||||
| 
 | ||||
| 	public String getHelloMessage() { | ||||
| 		return "Hello " + this.name; | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
|  | @ -1,5 +1,5 @@ | |||
| /* | ||||
|  * Copyright 2012-2016 the original author or authors. | ||||
|  * Copyright 2012-2017 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. | ||||
|  | @ -16,23 +16,15 @@ | |||
| 
 | ||||
| package sample.jetty.ssl.web; | ||||
| 
 | ||||
| import sample.jetty.ssl.service.HelloWorldService; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Controller; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.ResponseBody; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| 
 | ||||
| @Controller | ||||
| @RestController | ||||
| public class SampleController { | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private HelloWorldService helloWorldService; | ||||
| 
 | ||||
| 	@GetMapping("/") | ||||
| 	@ResponseBody | ||||
| 	public String helloWorld() { | ||||
| 		return this.helloWorldService.getHelloMessage(); | ||||
| 		return "Hello World"; | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -19,14 +19,13 @@ package sample.jetty.ssl; | |||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.boot.test.context.SpringBootTest; | ||||
| import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | ||||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.boot.test.web.client.TestRestTemplate.HttpClientOption; | ||||
| import org.springframework.boot.web.server.LocalServerPort; | ||||
| import org.springframework.boot.web.server.AbstractConfigurableWebServerFactory; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -38,19 +37,22 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleJettySslApplicationTests { | ||||
| 
 | ||||
| 	@LocalServerPort | ||||
| 	private int port; | ||||
| 	@Autowired | ||||
| 	private TestRestTemplate restTemplate; | ||||
| 	@Autowired | ||||
| 	private AbstractConfigurableWebServerFactory webServerFactory; | ||||
| 
 | ||||
| 	@Test | ||||
| 	public void testSsl() { | ||||
| 		assertThat(this.webServerFactory.getSsl().isEnabled()).isTrue(); | ||||
| 	} | ||||
| 
 | ||||
| 	@Test | ||||
| 	public void testHome() throws Exception { | ||||
| 		TestRestTemplate testRestTemplate = new TestRestTemplate(HttpClientOption.SSL); | ||||
| 		ResponseEntity<String> entity = testRestTemplate | ||||
| 				.getForEntity("https://localhost:" + this.port, String.class); | ||||
| 		ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class); | ||||
| 		assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); | ||||
| 		assertThat(entity.getBody()).isEqualTo("Hello World"); | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -18,16 +18,18 @@ | |||
| 		<!-- Compile --> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
| 			<artifactId>spring-boot-starter</artifactId> | ||||
| 			<artifactId>spring-boot-starter-web</artifactId> | ||||
| 			<exclusions> | ||||
| 				<exclusion> | ||||
| 					<groupId>org.springframework.boot</groupId> | ||||
| 					<artifactId>spring-boot-starter-tomcat</artifactId> | ||||
| 				</exclusion> | ||||
| 			</exclusions> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
| 			<artifactId>spring-boot-starter-jetty</artifactId> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework</groupId> | ||||
| 			<artifactId>spring-webmvc</artifactId> | ||||
| 		</dependency> | ||||
| 		<!-- Test --> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
|  |  | |||
|  | @ -32,7 +32,6 @@ import org.springframework.http.HttpHeaders; | |||
| import org.springframework.http.HttpMethod; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.util.StreamUtils; | ||||
| 
 | ||||
|  | @ -46,7 +45,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleJettyApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -27,7 +27,6 @@ import org.springframework.boot.test.web.client.TestRestTemplate; | |||
| import org.springframework.boot.web.server.LocalServerPort; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -35,7 +34,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = { | ||||
| 		"APP-CLIENT-ID=my-client-id", "APP-CLIENT-SECRET=my-client-secret" }) | ||||
| @DirtiesContext | ||||
| public class SampleOAuth2ClientApplicationTests { | ||||
| 
 | ||||
| 	@LocalServerPort | ||||
|  |  | |||
|  | @ -25,7 +25,6 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.boot.test.context.SpringBootTest; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.MediaType; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.test.web.reactive.server.WebTestClient; | ||||
| 
 | ||||
|  | @ -36,7 +35,6 @@ import org.springframework.test.web.reactive.server.WebTestClient; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleSecureWebFluxApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -31,7 +31,6 @@ import org.springframework.http.HttpMethod; | |||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.MediaType; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -43,7 +42,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleServletApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| /* | ||||
|  * Copyright 2012-2016 the original author or authors. | ||||
|  * Copyright 2012-2017 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. | ||||
|  | @ -24,7 +24,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | |||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -35,7 +34,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  * @author Phillip Webb | ||||
|  */ | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleTestNGApplicationTests extends AbstractTestNGSpringContextTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -27,11 +27,6 @@ | |||
| 			<artifactId>jstl</artifactId> | ||||
| 		</dependency> | ||||
| 		<!-- Provided --> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
| 			<artifactId>spring-boot-starter-tomcat</artifactId> | ||||
| 			<scope>provided</scope> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.apache.tomcat.embed</groupId> | ||||
| 			<artifactId>tomcat-embed-jasper</artifactId> | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| /* | ||||
|  * Copyright 2012-2016 the original author or authors. | ||||
|  * Copyright 2012-2017 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. | ||||
|  | @ -25,7 +25,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | |||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -37,7 +36,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleWebJspApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -18,15 +18,7 @@ | |||
| 		<!-- Compile --> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
| 			<artifactId>spring-boot-starter-tomcat</artifactId> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
| 			<artifactId>spring-boot-starter</artifactId> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework</groupId> | ||||
| 			<artifactId>spring-webmvc</artifactId> | ||||
| 			<artifactId>spring-boot-starter-web</artifactId> | ||||
| 		</dependency> | ||||
| 		<!-- Test --> | ||||
| 		<dependency> | ||||
|  | @ -34,6 +26,11 @@ | |||
| 			<artifactId>spring-boot-starter-test</artifactId> | ||||
| 			<scope>test</scope> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.apache.httpcomponents</groupId> | ||||
| 			<artifactId>httpclient</artifactId> | ||||
| 			<scope>test</scope> | ||||
| 		</dependency> | ||||
| 	</dependencies> | ||||
| 	<build> | ||||
| 		<plugins> | ||||
|  |  | |||
|  | @ -16,18 +16,8 @@ | |||
| 
 | ||||
| package sample.tomcat.multiconnector; | ||||
| 
 | ||||
| import java.io.IOException; | ||||
| import java.net.HttpURLConnection; | ||||
| 
 | ||||
| import javax.net.ssl.HostnameVerifier; | ||||
| import javax.net.ssl.HttpsURLConnection; | ||||
| import javax.net.ssl.SSLContext; | ||||
| import javax.net.ssl.TrustManager; | ||||
| import javax.net.ssl.X509TrustManager; | ||||
| 
 | ||||
| import org.apache.catalina.Service; | ||||
| import org.apache.catalina.connector.Connector; | ||||
| import org.junit.BeforeClass; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import sample.tomcat.multiconnector.SampleTomcatTwoConnectorsApplicationTests.Ports; | ||||
|  | @ -36,18 +26,16 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.boot.test.context.SpringBootTest; | ||||
| import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | ||||
| import org.springframework.boot.test.context.TestConfiguration; | ||||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.boot.web.context.WebServerInitializedEvent; | ||||
| import org.springframework.boot.web.embedded.tomcat.TomcatWebServer; | ||||
| import org.springframework.boot.web.server.AbstractConfigurableWebServerFactory; | ||||
| import org.springframework.boot.web.server.LocalServerPort; | ||||
| import org.springframework.context.ApplicationContext; | ||||
| import org.springframework.context.ApplicationListener; | ||||
| import org.springframework.context.annotation.Import; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.http.client.SimpleClientHttpRequestFactory; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.web.client.RestTemplate; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
| 
 | ||||
|  | @ -59,88 +47,37 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| @Import(Ports.class) | ||||
| public class SampleTomcatTwoConnectorsApplicationTests { | ||||
| 
 | ||||
| 	@LocalServerPort | ||||
| 	private int port; | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private ApplicationContext context; | ||||
| 
 | ||||
| 	@BeforeClass | ||||
| 	public static void setUp() { | ||||
| 
 | ||||
| 		try { | ||||
| 			// setup ssl context to ignore certificate errors | ||||
| 			SSLContext ctx = SSLContext.getInstance("TLS"); | ||||
| 			X509TrustManager tm = new X509TrustManager() { | ||||
| 
 | ||||
| 				@Override | ||||
| 				public void checkClientTrusted(java.security.cert.X509Certificate[] chain, | ||||
| 						String authType) throws java.security.cert.CertificateException { | ||||
| 				} | ||||
| 
 | ||||
| 				@Override | ||||
| 				public void checkServerTrusted(java.security.cert.X509Certificate[] chain, | ||||
| 						String authType) throws java.security.cert.CertificateException { | ||||
| 				} | ||||
| 
 | ||||
| 				@Override | ||||
| 				public java.security.cert.X509Certificate[] getAcceptedIssuers() { | ||||
| 					return null; | ||||
| 				} | ||||
| 			}; | ||||
| 			ctx.init(null, new TrustManager[] { tm }, null); | ||||
| 			SSLContext.setDefault(ctx); | ||||
| 		} | ||||
| 		catch (Exception ex) { | ||||
| 			ex.printStackTrace(); | ||||
| 		} | ||||
| 	private Ports ports; | ||||
| 	@Autowired | ||||
| 	private TestRestTemplate restTemplate; | ||||
| 	@Autowired | ||||
| 	private AbstractConfigurableWebServerFactory webServerFactory; | ||||
| 
 | ||||
| 	@Test | ||||
| 	public void testSsl() { | ||||
| 		assertThat(this.webServerFactory.getSsl().isEnabled()).isTrue(); | ||||
| 	} | ||||
| 
 | ||||
| 	@Test | ||||
| 	public void testHello() throws Exception { | ||||
| 		RestTemplate template = new RestTemplate(); | ||||
| 		final MySimpleClientHttpRequestFactory factory = new MySimpleClientHttpRequestFactory( | ||||
| 				(hostname, session) -> true); | ||||
| 		template.setRequestFactory(factory); | ||||
| 		Ports ports = this.context.getBean(Ports.class); | ||||
| 		assertThat(ports.getHttpsPort()).isEqualTo(this.port); | ||||
| 		assertThat(ports.getHttpPort()).isNotEqualTo(this.port); | ||||
| 		ResponseEntity<String> entity = template.getForEntity( | ||||
| 				"http://localhost:" + ports.getHttpPort() + "/hello", String.class); | ||||
| 		assertThat(this.ports.getHttpsPort()).isEqualTo(this.port); | ||||
| 		assertThat(this.ports.getHttpPort()).isNotEqualTo(this.port); | ||||
| 		ResponseEntity<String> entity = this.restTemplate.getForEntity( | ||||
| 				"http://localhost:" + this.ports.getHttpPort() + "/hello", String.class); | ||||
| 		assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); | ||||
| 		assertThat(entity.getBody()).isEqualTo("hello"); | ||||
| 		ResponseEntity<String> httpsEntity = template | ||||
| 		ResponseEntity<String> httpsEntity = this.restTemplate | ||||
| 				.getForEntity("https://localhost:" + this.port + "/hello", String.class); | ||||
| 		assertThat(httpsEntity.getStatusCode()).isEqualTo(HttpStatus.OK); | ||||
| 		assertThat(httpsEntity.getBody()).isEqualTo("hello"); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Http Request Factory for ignoring SSL hostname errors. Not for production use! | ||||
| 	 */ | ||||
| 	class MySimpleClientHttpRequestFactory extends SimpleClientHttpRequestFactory { | ||||
| 
 | ||||
| 		private final HostnameVerifier verifier; | ||||
| 
 | ||||
| 		public MySimpleClientHttpRequestFactory(final HostnameVerifier verifier) { | ||||
| 			this.verifier = verifier; | ||||
| 		} | ||||
| 
 | ||||
| 		@Override | ||||
| 		protected void prepareConnection(final HttpURLConnection connection, | ||||
| 				final String httpMethod) throws IOException { | ||||
| 			if (connection instanceof HttpsURLConnection) { | ||||
| 				((HttpsURLConnection) connection).setHostnameVerifier(this.verifier); | ||||
| 			} | ||||
| 			super.prepareConnection(connection, httpMethod); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	@TestConfiguration | ||||
| 	static class Ports implements ApplicationListener<WebServerInitializedEvent> { | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,19 +18,7 @@ | |||
| 		<!-- Compile --> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
| 			<artifactId>spring-boot-starter</artifactId> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
| 			<artifactId>spring-boot-starter-tomcat</artifactId> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework</groupId> | ||||
| 			<artifactId>spring-webmvc</artifactId> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.apache.httpcomponents</groupId> | ||||
| 			<artifactId>httpclient</artifactId> | ||||
| 			<artifactId>spring-boot-starter-web</artifactId> | ||||
| 		</dependency> | ||||
| 		<!-- Test --> | ||||
| 		<dependency> | ||||
|  | @ -39,8 +27,9 @@ | |||
| 			<scope>test</scope> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.yaml</groupId> | ||||
| 			<artifactId>snakeyaml</artifactId> | ||||
| 			<groupId>org.apache.httpcomponents</groupId> | ||||
| 			<artifactId>httpclient</artifactId> | ||||
| 			<scope>test</scope> | ||||
| 		</dependency> | ||||
| 	</dependencies> | ||||
| 	<build> | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| /* | ||||
|  * Copyright 2012-2016 the original author or authors. | ||||
|  * Copyright 2012-2017 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. | ||||
|  | @ -16,15 +16,13 @@ | |||
| 
 | ||||
| package sample.tomcat.ssl.web; | ||||
| 
 | ||||
| import org.springframework.stereotype.Controller; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.ResponseBody; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| 
 | ||||
| @Controller | ||||
| @RestController | ||||
| public class SampleController { | ||||
| 
 | ||||
| 	@GetMapping("/") | ||||
| 	@ResponseBody | ||||
| 	public String helloWorld() { | ||||
| 		return "Hello, world"; | ||||
| 	} | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| /* | ||||
|  * Copyright 2012-2016 the original author or authors. | ||||
|  * Copyright 2012-2017 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. | ||||
|  | @ -23,21 +23,28 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.boot.test.context.SpringBootTest; | ||||
| import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | ||||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.boot.web.server.AbstractConfigurableWebServerFactory; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
| 
 | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleTomcatSslApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private TestRestTemplate restTemplate; | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private AbstractConfigurableWebServerFactory webServerFactory; | ||||
| 
 | ||||
| 	@Test | ||||
| 	public void testSsl() { | ||||
| 		assertThat(this.webServerFactory.getSsl().isEnabled()).isTrue(); | ||||
| 	} | ||||
| 
 | ||||
| 	@Test | ||||
| 	public void testHome() throws Exception { | ||||
| 		ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class); | ||||
|  |  | |||
|  | @ -36,7 +36,6 @@ import org.springframework.context.annotation.Configuration; | |||
| import org.springframework.context.annotation.Import; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -48,7 +47,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class NonAutoConfigurationSampleTomcatApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -37,7 +37,6 @@ import org.springframework.http.HttpHeaders; | |||
| import org.springframework.http.HttpMethod; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.util.StreamUtils; | ||||
| 
 | ||||
|  | @ -51,7 +50,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleTomcatApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| /* | ||||
|  * Copyright 2012-2016 the original author or authors. | ||||
|  * Copyright 2012-2017 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. | ||||
|  | @ -25,7 +25,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | |||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -37,7 +36,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleTraditionalApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -15,19 +15,20 @@ | |||
| 		<main.basedir>${basedir}/../..</main.basedir> | ||||
| 	</properties> | ||||
| 	<dependencies> | ||||
| 		<!-- Compile --> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
| 			<artifactId>spring-boot-starter</artifactId> | ||||
| 			<artifactId>spring-boot-starter-web</artifactId> | ||||
| 			<exclusions> | ||||
| 				<exclusion> | ||||
| 					<groupId>org.springframework.boot</groupId> | ||||
| 					<artifactId>spring-boot-starter-tomcat</artifactId> | ||||
| 				</exclusion> | ||||
| 			</exclusions> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
| 			<artifactId>spring-boot-starter-undertow</artifactId> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework</groupId> | ||||
| 			<artifactId>spring-webmvc</artifactId> | ||||
| 		</dependency> | ||||
| 		<!-- Test --> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
|  |  | |||
|  | @ -1,32 +0,0 @@ | |||
| /* | ||||
|  * Copyright 2012-2015 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 sample.undertow.ssl.service; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Value; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| @Component | ||||
| public class HelloWorldService { | ||||
| 
 | ||||
| 	@Value("${name:World}") | ||||
| 	private String name; | ||||
| 
 | ||||
| 	public String getHelloMessage() { | ||||
| 		return "Hello " + this.name; | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
|  | @ -1,5 +1,5 @@ | |||
| /* | ||||
|  * Copyright 2012-2016 the original author or authors. | ||||
|  * Copyright 2012-2017 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. | ||||
|  | @ -16,23 +16,15 @@ | |||
| 
 | ||||
| package sample.undertow.ssl.web; | ||||
| 
 | ||||
| import sample.undertow.ssl.service.HelloWorldService; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Controller; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.ResponseBody; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| 
 | ||||
| @Controller | ||||
| @RestController | ||||
| public class SampleController { | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private HelloWorldService helloWorldService; | ||||
| 
 | ||||
| 	@GetMapping("/") | ||||
| 	@ResponseBody | ||||
| 	public String helloWorld() { | ||||
| 		return this.helloWorldService.getHelloMessage(); | ||||
| 		return "Hello World"; | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| /* | ||||
|  * Copyright 2012-2016 the original author or authors. | ||||
|  * Copyright 2012-2017 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. | ||||
|  | @ -23,9 +23,9 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.boot.test.context.SpringBootTest; | ||||
| import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | ||||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.boot.web.server.AbstractConfigurableWebServerFactory; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -37,14 +37,21 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleUndertowSslApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private TestRestTemplate restTemplate; | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private AbstractConfigurableWebServerFactory webServerFactory; | ||||
| 
 | ||||
| 	@Test | ||||
| 	public void testHome() throws Exception { | ||||
| 	public void testSsl() { | ||||
| 		assertThat(this.webServerFactory.getSsl().isEnabled()).isTrue(); | ||||
| 	} | ||||
| 
 | ||||
| 	@Test | ||||
| 	public void testHome() { | ||||
| 		ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class); | ||||
| 		assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); | ||||
| 		assertThat(entity.getBody()).isEqualTo("Hello World"); | ||||
|  |  | |||
|  | @ -18,16 +18,18 @@ | |||
| 		<!-- Compile --> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
| 			<artifactId>spring-boot-starter</artifactId> | ||||
| 			<artifactId>spring-boot-starter-web</artifactId> | ||||
| 			<exclusions> | ||||
| 				<exclusion> | ||||
| 					<groupId>org.springframework.boot</groupId> | ||||
| 					<artifactId>spring-boot-starter-tomcat</artifactId> | ||||
| 				</exclusion> | ||||
| 			</exclusions> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
| 			<artifactId>spring-boot-starter-undertow</artifactId> | ||||
| 		</dependency> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework</groupId> | ||||
| 			<artifactId>spring-webmvc</artifactId> | ||||
| 		</dependency> | ||||
| 		<!-- Test --> | ||||
| 		<dependency> | ||||
| 			<groupId>org.springframework.boot</groupId> | ||||
|  |  | |||
|  | @ -1,32 +0,0 @@ | |||
| /* | ||||
|  * Copyright 2012-2014 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 sample.undertow.service; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Value; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| @Component | ||||
| public class HelloWorldService { | ||||
| 
 | ||||
| 	@Value("${name:World}") | ||||
| 	private String name; | ||||
| 
 | ||||
| 	public String getHelloMessage() { | ||||
| 		return "Hello " + this.name; | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
|  | @ -1,5 +1,5 @@ | |||
| /* | ||||
|  * Copyright 2012-2016 the original author or authors. | ||||
|  * Copyright 2012-2017 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. | ||||
|  | @ -18,21 +18,15 @@ package sample.undertow.web; | |||
| 
 | ||||
| import java.util.concurrent.Callable; | ||||
| 
 | ||||
| import sample.undertow.service.HelloWorldService; | ||||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| 
 | ||||
| @RestController | ||||
| public class SampleController { | ||||
| 
 | ||||
| 	@Autowired | ||||
| 	private HelloWorldService helloWorldService; | ||||
| 
 | ||||
| 	@GetMapping("/") | ||||
| 	public String helloWorld() { | ||||
| 		return this.helloWorldService.getHelloMessage(); | ||||
| 		return "Hello World"; | ||||
| 	} | ||||
| 
 | ||||
| 	@GetMapping("/async") | ||||
|  | @ -41,12 +35,9 @@ public class SampleController { | |||
| 
 | ||||
| 			@Override | ||||
| 			public String call() throws Exception { | ||||
| 				return "async: " | ||||
| 						+ SampleController.this.helloWorldService.getHelloMessage(); | ||||
| 				return "async: Hello World"; | ||||
| 			} | ||||
| 
 | ||||
| 		}; | ||||
| 
 | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -32,7 +32,6 @@ import org.springframework.http.HttpHeaders; | |||
| import org.springframework.http.HttpMethod; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.util.StreamUtils; | ||||
| 
 | ||||
|  | @ -46,7 +45,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleUndertowApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -31,7 +31,6 @@ import org.springframework.http.HttpMethod; | |||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.MediaType; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -44,7 +43,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleWebFreeMarkerApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| /* | ||||
|  * Copyright 2012-2016 the original author or authors. | ||||
|  * Copyright 2012-2017 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. | ||||
|  | @ -26,7 +26,6 @@ import org.junit.runner.RunWith; | |||
| 
 | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.boot.test.context.SpringBootTest; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.test.web.servlet.MockMvc; | ||||
| import org.springframework.test.web.servlet.setup.MockMvcBuilders; | ||||
|  | @ -47,7 +46,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest | ||||
| @DirtiesContext | ||||
| public class MessageControllerWebTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -28,7 +28,6 @@ import org.springframework.boot.test.web.client.TestRestTemplate; | |||
| import org.springframework.boot.web.server.LocalServerPort; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.util.LinkedMultiValueMap; | ||||
| import org.springframework.util.MultiValueMap; | ||||
|  | @ -42,7 +41,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleGroovyTemplateApplicationTests { | ||||
| 
 | ||||
| 	@LocalServerPort | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| /* | ||||
|  * Copyright 2012-2016 the original author or authors. | ||||
|  * Copyright 2012-2017 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. | ||||
|  | @ -25,7 +25,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | |||
| import org.springframework.boot.test.web.client.TestRestTemplate; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -37,7 +36,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleWebJspApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -35,7 +35,6 @@ import org.springframework.http.HttpStatus; | |||
| import org.springframework.http.MediaType; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.http.client.support.BasicAuthorizationInterceptor; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.util.LinkedMultiValueMap; | ||||
| import org.springframework.util.MultiValueMap; | ||||
|  | @ -49,7 +48,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleMethodSecurityApplicationTests { | ||||
| 
 | ||||
| 	@LocalServerPort | ||||
|  |  | |||
|  | @ -31,7 +31,6 @@ import org.springframework.http.HttpMethod; | |||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.MediaType; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -44,7 +43,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleWebMustacheApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -34,7 +34,6 @@ import org.springframework.http.HttpMethod; | |||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.MediaType; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.util.LinkedMultiValueMap; | ||||
| import org.springframework.util.MultiValueMap; | ||||
|  | @ -48,7 +47,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleWebSecureCustomApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -34,7 +34,6 @@ import org.springframework.http.HttpMethod; | |||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.MediaType; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.util.LinkedMultiValueMap; | ||||
| import org.springframework.util.MultiValueMap; | ||||
|  | @ -48,7 +47,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleWebSecureJdbcApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -34,7 +34,6 @@ import org.springframework.http.HttpMethod; | |||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.MediaType; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.util.LinkedMultiValueMap; | ||||
| import org.springframework.util.MultiValueMap; | ||||
|  | @ -48,7 +47,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleSecureApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| /* | ||||
|  * Copyright 2012-2016 the original author or authors. | ||||
|  * Copyright 2012-2017 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. | ||||
|  | @ -26,7 +26,6 @@ import org.springframework.boot.test.web.client.TestRestTemplate; | |||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.MediaType; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| 
 | ||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||
|  | @ -38,7 +37,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleWebStaticApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -28,7 +28,6 @@ import org.springframework.boot.test.web.client.TestRestTemplate; | |||
| import org.springframework.boot.web.server.LocalServerPort; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.util.LinkedMultiValueMap; | ||||
| import org.springframework.util.MultiValueMap; | ||||
|  | @ -42,7 +41,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
|  */ | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleWebUiApplicationTests { | ||||
| 
 | ||||
| 	@Autowired | ||||
|  |  | |||
|  | @ -38,7 +38,6 @@ import org.springframework.boot.web.server.LocalServerPort; | |||
| import org.springframework.context.ConfigurableApplicationContext; | ||||
| import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.context.annotation.Configuration; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.web.socket.client.WebSocketConnectionManager; | ||||
| import org.springframework.web.socket.client.standard.StandardWebSocketClient; | ||||
|  | @ -47,7 +46,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| 
 | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(classes = SampleJettyWebSocketsApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleWebSocketsApplicationTests { | ||||
| 
 | ||||
| 	private static Log logger = LogFactory.getLog(SampleWebSocketsApplicationTests.class); | ||||
|  |  | |||
|  | @ -42,7 +42,6 @@ import org.springframework.boot.web.servlet.server.ServletWebServerFactory; | |||
| import org.springframework.context.ConfigurableApplicationContext; | ||||
| import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.context.annotation.Configuration; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.web.socket.client.WebSocketConnectionManager; | ||||
| import org.springframework.web.socket.client.standard.StandardWebSocketClient; | ||||
|  | @ -52,7 +51,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(classes = { SampleJettyWebSocketsApplication.class, | ||||
| 		CustomContainerConfiguration.class }, webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class CustomContainerWebSocketsApplicationTests { | ||||
| 
 | ||||
| 	private static Log logger = LogFactory | ||||
|  |  | |||
|  | @ -38,7 +38,6 @@ import org.springframework.boot.web.server.LocalServerPort; | |||
| import org.springframework.context.ConfigurableApplicationContext; | ||||
| import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.context.annotation.Configuration; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.web.socket.client.WebSocketConnectionManager; | ||||
| import org.springframework.web.socket.client.standard.StandardWebSocketClient; | ||||
|  | @ -47,7 +46,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| 
 | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(classes = SampleTomcatWebSocketApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleWebSocketsApplicationTests { | ||||
| 
 | ||||
| 	private static Log logger = LogFactory.getLog(SampleWebSocketsApplicationTests.class); | ||||
|  |  | |||
|  | @ -42,7 +42,6 @@ import org.springframework.boot.web.servlet.server.ServletWebServerFactory; | |||
| import org.springframework.context.ConfigurableApplicationContext; | ||||
| import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.context.annotation.Configuration; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.web.socket.client.WebSocketConnectionManager; | ||||
| import org.springframework.web.socket.client.standard.StandardWebSocketClient; | ||||
|  | @ -52,7 +51,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(classes = { SampleTomcatWebSocketApplication.class, | ||||
| 		CustomContainerConfiguration.class }, webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class CustomContainerWebSocketsApplicationTests { | ||||
| 
 | ||||
| 	private static Log logger = LogFactory | ||||
|  |  | |||
|  | @ -38,7 +38,6 @@ import org.springframework.boot.web.server.LocalServerPort; | |||
| import org.springframework.context.ConfigurableApplicationContext; | ||||
| import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.context.annotation.Configuration; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.web.socket.client.WebSocketConnectionManager; | ||||
| import org.springframework.web.socket.client.standard.StandardWebSocketClient; | ||||
|  | @ -47,7 +46,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| 
 | ||||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(classes = SampleUndertowWebSocketsApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class SampleWebSocketsApplicationTests { | ||||
| 
 | ||||
| 	private static Log logger = LogFactory.getLog(SampleWebSocketsApplicationTests.class); | ||||
|  |  | |||
|  | @ -42,7 +42,6 @@ import org.springframework.boot.web.servlet.server.ServletWebServerFactory; | |||
| import org.springframework.context.ConfigurableApplicationContext; | ||||
| import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.context.annotation.Configuration; | ||||
| import org.springframework.test.annotation.DirtiesContext; | ||||
| import org.springframework.test.context.junit4.SpringRunner; | ||||
| import org.springframework.web.socket.client.WebSocketConnectionManager; | ||||
| import org.springframework.web.socket.client.standard.StandardWebSocketClient; | ||||
|  | @ -52,7 +51,6 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
| @RunWith(SpringRunner.class) | ||||
| @SpringBootTest(classes = { SampleUndertowWebSocketsApplication.class, | ||||
| 		CustomContainerConfiguration.class }, webEnvironment = WebEnvironment.RANDOM_PORT) | ||||
| @DirtiesContext | ||||
| public class CustomContainerWebSocketsApplicationTests { | ||||
| 
 | ||||
| 	private static Log logger = LogFactory | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue