use of org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse in project bookkeeper by apache.
the class TestRootRangeStoreImpl method testDeleteStreamSuccess.
@Test
public void testDeleteStreamSuccess() throws Exception {
String nsName = name.getMethodName();
String streamName = name.getMethodName();
CreateNamespaceResponse createResp = createNamespaceAndVerify(nsName, 0L);
createStreamAndVerify(nsName, streamName, MIN_DATA_STREAM_ID);
verifyStreamExists(createResp.getColProps().getNamespaceId(), streamName, MIN_DATA_STREAM_ID);
verifyStreamId(MIN_DATA_STREAM_ID);
CompletableFuture<DeleteStreamResponse> deleteFuture = rootRangeStore.deleteStream(createDeleteStreamRequest(nsName, streamName));
DeleteStreamResponse deleteResp = FutureUtils.result(deleteFuture);
assertEquals(StatusCode.SUCCESS, deleteResp.getCode());
verifyStreamNotExists(createResp.getColProps().getNamespaceId(), streamName, MIN_DATA_STREAM_ID);
verifyStreamId(MIN_DATA_STREAM_ID);
}
use of org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse in project bookkeeper by apache.
the class TestRootRangeStoreImpl method testDeleteNamespaceSuccess.
@Test
public void testDeleteNamespaceSuccess() throws Exception {
String nsName = name.getMethodName();
CreateNamespaceResponse createResp = createNamespaceAndVerify(nsName, 0L);
verifyNamespaceExists(nsName, createResp.getColProps().getNamespaceId());
verifyNamespaceId(0L);
deleteNamespaceAndVerify(nsName);
verifyNamespaceNotExists(nsName, createResp.getColProps().getNamespaceId());
verifyNamespaceId(0L);
}
use of org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse in project bookkeeper by apache.
the class TestRootRangeStoreImpl method testCreateStreamExists.
@Test
public void testCreateStreamExists() throws Exception {
String nsName = name.getMethodName();
String streamName = name.getMethodName();
CreateNamespaceResponse createResp = createNamespaceAndVerify(nsName, 0L);
createStreamAndVerify(nsName, streamName, MIN_DATA_STREAM_ID);
verifyStreamExists(createResp.getColProps().getNamespaceId(), streamName, MIN_DATA_STREAM_ID);
verifyStreamId(MIN_DATA_STREAM_ID);
// create the namespace with same name will fail
CreateStreamResponse response2 = FutureUtils.result(rootRangeStore.createStream(createCreateStreamRequest(nsName, streamName, streamConf)));
// TODO: change it later
assertEquals(StatusCode.INTERNAL_SERVER_ERROR, response2.getCode());
verifyStreamId(MIN_DATA_STREAM_ID);
}
use of org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse in project bookkeeper by apache.
the class StorageContainerImplTest method testCreateNamespace.
//
// Root Range Methods
//
@Test
public void testCreateNamespace() throws Exception {
mockStorageContainer(SCID);
CreateNamespaceResponse expectedResp = CreateNamespaceResponse.getDefaultInstance();
when(rrStore.createNamespace(any(CreateNamespaceRequest.class))).thenReturn(FutureUtils.value(expectedResp));
CreateNamespaceRequest expectedReq = CreateNamespaceRequest.getDefaultInstance();
assertSame(expectedResp, FutureUtils.result(rrStore.createNamespace(expectedReq)));
verify(rrStore, times(1)).createNamespace(same(expectedReq));
}
Aggregations