Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: bump to Java 21 #598

Merged
merged 7 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
artifacts_archive_path: ${{ steps.release.outputs.artifacts_archive_path }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
cache: 'maven'
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_SIGNING_KEY_SEC }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Check
Expand All @@ -32,11 +32,11 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3.3.0
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'
cache: 'maven'
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Build & Copy exporter
Expand All @@ -45,10 +45,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup JDK 17
- name: Setup JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Build & Copy exporter
Expand Down Expand Up @@ -80,10 +80,10 @@ jobs:
./agent &
./agent wait
- uses: actions/checkout@v4
- name: Setup JDK 17
- name: Setup JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Build & Copy exporter
Expand All @@ -105,10 +105,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Build
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ testImplementation 'io.zeebe:zeebe-test-container:3.5.0'

Zeebe Test Container is built for Java 8+, and will not work on lower Java versions.

> You will need Java 17+ for development purposes, however, as many of our tests rely on shared
> Zeebe libraries which are built for Java 17+.
> You will need Java 21+ for development purposes, however, as many of our tests rely on shared
> Zeebe libraries which are built for Java 21+.

Additionally, you will need to comply with all the Testcontainers requirements, as defined
[here](https://www.testcontainers.org/#prerequisites).
Expand Down Expand Up @@ -1178,7 +1178,7 @@ you will need to sign the [Contributor License Agreement](https://cla-assistant.
In order to build from source, you will need to install maven 3.6+. You can find more about it on
the [maven homepage](https://maven.apache.org/users/index.html).

To build the project, you will need a JDK 17 installed locally. Note however that the `core` and `engine` modules
To build the project, you will need a JDK 21 installed locally. Note however that the `core` and `engine` modules
are targeting Java 8 for compatibility purposes, and we must ensure that we maintain compatibility.
To do this, the CI pipeline will run the tests using Java 8.

Expand All @@ -1194,7 +1194,7 @@ The library is split into three modules:
- `engine`: the implementation of `ZeebeTestEngine`, the compatibility layer between this library
and [Zeebe Process Test](https://github.com/camunda/zeebe-process-test).
- `exporter`: the debug exporter module. It will be packaged as a fat JAR and included as a resource
in the core module. It has to be a separate module as it targets Java 17, same as the
in the core module. It has to be a separate module as it targets Java 21, same as the
`zeebe-exporter-api` module it implements.
- `exporter-test`: a module to test the integration between `DebugReceiver` and `DebugExporter`,
without having to run everything through an actual broker.
Expand Down Expand Up @@ -1229,6 +1229,10 @@ Testing is done via GitHub actions, using two workflows:
tests
which need to run on the local job should be annotated with `@DisabledIfTestcontainersCloud`.

One important thing to note is that we package and copy the debug exporter into the core module
during the build process. This means that any tests which relies on the debug exporter being
accessible has to be an integration test run by failsafe (i.e. test files ending with `IT`).

## Code style

The project uses Spotless to apply consistent formatting and licensing to all project files. By
Expand Down
8 changes: 6 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@
<goals>
<goal>copy</goal>
</goals>
<!-- TODO: set to package, and run the relevant tests as integration tests -->
<phase>generate-resources</phase>
<phase>package</phase>
<configuration>
<artifactItems>
<artifactItem>
Expand All @@ -221,6 +220,11 @@
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.revapi</groupId>
<artifactId>revapi-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* io.zeebe.containers.ZeebeBrokerNode#withDebugExporter(int)}.
*/
@Testcontainers
final class BrokerWithDebugExporterTest {
final class BrokerWithDebugExporterIT {
private final List<Record<?>> records = new CopyOnWriteArrayList<>();
private final DebugReceiver receiver = new DebugReceiver(records::add).start();

Expand Down
5 changes: 5 additions & 0 deletions engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.revapi</groupId>
<artifactId>revapi-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import java.util.concurrent.TimeoutException;
import org.junit.jupiter.api.Test;

final class DebugReceiverStreamTest {
final class DebugReceiverStreamIT {
private final InfiniteList<Record<?>> records = new InfiniteList<>();
private final DebugReceiver receiver = new DebugReceiver(records::add);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import org.testcontainers.junit.jupiter.Testcontainers;

@Testcontainers
final class ZeebeClusterEngineTest {
final class ZeebeClusterEngineIT {
private final Network network = Network.newNetwork();
private final InfiniteList<Record<?>> records = new InfiniteList<>();
private final DebugReceiver receiver = new DebugReceiver(records::add);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.testcontainers.junit.jupiter.Testcontainers;

@Testcontainers
final class ZeebeContainerEngineTest {
final class ZeebeContainerEngineIT {
private final InfiniteList<Record<?>> records = new InfiniteList<>();
private final DebugReceiver receiver = new DebugReceiver(records::add);
private final DebugReceiverStream recordStream = new DebugReceiverStream(records, receiver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.testcontainers.junit.jupiter.Testcontainers;

@Testcontainers
final class ClusterEngineExampleTest {
final class ClusterEngineExampleIT {
private final Network network = Network.newNetwork();

// a container which will print out its log to the given logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
* href="https://github.com/camunda/zeebe-process-test">zeebe-process-test</a>.
*/
@Testcontainers
final class ContainerEngineExampleTest {
private static final Logger LOGGER = LoggerFactory.getLogger(ContainerEngineExampleTest.class);
final class ContainerEngineExampleIT {
private static final Logger LOGGER = LoggerFactory.getLogger(ContainerEngineExampleIT.class);

// a container which will print out its log to the given logger
private final ZeebeContainer container =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* of the grace period, thus slowing down your tests.
*/
@Testcontainers
final class GracePeriodExampleTest {
final class GracePeriodExampleIT {
@Container
private final ContainerEngine engine =
ContainerEngine.builder().withGracePeriod(Duration.ofSeconds(5)).build();
Expand Down
4 changes: 2 additions & 2 deletions exporter-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<name>Zeebe Test Container Exporter Tests</name>

<properties>
<!-- fix minimum JDK to 17, meaning the exporter is not compatible with Zeebe < 8.x -->
<version.java>17</version.java>
<!-- fix minimum JDK to 21, meaning the exporter is not compatible with Zeebe < 8.4 -->
<version.java>21</version.java>
</properties>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions exporter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<name>Zeebe Test Container Exporter</name>

<properties>
<!-- fix minimum JDK to 17, meaning the exporter is not compatible with Zeebe < 8.x -->
<version.java>17</version.java>
<!-- fix minimum JDK to 21, meaning the exporter is not compatible with Zeebe < 8.4 -->
<version.java>21</version.java>
</properties>

<dependencies>
Expand Down
81 changes: 63 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<properties>
<!-- release parent settings -->
<version.java>17</version.java>
<version.java>21</version.java>
<nexus.snapshot.repository>https://artifacts.camunda.com/artifactory/zeebe-io-snapshots/</nexus.snapshot.repository>
<nexus.release.repository>https://artifacts.camunda.com/artifactory/zeebe-io/</nexus.release.repository>

Expand Down Expand Up @@ -85,8 +85,9 @@
<plugin.version.compiler>3.11.0</plugin.version.compiler>
<plugin.version.dependency>3.6.0</plugin.version.dependency>
<plugin.version.enforcer>3.4.1</plugin.version.enforcer>
<plugin.version.failsafe>3.2.2</plugin.version.failsafe>
<plugin.version.flatten>1.5.0</plugin.version.flatten>
<plugin.version.google-format>1.15.0</plugin.version.google-format>
<plugin.version.google-format>1.17.0</plugin.version.google-format>
<plugin.version.gpg>3.1.0</plugin.version.gpg>
<plugin.version.jar>3.3.0</plugin.version.jar>
<plugin.version.javadoc>3.6.2</plugin.version.javadoc>
Expand Down Expand Up @@ -370,6 +371,13 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${version.junit-jupiter}</version>
<scope>test</scope>
</dependency>
</dependencies>

<repositories>
Expand Down Expand Up @@ -545,6 +553,25 @@
</dependencies>
</plugin>

<!-- integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${plugin.version.failsafe}</version>
<configuration>
<failIfNoTests>false</failIfNoTests>
<trimStackTrace>false</trimStackTrace>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${version.junit-jupiter}</version>
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
Expand Down Expand Up @@ -583,6 +610,7 @@
<!-- dependencies not directly used in all projects during tests -->
<ignoredUnusedDeclaredDependencies combine.children="append">
<dep>org.slf4j:slf4j-simple</dep>
<dep>org.junit.jupiter:junit-jupiter</dep>
</ignoredUnusedDeclaredDependencies>
</configuration>
</execution>
Expand Down Expand Up @@ -768,22 +796,39 @@
<forkCount>1C</forkCount>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>${forkCount}</forkCount>
<reuseForks>true</reuseForks>
<properties>
<configurationParameters>junit.jupiter.execution.parallel.enabled = true
junit.jupiter.execution.parallel.mode.default = concurrent
junit.jupiter.execution.parallel.config.strategy = fixed
junit.jupiter.execution.parallel.config.fixed.parallelism = 2</configurationParameters>
</properties>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>${forkCount}</forkCount>
<reuseForks>true</reuseForks>
<properties>
<configurationParameters>junit.jupiter.execution.parallel.enabled = true
junit.jupiter.execution.parallel.mode.default = concurrent
junit.jupiter.execution.parallel.config.strategy = fixed
junit.jupiter.execution.parallel.config.fixed.parallelism = 2</configurationParameters>
</properties>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<forkCount>${forkCount}</forkCount>
<reuseForks>true</reuseForks>
<properties>
<configurationParameters>junit.jupiter.execution.parallel.enabled = true
junit.jupiter.execution.parallel.mode.default = concurrent
junit.jupiter.execution.parallel.config.strategy = fixed
junit.jupiter.execution.parallel.config.fixed.parallelism = 2</configurationParameters>
</properties>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>

Expand Down
Loading