### Question:
MetaRangeStoreImpl implements MetaRangeStore { @Override public CompletableFuture<GetActiveRangesResponse> getActiveRanges(GetActiveRangesRequest request) { final long streamId = request.getStreamId(); MetaRangeImpl metaRange = streams.get(streamId); if (null == metaRange) { final MetaRangeImpl metaRangeImpl = new MetaRangeImpl(store, executor, rangePlacementPolicy); return metaRangeImpl.load(streamId) .thenCompose(mr -> { if (null == mr) { return clientManager.getStreamProperties(streamId) .thenCompose(streamProperties -> createStreamIfMissing(streamId, metaRangeImpl, streamProperties)); } else { synchronized (streams) { streams.put(streamId, (MetaRangeImpl) mr); } return getActiveRanges(mr); } }); } else { return getActiveRanges(metaRange); } } MetaRangeStoreImpl(MVCCAsyncStore<byte[], byte[]> store,
                              StorageContainerPlacementPolicy rangePlacementPolicy,
                              ScheduledExecutorService executor,
                              StorageServerClientManager clientManager); @Override CompletableFuture<GetActiveRangesResponse> getActiveRanges(GetActiveRangesRequest request);  }### Answer:
@Test public void testCreateIfMissingPropsNotSpecified() throws Exception { GetActiveRangesResponse resp = FutureUtils.result( this.mrStoreImpl.getActiveRanges(createRequest(null))); assertEquals(StatusCode.STREAM_NOT_FOUND, resp.getCode()); }
@Test public void testCreateIfMissing() throws Exception { GetActiveRangesResponse resp = FutureUtils.result( this.mrStoreImpl.getActiveRanges(createRequest(streamProps))); assertEquals(StatusCode.SUCCESS, resp.getCode()); verifyGetResponse(resp); }
@Test public void testGetTwice() throws Exception { GetActiveRangesResponse resp = FutureUtils.result( this.mrStoreImpl.getActiveRanges(createRequest(streamProps))); assertEquals(StatusCode.SUCCESS, resp.getCode()); verifyGetResponse(resp); GetActiveRangesResponse secondResp = FutureUtils.result( this.mrStoreImpl.getActiveRanges(createRequest(streamProps))); assertEquals(StatusCode.SUCCESS, secondResp.getCode()); verifyGetResponse(secondResp); }