use of io.searchbox.client.http.JestHttpClient in project gerrit by GerritCodeReview.
the class JestClientBuilder method build.
JestHttpClient build() {
JestClientFactory factory = new JestClientFactory();
Builder builder = new HttpClientConfig.Builder(cfg.urls).multiThreaded(true).discoveryEnabled(false).connTimeout((int) cfg.connectionTimeout).maxConnectionIdleTime(cfg.maxConnectionIdleTime, cfg.maxConnectionIdleUnit).maxTotalConnection(cfg.maxTotalConnection).readTimeout(cfg.readTimeout).requestCompressionEnabled(cfg.requestCompression).discoveryFrequency(1L, TimeUnit.MINUTES);
if (cfg.username != null && cfg.password != null) {
builder.defaultCredentials(cfg.username, cfg.password);
}
factory.setHttpClientConfig(builder.build());
return (JestHttpClient) factory.getObject();
}
use of io.searchbox.client.http.JestHttpClient in project spring-boot by spring-projects.
the class JestAutoConfigurationTests method customizerOverridesAutoConfig.
@Test
public void customizerOverridesAutoConfig() {
load(BuilderCustomizer.class, "spring.elasticsearch.jest.uris=http://localhost:9200");
JestHttpClient client = (JestHttpClient) this.context.getBean(JestClient.class);
assertThat(client.getGson()).isSameAs(this.context.getBean(BuilderCustomizer.class).getGson());
}
use of io.searchbox.client.http.JestHttpClient in project spring-boot by spring-projects.
the class JestAutoConfigurationTests method customGson.
@Test
public void customGson() {
load(CustomGson.class, "spring.elasticsearch.jest.uris=http://localhost:9200");
JestHttpClient client = (JestHttpClient) this.context.getBean(JestClient.class);
assertThat(client.getGson()).isSameAs(this.context.getBean("customGson"));
}
Aggregations