use of org.apache.bookkeeper.api.kv.result.PutResult in project bookkeeper by apache.
the class TestMVCCAsyncBytesStoreImpl method testPutGetDeleteRanges.
@Test
public void testPutGetDeleteRanges() throws Exception {
this.streamName = "test-put-kvs";
StateStoreSpec spec = initSpec(streamName);
result(store.init(spec));
int numPairs = 100;
List<PutResult<byte[], byte[]>> kvs = writeKVs(numPairs, true);
assertEquals(numPairs, kvs.size());
for (PutResult<byte[], byte[]> kv : kvs) {
assertEquals(Code.OK, kv.code());
assertNull(kv.prevKv());
kv.close();
}
verifyRange(20, 70, 2, 2, 0);
List<KeyValue<byte[], byte[]>> prevKvs = result(store.deleteRange(getKey(20), getKey(70)));
assertNotNull(prevKvs);
verifyRecords(prevKvs, 20, 70, 2, 2, 0);
prevKvs.forEach(KeyValue::close);
prevKvs = result(store.range(getKey(20), getKey(70)));
assertTrue(prevKvs.isEmpty());
}
Aggregations