merlimat closed pull request #1494:  In Namespace.addClusters and 
Properties.addRoles changed dataType to Set
URL: https://github.com/apache/incubator-pulsar/pull/1494
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java 
b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java
index 5114e36e1..68c307aa3 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java
@@ -230,7 +230,7 @@ void start() throws Exception {
 
             if (!admin.properties().getProperties().contains(property)) {
                 admin.properties().createProperty(property,
-                        new 
PropertyAdmin(Lists.newArrayList(config.getSuperUserRoles()), 
Sets.newHashSet(cluster)));
+                        new 
PropertyAdmin(Sets.newHashSet(config.getSuperUserRoles()), 
Sets.newHashSet(cluster)));
             }
 
             if 
(!admin.namespaces().getNamespaces(property).contains(namespace)) {
diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
index 2f2f63ea3..0fe5fd877 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
@@ -141,7 +141,7 @@ protected void internalDeleteNamespace(boolean 
authoritative) {
                 if (policies.replication_clusters.size() == 1
                         && 
!policies.replication_clusters.contains(config().getClusterName())) {
                     // the only replication cluster is other cluster, redirect
-                    String replCluster = policies.replication_clusters.get(0);
+                    String replCluster = 
Lists.newArrayList(policies.replication_clusters).get(0);
                     ClusterData replClusterData = 
clustersCache().get(AdminResource.path("clusters", replCluster))
                             .orElseThrow(() -> new 
RestException(Status.NOT_FOUND,
                                     "Cluster " + replCluster + " does not 
exist"));
@@ -242,7 +242,7 @@ protected void internalDeleteNamespaceBundle(String 
bundleRange, boolean authori
                 if (policies.replication_clusters.size() == 1
                         && 
!policies.replication_clusters.contains(config().getClusterName())) {
                     // the only replication cluster is other cluster, redirect
-                    String replCluster = policies.replication_clusters.get(0);
+                    String replCluster = 
Lists.newArrayList(policies.replication_clusters).get(0);
                     ClusterData replClusterData = 
clustersCache().get(AdminResource.path("clusters", replCluster))
                             .orElseThrow(() -> new 
RestException(Status.NOT_FOUND,
                                     "Cluser " + replCluster + " does not 
exist"));
@@ -346,7 +346,7 @@ protected void internalRevokePermissionsOnNamespace(String 
role) {
         }
     }
 
-    protected List<String> internalGetNamespaceReplicationClusters() {
+    protected Set<String> internalGetNamespaceReplicationClusters() {
         if (!namespaceName.isGlobal()) {
             throw new RestException(Status.PRECONDITION_FAILED,
                     "Cannot get the replication clusters for a non-global 
namespace");
@@ -388,7 +388,7 @@ protected void 
internalSetNamespaceReplicationClusters(List<String> clusterIds)
             // Force to read the data s.t. the watch to the cache content is 
setup.
             policiesNode = policiesCache().getWithStat(path(POLICIES, 
namespaceName.toString())).orElseThrow(
                     () -> new RestException(Status.NOT_FOUND, "Namespace " + 
namespaceName + " does not exist"));
-            policiesNode.getKey().replication_clusters = clusterIds;
+            policiesNode.getKey().replication_clusters = replicationClusterSet;
 
             // Write back the new policies into zookeeper
             globalZk().setData(path(POLICIES, namespaceName.toString()),
diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/Namespaces.java 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/Namespaces.java
index eae555951..1a1ad70dd 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/Namespaces.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/Namespaces.java
@@ -249,7 +249,7 @@ public void 
revokePermissionsOnNamespace(@PathParam("property") String property,
     @ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have 
admin permission"),
             @ApiResponse(code = 404, message = "Property or cluster or 
namespace doesn't exist"),
             @ApiResponse(code = 412, message = "Namespace is not global") })
-    public List<String> getNamespaceReplicationClusters(@PathParam("property") 
String property,
+    public Set<String> getNamespaceReplicationClusters(@PathParam("property") 
String property,
             @PathParam("cluster") String cluster, @PathParam("namespace") 
String namespace) {
         validateAdminAccessOnProperty(property);
         validateNamespaceName(property, cluster, namespace);
diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Namespaces.java 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Namespaces.java
index a22baaced..bf0b2551d 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Namespaces.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Namespaces.java
@@ -184,7 +184,7 @@ public void 
revokePermissionsOnNamespace(@PathParam("property") String property,
     @ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have 
admin permission"),
             @ApiResponse(code = 404, message = "Property or cluster or 
namespace doesn't exist"),
             @ApiResponse(code = 412, message = "Namespace is not global") })
-    public List<String> getNamespaceReplicationClusters(@PathParam("property") 
String property,
+    public Set<String> getNamespaceReplicationClusters(@PathParam("property") 
String property,
             @PathParam("namespace") String namespace) {
         validateAdminAccessOnProperty(property);
         validateNamespaceName(property, namespace);
diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
index 9eb7ce7d0..19c486441 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
@@ -532,7 +532,7 @@ void removeSubscription(String subscriptionName) {
 
         Set<String> configuredClusters;
         if (policies.replication_clusters != null) {
-            configuredClusters = 
Sets.newTreeSet(policies.replication_clusters);
+            configuredClusters = policies.replication_clusters;
         } else {
             configuredClusters = Collections.emptySet();
         }
diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java
index b6e7481ae..14779c805 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java
@@ -607,7 +607,7 @@ protected void 
validateGlobalNamespaceOwnership(NamespaceName namespace) {
         return validationFuture;
     }
 
-    private static ClusterData getOwnerFromPeerClusterList(PulsarService 
pulsar, List<String> replicationClusters) {
+    private static ClusterData getOwnerFromPeerClusterList(PulsarService 
pulsar, Set<String> replicationClusters) {
         String currentCluster = pulsar.getConfiguration().getClusterName();
         if (replicationClusters == null || replicationClusters.isEmpty() || 
isBlank(currentCluster)) {
             return null;
@@ -619,9 +619,8 @@ private static ClusterData 
getOwnerFromPeerClusterList(PulsarService pulsar, Lis
             if (!cluster.isPresent() || cluster.get().getPeerClusterNames() == 
null) {
                 return null;
             }
-            Set<String> replicationClusterSet = 
Sets.newHashSet(replicationClusters);
             for (String peerCluster : cluster.get().getPeerClusterNames()) {
-                if (replicationClusterSet.contains(peerCluster)) {
+                if (replicationClusters.contains(peerCluster)) {
                     return 
pulsar.getConfigurationCache().clustersCache().get(path("clusters", 
peerCluster))
                             .orElseThrow(() -> new 
RestException(Status.NOT_FOUND,
                                     "Peer cluster " + peerCluster + " data not 
found"));
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/SLAMonitoringTest.java 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/SLAMonitoringTest.java
index 81da3e07f..d60712568 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/SLAMonitoringTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/SLAMonitoringTest.java
@@ -25,7 +25,6 @@
 
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -118,7 +117,7 @@ private void createProperty(PulsarAdmin pulsarAdmin)
         allowedClusters.add("my-cluster");
         PropertyAdmin adminConfig = new PropertyAdmin();
         adminConfig.setAllowedClusters(allowedClusters);
-        List<String> adminRoles = new ArrayList<>();
+        Set<String> adminRoles = new HashSet<>();
         adminRoles.add("");
         adminConfig.setAdminRoles(adminRoles);
         pulsarAdmin.properties().createProperty("sla-monitor", adminConfig);
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest.java 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest.java
index 426a04cca..cb18e8075 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest.java
@@ -35,7 +35,6 @@
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
-import java.util.concurrent.Callable;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -44,7 +43,6 @@
 import javax.ws.rs.client.InvocationCallback;
 import javax.ws.rs.client.WebTarget;
 
-import lombok.extern.slf4j.Slf4j;
 import org.apache.pulsar.broker.PulsarServerException;
 import org.apache.pulsar.broker.PulsarService;
 import org.apache.pulsar.broker.ServiceConfiguration;
@@ -61,7 +59,6 @@
 import org.apache.pulsar.client.admin.internal.LookupImpl;
 import org.apache.pulsar.client.admin.internal.PersistentTopicsImpl;
 import org.apache.pulsar.client.admin.internal.PropertiesImpl;
-import org.apache.pulsar.client.api.ClientConfiguration;
 import org.apache.pulsar.client.api.Consumer;
 import org.apache.pulsar.client.api.ConsumerBuilder;
 import org.apache.pulsar.client.api.Message;
@@ -111,6 +108,8 @@
 import com.google.common.collect.Sets;
 import com.google.common.hash.Hashing;
 
+import lombok.extern.slf4j.Slf4j;
+
 @Slf4j
 public class AdminApiTest extends MockedPulsarServiceBaseTest {
 
@@ -152,7 +151,7 @@ public void setup() throws Exception {
 
         // Setup namespaces
         admin.clusters().createCluster("use", new 
ClusterData("http://127.0.0.1"; + ":" + BROKER_WEBSERVICE_PORT));
-        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Lists.newArrayList("role1", "role2"), Sets.newHashSet("use"));
+        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Sets.newHashSet("role1", "role2"), Sets.newHashSet("use"));
         admin.properties().createProperty("prop-xyz", propertyAdmin);
         admin.namespaces().createNamespace("prop-xyz/use/ns1");
     }
@@ -555,14 +554,14 @@ public void testGetDynamicLocalConfiguration() throws 
Exception {
     @Test(enabled = true)
     public void properties() throws PulsarAdminException {
         Set<String> allowedClusters = Sets.newHashSet("use");
-        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Lists.newArrayList("role1", "role2"), allowedClusters);
+        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Sets.newHashSet("role1", "role2"), allowedClusters);
         admin.properties().updateProperty("prop-xyz", propertyAdmin);
 
         assertEquals(admin.properties().getProperties(), 
Lists.newArrayList("prop-xyz"));
 
         assertEquals(admin.properties().getPropertyAdmin("prop-xyz"), 
propertyAdmin);
 
-        PropertyAdmin newPropertyAdmin = new 
PropertyAdmin(Lists.newArrayList("role3", "role4"), allowedClusters);
+        PropertyAdmin newPropertyAdmin = new 
PropertyAdmin(Sets.newHashSet("role3", "role4"), allowedClusters);
         admin.properties().updateProperty("prop-xyz", newPropertyAdmin);
 
         assertEquals(admin.properties().getPropertyAdmin("prop-xyz"), 
newPropertyAdmin);
@@ -583,7 +582,7 @@ public void properties() throws PulsarAdminException {
     @Test(invocationCount = 1)
     public void namespaces() throws PulsarAdminException, 
PulsarServerException, Exception {
         admin.clusters().createCluster("usw", new ClusterData());
-        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Lists.newArrayList("role1", "role2"),
+        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Sets.newHashSet("role1", "role2"),
                 Sets.newHashSet("use", "usw"));
         admin.properties().updateProperty("prop-xyz", propertyAdmin);
 
@@ -1615,7 +1614,7 @@ public void testObjectWithUnknowProperties() {
             public int newProperty;
         }
 
-        PropertyAdmin pa = new PropertyAdmin(Lists.newArrayList("test_appid1", 
"test_appid2"), Sets.newHashSet("use"));
+        PropertyAdmin pa = new PropertyAdmin(Sets.newHashSet("test_appid1", 
"test_appid2"), Sets.newHashSet("use"));
         CustomPropertyAdmin cpa = new CustomPropertyAdmin();
         cpa.setAdminRoles(pa.getAdminRoles());
         cpa.setAllowedClusters(pa.getAllowedClusters());
@@ -1877,7 +1876,7 @@ public PulsarAdmin getAdmin() {
     @Test
     public void testTopicBundleRangeLookup() throws PulsarAdminException, 
PulsarServerException, Exception {
         admin.clusters().createCluster("usw", new ClusterData());
-        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Lists.newArrayList("role1", "role2"),
+        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Sets.newHashSet("role1", "role2"),
                 Sets.newHashSet("use", "usw"));
         admin.properties().updateProperty("prop-xyz", propertyAdmin);
         admin.namespaces().createNamespace("prop-xyz/use/getBundleNs", 100);
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest2.java 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest2.java
index 44b7bf600..e9076222f 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest2.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest2.java
@@ -88,7 +88,7 @@ public void setup() throws Exception {
 
         // Setup namespaces
         admin.clusters().createCluster("use", new 
ClusterData("http://127.0.0.1"; + ":" + BROKER_WEBSERVICE_PORT));
-        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Lists.newArrayList("role1", "role2"), Sets.newHashSet("use"));
+        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Sets.newHashSet("role1", "role2"), Sets.newHashSet("use"));
         admin.properties().createProperty("prop-xyz", propertyAdmin);
         admin.namespaces().createNamespace("prop-xyz/use/ns1");
     }
@@ -599,7 +599,7 @@ public void testReplicationPeerCluster() throws Exception {
         final String property = "peer-prop";
         Set<String> allowedClusters = Sets.newHashSet("us-west1", "us-west2", 
"us-west3", "us-west4", "us-east1",
                 "us-east2");
-        PropertyAdmin propConfig = new 
PropertyAdmin(Lists.newArrayList("test"), allowedClusters);
+        PropertyAdmin propConfig = new PropertyAdmin(Sets.newHashSet("test"), 
allowedClusters);
         admin.properties().createProperty(property, propConfig);
 
         final String namespace = property + "/global/conflictPeer";
@@ -611,11 +611,11 @@ public void testReplicationPeerCluster() throws Exception 
{
                 Lists.newArrayList("us-west2", "us-west3"));
 
         // (1) no conflicting peer
-        List<String> clusterIds = Lists.newArrayList("us-east1", "us-east2");
+        Set<String> clusterIds = Sets.newHashSet("us-east1", "us-east2");
         admin.namespaces().setNamespaceReplicationClusters(namespace, 
clusterIds);
 
         // (2) conflicting peer
-        clusterIds = Lists.newArrayList("us-west2", "us-west3", "us-west1");
+        clusterIds = Sets.newHashSet("us-west2", "us-west3", "us-west1");
         try {
             admin.namespaces().setNamespaceReplicationClusters(namespace, 
clusterIds);
             fail("Peer-cluster can't coexist in replication cluster list");
@@ -623,11 +623,11 @@ public void testReplicationPeerCluster() throws Exception 
{
             // Ok
         }
 
-        clusterIds = Lists.newArrayList("us-west2", "us-west3");
+        clusterIds = Sets.newHashSet("us-west2", "us-west3");
         // no peer coexist in replication clusters
         admin.namespaces().setNamespaceReplicationClusters(namespace, 
clusterIds);
 
-        clusterIds = Lists.newArrayList("us-west1", "us-west4");
+        clusterIds = Sets.newHashSet("us-west1", "us-west4");
         // no peer coexist in replication clusters
         admin.namespaces().setNamespaceReplicationClusters(namespace, 
clusterIds);
     }
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminTest.java 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminTest.java
index 953fa683f..89f49f009 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminTest.java
@@ -52,9 +52,9 @@
 import org.apache.pulsar.broker.admin.v1.BrokerStats;
 import org.apache.pulsar.broker.admin.v1.Brokers;
 import org.apache.pulsar.broker.admin.v1.Clusters;
-import org.apache.pulsar.broker.admin.v1.Properties;
 import org.apache.pulsar.broker.admin.v1.Namespaces;
 import org.apache.pulsar.broker.admin.v1.PersistentTopics;
+import org.apache.pulsar.broker.admin.v1.Properties;
 import org.apache.pulsar.broker.admin.v1.ResourceQuotas;
 import org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest;
 import org.apache.pulsar.broker.cache.ConfigurationCacheService;
@@ -358,7 +358,7 @@ void properties() throws Exception {
         verify(properties, times(1)).validateSuperUserAccess();
 
         Set<String> allowedClusters = Sets.newHashSet();
-        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Lists.newArrayList("role1", "role2"), allowedClusters);
+        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Sets.newHashSet("role1", "role2"), allowedClusters);
         properties.createProperty("test-property", propertyAdmin);
         verify(properties, times(2)).validateSuperUserAccess();
 
@@ -368,7 +368,7 @@ void properties() throws Exception {
         assertEquals(properties.getPropertyAdmin("test-property"), 
propertyAdmin);
         verify(properties, times(4)).validateSuperUserAccess();
 
-        PropertyAdmin newPropertyAdmin = new 
PropertyAdmin(Lists.newArrayList("role1", "other-role"), allowedClusters);
+        PropertyAdmin newPropertyAdmin = new 
PropertyAdmin(Sets.newHashSet("role1", "other-role"), allowedClusters);
         properties.updateProperty("test-property", newPropertyAdmin);
         verify(properties, times(5)).validateSuperUserAccess();
 
@@ -466,7 +466,7 @@ void properties() throws Exception {
 
         // Create a namespace to test deleting a non-empty property
         clusters.createCluster("use", new ClusterData());
-        newPropertyAdmin = new PropertyAdmin(Lists.newArrayList("role1", 
"other-role"), Sets.newHashSet("use"));
+        newPropertyAdmin = new PropertyAdmin(Sets.newHashSet("role1", 
"other-role"), Sets.newHashSet("use"));
         properties.createProperty("my-property", newPropertyAdmin);
 
         namespaces.createNamespace("my-property", "use", "my-namespace", new 
BundlesData());
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/IncrementPartitionsTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/IncrementPartitionsTest.java
index 60f204494..3ffccfe6e 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/IncrementPartitionsTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/IncrementPartitionsTest.java
@@ -50,7 +50,7 @@ public void setup() throws Exception {
 
         // Setup namespaces
         admin.clusters().createCluster("use", new 
ClusterData("http://127.0.0.1"; + ":" + BROKER_WEBSERVICE_PORT));
-        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Lists.newArrayList("role1", "role2"), Sets.newHashSet("use"));
+        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Sets.newHashSet("role1", "role2"), Sets.newHashSet("use"));
         admin.properties().createProperty("prop-xyz", propertyAdmin);
         admin.namespaces().createNamespace("prop-xyz/use/ns1");
     }
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespacesTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespacesTest.java
index 0fc54b10f..374797bd8 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespacesTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespacesTest.java
@@ -57,10 +57,10 @@
 import org.apache.pulsar.broker.web.RestException;
 import org.apache.pulsar.client.admin.PulsarAdminException;
 import org.apache.pulsar.client.api.Producer;
-import org.apache.pulsar.common.naming.TopicName;
 import org.apache.pulsar.common.naming.NamespaceBundle;
 import org.apache.pulsar.common.naming.NamespaceBundles;
 import org.apache.pulsar.common.naming.NamespaceName;
+import org.apache.pulsar.common.naming.TopicName;
 import org.apache.pulsar.common.policies.data.AuthAction;
 import org.apache.pulsar.common.policies.data.BundlesData;
 import org.apache.pulsar.common.policies.data.ClusterData;
@@ -141,7 +141,7 @@ public void setup() throws Exception {
         admin.clusters().createCluster("usw", new 
ClusterData("http://broker-usw.com:"; + BROKER_WEBSERVICE_PORT));
         admin.clusters().createCluster("usc", new 
ClusterData("http://broker-usc.com:"; + BROKER_WEBSERVICE_PORT));
         admin.properties().createProperty(this.testProperty,
-                new PropertyAdmin(Lists.newArrayList("role1", "role2"), 
Sets.newHashSet("use", "usc", "usw")));
+                new PropertyAdmin(Sets.newHashSet("role1", "role2"), 
Sets.newHashSet("use", "usc", "usw")));
 
         createTestNamespaces(this.testProperty, this.testLocalNamespaces, new 
BundlesData());
         createGlobalTestNamespaces(this.testProperty, 
this.testGlobalNamespaces.get(0).getLocalName(),
@@ -371,7 +371,7 @@ public void testGlobalNamespaceReplicationConfiguration() 
throws Exception {
         assertEquals(
                 
namespaces.getNamespaceReplicationClusters(this.testGlobalNamespaces.get(0).getProperty(),
                         this.testGlobalNamespaces.get(0).getCluster(), 
this.testGlobalNamespaces.get(0).getLocalName()),
-                Lists.newArrayList());
+                Sets.newHashSet());
 
         
namespaces.setNamespaceReplicationClusters(this.testGlobalNamespaces.get(0).getProperty(),
                 this.testGlobalNamespaces.get(0).getCluster(), 
this.testGlobalNamespaces.get(0).getLocalName(),
@@ -410,7 +410,7 @@ public void testGlobalNamespaceReplicationConfiguration() 
throws Exception {
         }
 
         admin.properties().updateProperty(testProperty,
-                new PropertyAdmin(Lists.newArrayList("role1", "role2"), 
Sets.newHashSet("use", "usc")));
+                new PropertyAdmin(Sets.newHashSet("role1", "role2"), 
Sets.newHashSet("use", "usc")));
 
         try {
             namespaces.setNamespaceReplicationClusters(this.testProperty, 
"global",
@@ -568,7 +568,7 @@ public void 
_dont_implement_Matcher___instead_extend_BaseMatcher_() {
                 }), Mockito.anyBoolean(), Mockito.anyBoolean(), 
Mockito.anyBoolean());
 
         
admin.namespaces().setNamespaceReplicationClusters(testGlobalNamespaces.get(0).toString(),
-                Lists.newArrayList("usw"));
+                Sets.newHashSet("usw"));
 
         uri = URI.create("http://localhost"; + ":" + BROKER_WEBSERVICE_PORT + 
"/admin/namespace/"
                 + this.testLocalNamespaces.get(2).toString() + 
"?authoritative=false");
@@ -987,7 +987,7 @@ public void testValidateAdminAccessOnProperty() throws 
Exception {
             pulsar.getConfiguration().setAuthorizationEnabled(true);
             final String path = PulsarWebResource.path(POLICIES, property);
             final String data = 
ObjectMapperFactory.getThreadLocal().writeValueAsString(
-                    new 
PropertyAdmin(Lists.newArrayList(namespaces.clientAppId()), 
Sets.newHashSet("use")));
+                    new 
PropertyAdmin(Sets.newHashSet(namespaces.clientAppId()), 
Sets.newHashSet("use")));
             
ZkUtils.createFullPathOptimistic(pulsar.getConfigurationCache().getZooKeeper(), 
path, data.getBytes(),
                     ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
             namespaces.validateAdminAccessOnProperty(property);
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/auth/AuthorizationTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/auth/AuthorizationTest.java
index c4375e256..4ed8100c2 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/auth/AuthorizationTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/auth/AuthorizationTest.java
@@ -66,7 +66,7 @@ void simple() throws Exception {
         
assertEquals(auth.canLookup(TopicName.get("persistent://p1/c1/ns1/ds1"), 
"my-role", null), false);
 
         admin.clusters().createCluster("c1", new ClusterData());
-        admin.properties().createProperty("p1", new 
PropertyAdmin(Lists.newArrayList("role1"), Sets.newHashSet("c1")));
+        admin.properties().createProperty("p1", new 
PropertyAdmin(Sets.newHashSet("role1"), Sets.newHashSet("c1")));
         waitForChange();
         admin.namespaces().createNamespace("p1/c1/ns1");
         waitForChange();
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 319f06726..68d00c0fa 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
@@ -217,7 +217,7 @@ public void testAntiAffinityNamespaceFilteringWithDomain() 
throws Exception {
 
         pulsar1.getConfiguration().setFailureDomainsEnabled(true);
         admin1.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
 
         for (int i = 0; i < totalNamespaces; i++) {
             final String ns = namespace + i;
@@ -313,7 +313,7 @@ public void 
testAntiAffinityNamespaceFilteringWithoutDomain() throws Exception {
         final String bundle = "/0x00000000_0xffffffff";
 
         admin1.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
 
         for (int i = 0; i < totalNamespaces; i++) {
             final String ns = namespace + i;
@@ -449,7 +449,7 @@ public void testLoadSheddingUtilWithAntiAffinityNamespace() 
throws Exception {
         final String bundle = "/0x00000000_0xffffffff";
 
         admin1.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
 
         for (int i = 0; i < totalNamespaces; i++) {
             final String ns = namespace + i;
@@ -502,7 +502,7 @@ public void testLoadSheddingWithAntiAffinityNamespace() 
throws Exception {
         final String bundle = "0x00000000_0xffffffff";
 
         admin1.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
 
         for (int i = 0; i < totalNamespaces; i++) {
             final String ns = namespace + i;
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/ModularLoadManagerImplTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/ModularLoadManagerImplTest.java
index 5eb5a3046..9cb91e041 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/ModularLoadManagerImplTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/ModularLoadManagerImplTest.java
@@ -499,7 +499,7 @@ public void 
testNamespaceIsolationPoliciesForPrimaryAndSecondaryBrokers() throws
         final String sharedBroker = "broker3";
         admin1.clusters().createCluster(cluster, new ClusterData("http://"; + 
pulsar1.getAdvertisedAddress()));
         admin1.properties().createProperty(property,
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet(cluster)));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet(cluster)));
         admin1.namespaces().createNamespace(property + "/" + cluster + "/" + 
namespace);
 
         // set a new policy
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/lookup/http/HttpTopicLookupv2Test.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/lookup/http/HttpTopicLookupv2Test.java
index 6eefc8fbe..b6a3af3da 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/lookup/http/HttpTopicLookupv2Test.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/lookup/http/HttpTopicLookupv2Test.java
@@ -60,6 +60,7 @@
 import org.testng.annotations.Test;
 
 import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 
 /**
  * HTTP lookup unit tests.
@@ -183,7 +184,7 @@ public void testValidateReplicationSettingsOnNamespace() 
throws Exception {
         doReturn(Optional.of(policies1)).when(policiesCache)
                 .get(AdminResource.path(POLICIES, property, cluster, ns1));
         Policies policies2 = new Policies();
-        policies2.replication_clusters = 
Lists.newArrayList("invalid-localCluster");
+        policies2.replication_clusters = 
Sets.newHashSet("invalid-localCluster");
         doReturn(Optional.of(policies2)).when(policiesCache)
                 .get(AdminResource.path(POLICIES, property, cluster, ns2));
 
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BacklogQuotaManagerTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BacklogQuotaManagerTest.java
index 712baabe0..d58c690fb 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BacklogQuotaManagerTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BacklogQuotaManagerTest.java
@@ -47,7 +47,6 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 
@@ -95,7 +94,7 @@ void setup() throws Exception {
 
             admin.clusters().createCluster("usc", new 
ClusterData(adminUrl.toString()));
             admin.properties().createProperty("prop",
-                    new PropertyAdmin(Lists.newArrayList("appid1"), 
Sets.newHashSet("usc")));
+                    new PropertyAdmin(Sets.newHashSet("appid1"), 
Sets.newHashSet("usc")));
             admin.namespaces().createNamespace("prop/usc/ns-quota");
             admin.namespaces().createNamespace("prop/usc/quotahold");
             admin.namespaces().createNamespace("prop/usc/quotaholdasync");
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerBkEnsemblesTests.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerBkEnsemblesTests.java
index 85a087af2..1eaa18741 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerBkEnsemblesTests.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerBkEnsemblesTests.java
@@ -54,7 +54,6 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 /**
@@ -100,7 +99,7 @@ void setup() throws Exception {
 
             admin.clusters().createCluster("usc", new 
ClusterData(adminUrl.toString()));
             admin.properties().createProperty("prop",
-                    new PropertyAdmin(Lists.newArrayList("appid1"), 
Sets.newHashSet("usc")));
+                    new PropertyAdmin(Sets.newHashSet("appid1"), 
Sets.newHashSet("usc")));
         } catch (Throwable t) {
             LOG.error("Error setting up broker test", t);
             Assert.fail("Broker test setup failed");
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerTestBase.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerTestBase.java
index fc74b2792..fd078fc0c 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerTestBase.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerTestBase.java
@@ -25,7 +25,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 /**
@@ -41,7 +40,7 @@ public void baseSetup() throws Exception {
         super.internalSetup();
         admin.clusters().createCluster("use", new 
ClusterData(brokerUrl.toString()));
         admin.properties().createProperty("prop",
-                new PropertyAdmin(Lists.newArrayList("appid1"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace("prop/use/ns-abc");
     }
 
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/PeerReplicatorTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/PeerReplicatorTest.java
index d23356e2b..714b74102 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/PeerReplicatorTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/PeerReplicatorTest.java
@@ -86,8 +86,8 @@ public void testPeerClusterTopicLookup(String protocol) 
throws Exception {
         admin1.namespaces().createNamespace(namespace1);
         admin1.namespaces().createNamespace(namespace2);
         // add replication cluster
-        admin1.namespaces().setNamespaceReplicationClusters(namespace1, 
Lists.newArrayList("r1"));
-        admin1.namespaces().setNamespaceReplicationClusters(namespace2, 
Lists.newArrayList("r2"));
+        admin1.namespaces().setNamespaceReplicationClusters(namespace1, 
Sets.newHashSet("r1"));
+        admin1.namespaces().setNamespaceReplicationClusters(namespace2, 
Sets.newHashSet("r2"));
         admin1.clusters().updatePeerClusterNames("r3", null);
         // disable tls as redirection url is prepared according tls 
configuration
         pulsar1.getConfiguration().setTlsEnabled(false);
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorTest.java
index 09c807fef..ac03dc500 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorTest.java
@@ -79,6 +79,7 @@
 import org.testng.annotations.Test;
 import org.testng.collections.Lists;
 
+import com.google.common.collect.Sets;
 import com.scurrilous.circe.checksum.Crc32cIntChecksum;
 
 import io.netty.buffer.ByteBuf;
@@ -166,7 +167,7 @@ public Void call() throws Exception {
         Assert.assertNotNull(replicationClients3.get("r2"));
 
         // Case 1: Update the global namespace replication configuration to 
only contains the local cluster itself
-        
admin1.namespaces().setNamespaceReplicationClusters("pulsar/global/ns", 
Lists.newArrayList("r1"));
+        
admin1.namespaces().setNamespaceReplicationClusters("pulsar/global/ns", 
Sets.newHashSet("r1"));
 
         // Wait for config changes to be updated.
         Thread.sleep(1000L);
@@ -180,7 +181,7 @@ public Void call() throws Exception {
         Assert.assertNotNull(replicationClients3.get("r2"));
 
         // Case 2: Update the configuration back
-        
admin1.namespaces().setNamespaceReplicationClusters("pulsar/global/ns", 
Lists.newArrayList("r1", "r2", "r3"));
+        
admin1.namespaces().setNamespaceReplicationClusters("pulsar/global/ns", 
Sets.newHashSet("r1", "r2", "r3"));
 
         // Wait for config changes to be updated.
         Thread.sleep(1000L);
@@ -204,7 +205,7 @@ public void testConcurrentReplicator() throws Exception {
 
         final String namespace = "pulsar/global/concurrent";
         admin1.namespaces().createNamespace(namespace);
-        admin1.namespaces().setNamespaceReplicationClusters(namespace, 
Lists.newArrayList("r1", "r2"));
+        admin1.namespaces().setNamespaceReplicationClusters(namespace, 
Sets.newHashSet("r1", "r2"));
         final TopicName topicName = 
TopicName.get(String.format("persistent://" + namespace + "/topic-%d", 0));
         PulsarClient client1 = 
PulsarClient.builder().serviceUrl(url1.toString()).statsInterval(0, 
TimeUnit.SECONDS)
                 .build();
@@ -223,7 +224,7 @@ public void testConcurrentReplicator() throws Exception {
                 .get(pulsar1.getBrokerService());
         replicationClients.put("r3", pulsarClient);
 
-        admin1.namespaces().setNamespaceReplicationClusters(namespace, 
Lists.newArrayList("r1", "r2", "r3"));
+        admin1.namespaces().setNamespaceReplicationClusters(namespace, 
Sets.newHashSet("r1", "r2", "r3"));
         ExecutorService executor = Executors.newFixedThreadPool(5);
         for (int i = 0; i < 5; i++) {
             executor.submit(() -> {
@@ -265,7 +266,7 @@ public void testConfigChangeNegativeCases() throws 
Exception {
 
         // Make sure the namespace config update failed
         try {
-            
admin1.namespaces().setNamespaceReplicationClusters("pulsar/global/ns", 
Lists.newArrayList("r1"));
+            
admin1.namespaces().setNamespaceReplicationClusters("pulsar/global/ns", 
Sets.newHashSet("r1"));
             fail("Should have raised exception");
         } catch (PreconditionFailedException pfe) {
             // OK
@@ -887,7 +888,7 @@ public void testReplicatorOnPartitionedTopic(boolean 
isPartitionedTopic) throws
         BrokerService brokerService = pulsar1.getBrokerService();
 
         admin1.namespaces().createNamespace(namespace);
-        admin1.namespaces().setNamespaceReplicationClusters(namespace, 
Lists.newArrayList("r1", "r2", "r3"));
+        admin1.namespaces().setNamespaceReplicationClusters(namespace, 
Sets.newHashSet("r1", "r2", "r3"));
 
         if (isPartitionedTopic) {
             
admin1.persistentTopics().createPartitionedTopic(persistentTopicName, 5);
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorTestBase.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorTestBase.java
index 81c53c5c0..d69b5924b 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorTestBase.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorTestBase.java
@@ -215,11 +215,11 @@ void setup() throws Exception {
 
         admin1.clusters().createCluster("global", new 
ClusterData("http://global:8080";, "https://global:8443";));
         admin1.properties().createProperty("pulsar",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2", 
"appid3"), Sets.newHashSet("r1", "r2", "r3")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2", 
"appid3"), Sets.newHashSet("r1", "r2", "r3")));
         admin1.namespaces().createNamespace("pulsar/global/ns");
-        
admin1.namespaces().setNamespaceReplicationClusters("pulsar/global/ns", 
Lists.newArrayList("r1", "r2", "r3"));
+        
admin1.namespaces().setNamespaceReplicationClusters("pulsar/global/ns", 
Sets.newHashSet("r1", "r2", "r3"));
         admin1.namespaces().createNamespace("pulsar/global/ns1");
-        
admin1.namespaces().setNamespaceReplicationClusters("pulsar/global/ns1", 
Lists.newArrayList("r1", "r2"));
+        
admin1.namespaces().setNamespaceReplicationClusters("pulsar/global/ns1", 
Sets.newHashSet("r1", "r2"));
 
         assertEquals(admin2.clusters().getCluster("r1").getServiceUrl(), 
url1.toString());
         assertEquals(admin2.clusters().getCluster("r2").getServiceUrl(), 
url2.toString());
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthenticatedProducerConsumerTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthenticatedProducerConsumerTest.java
index 83aaadea8..219e70300 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthenticatedProducerConsumerTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthenticatedProducerConsumerTest.java
@@ -18,8 +18,19 @@
  */
 package org.apache.pulsar.client.api;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+
+import java.net.URI;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import javax.ws.rs.InternalServerErrorException;
+
 import org.apache.pulsar.broker.authentication.AuthenticationProviderBasic;
 import org.apache.pulsar.broker.authentication.AuthenticationProviderTls;
 import org.apache.pulsar.client.admin.PulsarAdmin;
@@ -37,13 +48,7 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-import javax.ws.rs.InternalServerErrorException;
-import java.net.URI;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
+import com.google.common.collect.Sets;
 
 public class AuthenticatedProducerConsumerTest extends ProducerConsumerBase {
     private static final Logger log = 
LoggerFactory.getLogger(AuthenticatedProducerConsumerTest.class);
@@ -164,7 +169,7 @@ public void testTlsSyncProducerAndConsumer(int 
batchMessageDelayMs) throws Excep
         internalSetup(authTls);
 
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace("my-property/use/my-ns");
 
         testSyncProducerAndConsumer(batchMessageDelayMs);
@@ -180,7 +185,7 @@ public void testBasicCryptSyncProducerAndConsumer(int 
batchMessageDelayMs) throw
         internalSetup(authPassword);
 
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList(), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet(), Sets.newHashSet("use")));
         admin.namespaces().createNamespace("my-property/use/my-ns");
 
         testSyncProducerAndConsumer(batchMessageDelayMs);
@@ -196,7 +201,7 @@ public void testBasicArp1SyncProducerAndConsumer(int 
batchMessageDelayMs) throws
         internalSetup(authPassword);
 
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList(), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet(), Sets.newHashSet("use")));
         admin.namespaces().createNamespace("my-property/use/my-ns");
 
         testSyncProducerAndConsumer(batchMessageDelayMs);
@@ -218,7 +223,7 @@ public void testAnonymousSyncProducerAndConsumer(int 
batchMessageDelayMs) throws
         admin.clusters().createCluster("use", new 
ClusterData(brokerUrl.toString(), brokerUrlTls.toString(),
                 "pulsar://localhost:" + BROKER_PORT, "pulsar+ssl://localhost:" 
+ BROKER_PORT_TLS));
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("anonymousUser"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("anonymousUser"), 
Sets.newHashSet("use")));
 
         // make a PulsarAdmin instance as "anonymousUser" for http request
         admin.close();
@@ -297,7 +302,7 @@ public void testInternalServerExceptionOnLookup() throws 
Exception {
         admin.clusters().createCluster("use", new 
ClusterData(brokerUrl.toString(), brokerUrlTls.toString(),
                 "pulsar://localhost:" + BROKER_PORT, "pulsar+ssl://localhost:" 
+ BROKER_PORT_TLS));
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         String namespace = "my-property/use/my-ns";
         admin.namespaces().createNamespace(namespace);
 
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthenticationTlsHostnameVerificationTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthenticationTlsHostnameVerificationTest.java
index b14ee11f7..13d5ad299 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthenticationTlsHostnameVerificationTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthenticationTlsHostnameVerificationTest.java
@@ -42,7 +42,6 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 public class AuthenticationTlsHostnameVerificationTest extends 
ProducerConsumerBase {
@@ -118,7 +117,7 @@ protected void setupClient() throws Exception {
                 .build();
 
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace("my-property/use/my-ns");
     }
 
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthorizationProducerConsumerTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthorizationProducerConsumerTest.java
index 36b91a40b..63ac489e5 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthorizationProducerConsumerTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/AuthorizationProducerConsumerTest.java
@@ -117,7 +117,7 @@ public void testProducerAndConsumerAuthorization() throws 
Exception {
                 .authentication(authenticationInvalidRole).build();
 
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace("my-property/use/my-ns");
 
         // (1) Valid Producer and consumer creation
@@ -166,7 +166,7 @@ public void testSubscriptionPrefixAuthorization() throws 
Exception {
         pulsarClient = 
PulsarClient.builder().serviceUrl(lookupUrl).authentication(authentication).build();
 
         admin.properties().createProperty("prop-prefix",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace("prop-prefix/use/ns");
 
         // (1) Valid subscription name will be approved by authorization 
service
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/BrokerServiceLookupTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/BrokerServiceLookupTest.java
index 57d8b478b..d5759f04a 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/BrokerServiceLookupTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/BrokerServiceLookupTest.java
@@ -97,7 +97,6 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import com.google.common.util.concurrent.MoreExecutors;
 
@@ -234,7 +233,7 @@ public void testMultipleBrokerDifferentClusterLookup() 
throws Exception {
         admin.clusters().createCluster(newCluster,
                 new ClusterData("http://127.0.0.1:"; + BROKER_WEBSERVICE_PORT, 
null, broker2ServiceUrl, null));
         admin.properties().createProperty(property,
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet(newCluster)));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet(newCluster)));
         admin.namespaces().createNamespace(property + "/" + newCluster + 
"/my-ns");
 
         PulsarService pulsar2 = startBroker(conf2);
@@ -1023,7 +1022,7 @@ public void 
testPartitionedMetadataWithDeprecatedVersion() throws Exception {
         admin.clusters().createCluster(cluster,
                 new ClusterData("http://127.0.0.1:"; + BROKER_WEBSERVICE_PORT, 
null, null, null));
         admin.properties().createProperty(property,
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet(cluster)));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet(cluster)));
         admin.namespaces().createNamespace(property + "/" + cluster + "/" + 
namespace);
         admin.persistentTopics().createPartitionedTopic(dest.toString(), 
totalPartitions);
 
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/MessageDispatchThrottlingTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/MessageDispatchThrottlingTest.java
index 59e343933..f9f346f35 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/MessageDispatchThrottlingTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/MessageDispatchThrottlingTest.java
@@ -39,7 +39,7 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.Lists;
+import dlshade.com.google.common.collect.Sets;
 
 public class MessageDispatchThrottlingTest extends ProducerConsumerBase {
     private static final Logger log = 
LoggerFactory.getLogger(MessageDispatchThrottlingTest.class);
@@ -653,7 +653,7 @@ public void testGlobalNamespaceThrottling() throws 
Exception {
 
         admin.clusters().createCluster("global", new 
ClusterData("http://global:8080";));
         admin.namespaces().createNamespace(namespace);
-        admin.namespaces().setNamespaceReplicationClusters(namespace, 
Lists.newArrayList("use"));
+        admin.namespaces().setNamespaceReplicationClusters(namespace, 
Sets.newHashSet("use"));
         admin.namespaces().setDispatchRate(namespace, dispatchRate);
 
         // create producer and topic
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/NonPersistentTopicTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/NonPersistentTopicTest.java
index 41df9ff82..02fe3225c 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/NonPersistentTopicTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/NonPersistentTopicTest.java
@@ -950,10 +950,10 @@ void setupReplicationCluster() throws Exception {
 
             admin1.clusters().createCluster("global", new 
ClusterData("http://global:8080";));
             admin1.properties().createProperty("pulsar", new PropertyAdmin(
-                    Lists.newArrayList("appid1", "appid2", "appid3"), 
Sets.newHashSet("r1", "r2", "r3")));
+                    Sets.newHashSet("appid1", "appid2", "appid3"), 
Sets.newHashSet("r1", "r2", "r3")));
             admin1.namespaces().createNamespace("pulsar/global/ns");
             
admin1.namespaces().setNamespaceReplicationClusters("pulsar/global/ns",
-                    Lists.newArrayList("r1", "r2", "r3"));
+                    Sets.newHashSet("r1", "r2", "r3"));
 
             assertEquals(admin2.clusters().getCluster("r1").getServiceUrl(), 
url1.toString());
             assertEquals(admin2.clusters().getCluster("r2").getServiceUrl(), 
url2.toString());
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/ProducerConsumerBase.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/ProducerConsumerBase.java
index ed746f861..2960bb3df 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/ProducerConsumerBase.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/ProducerConsumerBase.java
@@ -27,7 +27,6 @@
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 public abstract class ProducerConsumerBase extends MockedPulsarServiceBaseTest 
{
@@ -41,7 +40,7 @@ public void beforeMethod(Method m) throws Exception {
     public void producerBaseSetup() throws Exception {
         admin.clusters().createCluster("use", new 
ClusterData("http://127.0.0.1:"; + BROKER_WEBSERVICE_PORT));
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace("my-property/use/my-ns");
     }
 
@@ -54,4 +53,5 @@ protected void testMessageOrderAndDuplicates(Set<String> 
messagesReceived, Strin
         // Make sure that there are no duplicates
         Assert.assertTrue(messagesReceived.add(receivedMessage), "Received 
duplicate message " + receivedMessage);
     }
+    
 }
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/TlsProducerConsumerBase.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/TlsProducerConsumerBase.java
index 659034479..0c850216e 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/TlsProducerConsumerBase.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/TlsProducerConsumerBase.java
@@ -20,9 +20,6 @@
 
 import static org.mockito.Mockito.spy;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -34,6 +31,8 @@
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 
+import com.google.common.collect.Sets;
+
 public class TlsProducerConsumerBase extends ProducerConsumerBase {
     protected final String TLS_TRUST_CERT_FILE_PATH = 
"./src/test/resources/authentication/tls/cacert.pem";
     protected final String TLS_CLIENT_CERT_FILE_PATH = 
"./src/test/resources/authentication/tls/client-cert.pem";
@@ -92,7 +91,7 @@ protected void internalSetUpForNamespace() throws Exception {
         admin.clusters().createCluster(clusterName, new 
ClusterData(brokerUrl.toString(), brokerUrlTls.toString(),
                 "pulsar://localhost:" + BROKER_PORT, "pulsar+ssl://localhost:" 
+ BROKER_PORT_TLS));
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace("my-property/use/my-ns");
     }
 }
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/ConsumerConfigurationTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/ConsumerConfigurationTest.java
index e070bf906..64212af48 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/ConsumerConfigurationTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/ConsumerConfigurationTest.java
@@ -41,7 +41,7 @@ public void setup() throws Exception {
 
         admin.clusters().createCluster("use", new 
ClusterData("http://127.0.0.1:"; + BROKER_WEBSERVICE_PORT));
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace("my-property/use/my-ns");
     }
 
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/RawReaderTest.java 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/RawReaderTest.java
index e061e3e49..990bcaefa 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/RawReaderTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/RawReaderTest.java
@@ -64,7 +64,7 @@ public void setup() throws Exception {
         admin.clusters().createCluster("use",
                 new ClusterData("http://127.0.0.1:"; + BROKER_WEBSERVICE_PORT));
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace("my-property/use/my-ns");
     }
 
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactedTopicTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactedTopicTest.java
index 69d9cfbc7..3a9a37144 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactedTopicTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactedTopicTest.java
@@ -62,7 +62,7 @@ public void setup() throws Exception {
         admin.clusters().createCluster("use",
                 new ClusterData("http://127.0.0.1:"; + BROKER_WEBSERVICE_PORT));
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace("my-property/use/my-ns");
     }
 
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactionTest.java 
b/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactionTest.java
index b2c2bbeeb..af39e12de 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactionTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactionTest.java
@@ -60,7 +60,7 @@ public void setup() throws Exception {
 
         admin.clusters().createCluster("use", new 
ClusterData("http://127.0.0.1:"; + BROKER_WEBSERVICE_PORT));
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace("my-property/use/my-ns");
 
         compactionScheduler = Executors.newSingleThreadScheduledExecutor(
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactorTest.java 
b/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactorTest.java
index 59c46ecb2..84bc3959b 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactorTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactorTest.java
@@ -64,7 +64,7 @@ public void setup() throws Exception {
         admin.clusters().createCluster("use",
                 new ClusterData("http://127.0.0.1:"; + BROKER_WEBSERVICE_PORT));
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace("my-property/use/my-ns");
 
         compactionScheduler = Executors.newSingleThreadScheduledExecutor(
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/websocket/proxy/ProxyAuthorizationTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/websocket/proxy/ProxyAuthorizationTest.java
index 025ccb21c..37c9295df 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/websocket/proxy/ProxyAuthorizationTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/websocket/proxy/ProxyAuthorizationTest.java
@@ -82,7 +82,7 @@ public void test() throws Exception {
         
assertEquals(auth.canLookup(TopicName.get("persistent://p1/c1/ns1/ds1"), 
"my-role", null), false);
 
         admin.clusters().createCluster(configClusterName, new ClusterData());
-        admin.properties().createProperty("p1", new 
PropertyAdmin(Lists.newArrayList("role1"), Sets.newHashSet("c1")));
+        admin.properties().createProperty("p1", new 
PropertyAdmin(Sets.newHashSet("role1"), Sets.newHashSet("c1")));
         waitForChange();
         admin.namespaces().createNamespace("p1/c1/ns1");
         waitForChange();
diff --git 
a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/Namespaces.java
 
b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/Namespaces.java
index 9fa0a53a2..bc78283b2 100644
--- 
a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/Namespaces.java
+++ 
b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/Namespaces.java
@@ -376,7 +376,7 @@
      * @throws PulsarAdminException
      *             Unexpected error
      */
-    void setNamespaceReplicationClusters(String namespace, List<String> 
clusterIds) throws PulsarAdminException;
+    void setNamespaceReplicationClusters(String namespace, Set<String> 
clusterIds) throws PulsarAdminException;
 
     /**
      * Get the message TTL for a namespace.
diff --git 
a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NamespacesImpl.java
 
b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NamespacesImpl.java
index c24d8e562..f48e81ea6 100644
--- 
a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NamespacesImpl.java
+++ 
b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NamespacesImpl.java
@@ -193,7 +193,7 @@ public void revokePermissionsOnNamespace(String namespace, 
String role) throws P
     }
 
     @Override
-    public void setNamespaceReplicationClusters(String namespace, List<String> 
clusterIds) throws PulsarAdminException {
+    public void setNamespaceReplicationClusters(String namespace, Set<String> 
clusterIds) throws PulsarAdminException {
         try {
             NamespaceName ns = NamespaceName.get(namespace);
             WebTarget path = namespacePath(ns, "replication");
diff --git 
a/pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/PulsarAdminToolTest.java
 
b/pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/PulsarAdminToolTest.java
index c5959b883..e70f20b8d 100644
--- 
a/pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/PulsarAdminToolTest.java
+++ 
b/pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/PulsarAdminToolTest.java
@@ -190,12 +190,12 @@ void properties() throws Exception {
         properties.run(split("list"));
         verify(mockProperties).getProperties();
 
-        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Lists.newArrayList("role1", "role2"), Sets.newHashSet("use"));
+        PropertyAdmin propertyAdmin = new 
PropertyAdmin(Sets.newHashSet("role1", "role2"), Sets.newHashSet("use"));
 
         properties.run(split("create property --admin-roles role1,role2 
--allowed-clusters use"));
         verify(mockProperties).createProperty("property", propertyAdmin);
 
-        propertyAdmin = new PropertyAdmin(Lists.newArrayList("role1", 
"role2"), Sets.newHashSet("usw"));
+        propertyAdmin = new PropertyAdmin(Sets.newHashSet("role1", "role2"), 
Sets.newHashSet("usw"));
 
         properties.run(split("update property --admin-roles role1,role2 
--allowed-clusters usw"));
         verify(mockProperties).updateProperty("property", propertyAdmin);
@@ -247,7 +247,7 @@ void namespaces() throws Exception {
 
         namespaces.run(split("set-clusters myprop/clust/ns1 -c use,usw,usc"));
         
verify(mockNamespaces).setNamespaceReplicationClusters("myprop/clust/ns1",
-                Lists.newArrayList("use", "usw", "usc"));
+                Sets.newHashSet("use", "usw", "usc"));
 
         namespaces.run(split("get-clusters myprop/clust/ns1"));
         
verify(mockNamespaces).getNamespaceReplicationClusters("myprop/clust/ns1");
diff --git 
a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
 
b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
index 6d37594f9..6a2c8f2cb 100644
--- 
a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
+++ 
b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
@@ -36,6 +36,7 @@
 import com.beust.jcommander.Parameters;
 import com.beust.jcommander.converters.CommaParameterSplitter;
 import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 
 @Parameters(commandDescription = "Operations about namespaces")
 public class CmdNamespaces extends CmdBase {
@@ -182,7 +183,7 @@ void run() throws PulsarAdminException {
         void run() throws PulsarAdminException {
             String namespace = validateNamespace(params);
             List<String> clusters = Lists.newArrayList(clusterIds.split(","));
-            admin.namespaces().setNamespaceReplicationClusters(namespace, 
clusters);
+            admin.namespaces().setNamespaceReplicationClusters(namespace, 
Sets.newHashSet(clusters));
         }
     }
 
diff --git 
a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdProperties.java
 
b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdProperties.java
index 68cb2ecd9..fb6075c29 100644
--- 
a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdProperties.java
+++ 
b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdProperties.java
@@ -65,7 +65,7 @@ void run() throws PulsarAdminException {
         @Override
         void run() throws PulsarAdminException {
             String property = getOneArgument(params);
-            PropertyAdmin propertyAdmin = new PropertyAdmin(adminRoles, 
Sets.newHashSet(allowedClusters));
+            PropertyAdmin propertyAdmin = new 
PropertyAdmin(Sets.newHashSet(adminRoles), Sets.newHashSet(allowedClusters));
             admin.properties().createProperty(property, propertyAdmin);
         }
     }
@@ -86,7 +86,7 @@ void run() throws PulsarAdminException {
         @Override
         void run() throws PulsarAdminException {
             String property = getOneArgument(params);
-            PropertyAdmin propertyAdmin = new PropertyAdmin(adminRoles, 
Sets.newHashSet(allowedClusters));
+            PropertyAdmin propertyAdmin = new 
PropertyAdmin(Sets.newHashSet(adminRoles), Sets.newHashSet(allowedClusters));
             admin.properties().updateProperty(property, propertyAdmin);
         }
     }
diff --git 
a/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/Policies.java
 
b/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/Policies.java
index 985a13f5f..c1d85bd1c 100644
--- 
a/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/Policies.java
+++ 
b/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/Policies.java
@@ -21,7 +21,9 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
+import java.util.Set;
 
+import com.google.common.collect.Sets;
 import com.google.common.base.MoreObjects;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
@@ -29,7 +31,7 @@
 public class Policies {
 
     public final AuthPolicies auth_policies = new AuthPolicies();
-    public List<String> replication_clusters = Lists.newArrayList();
+    public Set<String> replication_clusters = Sets.newHashSet();
     public BundlesData bundles = defaultBundle();
     public Map<BacklogQuota.BacklogQuotaType, BacklogQuota> backlog_quota_map 
= Maps.newHashMap();
     public Map<String, DispatchRate> clusterDispatchRate = Maps.newHashMap();
diff --git 
a/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/PropertyAdmin.java
 
b/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/PropertyAdmin.java
index f4c69ebd7..ef82f0617 100644
--- 
a/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/PropertyAdmin.java
+++ 
b/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/PropertyAdmin.java
@@ -18,13 +18,11 @@
  */
 package org.apache.pulsar.common.policies.data;
 
-import java.util.List;
 import java.util.Objects;
 import java.util.Set;
 
 import javax.xml.bind.annotation.XmlRootElement;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 @XmlRootElement
@@ -32,7 +30,7 @@
     /**
      * List of role enabled as admin for this property
      */
-    private List<String> adminRoles;
+    private Set<String> adminRoles;
 
     /**
      * List of clusters this property is restricted on
@@ -40,20 +38,20 @@
     private Set<String> allowedClusters;
 
     public PropertyAdmin() {
-        adminRoles = Lists.newArrayList();
+        adminRoles = Sets.newHashSet();
         allowedClusters = Sets.newHashSet();
     }
 
-    public PropertyAdmin(List<String> adminRoles, Set<String> allowedClusters) 
{
+    public PropertyAdmin(Set<String> adminRoles, Set<String> allowedClusters) {
         this.adminRoles = adminRoles;
         this.allowedClusters = allowedClusters;
     }
 
-    public List<String> getAdminRoles() {
+    public Set<String> getAdminRoles() {
         return adminRoles;
     }
 
-    public void setAdminRoles(List<String> adminRoles) {
+    public void setAdminRoles(Set<String> adminRoles) {
         this.adminRoles = adminRoles;
     }
 
diff --git 
a/pulsar-common/src/test/java/org/apache/pulsar/common/policies/data/PoliciesDataTest.java
 
b/pulsar-common/src/test/java/org/apache/pulsar/common/policies/data/PoliciesDataTest.java
index 40cc94d8e..848a94a89 100644
--- 
a/pulsar-common/src/test/java/org/apache/pulsar/common/policies/data/PoliciesDataTest.java
+++ 
b/pulsar-common/src/test/java/org/apache/pulsar/common/policies/data/PoliciesDataTest.java
@@ -27,18 +27,13 @@
 import java.util.Map;
 import java.util.Set;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonGenerationException;
-
-import org.apache.pulsar.common.policies.data.AuthAction;
-import org.apache.pulsar.common.policies.data.BundlesData;
-import org.apache.pulsar.common.policies.data.Policies;
-import org.apache.pulsar.common.policies.data.PropertyAdmin;
 import org.apache.pulsar.common.util.ObjectMapperFactory;
 import org.testng.annotations.Test;
 
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
@@ -68,13 +63,13 @@ void policies() {
     @Test
     void propertyAdmin() {
         PropertyAdmin pa1 = new PropertyAdmin();
-        pa1.setAdminRoles(Lists.newArrayList("role1", "role2"));
+        pa1.setAdminRoles(Sets.newHashSet("role1", "role2"));
         pa1.setAllowedClusters(Sets.newHashSet("use", "usw"));
 
-        assertEquals(pa1, new PropertyAdmin(Lists.newArrayList("role1", 
"role2"), Sets.newHashSet("use", "usw")));
+        assertEquals(pa1, new PropertyAdmin(Sets.newHashSet("role1", "role2"), 
Sets.newHashSet("use", "usw")));
         assertTrue(!pa1.equals(new Object()));
         assertTrue(!pa1.equals(new PropertyAdmin()));
-        assertTrue(!pa1.equals(new PropertyAdmin(Lists.newArrayList("role1", 
"role3"), Sets.newHashSet("usc"))));
+        assertTrue(!pa1.equals(new PropertyAdmin(Sets.newHashSet("role1", 
"role3"), Sets.newHashSet("usc"))));
         assertEquals(pa1.getAdminRoles(), Lists.newArrayList("role1", 
"role2"));
     }
 
diff --git 
a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyAuthenticatedProducerConsumerTest.java
 
b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyAuthenticatedProducerConsumerTest.java
index 2bd5e8f9c..f069d021c 100644
--- 
a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyAuthenticatedProducerConsumerTest.java
+++ 
b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyAuthenticatedProducerConsumerTest.java
@@ -47,7 +47,6 @@
 import org.testng.annotations.Test;
 import org.testng.collections.Maps;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 public class ProxyAuthenticatedProducerConsumerTest extends 
ProducerConsumerBase {
@@ -163,7 +162,7 @@ public void testTlsSyncProducerAndConsumer() throws 
Exception {
         admin.clusters().createCluster(configClusterName, new 
ClusterData(brokerUrl.toString(), brokerUrlTls.toString(),
                 "pulsar://localhost:" + BROKER_PORT, "pulsar+ssl://localhost:" 
+ BROKER_PORT_TLS));
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace("my-property/use/my-ns");
 
         Consumer<byte[]> consumer = 
proxyClient.newConsumer().topic("persistent://my-property/use/my-ns/my-topic1")
diff --git 
a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyForwardAuthDataTest.java
 
b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyForwardAuthDataTest.java
index 1b6356773..fda29b252 100644
--- 
a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyForwardAuthDataTest.java
+++ 
b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyForwardAuthDataTest.java
@@ -38,7 +38,6 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 public class ProxyForwardAuthDataTest extends ProducerConsumerBase {
@@ -94,7 +93,7 @@ void testForwardAuthData() throws Exception {
         String proxyAuthParams = "authParam:proxy";
 
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace(namespaceName);
         admin.namespaces().grantPermissionOnNamespace(namespaceName, "proxy",
                 Sets.newHashSet(AuthAction.consume, AuthAction.produce));
diff --git 
a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyRolesEnforcementTest.java
 
b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyRolesEnforcementTest.java
index 10c0bdf49..a36566630 100644
--- 
a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyRolesEnforcementTest.java
+++ 
b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyRolesEnforcementTest.java
@@ -36,20 +36,17 @@
 import org.apache.pulsar.client.admin.PulsarAdmin;
 import org.apache.pulsar.client.api.Authentication;
 import org.apache.pulsar.client.api.AuthenticationDataProvider;
-import org.apache.pulsar.client.api.Consumer;
 import org.apache.pulsar.client.api.ProducerConsumerBase;
 import org.apache.pulsar.client.api.PulsarClient;
 import org.apache.pulsar.client.api.PulsarClientException;
 import org.apache.pulsar.common.policies.data.AuthAction;
 import org.apache.pulsar.common.policies.data.PropertyAdmin;
-import 
org.apache.pulsar.proxy.server.ProxyRolesEnforcementTest.BasicAuthentication;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 public class ProxyRolesEnforcementTest extends ProducerConsumerBase {
@@ -193,7 +190,7 @@ void testIncorrectRoles() throws Exception {
         String proxyAuthParams = "authParam:proxy";
 
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("use")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("use")));
         admin.namespaces().createNamespace(namespaceName);
 
         admin.namespaces().grantPermissionOnNamespace(namespaceName, "proxy",
diff --git 
a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyWithAuthorizationNegTest.java
 
b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyWithAuthorizationNegTest.java
index b9f3376b5..77c396ba9 100644
--- 
a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyWithAuthorizationNegTest.java
+++ 
b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyWithAuthorizationNegTest.java
@@ -47,7 +47,6 @@
 import org.testng.annotations.Test;
 import org.testng.collections.Maps;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 public class ProxyWithAuthorizationNegTest extends ProducerConsumerBase {
@@ -161,7 +160,7 @@ public void testProxyAuthorization() throws Exception {
         String namespaceName = "my-property/proxy-authorization-neg/my-ns";
 
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("proxy-authorization-neg")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("proxy-authorization-neg")));
         admin.namespaces().createNamespace(namespaceName);
 
         admin.namespaces().grantPermissionOnNamespace(namespaceName, "Proxy", 
Sets.newHashSet(AuthAction.produce));
diff --git 
a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyWithAuthorizationTest.java
 
b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyWithAuthorizationTest.java
index 9c95778e0..1544d5386 100644
--- 
a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyWithAuthorizationTest.java
+++ 
b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyWithAuthorizationTest.java
@@ -50,7 +50,6 @@
 import org.testng.annotations.Test;
 import org.testng.collections.Maps;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 public class ProxyWithAuthorizationTest extends ProducerConsumerBase {
@@ -227,7 +226,7 @@ public void testProxyAuthorization() throws Exception {
         String namespaceName = "my-property/proxy-authorization/my-ns";
 
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("proxy-authorization")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("proxy-authorization")));
         admin.namespaces().createNamespace(namespaceName);
 
         admin.namespaces().grantPermissionOnNamespace(namespaceName, "Proxy",
@@ -279,7 +278,7 @@ public void testTlsHostVerificationProxyToClient(boolean 
hostnameVerificationEna
         String namespaceName = "my-property/proxy-authorization/my-ns";
 
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("proxy-authorization")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("proxy-authorization")));
         admin.namespaces().createNamespace(namespaceName);
 
         admin.namespaces().grantPermissionOnNamespace(namespaceName, "Proxy",
@@ -329,7 +328,7 @@ public void testTlsHostVerificationProxyToBroker(boolean 
hostnameVerificationEna
         String namespaceName = "my-property/proxy-authorization/my-ns";
 
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("proxy-authorization")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("proxy-authorization")));
         admin.namespaces().createNamespace(namespaceName);
 
         admin.namespaces().grantPermissionOnNamespace(namespaceName, "Proxy",
@@ -364,7 +363,7 @@ public void tlsCiphersAndProtocols(Set<String> tlsCiphers, 
Set<String> tlsProtoc
         createAdminClient();
 
         admin.properties().createProperty("my-property",
-                new PropertyAdmin(Lists.newArrayList("appid1", "appid2"), 
Sets.newHashSet("proxy-authorization")));
+                new PropertyAdmin(Sets.newHashSet("appid1", "appid2"), 
Sets.newHashSet("proxy-authorization")));
         admin.namespaces().createNamespace(namespaceName);
 
         admin.namespaces().grantPermissionOnNamespace(namespaceName, "Proxy",
diff --git 
a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyWithoutServiceDiscoveryTest.java
 
b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyWithoutServiceDiscoveryTest.java
index ca22a8fb4..02770be47 100644
--- 
a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyWithoutServiceDiscoveryTest.java
+++ 
b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyWithoutServiceDiscoveryTest.java
@@ -45,7 +45,6 @@
 import org.testng.annotations.Test;
 import org.testng.collections.Maps;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 public class ProxyWithoutServiceDiscoveryTest extends ProducerConsumerBase {
@@ -154,7 +153,7 @@ public void testDiscoveryService() throws Exception {
         // create a client which connects to proxy over tls and pass authData
         PulsarClient proxyClient = createPulsarClient(authTls, 
proxyServiceUrl);
 
-        admin.properties().createProperty("my-property", new 
PropertyAdmin(Lists.newArrayList("appid1", "appid2"),
+        admin.properties().createProperty("my-property", new 
PropertyAdmin(Sets.newHashSet("appid1", "appid2"),
                 Sets.newHashSet("without-service-discovery")));
         
admin.namespaces().createNamespace("my-property/without-service-discovery/my-ns");
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to