HBASE-7441 Make ClusterManager in IntegrationTestingUtility pluggable (Liu Shaohui)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1430433 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4e0af48fe4
commit
f77e5b5bff
|
@ -21,6 +21,7 @@ package org.apache.hadoop.hbase;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* Facility for <strong>integration/system</strong> tests. This extends {@link HBaseTestingUtility}
|
||||
|
@ -58,6 +59,11 @@ public class IntegrationTestingUtility extends HBaseTestingUtility {
|
|||
*/
|
||||
public static final String IS_DISTRIBUTED_CLUSTER = "hbase.test.cluster.distributed";
|
||||
|
||||
/** Config for pluggable hbase cluster manager */
|
||||
private static final String HBASE_CLUSTER_MANAGER_CLASS = "hbase.it.clustermanager.class";
|
||||
private static final Class<? extends ClusterManager> DEFAULT_HBASE_CLUSTER_MANAGER_CLASS =
|
||||
HBaseClusterManager.class;
|
||||
|
||||
/**
|
||||
* Initializes the state of the cluster. It starts a new in-process mini cluster, OR
|
||||
* if we are given an already deployed distributed cluster it initializes the state.
|
||||
|
@ -122,7 +128,10 @@ public class IntegrationTestingUtility extends HBaseTestingUtility {
|
|||
|
||||
private void createDistributedHBaseCluster() throws IOException {
|
||||
Configuration conf = getConfiguration();
|
||||
ClusterManager clusterManager = new HBaseClusterManager();
|
||||
Class<? extends ClusterManager> clusterManagerClass = conf.getClass(HBASE_CLUSTER_MANAGER_CLASS,
|
||||
DEFAULT_HBASE_CLUSTER_MANAGER_CLASS, ClusterManager.class);
|
||||
ClusterManager clusterManager = ReflectionUtils.newInstance(
|
||||
clusterManagerClass, conf);
|
||||
setHBaseCluster(new DistributedHBaseCluster(conf, clusterManager));
|
||||
getHBaseAdmin();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue