use of org.apache.bookkeeper.stream.proto.storage.RootRangeServiceGrpc.RootRangeServiceImplBase in project bookkeeper by apache.
the class RootRangeClientImplTestBase method testRequestFailure.
@Test
public void testRequestFailure() throws Exception {
CompletableFuture<StorageServerChannel> serviceFuture = FutureUtils.createFuture();
rootRangeClient.getStorageContainerClient().setStorageServerChannelFuture(serviceFuture);
RootRangeServiceImplBase rootRangeService = createRootRangeServiceForRequestFailure();
serviceRegistry.addService(rootRangeService.bindService());
StorageServerChannel rsChannel = new StorageServerChannel(InProcessChannelBuilder.forName(serverName).directExecutor().build(), Optional.empty());
serviceFuture.complete(rsChannel);
verifyRequestFailure(rootRangeClient);
}
use of org.apache.bookkeeper.stream.proto.storage.RootRangeServiceGrpc.RootRangeServiceImplBase in project bookkeeper by apache.
the class RootRangeClientImplTestBase method testRequestSuccess.
@Test
public void testRequestSuccess() throws Exception {
CompletableFuture<StorageServerChannel> serviceFuture = FutureUtils.createFuture();
rootRangeClient.getStorageContainerClient().setStorageServerChannelFuture(serviceFuture);
RootRangeServiceImplBase rootRangeService = createRootRangeServiceForSuccess();
serviceRegistry.addService(rootRangeService.bindService());
StorageServerChannel rsChannel = new StorageServerChannel(InProcessChannelBuilder.forName(serverName).directExecutor().build(), Optional.empty());
serviceFuture.complete(rsChannel);
verifySuccess(rootRangeClient);
}
use of org.apache.bookkeeper.stream.proto.storage.RootRangeServiceGrpc.RootRangeServiceImplBase in project bookkeeper by apache.
the class RootRangeClientImplTestBase method testRpcFailure.
@Test
public void testRpcFailure() throws Exception {
CompletableFuture<StorageServerChannel> serviceFuture = FutureUtils.createFuture();
rootRangeClient.getStorageContainerClient().setStorageServerChannelFuture(serviceFuture);
RootRangeServiceImplBase rootRangeService = createRootRangeServiceForRpcFailure();
serviceRegistry.addService(rootRangeService.bindService());
StorageServerChannel rsChannel = new StorageServerChannel(InProcessChannelBuilder.forName(serverName).directExecutor().build(), Optional.empty());
serviceFuture.complete(rsChannel);
verifyRpcFailure(rootRangeClient);
}
use of org.apache.bookkeeper.stream.proto.storage.RootRangeServiceGrpc.RootRangeServiceImplBase in project bookkeeper by apache.
the class TestStorageServerClientManagerImpl method testGetMetaRangeClientByStreamId.
@Test
public void testGetMetaRangeClientByStreamId() throws Exception {
long streamId = 3456L;
StreamProperties props = StreamProperties.newBuilder().setStorageContainerId(1234L).setStreamId(streamId).setStreamName("metaclient-stream").setStreamConf(StreamConfiguration.newBuilder().build()).build();
RootRangeServiceImplBase rootRangeService = new RootRangeServiceImplBase() {
@Override
public void getStream(GetStreamRequest request, StreamObserver<GetStreamResponse> responseObserver) {
responseObserver.onNext(GetStreamResponse.newBuilder().setCode(StatusCode.SUCCESS).setStreamProps(props).build());
responseObserver.onCompleted();
}
};
serviceRegistry.addService(rootRangeService.bindService());
// the stream properties will be cached here
assertEquals(props, FutureUtils.result(serverManager.getStreamProperties(streamId)));
// the metadata range client is cached as well
MetaRangeClient client = FutureUtils.result(serverManager.openMetaRangeClient(streamId));
assertEquals(props, client.getStreamProps());
}
Aggregations