Search in sources :

Example 1 with ElasticSearchRestClientBuilderProvider

use of com.netflix.conductor.elasticsearch.ElasticSearchRestClientBuilderProvider in project conductor by Netflix.

the class TestElasticSearchRestDAOV6 method startElasticSearchWithBatchSize.

private void startElasticSearchWithBatchSize(int i) throws Exception {
    System.setProperty(ElasticSearchConfiguration.ELASTIC_SEARCH_INDEX_BATCH_SIZE_PROPERTY_NAME, String.valueOf(i));
    configuration = new SystemPropertiesElasticSearchConfiguration();
    String host = configuration.getEmbeddedHost();
    int port = configuration.getEmbeddedPort();
    String clusterName = configuration.getEmbeddedClusterName();
    embeddedElasticSearch = new EmbeddedElasticSearchV6(clusterName, host, port);
    embeddedElasticSearch.start();
    ElasticSearchRestClientBuilderProvider restClientProvider = new ElasticSearchRestClientBuilderProvider(configuration);
    RestClientBuilder restClientBuilder = restClientProvider.get();
    restClient = restClientBuilder.build();
    Map<String, String> params = new HashMap<>();
    params.put("wait_for_status", "yellow");
    params.put("timeout", "30s");
    restClient.performRequest("GET", "/_cluster/health", params);
    objectMapper = new JsonMapperProvider().get();
    indexDAO = new ElasticSearchRestDAOV6(restClientBuilder, configuration, objectMapper);
}
Also used : EmbeddedElasticSearchV6(com.netflix.conductor.elasticsearch.es6.EmbeddedElasticSearchV6) ElasticSearchRestClientBuilderProvider(com.netflix.conductor.elasticsearch.ElasticSearchRestClientBuilderProvider) HashMap(java.util.HashMap) SystemPropertiesElasticSearchConfiguration(com.netflix.conductor.elasticsearch.SystemPropertiesElasticSearchConfiguration) RestClientBuilder(org.elasticsearch.client.RestClientBuilder) JsonMapperProvider(com.netflix.conductor.common.utils.JsonMapperProvider)

Example 2 with ElasticSearchRestClientBuilderProvider

use of com.netflix.conductor.elasticsearch.ElasticSearchRestClientBuilderProvider in project conductor by Netflix.

the class TestElasticSearchRestDAOV6 method startServer.

@BeforeClass
public static void startServer() throws Exception {
    System.setProperty(ElasticSearchConfiguration.EMBEDDED_PORT_PROPERTY_NAME, "9204");
    System.setProperty(ElasticSearchConfiguration.ELASTIC_SEARCH_URL_PROPERTY_NAME, "http://localhost:9204");
    System.setProperty(ElasticSearchConfiguration.ELASTIC_SEARCH_INDEX_BATCH_SIZE_PROPERTY_NAME, "1");
    configuration = new SystemPropertiesElasticSearchConfiguration();
    String host = configuration.getEmbeddedHost();
    int port = configuration.getEmbeddedPort();
    String clusterName = configuration.getEmbeddedClusterName();
    embeddedElasticSearch = new EmbeddedElasticSearchV6(clusterName, host, port);
    embeddedElasticSearch.start();
    ElasticSearchRestClientBuilderProvider restClientProvider = new ElasticSearchRestClientBuilderProvider(configuration);
    RestClientBuilder restClientBuilder = restClientProvider.get();
    restClient = restClientBuilder.build();
    Map<String, String> params = new HashMap<>();
    params.put("wait_for_status", "yellow");
    params.put("timeout", "30s");
    restClient.performRequest("GET", "/_cluster/health", params);
    objectMapper = new JsonMapperProvider().get();
    indexDAO = new ElasticSearchRestDAOV6(restClientBuilder, configuration, objectMapper);
}
Also used : EmbeddedElasticSearchV6(com.netflix.conductor.elasticsearch.es6.EmbeddedElasticSearchV6) ElasticSearchRestClientBuilderProvider(com.netflix.conductor.elasticsearch.ElasticSearchRestClientBuilderProvider) HashMap(java.util.HashMap) SystemPropertiesElasticSearchConfiguration(com.netflix.conductor.elasticsearch.SystemPropertiesElasticSearchConfiguration) RestClientBuilder(org.elasticsearch.client.RestClientBuilder) JsonMapperProvider(com.netflix.conductor.common.utils.JsonMapperProvider) BeforeClass(org.junit.BeforeClass)

Example 3 with ElasticSearchRestClientBuilderProvider

use of com.netflix.conductor.elasticsearch.ElasticSearchRestClientBuilderProvider in project conductor by Netflix.

the class TestElasticSearchRestDAOV7 method startElasticSearchWithBatchSize.

