Package org.apache.hadoop.hbase
Class HBaseZKTestingUtil
java.lang.Object
org.apache.hadoop.hbase.HBaseCommonTestingUtil
org.apache.hadoop.hbase.HBaseZKTestingUtil
- Direct Known Subclasses:
HBaseTestingUtil
Helpers for testing HBase that do not depend on specific server/etc. things. The main difference
from
HBaseCommonTestingUtil
is that we can start a zookeeper cluster.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.HBaseCommonTestingUtil
HBaseCommonTestingUtil.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.HBaseCommonTestingUtil
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
Returns Where the cluster will write data on the local subsystem.org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster
org.apache.hadoop.hbase.zookeeper.ZKWatcher
Returns a ZKWatcher instance.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.HBaseCommonTestingUtil
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
-
HBaseZKTestingUtil
public HBaseZKTestingUtil() -
HBaseZKTestingUtil
-
-
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 ofHBaseCommonTestingUtility#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
-
cleanupTestDir
Returns true if we removed the test dirs- Overrides:
cleanupTestDir
in classHBaseCommonTestingUtil
-