You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by tg...@apache.org on 2017/03/22 16:42:50 UTC

[1/2] beam git commit: This closes #2120

Repository: beam
Updated Branches:
  refs/heads/master e1dc7a861 -> 2d9bf2747


This closes #2120


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

Branch: refs/heads/master
Commit: 2d9bf2747527b20a15f48c8ca8f4cd8fc7791e55
Parents: e1dc7a8 f1badfd
Author: Thomas Groh <tg...@google.com>
Authored: Wed Mar 22 09:42:23 2017 -0700
Committer: Thomas Groh <tg...@google.com>
Committed: Wed Mar 22 09:42:23 2017 -0700

----------------------------------------------------------------------
 .../org/apache/beam/sdk/transforms/FlattenTest.java  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------



[2/2] beam git commit: Add a test for FlattenPCollectionList on a singleton list

Posted by tg...@apache.org.
Add a test for FlattenPCollectionList on a singleton list

This test validates that the output PCollection of a Flatten with a
single input PCollection contains the contents of the input PCollection.


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

Branch: refs/heads/master
Commit: f1badfd1b939d09a990f0564e62315c91d3da6b8
Parents: e1dc7a8
Author: Thomas Groh <tg...@google.com>
Authored: Mon Feb 27 16:16:49 2017 -0800
Committer: Thomas Groh <tg...@google.com>
Committed: Wed Mar 22 09:42:23 2017 -0700

----------------------------------------------------------------------
 .../org/apache/beam/sdk/transforms/FlattenTest.java  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/f1badfd1/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/FlattenTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/FlattenTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/FlattenTest.java
index bc3e322..5800738 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/FlattenTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/FlattenTest.java
@@ -22,6 +22,9 @@ import static org.apache.beam.sdk.TestUtils.LINES2;
 import static org.apache.beam.sdk.TestUtils.LINES_ARRAY;
 import static org.apache.beam.sdk.TestUtils.NO_LINES;
 import static org.apache.beam.sdk.TestUtils.NO_LINES_ARRAY;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.not;
+import static org.junit.Assert.assertThat;
 
 import com.google.common.collect.ImmutableSet;
 import java.io.Serializable;
@@ -95,6 +98,18 @@ public class FlattenTest implements Serializable {
 
   @Test
   @Category(RunnableOnService.class)
+  public void testFlattenPCollectionsSingletonList() {
+    PCollection<String> input = p.apply(Create.of(LINES));
+    PCollection<String> output = PCollectionList.of(input).apply(Flatten.<String>pCollections());
+
+    assertThat(output, not(equalTo(input)));
+
+    PAssert.that(output).containsInAnyOrder(LINES);
+    p.run();
+  }
+
+  @Test
+  @Category(RunnableOnService.class)
   public void testFlattenPCollectionsThenParDo() {
     List<List<String>> inputs = Arrays.asList(
       LINES, NO_LINES, LINES2, NO_LINES, LINES, NO_LINES);