use of org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse in project bookkeeper by apache.
the class TestRootRangeStoreImpl method createNamespaceAndVerify.
private CreateNamespaceResponse createNamespaceAndVerify(String nsName, long expectedNsId) throws Exception {
CompletableFuture<CreateNamespaceResponse> createFuture = rootRangeStore.createNamespace(createCreateNamespaceRequest(nsName, namespaceConf));
CreateNamespaceResponse response = FutureUtils.result(createFuture);
assertEquals(StatusCode.SUCCESS, response.getCode());
assertEquals(expectedNsId, response.getColProps().getNamespaceId());
assertEquals(nsName, response.getColProps().getNamespaceName());
assertEquals(namespaceConf.getDefaultStreamConf(), response.getColProps().getDefaultStreamConf());
return response;
}
use of org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse in project bookkeeper by apache.
the class TestRootRangeStoreImpl method testCreateNamespaceSuccess.
@Test
public void testCreateNamespaceSuccess() throws Exception {
String nsName = name.getMethodName();
CreateNamespaceResponse response = createNamespaceAndVerify(nsName, 0L);
verifyNamespaceExists(nsName, response.getColProps().getNamespaceId());
verifyNamespaceId(0L);
}
use of org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse in project bookkeeper by apache.
the class TestRootRangeStoreImpl method testCreateNamespaceExists.
@Test
public void testCreateNamespaceExists() throws Exception {
String nsName = name.getMethodName();
// create first namespace
CreateNamespaceResponse response = createNamespaceAndVerify(nsName, 0L);
verifyNamespaceExists(nsName, response.getColProps().getNamespaceId());
verifyNamespaceId(0L);
// create the namespace with same name will fail
CreateNamespaceResponse response2 = FutureUtils.result(rootRangeStore.createNamespace(createCreateNamespaceRequest(nsName, namespaceConf)));
assertEquals(StatusCode.INTERNAL_SERVER_ERROR, response2.getCode());
// namespace will not be advanced
verifyNamespaceId(0L);
}
use of org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse in project bookkeeper by apache.
the class TestRootRangeStoreImpl method testCreateStreamSuccess.
@Test
public void testCreateStreamSuccess() 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);
}
use of org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse in project bookkeeper by apache.
the class TestRootRangeStoreImpl method testGetNamespaceSuccess.
@Test
public void testGetNamespaceSuccess() throws Exception {
String nsName = name.getMethodName();
CreateNamespaceResponse response = createNamespaceAndVerify(nsName, 0L);
getNamespaceAndVerify(nsName, 0L, namespaceConf.getDefaultStreamConf());
verifyNamespaceId(0);
}
Aggregations