hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-14596 TestCellACLs failing... on1.2 builds; FIX
Date Wed, 14 Oct 2015 00:08:04 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 db880599b -> 778a595a5


    HBASE-14596 TestCellACLs failing... on1.2 builds; FIX


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

Branch: refs/heads/branch-1
Commit: 778a595a5289a71b7c562e93bedf7d7583688b99
Parents: db88059
Author: stack <stack@apache.org>
Authored: Tue Oct 13 17:07:28 2015 -0700
Committer: stack <stack@apache.org>
Committed: Tue Oct 13 17:07:58 2015 -0700

----------------------------------------------------------------------
 .../hbase/security/access/TestCellACLs.java     | 65 ++++++++++++--------
 1 file changed, 38 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/778a595a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java
index 24d207c..b9263b6 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java
@@ -26,14 +26,15 @@ import java.util.Map;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.AuthUtil;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
-import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableNotFoundException;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Connection;
 import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.client.Delete;
@@ -44,6 +45,7 @@ import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
 import org.apache.hadoop.hbase.regionserver.RegionServerCoprocessorHost;
 import org.apache.hadoop.hbase.security.User;
@@ -76,7 +78,6 @@ public class TestCellACLs extends SecureTestUtil {
 
   @Rule
   public TestTableName TEST_TABLE = new TestTableName();
-
   private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
   private static final byte[] TEST_FAMILY = Bytes.toBytes("f1");
   private static final byte[] TEST_ROW = Bytes.toBytes("cellpermtest");
@@ -95,8 +96,6 @@ public class TestCellACLs extends SecureTestUtil {
   private static User USER_OTHER;
   private static String[] usersAndGroups;
 
-  private Connection connection;
-
   @BeforeClass
   public static void setupBeforeClass() throws Exception {
     // setup configuration
@@ -140,16 +139,16 @@ public class TestCellACLs extends SecureTestUtil {
   @Before
   public void setUp() throws Exception {
     // Create the test table (owner added to the _acl_ table)
-    this.connection = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     HTableDescriptor htd = new HTableDescriptor(TEST_TABLE.getTableName());
     HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY);
     hcd.setMaxVersions(4);
     htd.setOwner(USER_OWNER);
     htd.addFamily(hcd);
-    TEST_UTIL.createTable(htd, new byte[][] { Bytes.toBytes("s") });
+    admin.createTable(htd, new byte[][] { Bytes.toBytes("s") });
+    TEST_UTIL.waitTableEnabled(TEST_TABLE.getTableName());
     LOG.info("Sleeping a second because of HBASE-12581");
     Threads.sleep(1000);
-    this.connection = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
   }
 
   @Test (timeout=120000)
@@ -158,20 +157,21 @@ public class TestCellACLs extends SecureTestUtil {
     verifyAllowed(new AccessTestAction() {
       @Override
       public Object run() throws Exception {
-        try (Table t = connection.getTable(TEST_TABLE.getTableName());) {
+        try (Table t = new HTable(TEST_UTIL.getConfiguration(),
+            TEST_TABLE.getTableName());) {
           Put p;
           // with ro ACL
-          p = new Put(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q1, ZERO);
+          p = new Put(TEST_ROW).add(TEST_FAMILY, TEST_Q1, ZERO);
           p.setACL(prepareCellPermissions(usersAndGroups, Action.READ));
           t.put(p);
           // with rw ACL
-          p = new Put(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q2, ZERO);
+          p = new Put(TEST_ROW).add(TEST_FAMILY, TEST_Q2, ZERO);
           p.setACL(prepareCellPermissions(usersAndGroups, Action.READ, Action.WRITE));
           t.put(p);
           // no ACL
           p = new Put(TEST_ROW)
-            .addColumn(TEST_FAMILY, TEST_Q3, ZERO)
-            .addColumn(TEST_FAMILY, TEST_Q4, ZERO);
+            .add(TEST_FAMILY, TEST_Q3, ZERO)
+            .add(TEST_FAMILY, TEST_Q4, ZERO);
           t.put(p);
         }
         return null;
@@ -184,7 +184,8 @@ public class TestCellACLs extends SecureTestUtil {
       @Override
       public Object run() throws Exception {
         Get get = new Get(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q1);
-        try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
+        try (Table t = new HTable(TEST_UTIL.getConfiguration(),
+            TEST_TABLE.getTableName())) {
           return t.get(get).listCells();
         }
       }
@@ -194,7 +195,8 @@ public class TestCellACLs extends SecureTestUtil {
       @Override
       public Object run() throws Exception {
         Get get = new Get(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q2);
-        try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
+        try (Table t = new HTable(TEST_UTIL.getConfiguration(),
+            TEST_TABLE.getTableName())) {
           return t.get(get).listCells();
         }
       }
@@ -204,7 +206,8 @@ public class TestCellACLs extends SecureTestUtil {
       @Override
       public Object run() throws Exception {
         Get get = new Get(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q3);
-        try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
+        try (Table t = new HTable(TEST_UTIL.getConfiguration(),
+            TEST_TABLE.getTableName())) {
           return t.get(get).listCells();
         }
       }
@@ -214,7 +217,8 @@ public class TestCellACLs extends SecureTestUtil {
       @Override
       public Object run() throws Exception {
         Get get = new Get(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q4);
-        try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
+        try (Table t = new HTable(TEST_UTIL.getConfiguration(),
+            TEST_TABLE.getTableName())) {
           return t.get(get).listCells();
         }
       }
@@ -243,7 +247,8 @@ public class TestCellACLs extends SecureTestUtil {
         scan.setStartRow(TEST_ROW);
         scan.setStopRow(Bytes.add(TEST_ROW, new byte[]{ 0 } ));
         scan.addFamily(TEST_FAMILY);
-        try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
+        try (Table t = new HTable(TEST_UTIL.getConfiguration(),
+            TEST_TABLE.getTableName())) {
           ResultScanner scanner = t.getScanner(scan);
           Result result = null;
           do {
@@ -277,7 +282,8 @@ public class TestCellACLs extends SecureTestUtil {
       @Override
       public Object run() throws Exception {
         Increment i = new Increment(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q1, 1L);
-        try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
+        try (Table t = new HTable(TEST_UTIL.getConfiguration(),
+            TEST_TABLE.getTableName())) {
           t.increment(i);
         }
         return null;
@@ -288,7 +294,8 @@ public class TestCellACLs extends SecureTestUtil {
       @Override
       public Object run() throws Exception {
         Increment i = new Increment(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q2, 1L);
-        try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
+        try (Table t = new HTable(TEST_UTIL.getConfiguration(),
+            TEST_TABLE.getTableName())) {
           t.increment(i);
         }
         return null;
@@ -301,7 +308,8 @@ public class TestCellACLs extends SecureTestUtil {
         Increment i = new Increment(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q2, 1L);
         // Tag this increment with an ACL that denies write permissions to USER_OTHER
         i.setACL(USER_OTHER.getShortName(), new Permission(Action.READ));
-        try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
+        try (Table t = new HTable(TEST_UTIL.getConfiguration(),
+            TEST_TABLE.getTableName())) {
           t.increment(i);
         }
         return null;
@@ -312,7 +320,8 @@ public class TestCellACLs extends SecureTestUtil {
       @Override
       public Object run() throws Exception {
         Increment i = new Increment(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q3, 1L);
-        try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
+        try (Table t = new HTable(TEST_UTIL.getConfiguration(),
+            TEST_TABLE.getTableName())) {
           t.increment(i);
         }
         return null;
@@ -336,7 +345,8 @@ public class TestCellACLs extends SecureTestUtil {
       @Override
       public Object run() throws Exception {
         Delete delete = new Delete(TEST_ROW).addFamily(TEST_FAMILY);
-        try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
+        try (Table t = new HTable(TEST_UTIL.getConfiguration(),
+            TEST_TABLE.getTableName())) {
           t.delete(delete);
         }
         return null;
@@ -347,7 +357,8 @@ public class TestCellACLs extends SecureTestUtil {
       @Override
       public Object run() throws Exception {
         Delete delete = new Delete(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q1);
-        try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
+        try (Table t = new HTable(TEST_UTIL.getConfiguration(),
+            TEST_TABLE.getTableName())) {
           t.delete(delete);
         }
         return null;
@@ -383,9 +394,10 @@ public class TestCellACLs extends SecureTestUtil {
     verifyAllowed(new AccessTestAction() {
       @Override
       public Object run() throws Exception {
-        try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
+        try (Table t = new HTable(TEST_UTIL.getConfiguration(),
+            TEST_TABLE.getTableName())) {
           Put p;
-          p = new Put(TEST_ROW).addColumn(TEST_FAMILY, TEST_Q1, ZERO);
+          p = new Put(TEST_ROW).add(TEST_FAMILY, TEST_Q1, ZERO);
           t.put(p);
         }
         return null;
@@ -449,6 +461,5 @@ public class TestCellACLs extends SecureTestUtil {
       LOG.info("Test deleted table " + TEST_TABLE.getTableName());
     }
     assertEquals(0, AccessControlLists.getTablePermissions(conf, TEST_TABLE.getTableName()).size());
-    this.connection.close();
   }
-}
\ No newline at end of file
+}


Mime
View raw message