Search in sources :

Example 6 with GetNamespaceResponse

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

the class TestRootRangeStoreImpl method testGetNamespaceNotFound.

@Test
public void testGetNamespaceNotFound() throws Exception {
    String nsName = name.getMethodName();
    CompletableFuture<GetNamespaceResponse> getFuture = rootRangeStore.getNamespace(createGetNamespaceRequest(nsName));
    // create first namespace
    GetNamespaceResponse response = FutureUtils.result(getFuture);
    assertEquals(StatusCode.NAMESPACE_NOT_FOUND, response.getCode());
    verifyNamespaceNotExists(nsName, 0L);
    verifyNamespaceId(-1L);
}
Also used : GetNamespaceResponse(org.apache.bookkeeper.stream.proto.storage.GetNamespaceResponse) Test(org.junit.Test)

Example 7 with GetNamespaceResponse

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

the class StorageContainerImplTest method testGetNamespace.

@Test
public void testGetNamespace() throws Exception {
    mockStorageContainer(SCID);
    GetNamespaceResponse expectedResp = GetNamespaceResponse.getDefaultInstance();
    when(rrStore.getNamespace(any(GetNamespaceRequest.class))).thenReturn(FutureUtils.value(expectedResp));
    GetNamespaceRequest expectedReq = GetNamespaceRequest.getDefaultInstance();
    assertSame(expectedResp, FutureUtils.result(rrStore.getNamespace(expectedReq)));
    verify(rrStore, times(1)).getNamespace(same(expectedReq));
}
Also used : GetNamespaceResponse(org.apache.bookkeeper.stream.proto.storage.GetNamespaceResponse) GetNamespaceRequest(org.apache.bookkeeper.stream.proto.storage.GetNamespaceRequest) Test(org.junit.Test)

Aggregations

GetNamespaceResponse (org.apache.bookkeeper.stream.proto.storage.GetNamespaceResponse)7 Test (org.junit.Test)6 GetNamespaceRequest (org.apache.bookkeeper.stream.proto.storage.GetNamespaceRequest)4 ProtoUtils.createGetNamespaceRequest (org.apache.bookkeeper.stream.protocol.util.ProtoUtils.createGetNamespaceRequest)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 StorageContainer (org.apache.bookkeeper.stream.storage.api.sc.StorageContainer)1