Skip to content

Commit 3b23c54

Browse files
committed
Test servlet 3.1 compatibility in deployment tests
Closes gh-28906
1 parent b0b2cd7 commit 3b23c54

File tree

4 files changed

+47
-1
lines changed

4 files changed

+47
-1
lines changed

spring-boot-tests/spring-boot-deployment-tests/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ configurations {
1313
}
1414

1515
dependencies {
16+
implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-actuator"))
17+
implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-security"))
1618
implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-web")) {
1719
exclude group: "org.hibernate.validator"
1820
}
19-
implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-actuator"))
2021

2122
intTestImplementation(enforcedPlatform(project(path: ":spring-boot-project:spring-boot-parent")))
2223
intTestImplementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-test"))

spring-boot-tests/spring-boot-deployment-tests/src/intTest/java/sample/AbstractDeploymentIntegrationTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ private void test(Consumer<TestRestTemplate> consumer) {
9595
TestRestTemplate rest = new TestRestTemplate(new RestTemplateBuilder()
9696
.rootUri("http://" + this.container.getHost() + ":" + this.container.getMappedPort(this.port)
9797
+ "/spring-boot")
98+
.basicAuthentication("test", "test")
9899
.requestFactory(() -> new HttpComponentsClientHttpRequestFactory(HttpClients.custom()
99100
.setRetryHandler(new StandardHttpRequestRetryHandler(10, false)).build())));
100101
try {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2012-2021 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package sample;
18+
19+
import org.testcontainers.junit.jupiter.Container;
20+
import org.testcontainers.junit.jupiter.Testcontainers;
21+
22+
/**
23+
* Deployment integration tests for Tomcat 8.5 (a Servlet 3.1 container).
24+
*
25+
* @author Andy Wilkinson
26+
*/
27+
@Testcontainers(disabledWithoutDocker = true)
28+
class Tomcat85DeploymentIntegrationTests extends AbstractDeploymentIntegrationTests {
29+
30+
@Container
31+
static WarDeploymentContainer container = new WarDeploymentContainer("tomcat:8.5.73-jdk8-openjdk",
32+
"/usr/local/tomcat/webapps", DEFAULT_PORT);
33+
34+
@Override
35+
WarDeploymentContainer getContainer() {
36+
return container;
37+
}
38+
39+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1+
spring:
2+
security:
3+
user:
4+
name: test
5+
password: test
16
management.endpoints.web.exposure.include: '*'

0 commit comments

Comments
 (0)