hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject [08/44] hbase git commit: HBASE-13246 Correct the assertion for namespace permissions in tearDown method of TestAccessController (Ashish Singhi)
Date Mon, 23 Mar 2015 22:22:53 GMT
HBASE-13246 Correct the assertion for namespace permissions in tearDown method of TestAccessController
(Ashish Singhi)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/76ba5300
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/76ba5300
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/76ba5300

Branch: refs/heads/hbase-12439
Commit: 76ba53004b3760c6c3d1a51dc000205fd68f1d53
Parents: b7e2daa
Author: tedyu <yuzhihong@gmail.com>
Authored: Mon Mar 16 06:47:56 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Mon Mar 16 06:47:56 2015 -0700

----------------------------------------------------------------------
 .../security/access/TestAccessController.java   | 26 ++++++++++++++------
 1 file changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/76ba5300/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
index ffabe34..9a45116 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
@@ -20,7 +20,6 @@ package org.apache.hadoop.hbase.security.access;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -288,7 +287,10 @@ public class TestAccessController extends SecureTestUtil {
     }
     // Verify all table/namespace permissions are erased
     assertEquals(0, AccessControlLists.getTablePermissions(conf, TEST_TABLE.getTableName()).size());
-    assertEquals(0, AccessControlLists.getNamespacePermissions(conf, TEST_TABLE.getTableName().getNameAsString()).size());
+    assertEquals(
+      0,
+      AccessControlLists.getNamespacePermissions(conf,
+        TEST_TABLE.getTableName().getNamespaceAsString()).size());
   }
 
   @Test
@@ -2168,13 +2170,17 @@ public class TestAccessController extends SecureTestUtil {
 
     verifyDenied(getAction, USER_NONE);
 
+    String namespace = "testNamespaceUserGrant";
+    NamespaceDescriptor desc = NamespaceDescriptor.create(namespace).build();
+    TEST_UTIL.getMiniHBaseCluster().getMaster().createNamespace(desc);
+    
     // Grant namespace READ to USER_NONE, this should supersede any table permissions
-    grantOnNamespace(TEST_UTIL, USER_NONE.getShortName(),
-      TEST_TABLE.getTableName().getNamespaceAsString(),
-      Permission.Action.READ);
+    grantOnNamespace(TEST_UTIL, USER_NONE.getShortName(), namespace, Permission.Action.READ);
 
     // Now USER_NONE should be able to read also
     verifyAllowed(getAction, USER_NONE);
+    
+    TEST_UTIL.getMiniHBaseCluster().getMaster().deleteNamespace(namespace);
   }
 
   @Test
@@ -2386,14 +2392,18 @@ public class TestAccessController extends SecureTestUtil {
     // Verify that EXEC permission is checked correctly
     verifyDenied(execEndpointAction, userB);
     verifyAllowed(execEndpointAction, userA);
+    
+    String namespace = "testCoprocessorExec";
+    NamespaceDescriptor desc = NamespaceDescriptor.create(namespace).build();
+    TEST_UTIL.getMiniHBaseCluster().getMaster().createNamespace(desc);
 
     // Now grant EXEC to the entire namespace to user B
-    grantOnNamespace(TEST_UTIL, userB.getShortName(),
-      TEST_TABLE.getTableName().getNamespaceAsString(),
-      Permission.Action.EXEC);
+    grantOnNamespace(TEST_UTIL, userB.getShortName(), namespace, Permission.Action.EXEC);
 
     // User B should now be allowed also
     verifyAllowed(execEndpointAction, userA, userB);
+    
+    TEST_UTIL.getMiniHBaseCluster().getMaster().deleteNamespace(namespace);
   }
 
   @Test


Mime
View raw message