use of org.apache.bookkeeper.stream.proto.storage.StorageContainerResponse in project bookkeeper by apache.
the class TableStoreImplTest method deleteRange.
List<KeyValue> deleteRange(int startKey, int endKey) throws Exception {
StorageContainerResponse response = result(tableStore.delete(StorageContainerRequest.newBuilder().setScId(SC_ID).setKvDeleteReq(DeleteRangeRequest.newBuilder().setHeader(HEADER).setKey(getKey(startKey)).setRangeEnd(getKey(endKey)).setPrevKv(true).build()).build()));
assertEquals(StatusCode.SUCCESS, response.getCode());
assertEquals(ResponseCase.KV_DELETE_RESP, response.getResponseCase());
DeleteRangeResponse delResp = response.getKvDeleteResp();
assertEquals(HEADER, delResp.getHeader().getRoutingHeader());
return delResp.getPrevKvsList();
}
use of org.apache.bookkeeper.stream.proto.storage.StorageContainerResponse in project bookkeeper by apache.
the class TableStoreImplTest method range.
List<KeyValue> range(int startKey, int endKey) throws Exception {
StorageContainerResponse response = result(tableStore.range(StorageContainerRequest.newBuilder().setScId(SC_ID).setKvRangeReq(RangeRequest.newBuilder().setHeader(HEADER).setKey(getKey(startKey)).setRangeEnd(getKey(endKey)).build()).build()));
assertEquals(StatusCode.SUCCESS, response.getCode());
assertEquals(ResponseCase.KV_RANGE_RESP, response.getResponseCase());
RangeResponse rangeResp = response.getKvRangeResp();
assertEquals(HEADER, rangeResp.getHeader().getRoutingHeader());
return rangeResp.getKvsList();
}
use of org.apache.bookkeeper.stream.proto.storage.StorageContainerResponse in project bookkeeper by apache.
the class MetaRangeStoreImplTest method testGetTwice.
@Test
public void testGetTwice() throws Exception {
StorageContainerResponse resp = FutureUtils.result(this.mrStoreImpl.getActiveRanges(createRequest(streamProps)));
assertEquals(StatusCode.SUCCESS, resp.getCode());
GetActiveRangesResponse getResp = resp.getGetActiveRangesResp();
verifyGetResponse(getResp);
StorageContainerResponse secondResp = FutureUtils.result(this.mrStoreImpl.getActiveRanges(createRequest(streamProps)));
assertEquals(StatusCode.SUCCESS, secondResp.getCode());
GetActiveRangesResponse secondGetResp = resp.getGetActiveRangesResp();
verifyGetResponse(secondGetResp);
}
use of org.apache.bookkeeper.stream.proto.storage.StorageContainerResponse in project bookkeeper by apache.
the class MetaRangeStoreImplTest method testCreateIfMissing.
@Test
public void testCreateIfMissing() throws Exception {
StorageContainerResponse resp = FutureUtils.result(this.mrStoreImpl.getActiveRanges(createRequest(streamProps)));
assertEquals(StatusCode.SUCCESS, resp.getCode());
GetActiveRangesResponse getResp = resp.getGetActiveRangesResp();
verifyGetResponse(getResp);
}
use of org.apache.bookkeeper.stream.proto.storage.StorageContainerResponse in project bookkeeper by apache.
the class StorageContainerImplTest method testGetActiveRanges.
//
// Meta Range Methods
//
@Test
public void testGetActiveRanges() throws Exception {
mockStorageContainer(SCID);
StorageContainerResponse expectedResp = StorageContainerResponse.getDefaultInstance();
when(mrStore.getActiveRanges(any(StorageContainerRequest.class))).thenReturn(FutureUtils.value(expectedResp));
StorageContainerRequest expectedReq = StorageContainerRequest.getDefaultInstance();
assertSame(expectedResp, FutureUtils.result(mrStore.getActiveRanges(expectedReq)));
verify(mrStore, times(1)).getActiveRanges(same(expectedReq));
}
Aggregations