streams-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfrank...@apache.org
Subject [1/3] git commit: STREAMS-178 | Modified the behavior of the LinkResolverProcessor's unwind method. Duplicate unwound links are now consolidated into a unique set of links
Date Thu, 25 Sep 2014 14:51:19 GMT
Repository: incubator-streams
Updated Branches:
  refs/heads/master 12923758a -> 5f47348c0


STREAMS-178 | Modified the behavior of the LinkResolverProcessor's unwind method. Duplicate
unwound links are now consolidated into a unique set of links


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

Branch: refs/heads/master
Commit: f76f2de5923e63405229e2c83acc12156fe0c8de
Parents: dc5e7de
Author: Robert Douglas <rdouglas@w2odigital.com>
Authored: Thu Sep 18 10:46:23 2014 -0500
Committer: Robert Douglas <rdouglas@w2odigital.com>
Committed: Thu Sep 18 10:46:23 2014 -0500

----------------------------------------------------------------------
 .../java/org/apache/streams/urls/LinkResolverProcessor.java  | 8 ++++----
 .../org/apache/streams/urls/TestLinkUnwinderProcessor.java   | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/f76f2de5/streams-contrib/streams-processor-urls/src/main/java/org/apache/streams/urls/LinkResolverProcessor.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-processor-urls/src/main/java/org/apache/streams/urls/LinkResolverProcessor.java
b/streams-contrib/streams-processor-urls/src/main/java/org/apache/streams/urls/LinkResolverProcessor.java
index 8268c27..0b4cd7c 100644
--- a/streams-contrib/streams-processor-urls/src/main/java/org/apache/streams/urls/LinkResolverProcessor.java
+++ b/streams-contrib/streams-processor-urls/src/main/java/org/apache/streams/urls/LinkResolverProcessor.java
@@ -48,7 +48,7 @@ public class LinkResolverProcessor implements StreamsProcessor {
         if (entry.getDocument() instanceof Activity) {
             activity = (Activity) entry.getDocument();
 
-            activity.setLinks(unwind(activity.getLinks()));
+            activity.setLinks(Lists.newArrayList(unwind(activity.getLinks())));
 
             entry.setDocument(activity);
 
@@ -65,7 +65,7 @@ public class LinkResolverProcessor implements StreamsProcessor {
                 return (Lists.newArrayList(entry));
             }
 
-            activity.setLinks(unwind(activity.getLinks()));
+            activity.setLinks(Lists.newArrayList(unwind(activity.getLinks())));
 
             try {
                 entry.setDocument(mapper.writeValueAsString(activity));
@@ -96,8 +96,8 @@ public class LinkResolverProcessor implements StreamsProcessor {
     }
 
 
-    protected List<String> unwind(List<String> inputLinks) {
-        List<String> outputLinks = Lists.newArrayList();
+    protected Set<String> unwind(List<String> inputLinks) {
+        Set<String> outputLinks = new HashSet<String>();
         for (String link : inputLinks) {
             try {
                 LinkResolver unwinder = new LinkResolver(link);

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/f76f2de5/streams-contrib/streams-processor-urls/src/test/java/org/apache/streams/urls/TestLinkUnwinderProcessor.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-processor-urls/src/test/java/org/apache/streams/urls/TestLinkUnwinderProcessor.java
b/streams-contrib/streams-processor-urls/src/test/java/org/apache/streams/urls/TestLinkUnwinderProcessor.java
index ded640f..281f320 100644
--- a/streams-contrib/streams-processor-urls/src/test/java/org/apache/streams/urls/TestLinkUnwinderProcessor.java
+++ b/streams-contrib/streams-processor-urls/src/test/java/org/apache/streams/urls/TestLinkUnwinderProcessor.java
@@ -76,8 +76,8 @@ public class TestLinkUnwinderProcessor {
 
     @Test
     public void testActivityLinkUnwinderProcessorMulti() throws Exception{
-        testActivityUnwinderHelper(Lists.newArrayList("http://x.co/3yapt", "http://ow.ly/u4Kte",
"http://goo.gl/wSrHDA"), Lists.newArrayList("http://www.wcgworld.com/", "http://www.wcgworld.com/",
"http://www.wcgworld.com/"));
-        testStringActivityUnwinderHelper(Lists.newArrayList("http://x.co/3yapt", "http://ow.ly/u4Kte",
"http://goo.gl/wSrHDA"), Lists.newArrayList("http://www.wcgworld.com/", "http://www.wcgworld.com/",
"http://www.wcgworld.com/"));
+        testActivityUnwinderHelper(Lists.newArrayList("http://x.co/3yapt", "http://ow.ly/u4Kte",
"http://goo.gl/wSrHDA"), Lists.newArrayList("http://www.wcgworld.com/"));//, "http://www.wcgworld.com/",
"http://www.wcgworld.com/"));
+        testStringActivityUnwinderHelper(Lists.newArrayList("http://x.co/3yapt", "http://ow.ly/u4Kte",
"http://goo.gl/wSrHDA"), Lists.newArrayList("http://www.wcgworld.com/"));//, "http://www.wcgworld.com/",
"http://www.wcgworld.com/"));
     }
 
     @Test


Mime
View raw message