use of org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService in project elasticsearch by elastic.
the class MetaDataIndexTemplateServiceTests method putTemplate.
private static List<Throwable> putTemplate(NamedXContentRegistry xContentRegistry, PutRequest request) {
MetaDataCreateIndexService createIndexService = new MetaDataCreateIndexService(Settings.EMPTY, null, null, null, null, null, null, null, xContentRegistry);
MetaDataIndexTemplateService service = new MetaDataIndexTemplateService(Settings.EMPTY, null, createIndexService, new AliasValidator(Settings.EMPTY), null, new IndexScopedSettings(Settings.EMPTY, IndexScopedSettings.BUILT_IN_INDEX_SETTINGS), xContentRegistry);
final List<Throwable> throwables = new ArrayList<>();
service.putTemplate(request, new MetaDataIndexTemplateService.PutListener() {
@Override
public void onResponse(MetaDataIndexTemplateService.PutResponse response) {
}
@Override
public void onFailure(Exception e) {
throwables.add(e);
}
});
return throwables;
}
use of org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService in project elasticsearch by elastic.
the class MetaDataIndexTemplateServiceTests method putTemplateDetail.
private List<Throwable> putTemplateDetail(PutRequest request) throws Exception {
IndicesService indicesService = getInstanceFromNode(IndicesService.class);
ClusterService clusterService = getInstanceFromNode(ClusterService.class);
MetaDataCreateIndexService createIndexService = new MetaDataCreateIndexService(Settings.EMPTY, clusterService, indicesService, null, null, null, null, null, xContentRegistry());
MetaDataIndexTemplateService service = new MetaDataIndexTemplateService(Settings.EMPTY, clusterService, createIndexService, new AliasValidator(Settings.EMPTY), indicesService, new IndexScopedSettings(Settings.EMPTY, IndexScopedSettings.BUILT_IN_INDEX_SETTINGS), xContentRegistry());
final List<Throwable> throwables = new ArrayList<>();
final CountDownLatch latch = new CountDownLatch(1);
service.putTemplate(request, new MetaDataIndexTemplateService.PutListener() {
@Override
public void onResponse(MetaDataIndexTemplateService.PutResponse response) {
latch.countDown();
}
@Override
public void onFailure(Exception e) {
throwables.add(e);
latch.countDown();
}
});
latch.await();
return throwables;
}
Aggregations