Skip to content

Commit

Permalink
HBASE-14596 TestCellACLs failing... on1.2 builds; FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
saintstack committed Oct 14, 2015
1 parent 73ccccf commit e6a271a
Showing 1 changed file with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
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;
Expand All @@ -44,6 +45,7 @@
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;
Expand Down Expand Up @@ -77,7 +79,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");
Expand All @@ -96,8 +97,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
Expand Down Expand Up @@ -141,16 +140,16 @@ public static void tearDownAfterClass() throws Exception {
@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)
Expand All @@ -163,17 +162,17 @@ public Object run() throws Exception {
Table t = connection.getTable(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;
Expand Down Expand Up @@ -403,7 +402,7 @@ public Object run() throws Exception {
try(Connection connection = ConnectionFactory.createConnection(conf);
Table t = connection.getTable(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;
Expand Down Expand Up @@ -466,6 +465,5 @@ public void tearDown() throws Exception {
LOG.info("Test deleted table " + TEST_TABLE.getTableName());
}
assertEquals(0, AccessControlLists.getTablePermissions(conf, TEST_TABLE.getTableName()).size());
this.connection.close();
}
}

0 comments on commit e6a271a

Please sign in to comment.