Repository: incubator-beam Updated Branches: refs/heads/master 2571cfcf5 -> db47c63ab
Add StreamingIT category to integration test Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/fbae96f2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/fbae96f2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/fbae96f2 Branch: refs/heads/master Commit: fbae96f208afe3dca3ef620c4a312345a6314e13 Parents: 9f0588a Author: Mark Liu <mark...@markliu-macbookpro.roam.corp.google.com> Authored: Thu Sep 8 10:52:36 2016 -0700 Committer: Luke Cwik <lc...@google.com> Committed: Tue Sep 27 17:03:56 2016 -0700 ---------------------------------------------------------------------- examples/java/pom.xml | 31 ++++++++++++++++++++ .../beam/examples/WindowedWordCountIT.java | 18 ++++++++++-- .../apache/beam/sdk/testing/StreamingIT.java | 24 +++++++++++++++ 3 files changed, 71 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/fbae96f2/examples/java/pom.xml ---------------------------------------------------------------------- diff --git a/examples/java/pom.xml b/examples/java/pom.xml index 9a48ec6..31244db 100644 --- a/examples/java/pom.xml +++ b/examples/java/pom.xml @@ -216,6 +216,37 @@ </plugins> </build> </profile> + + <!-- + This profile disable streaming integration tests which + have @Category(StreamingIT.class) annotation. + + This profile can be abled on the command line + by specifying -P disable-streaming-ITs. + --> + <profile> + <id>disable-streaming-ITs</id> + <activation><activeByDefault>false</activeByDefault></activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + <configuration> + <excludedGroups>org.apache.beam.sdk.testing.StreamingIT</excludedGroups> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> </profiles> <build> http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/fbae96f2/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 890ca2b..cddcd4a 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 @@ -21,9 +21,12 @@ package org.apache.beam.examples; import java.io.IOException; import org.apache.beam.examples.WindowedWordCount.Options; import org.apache.beam.sdk.options.PipelineOptionsFactory; +import org.apache.beam.sdk.options.StreamingOptions; +import org.apache.beam.sdk.testing.StreamingIT; import org.apache.beam.sdk.testing.TestPipeline; import org.apache.beam.sdk.testing.TestPipelineOptions; import org.junit.Test; +import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -36,13 +39,24 @@ public class WindowedWordCountIT { /** * Options for the {@link WindowedWordCount} Integration Test. */ - public interface TestOptions extends Options, TestPipelineOptions { + public interface TestOptions extends Options, TestPipelineOptions, StreamingOptions{ } @Test - public void testWindowedWordCount() throws IOException { + public void testWindowedWordCountInBatch() throws IOException { + testWindowedWordCountPipeline(false); + } + + @Test + @Category(StreamingIT.class) + public void testWindowedWordCountInStreaming() throws IOException { + testWindowedWordCountPipeline(true); + } + + private void testWindowedWordCountPipeline(boolean isStreaming) throws IOException { PipelineOptionsFactory.register(TestOptions.class); TestOptions options = TestPipeline.testingPipelineOptions().as(TestOptions.class); + options.setStreaming(isStreaming); WindowedWordCount.main(TestPipeline.convertToArgs(options)); } http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/fbae96f2/sdks/java/core/src/main/java/org/apache/beam/sdk/testing/StreamingIT.java ---------------------------------------------------------------------- diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/testing/StreamingIT.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/testing/StreamingIT.java new file mode 100644 index 0000000..b3dd4a0 --- /dev/null +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/testing/StreamingIT.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.beam.sdk.testing; + +/** + * Category tag for validation tests which are expected running in streaming mode. + */ +public interface StreamingIT { +}