Index: hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java =================================================================== --- hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (revision 1396445) +++ hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (working copy) @@ -142,6 +142,9 @@ // Directory (a subdirectory of dataTestDir) used by the dfs cluster if any private File clusterTestDir = null; + + //allows consumers to inject a base MiniZKCluster instance for controlling initialization. + private MiniZooKeeperCluster baseZKCluster; /** * System property key to get test directory value. @@ -540,6 +543,17 @@ dfsCluster = null; } } + + /** + * Sets the base {@link MiniZooKeeperCluster} image that can be used to startup the cluster. + * Note that the {@code baseZKCluster} instance should not be started and additional configuration might + * be changed on the instance. + * + * @param baseZKCluster base image to use for starting the cluster. + */ + public void setMiniZookeeperCluster(MiniZooKeeperCluster baseZKCluster){ + this.baseZKCluster = baseZKCluster; + } /** * Call this if you only want a zk cluster. @@ -582,7 +596,7 @@ throw new IOException("Cluster already running at " + dir); } this.passedZkCluster = false; - this.zkCluster = new MiniZooKeeperCluster(this.getConfiguration()); + this.zkCluster = baseZKCluster == null ? new MiniZooKeeperCluster(this.getConfiguration()): baseZKCluster; 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.