From 58cfa51fcf825674af38b55801607ae798872881 Mon Sep 17 00:00:00 2001 From: Pascal Krause Date: Fri, 11 Aug 2023 11:39:37 +0200 Subject: [PATCH] feat: add maven profiles for Infinispan 14 --- .github/workflows/ci-4.x.yml | 36 ++++++++++ pom.xml | 1 + vertx-infinispan/pom.xml | 17 ++++- .../infinispan/InfinispanClusterManager.java | 7 +- ...finispan.xml => default-infinispan-13.xml} | 0 .../main/resources/default-infinispan-14.xml | 35 +++++++++ .../InfinispanFaultToleranceTest.java | 4 +- .../resources/{jgroups.xml => jgroups-4.xml} | 0 .../src/test/resources/jgroups-5.xml | 71 +++++++++++++++++++ vertx-web-sstore-infinispan/pom.xml | 2 +- 10 files changed, 167 insertions(+), 6 deletions(-) rename vertx-infinispan/src/main/resources/{default-infinispan.xml => default-infinispan-13.xml} (100%) create mode 100644 vertx-infinispan/src/main/resources/default-infinispan-14.xml rename vertx-infinispan/src/test/resources/{jgroups.xml => jgroups-4.xml} (100%) 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..e3cec06 100644 --- a/.github/workflows/ci-4.x.yml +++ b/.github/workflows/ci-4.x.yml @@ -33,6 +33,42 @@ jobs: with: name: heap-dump path: target/*.hprof + Test-ISPN14: + name: Run tests + strategy: + matrix: + os: [ ubuntu-latest ] + jdk: [ 11 ] + profile: [ISPN-14] + 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 + Test-ISPN14-jakarta: + name: Run tests + strategy: + matrix: + os: [ ubuntu-latest ] + jdk: [ 11 ] + profile: [ 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..7b934cf 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} @@ -271,6 +271,19 @@ + + ISPN-14 + + 14.0.13.Final + + + + ISPN-14-jakarta + + 14.0.13.Final + -jakarta + + coverage 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..a2c0e51 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-13.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-4.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.xml b/vertx-infinispan/src/main/resources/default-infinispan-13.xml similarity index 100% rename from vertx-infinispan/src/main/resources/default-infinispan.xml rename to vertx-infinispan/src/main/resources/default-infinispan-13.xml 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..9667eb3 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) ? "4" : "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.xml b/vertx-infinispan/src/test/resources/jgroups-4.xml similarity index 100% rename from vertx-infinispan/src/test/resources/jgroups.xml rename to vertx-infinispan/src/test/resources/jgroups-4.xml 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..4d5979d 100644 --- a/vertx-web-sstore-infinispan/pom.xml +++ b/vertx-web-sstore-infinispan/pom.xml @@ -55,7 +55,7 @@ org.infinispan - infinispan-client-hotrod + infinispan-client-hotrod${infinispan.jakartasuffix} ${infinispan.version}