private void testDeleteCellWithoutVisibility(DeleteMark mark) throws IOException, InterruptedException { setAuths(); TableName tableName = TableName.valueOf("testDeleteCellWithoutVisibility-" + mark.name()); createTable(tableName, 5); long now = EnvironmentEdgeManager.currentTime(); List<Put> puts = new ArrayList<>(1); Put put = new Put(row1); if (mark == DeleteMark.FAMILY_VERSION) { put.addColumn(fam, qual, now, value); } else { put.addColumn(fam, qual, value); } puts.add(put); try (Table table = TEST_UTIL.getConnection().getTable(tableName)) { table.put(puts); Result r = table.get(new Get(row1)); assertEquals(1, r.size()); assertEquals(Bytes.toString(value), Bytes.toString(CellUtil.cloneValue(r.rawCells()[0]))); Delete d = addDeleteMark(new Delete(row1), mark, now); table.delete(d); r = table.get(new Get(row1)); assertEquals(0, r.size()); } }
@Override public Void run() throws Exception { Delete d1 = new Delete(row1); d1.addFamily(fam); Delete d2 = new Delete(row1); d2.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET)); d2.addColumns(fam, qual); try (Connection connection = ConnectionFactory.createConnection(conf); Table table = connection.getTable(tableName)) { table.delete(createList(d1, d2)); } catch (Throwable t) { throw new IOException(t); } return null; } };
@Test public void testVisibilityLabelsWithDeleteFamilyWithMultipleVersionsNoTimestamp() throws Exception { setAuths(); final TableName tableName = TableName.valueOf(testName.getMethodName()); try (Table table = doPuts(tableName)) { TEST_UTIL.getAdmin().flush(tableName); PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
@Test public void testDeleteCellWithVisibility() throws IOException, InterruptedException { for (DeleteMark mark : DeleteMark.values()) { testDeleteCellWithVisibility(mark); testDeleteCellWithVisibilityV2(mark); } }
@Test public void testVisibilityLabelsWithDeleteColumnWithSpecificVersionWithPutsReAppearing() throws Exception { TableName tableName = createTable(5); try (Table table = TEST_UTIL.getConnection().getTable(tableName)) { Put put1 = new Put(Bytes.toBytes("row1")); put2.addColumn(fam, qual, 123L, value1); put2.setCellVisibility(new CellVisibility(SECRET)); table.put(createList(put1, put2));
private TableName createTable() throws IOException { return createTable(-1); }
@Test public void testDeleteColumnLatestWithNoCellVisibility() throws Exception { setAuths(); final TableName tableName = TableName.valueOf(testName.getMethodName()); try (Table table = doPuts(tableName)) { TEST_UTIL.getAdmin().flush(tableName); PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() { Result[] next = scanner.next(3); assertTrue(next.length == 2); scanAll(next); actiona = new PrivilegedExceptionAction<Void>() { @Override next = scanner.next(3); assertTrue(next.length == 2); scanAll(next); next = scanner.next(3); assertTrue(next.length == 2); scanAll(next); next = scanner.next(3); assertTrue(next.length == 2); scanAll(next); next = scanner.next(3); assertTrue(next.length == 2); scanAll(next);
@Test public void testDeleteFamilyWithoutCellVisibilityWithMulipleVersions() throws Exception { setAuths(); final TableName tableName = TableName.valueOf(testName.getMethodName()); try (Table table = doPutsWithoutVisibility(tableName)) { TEST_UTIL.getAdmin().flush(tableName); PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
@Test public void testDeleteColumnswithMultipleColumnsWithMultipleVersions() throws Exception { setAuths(); final TableName tableName = TableName.valueOf(testName.getMethodName()); try (Table table = doPutsWithDiffCols(tableName)) { TEST_UTIL.getAdmin().flush(tableName); PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
@Test public void testVisibilityExpressionWithNotEqualORCondition() throws Exception { setAuths(); TableName tableName = createTable(5); try (Table table = TEST_UTIL.getConnection().getTable(tableName)) { Put put = new Put(Bytes.toBytes("row1"));
SUPERUSER.runAs(action); final TableName tableName = TableName.valueOf(testName.getMethodName()); try (Table table = doPuts(tableName)) { PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() { @Override
private TableName createTable(int maxVersions) throws IOException { TableName tableName = TableName.valueOf(testName.getMethodName()); createTable(tableName, maxVersions); return tableName; }
@Test public void testDeleteColumnLatestWithNoCellVisibility() throws Exception { setAuths(); final TableName tableName = TableName.valueOf(testName.getMethodName()); try (Table table = doPuts(tableName)) { TEST_UTIL.getAdmin().flush(tableName); PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() { Result[] next = scanner.next(3); assertTrue(next.length == 2); scanAll(next); actiona = new PrivilegedExceptionAction<Void>() { @Override next = scanner.next(3); assertTrue(next.length == 2); scanAll(next); next = scanner.next(3); assertTrue(next.length == 2); scanAll(next); next = scanner.next(3); assertTrue(next.length == 2); scanAll(next); next = scanner.next(3); assertTrue(next.length == 2); scanAll(next);
@Test public void testDeleteFamilyLatestTimeStampWithMulipleVersionsWithoutCellVisibilityInPuts() throws Exception { setAuths(); final TableName tableName = TableName.valueOf(testName.getMethodName()); try (Table table = doPutsWithoutVisibility(tableName)) { PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() { @Override
@Test public void testDeleteCellWithVisibility() throws IOException, InterruptedException { for (DeleteMark mark : DeleteMark.values()) { testDeleteCellWithVisibility(mark); testDeleteCellWithVisibilityV2(mark); } }
@Test public void testDeleteColumnswithMultipleColumnsWithMultipleVersions() throws Exception { setAuths(); final TableName tableName = TableName.valueOf(testName.getMethodName()); try (Table table = doPutsWithDiffCols(tableName)) { TEST_UTIL.getAdmin().flush(tableName); PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
@Test public void testVisibilityExpressionWithNotEqualORCondition() throws Exception { setAuths(); TableName tableName = createTable(5); try (Table table = TEST_UTIL.getConnection().getTable(tableName)) { Put put = new Put(Bytes.toBytes("row1"));
@Test public void testVisibilityLabelsWithDeleteColumnWithSpecificVersionWithPutsReAppearing() throws Exception { TableName tableName = createTable(5); try (Table table = TEST_UTIL.getConnection().getTable(tableName)) { Put put1 = new Put(Bytes.toBytes("row1")); put2.addColumn(fam, qual, 123L, value1); put2.setCellVisibility(new CellVisibility(SECRET)); table.put(createList(put1, put2));
SUPERUSER.runAs(action); final TableName tableName = TableName.valueOf(testName.getMethodName()); try (Table table = doPuts(tableName)) { PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() { @Override
@Test public void testVisibilityLabelsWithDeleteColumnsWithMultipleVersionsNoTimestamp() throws Exception { setAuths(); final TableName tableName = TableName.valueOf(testName.getMethodName()); try (Table table = doPuts(tableName)) { TEST_UTIL.getAdmin().flush(tableName); PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {