use of com.netflix.titus.ext.elasticsearch.model.BulkEsIndexResp in project titus-control-plane by Netflix.
the class TaskEventsGeneratorTest method mockElasticSearchClient.
private EsClient<TaskDocument> mockElasticSearchClient() {
EsClient<TaskDocument> esClient = mock(EsClient.class);
when(esClient.bulkIndexDocuments(anyList(), anyString(), anyString())).thenAnswer((Answer<Mono<BulkEsIndexResp>>) invocation -> {
final List<TaskDocument> documents = invocation.getArgument(0);
final List<BulkEsIndexRespItem> bulkEsIndexRespItemList = documents.stream().map(doc -> {
EsIndexResp esIndexResp = new EsIndexResp(true, "created", doc.getId());
return new BulkEsIndexRespItem(esIndexResp);
}).collect(Collectors.toList());
final BulkEsIndexResp bulkEsIndexResp = new BulkEsIndexResp(bulkEsIndexRespItemList);
return Mono.just(bulkEsIndexResp);
});
return esClient;
}
Aggregations