You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by mb...@apache.org on 2013/03/15 21:11:38 UTC
svn commit: r1457091 -
/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
Author: mbertozzi
Date: Fri Mar 15 20:11:37 2013
New Revision: 1457091
URL: http://svn.apache.org/r1457091
Log:
HBASE-8122 TestAccessController depends on the execution order
Modified:
hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java?rev=1457091&r1=1457090&r2=1457091&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java Fri Mar 15 20:11:37 2013
@@ -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.exception
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 {