private void startElasticSearchWithBatchSize(int i) throws Exception {
    System.setProperty(ElasticSearchConfiguration.ELASTIC_SEARCH_INDEX_BATCH_SIZE_PROPERTY_NAME, String.valueOf(i));
    configuration = new SystemPropertiesElasticSearchConfiguration();
    String host = configuration.getEmbeddedHost();
    int port = configuration.getEmbeddedPort();
    String clusterName = configuration.getEmbeddedClusterName();
    embeddedElasticSearch = new EmbeddedElasticSearchV7(clusterName, host, port);
    embeddedElasticSearch.start();
    ElasticSearchRestClientBuilderProvider restClientProvider = new ElasticSearchRestClientBuilderProvider(configuration);
    RestClientBuilder restClientBuilder = restClientProvider.get();
    restClient = restClientBuilder.build();
    Map<String, String> params = new HashMap<>();
    params.put("wait_for_status", "yellow");
    params.put("timeout", "30s");
    Request request = new Request("GET", "/_cluster/health");
    request.addParameters(params);
    restClient.performRequest(request);
    objectMapper = new JsonMapperProvider().get();
    indexDAO = new ElasticSearchRestDAOV7(restClientBuilder, configuration, objectMapper);
}
Also used : EmbeddedElasticSearchV7(com.netflix.conductor.elasticsearch.es7.EmbeddedElasticSearchV7) ElasticSearchRestClientBuilderProvider(com.netflix.conductor.elasticsearch.ElasticSearchRestClientBuilderProvider) HashMap(java.util.HashMap) SystemPropertiesElasticSearchConfiguration(com.netflix.conductor.elasticsearch.SystemPropertiesElasticSearchConfiguration) Request(org.elasticsearch.client.Request) RestClientBuilder(org.elasticsearch.client.RestClientBuilder) JsonMapperProvider(com.netflix.conductor.common.utils.JsonMapperProvider)

Example 4 with ElasticSearchRestClientBuilderProvider

use of com.netflix.conductor.elasticsearch.ElasticSearchRestClientBuilderProvider in project conductor by Netflix.

the class TestElasticSearchRestDAOV7 method startServer.

@BeforeClass
public static void startServer() throws Exception {
    System.setProperty(ElasticSearchConfiguration.EMBEDDED_PORT_PROPERTY_NAME, "9204");
    System.setProperty(ElasticSearchConfiguration.ELASTIC_SEARCH_URL_PROPERTY_NAME, "http://localhost:9204");
    System.setProperty(ElasticSearchConfiguration.ELASTIC_SEARCH_INDEX_BATCH_SIZE_PROPERTY_NAME, "1");
    configuration = new SystemPropertiesElasticSearchConfiguration();
    String host = configuration.getEmbeddedHost();
    int port = configuration.getEmbeddedPort();
    String clusterName = configuration.getEmbeddedClusterName();
    embeddedElasticSearch = new EmbeddedElasticSearchV7(clusterName, host, port);
    embeddedElasticSearch.start();
    ElasticSearchRestClientBuilderProvider restClientProvider = new ElasticSearchRestClientBuilderProvider(configuration);
    RestClientBuilder restClientBuilder = restClientProvider.get();
    restClient = restClientBuilder.build();
    Map<String, String> params = new HashMap<>();
    params.put("wait_for_status", "yellow");
    params.put("timeout", "30s");
    Request request = new Request("GET", "/_cluster/health");
    request.addParameters(params);
    restClient.performRequest(request);
    objectMapper = new JsonMapperProvider().get();
    indexDAO = new ElasticSearchRestDAOV7(restClientBuilder, configuration, objectMapper);
}
Also used : EmbeddedElasticSearchV7(com.netflix.conductor.elasticsearch.es7.EmbeddedElasticSearchV7) ElasticSearchRestClientBuilderProvider(com.netflix.conductor.elasticsearch.ElasticSearchRestClientBuilderProvider) HashMap(java.util.HashMap) SystemPropertiesElasticSearchConfiguration(com.netflix.conductor.elasticsearch.SystemPropertiesElasticSearchConfiguration) Request(org.elasticsearch.client.Request) RestClientBuilder(org.elasticsearch.client.RestClientBuilder) JsonMapperProvider(com.netflix.conductor.common.utils.JsonMapperProvider) BeforeClass(org.junit.BeforeClass)

Aggregations

JsonMapperProvider (com.netflix.conductor.common.utils.JsonMapperProvider)4 ElasticSearchRestClientBuilderProvider (com.netflix.conductor.elasticsearch.ElasticSearchRestClientBuilderProvider)4 SystemPropertiesElasticSearchConfiguration (com.netflix.conductor.elasticsearch.SystemPropertiesElasticSearchConfiguration)4 HashMap (java.util.HashMap)4 RestClientBuilder (org.elasticsearch.client.RestClientBuilder)4 EmbeddedElasticSearchV6 (com.netflix.conductor.elasticsearch.es6.EmbeddedElasticSearchV6)2 EmbeddedElasticSearchV7 (com.netflix.conductor.elasticsearch.es7.EmbeddedElasticSearchV7)2 Request (org.elasticsearch.client.Request)2 BeforeClass (org.junit.BeforeClass)2