Skip to content

Commit 92b2b82

Browse files
committed
Fix Java 17 test CI and remove Java 11 variant
This commit fixes configuration and runtime issues with the Java 17 test CI variant and removes the Java 11 one, now that Spring Framework 5.3.x is in maintenance mode.
1 parent a11222f commit 92b2b82

File tree

8 files changed

+17
-76
lines changed

8 files changed

+17
-76
lines changed

ci/images/ci-image/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ ADD get-jdk-url.sh /get-jdk-url.sh
55
RUN ./setup.sh java8
66

77
ENV JAVA_HOME /opt/openjdk/java8
8-
ENV JDK11 /opt/openjdk/java11
98
ENV JDK17 /opt/openjdk/java17
109

1110
ENV PATH $JAVA_HOME/bin:$PATH

ci/images/get-jdk-url.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,9 @@ case "$1" in
55
java8)
66
echo "https://github.com/bell-sw/Liberica/releases/download/8u345+1/bellsoft-jdk8u345+1-linux-amd64.tar.gz"
77
;;
8-
java11)
9-
echo "https://github.com/bell-sw/Liberica/releases/download/11.0.16+8/bellsoft-jdk11.0.16+8-linux-amd64.tar.gz"
10-
;;
118
java17)
129
echo "https://github.com/bell-sw/Liberica/releases/download/17.0.4+8/bellsoft-jdk17.0.4+8-linux-amd64.tar.gz"
1310
;;
14-
java18)
15-
echo "https://github.com/bell-sw/Liberica/releases/download/18.0.2+10/bellsoft-jdk18.0.2+10-linux-amd64.tar.gz"
16-
;;
1711
*)
1812
echo $"Unknown java version"
1913
exit 1

ci/images/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ curl https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.4/c
2020

2121
mkdir -p /opt/openjdk
2222
pushd /opt/openjdk > /dev/null
23-
for jdk in java8 java11 java17
23+
for jdk in java8 java17
2424
do
2525
JDK_URL=$( /get-jdk-url.sh $jdk )
2626
mkdir $jdk

ci/pipeline.yml

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,6 @@ resources:
125125
access_token: ((github-ci-status-token))
126126
branch: ((branch))
127127
context: build
128-
- name: repo-status-jdk11-build
129-
type: github-status-resource
130-
icon: eye-check-outline
131-
source:
132-
repository: ((github-repo-name))
133-
access_token: ((github-ci-status-token))
134-
branch: ((branch))
135-
context: jdk11-build
136128
- name: repo-status-jdk17-build
137129
type: github-status-resource
138130
icon: eye-check-outline
@@ -237,34 +229,6 @@ jobs:
237229
"zip.type": "schema"
238230
get_params:
239231
threads: 8
240-
- name: jdk11-build
241-
serial: true
242-
public: true
243-
plan:
244-
- get: ci-image
245-
- get: git-repo
246-
- get: every-morning
247-
trigger: true
248-
- put: repo-status-jdk11-build
249-
params: { state: "pending", commit: "git-repo" }
250-
- do:
251-
- task: check-project
252-
image: ci-image
253-
file: git-repo/ci/tasks/check-project.yml
254-
privileged: true
255-
timeout: ((task-timeout))
256-
params:
257-
TEST_TOOLCHAIN: 11
258-
<<: *build-project-task-params
259-
on_failure:
260-
do:
261-
- put: repo-status-jdk11-build
262-
params: { state: "failure", commit: "git-repo" }
263-
- put: slack-alert
264-
params:
265-
<<: *slack-fail-params
266-
- put: repo-status-jdk11-build
267-
params: { state: "success", commit: "git-repo" }
268232
- name: jdk17-build
269233
serial: true
270234
public: true
@@ -282,7 +246,7 @@ jobs:
282246
privileged: true
283247
timeout: ((task-timeout))
284248
params:
285-
TEST_TOOLCHAIN: 15
249+
TEST_TOOLCHAIN: 17
286250
<<: *build-project-task-params
287251
on_failure:
288252
do:
@@ -471,7 +435,7 @@ jobs:
471435

472436
groups:
473437
- name: "builds"
474-
jobs: ["build", "jdk11-build", "jdk17-build"]
438+
jobs: ["build", "jdk17-build"]
475439
- name: "releases"
476440
jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "create-github-release"]
477441
- name: "ci-images"

ci/scripts/check-project.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ set -e
44
source $(dirname $0)/common.sh
55

66
pushd git-repo > /dev/null
7-
./gradlew -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false -Porg.gradle.java.installations.fromEnv=JDK11,JDK15 \
7+
./gradlew -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false -Porg.gradle.java.installations.fromEnv=JDK17 \
88
-PmainToolchain=${MAIN_TOOLCHAIN} -PtestToolchain=${TEST_TOOLCHAIN} --no-daemon --max-workers=4 check
99
popd > /dev/null

