incubator-crunch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwi...@apache.org
Subject [5/7] git commit: Lazify the pipeline fields so that they play nicely w/the TemporaryPath code
Date Sat, 28 Jul 2012 19:40:20 GMT
Lazify the pipeline fields so that they play nicely w/the TemporaryPath code

Signed-off-by: jwills <jwills@apache.org>


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

Branch: refs/heads/master
Commit: ac6f6894f5393ab7a080d754a4b91041ecb06fc1
Parents: 5b9d3ce
Author: jwills <jwills@apache.org>
Authored: Thu Jul 26 23:38:33 2012 -0700
Committer: jwills <jwills@apache.org>
Committed: Sat Jul 28 11:17:58 2012 -0700

----------------------------------------------------------------------
 .../org/apache/scrunch/ScrunchTestSupport.java     |    7 +------
 .../it/scala/org/apache/scrunch/CogroupTest.scala  |    2 +-
 .../src/it/scala/org/apache/scrunch/JoinTest.scala |    2 +-
 .../org/apache/scrunch/PageRankClassTest.scala     |    2 +-
 .../it/scala/org/apache/scrunch/PageRankTest.scala |    2 +-
 .../it/scala/org/apache/scrunch/UnionTest.scala    |    8 +++++---
 6 files changed, 10 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/ac6f6894/scrunch/src/it/java/org/apache/scrunch/ScrunchTestSupport.java
----------------------------------------------------------------------
diff --git a/scrunch/src/it/java/org/apache/scrunch/ScrunchTestSupport.java b/scrunch/src/it/java/org/apache/scrunch/ScrunchTestSupport.java
index 2cfb1ce..a9f7318 100644
--- a/scrunch/src/it/java/org/apache/scrunch/ScrunchTestSupport.java
+++ b/scrunch/src/it/java/org/apache/scrunch/ScrunchTestSupport.java
@@ -20,13 +20,8 @@ package org.apache.scrunch;
 import org.apache.crunch.test.TemporaryPath;
 
 import org.junit.Rule;
