diff --git a/build/run_integration_group.sh b/build/run_integration_group.sh index 6456911999e9df..c107a2adb1e3d8 100755 --- a/build/run_integration_group.sh +++ b/build/run_integration_group.sh @@ -25,6 +25,8 @@ set -o pipefail set -o errexit JAVA_MAJOR_VERSION="$(java -version 2>&1 |grep " version " | awk -F\" '{ print $2 }' | awk -F. '{ if ($1=="1") { print $2 } else { print $1 } }')" +# Used to shade run test on Java 8, because the latest TestNG requires Java 11 or higher. +TESTNG_VERSION="7.3.0" # lists all active maven modules with given parameters # parses the modules from the "mvn initialize" output @@ -95,6 +97,11 @@ test_group_shade_run() { if [[ $JAVA_MAJOR_VERSION -gt 8 && $JAVA_MAJOR_VERSION -lt 17 ]]; then additional_args="-Dmaven.compiler.source=$JAVA_MAJOR_VERSION -Dmaven.compiler.target=$JAVA_MAJOR_VERSION" fi + + if [[ $JAVA_MAJOR_VERSION -ge 8 && $JAVA_MAJOR_VERSION -lt 11 ]]; then + additional_args="$additional_args -Dtestng.version=$TESTNG_VERSION" + fi + mvn_run_integration_test --skip-build-deps --clean "$@" -Denforcer.skip=true -DShadeTests -DtestForkCount=1 -DtestReuseFork=false $additional_args } diff --git a/buildtools/pom.xml b/buildtools/pom.xml index a463f114c627cc..706736e4c26cb1 100644 --- a/buildtools/pom.xml +++ b/buildtools/pom.xml @@ -41,7 +41,7 @@ 3.0.0-M3 2.18.0 1.7.32 - 7.3.0 + 7.6.1 3.11 4.1 3.4.0 diff --git a/pom.xml b/pom.xml index 82cf6954490ceb..41589a69b3a450 100644 --- a/pom.xml +++ b/pom.xml @@ -241,7 +241,7 @@ flexible messaging model and an intuitive client API. 3.2.13 1.1.1 - 7.3.0 + 7.6.1 3.12.4 3.25.0-GA 1.5.0 diff --git a/pulsar-client-admin/pom.xml b/pulsar-client-admin/pom.xml index 89fccfccd56602..983dfbdaf080d3 100644 --- a/pulsar-client-admin/pom.xml +++ b/pulsar-client-admin/pom.xml @@ -107,6 +107,12 @@ pulsar-package-core ${project.version} + + + org.hamcrest + hamcrest + test + diff --git a/pulsar-client-all/pom.xml b/pulsar-client-all/pom.xml index 11f46b9270431c..7c7b2ed7f80f0a 100644 --- a/pulsar-client-all/pom.xml +++ b/pulsar-client-all/pom.xml @@ -412,6 +412,9 @@ ${pulsar.client.compiler.release} + + test + diff --git a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/BatchMessageContainerImplTest.java b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/BatchMessageContainerImplTest.java index a51be6b4bd0b54..4b80e19c256d71 100644 --- a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/BatchMessageContainerImplTest.java +++ b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/BatchMessageContainerImplTest.java @@ -25,6 +25,7 @@ import static org.mockito.Mockito.when; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; +import static org.testng.Assert.fail; import io.netty.buffer.ByteBufAllocator; import io.netty.util.ReferenceCountUtil; import java.lang.reflect.Field; @@ -36,7 +37,6 @@ import org.apache.pulsar.client.api.Schema; import org.apache.pulsar.client.impl.conf.ProducerConfigurationData; import org.apache.pulsar.common.api.proto.MessageMetadata; -import org.junit.Assert; import org.testng.annotations.Test; public class BatchMessageContainerImplTest { @@ -112,7 +112,7 @@ public void recoveryAfterOom() { clientFiled.setAccessible(true); clientFiled.set(producer, pulsarClient); } catch (Exception e){ - Assert.fail(e.getMessage()); + fail(e.getMessage()); } when(producer.getConfiguration()).thenReturn(producerConfigurationData); @@ -155,7 +155,7 @@ public void testMessagesSize() throws Exception { clientFiled.setAccessible(true); clientFiled.set(producer, pulsarClient); } catch (Exception e){ - Assert.fail(e.getMessage()); + fail(e.getMessage()); } ByteBuffer payload = ByteBuffer.wrap("payload".getBytes(StandardCharsets.UTF_8)); diff --git a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ClientBuilderImplTest.java b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ClientBuilderImplTest.java index cacf2c30c53bda..c435d6f05e4256 100644 --- a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ClientBuilderImplTest.java +++ b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ClientBuilderImplTest.java @@ -18,10 +18,10 @@ */ package org.apache.pulsar.client.impl; +import static org.testng.Assert.fail; import org.apache.pulsar.client.api.PulsarClient; import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.api.ServiceUrlProvider; -import org.junit.Assert; import org.testng.annotations.Test; public class ClientBuilderImplTest { @@ -90,7 +90,7 @@ public void testConnectionMaxIdleSeconds() throws Exception { // test config not correct. try { PulsarClient.builder().connectionMaxIdleSeconds(30); - Assert.fail(); + fail(); } catch (IllegalArgumentException e){ } } diff --git a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ProducerStatsRecorderImplTest.java b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ProducerStatsRecorderImplTest.java index 0b4379e087f95b..32d0eff6e792e7 100644 --- a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ProducerStatsRecorderImplTest.java +++ b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ProducerStatsRecorderImplTest.java @@ -18,20 +18,18 @@ */ package org.apache.pulsar.client.impl; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; import io.netty.util.HashedWheelTimer; import io.netty.util.Timer; +import java.util.concurrent.TimeUnit; import org.apache.pulsar.client.impl.conf.ClientConfigurationData; import org.apache.pulsar.client.impl.conf.ProducerConfigurationData; import org.testng.annotations.Test; -import java.util.concurrent.TimeUnit; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; -import static org.testng.Assert.assertEquals; - /** * Unit tests of {@link ProducerStatsRecorderImpl}. */ diff --git a/pulsar-common/src/test/java/org/apache/pulsar/common/util/TrustManagerProxyTest.java b/pulsar-common/src/test/java/org/apache/pulsar/common/util/TrustManagerProxyTest.java index 31c74c2f09b278..8114f9b9356f35 100644 --- a/pulsar-common/src/test/java/org/apache/pulsar/common/util/TrustManagerProxyTest.java +++ b/pulsar-common/src/test/java/org/apache/pulsar/common/util/TrustManagerProxyTest.java @@ -18,8 +18,8 @@ */ package org.apache.pulsar.common.util; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; import com.google.common.io.Resources; import java.security.cert.X509Certificate; import java.util.Arrays; diff --git a/pulsar-io/kafka/pom.xml b/pulsar-io/kafka/pom.xml index ca7485510c864a..f6711e572ce37e 100644 --- a/pulsar-io/kafka/pom.xml +++ b/pulsar-io/kafka/pom.xml @@ -113,6 +113,12 @@ jjwt-jackson + + org.hamcrest + hamcrest + test + + diff --git a/pulsar-package-management/bookkeeper-storage/src/test/java/org/apache/pulsar/packages/management/storage/bookkeeper/bookkeeper/test/ZooKeeperUtil.java b/pulsar-package-management/bookkeeper-storage/src/test/java/org/apache/pulsar/packages/management/storage/bookkeeper/bookkeeper/test/ZooKeeperUtil.java index 02c32e671863d6..559cc54d8b6962 100644 --- a/pulsar-package-management/bookkeeper-storage/src/test/java/org/apache/pulsar/packages/management/storage/bookkeeper/bookkeeper/test/ZooKeeperUtil.java +++ b/pulsar-package-management/bookkeeper-storage/src/test/java/org/apache/pulsar/packages/management/storage/bookkeeper/bookkeeper/test/ZooKeeperUtil.java @@ -18,13 +18,13 @@ */ package org.apache.pulsar.packages.management.storage.bookkeeper.bookkeeper.test; +import static org.testng.Assert.assertTrue; import java.io.File; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; - import org.apache.bookkeeper.test.ZooKeeperCluster; import org.apache.bookkeeper.util.IOUtils; import org.apache.bookkeeper.zookeeper.ZooKeeperClient; @@ -33,7 +33,6 @@ import org.apache.zookeeper.server.NIOServerCnxnFactory; import org.apache.zookeeper.server.ZooKeeperServer; import org.apache.zookeeper.test.ClientBase; -import org.junit.Assert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -135,7 +134,7 @@ public void stopCluster() throws Exception { if (this.serverFactory != null) { this.serverFactory.shutdown(); - Assert.assertTrue("waiting for server down", ClientBase.waitForServerDown(this.getZooKeeperConnectString(), (long)ClientBase.CONNECTION_TIMEOUT)); + assertTrue(ClientBase.waitForServerDown(this.getZooKeeperConnectString(), (long)ClientBase.CONNECTION_TIMEOUT),"waiting for server down"); } if (this.zks != null) {