gradle/toolchains.gradle

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ plugins.withType(JavaPlugin) {
8181
javaLauncher = javaToolchains.launcherFor {
8282
languageVersion = testLanguageVersion
8383
}
84+
if(testLanguageVersion == JavaLanguageVersion.of(17)) {
85+
jvmArgs(["--add-opens=java.base/java.lang=ALL-UNNAMED",
86+
"--add-opens=java.base/java.util=ALL-UNNAMED"])
87+
}
8488
}
8589
}
8690
}
@@ -130,21 +134,6 @@ pluginManager.withPlugin("kotlin") {
130134
}
131135
}
132136
}
133-
134-
if (testToolchainConfigured()) {
135-
def testLanguageVersion = testToolchainLanguageVersion()
136-
def compiler = javaToolchains.compilerFor {
137-
languageVersion = testLanguageVersion
138-
}
139-
// See https://kotlinlang.org/docs/gradle.html#attributes-specific-for-jvm
140-
def javaVersion = testLanguageVersion.toString() == '8' ? '1.8' : testLanguageVersion.toString()
141-
compileTestKotlin {
142-
kotlinOptions {
143-
jvmTarget = javaVersion
144-
jdkHome = compiler.get().metadata.installationPath.asFile.absolutePath
145-
}
146-
}
147-
}
148137
}
149138

150139
// Configure the JMH plugin to use the toolchain for generating and running JMH bytecode

spring-core/src/test/java/org/springframework/core/SpringCoreBlockHoundIntegrationTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import org.junit.jupiter.api.BeforeAll;
2424
import org.junit.jupiter.api.Test;
25+
import org.junit.jupiter.api.condition.DisabledForJreRange;
2526
import reactor.blockhound.BlockHound;
2627
import reactor.core.scheduler.ReactorBlockHoundIntegration;
2728
import reactor.core.scheduler.Schedulers;
@@ -31,13 +32,15 @@
3132

3233
import static org.assertj.core.api.Assertions.assertThat;
3334
import static org.assertj.core.api.Assertions.assertThatThrownBy;
35+
import static org.junit.jupiter.api.condition.JRE.JAVA_14;
3436

3537
/**
3638
* Tests to verify the spring-core BlockHound integration rules.
3739
*
3840
* @author Rossen Stoyanchev
3941
* @since 5.2.4
4042
*/
43+
@DisabledForJreRange(min = JAVA_14)
4144
public class SpringCoreBlockHoundIntegrationTests {
4245

4346
@BeforeAll

spring-core/src/test/java/org/springframework/util/StreamUtilsTests.java

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
import static org.mockito.Mockito.inOrder;
3434
import static org.mockito.Mockito.mock;
3535
import static org.mockito.Mockito.never;
36-
import static org.mockito.Mockito.spy;
37-
import static org.mockito.Mockito.verify;
3836

3937
/**
4038
* Tests for {@link StreamUtils}.
@@ -57,53 +55,47 @@ void setup() {
5755

5856
@Test
5957
void copyToByteArray() throws Exception {
60-
InputStream inputStream = spy(new ByteArrayInputStream(bytes));
58+
InputStream inputStream = new ByteArrayInputStream(bytes);
6159
byte[] actual = StreamUtils.copyToByteArray(inputStream);
6260
assertThat(actual).isEqualTo(bytes);
63-
verify(inputStream, never()).close();
6461
}
6562

6663
@Test
6764
void copyToString() throws Exception {
6865
Charset charset = Charset.defaultCharset();
69-
InputStream inputStream = spy(new ByteArrayInputStream(string.getBytes(charset)));
66+
InputStream inputStream = new ByteArrayInputStream(string.getBytes(charset));
7067
String actual = StreamUtils.copyToString(inputStream, charset);
7168
assertThat(actual).isEqualTo(string);
72-
verify(inputStream, never()).close();
7369
}
7470

7571
@Test
7672
void copyBytes() throws Exception {
77-
ByteArrayOutputStream out = spy(new ByteArrayOutputStream());
73+
ByteArrayOutputStream out = new ByteArrayOutputStream();
7874
StreamUtils.copy(bytes, out);
7975
assertThat(out.toByteArray()).isEqualTo(bytes);
80-
verify(out, never()).close();
8176
}
8277

8378
@Test
8479
void copyString() throws Exception {
8580
Charset charset = Charset.defaultCharset();
86-
ByteArrayOutputStream out = spy(new ByteArrayOutputStream());
81+
ByteArrayOutputStream out = new ByteArrayOutputStream();
8782
StreamUtils.copy(string, charset, out);
8883
assertThat(out.toByteArray()).isEqualTo(string.getBytes(charset));
89-
verify(out, never()).close();
9084
}
9185

9286
@Test
9387
void copyStream() throws Exception {
94-
ByteArrayOutputStream out = spy(new ByteArrayOutputStream());
88+
ByteArrayOutputStream out = new ByteArrayOutputStream();
9589
StreamUtils.copy(new ByteArrayInputStream(bytes), out);
9690
assertThat(out.toByteArray()).isEqualTo(bytes);
97-
verify(out, never()).close();
9891
}
9992

10093
@Test
10194
void copyRange() throws Exception {
102-
ByteArrayOutputStream out = spy(new ByteArrayOutputStream());
95+
ByteArrayOutputStream out = new ByteArrayOutputStream();
10396
StreamUtils.copyRange(new ByteArrayInputStream(bytes), out, 0, 100);
10497
byte[] range = Arrays.copyOfRange(bytes, 0, 101);
10598
assertThat(out.toByteArray()).isEqualTo(range);
106-
verify(out, never()).close();
10799
}
108100

109101
@Test

0 commit comments

Comments
 (0)