HBASE-12581 TestCellACLWithMultipleVersions failing since task 5 HBASE-12404 (HBASE-12404 addendum)
This commit is contained in:
parent
b9dfcd01b8
commit
c9376e6d37
|
@ -34,6 +34,8 @@ import org.apache.hadoop.hbase.HTableDescriptor;
|
||||||
import org.apache.hadoop.hbase.MediumTests;
|
import org.apache.hadoop.hbase.MediumTests;
|
||||||
import org.apache.hadoop.hbase.TableNotFoundException;
|
import org.apache.hadoop.hbase.TableNotFoundException;
|
||||||
import org.apache.hadoop.hbase.client.Admin;
|
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.Delete;
|
||||||
import org.apache.hadoop.hbase.client.Get;
|
import org.apache.hadoop.hbase.client.Get;
|
||||||
import org.apache.hadoop.hbase.client.HTable;
|
import org.apache.hadoop.hbase.client.HTable;
|
||||||
|
@ -249,24 +251,23 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
verifyAllowed(new AccessTestAction() {
|
verifyAllowed(new AccessTestAction() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
// with rw ACL for "user1"
|
// with rw ACL for "user1"
|
||||||
Put p = new Put(TEST_ROW1);
|
Put p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||||
p.setACL(user1.getShortName(), new Permission(Permission.Action.READ,
|
p.setACL(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
t.put(p);
|
t.put(p);
|
||||||
// with rw ACL for "user1"
|
// with rw ACL for "user1"
|
||||||
p = new Put(TEST_ROW2);
|
p = new Put(TEST_ROW2);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||||
p.setACL(user1.getShortName(), new Permission(Permission.Action.READ,
|
p.setACL(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
t.put(p);
|
t.put(p);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -275,27 +276,26 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
verifyAllowed(new AccessTestAction() {
|
verifyAllowed(new AccessTestAction() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
// with rw ACL for "user1" and "user2"
|
// with rw ACL for "user1" and "user2"
|
||||||
Put p = new Put(TEST_ROW1);
|
Put p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||||
Map<String, Permission> perms = new HashMap<String, Permission>();
|
Map<String, Permission> perms = new HashMap<String, Permission>();
|
||||||
perms.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
perms.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
perms.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
perms.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
p.setACL(perms);
|
p.setACL(perms);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
// with rw ACL for "user1" and "user2"
|
// with rw ACL for "user1" and "user2"
|
||||||
p = new Put(TEST_ROW2);
|
p = new Put(TEST_ROW2);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, ZERO);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||||
p.setACL(perms);
|
p.setACL(perms);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -306,14 +306,13 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Delete d = new Delete(TEST_ROW1);
|
Delete d = new Delete(TEST_ROW1);
|
||||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||||
d.deleteColumns(TEST_FAMILY1, TEST_Q2);
|
d.deleteColumns(TEST_FAMILY1, TEST_Q2);
|
||||||
t.delete(d);
|
t.delete(d);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -323,17 +322,16 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Delete d = new Delete(TEST_ROW2);
|
Delete d = new Delete(TEST_ROW2);
|
||||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||||
d.deleteColumns(TEST_FAMILY1, TEST_Q2);
|
d.deleteColumns(TEST_FAMILY1, TEST_Q2);
|
||||||
t.delete(d);
|
t.delete(d);
|
||||||
fail("user2 should not be allowed to delete the row");
|
fail("user2 should not be allowed to delete the row");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -342,13 +340,12 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Delete d = new Delete(TEST_ROW2);
|
Delete d = new Delete(TEST_ROW2);
|
||||||
d.deleteFamily(TEST_FAMILY1);
|
d.deleteFamily(TEST_FAMILY1);
|
||||||
t.delete(d);
|
t.delete(d);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -363,21 +360,20 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
verifyAllowed(new AccessTestAction() {
|
verifyAllowed(new AccessTestAction() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
// Store read only ACL at a future time
|
// Store a read write ACL without a timestamp, server will use current time
|
||||||
Put p = new Put(TEST_ROW).add(TEST_FAMILY1, TEST_Q1,
|
Put p = new Put(TEST_ROW).add(TEST_FAMILY1, TEST_Q2, ONE);
|
||||||
EnvironmentEdgeManager.currentTime() + 1000000,
|
p.setACL(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
||||||
ZERO);
|
Permission.Action.WRITE));
|
||||||
p.setACL(USER_OTHER.getShortName(), new Permission(Permission.Action.READ));
|
t.put(p);
|
||||||
t.put(p);
|
LOG.info("Stored at current time");
|
||||||
// Store a read write ACL without a timestamp, server will use current time
|
// Store read only ACL at a future time
|
||||||
p = new Put(TEST_ROW).add(TEST_FAMILY1, TEST_Q2, ONE);
|
p = new Put(TEST_ROW).add(TEST_FAMILY1, TEST_Q1,
|
||||||
p.setACL(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
EnvironmentEdgeManager.currentTime() + 1000000, ZERO);
|
||||||
Permission.Action.WRITE));
|
p.setACL(USER_OTHER.getShortName(), new Permission(Permission.Action.READ));
|
||||||
t.put(p);
|
t.put(p);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -389,11 +385,10 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Get get = new Get(TEST_ROW).addColumn(TEST_FAMILY1, TEST_Q1);
|
Get get = new Get(TEST_ROW).addColumn(TEST_FAMILY1, TEST_Q1);
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
return t.get(get).listCells();
|
return t.get(get).listCells();
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -402,11 +397,10 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Get get = new Get(TEST_ROW).addColumn(TEST_FAMILY1, TEST_Q2);
|
Get get = new Get(TEST_ROW).addColumn(TEST_FAMILY1, TEST_Q2);
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
return t.get(get).listCells();
|
return t.get(get).listCells();
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -422,11 +416,10 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Delete delete = new Delete(TEST_ROW).deleteFamily(TEST_FAMILY1);
|
Delete delete = new Delete(TEST_ROW).deleteFamily(TEST_FAMILY1);
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
t.delete(delete);
|
t.delete(delete);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -448,43 +441,42 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
USER_OWNER.runAs(new AccessTestAction() {
|
USER_OWNER.runAs(new AccessTestAction() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
// This version (TS = 123) with rw ACL for USER_OTHER and USER_OTHER2
|
// This version (TS = 123) with rw ACL for USER_OTHER and USER_OTHER2
|
||||||
Put p = new Put(TEST_ROW);
|
Put p = new Put(TEST_ROW);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, 123L, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, 123L, ZERO);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, 123L, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, 123L, ZERO);
|
||||||
Map<String, Permission> perms = new HashMap<String, Permission>();
|
Map<String, Permission> perms = new HashMap<String, Permission>();
|
||||||
perms.put(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
perms.put(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
perms.put(USER_OTHER2.getShortName(), new Permission(Permission.Action.READ,
|
perms.put(USER_OTHER2.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
p.setACL(perms);
|
p.setACL(perms);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
|
|
||||||
// This version (TS = 125) with rw ACL for USER_OTHER
|
// This version (TS = 125) with rw ACL for USER_OTHER
|
||||||
p = new Put(TEST_ROW);
|
p = new Put(TEST_ROW);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, 125L, ONE);
|
p.add(TEST_FAMILY1, TEST_Q1, 125L, ONE);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, 125L, ONE);
|
p.add(TEST_FAMILY1, TEST_Q2, 125L, ONE);
|
||||||
perms = new HashMap<String, Permission>();
|
perms = new HashMap<String, Permission>();
|
||||||
perms.put(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
perms.put(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
p.setACL(perms);
|
p.setACL(perms);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
|
|
||||||
// This version (TS = 127) with rw ACL for USER_OTHER
|
// This version (TS = 127) with rw ACL for USER_OTHER
|
||||||
p = new Put(TEST_ROW);
|
p = new Put(TEST_ROW);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, 127L, TWO);
|
p.add(TEST_FAMILY1, TEST_Q1, 127L, TWO);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, 127L, TWO);
|
p.add(TEST_FAMILY1, TEST_Q2, 127L, TWO);
|
||||||
perms = new HashMap<String, Permission>();
|
perms = new HashMap<String, Permission>();
|
||||||
perms.put(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
perms.put(USER_OTHER.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
p.setACL(perms);
|
p.setACL(perms);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -493,13 +485,12 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
USER_OTHER2.runAs(new AccessTestAction() {
|
USER_OTHER2.runAs(new AccessTestAction() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Delete d = new Delete(TEST_ROW, 124L);
|
Delete d = new Delete(TEST_ROW, 124L);
|
||||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||||
t.delete(d);
|
t.delete(d);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -509,13 +500,12 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
USER_OTHER2.runAs(new AccessTestAction() {
|
USER_OTHER2.runAs(new AccessTestAction() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Delete d = new Delete(TEST_ROW);
|
Delete d = new Delete(TEST_ROW);
|
||||||
d.deleteColumns(TEST_FAMILY1, TEST_Q2, 124L);
|
d.deleteColumns(TEST_FAMILY1, TEST_Q2, 124L);
|
||||||
t.delete(d);
|
t.delete(d);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -535,53 +525,52 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
verifyAllowed(new AccessTestAction() {
|
verifyAllowed(new AccessTestAction() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
||||||
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
Map<String, Permission> permsU2andOwner = new HashMap<String, Permission>();
|
Map<String, Permission> permsU2andOwner = new HashMap<String, Permission>();
|
||||||
permsU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
permsU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
permsU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
permsU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
Put p = new Put(TEST_ROW1);
|
Put p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
||||||
p.setACL(permsU1andOwner);
|
p.setACL(permsU1andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
||||||
p.setACL(permsU2andOwner);
|
p.setACL(permsU2andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY2, TEST_Q1, 123, ZERO);
|
p.add(TEST_FAMILY2, TEST_Q1, 123, ZERO);
|
||||||
p.add(TEST_FAMILY2, TEST_Q2, 123, ZERO);
|
p.add(TEST_FAMILY2, TEST_Q2, 123, ZERO);
|
||||||
p.setACL(permsU2andOwner);
|
p.setACL(permsU2andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
|
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY2, TEST_Q1, 125, ZERO);
|
p.add(TEST_FAMILY2, TEST_Q1, 125, ZERO);
|
||||||
p.add(TEST_FAMILY2, TEST_Q2, 125, ZERO);
|
p.add(TEST_FAMILY2, TEST_Q2, 125, ZERO);
|
||||||
p.setACL(permsU1andOwner);
|
p.setACL(permsU1andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
|
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
||||||
p.setACL(permsU2andOwner);
|
p.setACL(permsU2andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
||||||
p.setACL(permsU1andOwner);
|
p.setACL(permsU1andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY2, TEST_Q1, 129, ZERO);
|
p.add(TEST_FAMILY2, TEST_Q1, 129, ZERO);
|
||||||
p.add(TEST_FAMILY2, TEST_Q2, 129, ZERO);
|
p.add(TEST_FAMILY2, TEST_Q2, 129, ZERO);
|
||||||
p.setACL(permsU1andOwner);
|
p.setACL(permsU1andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -592,15 +581,14 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Delete d = new Delete(TEST_ROW1);
|
Delete d = new Delete(TEST_ROW1);
|
||||||
d.deleteColumn(TEST_FAMILY1, TEST_Q1, 123);
|
d.deleteColumn(TEST_FAMILY1, TEST_Q1, 123);
|
||||||
d.deleteColumn(TEST_FAMILY1, TEST_Q2);
|
d.deleteColumn(TEST_FAMILY1, TEST_Q2);
|
||||||
d.deleteFamilyVersion(TEST_FAMILY2, 125);
|
d.deleteFamilyVersion(TEST_FAMILY2, 125);
|
||||||
t.delete(d);
|
t.delete(d);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -609,18 +597,17 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Delete d = new Delete(TEST_ROW1, 127);
|
Delete d = new Delete(TEST_ROW1, 127);
|
||||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||||
d.deleteColumns(TEST_FAMILY1, TEST_Q2);
|
d.deleteColumns(TEST_FAMILY1, TEST_Q2);
|
||||||
d.deleteFamily(TEST_FAMILY2, 129);
|
d.deleteFamily(TEST_FAMILY2, 129);
|
||||||
t.delete(d);
|
t.delete(d);
|
||||||
fail("user2 can not do the delete");
|
fail("user2 can not do the delete");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -640,37 +627,36 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
verifyAllowed(new AccessTestAction() {
|
verifyAllowed(new AccessTestAction() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
||||||
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
Map<String, Permission> permsU2andOwner = new HashMap<String, Permission>();
|
Map<String, Permission> permsU2andOwner = new HashMap<String, Permission>();
|
||||||
permsU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
permsU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
permsU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
permsU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
Put p = new Put(TEST_ROW1);
|
Put p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
||||||
p.setACL(permsU1andOwner);
|
p.setACL(permsU1andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
||||||
p.setACL(permsU2andOwner);
|
p.setACL(permsU2andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
|
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
||||||
p.setACL(permsU2andOwner);
|
p.setACL(permsU2andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
||||||
p.setACL(permsU1andOwner);
|
p.setACL(permsU1andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -680,15 +666,14 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Increment inc = new Increment(TEST_ROW1);
|
Increment inc = new Increment(TEST_ROW1);
|
||||||
inc.setTimeRange(0, 123);
|
inc.setTimeRange(0, 123);
|
||||||
inc.addColumn(TEST_FAMILY1, TEST_Q1, 2L);
|
inc.addColumn(TEST_FAMILY1, TEST_Q1, 2L);
|
||||||
t.increment(inc);
|
t.increment(inc);
|
||||||
t.incrementColumnValue(TEST_ROW1, TEST_FAMILY1, TEST_Q2, 1L);
|
t.incrementColumnValue(TEST_ROW1, TEST_FAMILY1, TEST_Q2, 1L);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -697,17 +682,16 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Increment inc = new Increment(TEST_ROW1);
|
Increment inc = new Increment(TEST_ROW1);
|
||||||
inc.setTimeRange(0, 127);
|
inc.setTimeRange(0, 127);
|
||||||
inc.addColumn(TEST_FAMILY1, TEST_Q2, 2L);
|
inc.addColumn(TEST_FAMILY1, TEST_Q2, 2L);
|
||||||
t.increment(inc);
|
t.increment(inc);
|
||||||
fail();
|
fail();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -727,37 +711,36 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
verifyAllowed(new AccessTestAction() {
|
verifyAllowed(new AccessTestAction() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
||||||
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
Map<String, Permission> permsU2andOwner = new HashMap<String, Permission>();
|
Map<String, Permission> permsU2andOwner = new HashMap<String, Permission>();
|
||||||
permsU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
permsU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
permsU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
permsU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
Put p = new Put(TEST_ROW1);
|
Put p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
||||||
p.setACL(permsU1andOwner);
|
p.setACL(permsU1andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
||||||
p.setACL(permsU2andOwner);
|
p.setACL(permsU2andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
|
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
||||||
p.setACL(permsU2andOwner);
|
p.setACL(permsU2andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
||||||
p.setACL(permsU1andOwner);
|
p.setACL(permsU1andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -769,16 +752,15 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Put p = new Put(TEST_ROW1);
|
Put p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, 125, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, 125, ZERO);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||||
p.setACL(user2.getShortName(), new Permission(Permission.Action.READ,
|
p.setACL(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
t.put(p);
|
t.put(p);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -788,18 +770,17 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Put p = new Put(TEST_ROW1);
|
Put p = new Put(TEST_ROW1);
|
||||||
// column Q1 covers version at 123 fr which user2 do not have permission
|
// 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_Q1, 124, ZERO);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, ZERO);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
fail();
|
fail();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -817,49 +798,48 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
verifyAllowed(new AccessTestAction() {
|
verifyAllowed(new AccessTestAction() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() throws Exception {
|
public Object run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
Map<String, Permission> permsU1andOwner = new HashMap<String, Permission>();
|
||||||
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
permsU1andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
permsU1andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
Map<String, Permission> permsU1andU2andOwner = new HashMap<String, Permission>();
|
Map<String, Permission> permsU1andU2andOwner = new HashMap<String, Permission>();
|
||||||
permsU1andU2andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
permsU1andU2andOwner.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
permsU1andU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
permsU1andU2andOwner.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
permsU1andU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
permsU1andU2andOwner.put(USER_OWNER.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
Map<String, Permission> permsU1andU2 = new HashMap<String, Permission>();
|
Map<String, Permission> permsU1andU2 = new HashMap<String, Permission>();
|
||||||
permsU1andU2.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
permsU1andU2.put(user1.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
permsU1andU2.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
permsU1andU2.put(user2.getShortName(), new Permission(Permission.Action.READ,
|
||||||
Permission.Action.WRITE));
|
Permission.Action.WRITE));
|
||||||
|
|
||||||
Put p = new Put(TEST_ROW1);
|
Put p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, 120, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, 120, ZERO);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, 120, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, 120, ZERO);
|
||||||
p.setACL(permsU1andU2andOwner);
|
p.setACL(permsU1andU2andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
|
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, 123, ZERO);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, 123, ZERO);
|
||||||
p.setACL(permsU1andOwner);
|
p.setACL(permsU1andOwner);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
|
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q1, 127, ZERO);
|
||||||
p.setACL(permsU1andU2);
|
p.setACL(permsU1andU2);
|
||||||
t.put(p);
|
t.put(p);
|
||||||
|
|
||||||
p = new Put(TEST_ROW1);
|
p = new Put(TEST_ROW1);
|
||||||
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
p.add(TEST_FAMILY1, TEST_Q2, 127, ZERO);
|
||||||
p.setACL(user2.getShortName(), new Permission(Permission.Action.READ));
|
p.setACL(user2.getShortName(), new Permission(Permission.Action.READ));
|
||||||
t.put(p);
|
t.put(p);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -870,13 +850,12 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
user1.runAs(new PrivilegedExceptionAction<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Delete d = new Delete(TEST_ROW1);
|
Delete d = new Delete(TEST_ROW1);
|
||||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1, 120);
|
d.deleteColumns(TEST_FAMILY1, TEST_Q1, 120);
|
||||||
t.checkAndDelete(TEST_ROW1, TEST_FAMILY1, TEST_Q1, ZERO, d);
|
t.checkAndDelete(TEST_ROW1, TEST_FAMILY1, TEST_Q1, ZERO, d);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -886,15 +865,14 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Delete d = new Delete(TEST_ROW1);
|
Delete d = new Delete(TEST_ROW1);
|
||||||
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
d.deleteColumns(TEST_FAMILY1, TEST_Q1);
|
||||||
t.checkAndDelete(TEST_ROW1, TEST_FAMILY1, TEST_Q1, ZERO, d);
|
t.checkAndDelete(TEST_ROW1, TEST_FAMILY1, TEST_Q1, ZERO, d);
|
||||||
fail("user2 should not be allowed to do checkAndDelete");
|
fail("user2 should not be allowed to do checkAndDelete");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -905,13 +883,12 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
|
||||||
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
user2.runAs(new PrivilegedExceptionAction<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception {
|
||||||
Table t = new HTable(conf, TEST_TABLE.getTableName());
|
try (Connection connection = ConnectionFactory.createConnection(conf)) {
|
||||||
try {
|
try (Table t = connection.getTable(TEST_TABLE.getTableName())) {
|
||||||
Delete d = new Delete(TEST_ROW1);
|
Delete d = new Delete(TEST_ROW1);
|
||||||
d.deleteColumn(TEST_FAMILY1, TEST_Q2, 120);
|
d.deleteColumn(TEST_FAMILY1, TEST_Q2, 120);
|
||||||
t.checkAndDelete(TEST_ROW1, TEST_FAMILY1, TEST_Q2, ZERO, d);
|
t.checkAndDelete(TEST_ROW1, TEST_FAMILY1, TEST_Q2, ZERO, d);
|
||||||
} finally {
|
}
|
||||||
t.close();
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue