From e93ed82b717a8d8fcf75019fb503500af42d0637 Mon Sep 17 00:00:00 2001 From: Lari Hotari Date: Thu, 28 Nov 2024 12:56:23 +0200 Subject: [PATCH] Add Java 21 build support and enable running of pulsar-metadatastore-oxia tests (#194) * Update test dependencies, cleanup build and make it buildable with Java 21 * Fix tests * Run spotless:apply --- pom.xml | 73 ++++++++++++------- pulsar-metadatastore-oxia/pom.xml | 27 +++++-- .../OxiaMetadataStore.java | 8 +- .../OxiaMetadataStoreTest.java | 8 ++ ...OxiaLedgerUnderreplicationManagerTest.java | 5 ++ .../OxiaPulsarRegistrationClientTest.java | 7 ++ 6 files changed, 92 insertions(+), 36 deletions(-) diff --git a/pom.xml b/pom.xml index 5365a2d2..d6087532 100644 --- a/pom.xml +++ b/pom.xml @@ -79,6 +79,7 @@ 17 17 + 17 UTF-8 UTF-8 @@ -92,22 +93,24 @@ 3.24.0 3.24.1 - 3.0.0 - 1.18.30 + 4.2.2 + 1.18.32 1.7.32 - 5.11.0-M1 - 5.11.0 + 5.11.3 + 5.14.2 1.37.0 - 1.19.7 + 1.20.4 32.1.3-jre 0.8.12 4.1 - 3.10.1 - 3.1.0 - 3.2.5 + 3.13.0 + 3.5.0 + 3.5.2 + 3.6.0 4.8.1.0 2.39.0 + 1.15.10 @@ -126,6 +129,13 @@ pom import + + org.junit + junit-bom + ${junit.jupiter.version} + pom + import + org.testcontainers testcontainers-bom @@ -138,6 +148,36 @@ guava ${guava.version} + + net.bytebuddy + byte-buddy + ${byte-buddy.version} + + + net.bytebuddy + byte-buddy-agent + ${byte-buddy.version} + + + org.assertj + assertj-core + ${assertj.version} + + + org.awaitility + awaitility + ${awaitility.version} + + + org.mockito + mockito-junit-jupiter + ${mockito.junit.jupiter.version} + + + org.projectlombok + lombok + ${lombok.version} + @@ -150,44 +190,27 @@ org.projectlombok lombok - ${lombok.version} provided org.assertj assertj-core - ${assertj.version} test org.awaitility awaitility - ${awaitility.version} - test - - - org.awaitility - awaitility-proxy - ${awaitility.version} test org.junit.jupiter junit-jupiter - ${junit.jupiter.version} test org.mockito mockito-junit-jupiter - ${mockito.junit.jupiter.version} test - - - org.junit.jupiter - junit-jupiter-api - - org.slf4j diff --git a/pulsar-metadatastore-oxia/pom.xml b/pulsar-metadatastore-oxia/pom.xml index 4fbe26bd..e24c138b 100644 --- a/pulsar-metadatastore-oxia/pom.xml +++ b/pulsar-metadatastore-oxia/pom.xml @@ -30,23 +30,17 @@ Oxia Metadatastore implementation for Apache Pulsar - 17 - 17 UTF-8 UTF-8 io.streamnative.pulsarmetadatastoreoxia.shaded + 3.0.2 - 7.7.0 + 7.7.1 4.1.12.1 1.1.10.4 - 4.1 - 3.10.1 - 3.1.0 - 3.4.1 - 3.0.0-M7 4.8.1.0 2.39.0 @@ -86,6 +80,12 @@ buildtools ${pulsar.version} test + + + * + * + + org.apache.pulsar @@ -314,6 +314,17 @@ + + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + org.apache.maven.surefire + surefire-testng + ${maven.surefire.plugin.version} + + + org.codehaus.mojo build-helper-maven-plugin diff --git a/pulsar-metadatastore-oxia/src/main/java/io/streamnative/pulsarmetadatastoreoxia/OxiaMetadataStore.java b/pulsar-metadatastore-oxia/src/main/java/io/streamnative/pulsarmetadatastoreoxia/OxiaMetadataStore.java index 2bdbb723..84269287 100644 --- a/pulsar-metadatastore-oxia/src/main/java/io/streamnative/pulsarmetadatastoreoxia/OxiaMetadataStore.java +++ b/pulsar-metadatastore-oxia/src/main/java/io/streamnative/pulsarmetadatastoreoxia/OxiaMetadataStore.java @@ -269,10 +269,12 @@ private CompletableFuture createParents(String path) { @Override public void close() throws Exception { - if (client != null) { - client.close(); + if (isClosed.compareAndSet(false, true)) { + if (client != null) { + client.close(); + } + super.close(); } - super.close(); } public Optional getMetadataEventSynchronizer() { diff --git a/pulsar-metadatastore-oxia/src/test/java/io/streamnative/pulsarmetadatastoreoxia/OxiaMetadataStoreTest.java b/pulsar-metadatastore-oxia/src/test/java/io/streamnative/pulsarmetadatastoreoxia/OxiaMetadataStoreTest.java index 1d224023..37ea820c 100644 --- a/pulsar-metadatastore-oxia/src/test/java/io/streamnative/pulsarmetadatastoreoxia/OxiaMetadataStoreTest.java +++ b/pulsar-metadatastore-oxia/src/test/java/io/streamnative/pulsarmetadatastoreoxia/OxiaMetadataStoreTest.java @@ -67,4 +67,12 @@ public void testGetChildren(String provider, Supplier urlSupplier) throw @Test(dataProvider = "impl") public void testDeleteUnusedDirectories(String provider, Supplier urlSupplier) throws Exception {} + + @Ignore + @Test(dataProvider = "conditionOfSwitchThread") + @Override + public void testThreadSwitchOfZkMetadataStore(boolean hasSynchronizer, boolean enabledBatch) + throws Exception { + super.testThreadSwitchOfZkMetadataStore(hasSynchronizer, enabledBatch); + } } diff --git a/pulsar-metadatastore-oxia/src/test/java/io/streamnative/pulsarmetadatastoreoxia/bookkeeper/OxiaLedgerUnderreplicationManagerTest.java b/pulsar-metadatastore-oxia/src/test/java/io/streamnative/pulsarmetadatastoreoxia/bookkeeper/OxiaLedgerUnderreplicationManagerTest.java index 4dcbc822..ad69f136 100644 --- a/pulsar-metadatastore-oxia/src/test/java/io/streamnative/pulsarmetadatastoreoxia/bookkeeper/OxiaLedgerUnderreplicationManagerTest.java +++ b/pulsar-metadatastore-oxia/src/test/java/io/streamnative/pulsarmetadatastoreoxia/bookkeeper/OxiaLedgerUnderreplicationManagerTest.java @@ -23,6 +23,7 @@ import org.apache.pulsar.metadata.bookkeeper.LedgerUnderreplicationManagerTest; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; +import org.testng.annotations.Ignore; /** Test the zookeeper implementation of the ledger replication manager. */ @Slf4j @@ -40,4 +41,8 @@ public void setup() throws Exception { public Object[][] implementations() { return impl(); } + + @Ignore + @Override + public void testZkMetasStoreMarkReplicatedDeleteEmptyParentNodes() throws Exception {} } diff --git a/pulsar-metadatastore-oxia/src/test/java/io/streamnative/pulsarmetadatastoreoxia/bookkeeper/OxiaPulsarRegistrationClientTest.java b/pulsar-metadatastore-oxia/src/test/java/io/streamnative/pulsarmetadatastoreoxia/bookkeeper/OxiaPulsarRegistrationClientTest.java index a7d54407..04287639 100644 --- a/pulsar-metadatastore-oxia/src/test/java/io/streamnative/pulsarmetadatastoreoxia/bookkeeper/OxiaPulsarRegistrationClientTest.java +++ b/pulsar-metadatastore-oxia/src/test/java/io/streamnative/pulsarmetadatastoreoxia/bookkeeper/OxiaPulsarRegistrationClientTest.java @@ -23,6 +23,7 @@ import org.apache.pulsar.metadata.bookkeeper.PulsarRegistrationClientTest; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; +import org.testng.annotations.Ignore; @Slf4j public class OxiaPulsarRegistrationClientTest extends PulsarRegistrationClientTest @@ -39,4 +40,10 @@ public void setup() throws Exception { public Object[][] implementations() { return impl(); } + + @Ignore + @Override + public void testNetworkDelayWithBkZkManager() throws Throwable { + // ignore + } }