Repository: incubator-beam
Updated Branches:
  refs/heads/master 99062d103 -> 46fbfe06b


Remove @Default from IT options


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

Branch: refs/heads/master
Commit: 1eccd29b72aedc87e69763fbcc828b5694335e1f
Parents: 99062d1
Author: Mark Liu <mark...@markliu0.mtv.corp.google.com>
Authored: Thu Nov 3 16:45:43 2016 -0700
Committer: Luke Cwik <lc...@google.com>
Committed: Fri Nov 4 14:19:43 2016 -0700

----------------------------------------------------------------------
 .../beam/examples/WindowedWordCountIT.java       | 11 ++++++++---
 .../org/apache/beam/examples/WordCountIT.java    | 19 +++++++++++--------
 .../examples/cookbook/BigQueryTornadoesIT.java   | 11 ++++++++---
 3 files changed, 27 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/1eccd29b/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 6742654..d545ad2 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,9 +17,9 @@
  */
 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.Default;
 import org.apache.beam.sdk.options.PipelineOptionsFactory;
 import org.apache.beam.sdk.options.StreamingOptions;
 import org.apache.beam.sdk.testing.BigqueryMatcher;
@@ -37,12 +37,13 @@ import org.junit.runners.JUnit4;
 @RunWith(JUnit4.class)
 public class WindowedWordCountIT {
 
+  private static final String DEFAULT_OUTPUT_CHECKSUM = 
"ff54f6f42b2afeb146206c1e8e915deaee0362b4";
+
   /**
    * Options for the {@link WindowedWordCount} Integration Test.
    */
   public interface WindowedWordCountITOptions
       extends Options, TestPipelineOptions, StreamingOptions {
-    @Default.String("ff54f6f42b2afeb146206c1e8e915deaee0362b4")
     String getChecksum();
     void setChecksum(String value);
   }
@@ -66,9 +67,13 @@ public class WindowedWordCountIT {
 
     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, 
options.getChecksum()));
+            options.getAppName(), options.getProject(), query, 
outputChecksum));
 
     WindowedWordCount.main(TestPipeline.convertToArgs(options));
   }

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/1eccd29b/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 2f2ea46..8f170af 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,9 +18,9 @@
 
 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.Default;
 import org.apache.beam.sdk.options.PipelineOptionsFactory;
 import org.apache.beam.sdk.testing.FileChecksumMatcher;
 import org.apache.beam.sdk.testing.TestPipeline;
@@ -36,6 +36,8 @@ import org.junit.runners.JUnit4;
 @RunWith(JUnit4.class)
 public class WordCountIT {
 
+  private static final String DEFAULT_OUTPUT_CHECKSUM = 
"8ae94f799f97cfd1cb5e8125951b32dfb52e1f12";
+
   /**
    * Options for the WordCount Integration Test.
    *
@@ -43,9 +45,8 @@ public class WordCountIT {
    * with customized input.
    */
   public interface WordCountITOptions extends TestPipelineOptions, 
WordCountOptions {
-    @Default.String("c04722202dee29c442b55ead54c6000693e85e77")
-    String getOutputChecksum();
-    void setOutputChecksum(String value);
+    String getChecksum();
+    void setChecksum(String value);
   }
 
   @Test
@@ -58,11 +59,13 @@ public class WordCountIT {
         String.format("WordCountIT-%tF-%<tH-%<tM-%<tS-%<tL", new Date()),
         "output",
         "results"));
-    options.setOnSuccessMatcher(
-        new FileChecksumMatcher(options.getOutputChecksum(), 
options.getOutput() + "*"));
 
-    String e2eTestInputPath = "gs://apache-beam-samples/apache/LICENSE";
-    options.setInputFile(e2eTestInputPath);
+    String outputChecksum =
+        Strings.isNullOrEmpty(options.getChecksum())
+            ? DEFAULT_OUTPUT_CHECKSUM
+            : options.getChecksum();
+    options.setOnSuccessMatcher(
+        new FileChecksumMatcher(outputChecksum, options.getOutput() + "*"));
 
     WordCount.main(TestPipeline.convertToArgs(options));
   }

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/1eccd29b/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 27a5a8f..209c713 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,8 +18,8 @@
 
 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.Default;
 import org.apache.beam.sdk.options.PipelineOptionsFactory;
 import org.apache.beam.sdk.testing.BigqueryMatcher;
 import org.apache.beam.sdk.testing.TestPipeline;
@@ -34,12 +34,13 @@ import org.junit.runners.JUnit4;
 @RunWith(JUnit4.class)
 public class BigQueryTornadoesIT {
 
+  private static final String DEFAULT_OUTPUT_CHECKSUM = 
"1ab4c7ec460b94bbb3c3885b178bf0e6bed56e1f";
+
   /**
    * Options for the BigQueryTornadoes Integration Test.
    */
   public interface BigQueryTornadoesITOptions
       extends TestPipelineOptions, BigQueryTornadoes.Options, BigQueryOptions {
-    @Default.String("1ab4c7ec460b94bbb3c3885b178bf0e6bed56e1f")
     String getChecksum();
     void setChecksum(String value);
   }
@@ -54,9 +55,13 @@ 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, 
options.getChecksum()));
+            options.getAppName(), options.getProject(), query, 
outputChecksum));
 
     BigQueryTornadoes.main(TestPipeline.convertToArgs(options));
   }

Reply via email to