hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [1/3] hbase git commit: Amend HBASE-14818 user_permission does not list namespace permissions
Date Sat, 28 May 2016 01:34:06 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 74854148e -> 45bf0c64f


Amend HBASE-14818 user_permission does not list namespace permissions

Fix new test case in TestAccessController for 0.98 branch


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

Branch: refs/heads/0.98
Commit: 45bf0c64ff94c348a2f3fd8cdf72c0d94bb6a4ae
Parents: 8210934
Author: Andrew Purtell <apurtell@apache.org>
Authored: Fri May 27 18:05:08 2016 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Fri May 27 18:33:41 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/45bf0c64/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 5ce90eb..e6bde07 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
@@ -2389,19 +2389,39 @@ public class TestAccessController extends SecureTestUtil {
 
   @Test
   public void testGetNamespacePermission() throws Exception {
-    String namespace = "testNamespace";
+    final String namespace = "testNamespace";
     NamespaceDescriptor desc = NamespaceDescriptor.create(namespace).build();
     createNamespace(TEST_UTIL, desc);
-    grantOnNamespace(TEST_UTIL, USER_NONE.getShortName(), namespace, Permission.Action.READ);
+    grantOnNamespace(TEST_UTIL, USER_NONE.getShortName(), namespace, Permission.Action.ADMIN);
 
-    // Test 1: A specific namespace
-    getNamespacePermissionsAndVerify(namespace, 1, namespace);
+    AccessTestAction test1 = new AccessTestAction() {
+      @Override
+      public Void run() throws Exception {
+        // Test 1: A specific namespace
+        getNamespacePermissionsAndVerify(namespace, 1, namespace);
+        return null;
+      }
+    };
+
+    AccessTestAction test2 = new AccessTestAction() {
+      @Override
+      public Void run() throws Exception {
+        // Test 2: '@.*'
+        getNamespacePermissionsAndVerify(".*", 1, namespace);
+        return null;
+      }
+    };
 
-    // Test 2: '@.*'
-    getNamespacePermissionsAndVerify(".*", 1, namespace);
+    AccessTestAction test3 = new AccessTestAction() {
+      @Override
+      public Void run() throws Exception {
+        // Test 3: A more complex regex
+        getNamespacePermissionsAndVerify("^test[a-zA-Z]*", 1, namespace);
+        return null;
+      }
+    };
 
-    // Test 3: A more complex regex
-    getNamespacePermissionsAndVerify("^test[a-zA-Z]*", 1, namespace);
+    verifyAllowed(USER_NONE, test1, test2, test3);
 
     deleteNamespace(TEST_UTIL, namespace);
   }


Mime
View raw message