HBASE-8964 TestAccessController.testGlobalAuthorizationForNewRegisteredRS

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1503961 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2013-07-17 00:51:36 +00:00
parent b73d17e4e4
commit 658bac81e3
1 changed files with 11 additions and 11 deletions

View File

@ -127,6 +127,7 @@ public class TestAccessController {
// user with no permissions
private static User USER_NONE;
private static byte[] TEST_TABLE2 = Bytes.toBytes("testtable2");
private static byte[] TEST_FAMILY = Bytes.toBytes("f1");
private static MasterCoprocessorEnvironment CP_ENV;
@ -1917,7 +1918,7 @@ public class TestAccessController {
verifyDenied(cloneAction, USER_CREATE, USER_RW, USER_RO, USER_NONE, USER_OWNER);
}
@Test (timeout=30000)
@Test
public void testGlobalAuthorizationForNewRegisteredRS() throws Exception {
LOG.debug("Test for global authorization for a new registered RegionServer.");
MiniHBaseCluster hbaseCluster = TEST_UTIL.getHBaseCluster();
@ -1940,8 +1941,7 @@ public class TestAccessController {
acl.close();
}
HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
final byte [] tableName = Bytes.toBytes("testGlobalAuthorizationForNewRegisteredRS");
HTableDescriptor htd = new HTableDescriptor(tableName);
HTableDescriptor htd = new HTableDescriptor(TEST_TABLE2);
htd.addFamily(new HColumnDescriptor(TEST_FAMILY));
admin.createTable(htd);
@ -1951,7 +1951,7 @@ public class TestAccessController {
final HRegionServer newRs = newRsThread.getRegionServer();
// Move region to the new RegionServer.
HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName);
HTable table = new HTable(TEST_UTIL.getConfiguration(), TEST_TABLE2);
try {
NavigableMap<HRegionInfo, ServerName> regions = table
.getRegionLocations();
@ -1968,25 +1968,25 @@ public class TestAccessController {
};
SUPERUSER.runAs(moveAction);
final int RETRIES_LIMIT = 100;
final int RETRIES_LIMIT = 10;
int retries = 0;
while (newRs.getOnlineRegions(tableName).size() < 1 && retries < RETRIES_LIMIT) {
LOG.debug("Waiting for a region to be opened. Already retried " + retries + " times.");
while (newRs.getOnlineRegions(TEST_TABLE2).size() < 1 && retries < RETRIES_LIMIT) {
LOG.debug("Waiting for region to be opened. Already retried " + retries
+ " times.");
try {
Thread.sleep(1000);
Thread.sleep(200);
} catch (InterruptedException e) {
}
retries++;
if (retries == RETRIES_LIMIT - 1) {
fail("Retry exhaust for waiting region to be opened: " +
newRs.getOnlineRegions(tableName));
fail("Retry exhaust for waiting region to be opened.");
}
}
// Verify write permission for user "admin2" who has the global
// permissions.
PrivilegedExceptionAction putAction = new PrivilegedExceptionAction() {
public Object run() throws Exception {
HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName);
HTable table = new HTable(TEST_UTIL.getConfiguration(), TEST_TABLE2);
Put put = new Put(Bytes.toBytes("test"));
put.add(TEST_FAMILY, Bytes.toBytes("qual"), Bytes.toBytes("value"));
table.put(put);