Package org.apache.hadoop.hbase
Class IntegrationTestingUtility
java.lang.Object
org.apache.hadoop.hbase.HBaseCommonTestingUtility
org.apache.hadoop.hbase.HBaseZKTestingUtility
org.apache.hadoop.hbase.HBaseTestingUtility
org.apache.hadoop.hbase.IntegrationTestingUtility
Facility for integration/system tests. This extends
HBaseTestingUtility
and adds-in the functionality needed by integration and system tests. This class understands
distributed and pseudo-distributed/local cluster deployments, and abstracts those from the tests
in this module.
IntegrationTestingUtility is constructed and used by the integration tests, but the tests
themselves should not assume a particular deployment. They can rely on the methods in this class
and HBaseCluster. Before the testing begins, the test should initialize the cluster by calling
initializeCluster(int).
The cluster that is used defaults to a mini cluster, but it can be forced to use a distributed
cluster by calling setUseDistributedCluster(Configuration). This method is invoked by
test drivers (maven, IntegrationTestsDriver, etc) before initializing the cluster via
initializeCluster(int). Individual tests should not directly call
setUseDistributedCluster(Configuration).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.HBaseTestingUtility
HBaseTestingUtility.SeenRowTrackerNested classes/interfaces inherited from class org.apache.hadoop.hbase.HBaseCommonTestingUtility
HBaseCommonTestingUtility.PortAllocator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Class<? extends ClusterManager>static final StringConfig for pluggable hbase cluster manager.static final StringConfiguration that controls whether this utility assumes a running/deployed cluster.Fields inherited from class org.apache.hadoop.hbase.HBaseTestingUtility
BLOOM_AND_COMPRESSION_COMBINATIONS, COLUMNS, DEFAULT_REGIONS_PER_SERVER, fam1, fam2, fam3, FIRST_CHAR, KEYS, KEYS_FOR_HBA_CREATE_TABLE, LAST_CHAR, MEMSTORETS_TAGS_PARAMETRIZED, PRESPLIT_TEST_TABLE, PRESPLIT_TEST_TABLE_KEY, REGIONS_PER_SERVER_KEY, ROWS, START_KEY, START_KEY_BYTESFields inherited from class org.apache.hadoop.hbase.HBaseZKTestingUtility
clusterTestDir, zooKeeperWatcherFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckNodeCount(int numSlaves) Checks whether we have more than numSlaves nodes.voidvoidinitializeCluster(int numSlaves) Initializes the state of the cluster.booleanReturns whether we are interacting with a distributed cluster as opposed to and in-process mini cluster or a local cluster.voidRestores the cluster to the initial state if it is a distributed cluster, otherwise, shutdowns the mini cluster.static voidsetUseDistributedCluster(org.apache.hadoop.conf.Configuration conf) Sets the configuration property to use a distributed cluster for the integration tests.Methods inherited from class org.apache.hadoop.hbase.HBaseTestingUtility
assertKVListsEqual, assertRegionOnlyOnServer, assertRegionOnServer, assignRegion, available, await, checksumRows, cleanupDataTestDirOnTestFS, cleanupDataTestDirOnTestFS, closeConnection, closeRegionAndWAL, closeRegionAndWAL, compact, compact, countRows, countRows, countRows, countRows, countRows, countRows, countRows, createLocalHRegion, createLocalHRegion, createLocalHRegion, createLocalHRegion, createLocalHRegion, createLocalHRegion, createLocalHRegionWithInMemoryFlags, createLocalHTU, createLocalHTU, createMockRegionServerService, createMockRegionServerService, createMockRegionServerService, createModifyableTableDescriptor, createModifyableTableDescriptor, createMultiRegionsInMeta, createMultiRegionsInMeta, createMultiRegionTable, createMultiRegionTable, createMultiRegionTable, createMultiRegionTable, createMultiRegionTable, createPreSplitLoadTestTable, createPreSplitLoadTestTable, createPreSplitLoadTestTable, createPreSplitLoadTestTable, createPreSplitLoadTestTable, createPreSplitLoadTestTable, createPreSplitLoadTestTable, createRandomTable, createRegionAndWAL, createRegionAndWAL, createRegionAndWAL, createRegionAndWAL, createRootDir, createRootDir, createTable, createTable, createTable, createTable, createTable, createTable, createTable, createTable, createTable, createTable, createTable, createTable, createTable, createTable, createTable, createTable, createTable, createTable, createTable, createTableDescriptor, createTableDescriptor, createTableDescriptor, createTableDescriptor, createTableDescriptor, createTableDescriptor, createTestRegion, createTestRegion, createWal, createWALRootDir, deleteNumericRows, deleteTable, deleteTableData, deleteTableIfAny, enableDebug, ensureSomeNonStoppedRegionServersAvailable, ensureSomeRegionServersAvailable, expireMasterSession, expireRegionServerSession, expireSession, expireSession, explainTableAvailability, explainTableState, findLastTableState, flush, flush, generateColumnDescriptors, generateColumnDescriptors, getAdmin, getAllOnlineRegions, getClosestRowBefore, getClusterKey, getConfiguration, getConnection, getDataTestDirOnTestFS, getDataTestDirOnTestFS, getDefaultRootDirPath, getDefaultRootDirPath, getDFSCluster, getDifferentUser, getFromStoreFile, getFromStoreFile, getHBaseAdmin, getHBaseCluster, getHBaseClusterInterface, getHbck, getMetaRSPort, getMetaTableDescriptor, getMetaTableDescriptorBuilder, getMetaTableRows, getMetaTableRows, getMiniHBaseCluster, getNumHFiles, getNumHFilesForRS, getOtherRegionServer, getRegionSplitStartKeys, getRSForFirstRegionInTable, getSplittableRegion, getSupportedCompressionAlgorithms, getTestFileSystem, invalidateConnection, isNewVersionBehaviorEnabled, isReadShortCircuitOn, killMiniHBaseCluster, loadNumericRows, loadRandomRows, loadRegion, loadRegion, loadRegion, loadTable, loadTable, loadTable, loadTable, loadTable, memStoreTSTagsAndOffheapCombination, modifyTableSync, moveRegionAndWait, predicateNoRegionsInTransition, predicateTableAvailable, predicateTableDisabled, predicateTableEnabled, randomFreePort, randomMultiCastAddress, restartHBaseCluster, restartHBaseCluster, restartHBaseCluster, safeGetAsStr, setDFSCluster, setDFSCluster, setFileSystemURI, setHBaseCluster, setMaxRecoveryErrorCount, setReplicas, setReplicas, setupDataTestDir, setupMiniKdc, shutdownMiniCluster, shutdownMiniDFSCluster, shutdownMiniHBaseCluster, shutdownMiniMapReduceCluster, startMiniCluster, startMiniCluster, startMiniCluster, startMiniCluster, startMiniCluster, startMiniCluster, startMiniCluster, startMiniCluster, startMiniCluster, startMiniCluster, startMiniCluster, startMiniCluster, startMiniCluster, startMiniCluster, startMiniDFSCluster, startMiniDFSCluster, startMiniDFSCluster, startMiniDFSCluster, startMiniDFSClusterForTestWAL, startMiniHBaseCluster, startMiniHBaseCluster, startMiniHBaseCluster, startMiniHBaseCluster, startMiniHBaseCluster, startMiniMapReduceCluster, truncateTable, truncateTable, unassignRegion, unassignRegion, unassignRegionByRow, unassignRegionByRow, verifyNumericRows, verifyNumericRows, verifyNumericRows, verifyNumericRows, verifyNumericRows, verifyTableDescriptorIgnoreTableName, waitForHostPort, waitLabelAvailable, waitTableAvailable, waitTableAvailable, waitTableAvailable, waitTableDisabled, waitTableDisabled, waitTableDisabled, waitTableEnabled, waitTableEnabled, waitTableEnabled, waitUntilAllRegionsAssigned, waitUntilAllRegionsAssigned, waitUntilAllSystemRegionsAssigned, waitUntilNoRegionsInTransition, waitUntilNoRegionsInTransitionMethods inherited from class org.apache.hadoop.hbase.HBaseZKTestingUtility
cleanupTestDir, getClusterTestDir, getZkCluster, getZooKeeperWatcher, getZooKeeperWatcher, setupClusterTestDir, setZkCluster, shutdownMiniZKCluster, startMiniZKCluster, startMiniZKClusterMethods inherited from class org.apache.hadoop.hbase.HBaseCommonTestingUtility
cleanupTestDir, createSubDir, deleteDir, deleteOnExit, getDataTestDir, getDataTestDir, getRandomDir, getRandomUUID, waitFor, waitFor, waitFor
-
Field Details
-
IS_DISTRIBUTED_CLUSTER
Configuration that controls whether this utility assumes a running/deployed cluster. This is different than "hbase.cluster.distributed" since that parameter indicates whether the cluster is in an actual distributed environment, while this shows that there is a deployed (distributed or pseudo-distributed) cluster running, and we do not need to start a mini-cluster for tests.- See Also:
-
HBASE_CLUSTER_MANAGER_CLASS
Config for pluggable hbase cluster manager. Pass fully-qualified class name as property value. Drop the '.class' suffix.- See Also:
-
DEFAULT_HBASE_CLUSTER_MANAGER_CLASS
-
-
Constructor Details
-
IntegrationTestingUtility
public IntegrationTestingUtility() -
IntegrationTestingUtility
-
-
Method Details
-
initializeCluster
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.- Parameters:
numSlaves- Number of slaves to start up if we are booting a mini cluster. Otherwise we check whether this many nodes are available and throw an exception if not.- Throws:
Exception
-
checkNodeCount
Checks whether we have more than numSlaves nodes. Throws an exception otherwise.- Throws:
Exception
-
restoreCluster
Restores the cluster to the initial state if it is a distributed cluster, otherwise, shutdowns the mini cluster.- Throws:
IOException
-
setUseDistributedCluster
Sets the configuration property to use a distributed cluster for the integration tests. Test drivers should use this to enforce cluster deployment. -
isDistributedCluster
Returns whether we are interacting with a distributed cluster as opposed to and in-process mini cluster or a local cluster.- See Also:
-
createDistributedHBaseCluster
- Throws:
IOException
-