From 2d36fd91d8f76cbdd1472b96dc7913df8c6978dc Mon Sep 17 00:00:00 2001 From: Pascal <23715608+pk-work@users.noreply.github.com> Date: Mon, 28 Aug 2023 19:04:01 +0200 Subject: [PATCH] feat: add maven profiles for Infinispan 14 (#131) * feat: add maven profiles for Infinispan 14 * feat: bump ISPN version to 14.0.14.Final * fix: unknown enum constant warning Without this dependency a warning occurs during the build process. * docs: describe how to use a different ISPN version Without this dependency a warning occurs during the build process. --- .github/workflows/ci-4.x.yml | 18 +++ pom.xml | 1 + vertx-infinispan/pom.xml | 34 +++++- vertx-infinispan/src/main/asciidoc/index.adoc | 104 ++++++++++++++++++ .../infinispan/InfinispanClusterManager.java | 7 +- .../main/resources/default-infinispan-14.xml | 35 ++++++ .../InfinispanFaultToleranceTest.java | 4 +- .../src/test/resources/jgroups-5.xml | 71 ++++++++++++ vertx-web-sstore-infinispan/pom.xml | 18 ++- .../main/asciidoc/web-sstore-infinispan.adoc | 88 +++++++++++++++ 10 files changed, 374 insertions(+), 6 deletions(-) create mode 100644 vertx-infinispan/src/main/resources/default-infinispan-14.xml create mode 100644 vertx-infinispan/src/test/resources/jgroups-5.xml diff --git a/.github/workflows/ci-4.x.yml b/.github/workflows/ci-4.x.yml index 9a527aa..f0abcd3 100644 --- a/.github/workflows/ci-4.x.yml +++ b/.github/workflows/ci-4.x.yml @@ -33,6 +33,24 @@ jobs: with: name: heap-dump path: target/*.hprof + Test-ISPN14: + name: Run tests + strategy: + matrix: + os: [ ubuntu-latest ] + jdk: [ 11 ] + profile: [ISPN-14, ISPN-14-jakarta] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install JDK + uses: actions/setup-java@v2 + with: + java-version: ${{ matrix.jdk }} + distribution: temurin + - name: Run tests + run: mvn -P ${{ matrix.profile }} -s .github/maven-ci-settings.xml -B -DtestLogLevel=OFF test Deploy: name: Deploy to OSSRH if: ${{ github.repository_owner == 'vert-x3' && (github.event_name == 'push' || github.event_name == 'schedule') }} diff --git a/pom.xml b/pom.xml index 779482b..1d7e22c 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,7 @@ true 3.0.13 13.0.17.Final + diff --git a/vertx-infinispan/pom.xml b/vertx-infinispan/pom.xml index 2ced026..fcda6fe 100644 --- a/vertx-infinispan/pom.xml +++ b/vertx-infinispan/pom.xml @@ -43,7 +43,7 @@ org.infinispan - infinispan-core + infinispan-core${infinispan.jakartasuffix} ${infinispan.version} @@ -67,7 +67,7 @@ org.infinispan - infinispan-multimap + infinispan-multimap${infinispan.jakartasuffix} ${infinispan.version} @@ -92,11 +92,28 @@ org.infinispan infinispan-clustered-lock ${infinispan.version} + + + org.infinispan + infinispan-core + + org.infinispan infinispan-clustered-counter ${infinispan.version} + + + org.infinispan + infinispan-core + + + + + org.infinispan + infinispan-component-annotations + ${infinispan.version} @@ -271,6 +288,19 @@ + + ISPN-14 + + 14.0.14.Final + + + + ISPN-14-jakarta + + 14.0.14.Final + -jakarta + + coverage diff --git a/vertx-infinispan/src/main/asciidoc/index.adoc b/vertx-infinispan/src/main/asciidoc/index.adoc index e89229a..d94bf4f 100644 --- a/vertx-infinispan/src/main/asciidoc/index.adoc +++ b/vertx-infinispan/src/main/asciidoc/index.adoc @@ -432,3 +432,107 @@ After creation, the health check can be exposed over HTTP with a link:../../vert ---- {@link examples.Examples#healthCheckHandler(io.vertx.core.Vertx, io.vertx.ext.healthchecks.HealthChecks)} ---- + +== Using a different Infinispan version + +Switching the version to Infinispan 14 or Infinispan 14 Jakarta requires Java 11. + +=== Switch to Infinispan 14 + +In order to use Infinispan 14 you need to upgrade all Infinispan related packages. + +Maven: +---- + + + + org.infinispan + infinispan-bom + 14.0.14.Final + pom + import + + + +---- + +Gradle: +---- +configurations.all { + resolutionStrategy.eachDependency { details -> + if (details.requested.group == 'org.infinispan') { + details.useVersion '14.0.14.Final' + } + } +} +---- + +=== Switch to Infinispan 14 Jakarta + +In order to use Infinispan 14 you need to upgrade all Infinispan related packages and replace some jakarta specific artifacts. + +Maven: +---- + + + + org.infinispan + infinispan-bom + 14.0.14.Final + pom + import + + + + + + + org.infinispan + infinispan-core-jakarta + + + org.infinispan + infinispan-multimap-jakarta + + + io.vertx + vertx-infinispan + + + org.infinispan + infinispan-core + + + org.infinispan + infinispan-multimap + + + org.infinispan + infinispan-commons + + + + +---- + +Gradle: +---- +configurations.all { + resolutionStrategy.eachDependency { details -> + if (details.requested.group == 'org.infinispan') { + details.useVersion '14.0.14.Final' + } + } +} + +dependencies { + implementation (group: '${maven.groupId}', name: '${maven.artifactId}', version: '${maven.version}') { + exclude group: 'org.infinispan', module: 'infinispan-core' + exclude group: 'org.infinispan', module: 'infinispan-commons' + exclude group: 'org.infinispan', module: 'infinispan-multimap' + } + + implementation group: 'org.infinispan', name: 'infinispan-multimap-jakarta', version: '14.0.14.Final' + implementation group: 'org.infinispan', name: 'infinispan-core-jakarta', version: '14.0.14.Final' +} +---- diff --git a/vertx-infinispan/src/main/java/io/vertx/ext/cluster/infinispan/InfinispanClusterManager.java b/vertx-infinispan/src/main/java/io/vertx/ext/cluster/infinispan/InfinispanClusterManager.java index 0851fc0..6d604de 100644 --- a/vertx-infinispan/src/main/java/io/vertx/ext/cluster/infinispan/InfinispanClusterManager.java +++ b/vertx-infinispan/src/main/java/io/vertx/ext/cluster/infinispan/InfinispanClusterManager.java @@ -33,6 +33,7 @@ import org.infinispan.commons.api.CacheContainerAdmin; import org.infinispan.commons.util.FileLookup; import org.infinispan.commons.util.FileLookupFactory; +import org.infinispan.commons.util.Version; import org.infinispan.configuration.parsing.ConfigurationBuilderHolder; import org.infinispan.configuration.parsing.ParserRegistry; import org.infinispan.context.Flag; @@ -72,11 +73,12 @@ public class InfinispanClusterManager implements ClusterManager { private static final Logger log = LoggerFactory.getLogger(InfinispanClusterManager.class); + private static final boolean isISPN13 = "13".equals(Version.getMajor()); private static final String VERTX_INFINISPAN_CONFIG_PROP_NAME = "vertx.infinispan.config"; private static final String INFINISPAN_XML = "infinispan.xml"; - private static final String DEFAULT_INFINISPAN_XML = "default-infinispan.xml"; + private static final String DEFAULT_INFINISPAN_XML = isISPN13 ? "default-infinispan.xml" : "default-infinispan-14.xml"; private static final String VERTX_JGROUPS_CONFIG_PROP_NAME = "vertx.jgroups.config"; - private static final String JGROUPS_XML = "jgroups.xml"; + private static final String JGROUPS_XML = isISPN13 ? "jgroups.xml" : "jgroups-5.xml"; private final String ispnConfigPath; private final String jgroupsConfigPath; @@ -119,6 +121,7 @@ public InfinispanClusterManager(DefaultCacheManager cacheManager) { @Override public void init(Vertx vertx, NodeSelector nodeSelector) { + log.info("Cluster Manager is using Infinispan " + Version.getVersion()); this.vertx = (VertxInternal) vertx; this.nodeSelector = nodeSelector; } diff --git a/vertx-infinispan/src/main/resources/default-infinispan-14.xml b/vertx-infinispan/src/main/resources/default-infinispan-14.xml new file mode 100644 index 0000000..9403fcd --- /dev/null +++ b/vertx-infinispan/src/main/resources/default-infinispan-14.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + diff --git a/vertx-infinispan/src/test/java/io/vertx/core/eventbus/InfinispanFaultToleranceTest.java b/vertx-infinispan/src/test/java/io/vertx/core/eventbus/InfinispanFaultToleranceTest.java index 38c96de..2c9f6e2 100644 --- a/vertx-infinispan/src/test/java/io/vertx/core/eventbus/InfinispanFaultToleranceTest.java +++ b/vertx-infinispan/src/test/java/io/vertx/core/eventbus/InfinispanFaultToleranceTest.java @@ -19,6 +19,7 @@ import io.vertx.core.*; import io.vertx.core.spi.cluster.ClusterManager; import io.vertx.ext.cluster.infinispan.InfinispanClusterManager; +import org.infinispan.commons.util.Version; import org.junit.Rule; import org.junit.rules.TemporaryFolder; @@ -68,11 +69,12 @@ protected ClusterManager getClusterManager() { @Override protected List getExternalNodeSystemProperties() { + String jgroupsVersion = Version.getMajor().equals(13) ? "" : "-5"; return Arrays.asList( "-Djava.net.preferIPv4Stack=true", "-Djgroups.join_timeout=1000", "-Dvertx.infinispan.config=infinispan.xml", - "-Dvertx.jgroups.config=jgroups.xml", + "-Dvertx.jgroups.config=jgroups"+ jgroupsVersion + ".xml", "-Djgroups.file.location=" + System.getProperty("jgroups.file.location"), "-Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory" ); diff --git a/vertx-infinispan/src/test/resources/jgroups-5.xml b/vertx-infinispan/src/test/resources/jgroups-5.xml new file mode 100644 index 0000000..b58f81c --- /dev/null +++ b/vertx-infinispan/src/test/resources/jgroups-5.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + diff --git a/vertx-web-sstore-infinispan/pom.xml b/vertx-web-sstore-infinispan/pom.xml index b2c7a02..eca5f85 100644 --- a/vertx-web-sstore-infinispan/pom.xml +++ b/vertx-web-sstore-infinispan/pom.xml @@ -36,6 +36,22 @@ ${project.basedir}/src/main/resources/META-INF/MANIFEST.MF + + + ISPN-14 + + 14.0.14.Final + + + + ISPN-14-jakarta + + 14.0.14.Final + -jakarta + + + + io.vertx @@ -55,7 +71,7 @@ org.infinispan - infinispan-client-hotrod + infinispan-client-hotrod${infinispan.jakartasuffix} ${infinispan.version} diff --git a/vertx-web-sstore-infinispan/src/main/asciidoc/web-sstore-infinispan.adoc b/vertx-web-sstore-infinispan/src/main/asciidoc/web-sstore-infinispan.adoc index 6c7817e..5146418 100644 --- a/vertx-web-sstore-infinispan/src/main/asciidoc/web-sstore-infinispan.adoc +++ b/vertx-web-sstore-infinispan/src/main/asciidoc/web-sstore-infinispan.adoc @@ -73,3 +73,91 @@ For advanced configuration requirements, you can provide a custom https://docs.j {@link examples.Examples#customClient} ---- +== Using a different Infinispan version + +Switching the version to Infinispan 14 or Infinispan 14 Jakarta requires Java 11. + +=== Switch to Infinispan 14 + +In order to use Infinispan 14 you need to upgrade all Infinispan related packages. + +Maven: +---- + + + + org.infinispan + infinispan-bom + 14.0.14.Final + pom + import + + + +---- + +Gradle: +---- +configurations.all { + resolutionStrategy.eachDependency { details -> + if (details.requested.group == 'org.infinispan') { + details.useVersion '14.0.14.Final' + } + } +} +---- + +=== Switch to Infinispan 14 Jakarta + +In order to use Infinispan 14 you need to upgrade all Infinispan related packages and replace some jakarta specific artifacts. + +Maven: +---- + + + + org.infinispan + infinispan-bom + 14.0.14.Final + pom + import + + + + + + + org.infinispan + infinispan-client-hotrod-jakarta + + + io.vertx + vertx-web-sstore-infinispan + + + org.infinispan + infinispan-client-hotrod + + + + +---- + +Gradle: +---- +configurations.all { + resolutionStrategy.eachDependency { details -> + if (details.requested.group == 'org.infinispan') { + details.useVersion '14.0.14.Final' + } + } +} + +dependencies { + implementation (group: '${maven.groupId}', name: '${maven.artifactId}', version: '${maven.version}') { + exclude group: 'org.infinispan', module: 'infinispan-client-hotrod' + } + + implementation group: 'org.infinispan', name: 'infinispan-client-hotrod-jakarta', version: '14.0.14.Final' +} +----