Search in sources :

Example 26 with HBaseCommonTestingUtil

use of org.apache.hadoop.hbase.HBaseCommonTestingUtil in project hbase by apache.

the class TestRegionNormalizerWorker method before.

@Before
public void before() throws Exception {
    MockitoAnnotations.initMocks(this);
    when(masterServices.skipRegionManagementAction(any())).thenReturn(false);
    testingUtility = new HBaseCommonTestingUtil();
    queue = new RegionNormalizerWorkQueue<>();
    workerThreadThrowable.set(null);
    final String threadNameFmt = TestRegionNormalizerWorker.class.getSimpleName() + "-" + testName.getMethodName() + "-%d";
    final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat(threadNameFmt).setDaemon(true).setUncaughtExceptionHandler((t, e) -> workerThreadThrowable.set(e)).build();
    workerPool = Executors.newSingleThreadExecutor(threadFactory);
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Arrays(java.util.Arrays) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) Waiter(org.apache.hadoop.hbase.Waiter) StringDescription(org.hamcrest.StringDescription) Mock(org.mockito.Mock) ThreadFactoryBuilder(org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder) ArgumentMatchers.anyBoolean(org.mockito.ArgumentMatchers.anyBoolean) AtomicReference(java.util.concurrent.atomic.AtomicReference) Supplier(java.util.function.Supplier) Collections.singletonList(java.util.Collections.singletonList) MockitoAnnotations(org.mockito.MockitoAnnotations) HBaseCommonTestingUtil(org.apache.hadoop.hbase.HBaseCommonTestingUtil) TableDescriptorBuilder(org.apache.hadoop.hbase.client.TableDescriptorBuilder) Matchers.comparesEqualTo(org.hamcrest.Matchers.comparesEqualTo) TestName(org.junit.rules.TestName) Matchers.nullValue(org.hamcrest.Matchers.nullValue) Duration(java.time.Duration) Configuration(org.apache.hadoop.conf.Configuration) After(org.junit.After) MasterServices(org.apache.hadoop.hbase.master.MasterServices) MockitoJUnit(org.mockito.junit.MockitoJUnit) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) ThreadFactory(java.util.concurrent.ThreadFactory) ClassRule(org.junit.ClassRule) ExecutorService(java.util.concurrent.ExecutorService) Before(org.junit.Before) Description(org.hamcrest.Description) Matchers.greaterThanOrEqualTo(org.hamcrest.Matchers.greaterThanOrEqualTo) TableName(org.apache.hadoop.hbase.TableName) Answers(org.mockito.Answers) Assert.assertTrue(org.junit.Assert.assertTrue) HBaseClassTestRule(org.apache.hadoop.hbase.HBaseClassTestRule) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) Category(org.junit.experimental.categories.Category) Executors(java.util.concurrent.Executors) TimeUnit(java.util.concurrent.TimeUnit) Rule(org.junit.Rule) TableNameTestRule(org.apache.hadoop.hbase.TableNameTestRule) MasterTests(org.apache.hadoop.hbase.testclassification.MasterTests) Matcher(org.hamcrest.Matcher) SmallTests(org.apache.hadoop.hbase.testclassification.SmallTests) Matchers.greaterThan(org.hamcrest.Matchers.greaterThan) MockitoRule(org.mockito.junit.MockitoRule) RegionInfo(org.apache.hadoop.hbase.client.RegionInfo) RegionInfoBuilder(org.apache.hadoop.hbase.client.RegionInfoBuilder) TableDescriptor(org.apache.hadoop.hbase.client.TableDescriptor) ThreadFactory(java.util.concurrent.ThreadFactory) HBaseCommonTestingUtil(org.apache.hadoop.hbase.HBaseCommonTestingUtil) ThreadFactoryBuilder(org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder) Before(org.junit.Before)

Aggregations

HBaseCommonTestingUtil (org.apache.hadoop.hbase.HBaseCommonTestingUtil)26 Before (org.junit.Before)20 Path (org.apache.hadoop.fs.Path)15 Configuration (org.apache.hadoop.conf.Configuration)7 BeforeClass (org.junit.BeforeClass)6 File (java.io.File)4 LoadCounter (org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility.LoadCounter)4 NoopProcedureStore (org.apache.hadoop.hbase.procedure2.store.NoopProcedureStore)3 URI (java.net.URI)1 URL (java.net.URL)1 Duration (java.time.Duration)1 Arrays (java.util.Arrays)1 Collections.singletonList (java.util.Collections.singletonList)1 ExecutorService (java.util.concurrent.ExecutorService)1 Executors (java.util.concurrent.Executors)1 ThreadFactory (java.util.concurrent.ThreadFactory)1 TimeUnit (java.util.concurrent.TimeUnit)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Supplier (java.util.function.Supplier)1 FileSystem (org.apache.hadoop.fs.FileSystem)1