use of io.etcd.jetcd.kv.DeleteResponse in project jetcd by coreos.
the class KVNamespaceTest method deleteKVsWithAssertion.
private static void deleteKVsWithAssertion(KV kvClient, ByteSequence key, ByteSequence end, List<TestKeyValue> previousKVs) throws Exception {
CompletableFuture<DeleteResponse> deleteFuture = kvClient.delete(key, DeleteOption.newBuilder().withRange(end).withPrevKV(true).build());
DeleteResponse deleteResponse = deleteFuture.get();
assertThat(deleteResponse.getDeleted()).isEqualTo(previousKVs.size());
assertThat(deleteResponse.getPrevKvs().size()).isEqualTo(previousKVs.size());
for (KeyValue keyValue : deleteResponse.getPrevKvs()) {
boolean exist = false;
for (TestKeyValue previousKV : previousKVs) {
if (previousKV.key.equals(keyValue.getKey())) {
exist = true;
assertThat(keyValue.getValue()).isEqualTo(previousKV.value);
break;
}
}
assertThat(exist).isTrue();
}
}
Aggregations