Search in sources :

Example 1 with CreateNamespaceResponse

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;
}
Also used : CreateNamespaceResponse(org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse)

Example 2 with CreateNamespaceResponse

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);
}
Also used : CreateNamespaceResponse(org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse) Test(org.junit.Test)

Example 3 with CreateNamespaceResponse

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);
}
Also used : CreateNamespaceResponse(org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse) Test(org.junit.Test)

Example 4 with CreateNamespaceResponse

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);
}
Also used : CreateNamespaceResponse(org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse) Test(org.junit.Test)

Example 5 with CreateNamespaceResponse

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);
}
Also used : CreateNamespaceResponse(org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse) Test(org.junit.Test)

Aggregations

CreateNamespaceResponse (org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse)14 Test (org.junit.Test)12 CreateNamespaceRequest (org.apache.bookkeeper.stream.proto.storage.CreateNamespaceRequest)5 ProtoUtils.createCreateNamespaceRequest (org.apache.bookkeeper.stream.protocol.util.ProtoUtils.createCreateNamespaceRequest)3 StreamObserver (io.grpc.stub.StreamObserver)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 CreateStreamResponse (org.apache.bookkeeper.stream.proto.storage.CreateStreamResponse)2 DeleteStreamResponse (org.apache.bookkeeper.stream.proto.storage.DeleteStreamResponse)2 UTF_8 (com.google.common.base.Charsets.UTF_8)1 ByteString (com.google.protobuf.ByteString)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 URI (java.net.URI)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 Slf4j (lombok.extern.slf4j.Slf4j)1 CompareResult (org.apache.bookkeeper.api.kv.op.CompareResult)1 RangeOp (org.apache.bookkeeper.api.kv.op.RangeOp)1 TxnOp (org.apache.bookkeeper.api.kv.op.TxnOp)1 Options (org.apache.bookkeeper.api.kv.options.Options)1