HBASE-8122 TestAccessController depends on the execution order
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1457091 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
16589af634
commit
ba155ad854
|
@ -19,6 +19,7 @@
|
|||
package org.apache.hadoop.hbase.security.access;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
|
@ -75,7 +76,9 @@ import org.apache.hadoop.hbase.exceptions.AccessDeniedException;
|
|||
import org.apache.hadoop.hbase.security.User;
|
||||
import org.apache.hadoop.hbase.security.access.Permission.Action;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
@ -113,9 +116,9 @@ public class TestAccessController {
|
|||
private static byte[] TEST_FAMILY = Bytes.toBytes("f1");
|
||||
|
||||
private static MasterCoprocessorEnvironment CP_ENV;
|
||||
private static RegionCoprocessorEnvironment RCP_ENV;
|
||||
private static RegionServerCoprocessorEnvironment RSCP_ENV;
|
||||
private static AccessController ACCESS_CONTROLLER;
|
||||
private static RegionServerCoprocessorEnvironment RSCP_ENV;
|
||||
private RegionCoprocessorEnvironment RCP_ENV;
|
||||
|
||||
@BeforeClass
|
||||
public static void setupBeforeClass() throws Exception {
|
||||
|
@ -150,7 +153,16 @@ public class TestAccessController {
|
|||
USER_OWNER = User.createUserForTesting(conf, "owner", new String[0]);
|
||||
USER_CREATE = User.createUserForTesting(conf, "tbl_create", new String[0]);
|
||||
USER_NONE = User.createUserForTesting(conf, "nouser", new String[0]);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownAfterClass() throws Exception {
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
// Create the test table (owner added to the _acl_ table)
|
||||
HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
|
||||
HTableDescriptor htd = new HTableDescriptor(TEST_TABLE);
|
||||
htd.addFamily(new HColumnDescriptor(TEST_FAMILY));
|
||||
|
@ -186,14 +198,18 @@ public class TestAccessController {
|
|||
|
||||
protocol.grant(null, RequestConverter.buildGrantRequest(USER_CREATE.getShortName(),
|
||||
TEST_TABLE, null, null, AccessControlProtos.Permission.Action.CREATE));
|
||||
|
||||
assertEquals(4, AccessControlLists.getTablePermissions(conf, TEST_TABLE).size());
|
||||
} finally {
|
||||
acl.close();
|
||||
}
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownAfterClass() throws Exception {
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
// Clean the _acl_ table
|
||||
TEST_UTIL.deleteTable(TEST_TABLE);
|
||||
assertEquals(0, AccessControlLists.getTablePermissions(conf, TEST_TABLE).size());
|
||||
}
|
||||
|
||||
public void verifyAllowed(User user, PrivilegedExceptionAction... actions) throws Exception {
|
||||
|
|
Loading…
Reference in New Issue