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_r227582877
 
 

 ##########
 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:
   couple of things,
   
   1) people may take snapshot of ZK for analysis of test failure, so not 
fsyncing might be an issue for them.
   2) even if we decide not to do fsync, i think it should be in different 
commit with full details, since it affects the behavior of single noded 
ZKCluster utility class also. So I'm not inclined to make that change in this 
PR.

----------------------------------------------------------------
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