beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lc...@apache.org
Subject [1/2] incubator-beam git commit: Fix IT Options Conflict
Date Mon, 07 Nov 2016 21:51:46 GMT
Repository: incubator-beam
Updated Branches:
  refs/heads/master 3e84a5f3c -> 912500f13


Fix IT Options Conflict


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/19279689
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/19279689
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/19279689

Branch: refs/heads/master
Commit: 1927968955dfe834b3e48482a606ffa7fc403749
Parents: 3e84a5f
Author: Mark Liu <markliu@markliu0.mtv.corp.google.com>
Authored: Mon Nov 7 11:27:15 2016 -0800
Committer: Luke Cwik <lcwik@google.com>
Committed: Mon Nov 7 13:45:43 2016 -0800

----------------------------------------------------------------------
 .../apache/beam/examples/WindowedWordCountIT.java  | 16 +++++++---------
 .../java/org/apache/beam/examples/WordCountIT.java | 17 +++++++----------
 .../examples/cookbook/BigQueryTornadoesIT.java     | 16 +++++++---------
 3 files changed, 21 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/19279689/examples/java/src/test/java/org/apache/beam/examples/WindowedWordCountIT.java
----------------------------------------------------------------------
diff --git a/examples/java/src/test/java/org/apache/beam/examples/WindowedWordCountIT.java
b/examples/java/src/test/java/org/apache/beam/examples/WindowedWordCountIT.java
index d545ad2..c78fad6 100644
--- a/examples/java/src/test/java/org/apache/beam/examples/WindowedWordCountIT.java
+++ b/examples/java/src/test/java/org/apache/beam/examples/WindowedWordCountIT.java
@@ -17,7 +17,6 @@
  */
 package org.apache.beam.examples;
 
-import com.google.common.base.Strings;
 import java.io.IOException;
 import org.apache.beam.examples.WindowedWordCount.Options;
 import org.apache.beam.sdk.options.PipelineOptionsFactory;
@@ -26,6 +25,7 @@ import org.apache.beam.sdk.testing.BigqueryMatcher;
 import org.apache.beam.sdk.testing.StreamingIT;
 import org.apache.beam.sdk.testing.TestPipeline;
 import org.apache.beam.sdk.testing.TestPipelineOptions;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
@@ -44,8 +44,11 @@ public class WindowedWordCountIT {
    */
   public interface WindowedWordCountITOptions
       extends Options, TestPipelineOptions, StreamingOptions {
-    String getChecksum();
-    void setChecksum(String value);
+  }
+
+  @BeforeClass
+  public static void setUp() {
+    PipelineOptionsFactory.register(TestPipelineOptions.class);
   }
 
   @Test
@@ -60,20 +63,15 @@ public class WindowedWordCountIT {
   }
 
   private void testWindowedWordCountPipeline(boolean isStreaming) throws IOException {
-    PipelineOptionsFactory.register(WindowedWordCountITOptions.class);
     WindowedWordCountITOptions options =
         TestPipeline.testingPipelineOptions().as(WindowedWordCountITOptions.class);
     options.setStreaming(isStreaming);
 
     String query = String.format("SELECT word, SUM(count) FROM [%s:%s.%s] GROUP BY word",
         options.getProject(), options.getBigQueryDataset(), options.getBigQueryTable());
-    String outputChecksum =
-        Strings.isNullOrEmpty(options.getChecksum())
-            ? DEFAULT_OUTPUT_CHECKSUM
-            : options.getChecksum();
     options.setOnSuccessMatcher(
         new BigqueryMatcher(
-            options.getAppName(), options.getProject(), query, outputChecksum));
+            options.getAppName(), options.getProject(), query, DEFAULT_OUTPUT_CHECKSUM));
 
     WindowedWordCount.main(TestPipeline.convertToArgs(options));
   }

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/19279689/examples/java/src/test/java/org/apache/beam/examples/WordCountIT.java
----------------------------------------------------------------------
diff --git a/examples/java/src/test/java/org/apache/beam/examples/WordCountIT.java b/examples/java/src/test/java/org/apache/beam/examples/WordCountIT.java
index 8f170af..487f04b 100644
--- a/examples/java/src/test/java/org/apache/beam/examples/WordCountIT.java
+++ b/examples/java/src/test/java/org/apache/beam/examples/WordCountIT.java
@@ -18,7 +18,6 @@
 
 package org.apache.beam.examples;
 
