Skip to content

Commit 4141211

Browse files
committed
Prepare to parallelize tests
This change sets up `httpclient5` and `httpclient5-testing` for parallelization. When they pick up the next release of httpcore5, they will pull in its `junit-platform.properties`, as well as the `LoggingInitializationListener` that initializes Slf4j before any tests run.
1 parent 6b7f5e3 commit 4141211

File tree

6 files changed

+29
-3
lines changed

6 files changed

+29
-3
lines changed

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ jobs:
4949
distribution: 'temurin'
5050
java-version: ${{ matrix.java }}
5151
- name: Build with Maven
52-
run: ./mvnw -V --file pom.xml --no-transfer-progress -DtrimStackTrace=false -P-use-toolchains,docker
52+
run: ./mvnw -V --file pom.xml --no-transfer-progress -DtrimStackTrace=false -Djunit.jupiter.execution.parallel.enabled=false -P-use-toolchains,docker

httpclient5-testing/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@
8888
<artifactId>junit-jupiter</artifactId>
8989
<scope>test</scope>
9090
</dependency>
91+
<dependency>
92+
<groupId>org.junit.platform</groupId>
93+
<artifactId>junit-platform-launcher</artifactId>
94+
<scope>test</scope>
95+
</dependency>
9196
<dependency>
9297
<groupId>org.hamcrest</groupId>
9398
<artifactId>hamcrest</artifactId>
@@ -159,4 +164,4 @@
159164
</plugins>
160165
</reporting>
161166

162-
</project>
167+
</project>

httpclient5/pom.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@
5757
<artifactId>conscrypt-openjdk-uber</artifactId>
5858
<optional>true</optional>
5959
</dependency>
60+
<dependency>
61+
<groupId>org.apache.httpcomponents.core5</groupId>
62+
<artifactId>httpcore5</artifactId>
63+
<classifier>tests</classifier>
64+
<scope>test</scope>
65+
</dependency>
6066
<dependency>
6167
<groupId>org.apache.httpcomponents.core5</groupId>
6268
<artifactId>httpcore5-reactive</artifactId>
@@ -88,6 +94,11 @@
8894
<artifactId>junit-jupiter</artifactId>
8995
<scope>test</scope>
9096
</dependency>
97+
<dependency>
98+
<groupId>org.junit.platform</groupId>
99+
<artifactId>junit-platform-launcher</artifactId>
100+
<scope>test</scope>
101+
</dependency>
91102
<dependency>
92103
<groupId>org.hamcrest</groupId>
93104
<artifactId>hamcrest</artifactId>
@@ -206,4 +217,4 @@
206217
</profile>
207218
</profiles>
208219

209-
</project>
220+
</project>

httpclient5/src/test/java/org/apache/hc/client5/http/impl/ExecSupportTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828

2929
import org.junit.jupiter.api.Assertions;
3030
import org.junit.jupiter.api.Test;
31+
import org.junit.jupiter.api.parallel.Isolated;
3132

33+
@Isolated
3234
class ExecSupportTest {
3335

3436
@Test

httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestSystemDefaultCredentialsProvider.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@
4040
import org.apache.hc.client5.http.protocol.HttpClientContext;
4141
import org.junit.jupiter.api.Assertions;
4242
import org.junit.jupiter.api.Test;
43+
import org.junit.jupiter.api.parallel.Isolated;
4344
import org.mockito.ArgumentMatchers;
4445
import org.mockito.Mockito;
4546

4647
/**
4748
* Simple tests for {@link SystemDefaultCredentialsProvider}.
4849
*/
50+
@Isolated
4951
class TestSystemDefaultCredentialsProvider {
5052

5153
private final static String PROXY_PROTOCOL1 = "http";

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@
9494
<artifactId>httpcore5</artifactId>
9595
<version>${httpcore.version}</version>
9696
</dependency>
97+
<dependency>
98+
<groupId>org.apache.httpcomponents.core5</groupId>
99+
<artifactId>httpcore5</artifactId>
100+
<version>${httpcore.version}</version>
101+
<classifier>tests</classifier>
102+
</dependency>
97103
<dependency>
98104
<groupId>org.apache.httpcomponents.core5</groupId>
99105
<artifactId>httpcore5-h2</artifactId>

0 commit comments

Comments
 (0)