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.
  • Field Details

    • zkCluster

      private org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster zkCluster
    • passedZkCluster

      private boolean passedZkCluster
      Set if we were passed a zkCluster. If so, we won't shutdown zk as part of general shutdown.
    • zooKeeperWatcher

      protected org.apache.hadoop.hbase.zookeeper.ZKWatcher zooKeeperWatcher
    • clusterTestDir

      protected File clusterTestDir
      Directory (a subdirectory of dataTestDir) used by the dfs cluster if any
  • Constructor Details

  • 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

      protected void setupClusterTestDir()
      Creates a directory for the cluster, under the test data
    • startMiniZKCluster

      public org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster startMiniZKCluster() throws Exception
      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

      public org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster getZkCluster()
    • setZkCluster

      public void setZkCluster(org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster zkCluster)
    • shutdownMiniZKCluster

      public void shutdownMiniZKCluster() throws IOException
      Shuts down zk cluster created by call to startMiniZKCluster() or does nothing.
      Throws:
      IOException
      See Also:
    • getZooKeeperWatcher

      public org.apache.hadoop.hbase.zookeeper.ZKWatcher getZooKeeperWatcher() throws IOException
      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

      public boolean cleanupTestDir()
      Returns True if we removed the test dirs
      Overrides:
      cleanupTestDir in class HBaseCommonTestingUtility