Search in sources :

Example 1 with Hbck

use of org.apache.hadoop.hbase.client.Hbck in project hbase by apache.

the class TestAccessController method testUnauthorizedSetRegionStateInMeta.

@Test
public void testUnauthorizedSetRegionStateInMeta() throws Exception {
    Admin admin = TEST_UTIL.getAdmin();
    final List<RegionInfo> regions = admin.getRegions(TEST_TABLE);
    RegionInfo closeRegion = regions.get(0);
    Map<String, RegionState.State> newStates = new HashMap<>();
    newStates.put(closeRegion.getEncodedName(), RegionState.State.CLOSED);
    AccessTestAction action = () -> {
        try (Connection conn = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
            Hbck hbck = conn.getHbck()) {
            hbck.setRegionStateInMeta(newStates);
        }
        return null;
    };
    verifyDenied(action, USER_CREATE, USER_OWNER, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ, USER_GROUP_WRITE, USER_GROUP_CREATE);
}
Also used : Hbck(org.apache.hadoop.hbase.client.Hbck) HashMap(java.util.HashMap) RegionState(org.apache.hadoop.hbase.master.RegionState) ProcedureState(org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.ProcedureState) SyncReplicationState(org.apache.hadoop.hbase.replication.SyncReplicationState) TableState(org.apache.hadoop.hbase.client.TableState) Connection(org.apache.hadoop.hbase.client.Connection) RegionInfo(org.apache.hadoop.hbase.client.RegionInfo) Admin(org.apache.hadoop.hbase.client.Admin) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 Admin (org.apache.hadoop.hbase.client.Admin)1 Connection (org.apache.hadoop.hbase.client.Connection)1 Hbck (org.apache.hadoop.hbase.client.Hbck)1 RegionInfo (org.apache.hadoop.hbase.client.RegionInfo)1 TableState (org.apache.hadoop.hbase.client.TableState)1 RegionState (org.apache.hadoop.hbase.master.RegionState)1 SyncReplicationState (org.apache.hadoop.hbase.replication.SyncReplicationState)1 ProcedureState (org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.ProcedureState)1 Test (org.junit.Test)1