Package org.apache.hadoop.hbase
Class HBaseCommonTestingUtil
java.lang.Object
org.apache.hadoop.hbase.HBaseCommonTestingUtil
- Direct Known Subclasses:
HBaseZKTestingUtil
Common helpers for testing HBase that do not depend on specific server/etc. things.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class -
Field Summary
FieldsModifier 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 HBaseCommonTestingUtil.PortAllocator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if we removed the test dirsbooleancleanupTestDir(String subdir) Returns true if we removed the test dirprotected voidcreateSubDir(String propertyName, org.apache.hadoop.fs.Path parent, String subDirName) (package private) booleanReturns true if we deleted it.(package private) booleanReturns true if we should delete testing dirs on exit.private org.apache.hadoop.fs.PathReturns Where to write test data on local filesystem; usuallyDEFAULT_BASE_TEST_DIRECTORYShould not be used by the unit tests, hence its's private.org.apache.hadoop.conf.ConfigurationReturns this classes's instance ofConfiguration.org.apache.hadoop.fs.PathReturns Where to write test data on local filesystem, specific to the test.org.apache.hadoop.fs.PathgetDataTestDir(String name) Returns the path to a subdirectory or file named {code subdirName} undergetDataTestDir().org.apache.hadoop.fs.PathReturns a dir with a random (uuid) name under the test dirstatic 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_PARAMETERIZED
Compression algorithms to use in parameterized JUnit 4 tests -
BOOLEAN_PARAMETERIZED
This is for unit tests parameterized with a two booleans. -
COMPRESSION_ALGORITHMS
public static final org.apache.hadoop.hbase.io.compress.Compression.Algorithm[] COMPRESSION_ALGORITHMSCompression algorithms to use in testing -
conf
-
BASE_TEST_DIRECTORY_KEY
System property key to get base test directory value- See Also:
-
DEFAULT_BASE_TEST_DIRECTORY
Default base directory for test output.- See Also:
-
dataTestDir
Directory where we put the data for this instance of HBaseTestingUtility -
portAllocator
-
-
Constructor Details
-
HBaseCommonTestingUtil
public HBaseCommonTestingUtil() -
HBaseCommonTestingUtil
-
-
Method Details
-
getConfiguration
Returns 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
Returns the path to a subdirectory or file named {code subdirName} undergetDataTestDir(). Does *NOT* create the directory or file if it does not exist.- Parameters:
name- the name of a subdirectory or file in the test data directory
-
setupDataTestDir
Sets 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
-
createSubDir
protected void createSubDir(String propertyName, org.apache.hadoop.fs.Path parent, String subDirName) -
deleteOnExit
boolean deleteOnExit()Returns true if we should delete testing dirs on exit. -
cleanupTestDir
Returns true if we removed the test dirs -
cleanupTestDir
Returns true if we removed the test dir- Parameters:
subdir- Test subdir name.
-
getBaseTestDir
Returns Where to write test data on local filesystem; usuallyDEFAULT_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
Returns true if we deleted it.- Parameters:
dir- Directory to delete
-
waitFor
Wrapper method forWaiter.waitFor(Configuration, long, Predicate).- Throws:
E extends Exception
-
waitFor
public <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
-
waitFor
public <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
-