pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mme...@apache.org
Subject [incubator-pulsar] branch master updated: Remove "global" from returned clusters list (#1695)
Date Tue, 01 May 2018 00:03:57 GMT
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 1e0e12a  Remove "global" from returned clusters list (#1695)
1e0e12a is described below

commit 1e0e12a72fb978abc04797b049dada100d8d0832
Author: Matteo Merli <mmerli@apache.org>
AuthorDate: Mon Apr 30 17:03:54 2018 -0700

    Remove "global" from returned clusters list (#1695)
---
 .../main/java/org/apache/pulsar/broker/admin/AdminResource.java    | 7 ++++++-
 .../test/java/org/apache/pulsar/broker/admin/AdminApiTest2.java    | 6 ++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
index 04389cc..be1b7dd 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
@@ -40,6 +40,7 @@ import org.apache.pulsar.broker.cache.LocalZooKeeperCacheService;
 import org.apache.pulsar.broker.web.PulsarWebResource;
 import org.apache.pulsar.broker.web.RestException;
 import org.apache.pulsar.common.naming.TopicName;
+import org.apache.pulsar.common.naming.Constants;
 import org.apache.pulsar.common.naming.NamespaceBundle;
 import org.apache.pulsar.common.naming.NamespaceBundleFactory;
 import org.apache.pulsar.common.naming.NamespaceBundles;
@@ -334,7 +335,11 @@ public abstract class AdminResource extends PulsarWebResource {
 
     protected Set<String> clusters() {
         try {
-            return pulsar().getConfigurationCache().clustersListCache().get();
+            Set<String> clusters = pulsar().getConfigurationCache().clustersListCache().get();
+
+            // Remove "global" cluster from returned list
+            clusters.remove(Constants.GLOBAL_CLUSTER);
+            return clusters;
         } catch (Exception e) {
             throw new RestException(e);
         }
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 5c9346e..73dc79c 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
@@ -869,4 +869,10 @@ public class AdminApiTest2 extends MockedPulsarServiceBaseTest {
         } catch (PulsarAdminException.NotFoundException e) {// expected
         }
     }
+
+    @Test
+    public void clustersList() throws PulsarAdminException {
+        final String cluster = pulsar.getConfiguration().getClusterName();
+        assertEquals(admin.clusters().getClusters(), Lists.newArrayList(cluster));
+    }
 }

-- 
To stop receiving notification emails like this one, please contact
mmerli@apache.org.

Mime
View raw message