Repository: incubator-edgent Updated Branches: refs/heads/master 90d367102 -> 08944e5f0
[Edgent-422] desensitize FileStreamsTextFileWriterTest Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/d4236e8a Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/d4236e8a Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/d4236e8a Branch: refs/heads/master Commit: d4236e8a23e0e9f27f9f8800d697650c38157755 Parents: a70230b Author: Dale LaBossiere <dlab...@us.ibm.com> Authored: Thu Jun 15 16:18:29 2017 -0400 Committer: Dale LaBossiere <dlab...@us.ibm.com> Committed: Thu Jun 15 16:18:29 2017 -0400 ---------------------------------------------------------------------- .../file/FileStreamsTextFileWriterTest.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/d4236e8a/connectors/file/src/test/java/org/apache/edgent/test/connectors/file/FileStreamsTextFileWriterTest.java ---------------------------------------------------------------------- diff --git a/connectors/file/src/test/java/org/apache/edgent/test/connectors/file/FileStreamsTextFileWriterTest.java b/connectors/file/src/test/java/org/apache/edgent/test/connectors/file/FileStreamsTextFileWriterTest.java index 6b40aac..b4d3e25 100644 --- a/connectors/file/src/test/java/org/apache/edgent/test/connectors/file/FileStreamsTextFileWriterTest.java +++ b/connectors/file/src/test/java/org/apache/edgent/test/connectors/file/FileStreamsTextFileWriterTest.java @@ -41,6 +41,7 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.Date; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -735,10 +736,12 @@ public class FileStreamsTextFileWriterTest extends TopologyAbstractTest implemen System.out.println("########## "+t.getName()); // Write the files - // add delay so watcher starts first + // add delay so watcher starts first and gets to "see" file additions int throttleSec = 2; - TStream<String> contents = PlumbingStreams.blockingThrottle( - t.strings(lines), throttleSec, TimeUnit.SECONDS); + TStream<String> contents = PlumbingStreams.blockingOneShotDelay( + t.strings(lines), 2, TimeUnit.SECONDS); + contents = PlumbingStreams.blockingThrottle( + contents, throttleSec, TimeUnit.SECONDS); IFileWriterPolicy<String> policy = new FileWriterPolicy<String>( FileWriterFlushConfig.newImplicitConfig(), @@ -749,16 +752,16 @@ public class FileStreamsTextFileWriterTest extends TopologyAbstractTest implemen // Watch and read contents TStream<String> pathnames = FileStreams.directoryWatcher(t, - () -> dir.toAbsolutePath().toString()); - pathnames.sink(tuple -> System.out.println("watcher added "+tuple)); - pathnames.peek(tuple -> { if (new File(tuple).getName().startsWith(".")) + () -> dir.toAbsolutePath().toString()) + .peek(tuple -> System.out.println(new Date() + " watcher added "+tuple)) + .peek(tuple -> { if (new File(tuple).getName().startsWith(".")) throw new RuntimeException("Not filtering active/hidden files "+tuple); }); TStream<String> readContents = FileStreams.textFileReader(pathnames); boolean dump = true; try { completeAndValidate("", t, readContents, - (lines.length*throttleSec)+TMO_SEC, lines); + (lines.length*throttleSec)+TMO_SEC+3/*on-the-edge*/, lines); dump = false; } finally {