HBASE-12581 TestCellACLWithMultipleVersions failing since task 5 HBASE-12404 (HBASE-12404 addendum)
This commit is contained in:
parent
e6b4300756
commit
24f19328eb
|
@ -33,6 +33,8 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
|
|||
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;
|
||||
import org.apache.hadoop.hbase.client.Get;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
|
@ -250,24 +252,23 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
verifyAllowed(new AccessTestAction() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
// with rw ACL for "user1"
|
||||
Put p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||
p.setACL(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
t.put(p);
|
||||
// with rw ACL for "user1"
|
||||
p = new Put(TEST_ROW2);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||
p.setACL(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
t.put(p);
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
// with rw ACL for "user1"
|
||||
Put p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||
p.setACL(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
t.put(p);
|
||||
// with rw ACL for "user1"
|
||||
p = new Put(TEST_ROW2);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||
p.setACL(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
t.put(p);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -276,27 +277,26 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
verifyAllowed(new AccessTestAction() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
// with rw ACL for "user1" and "user2"
|
||||
Put p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||
Map<String, Permission> perms = new HashMap<String, Permission>();
|
||||
perms.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
perms.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
p.setACL(perms);
|
||||
t.put(p);
|
||||
// with rw ACL for "user1" and "user2"
|
||||
p = new Put(TEST_ROW2);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||
p.setACL(perms);
|
||||
t.put(p);
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
// with rw ACL for "user1" and "user2"
|
||||
Put p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||
Map<String, Permission> perms = new HashMap<String, Permission>();
|
||||
perms.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
perms.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
p.setACL(perms);
|
||||
t.put(p);
|
||||
// with rw ACL for "user1" and "user2"
|
||||
p = new Put(TEST_ROW2);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||
p.setACL(perms);
|
||||
t.put(p);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -307,14 +307,13 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
||||
@Override
|
||||
public Void run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Delete d = new Delete(TEST_ROW1);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q2);
|
||||
t.delete(d);
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Delete d = new Delete(TEST_ROW1);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q2);
|
||||
t.delete(d);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -324,17 +323,16 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
||||
@Override
|
||||
public Void run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Delete d = new Delete(TEST_ROW2);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q2);
|
||||
t.delete(d);
|
||||
fail("user2 should not be allowed to delete the row");
|
||||
} catch (Exception e) {
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Delete d = new Delete(TEST_ROW2);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q2);
|
||||
t.delete(d);
|
||||
fail("user2 should not be allowed to delete the row");
|
||||
} catch (Exception e) {
|
||||
|
||||
} finally {
|
||||
t.close();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -343,13 +341,12 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
||||
@Override
|
||||
public Void run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Delete d = new Delete(TEST_ROW2);
|
||||
d.deleteFamily(TEST_FAMILY1);
|
||||
t.delete(d);
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Delete d = new Delete(TEST_ROW2);
|
||||
d.deleteFamily(TEST_FAMILY1);
|
||||
t.delete(d);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -364,21 +361,20 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
verifyAllowed(new AccessTestAction() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
// Store read only ACL at a future time
|
||||
Put p = new Put(TEST_ROW).add(TEST_FAMILY1, TEST_Q1,
|
||||
EnvironmentEdgeManager.currentTime() + 1000000,
|
||||
ZERO);
|
||||
p.setACL(USER_OTHER.getShortName(), new Permission(Permission.Action.READ));
|
||||
t.put(p);
|
||||
// Store a read write ACL without a timestamp, server will use current time
|
||||
p = new Put(TEST_ROW).add(TEST_FAMILY1, TEST_Q2, ONE);
|
||||
p.setACL(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
t.put(p);
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
// Store a read write ACL without a timestamp, server will use current time
|
||||
Put p = new Put(TEST_ROW).add(TEST_FAMILY1, TEST_Q2, ONE);
|
||||
p.setACL(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
t.put(p);
|
||||
LOG.info("Stored at current time");
|
||||
// Store read only ACL at a future time
|
||||
p = new Put(TEST_ROW).add(TEST_FAMILY1, TEST_Q1,
|
||||
EnvironmentEdgeManager.currentTime() + 1000000, ZERO);
|
||||
p.setACL(USER_OTHER.getShortName(), new Permission(Permission.Action.READ));
|
||||
t.put(p);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -390,11 +386,10 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
@Override
|
||||
public Object run() throws Exception {
|
||||
Get get = new Get(TEST_ROW).addColumn(TEST_FAMILY1, TEST_Q1);
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
return t.get(get).listCells();
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
return t.get(get).listCells();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -403,11 +398,10 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
@Override
|
||||
public Object run() throws Exception {
|
||||
Get get = new Get(TEST_ROW).addColumn(TEST_FAMILY1, TEST_Q2);
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
return t.get(get).listCells();
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
return t.get(get).listCells();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -423,11 +417,10 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
@Override
|
||||
public Object run() throws Exception {
|
||||
Delete delete = new Delete(TEST_ROW).deleteFamily(TEST_FAMILY1);
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
t.delete(delete);
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
t.delete(delete);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -449,43 +442,42 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
USER_OWNER.runAs(new AccessTestAction() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
// This version (TS = 123) with rw ACL for USER_OTHER and USER_OTHER2
|
||||
Put p = new Put(TEST_ROW);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 123L, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 123L, ZERO);
|
||||
Map<String, Permission> perms = new HashMap<String, Permission>();
|
||||
perms.put(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
perms.put(USER_OTHER2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
p.setACL(perms);
|
||||
t.put(p);
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
// This version (TS = 123) with rw ACL for USER_OTHER and USER_OTHER2
|
||||
Put p = new Put(TEST_ROW);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 123L, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 123L, ZERO);
|
||||
Map<String, Permission> perms = new HashMap<String, Permission>();
|
||||
perms.put(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
perms.put(USER_OTHER2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
p.setACL(perms);
|
||||
t.put(p);
|
||||
|
||||
// This version (TS = 125) with rw ACL for USER_OTHER
|
||||
p = new Put(TEST_ROW);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 125L, ONE);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 125L, ONE);
|
||||
perms = new HashMap<String, Permission>();
|
||||
perms.put(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
p.setACL(perms);
|
||||
t.put(p);
|
||||
// This version (TS = 125) with rw ACL for USER_OTHER
|
||||
p = new Put(TEST_ROW);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 125L, ONE);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 125L, ONE);
|
||||
perms = new HashMap<String, Permission>();
|
||||
perms.put(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
p.setACL(perms);
|
||||
t.put(p);
|
||||
|
||||
// This version (TS = 127) with rw ACL for USER_OTHER
|
||||
p = new Put(TEST_ROW);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 127L, TWO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 127L, TWO);
|
||||
perms = new HashMap<String, Permission>();
|
||||
perms.put(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
p.setACL(perms);
|
||||
t.put(p);
|
||||
// This version (TS = 127) with rw ACL for USER_OTHER
|
||||
p = new Put(TEST_ROW);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 127L, TWO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 127L, TWO);
|
||||
perms = new HashMap<String, Permission>();
|
||||
perms.put(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
p.setACL(perms);
|
||||
t.put(p);
|
||||
|
||||
return null;
|
||||
} finally {
|
||||
t.close();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -494,13 +486,12 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
USER_OTHER2.runAs(new AccessTestAction() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Delete d = new Delete(TEST_ROW, 124L);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||
t.delete(d);
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Delete d = new Delete(TEST_ROW, 124L);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||
t.delete(d);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -510,13 +501,12 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
USER_OTHER2.runAs(new AccessTestAction() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Delete d = new Delete(TEST_ROW);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q2, 124L);
|
||||
t.delete(d);
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Delete d = new Delete(TEST_ROW);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q2, 124L);
|
||||
t.delete(d);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -536,53 +526,52 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
verifyAllowed(new AccessTestAction() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
||||
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Map<String, Permission> permsU2andOwner = new HashMap<String, Permission>();
|
||||
permsU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Put p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
||||
p.setACL(permsU2andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY2, TEST_Q1, 123, ZERO);
|
||||
p.add(TEST_FAMILY2, TEST_Q2, 123, ZERO);
|
||||
p.setACL(permsU2andOwner);
|
||||
t.put(p);
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
||||
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Map<String, Permission> permsU2andOwner = new HashMap<String, Permission>();
|
||||
permsU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Put p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
||||
p.setACL(permsU2andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY2, TEST_Q1, 123, ZERO);
|
||||
p.add(TEST_FAMILY2, TEST_Q2, 123, ZERO);
|
||||
p.setACL(permsU2andOwner);
|
||||
t.put(p);
|
||||
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY2, TEST_Q1, 125, ZERO);
|
||||
p.add(TEST_FAMILY2, TEST_Q2, 125, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY2, TEST_Q1, 125, ZERO);
|
||||
p.add(TEST_FAMILY2, TEST_Q2, 125, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
||||
p.setACL(permsU2andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY2, TEST_Q1, 129, ZERO);
|
||||
p.add(TEST_FAMILY2, TEST_Q2, 129, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
} finally {
|
||||
t.close();
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
||||
p.setACL(permsU2andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY2, TEST_Q1, 129, ZERO);
|
||||
p.add(TEST_FAMILY2, TEST_Q2, 129, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -593,15 +582,14 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
||||
@Override
|
||||
public Void run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Delete d = new Delete(TEST_ROW1);
|
||||
d.deleteColumn(TEST_FAMILY1, TEST_Q1, 123);
|
||||
d.deleteColumn(TEST_FAMILY1, TEST_Q2);
|
||||
d.deleteFamilyVersion(TEST_FAMILY2, 125);
|
||||
t.delete(d);
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Delete d = new Delete(TEST_ROW1);
|
||||
d.deleteColumn(TEST_FAMILY1, TEST_Q1, 123);
|
||||
d.deleteColumn(TEST_FAMILY1, TEST_Q2);
|
||||
d.deleteFamilyVersion(TEST_FAMILY2, 125);
|
||||
t.delete(d);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -610,18 +598,17 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
||||
@Override
|
||||
public Void run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Delete d = new Delete(TEST_ROW1, 127);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q2);
|
||||
d.deleteFamily(TEST_FAMILY2, 129);
|
||||
t.delete(d);
|
||||
fail("user2 can not do the delete");
|
||||
} catch (Exception e) {
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Delete d = new Delete(TEST_ROW1, 127);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q2);
|
||||
d.deleteFamily(TEST_FAMILY2, 129);
|
||||
t.delete(d);
|
||||
fail("user2 can not do the delete");
|
||||
} catch (Exception e) {
|
||||
|
||||
} finally {
|
||||
t.close();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -641,37 +628,36 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
verifyAllowed(new AccessTestAction() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
||||
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Map<String, Permission> permsU2andOwner = new HashMap<String, Permission>();
|
||||
permsU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Put p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
||||
p.setACL(permsU2andOwner);
|
||||
t.put(p);
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
||||
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Map<String, Permission> permsU2andOwner = new HashMap<String, Permission>();
|
||||
permsU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Put p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
||||
p.setACL(permsU2andOwner);
|
||||
t.put(p);
|
||||
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
||||
p.setACL(permsU2andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
} finally {
|
||||
t.close();
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
||||
p.setACL(permsU2andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -681,15 +667,14 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
||||
@Override
|
||||
public Void run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Increment inc = new Increment(TEST_ROW1);
|
||||
inc.setTimeRange(0, 123);
|
||||
inc.addColumn(TEST_FAMILY1, TEST_Q1, 2L);
|
||||
t.increment(inc);
|
||||
t.incrementColumnValue(TEST_ROW1, TEST_FAMILY1, TEST_Q2, 1L);
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Increment inc = new Increment(TEST_ROW1);
|
||||
inc.setTimeRange(0, 123);
|
||||
inc.addColumn(TEST_FAMILY1, TEST_Q1, 2L);
|
||||
t.increment(inc);
|
||||
t.incrementColumnValue(TEST_ROW1, TEST_FAMILY1, TEST_Q2, 1L);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -698,17 +683,16 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
||||
@Override
|
||||
public Void run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Increment inc = new Increment(TEST_ROW1);
|
||||
inc.setTimeRange(0, 127);
|
||||
inc.addColumn(TEST_FAMILY1, TEST_Q2, 2L);
|
||||
t.increment(inc);
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Increment inc = new Increment(TEST_ROW1);
|
||||
inc.setTimeRange(0, 127);
|
||||
inc.addColumn(TEST_FAMILY1, TEST_Q2, 2L);
|
||||
t.increment(inc);
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
|
||||
} finally {
|
||||
t.close();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -728,37 +712,36 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
verifyAllowed(new AccessTestAction() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
||||
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Map<String, Permission> permsU2andOwner = new HashMap<String, Permission>();
|
||||
permsU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Put p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
||||
p.setACL(permsU2andOwner);
|
||||
t.put(p);
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
||||
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Map<String, Permission> permsU2andOwner = new HashMap<String, Permission>();
|
||||
permsU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Put p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
||||
p.setACL(permsU2andOwner);
|
||||
t.put(p);
|
||||
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
||||
p.setACL(permsU2andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
} finally {
|
||||
t.close();
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
||||
p.setACL(permsU2andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -770,16 +753,15 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
||||
@Override
|
||||
public Void run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Put p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 125, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||
p.setACL(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
t.put(p);
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Put p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 125, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||
p.setACL(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
t.put(p);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -789,18 +771,17 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
||||
@Override
|
||||
public Void run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Put p = new Put(TEST_ROW1);
|
||||
// column Q1 covers version at 123 fr which user2 do not have permission
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 124, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||
t.put(p);
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Put p = new Put(TEST_ROW1);
|
||||
// column Q1 covers version at 123 fr which user2 do not have permission
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 124, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||
t.put(p);
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
|
||||
} finally {
|
||||
t.close();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -818,49 +799,48 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
verifyAllowed(new AccessTestAction() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
||||
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Map<String, Permission> permsU1andU2andOwner = new HashMap<String, Permission>();
|
||||
permsU1andU2andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU1andU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU1andU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Map<String, Permission> permsU1andU2 = new HashMap<String, Permission>();
|
||||
permsU1andU2.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU1andU2.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
||||
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Map<String, Permission> permsU1andU2andOwner = new HashMap<String, Permission>();
|
||||
permsU1andU2andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU1andU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU1andU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
Map<String, Permission> permsU1andU2 = new HashMap<String, Permission>();
|
||||
permsU1andU2.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
permsU1andU2.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||
Permission.Action.WRITE));
|
||||
|
||||
Put p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 120, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 120, ZERO);
|
||||
p.setACL(permsU1andU2andOwner);
|
||||
t.put(p);
|
||||
Put p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 120, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 120, ZERO);
|
||||
p.setACL(permsU1andU2andOwner);
|
||||
t.put(p);
|
||||
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
||||
p.setACL(permsU1andOwner);
|
||||
t.put(p);
|
||||
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
||||
p.setACL(permsU1andU2);
|
||||
t.put(p);
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
||||
p.setACL(permsU1andU2);
|
||||
t.put(p);
|
||||
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
||||
p.setACL(user2.getShortName(), new Permission(Permission.Action.READ));
|
||||
t.put(p);
|
||||
} finally {
|
||||
t.close();
|
||||
p = new Put(TEST_ROW1);
|
||||
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
||||
p.setACL(user2.getShortName(), new Permission(Permission.Action.READ));
|
||||
t.put(p);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -871,13 +851,12 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
||||
@Override
|
||||
public Void run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Delete d = new Delete(TEST_ROW1);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1, 120);
|
||||
t.checkAndDelete(TEST_ROW1, TEST_FAMILY1, TEST_Q1, ZERO, d);
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Delete d = new Delete(TEST_ROW1);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1, 120);
|
||||
t.checkAndDelete(TEST_ROW1, TEST_FAMILY1, TEST_Q1, ZERO, d);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -887,15 +866,14 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
||||
@Override
|
||||
public Void run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Delete d = new Delete(TEST_ROW1);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||
t.checkAndDelete(TEST_ROW1, TEST_FAMILY1, TEST_Q1, ZERO, d);
|
||||
fail("user2 should not be allowed to do checkAndDelete");
|
||||
} catch (Exception e) {
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Delete d = new Delete(TEST_ROW1);
|
||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||
t.checkAndDelete(TEST_ROW1, TEST_FAMILY1, TEST_Q1, ZERO, d);
|
||||
fail("user2 should not be allowed to do checkAndDelete");
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -906,13 +884,12 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
||||
@Override
|
||||
public Void run() throws Exception {
|
||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
||||
try {
|
||||
Delete d = new Delete(TEST_ROW1);
|
||||
d.deleteColumn(TEST_FAMILY1, TEST_Q2, 120);
|
||||
t.checkAndDelete(TEST_ROW1, TEST_FAMILY1, TEST_Q2, ZERO, d);
|
||||
} finally {
|
||||
t.close();
|
||||
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||
Delete d = new Delete(TEST_ROW1);
|
||||
d.deleteColumn(TEST_FAMILY1, TEST_Q2, 120);
|
||||
t.checkAndDelete(TEST_ROW1, TEST_FAMILY1, TEST_Q2, ZERO, d);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -930,4 +907,4 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
|||
}
|
||||
assertEquals(0, AccessControlLists.getTablePermissions(conf, TEST_TABLE.getTableName()).size());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue