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 Summary
Modifier and TypeClassDescription(package private) static class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
System 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.Configuration
private File
Directory where we put the data for this instance of HBaseTestingUtilitystatic final String
Default base directory for test output.protected static final org.slf4j.Logger
private static final HBaseCommonTestingUtility.PortAllocator
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns True if we removed the test dirs(package private) boolean
cleanupTestDir
(String subdir) protected void
createSubDir
(String propertyName, org.apache.hadoop.fs.Path parent, String subDirName) (package private) boolean
(package private) boolean
Returns True if we should delete testing dirs on exit.private org.apache.hadoop.fs.Path
org.apache.hadoop.conf.Configuration
Returns this classes's instance ofConfiguration
.org.apache.hadoop.fs.Path
org.apache.hadoop.fs.Path
getDataTestDir
(String name) org.apache.hadoop.fs.Path
static UUID
static int
protected org.apache.hadoop.fs.Path
Sets 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
-
HBaseCommonTestingUtility
public HBaseCommonTestingUtility() -
HBaseCommonTestingUtility
-
-
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
- 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.
-
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
- 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_DIRECTORY
Should 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.
-
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
-