当前位置: 首页>>代码示例>>Java>>正文


Java Delete.deleteFamilyVersion方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.client.Delete.deleteFamilyVersion方法的典型用法代码示例。如果您正苦于以下问题:Java Delete.deleteFamilyVersion方法的具体用法?Java Delete.deleteFamilyVersion怎么用?Java Delete.deleteFamilyVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.client.Delete的用法示例。


在下文中一共展示了Delete.deleteFamilyVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testVisibilityLabelsWithDeleteFamilyVersion

import org.apache.hadoop.hbase.client.Delete; //导入方法依赖的package包/类
@Test
public void testVisibilityLabelsWithDeleteFamilyVersion() throws Exception {
  setAuths();
  final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
  long[] ts = new long[] { 123l, 125l };
  try (Table table = createTableAndWriteDataWithLabels(tableName, ts,
      CONFIDENTIAL + "|" + TOPSECRET, SECRET)) {
    PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
      @Override
      public Void run() throws Exception {
        try (Connection connection = ConnectionFactory.createConnection(conf);
             Table table = connection.getTable(tableName)) {
          Delete d = new Delete(row1);
          d.setCellVisibility(new CellVisibility(TOPSECRET + "|" + CONFIDENTIAL));
          d.deleteFamilyVersion(fam, 123l);
          table.delete(d);
        } catch (Throwable t) {
          throw new IOException(t);
        }
        return null;
      }
    };
    SUPERUSER.runAs(actiona);

    TEST_UTIL.getHBaseAdmin().flush(tableName);
    Scan s = new Scan();
    s.setAuthorizations(new Authorizations(SECRET, PRIVATE, CONFIDENTIAL));
    ResultScanner scanner = table.getScanner(s);
    Result[] next = scanner.next(3);
    assertTrue(next.length == 1);
    CellScanner cellScanner = next[0].cellScanner();
    cellScanner.advance();
    Cell current = cellScanner.current();
    assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
        current.getRowLength(), row2, 0, row2.length));
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:38,代码来源:TestVisibilityLabelsWithDeletes.java


注:本文中的org.apache.hadoop.hbase.client.Delete.deleteFamilyVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。