incubator-crunch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwi...@apache.org
Subject [1/7] git commit: Fix PageRankIT test to work with new tempDir construct
Date Sat, 28 Jul 2012 19:40:20 GMT
Updated Branches:
  refs/heads/master e540459ee -> 9d3bf4160


Fix PageRankIT test to work with new tempDir construct


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

Branch: refs/heads/master
Commit: 9d3bf41605b07d888ca07a29f3dd35c1fc96bb36
Parents: 47a9d1c
Author: jwills <jwills@apache.org>
Authored: Sat Jul 28 12:03:36 2012 -0700
Committer: jwills <jwills@apache.org>
Committed: Sat Jul 28 12:03:36 2012 -0700

----------------------------------------------------------------------
 .../src/it/java/org/apache/crunch/PageRankIT.java  |   21 ++++++++++-----
 1 files changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/9d3bf416/crunch/src/it/java/org/apache/crunch/PageRankIT.java
----------------------------------------------------------------------
diff --git a/crunch/src/it/java/org/apache/crunch/PageRankIT.java b/crunch/src/it/java/org/apache/crunch/PageRankIT.java
index e5fbfe6..761129a 100644
--- a/crunch/src/it/java/org/apache/crunch/PageRankIT.java
+++ b/crunch/src/it/java/org/apache/crunch/PageRankIT.java
@@ -71,33 +71,40 @@ public class PageRankIT {
 
   @Rule
   public TemporaryPath tmpDir = TemporaryPaths.create();
-
+  
   @Test
   public void testAvroReflect() throws Exception {
     PTypeFamily tf = AvroTypeFamily.getInstance();
     PType<PageRankData> prType = Avros.reflects(PageRankData.class);
-    run(new MRPipeline(PageRankIT.class, tmpDir.getDefaultConfiguration()), prType, tf);
+    String urlInput = tmpDir.copyResourceFileName("urls.txt");
+    run(new MRPipeline(PageRankIT.class, tmpDir.getDefaultConfiguration()),
+        urlInput, prType, tf);
   }
 
   @Test
   public void testAvroMReflectInMemory() throws Exception {
     PTypeFamily tf = AvroTypeFamily.getInstance();
     PType<PageRankData> prType = Avros.reflects(PageRankData.class);
-    run(MemPipeline.getInstance(), prType, tf);
+    String urlInput = tmpDir.copyResourceFileName("urls.txt");
+    run(MemPipeline.getInstance(), urlInput, prType, tf);
   }
 
   @Test
   public void testAvroJSON() throws Exception {
     PTypeFamily tf = AvroTypeFamily.getInstance();
     PType<PageRankData> prType = PTypes.jsonString(PageRankData.class, tf);
-    run(new MRPipeline(PageRankIT.class, tmpDir.getDefaultConfiguration()), prType, tf);
+    String urlInput = tmpDir.copyResourceFileName("urls.txt");
+    run(new MRPipeline(PageRankIT.class, tmpDir.getDefaultConfiguration()),
+        urlInput, prType, tf);
   }
 
   @Test
   public void testWritablesJSON() throws Exception {
     PTypeFamily tf = WritableTypeFamily.getInstance();
     PType<PageRankData> prType = PTypes.jsonString(PageRankData.class, tf);
-    run(new MRPipeline(PageRankIT.class, tmpDir.getDefaultConfiguration()), prType, tf);
+    String urlInput = tmpDir.copyResourceFileName("urls.txt");
+    run(new MRPipeline(PageRankIT.class, tmpDir.getDefaultConfiguration()),
+        urlInput, prType, tf);
   }
 
   public static PTable<String, PageRankData> pageRank(PTable<String, PageRankData>
input, final float d) {
@@ -127,8 +134,8 @@ public class PageRankIT {
         }, input.getPTableType());
   }
 
-  public void run(Pipeline pipeline, PType<PageRankData> prType, PTypeFamily ptf) throws
Exception {
-    String urlInput = tmpDir.copyResourceFileName("urls.txt");
+  public static void run(Pipeline pipeline, String urlInput,
+      PType<PageRankData> prType, PTypeFamily ptf) throws Exception {
     PTable<String, PageRankData> scores = pipeline.readTextFile(urlInput)
         .parallelDo(new MapFn<String, Pair<String, String>>() {
           @Override


Mime
View raw message