Repository: zookeeper
Updated Branches:
  refs/heads/branch-3.4 e93d5b27f -> 88e4d9dcd


ZOOKEEPER-2671: Fix compilation error in branch-3.4

Creating the PR on behalf of Arshad.

Author: Rakesh Radhakrishnan <[email protected]>

Reviewers: Arshad Mohammad <[email protected]>, Edward Ribeiro 
<[email protected]>

Closes #153 from rakeshadr/ZK-2671


Project: http://git-wip-us.apache.org/repos/asf/zookeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/zookeeper/commit/88e4d9dc
Tree: http://git-wip-us.apache.org/repos/asf/zookeeper/tree/88e4d9dc
Diff: http://git-wip-us.apache.org/repos/asf/zookeeper/diff/88e4d9dc

Branch: refs/heads/branch-3.4
Commit: 88e4d9dcda14e83445c4198aa9a3096d202f1cf7
Parents: e93d5b2
Author: Rakesh Radhakrishnan <[email protected]>
Authored: Mon Jan 23 12:21:44 2017 +0530
Committer: Rakesh Radhakrishnan <[email protected]>
Committed: Mon Jan 23 12:21:44 2017 +0530

----------------------------------------------------------------------
 .../org/apache/zookeeper/test/ClientBase.java   | 28 ++++++++++++++++++++
 1 file changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/88e4d9dc/src/java/test/org/apache/zookeeper/test/ClientBase.java
----------------------------------------------------------------------
diff --git a/src/java/test/org/apache/zookeeper/test/ClientBase.java 
b/src/java/test/org/apache/zookeeper/test/ClientBase.java
index fdcfac4..6037ff2 100644
--- a/src/java/test/org/apache/zookeeper/test/ClientBase.java
+++ b/src/java/test/org/apache/zookeeper/test/ClientBase.java
@@ -664,4 +664,32 @@ public abstract class ClientBase extends ZKTestCase {
         }
         return sb.toString();
     }
+
+    public static ZooKeeper createZKClient(String cxnString) throws Exception {
+        return createZKClient(cxnString, CONNECTION_TIMEOUT);
+    }
+
+    /**
+     * Returns ZooKeeper client after connecting to ZooKeeper Server. Session
+     * timeout is {@link #CONNECTION_TIMEOUT}
+     *
+     * @param cxnString
+     *            connection string in the form of host:port
+     * @param sessionTimeout
+     * @throws IOException
+     *             in cases of network failure
+     */
+    public static ZooKeeper createZKClient(String cxnString, int 
sessionTimeout) throws IOException {
+        CountdownWatcher watcher = new CountdownWatcher();
+        ZooKeeper zk = new ZooKeeper(cxnString, sessionTimeout, watcher);
+        try {
+            watcher.waitForConnected(CONNECTION_TIMEOUT);
+        } catch (InterruptedException e) {
+            Assert.fail("ZooKeeper client can not connect to " + cxnString);
+        }
+        catch (TimeoutException e) {
+            Assert.fail("ZooKeeper client can not connect to " + cxnString);
+        }
+        return zk;
+    }
 }

Reply via email to