use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestMasterObserver method testStarted.
@Test
public void testStarted() throws Exception {
SingleProcessHBaseCluster cluster = UTIL.getHBaseCluster();
HMaster master = cluster.getMaster();
assertTrue("Master should be active", master.isActiveMaster());
MasterCoprocessorHost host = master.getMasterCoprocessorHost();
assertNotNull("CoprocessorHost should not be null", host);
CPMasterObserver cp = host.findCoprocessor(CPMasterObserver.class);
assertNotNull("CPMasterObserver coprocessor not found or not installed!", cp);
// check basic lifecycle
assertTrue("MasterObserver should have been started", cp.wasStarted());
assertTrue("preMasterInitialization() hook should have been called", cp.wasMasterInitializationCalled());
assertTrue("postStartMaster() hook should have been called", cp.wasStartMasterCalled());
}
use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestMasterObserver method testGetProceduresOperation.
@Test
public void testGetProceduresOperation() throws Exception {
SingleProcessHBaseCluster cluster = UTIL.getHBaseCluster();
HMaster master = cluster.getMaster();
MasterCoprocessorHost host = master.getMasterCoprocessorHost();
CPMasterObserver cp = host.findCoprocessor(CPMasterObserver.class);
cp.resetStates();
master.getProcedures();
assertTrue("Coprocessor should be called on get procedures request", cp.wasGetProceduresCalled());
}
use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestMasterObserver method testNamespaceOperations.
@Test
public void testNamespaceOperations() throws Exception {
SingleProcessHBaseCluster cluster = UTIL.getHBaseCluster();
String testNamespace = "observed_ns";
HMaster master = cluster.getMaster();
MasterCoprocessorHost host = master.getMasterCoprocessorHost();
CPMasterObserver cp = host.findCoprocessor(CPMasterObserver.class);
// create a table
Admin admin = UTIL.getAdmin();
admin.listNamespaces();
assertTrue("preListNamespaces should have been called", cp.preListNamespacesCalled);
assertTrue("postListNamespaces should have been called", cp.postListNamespacesCalled);
admin.createNamespace(NamespaceDescriptor.create(testNamespace).build());
assertTrue("Test namespace should be created", cp.wasCreateNamespaceCalled());
assertNotNull(admin.getNamespaceDescriptor(testNamespace));
assertTrue("Test namespace descriptor should have been called", cp.wasGetNamespaceDescriptorCalled());
// This test used to do a bunch w/ bypass but bypass of these table and namespace stuff has
// been removed so the testing code was removed.
}
use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestMasterObserver method testGetLocksOperation.
@Test
public void testGetLocksOperation() throws Exception {
SingleProcessHBaseCluster cluster = UTIL.getHBaseCluster();
HMaster master = cluster.getMaster();
MasterCoprocessorHost host = master.getMasterCoprocessorHost();
CPMasterObserver cp = host.findCoprocessor(CPMasterObserver.class);
cp.resetStates();
master.getLocks();
assertTrue("Coprocessor should be called on get locks request", cp.wasGetLocksCalled());
}
use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestMasterObserver method testTableNamesEnumeration.
@Test
public void testTableNamesEnumeration() throws Exception {
SingleProcessHBaseCluster cluster = UTIL.getHBaseCluster();
HMaster master = cluster.getMaster();
MasterCoprocessorHost host = master.getMasterCoprocessorHost();
CPMasterObserver cp = host.findCoprocessor(CPMasterObserver.class);
cp.resetStates();
master.getMasterRpcServices().getTableNames(null, GetTableNamesRequest.newBuilder().build());
assertTrue("Coprocessor should be called on table names request", cp.wasGetTableNamesCalled());
}
Aggregations