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

[1/2] beam git commit: Add prefix and suffix to WindowedWordCountIT output location

Repository: beam
Updated Branches:
  refs/heads/master 963772414 -> 2cbc08b58


Add prefix and suffix to WindowedWordCountIT output location


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

Branch: refs/heads/master
Commit: 4d0225e8e29047dc7b4e0f5cea2414eaef4b038c
Parents: 9637724
Author: Kenneth Knowles <kl...@google.com>
Authored: Thu Jan 26 13:42:58 2017 -0800
Committer: Kenneth Knowles <kl...@google.com>
Committed: Thu Jan 26 13:47:08 2017 -0800

----------------------------------------------------------------------
 .../apache/beam/examples/WindowedWordCountIT.java   | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/4d0225e8/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 e4570ac..703f836 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
@@ -28,6 +28,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.SortedMap;
 import java.util.TreeMap;
+import java.util.concurrent.ThreadLocalRandom;
 import org.apache.beam.examples.common.WriteWindowedFilesDoFn;
 import org.apache.beam.sdk.PipelineResult;
 import org.apache.beam.sdk.options.PipelineOptionsFactory;
@@ -47,8 +48,10 @@ import org.hamcrest.TypeSafeMatcher;
 import org.joda.time.Duration;
 import org.joda.time.Instant;
 import org.junit.BeforeClass;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 import org.slf4j.Logger;
@@ -58,6 +61,8 @@ import org.slf4j.LoggerFactory;
 @RunWith(JUnit4.class)
 public class WindowedWordCountIT {
 
+  @Rule public TestName testName = new TestName();
+
   private static final String DEFAULT_INPUT =
       "gs://apache-beam-samples/shakespeare/winterstale-personae";
   static final int MAX_READ_RETRIES = 4;
@@ -100,7 +105,9 @@ public class WindowedWordCountIT {
     options.setOutput(
         IOChannelUtils.resolve(
             options.getTempRoot(),
-            String.format("WindowedWordCountIT-%tF-%<tH-%<tM-%<tS-%<tL", new Date()),
+            String.format(
+                "WindowedWordCountIT.%s-%tFT%<tH:%<tM:%<tS.%<tL+%s",
+                testName.getMethodName(), new Date(), ThreadLocalRandom.current().nextInt()),
             "output",
             "results"));
     return options;
@@ -133,8 +140,7 @@ public class WindowedWordCountIT {
               new IntervalWindow(windowStart, windowStart.plus(Duration.standardMinutes(10)))));
     }
 
-    ShardedFile inputFile =
-        new ExplicitShardedFile(Collections.singleton(options.getInputFile()));
+    ShardedFile inputFile = new ExplicitShardedFile(Collections.singleton(options.getInputFile()));
 
     // For this integration test, input is tiny and we can build the expected counts
     SortedMap<String, Long> expectedWordCounts = new TreeMap<>();
@@ -144,8 +150,8 @@ public class WindowedWordCountIT {
 
       for (String word : words) {
         if (!word.isEmpty()) {
-          expectedWordCounts.put(word,
-              MoreObjects.firstNonNull(expectedWordCounts.get(word), 0L) + 1L);
+          expectedWordCounts.put(
+              word, MoreObjects.firstNonNull(expectedWordCounts.get(word), 0L) + 1L);
         }
       }
     }


[2/2] beam git commit: This closes #1856

Posted by dh...@apache.org.
This closes #1856


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

Branch: refs/heads/master
Commit: 2cbc08b5870036c52a94bb1f1f1d081d387e4ae0
Parents: 9637724 4d0225e
Author: Dan Halperin <dh...@google.com>
Authored: Thu Jan 26 14:42:04 2017 -0800
Committer: Dan Halperin <dh...@google.com>
Committed: Thu Jan 26 14:42:04 2017 -0800

----------------------------------------------------------------------
 .../apache/beam/examples/WindowedWordCountIT.java   | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------