You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by nk...@apache.org on 2012/10/04 09:36:32 UTC

svn commit: r1393940 - /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java

Author: nkeywal
Date: Thu Oct  4 07:36:31 2012
New Revision: 1393940

URL: http://svn.apache.org/viewvc?rev=1393940&view=rev
Log:
HBASE-6939 Add the possibility to set the ZK port in HBaseTestingUtility

Modified:
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1393940&r1=1393939&r2=1393940&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java Thu Oct  4 07:36:31 2012
@@ -571,6 +571,10 @@ public class HBaseTestingUtility {
     return startMiniZKCluster(dir,1);
   }
 
+  /**
+   * Start a mini ZK cluster. If the property "test.hbase.zookeeper.property.clientPort" is set
+   *  the port mentionned is used as the default port for ZooKeeper.
+   */
   private MiniZooKeeperCluster startMiniZKCluster(final File dir,
       int zooKeeperServerNum)
   throws Exception {
@@ -579,6 +583,11 @@ public class HBaseTestingUtility {
     }
     this.passedZkCluster = false;
     this.zkCluster = new MiniZooKeeperCluster(this.getConfiguration());
+    final int defPort = this.conf.getInt("test.hbase.zookeeper.property.clientPort", 0);
+    if (defPort > 0){
+      // If there is a port in the config file, we use it.
+      this.zkCluster.setDefaultClientPort(defPort);
+    }
     int clientPort =   this.zkCluster.startup(dir,zooKeeperServerNum);
     this.conf.set(HConstants.ZOOKEEPER_CLIENT_PORT,
       Integer.toString(clientPort));