HBASE-6939 Add the possibility to set the ZK port in HBaseTestingUtility
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1393940 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
610ea30534
commit
07e97d2b32
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue