use of com.google.cloud.teleport.v2.elasticsearch.options.ElasticsearchWriteOptions in project DataflowTemplates by GoogleCloudPlatform.
the class WriteToElasticsearchTest method testNullConnectionInformation.
/**
* Tests {@link WriteToElasticsearch} throws an exception if a null ConnectionInformation is
* provided.
*/
@Test
public void testNullConnectionInformation() {
exceptionRule.expect(IllegalArgumentException.class);
ElasticsearchWriteOptions options = PipelineOptionsFactory.create().as(ElasticsearchWriteOptions.class);
options.setConnectionUrl(null);
options.setApiKey("key");
pipeline.apply("CreateInput", Create.of("test")).apply(WriteToElasticsearch.newBuilder().setOptions(options).build());
pipeline.run();
}
use of com.google.cloud.teleport.v2.elasticsearch.options.ElasticsearchWriteOptions in project DataflowTemplates by GoogleCloudPlatform.
the class WriteToElasticsearchTest method testElasticsearchWriteOptionsRetryConfigMaxAttempts.
/**
* Tests that {@link WriteToElasticsearch} throws an exception if {@link
* org.apache.beam.sdk.io.elasticsearch.ElasticsearchIO.RetryConfiguration} are invalid.
*/
@Test
public void testElasticsearchWriteOptionsRetryConfigMaxAttempts() {
exceptionRule.expect(IllegalArgumentException.class);
ElasticsearchWriteOptions options = PipelineOptionsFactory.create().as(ElasticsearchWriteOptions.class);
options.setConnectionUrl("https://host.domain");
options.setApiKey("key");
options.setMaxRetryDuration(500L);
options.setMaxRetryAttempts(null);
pipeline.apply("CreateInput", Create.of("test")).apply("TestWriteToElasticsearchBadMaxAttempts", WriteToElasticsearch.newBuilder().setOptions(options).build());
pipeline.run();
}
use of com.google.cloud.teleport.v2.elasticsearch.options.ElasticsearchWriteOptions in project DataflowTemplates by GoogleCloudPlatform.
the class WriteToElasticsearchTest method testNullType.
/**
* Tests {@link WriteToElasticsearch} throws an exception if a null index is provided.
*/
@Test
public void testNullType() {
exceptionRule.expect(IllegalArgumentException.class);
ElasticsearchWriteOptions options = PipelineOptionsFactory.create().as(ElasticsearchWriteOptions.class);
options.setConnectionUrl("https://host.domain");
options.setApiKey("key");
pipeline.apply("CreateInput", Create.of("test")).apply(WriteToElasticsearch.newBuilder().setOptions(options).build());
pipeline.run();
}
use of com.google.cloud.teleport.v2.elasticsearch.options.ElasticsearchWriteOptions in project DataflowTemplates by GoogleCloudPlatform.
the class WriteToElasticsearchTest method testInvalidConnectionInformation.
/**
* Tests that {@link WriteToElasticsearch} throws an exception if an invalid ConnectionInformation
* is provided.
*/
@Test
public void testInvalidConnectionInformation() {
exceptionRule.expect(IllegalStateException.class);
ElasticsearchWriteOptions options = PipelineOptionsFactory.create().as(ElasticsearchWriteOptions.class);
options.setConnectionUrl(",");
options.setIndex("index");
options.setApiKey("key");
pipeline.apply("CreateInput", Create.of("test")).apply("TestWriteToElasticsearch", WriteToElasticsearch.newBuilder().setOptions(options).build());
pipeline.run();
}
use of com.google.cloud.teleport.v2.elasticsearch.options.ElasticsearchWriteOptions in project DataflowTemplates by GoogleCloudPlatform.
the class WriteToElasticsearchTest method testElasticsearchWriteOptionsRetryConfigMaxDuration.
/**
* Tests that {@link WriteToElasticsearch} throws an exception if {@link
* org.apache.beam.sdk.io.elasticsearch.ElasticsearchIO.RetryConfiguration} are invalid.
*/
@Test
public void testElasticsearchWriteOptionsRetryConfigMaxDuration() {
exceptionRule.expect(IllegalArgumentException.class);
ElasticsearchWriteOptions options = PipelineOptionsFactory.create().as(ElasticsearchWriteOptions.class);
options.setConnectionUrl("https://host.domain");
options.setApiKey("key");
options.setMaxRetryDuration(null);
options.setMaxRetryAttempts(3);
pipeline.apply("CreateInput", Create.of("test")).apply("TestWriteToElasticsearchBadMaxDuration", WriteToElasticsearch.newBuilder().setOptions(options).build());
pipeline.run();
}
Aggregations