@InterfaceAudience.LimitedPrivate(value="Phoenix") @InterfaceStability.Evolving public class HBaseCommonTestingUtil extends Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
HBaseCommonTestingUtil.PortAllocator |
Modifier and Type | Field and Description |
---|---|
static String |
BASE_TEST_DIRECTORY_KEY
System property key to get base test directory value
|
static List<Object[]> |
BOOLEAN_PARAMETERIZED
This is for unit tests parameterized with a two booleans.
|
static org.apache.hadoop.hbase.io.compress.Compression.Algorithm[] |
COMPRESSION_ALGORITHMS
Compression algorithms to use in testing
|
static List<Object[]> |
COMPRESSION_ALGORITHMS_PARAMETERIZED
Compression algorithms to use in parameterized JUnit 4 tests
|
protected org.apache.hadoop.conf.Configuration |
conf |
private File |
dataTestDir
Directory where we put the data for this instance of HBaseTestingUtility
|
static String |
DEFAULT_BASE_TEST_DIRECTORY
Default base directory for test output.
|
protected static org.slf4j.Logger |
LOG |
private static HBaseCommonTestingUtil.PortAllocator |
portAllocator |
Constructor and Description |
---|
HBaseCommonTestingUtil() |
HBaseCommonTestingUtil(org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
boolean |
cleanupTestDir()
Returns true if we removed the test dirs
|
boolean |
cleanupTestDir(String subdir)
Returns true if we removed the test dir
|
protected void |
createSubDir(String propertyName,
org.apache.hadoop.fs.Path parent,
String subDirName) |
(package private) boolean |
deleteDir(File dir)
Returns true if we deleted it.
|
(package private) boolean |
deleteOnExit()
Returns true if we should delete testing dirs on exit.
|
private org.apache.hadoop.fs.Path |
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. |
org.apache.hadoop.conf.Configuration |
getConfiguration()
Returns this classes's instance of
Configuration . |
org.apache.hadoop.fs.Path |
getDataTestDir()
Returns Where to write test data on local filesystem, specific to the test.
|
org.apache.hadoop.fs.Path |
getDataTestDir(String name)
Returns the path to a subdirectory or file named {code subdirName} under
getDataTestDir() . |
org.apache.hadoop.fs.Path |
getRandomDir()
Returns a dir with a random (uuid) name under the test dir
|
static UUID |
getRandomUUID() |
static int |
randomFreePort() |
protected org.apache.hadoop.fs.Path |
setupDataTestDir()
Sets up a directory for a test to use.
|
<E extends Exception> |
waitFor(long timeout,
long interval,
boolean failIfTimeout,
Waiter.Predicate<E> predicate)
Wrapper method for
Waiter.waitFor(Configuration, long, long, boolean, Predicate) . |
<E extends Exception> |
waitFor(long timeout,
long interval,
Waiter.Predicate<E> predicate)
Wrapper method for
Waiter.waitFor(Configuration, long, long, Predicate) . |
<E extends Exception> |
waitFor(long timeout,
Waiter.Predicate<E> predicate)
Wrapper method for
Waiter.waitFor(Configuration, long, Predicate) . |
protected static final org.slf4j.Logger LOG
public static final List<Object[]> COMPRESSION_ALGORITHMS_PARAMETERIZED
public static final List<Object[]> BOOLEAN_PARAMETERIZED
public static final org.apache.hadoop.hbase.io.compress.Compression.Algorithm[] COMPRESSION_ALGORITHMS
protected final org.apache.hadoop.conf.Configuration conf
public static final String BASE_TEST_DIRECTORY_KEY
public static final String DEFAULT_BASE_TEST_DIRECTORY
private File dataTestDir
private static final HBaseCommonTestingUtil.PortAllocator portAllocator
public HBaseCommonTestingUtil()
public HBaseCommonTestingUtil(org.apache.hadoop.conf.Configuration conf)
public org.apache.hadoop.conf.Configuration getConfiguration()
Configuration
.public org.apache.hadoop.fs.Path getDataTestDir()
public org.apache.hadoop.fs.Path getDataTestDir(String name)
getDataTestDir()
. Does *NOT* create the directory or file if it does not exist.name
- the name of a subdirectory or file in the test data directoryprotected org.apache.hadoop.fs.Path setupDataTestDir()
public org.apache.hadoop.fs.Path getRandomDir()
getBaseTestDir()
public static UUID getRandomUUID()
protected void createSubDir(String propertyName, org.apache.hadoop.fs.Path parent, String subDirName)
boolean deleteOnExit()
public boolean cleanupTestDir()
public boolean cleanupTestDir(String subdir)
subdir
- Test subdir name.private org.apache.hadoop.fs.Path getBaseTestDir()
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.setupDataTestDir()
boolean deleteDir(File dir)
dir
- Directory to deletepublic <E extends Exception> long waitFor(long timeout, Waiter.Predicate<E> predicate) throws E extends Exception
Waiter.waitFor(Configuration, long, Predicate)
.E extends Exception
public <E extends Exception> long waitFor(long timeout, long interval, Waiter.Predicate<E> predicate) throws E extends Exception
Waiter.waitFor(Configuration, long, long, Predicate)
.E extends Exception
public <E extends Exception> long waitFor(long timeout, long interval, boolean failIfTimeout, Waiter.Predicate<E> predicate) throws E extends Exception
Waiter.waitFor(Configuration, long, long, boolean, Predicate)
.E extends Exception
public static int randomFreePort()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.