Search in sources :

Example 6 with DeleteStreamResponse

use of org.apache.bookkeeper.stream.proto.storage.DeleteStreamResponse in project bookkeeper by apache.

the class TestRootRangeStoreImpl method testDeleteStreamNamespaceNotFound.

@Test
public void testDeleteStreamNamespaceNotFound() throws Exception {
    String nsName = name.getMethodName();
    String streamName = name.getMethodName();
    CompletableFuture<DeleteStreamResponse> deleteFuture = rootRangeStore.deleteStream(createDeleteStreamRequest(nsName, streamName));
    DeleteStreamResponse response = FutureUtils.result(deleteFuture);
    assertEquals(StatusCode.NAMESPACE_NOT_FOUND, response.getCode());
}
Also used : DeleteStreamResponse(org.apache.bookkeeper.stream.proto.storage.DeleteStreamResponse) Test(org.junit.Test)

Example 7 with DeleteStreamResponse

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

Example 8 with DeleteStreamResponse

use of org.apache.bookkeeper.stream.proto.storage.DeleteStreamResponse in project bookkeeper by apache.

the class TestRootRangeStoreImpl method testDeleteStreamInvalidName.

@Test
public void testDeleteStreamInvalidName() throws Exception {
    String nsName = name.getMethodName();
    String streamName = "";
    CompletableFuture<DeleteStreamResponse> deleteFuture = rootRangeStore.deleteStream(createDeleteStreamRequest(nsName, streamName));
    DeleteStreamResponse response = FutureUtils.result(deleteFuture);
    assertEquals(StatusCode.INVALID_STREAM_NAME, response.getCode());
}
Also used : DeleteStreamResponse(org.apache.bookkeeper.stream.proto.storage.DeleteStreamResponse) Test(org.junit.Test)

Aggregations

DeleteStreamResponse (org.apache.bookkeeper.stream.proto.storage.DeleteStreamResponse)8 Test (org.junit.Test)8 DeleteStreamRequest (org.apache.bookkeeper.stream.proto.storage.DeleteStreamRequest)4 ProtoUtils.createDeleteStreamRequest (org.apache.bookkeeper.stream.protocol.util.ProtoUtils.createDeleteStreamRequest)3 StreamObserver (io.grpc.stub.StreamObserver)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 RangeStoreImpl (org.apache.bookkeeper.stream.storage.impl.RangeStoreImpl)2 ByteString (com.google.protobuf.ByteString)1 CreateNamespaceResponse (org.apache.bookkeeper.stream.proto.storage.CreateNamespaceResponse)1 StorageContainer (org.apache.bookkeeper.stream.storage.api.sc.StorageContainer)1