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:
Zhihong Yu 2013-01-08 18:27:04 +00:00
parent 4e0af48fe4
commit f77e5b5bff
1 changed files with 10 additions and 1 deletions

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.hbase;
import java.io.IOException; import java.io.IOException;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.ReflectionUtils;
/** /**
* Facility for <strong>integration/system</strong> tests. This extends {@link HBaseTestingUtility} * 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"; 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 * 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. * 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 { private void createDistributedHBaseCluster() throws IOException {
Configuration conf = getConfiguration(); 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)); setHBaseCluster(new DistributedHBaseCluster(conf, clusterManager));
getHBaseAdmin(); getHBaseAdmin();
} }