bookkeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject bookkeeper git commit: BOOKKEEPER-1001: Make LocalBookiesRegistry.isLocalBookie() public
Date Thu, 23 Mar 2017 14:58:11 GMT
Repository: bookkeeper
Updated Branches:
  refs/heads/master 3d3340be7 -> 986110c4d


BOOKKEEPER-1001: Make LocalBookiesRegistry.isLocalBookie() public

Author: Francesco Caliumi - Diennea <francesco.caliumi@diennea.com>

Reviewers: Enrico Olivelli <eolivelli@gmail.com>, Venkateswararao Jujjuri (JV) <None>,
Sijie Guo <sijie@apache.org>

Closes #106 from caiok/BOOKKEEPER-1001


Project: http://git-wip-us.apache.org/repos/asf/bookkeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/bookkeeper/commit/986110c4
Tree: http://git-wip-us.apache.org/repos/asf/bookkeeper/tree/986110c4
Diff: http://git-wip-us.apache.org/repos/asf/bookkeeper/diff/986110c4

Branch: refs/heads/master
Commit: 986110c4d03a38db81c166216cf4db81a9cb5cb7
Parents: 3d3340b
Author: Francesco Caliumi - Diennea <francesco.caliumi@diennea.com>
Authored: Thu Mar 23 10:58:08 2017 -0400
Committer: Sijie Guo <sijie@apache.org>
Committed: Thu Mar 23 10:58:08 2017 -0400

----------------------------------------------------------------------
 .../bookkeeper/proto/LocalBookiesRegistry.java  |  4 +-
 .../test/LocalBookiesRegistryTest.java          | 59 ++++++++++++++++++++
 2 files changed, 61 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/986110c4/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/LocalBookiesRegistry.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/LocalBookiesRegistry.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/LocalBookiesRegistry.java
index 0dd2aa3..738ee48 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/LocalBookiesRegistry.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/LocalBookiesRegistry.java
@@ -26,7 +26,7 @@ import org.apache.bookkeeper.net.BookieSocketAddress;
 /**
  * Local registry for embedded Bookies
  */
-class LocalBookiesRegistry {
+public class LocalBookiesRegistry {
     
     private final static ConcurrentHashMap<BookieSocketAddress,Boolean> localBookiesRegistry
             = new ConcurrentHashMap<>();
@@ -39,7 +39,7 @@ class LocalBookiesRegistry {
             localBookiesRegistry.remove(address);
         }
     }
-    static boolean isLocalBookie(BookieSocketAddress address) {        
+    public static boolean isLocalBookie(BookieSocketAddress address) {        
         return localBookiesRegistry.containsKey(address);
     }
     

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/986110c4/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/LocalBookiesRegistryTest.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/LocalBookiesRegistryTest.java
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/LocalBookiesRegistryTest.java
new file mode 100644
index 0000000..25c5ff4
--- /dev/null
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/LocalBookiesRegistryTest.java
@@ -0,0 +1,59 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.bookkeeper.test;
+
+import org.apache.bookkeeper.client.BookKeeper;
+import org.apache.bookkeeper.conf.ServerConfiguration;
+import org.apache.bookkeeper.proto.BookieServer;
+import org.apache.bookkeeper.proto.LocalBookiesRegistry;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+
+/**
+ * Test the correctness and the availability outside of its package of LocalBookiesRegistryTest
+ */
+public class LocalBookiesRegistryTest extends BaseTestCase {
+    
+    @Override
+    protected ServerConfiguration newServerConfiguration() throws Exception {
+        return super
+                .newServerConfiguration()
+                .setDisableServerSocketBind(true)
+                .setEnableLocalTransport(true);
+    }
+        
+    BookKeeper.DigestType digestType;
+    
+    public LocalBookiesRegistryTest(BookKeeper.DigestType digestType) {
+        super(3);
+        this.digestType = digestType;
+    }
+
+    @Test
+    public void testAccessibleLocalBookiesRegistry() throws Exception {
+        assertEquals(3,bs.size());
+        for (BookieServer bk : bs) {
+            assertTrue(LocalBookiesRegistry.isLocalBookie(bk.getLocalAddress()));
+        }
+    }
+}


Mime
View raw message