Search in sources :

Example 1 with MockMasterServices

use of org.apache.hadoop.hbase.master.assignment.MockMasterServices in project hbase by apache.

the class TestCatalogJanitor method setup.

@Before
public void setup() throws IOException, KeeperException {
    setRootDirAndCleanIt(HTU, this.name.getMethodName());
    NavigableMap<ServerName, SortedSet<byte[]>> regionsToRegionServers = new ConcurrentSkipListMap<ServerName, SortedSet<byte[]>>();
    this.masterServices = new MockMasterServices(HTU.getConfiguration(), regionsToRegionServers);
    this.masterServices.start(10, null);
    this.janitor = new CatalogJanitor(masterServices);
}
Also used : ConcurrentSkipListMap(java.util.concurrent.ConcurrentSkipListMap) ServerName(org.apache.hadoop.hbase.ServerName) MockMasterServices(org.apache.hadoop.hbase.master.assignment.MockMasterServices) SortedSet(java.util.SortedSet) Before(org.junit.Before)

Example 2 with MockMasterServices

use of org.apache.hadoop.hbase.master.assignment.MockMasterServices in project hbase by apache.

the class TestServerRemoteProcedure method setUp.

@Before
public void setUp() throws Exception {
    util = new HBaseTestingUtil();
    this.executor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setUncaughtExceptionHandler((t, e) -> LOG.warn("Uncaught: ", e)).build());
    master = new MockMasterServices(util.getConfiguration(), this.regionsToRegionServers);
    rsDispatcher = new MockRSProcedureDispatcher(master);
    rsDispatcher.setMockRsExecutor(new NoopRSExecutor());
    master.start(2, rsDispatcher);
    am = master.getAssignmentManager();
    master.getServerManager().getOnlineServersList().stream().forEach(serverName -> am.getRegionStates().getOrCreateServer(serverName));
}
Also used : AssignmentManager(org.apache.hadoop.hbase.master.assignment.AssignmentManager) SortedSet(java.util.SortedSet) MockMasterServices(org.apache.hadoop.hbase.master.assignment.MockMasterServices) ThreadFactoryBuilder(org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder) LoggerFactory(org.slf4j.LoggerFactory) TimeoutException(java.util.concurrent.TimeoutException) SWITCH_RPC_THROTTLE(org.apache.hadoop.hbase.master.procedure.ServerProcedureInterface.ServerOperationType.SWITCH_RPC_THROTTLE) Future(java.util.concurrent.Future) TestName(org.junit.rules.TestName) ProcedureStateSerializer(org.apache.hadoop.hbase.procedure2.ProcedureStateSerializer) After(org.junit.After) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) MasterServices(org.apache.hadoop.hbase.master.MasterServices) Assert.fail(org.junit.Assert.fail) OpenRegionProcedure(org.apache.hadoop.hbase.master.assignment.OpenRegionProcedure) ClassRule(org.junit.ClassRule) ExpectedException(org.junit.rules.ExpectedException) ExecutorService(java.util.concurrent.ExecutorService) ServerName(org.apache.hadoop.hbase.ServerName) Bytes(org.apache.hadoop.hbase.util.Bytes) Before(org.junit.Before) TableName(org.apache.hadoop.hbase.TableName) Logger(org.slf4j.Logger) HBaseTestingUtil(org.apache.hadoop.hbase.HBaseTestingUtil) MediumTests(org.apache.hadoop.hbase.testclassification.MediumTests) RemoteProcedureDispatcher(org.apache.hadoop.hbase.procedure2.RemoteProcedureDispatcher) Set(java.util.Set) HBaseClassTestRule(org.apache.hadoop.hbase.HBaseClassTestRule) IOException(java.io.IOException) Test(org.junit.Test) NavigableMap(java.util.NavigableMap) Category(org.junit.experimental.categories.Category) Procedure(org.apache.hadoop.hbase.procedure2.Procedure) Executors(java.util.concurrent.Executors) TimeUnit(java.util.concurrent.TimeUnit) ConcurrentSkipListMap(java.util.concurrent.ConcurrentSkipListMap) Rule(org.junit.Rule) AdminProtos(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos) TransitRegionStateProcedure(org.apache.hadoop.hbase.master.assignment.TransitRegionStateProcedure) RemoteProcedureException(org.apache.hadoop.hbase.procedure2.RemoteProcedureException) MasterTests(org.apache.hadoop.hbase.testclassification.MasterTests) Optional(java.util.Optional) Assert(org.junit.Assert) RegionInfo(org.apache.hadoop.hbase.client.RegionInfo) RegionInfoBuilder(org.apache.hadoop.hbase.client.RegionInfoBuilder) MockMasterServices(org.apache.hadoop.hbase.master.assignment.MockMasterServices) ThreadFactoryBuilder(org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder) HBaseTestingUtil(org.apache.hadoop.hbase.HBaseTestingUtil) Before(org.junit.Before)

Example 3 with MockMasterServices

use of org.apache.hadoop.hbase.master.assignment.MockMasterServices in project hbase by apache.

the class TestCoreMasterCoprocessor method before.

@Before
public void before() throws IOException {
    String methodName = this.name.getMethodName();
    this.ms = new MockMasterServices(HTU.getConfiguration(), null);
    this.mch = new MasterCoprocessorHost(this.ms, HTU.getConfiguration());
    this.mch.preMasterInitialization();
}
Also used : MasterCoprocessorHost(org.apache.hadoop.hbase.master.MasterCoprocessorHost) MockMasterServices(org.apache.hadoop.hbase.master.assignment.MockMasterServices) Before(org.junit.Before)

Aggregations

MockMasterServices (org.apache.hadoop.hbase.master.assignment.MockMasterServices)3 Before (org.junit.Before)3 SortedSet (java.util.SortedSet)2 ConcurrentSkipListMap (java.util.concurrent.ConcurrentSkipListMap)2 ServerName (org.apache.hadoop.hbase.ServerName)2 IOException (java.io.IOException)1 NavigableMap (java.util.NavigableMap)1 Optional (java.util.Optional)1 Set (java.util.Set)1 ExecutorService (java.util.concurrent.ExecutorService)1 Executors (java.util.concurrent.Executors)1 Future (java.util.concurrent.Future)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 TimeUnit (java.util.concurrent.TimeUnit)1 TimeoutException (java.util.concurrent.TimeoutException)1 HBaseClassTestRule (org.apache.hadoop.hbase.HBaseClassTestRule)1 HBaseTestingUtil (org.apache.hadoop.hbase.HBaseTestingUtil)1 TableName (org.apache.hadoop.hbase.TableName)1 RegionInfo (org.apache.hadoop.hbase.client.RegionInfo)1 RegionInfoBuilder (org.apache.hadoop.hbase.client.RegionInfoBuilder)1