-import org.scalatest.junit.JUnitSuite;
 
 public class ScrunchTestSupport {
   @Rule
-  private final TemporaryPath tempDir = new TemporaryPath();
-
-  public TemporaryPath tempDir() {
-    return tempDir;
-  }
+  public TemporaryPath tempDir = new TemporaryPath();
 }

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/ac6f6894/scrunch/src/it/scala/org/apache/scrunch/CogroupTest.scala
----------------------------------------------------------------------
diff --git a/scrunch/src/it/scala/org/apache/scrunch/CogroupTest.scala b/scrunch/src/it/scala/org/apache/scrunch/CogroupTest.scala
index 268d2b6..0e128c1 100644
--- a/scrunch/src/it/scala/org/apache/scrunch/CogroupTest.scala
+++ b/scrunch/src/it/scala/org/apache/scrunch/CogroupTest.scala
@@ -23,7 +23,7 @@ import org.scalatest.junit.JUnitSuite
 import _root_.org.junit.Test
 
 class CogroupTest extends ScrunchTestSupport with JUnitSuite {
-  val pipeline = Pipeline.mapReduce[CogroupTest](tempDir.getDefaultConfiguration)
+  lazy val pipeline = Pipeline.mapReduce[CogroupTest](tempDir.getDefaultConfiguration)
 
   def wordCount(fileName: String) = {
     pipeline.read(from.textFile(fileName))

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/ac6f6894/scrunch/src/it/scala/org/apache/scrunch/JoinTest.scala
----------------------------------------------------------------------
diff --git a/scrunch/src/it/scala/org/apache/scrunch/JoinTest.scala b/scrunch/src/it/scala/org/apache/scrunch/JoinTest.scala
index c3a4a80..6b8e1ef 100644
--- a/scrunch/src/it/scala/org/apache/scrunch/JoinTest.scala
+++ b/scrunch/src/it/scala/org/apache/scrunch/JoinTest.scala
@@ -23,7 +23,7 @@ import org.scalatest.junit.JUnitSuite
 import _root_.org.junit.Test
 
 class JoinTest extends ScrunchTestSupport with JUnitSuite {
-  val pipeline = Pipeline.mapReduce[CogroupTest](tempDir.getDefaultConfiguration)
+  lazy val pipeline = Pipeline.mapReduce[CogroupTest](tempDir.getDefaultConfiguration)
 
   def wordCount(fileName: String) = {
     pipeline.read(from.textFile(fileName))

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/ac6f6894/scrunch/src/it/scala/org/apache/scrunch/PageRankClassTest.scala
----------------------------------------------------------------------
diff --git a/scrunch/src/it/scala/org/apache/scrunch/PageRankClassTest.scala b/scrunch/src/it/scala/org/apache/scrunch/PageRankClassTest.scala
index 43775ea..9d0e3a7 100644
--- a/scrunch/src/it/scala/org/apache/scrunch/PageRankClassTest.scala
+++ b/scrunch/src/it/scala/org/apache/scrunch/PageRankClassTest.scala
@@ -62,7 +62,7 @@ class CachingPageRankClassFn extends DoFn[P[String, PageRankData], P[String,
Flo
 
 class PageRankClassTest extends ScrunchTestSupport with JUnitSuite {
 
-  val pipeline = Pipeline.mapReduce[PageRankTest](tempDir.getDefaultConfiguration)
+  lazy val pipeline = Pipeline.mapReduce[PageRankTest](tempDir.getDefaultConfiguration)
 
   def initialInput(fileName: String) = {
     pipeline.read(from.textFile(fileName))

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/ac6f6894/scrunch/src/it/scala/org/apache/scrunch/PageRankTest.scala
----------------------------------------------------------------------
diff --git a/scrunch/src/it/scala/org/apache/scrunch/PageRankTest.scala b/scrunch/src/it/scala/org/apache/scrunch/PageRankTest.scala
index 3cf7b8a..cf87a2a 100644
--- a/scrunch/src/it/scala/org/apache/scrunch/PageRankTest.scala
+++ b/scrunch/src/it/scala/org/apache/scrunch/PageRankTest.scala
@@ -49,7 +49,7 @@ class CachingPageRankFn extends DoFn[P[String, (Float, Float, List[String])],
P[
 }
 
 class PageRankTest extends ScrunchTestSupport with JUnitSuite {
-  val pipeline = Pipeline.mapReduce[PageRankTest](tempDir.getDefaultConfiguration)
+  lazy val pipeline = Pipeline.mapReduce[PageRankTest](tempDir.getDefaultConfiguration)
 
   def initialInput(fileName: String) = {
     pipeline.read(from.textFile(fileName))

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/ac6f6894/scrunch/src/it/scala/org/apache/scrunch/UnionTest.scala
----------------------------------------------------------------------
diff --git a/scrunch/src/it/scala/org/apache/scrunch/UnionTest.scala b/scrunch/src/it/scala/org/apache/scrunch/UnionTest.scala
index fa88edc..0946eff 100644
--- a/scrunch/src/it/scala/org/apache/scrunch/UnionTest.scala
+++ b/scrunch/src/it/scala/org/apache/scrunch/UnionTest.scala
@@ -23,15 +23,15 @@ import org.scalatest.junit.JUnitSuite
 import _root_.org.junit.Test
 
 class UnionTest extends ScrunchTestSupport with JUnitSuite {
-  val pipeline = Pipeline.mapReduce[UnionTest](tempDir.getDefaultConfiguration)
-  val shakespeare = tempDir.copyResourceFileName("shakes.txt")
-  val maugham = tempDir.copyResourceFileName("maugham.txt")
+  lazy val pipeline = Pipeline.mapReduce[UnionTest](tempDir.getDefaultConfiguration)
 
   def wordCount(col: PCollection[String]) = {
     col.flatMap(_.toLowerCase.split("\\W+")).count
   }
 
   @Test def testUnionCollection {
+    val shakespeare = tempDir.copyResourceFileName("shakes.txt")
+    val maugham = tempDir.copyResourceFileName("maugham.txt")
     val union = pipeline.read(from.textFile(shakespeare)).union(
         pipeline.read(from.textFile(maugham)))
     val wc = wordCount(union).materialize
@@ -40,6 +40,8 @@ class UnionTest extends ScrunchTestSupport with JUnitSuite {
   }
 
   @Test def testUnionTable {
+    val shakespeare = tempDir.copyResourceFileName("shakes.txt")
+    val maugham = tempDir.copyResourceFileName("maugham.txt")
     val wcs = wordCount(pipeline.read(from.textFile(shakespeare)))
     val wcm = wordCount(pipeline.read(from.textFile(maugham)))
     val wc = wcs.union(wcm).groupByKey.combine(v => v.sum).materialize


Mime
View raw message