Package org.apache.hadoop.hbase
Class HBaseCommonTestingUtility
java.lang.Object
org.apache.hadoop.hbase.HBaseCommonTestingUtility
- Direct Known Subclasses:
- HBaseZKTestingUtility
Common helpers for testing HBase that do not depend on specific server/etc. things.
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescription(package private) static class
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringSystem property key to get base test directory valueThis is for unit tests parameterized with a two booleans.static final org.apache.hadoop.hbase.io.compress.Compression.Algorithm[]Compression algorithms to use in testingCompression algorithms to use in parameterized JUnit 4 testsprotected final org.apache.hadoop.conf.Configurationprivate FileDirectory where we put the data for this instance of HBaseTestingUtilitystatic final StringDefault base directory for test output.protected static final org.slf4j.Loggerprivate static final HBaseCommonTestingUtility.PortAllocator
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanReturns True if we removed the test dirs(package private) booleancleanupTestDir(String subdir) protected voidcreateSubDir(String propertyName, org.apache.hadoop.fs.Path parent, String subDirName) (package private) boolean(package private) booleanReturns True if we should delete testing dirs on exit.private org.apache.hadoop.fs.Pathorg.apache.hadoop.conf.ConfigurationReturns this classes's instance ofConfiguration.org.apache.hadoop.fs.Pathorg.apache.hadoop.fs.PathgetDataTestDir(String name) org.apache.hadoop.fs.Pathstatic UUIDstatic intprotected org.apache.hadoop.fs.PathSets up a directory for a test to use.<E extends Exception>
 longwaitFor(long timeout, long interval, boolean failIfTimeout, Waiter.Predicate<E> predicate) Wrapper method forWaiter.waitFor(Configuration, long, long, boolean, Predicate).<E extends Exception>
 longwaitFor(long timeout, long interval, Waiter.Predicate<E> predicate) Wrapper method forWaiter.waitFor(Configuration, long, long, Predicate).<E extends Exception>
 longwaitFor(long timeout, Waiter.Predicate<E> predicate) Wrapper method forWaiter.waitFor(Configuration, long, Predicate).
- 
Field Details- 
LOG
- 
COMPRESSION_ALGORITHMS_PARAMETERIZEDCompression algorithms to use in parameterized JUnit 4 tests
- 
BOOLEAN_PARAMETERIZEDThis is for unit tests parameterized with a two booleans.
- 
COMPRESSION_ALGORITHMSpublic static final org.apache.hadoop.hbase.io.compress.Compression.Algorithm[] COMPRESSION_ALGORITHMSCompression algorithms to use in testing
- 
conf
- 
BASE_TEST_DIRECTORY_KEYSystem property key to get base test directory value- See Also:
 
- 
DEFAULT_BASE_TEST_DIRECTORYDefault base directory for test output.- See Also:
 
- 
dataTestDirDirectory where we put the data for this instance of HBaseTestingUtility
- 
portAllocator
 
- 
- 
Constructor Details- 
HBaseCommonTestingUtilitypublic HBaseCommonTestingUtility()
- 
HBaseCommonTestingUtility
 
- 
- 
Method Details- 
getConfigurationReturns this classes's instance ofConfiguration.- Returns:
- Instance of Configuration.
 
- 
getDataTestDir- Returns:
- Where to write test data on local filesystem, specific to the test. Useful for tests that do not use a cluster. Creates it if it does not exist already.
 
- 
getDataTestDir- Parameters:
- name- the name of a subdirectory or file in the test data directory
- Returns:
- Path to a subdirectory or file named {code subdirName} under getDataTestDir(). Does *NOT* create the directory or file if it does not exist.
 
- 
setupDataTestDirSets up a directory for a test to use.- Returns:
- New directory path, if created.
 
- 
getRandomDir- Returns:
- A dir with a random (uuid) name under the test dir
- See Also:
 
- 
getRandomUUID
- 
createSubDirprotected void createSubDir(String propertyName, org.apache.hadoop.fs.Path parent, String subDirName) 
- 
deleteOnExitboolean deleteOnExit()Returns True if we should delete testing dirs on exit.
- 
cleanupTestDirReturns True if we removed the test dirs
- 
cleanupTestDir- Parameters:
- subdir- Test subdir name.
- Returns:
- True if we removed the test dir
 
- 
getBaseTestDir- Returns:
- Where to write test data on local filesystem; usually
         DEFAULT_BASE_TEST_DIRECTORYShould not be used by the unit tests, hence its's private. Unit test will use a subdirectory of this directory.
- See Also:
 
- 
deleteDir- Parameters:
- dir- Directory to delete
- Returns:
- True if we deleted it.
 
- 
waitForWrapper method forWaiter.waitFor(Configuration, long, Predicate).- Throws:
- E extends Exception
 
- 
waitForpublic <E extends Exception> long waitFor(long timeout, long interval, Waiter.Predicate<E> predicate) throws E Wrapper method forWaiter.waitFor(Configuration, long, long, Predicate).- Throws:
- E extends Exception
 
- 
waitForpublic <E extends Exception> long waitFor(long timeout, long interval, boolean failIfTimeout, Waiter.Predicate<E> predicate) throws E Wrapper method forWaiter.waitFor(Configuration, long, long, boolean, Predicate).- Throws:
- E extends Exception
 
- 
randomFreePort
 
-