Skip to content

Commit

Permalink
[Maven Cleanup] Remove managed-ledger and zk-utils test-jar dependenc…
Browse files Browse the repository at this point in the history
…ies when possible (apache#6513)

Currently, many modules depend on `managed-ledger-test.jar` just because they want to use MockBookkeeper and MockZookeeper.  This made module dependencies hard to understand and track.

This PR introduces a new `testmocks` module and pulls all mocks from managed-ledger tests into the new module.
  • Loading branch information
yjshen authored Mar 11, 2020
1 parent a9d56ea commit efe19e0
Show file tree
Hide file tree
Showing 29 changed files with 128 additions and 131 deletions.
7 changes: 7 additions & 0 deletions managed-ledger/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@
<artifactId>guava</artifactId>
</dependency>

<dependency>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ flexible messaging model and an intuitive client API.</description>

<modules>
<module>buildtools</module>
<module>testmocks</module>
<module>managed-ledger</module>
<module>tiered-storage</module>
<module>pulsar-common</module>
Expand Down
5 changes: 2 additions & 3 deletions pulsar-broker-auth-athenz/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

Expand Down
13 changes: 2 additions & 11 deletions pulsar-broker-auth-sasl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,9 @@
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-zookeeper-utils</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

Expand Down
6 changes: 0 additions & 6 deletions pulsar-broker-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@
<artifactId>pulsar-zookeeper-utils</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-common</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
Expand Down
7 changes: 7 additions & 0 deletions pulsar-broker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions pulsar-client-kafka-compat/pulsar-client-kafka-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>
</dependencies>

Expand Down
6 changes: 2 additions & 4 deletions pulsar-client-kafka-compat/pulsar-client-kafka_0_8/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,12 @@
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>


<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-client</artifactId>
Expand Down
11 changes: 2 additions & 9 deletions pulsar-client-tools-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -58,12 +57,6 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-zookeeper-utils</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
21 changes: 3 additions & 18 deletions pulsar-discovery-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,6 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<version>${project.parent.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-common</artifactId>
Expand Down Expand Up @@ -143,11 +128,11 @@
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-zookeeper-utils</artifactId>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>

</dependencies>
</project>
13 changes: 2 additions & 11 deletions pulsar-io/debezium/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,9 @@
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-zookeeper-utils</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

Expand Down
13 changes: 2 additions & 11 deletions pulsar-io/kafka-connect-adaptor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,9 @@
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-zookeeper-utils</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

Expand Down
5 changes: 2 additions & 3 deletions pulsar-proxy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,9 @@
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

Expand Down
31 changes: 19 additions & 12 deletions pulsar-testclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,44 +35,51 @@

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>${zookeeper.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-client-admin-original</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-client-admin-original</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-client-original</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pulsar-broker</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
</dependency>

<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hdrhistogram</groupId>
<artifactId>HdrHistogram</artifactId>
</dependency>

<dependency>
<groupId>org.hdrhistogram</groupId>
<artifactId>HdrHistogram</artifactId>
</dependency>

</dependencies>
</project>
24 changes: 4 additions & 20 deletions pulsar-zookeeper-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<classifier>tests</classifier>
<dependency>
<groupId>org.apache.pulsar</groupId>
<artifactId>testmocks</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<version>${project.parent.version}</version>
</dependency>

<dependency>
Expand All @@ -107,21 +106,6 @@
<artifactId>simpleclient_caffeine</artifactId>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>managed-ledger</artifactId>
<version>${project.parent.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit efe19e0

Please sign in to comment.