From 1eccd29b72aedc87e69763fbcc828b5694335e1f Mon Sep 17 00:00:00 2001 From: Mark Liu Date: Thu, 3 Nov 2016 16:45:43 -0700 Subject: [PATCH] Remove @Default from IT options --- .../beam/examples/WindowedWordCountIT.java | 11 ++++++++--- .../org/apache/beam/examples/WordCountIT.java | 19 +++++++++++-------- .../cookbook/BigQueryTornadoesIT.java | 11 ++++++++--- 3 files changed, 27 insertions(+), 14 deletions(-) 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 67426545f728..d545ad20d484 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 @@ @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 @@ private void testWindowedWordCountPipeline(boolean isStreaming) throws IOExcepti 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)); } 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 2f2ea46ddea2..8f170af48fd0 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 @@ @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 void testE2EWordCount() throws Exception { String.format("WordCountIT-%tF-%