This is an automated email from the ASF dual-hosted git repository. mmerli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git
The following commit(s) were added to refs/heads/master by this push: new 55cb351 Explicitly set zookeeper version in broker (#1132) 55cb351 is described below commit 55cb351599735e00f5ae9b14b819a031e505c811 Author: Ivan Kelly <iv...@apache.org> AuthorDate: Wed Jan 31 07:34:20 2018 +0100 Explicitly set zookeeper version in broker (#1132) * Explicitly set zookeeper version in broker The broker "shades" zookeeper via the aspectj stuff, but the version it shades is the one pulled in with bookkeeper-server, not the version specified in the top level pom. This is fairly harmless, but it breaks the pulsar zookeeper-shell command if you want to specify a zookeeper command from the commandline. This change explicitly pulls in the correct zookeeper version, excluding all the stuff that we usually exclude when pulling zookeeper. * Move to dependencyManagement Doing so stops us pulling in junit, so a test needed a fixup * changed compiler version by mistake * It actually needs netty. It pulls 3, we pull 4, they use different packages --- pom.xml | 18 +++++++++-- .../AntiAffinityNamespaceGroupTest.java | 37 +++++++++++----------- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index 29efa02..ec3effb 100644 --- a/pom.xml +++ b/pom.xml @@ -169,7 +169,6 @@ flexible messaging model and an intuitive client API.</description> <dependency> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId> - <classifier>tests</classifier> <version>${zookeeper.version}</version> <exclusions> <exclusion> @@ -180,9 +179,22 @@ flexible messaging model and an intuitive client API.</description> <artifactId>log4j</artifactId> <groupId>log4j</groupId> </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.zookeeper</groupId> + <artifactId>zookeeper</artifactId> + <classifier>tests</classifier> + <version>${zookeeper.version}</version> + <exclusions> <exclusion> - <groupId>org.jboss.netty</groupId> - <artifactId>netty</artifactId> + <artifactId>slf4j-log4j12</artifactId> + <groupId>org.slf4j</groupId> + </exclusion> + <exclusion> + <artifactId>log4j</artifactId> + <groupId>log4j</groupId> </exclusion> </exclusions> </dependency> diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/AntiAffinityNamespaceGroupTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/AntiAffinityNamespaceGroupTest.java index f8b584a..fb44cbf 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/AntiAffinityNamespaceGroupTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/AntiAffinityNamespaceGroupTest.java @@ -18,6 +18,7 @@ */ package org.apache.pulsar.broker.loadbalance; +import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertTrue; @@ -69,8 +70,6 @@ import com.google.common.collect.Range; import com.google.common.collect.Sets; import com.google.common.hash.Hashing; -import junit.framework.Assert; - public class AntiAffinityNamespaceGroupTest { private LocalBookkeeperEnsemble bkEnsemble; @@ -240,7 +239,7 @@ public class AntiAffinityNamespaceGroupTest { Set<String> candidate = Sets.newHashSet(); Map<String, Map<String, Set<String>>> brokerToNamespaceToBundleRange = Maps.newHashMap(); - Assert.assertEquals(brokers.size(), totalBrokers); + assertEquals(brokers.size(), totalBrokers); String assignedNamespace = namespace + "0" + bundle; candidate.addAll(brokers); @@ -248,7 +247,7 @@ public class AntiAffinityNamespaceGroupTest { // for namespace-0 all brokers available LoadManagerShared.filterAntiAffinityGroupOwnedBrokers(pulsar1, assignedNamespace, brokers, brokerToNamespaceToBundleRange, brokerToDomainMap); - Assert.assertEquals(brokers.size(), totalBrokers); + assertEquals(brokers.size(), totalBrokers); // add namespace-0 to broker-0 of domain-0 => state: n0->b0 selectBrokerForNamespace(brokerToNamespaceToBundleRange, "brokerName-0", namespace + "0", assignedNamespace); @@ -257,8 +256,8 @@ public class AntiAffinityNamespaceGroupTest { assignedNamespace = namespace + "1" + bundle; LoadManagerShared.filterAntiAffinityGroupOwnedBrokers(pulsar1, assignedNamespace, candidate, brokerToNamespaceToBundleRange, brokerToDomainMap); - Assert.assertEquals(candidate.size(), 2); - candidate.forEach(broker -> Assert.assertEquals(brokerToDomainMap.get(broker), "domain-1")); + assertEquals(candidate.size(), 2); + candidate.forEach(broker -> assertEquals(brokerToDomainMap.get(broker), "domain-1")); // add namespace-1 to broker-2 of domain-1 => state: n0->b0, n1->b2 selectBrokerForNamespace(brokerToNamespaceToBundleRange, "brokerName-2", namespace + "1", assignedNamespace); @@ -267,9 +266,9 @@ public class AntiAffinityNamespaceGroupTest { assignedNamespace = namespace + "2" + bundle; LoadManagerShared.filterAntiAffinityGroupOwnedBrokers(pulsar1, assignedNamespace, candidate, brokerToNamespaceToBundleRange, brokerToDomainMap); - Assert.assertEquals(candidate.size(), 2); - Assert.assertTrue(candidate.contains("brokerName-1")); - Assert.assertTrue(candidate.contains("brokerName-3")); + assertEquals(candidate.size(), 2); + assertTrue(candidate.contains("brokerName-1")); + assertTrue(candidate.contains("brokerName-3")); // add namespace-2 to broker-1 of domain-0 => state: n0->b0, n1->b2, n2->b1 selectBrokerForNamespace(brokerToNamespaceToBundleRange, "brokerName-1", namespace + "2", assignedNamespace); @@ -278,8 +277,8 @@ public class AntiAffinityNamespaceGroupTest { assignedNamespace = namespace + "3" + bundle; LoadManagerShared.filterAntiAffinityGroupOwnedBrokers(pulsar1, assignedNamespace, candidate, brokerToNamespaceToBundleRange, brokerToDomainMap); - Assert.assertEquals(candidate.size(), 1); - Assert.assertTrue(candidate.contains("brokerName-3")); + assertEquals(candidate.size(), 1); + assertTrue(candidate.contains("brokerName-3")); // add namespace-3 to broker-3 of domain-1 => state: n0->b0, n1->b2, n2->b1, n3->b3 selectBrokerForNamespace(brokerToNamespaceToBundleRange, "brokerName-3", namespace + "3", assignedNamespace); candidate.addAll(brokers); @@ -287,7 +286,7 @@ public class AntiAffinityNamespaceGroupTest { assignedNamespace = namespace + "4" + bundle; LoadManagerShared.filterAntiAffinityGroupOwnedBrokers(pulsar1, assignedNamespace, candidate, brokerToNamespaceToBundleRange, brokerToDomainMap); - Assert.assertEquals(candidate.size(), 4); + assertEquals(candidate.size(), 4); } /** @@ -335,7 +334,7 @@ public class AntiAffinityNamespaceGroupTest { candidate.addAll(brokers); LoadManagerShared.filterAntiAffinityGroupOwnedBrokers(pulsar1, assignedNamespace, brokers, brokerToNamespaceToBundleRange, null); - Assert.assertEquals(brokers.size(), 3); + assertEquals(brokers.size(), 3); // add ns-0 to broker-0 selectBrokerForNamespace(brokerToNamespaceToBundleRange, "broker-0", namespace + "0", assignedNamespace); @@ -344,9 +343,9 @@ public class AntiAffinityNamespaceGroupTest { // available brokers for ns-1 => broker-1, broker-2 LoadManagerShared.filterAntiAffinityGroupOwnedBrokers(pulsar1, assignedNamespace, candidate, brokerToNamespaceToBundleRange, null); - Assert.assertEquals(candidate.size(), 2); - Assert.assertTrue(candidate.contains("broker-1")); - Assert.assertTrue(candidate.contains("broker-2")); + assertEquals(candidate.size(), 2); + assertTrue(candidate.contains("broker-1")); + assertTrue(candidate.contains("broker-2")); // add ns-1 to broker-1 selectBrokerForNamespace(brokerToNamespaceToBundleRange, "broker-1", namespace + "1", assignedNamespace); @@ -355,8 +354,8 @@ public class AntiAffinityNamespaceGroupTest { assignedNamespace = namespace + "2" + bundle; LoadManagerShared.filterAntiAffinityGroupOwnedBrokers(pulsar1, assignedNamespace, candidate, brokerToNamespaceToBundleRange, null); - Assert.assertEquals(candidate.size(), 1); - Assert.assertTrue(candidate.contains("broker-2")); + assertEquals(candidate.size(), 1); + assertTrue(candidate.contains("broker-2")); // add ns-2 to broker-2 selectBrokerForNamespace(brokerToNamespaceToBundleRange, "broker-2", namespace + "2", assignedNamespace); @@ -365,7 +364,7 @@ public class AntiAffinityNamespaceGroupTest { assignedNamespace = namespace + "3" + bundle; LoadManagerShared.filterAntiAffinityGroupOwnedBrokers(pulsar1, assignedNamespace, candidate, brokerToNamespaceToBundleRange, null); - Assert.assertEquals(candidate.size(), 3); + assertEquals(candidate.size(), 3); } private void selectBrokerForNamespace(Map<String, Map<String, Set<String>>> brokerToNamespaceToBundleRange, -- To stop receiving notification emails like this one, please contact mme...@apache.org.