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);
}
Aggregations