[
https://issues.apache.org/jira/browse/BEAM-4137?focusedWorklogId=118993&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-118993
]
ASF GitHub Bot logged work on BEAM-4137:
----------------------------------------
Author: ASF GitHub Bot
Created on: 04/Jul/18 08:55
Start Date: 04/Jul/18 08:55
Worklog Time Spent: 10m
Work Description: echauchot closed pull request #5876: [BEAM-4137] Divide
elasticsearch pipeline options
URL: https://github.com/apache/beam/pull/5876
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/sdks/java/io/common/src/test/java/org/apache/beam/sdk/io/common/IOTestPipelineOptions.java
b/sdks/java/io/common/src/test/java/org/apache/beam/sdk/io/common/IOTestPipelineOptions.java
index 132e3cc9094..b3733aee34c 100644
---
a/sdks/java/io/common/src/test/java/org/apache/beam/sdk/io/common/IOTestPipelineOptions.java
+++
b/sdks/java/io/common/src/test/java/org/apache/beam/sdk/io/common/IOTestPipelineOptions.java
@@ -21,31 +21,8 @@
import org.apache.beam.sdk.options.Description;
import org.apache.beam.sdk.testing.TestPipelineOptions;
-/**
- * This shared set of options is used so that the full suite of IO tests can
be run in one pass - if
- * a test tries to read TestPipelineOptions, it must be able to understand all
the options that were
- * passed on the command line.
- */
+/** Pipeline options common for IO integration tests. */
public interface IOTestPipelineOptions extends TestPipelineOptions {
- /* Elasticsearch */
- @Description("Server name for Elasticsearch server (host name/ip address)")
- @Default.String("elasticsearch-server-name")
- String getElasticsearchServer();
-
- void setElasticsearchServer(String value);
-
- @Description("Http port for elasticsearch server")
- @Default.Integer(9200)
- Integer getElasticsearchHttpPort();
-
- void setElasticsearchHttpPort(Integer value);
-
- /* Solr */
- @Description("Address of Zookeeper server for Solr")
- @Default.String("zookeeper-server")
- String getSolrZookeeperServer();
-
- void setSolrZookeeperServer(String value);
/* Used by most IOIT */
@Description("Number records that will be written and read by the test")
diff --git
a/sdks/java/io/elasticsearch-tests/elasticsearch-tests-2/src/test/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOIT.java
b/sdks/java/io/elasticsearch-tests/elasticsearch-tests-2/src/test/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOIT.java
index 0bcf228eec4..258121874d3 100644
---
a/sdks/java/io/elasticsearch-tests/elasticsearch-tests-2/src/test/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOIT.java
+++
b/sdks/java/io/elasticsearch-tests/elasticsearch-tests-2/src/test/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOIT.java
@@ -25,7 +25,7 @@
import java.util.List;
import org.apache.beam.sdk.io.BoundedSource;
-import org.apache.beam.sdk.io.common.IOTestPipelineOptions;
+import
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOITCommon.ElasticsearchPipelineOptions;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.apache.beam.sdk.testing.SourceTestUtils;
import org.apache.beam.sdk.testing.TestPipeline;
@@ -58,7 +58,7 @@
*/
public class ElasticsearchIOIT {
private static RestClient restClient;
- private static IOTestPipelineOptions options;
+ private static ElasticsearchPipelineOptions options;
private static ConnectionConfiguration readConnectionConfiguration;
private static ConnectionConfiguration writeConnectionConfiguration;
private static ConnectionConfiguration updateConnectionConfiguration;
@@ -68,8 +68,8 @@
@BeforeClass
public static void beforeClass() throws Exception {
- PipelineOptionsFactory.register(IOTestPipelineOptions.class);
- options =
TestPipeline.testingPipelineOptions().as(IOTestPipelineOptions.class);
+ PipelineOptionsFactory.register(ElasticsearchPipelineOptions.class);
+ options =
TestPipeline.testingPipelineOptions().as(ElasticsearchPipelineOptions.class);
readConnectionConfiguration =
ElasticsearchIOITCommon.getConnectionConfiguration(
options, ElasticsearchIOITCommon.IndexMode.READ);
diff --git
a/sdks/java/io/elasticsearch-tests/elasticsearch-tests-5/src/test/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOIT.java
b/sdks/java/io/elasticsearch-tests/elasticsearch-tests-5/src/test/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOIT.java
index c8bfa5658cb..b38b1696141 100644
---
a/sdks/java/io/elasticsearch-tests/elasticsearch-tests-5/src/test/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOIT.java
+++
b/sdks/java/io/elasticsearch-tests/elasticsearch-tests-5/src/test/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOIT.java
@@ -25,7 +25,7 @@
import java.util.List;
import org.apache.beam.sdk.io.BoundedSource;
-import org.apache.beam.sdk.io.common.IOTestPipelineOptions;
+import
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOITCommon.ElasticsearchPipelineOptions;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.apache.beam.sdk.testing.SourceTestUtils;
import org.apache.beam.sdk.testing.TestPipeline;
@@ -58,7 +58,7 @@
*/
public class ElasticsearchIOIT {
private static RestClient restClient;
- private static IOTestPipelineOptions options;
+ private static ElasticsearchPipelineOptions options;
private static ConnectionConfiguration readConnectionConfiguration;
private static ConnectionConfiguration writeConnectionConfiguration;
private static ConnectionConfiguration updateConnectionConfiguration;
@@ -68,8 +68,8 @@
@BeforeClass
public static void beforeClass() throws Exception {
- PipelineOptionsFactory.register(IOTestPipelineOptions.class);
- options =
TestPipeline.testingPipelineOptions().as(IOTestPipelineOptions.class);
+ PipelineOptionsFactory.register(ElasticsearchPipelineOptions.class);
+ options =
TestPipeline.testingPipelineOptions().as(ElasticsearchPipelineOptions.class);
readConnectionConfiguration =
ElasticsearchIOITCommon.getConnectionConfiguration(
options, ElasticsearchIOITCommon.IndexMode.READ);
diff --git
a/sdks/java/io/elasticsearch-tests/elasticsearch-tests-common/src/test/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOITCommon.java
b/sdks/java/io/elasticsearch-tests/elasticsearch-tests-common/src/test/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOITCommon.java
index 9fe2d605aad..6598e975f35 100644
---
a/sdks/java/io/elasticsearch-tests/elasticsearch-tests-common/src/test/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOITCommon.java
+++
b/sdks/java/io/elasticsearch-tests/elasticsearch-tests-common/src/test/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIOITCommon.java
@@ -22,8 +22,10 @@
import static
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTestCommon.ES_TYPE;
import static
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTestCommon.NUM_DOCS_ITESTS;
-import org.apache.beam.sdk.io.common.IOTestPipelineOptions;
+import org.apache.beam.sdk.options.Default;
+import org.apache.beam.sdk.options.Description;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
+import org.apache.beam.sdk.testing.TestPipelineOptions;
import org.elasticsearch.client.RestClient;
/**
@@ -34,6 +36,22 @@
*/
public class ElasticsearchIOITCommon {
+ /** Pipeline options for elasticsearch tests. */
+ public interface ElasticsearchPipelineOptions extends TestPipelineOptions {
+
+ @Description("Server name for Elasticsearch server (host name/ip address)")
+ @Default.String("elasticsearch-server-name")
+ String getElasticsearchServer();
+
+ void setElasticsearchServer(String value);
+
+ @Description("Http port for elasticsearch server")
+ @Default.Integer(9200)
+ Integer getElasticsearchHttpPort();
+
+ void setElasticsearchHttpPort(Integer value);
+ }
+
/** Enum encapsulating the mode of operation and the index. */
enum IndexMode {
READ(ES_INDEX),
@@ -69,13 +87,14 @@ public String getIndex() {
* Elasticsearch as shown above.
*/
public static void main(String[] args) throws Exception {
- PipelineOptionsFactory.register(IOTestPipelineOptions.class);
- IOTestPipelineOptions options =
- PipelineOptionsFactory.fromArgs(args).as(IOTestPipelineOptions.class);
+ PipelineOptionsFactory.register(ElasticsearchPipelineOptions.class);
+ ElasticsearchPipelineOptions options =
+
PipelineOptionsFactory.fromArgs(args).as(ElasticsearchPipelineOptions.class);
createAndPopulateReadIndex(options);
}
- private static void createAndPopulateReadIndex(IOTestPipelineOptions
options) throws Exception {
+ private static void createAndPopulateReadIndex(ElasticsearchPipelineOptions
options)
+ throws Exception {
// automatically creates the index and insert docs
ConnectionConfiguration connectionConfiguration =
getConnectionConfiguration(options, IndexMode.READ);
@@ -86,7 +105,7 @@ private static void
createAndPopulateReadIndex(IOTestPipelineOptions options) th
}
static ConnectionConfiguration getConnectionConfiguration(
- IOTestPipelineOptions options, IndexMode mode) {
+ ElasticsearchPipelineOptions options, IndexMode mode) {
return ConnectionConfiguration.create(
new String[] {
"http://" + options.getElasticsearchServer() + ":" +
options.getElasticsearchHttpPort()
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 118993)
Time Spent: 9h 50m (was: 9h 40m)
> Split IOTestPipelineOptions to multiple, test-specific files
> ------------------------------------------------------------
>
> Key: BEAM-4137
> URL: https://issues.apache.org/jira/browse/BEAM-4137
> Project: Beam
> Issue Type: Improvement
> Components: testing
> Reporter: Lukasz Gajowy
> Assignee: Lukasz Gajowy
> Priority: Minor
> Time Spent: 9h 50m
> Remaining Estimate: 0h
>
> Currently we have one big IOTestPipelineOptions interface that is used in
> many IOITs. It contains test specific options that should rather be located
> next to testing classes, not in a generic file. Let's split this.
> Additionally, besides separation of concerns, this will allow adding
> test-specific @Default and @Required annotations and validate the options
> better.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)