public class TestRegionNormalizerWorker extends Object
RegionNormalizerWorker
. Being a background thread, the only points of
interaction we have to this class are its input source (RegionNormalizerWorkQueue
and its
callbacks invoked against RegionNormalizer
and MasterServices
. The work queue is
simple enough to use directly; for MasterServices
, use a mock because, as of now, the
worker only invokes 4 methods.Modifier and Type | Field and Description |
---|---|
static HBaseClassTestRule |
CLASS_RULE |
private org.apache.hadoop.hbase.master.MasterServices |
masterServices |
org.mockito.junit.MockitoRule |
mockitoRule |
private org.apache.hadoop.hbase.master.normalizer.RegionNormalizerWorkQueue<org.apache.hadoop.hbase.TableName> |
queue |
private org.apache.hadoop.hbase.master.normalizer.RegionNormalizer |
regionNormalizer |
TableNameTestRule |
tableName |
private HBaseCommonTestingUtility |
testingUtility |
org.junit.rules.TestName |
testName |
private ExecutorService |
workerPool |
private AtomicReference<Throwable> |
workerThreadThrowable |
Constructor and Description |
---|
TestRegionNormalizerWorker() |
Modifier and Type | Method and Description |
---|---|
void |
after() |
private <T> void |
assertThatEventually(String reason,
Supplier<? extends T> actualSupplier,
org.hamcrest.Matcher<? super T> matcher)
Repeatedly evaluates
matcher against the result of calling actualSupplier until
the matcher succeeds or the timeout period of 30 seconds is exhausted. |
void |
before() |
void |
testMergeCounter() |
void |
testRateLimit()
Assert that a rate limit is honored, at least in a rough way.
|
void |
testSplitCounter() |
public static final HBaseClassTestRule CLASS_RULE
public org.junit.rules.TestName testName
public TableNameTestRule tableName
public org.mockito.junit.MockitoRule mockitoRule
@Mock(answer=RETURNS_DEEP_STUBS) private org.apache.hadoop.hbase.master.MasterServices masterServices
@Mock private org.apache.hadoop.hbase.master.normalizer.RegionNormalizer regionNormalizer
private HBaseCommonTestingUtility testingUtility
private org.apache.hadoop.hbase.master.normalizer.RegionNormalizerWorkQueue<org.apache.hadoop.hbase.TableName> queue
private ExecutorService workerPool
private final AtomicReference<Throwable> workerThreadThrowable
public TestRegionNormalizerWorker()
public void testMergeCounter() throws Exception
Exception
public void testSplitCounter() throws Exception
Exception
public void testRateLimit() throws Exception
Exception
private <T> void assertThatEventually(String reason, Supplier<? extends T> actualSupplier, org.hamcrest.Matcher<? super T> matcher) throws Exception
matcher
against the result of calling actualSupplier
until
the matcher succeeds or the timeout period of 30 seconds is exhausted.Exception
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.