Skip to content

Commit

Permalink
Merge pull request #3770 from kalaiyarasiganeshalingam/java21
Browse files Browse the repository at this point in the history
Fix test failures with java 21
  • Loading branch information
kalaiyarasiganeshalingam authored Nov 19, 2024
2 parents e260259 + 650a6df commit e9b3ea6
Show file tree
Hide file tree
Showing 36 changed files with 343 additions and 203 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/cluster-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,12 @@ jobs:
with:
distribution: 'temurin'
java-version: '17.0.6'
- name: Cluster Tests
- name: Cluster Tests with JDK 17
run: mvn -B clean install --file integration/pom.xml -P cluster-tests
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '21.0.4'
- name: Cluster Tests with JDK 21
run: mvn -B clean install --file integration/pom.xml -P cluster-tests
10 changes: 5 additions & 5 deletions .github/workflows/jdk-17-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Cache Maven packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2
restore-keys: ${{ runner.os }}-m2
- name: Set up JDK 11
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11.0.12+7'
Expand All @@ -35,9 +35,9 @@ jobs:
- name: check java version
run: echo "JAVA_VERSION=$(java -version)"
- name: Build in jdk11
run: mvn -B clean install -DskipTests --file pom.xml
run: mvn clean install -DskipTests --file pom.xml
- name: Set up JDK 17
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17.0.6'
Expand All @@ -48,4 +48,4 @@ jobs:
- name: Print segment
run: echo "Running build for segment ${{ matrix.profile }}"
- name: JDK 17 Tests
run: mvn -B clean install --file integration/pom.xml -P ${{ matrix.profile }} -fae
run: mvn clean install --file integration/pom.xml -P ${{ matrix.profile }} -fae
55 changes: 55 additions & 0 deletions .github/workflows/jdk-21-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Integration tests (Ubuntu, OpenJDK21)

on: [push, pull_request]

jobs:
ubuntu:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- id: 1
profile: tests-mediators_tests-other_tests-sample
- id: 2
profile: tests-service_tests-patches_service-samples
- id: 3
profile: tests-transport_tests-platform
- id: 4
profile: management-api_dss-tests
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2
restore-keys: ${{ runner.os }}-m2
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11.0.12+7'
- name: check mvn version
run: echo "MAVEN_VERSION=$(mvn -v)"
- name: check java version
run: echo "JAVA_VERSION=$(java -version)"
- name: Set JAVA_TOOL_OPTIONS
run: |
NEW_JAVA_TOOL_OPTIONS="${{ env.JAVA_TOOL_OPTIONS }} -Djdk.util.zip.disableZip64ExtraFieldValidation=true -Djdk.nio.zipfs.allowDotZipEntry=true --add-opens=java.base/java.net=ALL-UNNAMED"
echo "JAVA_TOOL_OPTIONS=$NEW_JAVA_TOOL_OPTIONS" >> $GITHUB_ENV
- name: Build in jdk11
run: mvn clean install -DskipTests --file pom.xml
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '21.0.4'
- name: check mvn version
run: echo "MAVEN_VERSION=$(mvn -v)"
- name: check java version
run: echo "JAVA_VERSION=$(java -version)"
- name: Print segment
run: echo "Running build for segment ${{ matrix.profile }}"
- name: JDK 21 Tests
run: mvn clean install --file integration/pom.xml -P ${{ matrix.profile }} -fae
4 changes: 1 addition & 3 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ jobs:
- name: Build with Maven
run: mvn -B clean install -P smoke-tests --file pom.xml -fae
windows:

runs-on: windows-latest

steps:
- name: Configure Git to support long paths
run: git config --global core.longpaths true
- name: Verify Git configuration for long paths
run: git config --global core.longpaths
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: joschi/setup-jdk@v2
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11.0.12+7'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/windows-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Integration tests (Windows, OpenJDK8)
name: Integration tests (Windows, OpenJDK11)

on: [push]

Expand All @@ -12,7 +12,7 @@ jobs:
run: git config --system core.longpaths true
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: joschi/setup-jdk@v2
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
Expand All @@ -28,7 +28,7 @@ jobs:
run: git config --system core.longpaths true
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: joschi/setup-jdk@v2
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
Expand All @@ -44,7 +44,7 @@ jobs:
run: git config --system core.longpaths true
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: joschi/setup-jdk@v2
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Please follow the steps below to build WSO2 Micro Integrator from the source cod
2. Run the maven command `mvn clean install` from the root directory of the repository.
3. The generated Micro Integrator distribution can be found at `micro-integrator/distribution/target/wso2mi-<version>.zip`.

Please note that the product can be build using only JDK 11 but the integration tests can be run in either JDK 11 or 17.
Please note that the product can be build using only JDK 11 but the integration tests can be run in either JDK 11, 17 or 21.

#### Building the Docker image

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

import javax.xml.stream.XMLStreamException;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
Expand Down Expand Up @@ -75,13 +76,14 @@ public void setUp() {
}

protected SynapseConfiguration getConfigurationFromSynapseXML() {
try {
FileInputStream fin = new FileInputStream(path + File.separator + "synapse.xml");
try (FileInputStream fin = new FileInputStream(path + File.separator + "synapse.xml")) {
return XMLConfigurationBuilder.getConfiguration(fin, new Properties());
} catch (FileNotFoundException e) {
fail("The synapse.xml file does not exist");
fail("The synapse.xml file does not exist at the path: " + path);
} catch (XMLStreamException e) {
fail("Error parsing the synapse.xml");
fail("Error parsing the synapse.xml file at the path: " + path);
} catch (IOException e) {
fail("IO error while reading the synapse.xml file at the path: " + path);
}
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion distribution/src/scripts/micro-integrator.bat
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ goto supportedJdk

:unknownJdk
echo Starting WSO2 MI (in unsupported JDK %JAVA_VERSION%)
echo [ERROR] WSO2 MI is supported only between JDK 11 and JDK 17"
echo [ERROR] WSO2 MI is supported only between JDK 11 and JDK 21"
goto end

:supportedJdk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.function.BooleanSupplier;
import javax.xml.xpath.XPathExpressionException;

Expand Down Expand Up @@ -316,10 +315,10 @@ private Process startProcess(String workingDirectory, String[] cmdArray) throws
}

private void waitTill(BooleanSupplier predicate, int maxWaitTime, String task) throws InterruptedException {
long time = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(maxWaitTime);
long time = System.currentTimeMillis() + maxWaitTime * 1000L;
while (predicate.getAsBoolean() && System.currentTimeMillis() < time) {
log.info("waiting for server " + task);
TimeUnit.SECONDS.sleep(1);
Thread.sleep(1000);
}
}

Expand Down
Loading

0 comments on commit e9b3ea6

Please sign in to comment.