Package org.apache.hadoop.hbase
Class HBaseZKTestingUtility
java.lang.Object
org.apache.hadoop.hbase.HBaseCommonTestingUtility
org.apache.hadoop.hbase.HBaseZKTestingUtility
- Direct Known Subclasses:
HBaseTestingUtility
Helpers for testing HBase that do not depend on specific server/etc. things. The main difference
from
HBaseCommonTestingUtility
is that we can start a zookeeper cluster.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.HBaseCommonTestingUtility
HBaseCommonTestingUtility.PortAllocator
-
Field Summary
Modifier and TypeFieldDescriptionprotected File
Directory (a subdirectory of dataTestDir) used by the dfs cluster if anyprivate boolean
Set if we were passed a zkCluster.private org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster
protected org.apache.hadoop.hbase.zookeeper.ZKWatcher
Fields inherited from class org.apache.hadoop.hbase.HBaseCommonTestingUtility
BASE_TEST_DIRECTORY_KEY, BOOLEAN_PARAMETERIZED, COMPRESSION_ALGORITHMS, COMPRESSION_ALGORITHMS_PARAMETERIZED, conf, DEFAULT_BASE_TEST_DIRECTORY, LOG
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns True if we removed the test dirs(package private) org.apache.hadoop.fs.Path
org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster
org.apache.hadoop.hbase.zookeeper.ZKWatcher
Returns a ZKWatcher instance.static org.apache.hadoop.hbase.zookeeper.ZKWatcher
getZooKeeperWatcher
(HBaseZKTestingUtility testUtil) Gets a ZKWatcher.protected void
Creates a directory for the cluster, under the test datavoid
setZkCluster
(org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster zkCluster) void
Shuts down zk cluster created by call tostartMiniZKCluster()
or does nothing.org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster
Call this if you only want a zk cluster.org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster
startMiniZKCluster
(int zooKeeperServerNum, int... clientPortList) Call this if you only want a zk cluster.private org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster
startMiniZKCluster
(File dir, int zooKeeperServerNum, int[] clientPortList) Start a mini ZK cluster.Methods inherited from class org.apache.hadoop.hbase.HBaseCommonTestingUtility
cleanupTestDir, createSubDir, deleteDir, deleteOnExit, getConfiguration, getDataTestDir, getDataTestDir, getRandomDir, getRandomUUID, randomFreePort, setupDataTestDir, waitFor, waitFor, waitFor
-
Field Details
-
zkCluster
-
passedZkCluster
Set if we were passed a zkCluster. If so, we won't shutdown zk as part of general shutdown. -
zooKeeperWatcher
-
clusterTestDir
Directory (a subdirectory of dataTestDir) used by the dfs cluster if any
-
-
Constructor Details
-
HBaseZKTestingUtility
public HBaseZKTestingUtility() -
HBaseZKTestingUtility
-
-
Method Details
-
getClusterTestDir
org.apache.hadoop.fs.Path getClusterTestDir()- Returns:
- Where the cluster will write data on the local subsystem. Creates it if it does not
exist already. A subdir of
HBaseCommonTestingUtility#getBaseTestDir()
-
setupClusterTestDir
Creates a directory for the cluster, under the test data -
startMiniZKCluster
Call this if you only want a zk cluster.- Returns:
- zk cluster started.
- Throws:
Exception
- See Also:
-
startMiniZKCluster
public org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster startMiniZKCluster(int zooKeeperServerNum, int... clientPortList) throws Exception Call this if you only want a zk cluster.- Returns:
- zk cluster started.
- Throws:
Exception
- See Also:
-
startMiniZKCluster
private org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster startMiniZKCluster(File dir, int zooKeeperServerNum, int[] clientPortList) throws Exception Start a mini ZK cluster. If the property "test.hbase.zookeeper.property.clientPort" is set the port mentioned is used as the default port for ZooKeeper.- Throws:
Exception
-
getZkCluster
-
setZkCluster
-
shutdownMiniZKCluster
Shuts down zk cluster created by call tostartMiniZKCluster()
or does nothing.- Throws:
IOException
- See Also:
-
getZooKeeperWatcher
Returns a ZKWatcher instance. This instance is shared between HBaseTestingUtility instance users. Don't close it, it will be closed automatically when the cluster shutdowns- Returns:
- The ZKWatcher instance.
- Throws:
IOException
-
getZooKeeperWatcher
public static org.apache.hadoop.hbase.zookeeper.ZKWatcher getZooKeeperWatcher(HBaseZKTestingUtility testUtil) throws IOException Gets a ZKWatcher.- Throws:
IOException
-
cleanupTestDir
Returns True if we removed the test dirs- Overrides:
cleanupTestDir
in classHBaseCommonTestingUtility
-