-import com.google.common.base.Strings;
 import java.util.Date;
 import org.apache.beam.examples.WordCount.WordCountOptions;
 import org.apache.beam.sdk.options.PipelineOptionsFactory;
@@ -26,6 +25,7 @@ import org.apache.beam.sdk.testing.FileChecksumMatcher;
 import org.apache.beam.sdk.testing.TestPipeline;
 import org.apache.beam.sdk.testing.TestPipelineOptions;
 import org.apache.beam.sdk.util.IOChannelUtils;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
@@ -45,13 +45,15 @@ public class WordCountIT {
    * with customized input.
    */
   public interface WordCountITOptions extends TestPipelineOptions, WordCountOptions {
-    String getChecksum();
-    void setChecksum(String value);
+  }
+
+  @BeforeClass
+  public static void setUp() {
+    PipelineOptionsFactory.register(TestPipelineOptions.class);
   }
 
   @Test
   public void testE2EWordCount() throws Exception {
-    PipelineOptionsFactory.register(WordCountITOptions.class);
     WordCountITOptions options = TestPipeline.testingPipelineOptions().as(WordCountITOptions.class);
 
     options.setOutput(IOChannelUtils.resolve(
@@ -59,13 +61,8 @@ public class WordCountIT {
         String.format("WordCountIT-%tF-%<tH-%<tM-%<tS-%<tL", new Date()),
         "output",
         "results"));
-
-    String outputChecksum =
-        Strings.isNullOrEmpty(options.getChecksum())
-            ? DEFAULT_OUTPUT_CHECKSUM
-            : options.getChecksum();
     options.setOnSuccessMatcher(
-        new FileChecksumMatcher(outputChecksum, options.getOutput() + "*"));
+        new FileChecksumMatcher(DEFAULT_OUTPUT_CHECKSUM, options.getOutput() + "*"));
 
     WordCount.main(TestPipeline.convertToArgs(options));
   }

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/19279689/examples/java/src/test/java/org/apache/beam/examples/cookbook/BigQueryTornadoesIT.java
----------------------------------------------------------------------
diff --git a/examples/java/src/test/java/org/apache/beam/examples/cookbook/BigQueryTornadoesIT.java
b/examples/java/src/test/java/org/apache/beam/examples/cookbook/BigQueryTornadoesIT.java
index 209c713..15c261f 100644
--- a/examples/java/src/test/java/org/apache/beam/examples/cookbook/BigQueryTornadoesIT.java
+++ b/examples/java/src/test/java/org/apache/beam/examples/cookbook/BigQueryTornadoesIT.java
@@ -18,12 +18,12 @@
 
 package org.apache.beam.examples.cookbook;
 
-import com.google.common.base.Strings;
 import org.apache.beam.sdk.options.BigQueryOptions;
 import org.apache.beam.sdk.options.PipelineOptionsFactory;
 import org.apache.beam.sdk.testing.BigqueryMatcher;
 import org.apache.beam.sdk.testing.TestPipeline;
 import org.apache.beam.sdk.testing.TestPipelineOptions;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
@@ -41,13 +41,15 @@ public class BigQueryTornadoesIT {
    */
   public interface BigQueryTornadoesITOptions
       extends TestPipelineOptions, BigQueryTornadoes.Options, BigQueryOptions {
-    String getChecksum();
-    void setChecksum(String value);
+  }
+
+  @BeforeClass
+  public static void setUp() {
+    PipelineOptionsFactory.register(TestPipelineOptions.class);
   }
 
   @Test
   public void testE2EBigQueryTornadoes() throws Exception {
-    PipelineOptionsFactory.register(BigQueryTornadoesITOptions.class);
     BigQueryTornadoesITOptions options =
         TestPipeline.testingPipelineOptions().as(BigQueryTornadoesITOptions.class);
     options.setOutput(String.format("%s.%s",
@@ -55,13 +57,9 @@ public class BigQueryTornadoesIT {
 
     String query =
         String.format("SELECT month, tornado_count FROM [%s]", options.getOutput());
-    String outputChecksum =
-        Strings.isNullOrEmpty(options.getChecksum())
-            ? DEFAULT_OUTPUT_CHECKSUM
-            : options.getChecksum();
     options.setOnSuccessMatcher(
         new BigqueryMatcher(
-            options.getAppName(), options.getProject(), query, outputChecksum));
+            options.getAppName(), options.getProject(), query, DEFAULT_OUTPUT_CHECKSUM));
 
     BigQueryTornadoes.main(TestPipeline.convertToArgs(options));
   }


Mime
View raw message