reddycharan commented on a change in pull request #1753: Adding multi-node 
ZKCluster test util class
URL: https://github.com/apache/bookkeeper/pull/1753#discussion_r227517306
 
 

 ##########
 File path: 
bookkeeper-server/src/test/java/org/apache/bookkeeper/test/ZooKeeperClusterUtil.java
 ##########
 @@ -0,0 +1,140 @@
+/*
+ *
+ * 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 com.google.common.io.Files;
+import java.io.IOException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.bookkeeper.meta.LongHierarchicalLedgerManagerFactory;
+import org.apache.bookkeeper.zookeeper.ZooKeeperClient;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.test.QuorumUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Provides multi node zookeeper cluster.
+ */
+@Slf4j
+public class ZooKeeperClusterUtil implements ZooKeeperCluster {
+
+    static {
+        enableZookeeperTestEnvVariables();
+    }
+
+    static final Logger LOG = 
LoggerFactory.getLogger(ZooKeeperClusterUtil.class);
+    private final int numOfZKNodes;
+    public QuorumUtil quorumUtil;
+    String connectString;
+    protected ZooKeeper zkc; // zookeeper client
+
+    public static void enableZookeeperTestEnvVariables() {
+        /*
+         * org.apache.zookeeper.test.ClientBase uses FourLetterWordMain, from
+         * 3.5.3 four letter words are disabled by default due to security
+         * reasons
+         */
+        System.setProperty("zookeeper.4lw.commands.whitelist", "*");
+        System.setProperty("zookeeper.admin.enableServer", "false");
 
 Review comment:
   from doc -
   
   "Unsafe Options
   The following options can be useful, but be careful when you use them. The 
risk of each is explained along with the explanation of what the variable does.
   forceSync
   (Java system property: zookeeper.forceSync)
   Requires updates to be synced to media of the transaction log before 
finishing processing the update. If this option is set to no, ZooKeeper will 
not require updates to be synced to the media."
   
   maybe worth considering, but this must not be specific to multinode zk 
cluster. So I'll leave it now for this change. We can revisit if it is needed 
for both kind of zkclusters (singlenode and multinode).

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to