diff --git a/managed-ledger/pom.xml b/managed-ledger/pom.xml
index bbd5b27b892c7..cfaf32c01de45 100644
--- a/managed-ledger/pom.xml
+++ b/managed-ledger/pom.xml
@@ -72,6 +72,13 @@
guava
+
+ org.apache.pulsar
+ testmocks
+ ${project.version}
+ test
+
+
org.apache.zookeeper
zookeeper
diff --git a/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerBkTest.java b/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerBkTest.java
index 5a9e8d4bafc7b..d5273b901b6be 100644
--- a/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerBkTest.java
+++ b/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerBkTest.java
@@ -36,7 +36,6 @@
import org.apache.bookkeeper.client.BookKeeper;
import org.apache.bookkeeper.client.BookKeeperTestClient;
import org.apache.bookkeeper.client.api.DigestType;
-import org.apache.bookkeeper.conf.ClientConfiguration;
import org.apache.bookkeeper.mledger.AsyncCallbacks.AddEntryCallback;
import org.apache.bookkeeper.mledger.AsyncCallbacks.DeleteCallback;
import org.apache.bookkeeper.mledger.Entry;
@@ -50,7 +49,6 @@
import org.apache.bookkeeper.mledger.Position;
import org.apache.bookkeeper.test.BookKeeperClusterTestCase;
import org.apache.pulsar.common.policies.data.PersistentOfflineTopicStats;
-import org.testng.Assert;
import org.testng.annotations.Test;
public class ManagedLedgerBkTest extends BookKeeperClusterTestCase {
diff --git a/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java b/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
index d38196317857c..b185b75567b8a 100644
--- a/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
+++ b/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
@@ -46,7 +46,6 @@
import java.nio.charset.Charset;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
diff --git a/pom.xml b/pom.xml
index 59aff775ecfeb..9bdeba5a5f802 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,6 +74,7 @@ flexible messaging model and an intuitive client API.
buildtools
+ testmocks
managed-ledger
tiered-storage
pulsar-common
diff --git a/pulsar-broker-auth-athenz/pom.xml b/pulsar-broker-auth-athenz/pom.xml
index 602758bcf47cd..45a381abb9f41 100644
--- a/pulsar-broker-auth-athenz/pom.xml
+++ b/pulsar-broker-auth-athenz/pom.xml
@@ -42,10 +42,9 @@
- ${project.groupId}
- managed-ledger
+ org.apache.pulsar
+ testmocks
${project.version}
- test-jar
test
diff --git a/pulsar-broker-auth-sasl/pom.xml b/pulsar-broker-auth-sasl/pom.xml
index c393ccc4a6407..7fc0997c695d8 100644
--- a/pulsar-broker-auth-sasl/pom.xml
+++ b/pulsar-broker-auth-sasl/pom.xml
@@ -83,18 +83,9 @@
- ${project.groupId}
- managed-ledger
+ org.apache.pulsar
+ testmocks
${project.version}
- test-jar
- test
-
-
-
- ${project.groupId}
- pulsar-zookeeper-utils
- ${project.version}
- test-jar
test
diff --git a/pulsar-broker-common/pom.xml b/pulsar-broker-common/pom.xml
index da8576e113844..cbec267f4da57 100644
--- a/pulsar-broker-common/pom.xml
+++ b/pulsar-broker-common/pom.xml
@@ -38,12 +38,6 @@
pulsar-zookeeper-utils
${project.version}
-
-
- ${project.groupId}
- pulsar-common
- ${project.version}
-
com.google.guava
diff --git a/pulsar-broker/pom.xml b/pulsar-broker/pom.xml
index 5df3fcb5a4ed6..dece2f82ee2fe 100644
--- a/pulsar-broker/pom.xml
+++ b/pulsar-broker/pom.xml
@@ -119,6 +119,13 @@
${project.version}
+
+ org.apache.pulsar
+ testmocks
+ ${project.version}
+ test
+
+
${project.groupId}
managed-ledger
diff --git a/pulsar-client-kafka-compat/pulsar-client-kafka-tests/pom.xml b/pulsar-client-kafka-compat/pulsar-client-kafka-tests/pom.xml
index 6ccd8b8a13321..a883b83813372 100644
--- a/pulsar-client-kafka-compat/pulsar-client-kafka-tests/pom.xml
+++ b/pulsar-client-kafka-compat/pulsar-client-kafka-tests/pom.xml
@@ -59,12 +59,12 @@
- ${project.groupId}
- managed-ledger
+ org.apache.pulsar
+ testmocks
${project.version}
test
- test-jar
+
diff --git a/pulsar-client-kafka-compat/pulsar-client-kafka-tests_0_8/pom.xml b/pulsar-client-kafka-compat/pulsar-client-kafka-tests_0_8/pom.xml
index d9c6b3e75ba23..cf315c8c5cd8c 100644
--- a/pulsar-client-kafka-compat/pulsar-client-kafka-tests_0_8/pom.xml
+++ b/pulsar-client-kafka-compat/pulsar-client-kafka-tests_0_8/pom.xml
@@ -59,11 +59,10 @@
- ${project.groupId}
- managed-ledger
+ org.apache.pulsar
+ testmocks
${project.version}
test
- test-jar
diff --git a/pulsar-client-kafka-compat/pulsar-client-kafka-tests_0_9/pom.xml b/pulsar-client-kafka-compat/pulsar-client-kafka-tests_0_9/pom.xml
index 6ac87b866911a..a6de6e3810cf9 100644
--- a/pulsar-client-kafka-compat/pulsar-client-kafka-tests_0_9/pom.xml
+++ b/pulsar-client-kafka-compat/pulsar-client-kafka-tests_0_9/pom.xml
@@ -59,11 +59,10 @@
- ${project.groupId}
- managed-ledger
+ org.apache.pulsar
+ testmocks
${project.version}
test
- test-jar
diff --git a/pulsar-client-kafka-compat/pulsar-client-kafka_0_8/pom.xml b/pulsar-client-kafka-compat/pulsar-client-kafka_0_8/pom.xml
index b1e3105ac1c9f..8d35f2d265d33 100644
--- a/pulsar-client-kafka-compat/pulsar-client-kafka_0_8/pom.xml
+++ b/pulsar-client-kafka-compat/pulsar-client-kafka_0_8/pom.xml
@@ -66,14 +66,12 @@
- ${project.groupId}
- managed-ledger
+ org.apache.pulsar
+ testmocks
${project.version}
- test-jar
test
-
${project.groupId}
pulsar-client
diff --git a/pulsar-client-tools-test/pom.xml b/pulsar-client-tools-test/pom.xml
index 7eb85a51fd0a0..2270c0f6b96b2 100644
--- a/pulsar-client-tools-test/pom.xml
+++ b/pulsar-client-tools-test/pom.xml
@@ -39,10 +39,9 @@
${project.version}
- ${project.groupId}
- managed-ledger
+ org.apache.pulsar
+ testmocks
${project.version}
- test-jar
test
@@ -58,12 +57,6 @@
${project.version}
test
-
- ${project.groupId}
- pulsar-zookeeper-utils
- ${project.version}
- test
-
diff --git a/pulsar-discovery-service/pom.xml b/pulsar-discovery-service/pom.xml
index 978c81df7f381..9cb162742af19 100644
--- a/pulsar-discovery-service/pom.xml
+++ b/pulsar-discovery-service/pom.xml
@@ -50,21 +50,6 @@
${project.version}
-
- ${project.groupId}
- managed-ledger
- ${project.parent.version}
- test
-
-
-
- ${project.groupId}
- managed-ledger
- ${project.parent.version}
- test-jar
- test
-
-
${project.groupId}
pulsar-common
@@ -143,11 +128,11 @@
- ${project.groupId}
- pulsar-zookeeper-utils
+ org.apache.pulsar
+ testmocks
${project.version}
test
- test-jar
+
diff --git a/pulsar-io/debezium/core/pom.xml b/pulsar-io/debezium/core/pom.xml
index 737b9a4f5b23e..1d21b7d9c419f 100644
--- a/pulsar-io/debezium/core/pom.xml
+++ b/pulsar-io/debezium/core/pom.xml
@@ -76,18 +76,9 @@
- ${project.groupId}
- managed-ledger
+ org.apache.pulsar
+ testmocks
${project.version}
- test-jar
- test
-
-
-
- ${project.groupId}
- pulsar-zookeeper-utils
- ${project.version}
- test-jar
test
diff --git a/pulsar-io/kafka-connect-adaptor/pom.xml b/pulsar-io/kafka-connect-adaptor/pom.xml
index 911a4bffc6cae..854489b473637 100644
--- a/pulsar-io/kafka-connect-adaptor/pom.xml
+++ b/pulsar-io/kafka-connect-adaptor/pom.xml
@@ -83,18 +83,9 @@
- ${project.groupId}
- managed-ledger
+ org.apache.pulsar
+ testmocks
${project.version}
- test-jar
- test
-
-
-
- ${project.groupId}
- pulsar-zookeeper-utils
- ${project.version}
- test-jar
test
diff --git a/pulsar-proxy/pom.xml b/pulsar-proxy/pom.xml
index a9e3ae353001a..b5e60ecbb7eca 100644
--- a/pulsar-proxy/pom.xml
+++ b/pulsar-proxy/pom.xml
@@ -155,10 +155,9 @@
- ${project.groupId}
- managed-ledger
+ org.apache.pulsar
+ testmocks
${project.version}
- test-jar
test
diff --git a/pulsar-testclient/pom.xml b/pulsar-testclient/pom.xml
index 52ce108dca1bf..f7098dae4ebac 100644
--- a/pulsar-testclient/pom.xml
+++ b/pulsar-testclient/pom.xml
@@ -35,44 +35,51 @@
- ${project.groupId}
- managed-ledger
+ org.apache.pulsar
+ testmocks
${project.version}
- test-jar
test
+
org.apache.zookeeper
zookeeper
${zookeeper.version}
-
- ${project.groupId}
- pulsar-client-admin-original
- ${project.version}
-
+
+
+ ${project.groupId}
+ pulsar-client-admin-original
+ ${project.version}
+
+
${project.groupId}
pulsar-client-original
${project.version}
+
${project.groupId}
pulsar-broker
${project.version}
+
commons-configuration
commons-configuration
+
com.beust
jcommander
compile
-
- org.hdrhistogram
- HdrHistogram
-
+
+
+ org.hdrhistogram
+ HdrHistogram
+
+
diff --git a/pulsar-zookeeper-utils/pom.xml b/pulsar-zookeeper-utils/pom.xml
index 7087b2a46c2ef..c908b14f9c363 100644
--- a/pulsar-zookeeper-utils/pom.xml
+++ b/pulsar-zookeeper-utils/pom.xml
@@ -78,12 +78,11 @@
test
-
- ${project.groupId}
- managed-ledger
- tests
+
+ org.apache.pulsar
+ testmocks
+ ${project.version}
test
- ${project.parent.version}
@@ -107,21 +106,6 @@
simpleclient_caffeine
-
- ${project.groupId}
- managed-ledger
- ${project.parent.version}
- test
-
-
-
- ${project.groupId}
- managed-ledger
- ${project.parent.version}
- test-jar
- test
-
-
diff --git a/pulsar-zookeeper-utils/src/test/java/org/apache/pulsar/zookeeper/ZookeeperServerTest.java b/pulsar-zookeeper-utils/src/test/java/org/apache/pulsar/zookeeper/ZookeeperServerTest.java
index 696675c5134dc..2f41f0d442536 100644
--- a/pulsar-zookeeper-utils/src/test/java/org/apache/pulsar/zookeeper/ZookeeperServerTest.java
+++ b/pulsar-zookeeper-utils/src/test/java/org/apache/pulsar/zookeeper/ZookeeperServerTest.java
@@ -23,7 +23,6 @@
import java.io.IOException;
import java.net.InetSocketAddress;
-import org.apache.pulsar.zookeeper.LocalBookkeeperEnsemble;
import org.apache.zookeeper.server.NIOServerCnxnFactory;
import org.apache.zookeeper.server.ZooKeeperServer;
import org.slf4j.Logger;
diff --git a/testmocks/pom.xml b/testmocks/pom.xml
new file mode 100644
index 0000000000000..4c55c786d136a
--- /dev/null
+++ b/testmocks/pom.xml
@@ -0,0 +1,60 @@
+
+
+ 4.0.0
+
+
+ pulsar
+ org.apache.pulsar
+ 2.6.0-SNAPSHOT
+
+
+ org.apache.pulsar
+ testmocks
+ 2.6.0-SNAPSHOT
+ jar
+ Pulsar Test Mocks
+
+
+
+
+ org.apache.zookeeper
+ zookeeper
+
+
+
+ org.apache.bookkeeper
+ bookkeeper-server
+
+
+
+ org.apache.commons
+ commons-lang3
+
+
+
+ org.testng
+ testng
+
+
+
+
diff --git a/managed-ledger/src/test/java/org/apache/bookkeeper/client/BookKeeperTestClient.java b/testmocks/src/main/java/org/apache/bookkeeper/client/BookKeeperTestClient.java
similarity index 100%
rename from managed-ledger/src/test/java/org/apache/bookkeeper/client/BookKeeperTestClient.java
rename to testmocks/src/main/java/org/apache/bookkeeper/client/BookKeeperTestClient.java
diff --git a/managed-ledger/src/test/java/org/apache/bookkeeper/client/PulsarMockBookKeeper.java b/testmocks/src/main/java/org/apache/bookkeeper/client/PulsarMockBookKeeper.java
similarity index 99%
rename from managed-ledger/src/test/java/org/apache/bookkeeper/client/PulsarMockBookKeeper.java
rename to testmocks/src/main/java/org/apache/bookkeeper/client/PulsarMockBookKeeper.java
index f7e9cd8aae135..9adf99ce5a6bb 100644
--- a/managed-ledger/src/test/java/org/apache/bookkeeper/client/PulsarMockBookKeeper.java
+++ b/testmocks/src/main/java/org/apache/bookkeeper/client/PulsarMockBookKeeper.java
@@ -33,13 +33,11 @@
import org.apache.bookkeeper.client.AsyncCallback.CreateCallback;
import org.apache.bookkeeper.client.AsyncCallback.DeleteCallback;
import org.apache.bookkeeper.client.AsyncCallback.OpenCallback;
-import org.apache.bookkeeper.client.BKException.Code;
import org.apache.bookkeeper.client.api.OpenBuilder;
import org.apache.bookkeeper.client.api.ReadHandle;
import org.apache.bookkeeper.client.impl.OpenBuilderBase;
import org.apache.bookkeeper.common.concurrent.FutureUtils;
import org.apache.bookkeeper.conf.ClientConfiguration;
-import org.apache.bookkeeper.net.BookieSocketAddress;
import org.apache.zookeeper.ZooKeeper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/managed-ledger/src/test/java/org/apache/bookkeeper/client/PulsarMockLedgerHandle.java b/testmocks/src/main/java/org/apache/bookkeeper/client/PulsarMockLedgerHandle.java
similarity index 99%
rename from managed-ledger/src/test/java/org/apache/bookkeeper/client/PulsarMockLedgerHandle.java
rename to testmocks/src/main/java/org/apache/bookkeeper/client/PulsarMockLedgerHandle.java
index 51598511df5dd..e909dc86eee89 100644
--- a/managed-ledger/src/test/java/org/apache/bookkeeper/client/PulsarMockLedgerHandle.java
+++ b/testmocks/src/main/java/org/apache/bookkeeper/client/PulsarMockLedgerHandle.java
@@ -27,7 +27,6 @@
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.EnumSet;
import java.util.Enumeration;
import java.util.List;
import java.util.Queue;
@@ -190,7 +189,7 @@ public void asyncAddEntry(final ByteBuf data, final AddCallback cb, final Object
if (exception != null) {
fenced = true;
cb.addComplete(PulsarMockBookKeeper.getExceptionCode(exception),
- PulsarMockLedgerHandle.this, INVALID_ENTRY_ID, ctx);
+ PulsarMockLedgerHandle.this, LedgerHandle.INVALID_ENTRY_ID, ctx);
} else {
cb.addComplete(BKException.Code.OK, PulsarMockLedgerHandle.this, entryId, ctx);
}
diff --git a/managed-ledger/src/test/java/org/apache/bookkeeper/client/PulsarMockReadHandle.java b/testmocks/src/main/java/org/apache/bookkeeper/client/PulsarMockReadHandle.java
similarity index 100%
rename from managed-ledger/src/test/java/org/apache/bookkeeper/client/PulsarMockReadHandle.java
rename to testmocks/src/main/java/org/apache/bookkeeper/client/PulsarMockReadHandle.java
diff --git a/managed-ledger/src/test/java/org/apache/zookeeper/MockZooKeeper.java b/testmocks/src/main/java/org/apache/zookeeper/MockZooKeeper.java
similarity index 100%
rename from managed-ledger/src/test/java/org/apache/zookeeper/MockZooKeeper.java
rename to testmocks/src/main/java/org/apache/zookeeper/MockZooKeeper.java
diff --git a/tests/pulsar-storm-test/pom.xml b/tests/pulsar-storm-test/pom.xml
index c21ee88be547d..942fafd0182a9 100644
--- a/tests/pulsar-storm-test/pom.xml
+++ b/tests/pulsar-storm-test/pom.xml
@@ -82,9 +82,8 @@
org.apache.pulsar
- managed-ledger
+ testmocks
${project.version}
- test-jar
test
diff --git a/tiered-storage/file-system/pom.xml b/tiered-storage/file-system/pom.xml
index 2956d7bbba5eb..11b515e541fe8 100644
--- a/tiered-storage/file-system/pom.xml
+++ b/tiered-storage/file-system/pom.xml
@@ -52,13 +52,14 @@
protobuf-java
${protobuf3.version}
+
org.apache.pulsar
- managed-ledger
+ testmocks
${project.version}
- test-jar
test
+
org.apache.hadoop
hadoop-minicluster
diff --git a/tiered-storage/jcloud/pom.xml b/tiered-storage/jcloud/pom.xml
index 47896ae7573dc..17698c6521936 100644
--- a/tiered-storage/jcloud/pom.xml
+++ b/tiered-storage/jcloud/pom.xml
@@ -61,9 +61,8 @@
org.apache.pulsar
- managed-ledger
+ testmocks
${project.version}
- test-jar
test