Exemplo n.º 1
0
  public void testDelete_KeepVersionZero() {
    byte[] qualifier = Bytes.toBytes("qualifier");
    deleteType = KeyValue.Type.Delete.getCode();

    long deleteTimestamp = 10;
    long valueTimestamp = 0;

    sdt.reset();
    KeyValue kv =
        new KeyValue(
            Bytes.toBytes("row"),
            Bytes.toBytes("f"),
            qualifier,
            deleteTimestamp,
            KeyValue.Type.Delete);
    sdt.add(kv);
    kv =
        new KeyValue(
            Bytes.toBytes("row"),
            Bytes.toBytes("f"),
            qualifier,
            valueTimestamp,
            KeyValue.Type.Delete);
    DeleteResult ret = sdt.isDeleted(kv);
    assertEquals(DeleteResult.NOT_DELETED, ret);
  }
Exemplo n.º 2
0
  public void testDelete_DeleteColumn() {
    byte[] qualifier = Bytes.toBytes("qualifier");
    deleteType = KeyValue.Type.Delete.getCode();
    KeyValue kv =
        new KeyValue(
            Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, timestamp, KeyValue.Type.Delete);
    sdt.add(kv);

    timestamp -= 5;
    kv =
        new KeyValue(
            Bytes.toBytes("row"),
            Bytes.toBytes("f"),
            qualifier,
            timestamp,
            KeyValue.Type.DeleteColumn);
    deleteType = KeyValue.Type.DeleteColumn.getCode();
    sdt.add(kv);

    timestamp -= 5;
    kv =
        new KeyValue(
            Bytes.toBytes("row"),
            Bytes.toBytes("f"),
            qualifier,
            timestamp,
            KeyValue.Type.DeleteColumn);
    DeleteResult ret = sdt.isDeleted(kv);
    assertEquals(DeleteResult.COLUMN_DELETED, ret);
  }
Exemplo n.º 3
0
 // Testing new way where we save the Delete in case of a Delete for specific
 // ts, could have just added the last line to the first test, but rather keep
 // them separated
 public void testDelete_KeepDelete() {
   byte[] qualifier = Bytes.toBytes("qualifier");
   deleteType = KeyValue.Type.Delete.getCode();
   KeyValue kv =
       new KeyValue(
           Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, timestamp, KeyValue.Type.Delete);
   sdt.add(kv);
   sdt.isDeleted(kv);
   assertEquals(false, sdt.isEmpty());
 }