From c94d78215ba469a7fd6f52eb56b6ff55011c457c Mon Sep 17 00:00:00 2001 From: Enrico Olivelli Date: Sun, 14 Mar 2021 03:13:57 +0100 Subject: [PATCH] More fixes about running tests on JDK11 (#9893) ### Motivation When you are running tests on JDK11 you encounter a lot of issues. This patch includes a list of minor fixes that can be grouped. Master issue #9578 ### Modifications - Upgrade Mockito to latest version - Add "--add-opens java.base/jdk.internal.loader=ALL-UNNAMED" in order to allow PowerMock to work - add JAXB into jcloud provider (we already have it on the classpath in production, it is only in order to let tests run) - Upgrade HDFS minicluster to 3.3.0 - Pin netty-codec-http dependency to the same version of netty (inherited from HDFS client) - Use the same version of Jetty for hdfs-offload (old version does not work with JDK11) --- pom.xml | 17 ++++++++++++++--- .../client/impl/PulsarClientImplTest.java | 6 +++--- tiered-storage/file-system/pom.xml | 12 +++++++++--- tiered-storage/jcloud/pom.xml | 19 +++++++++++++++++++ 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index fcdfabf34f3dc..436ad6b3b2e8e 100644 --- a/pom.xml +++ b/pom.xml @@ -86,6 +86,7 @@ flexible messaging model and an intuitive client API. UTF-8 UTF-8 true + true 4 false @@ -143,8 +144,7 @@ flexible messaging model and an intuitive client API. 42.2.12 0.2.4 2.6.0 - 3.2.0 - 9.3.24.v20180605 + 3.3.0 7.9.1 332 2.11 @@ -192,7 +192,7 @@ flexible messaging model and an intuitive client API. 1.15.1 1.1.1 7.3.0 - 3.0.0 + 3.8.0 2.0.9 3.25.0-GA 2.3.1 @@ -1154,6 +1154,7 @@ flexible messaging model and an intuitive client API. -Dpulsar.allocator.pooled=false -Dpulsar.allocator.leak_detection=Advanced -Dpulsar.allocator.exit_on_oom=false + ${test.additional.args} ${testReuseFork} ${testForkCount} @@ -1626,6 +1627,15 @@ flexible messaging model and an intuitive client API. + + jdk11-tests + + [11,) + + + --add-opens java.base/jdk.internal.loader=ALL-UNNAMED + + coverage @@ -1757,6 +1767,7 @@ flexible messaging model and an intuitive client API. main true + [8,) buildtools diff --git a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/PulsarClientImplTest.java b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/PulsarClientImplTest.java index 0133ec3ac911d..5aeb981cd56f3 100644 --- a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/PulsarClientImplTest.java +++ b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/PulsarClientImplTest.java @@ -53,7 +53,7 @@ import org.apache.pulsar.common.naming.TopicName; import org.apache.pulsar.common.partition.PartitionedTopicMetadata; import org.apache.pulsar.common.util.netty.EventLoopUtil; -import org.mockito.internal.util.reflection.FieldSetter; +import org.powermock.reflect.Whitebox; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -114,8 +114,8 @@ public void testConsumerIsClosed() throws Exception { .thenReturn(CompletableFuture.completedFuture(mock(ProducerResponse.class))); when(pool.getConnection(any(InetSocketAddress.class), any(InetSocketAddress.class))) .thenReturn(CompletableFuture.completedFuture(cnx)); - FieldSetter.setField(clientImpl, clientImpl.getClass().getDeclaredField("cnxPool"), pool); - FieldSetter.setField(clientImpl, clientImpl.getClass().getDeclaredField("lookup"), lookup); + Whitebox.setInternalState(clientImpl, "cnxPool", pool); + Whitebox.setInternalState(clientImpl, "lookup", lookup); List> consumers = new ArrayList<>(); /** diff --git a/tiered-storage/file-system/pom.xml b/tiered-storage/file-system/pom.xml index bd403167f71c3..fbf70747f1226 100644 --- a/tiered-storage/file-system/pom.xml +++ b/tiered-storage/file-system/pom.xml @@ -71,22 +71,28 @@ + + + io.netty + netty-codec-http + + org.eclipse.jetty jetty-server - ${org.eclipse.jetty-hdfs-offload} + ${jetty.version} test org.eclipse.jetty jetty-servlet - ${org.eclipse.jetty-hdfs-offload} + ${jetty.version} test org.eclipse.jetty jetty-util - ${org.eclipse.jetty-hdfs-offload} + ${jetty.version} test diff --git a/tiered-storage/jcloud/pom.xml b/tiered-storage/jcloud/pom.xml index 2d41288489b80..6f365c6d95e8a 100644 --- a/tiered-storage/jcloud/pom.xml +++ b/tiered-storage/jcloud/pom.xml @@ -99,6 +99,25 @@ ${jclouds.version} provided + + + javax.xml.bind + jaxb-api + + + javax.activation + javax.activation-api + + + runtime + + + + com.sun.activation + javax.activation + runtime + +