use of org.apache.bookkeeper.clients.impl.internal.api.MetaRangeClient 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