[ 
https://issues.apache.org/jira/browse/BEAM-2546?focusedWorklogId=391148&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-391148
 ]

ASF GitHub Bot logged work on BEAM-2546:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 22/Feb/20 15:07
            Start Date: 22/Feb/20 15:07
    Worklog Time Spent: 10m 
      Work Description: iemejia commented on pull request #10604: BEAM-2546 
Beam IO for InfluxDB
URL: https://github.com/apache/beam/pull/10604#discussion_r382916915
 
 

 ##########
 File path: 
sdks/java/io/influxdb/src/test/java/org/apache/beam/sdk/io/influxdb/InfluxDBIOIT.java
 ##########
 @@ -0,0 +1,190 @@
+package org.apache.beam.sdk.io.influxdb;
+
+import org.apache.beam.sdk.PipelineResult;
+
+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.PAssert;
+import org.apache.beam.sdk.testing.TestPipeline;
+import org.apache.beam.sdk.transforms.*;
+import org.apache.beam.sdk.values.PCollection;
+import org.influxdb.InfluxDB;
+import org.influxdb.InfluxDBFactory;
+import org.influxdb.dto.Query;
+import org.junit.*;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.util.Arrays;
+
+
+/**
+ * A test of {@link org.apache.beam.sdk.io.influxdb.InfluxDBIO} on an 
independent InfluxDB instance.
+ *
+ * <p>This test requires a running instance of InfluxDB. Pass in connection 
information using
+ * PipelineOptions:
+ *
+ * <pre>
+ *  ./gradlew integrationTest -p sdks/java/io/influxdb 
-DintegrationTestPipelineOptions='[
+ *  "--influxdburl=http://localhost:8086";,
+ *  "--infuxDBDatabase=mypass",
+ *  "--username=username"
+ *  "--password=password"]'
+ *  --tests org.apache.beam.sdk.io.influxdb.InfluxDBIOIT
+ *  -DintegrationTestRunner=direct
+ * </pre>
+ *
+ */
+
+
+@RunWith(JUnit4.class)
+public class InfluxDBIOIT {
+
+    private static InfluxDBPipelineOptions options;
+
+    @Rule
+    public final TestPipeline writePipeline = TestPipeline.create();
+    @Rule
+    public final TestPipeline readPipeline = TestPipeline.create();
+
+    /**
+     * InfluxDBIO options.
+     */
+    public interface InfluxDBPipelineOptions extends IOTestPipelineOptions {
+        @Description("InfluxDB host (host name/ip address)")
+        @Default.String("http://localhost:8086";)
+        String getInfluxDBURL();
+        void setInfluxDBURL(String value);
+
+        @Description("Username for InfluxDB")
+        @Default.String("superadmin")
+        String getInfluxDBUserName();
+        void setInfluxDBUserName(String value);
+
+        @Description("Password for InfluxDB")
+        @Default.String("supersecretpassword")
+        String getInfluxDBPassword();
+        void setInfluxDBPassword(String value);
+
+        @Description("InfluxDB database name")
+        @Default.String("db0")
+        String getDatabaseName();
+        void setDatabaseName(String value);
+
+    }
+    @BeforeClass
+    public static void setUp() {
+        PipelineOptionsFactory.register(InfluxDBPipelineOptions.class);
+        options = 
TestPipeline.testingPipelineOptions().as(InfluxDBPipelineOptions.class);
+    }
+
+    @After
+    public  void clear(){
+        try (InfluxDB connection = 
InfluxDBFactory.connect(options.getInfluxDBURL(),
+                options.getInfluxDBUserName(), options.getInfluxDBPassword())){
+            connection.query(new Query("DROP DATABASE \"" + 
options.getDatabaseName() + "\""));
+        }
+        }
+    @Before
+    public  void initTest(){
+        try (InfluxDB connection = 
InfluxDBFactory.connect(options.getInfluxDBURL(),
+                options.getInfluxDBUserName(), options.getInfluxDBPassword())){
+            connection.query(new Query("CREATE DATABASE \"" + 
options.getDatabaseName() + "\""));
+        }
+    }
+    @Test
+    public void testWriteAndRead() {
 
 Review comment:
   testWriteAndReadWithQuery
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 391148)
    Time Spent: 5h  (was: 4h 50m)

> Create InfluxDbIO
> -----------------
>
>                 Key: BEAM-2546
>                 URL: https://issues.apache.org/jira/browse/BEAM-2546
>             Project: Beam
>          Issue Type: New Feature
>          Components: io-ideas
>            Reporter: Jean-Baptiste Onofré
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>          Time Spent: 5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to