use of org.elasticsearch.indices.IndicesLifecycle in project crate by crate.
the class BlobIndicesServiceTest method testBlobComponentsAreNotCreatedForNonBlobIndex.
@Test
public void testBlobComponentsAreNotCreatedForNonBlobIndex() throws Exception {
CompletableFuture<IndicesLifecycle.Listener> listenerFuture = new CompletableFuture<>();
BlobIndicesService blobIndicesService = new BlobIndicesService(Settings.EMPTY, new NoopClusterService(), new IndicesLifecycle() {
@Override
public void addListener(Listener listener) {
listenerFuture.complete(listener);
}
@Override
public void removeListener(Listener listener) {
}
});
IndicesLifecycle.Listener listener = listenerFuture.get(30, TimeUnit.SECONDS);
IndexService indexService = mock(IndexService.class);
when(indexService.index()).thenReturn(new Index("dummy"));
listener.afterIndexCreated(indexService);
IndexShard indexShard = mock(IndexShard.class);
when(indexShard.indexService()).thenReturn(indexService);
listener.afterIndexShardCreated(indexShard);
assertThat(blobIndicesService.indices.keySet(), Matchers.empty());
}
Aggregations