use of org.sonar.server.es.IndexType in project sonarqube by SonarSource.
the class ProxyIndexRequestBuilderTest method fail_if_bad_query.
@Test
public void fail_if_bad_query() {
IndexRequestBuilder requestBuilder = esTester.client().prepareIndex(new IndexType("unknownIndex", "unknownType"));
try {
requestBuilder.get();
fail();
} catch (Exception e) {
assertThat(e).isInstanceOf(IllegalStateException.class);
assertThat(e.getMessage()).contains("Fail to execute ES index request for key 'null' on index 'unknownIndex' on type 'unknownType'");
}
}
use of org.sonar.server.es.IndexType in project sonarqube by SonarSource.
the class PermissionIndexer method index.
private void index(Collection<PermissionIndexerDao.Dto> authorizations, AuthorizationScope scope, Size bulkSize) {
IndexType indexType = scope.getIndexType();
BulkIndexer bulkIndexer = new BulkIndexer(esClient, indexType.getIndex());
bulkIndexer.setSize(bulkSize);
bulkIndexer.start();
authorizations.stream().filter(scope.getProjectPredicate()).map(dto -> newIndexRequest(dto, indexType)).forEach(bulkIndexer::add);
bulkIndexer.stop();
}
use of org.sonar.server.es.IndexType in project sonarqube by SonarSource.
the class ProxyIndexRequestBuilderTest method fail_if_bad_query_with_basic_profiling.
@Test
public void fail_if_bad_query_with_basic_profiling() {
IndexRequestBuilder requestBuilder = esTester.client().prepareIndex(new IndexType("unknownIndex", "unknownType"));
try {
requestBuilder.get();
fail();
} catch (Exception e) {
assertThat(e).isInstanceOf(IllegalStateException.class);
assertThat(e.getMessage()).contains("Fail to execute ES index request for key 'null' on index 'unknownIndex' on type 'unknownType'");
}
}
Aggregations