Samples cleanup
- Modifying dependencies to starter-web with tomcat exclusion plus alternative servlet container instead of manual dependency on spring-webmvc as it is the preferrable way to use alternative servlet container - Previously RestTemplate with ssl was configured manually in tests - now it rellies on autoconfiguration - changed this for multi-connector test and added test to ensure that ssl autoconfiguration is working - Most samples with alterntative servlet containers used some kind of service reading property and returning default since it wasn't configured - removed it, since it is not specific to using alternative servlet containers. See gh-10548
This commit is contained in:
committed by
Stephane Nicoll
parent
792de8f42a
commit
d8fa71bc97
@@ -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,11 +37,17 @@ 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 testSsl() {
|
||||
assertThat(this.webServerFactory.getSsl().isEnabled()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHome() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user