Updated Branches: refs/heads/master a7b98a9e0 -> daa16452c
CRUNCH-33: Move ScrunchTestSupport to CrunchTestSupport in the crunch-test submodule Project: http://git-wip-us.apache.org/repos/asf/incubator-crunch/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-crunch/commit/daa16452 Tree: http://git-wip-us.apache.org/repos/asf/incubator-crunch/tree/daa16452 Diff: http://git-wip-us.apache.org/repos/asf/incubator-crunch/diff/daa16452 Branch: refs/heads/master Commit: daa16452c467147c0b523ecce75da5100d4f4830 Parents: a7b98a9 Author: jwills <[email protected]> Authored: Sun Aug 5 17:47:52 2012 -0700 Committer: jwills <[email protected]> Committed: Sun Aug 5 17:47:52 2012 -0700 ---------------------------------------------------------------------- .../org/apache/crunch/test/CrunchTestSupport.java | 30 +++++++++++++++ .../org/apache/scrunch/ScrunchTestSupport.java | 28 -------------- .../it/scala/org/apache/scrunch/CogroupTest.scala | 3 +- .../src/it/scala/org/apache/scrunch/JoinTest.scala | 3 +- .../org/apache/scrunch/PageRankClassTest.scala | 3 +- .../it/scala/org/apache/scrunch/PageRankTest.scala | 3 +- .../scala/org/apache/scrunch/PipelineAppTest.scala | 4 +- .../src/it/scala/org/apache/scrunch/TopTest.scala | 3 +- .../it/scala/org/apache/scrunch/UnionTest.scala | 3 +- .../scala/org/apache/scrunch/WordCountTest.scala | 3 +- .../scrunch/interpreter/InterpreterJarTest.scala | 4 +- 11 files changed, 49 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/daa16452/crunch-test/src/main/java/org/apache/crunch/test/CrunchTestSupport.java ---------------------------------------------------------------------- diff --git a/crunch-test/src/main/java/org/apache/crunch/test/CrunchTestSupport.java b/crunch-test/src/main/java/org/apache/crunch/test/CrunchTestSupport.java new file mode 100644 index 0000000..7f74931 --- /dev/null +++ b/crunch-test/src/main/java/org/apache/crunch/test/CrunchTestSupport.java @@ -0,0 +1,30 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.crunch.test; + +import org.junit.Rule; + +/** + * A temporary workaround for Scala tests to use when working with Rule annotations + * until it gets fixed in JUnit 4.11. + */ +public class CrunchTestSupport { + @Rule + public TemporaryPath tempDir = new TemporaryPath( + "crunch.tmp.dir", "hadoop.tmp.dir"); +} http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/daa16452/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 deleted file mode 100644 index 53d7cca..0000000 --- a/scrunch/src/it/java/org/apache/scrunch/ScrunchTestSupport.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.scrunch; - -import org.apache.crunch.impl.mr.run.RuntimeParameters; -import org.apache.crunch.test.TemporaryPath; - -import org.junit.Rule; - -public class ScrunchTestSupport { - @Rule - public TemporaryPath tempDir = new TemporaryPath(RuntimeParameters.TMP_DIR, "hadoop.tmp.dir"); -} http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/daa16452/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 0e128c1..de20cd9 100644 --- a/scrunch/src/it/scala/org/apache/scrunch/CogroupTest.scala +++ b/scrunch/src/it/scala/org/apache/scrunch/CogroupTest.scala @@ -18,11 +18,12 @@ package org.apache.scrunch import org.apache.crunch.io.{From => from} +import org.apache.crunch.test.CrunchTestSupport import org.scalatest.junit.JUnitSuite import _root_.org.junit.Test -class CogroupTest extends ScrunchTestSupport with JUnitSuite { +class CogroupTest extends CrunchTestSupport with JUnitSuite { lazy val pipeline = Pipeline.mapReduce[CogroupTest](tempDir.getDefaultConfiguration) def wordCount(fileName: String) = { http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/daa16452/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 6b8e1ef..397ca65 100644 --- a/scrunch/src/it/scala/org/apache/scrunch/JoinTest.scala +++ b/scrunch/src/it/scala/org/apache/scrunch/JoinTest.scala @@ -18,11 +18,12 @@ package org.apache.scrunch import org.apache.crunch.io.{From => from, To => to} +import org.apache.crunch.test.CrunchTestSupport import org.scalatest.junit.JUnitSuite import _root_.org.junit.Test -class JoinTest extends ScrunchTestSupport with JUnitSuite { +class JoinTest extends CrunchTestSupport with JUnitSuite { lazy val pipeline = Pipeline.mapReduce[CogroupTest](tempDir.getDefaultConfiguration) def wordCount(fileName: String) = { http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/daa16452/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 9d0e3a7..d2822db 100644 --- a/scrunch/src/it/scala/org/apache/scrunch/PageRankClassTest.scala +++ b/scrunch/src/it/scala/org/apache/scrunch/PageRankClassTest.scala @@ -21,6 +21,7 @@ import Avros._ import org.apache.crunch.{DoFn, Emitter, Pair => P} import org.apache.crunch.io.{From => from} +import org.apache.crunch.test.CrunchTestSupport import scala.collection.mutable.HashMap @@ -60,7 +61,7 @@ class CachingPageRankClassFn extends DoFn[P[String, PageRankData], P[String, Flo } } -class PageRankClassTest extends ScrunchTestSupport with JUnitSuite { +class PageRankClassTest extends CrunchTestSupport with JUnitSuite { lazy val pipeline = Pipeline.mapReduce[PageRankTest](tempDir.getDefaultConfiguration) http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/daa16452/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 cf87a2a..9cf05e1 100644 --- a/scrunch/src/it/scala/org/apache/scrunch/PageRankTest.scala +++ b/scrunch/src/it/scala/org/apache/scrunch/PageRankTest.scala @@ -21,6 +21,7 @@ import Avros._ import org.apache.crunch.{DoFn, Emitter, Pair => P} import org.apache.crunch.io.{From => from} +import org.apache.crunch.test.CrunchTestSupport import scala.collection.mutable.HashMap @@ -48,7 +49,7 @@ class CachingPageRankFn extends DoFn[P[String, (Float, Float, List[String])], P[ } } -class PageRankTest extends ScrunchTestSupport with JUnitSuite { +class PageRankTest extends CrunchTestSupport with JUnitSuite { lazy val pipeline = Pipeline.mapReduce[PageRankTest](tempDir.getDefaultConfiguration) def initialInput(fileName: String) = { http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/daa16452/scrunch/src/it/scala/org/apache/scrunch/PipelineAppTest.scala ---------------------------------------------------------------------- diff --git a/scrunch/src/it/scala/org/apache/scrunch/PipelineAppTest.scala b/scrunch/src/it/scala/org/apache/scrunch/PipelineAppTest.scala index d418189..50d6fc1 100644 --- a/scrunch/src/it/scala/org/apache/scrunch/PipelineAppTest.scala +++ b/scrunch/src/it/scala/org/apache/scrunch/PipelineAppTest.scala @@ -17,6 +17,8 @@ */ package org.apache.scrunch +import org.apache.crunch.test.CrunchTestSupport + import org.scalatest.junit.JUnitSuite import _root_.org.junit.Test @@ -35,7 +37,7 @@ object WordCount extends PipelineApp { cogroup(w1, w2).write(to.textFile(args(2))) } -class PipelineAppTest extends ScrunchTestSupport with JUnitSuite { +class PipelineAppTest extends CrunchTestSupport with JUnitSuite { @Test def run { val args = new Array[String](3) args(0) = tempDir.copyResourceFileName("shakes.txt") http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/daa16452/scrunch/src/it/scala/org/apache/scrunch/TopTest.scala ---------------------------------------------------------------------- diff --git a/scrunch/src/it/scala/org/apache/scrunch/TopTest.scala b/scrunch/src/it/scala/org/apache/scrunch/TopTest.scala index 9c40b5c..f9db0e5 100644 --- a/scrunch/src/it/scala/org/apache/scrunch/TopTest.scala +++ b/scrunch/src/it/scala/org/apache/scrunch/TopTest.scala @@ -18,11 +18,12 @@ package org.apache.scrunch import org.apache.crunch.io.{From => from, To => to} +import org.apache.crunch.test.CrunchTestSupport import org.scalatest.junit.JUnitSuite import _root_.org.junit.Test -class TopTest extends ScrunchTestSupport with JUnitSuite { +class TopTest extends CrunchTestSupport with JUnitSuite { @Test def topInMem { val ptable = Mem.tableOf(("foo", 17), ("bar", 29), ("baz", 1729)) http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/daa16452/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 0946eff..dd0a651 100644 --- a/scrunch/src/it/scala/org/apache/scrunch/UnionTest.scala +++ b/scrunch/src/it/scala/org/apache/scrunch/UnionTest.scala @@ -18,11 +18,12 @@ package org.apache.scrunch import org.apache.crunch.io.{From => from} +import org.apache.crunch.test.CrunchTestSupport import org.scalatest.junit.JUnitSuite import _root_.org.junit.Test -class UnionTest extends ScrunchTestSupport with JUnitSuite { +class UnionTest extends CrunchTestSupport with JUnitSuite { lazy val pipeline = Pipeline.mapReduce[UnionTest](tempDir.getDefaultConfiguration) def wordCount(col: PCollection[String]) = { http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/daa16452/scrunch/src/it/scala/org/apache/scrunch/WordCountTest.scala ---------------------------------------------------------------------- diff --git a/scrunch/src/it/scala/org/apache/scrunch/WordCountTest.scala b/scrunch/src/it/scala/org/apache/scrunch/WordCountTest.scala index f8081ea..3edb08b 100644 --- a/scrunch/src/it/scala/org/apache/scrunch/WordCountTest.scala +++ b/scrunch/src/it/scala/org/apache/scrunch/WordCountTest.scala @@ -18,11 +18,12 @@ package org.apache.scrunch import org.apache.crunch.io.{From => from, To => to} +import org.apache.crunch.test.CrunchTestSupport import org.scalatest.junit.JUnitSuite import _root_.org.junit.Test -class WordCountTest extends ScrunchTestSupport with JUnitSuite { +class WordCountTest extends CrunchTestSupport with JUnitSuite { @Test def wordCount { val pipeline = Pipeline.mapReduce[WordCountTest](tempDir.getDefaultConfiguration) val input = tempDir.copyResourceFileName("shakes.txt") http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/daa16452/scrunch/src/it/scala/org/apache/scrunch/interpreter/InterpreterJarTest.scala ---------------------------------------------------------------------- diff --git a/scrunch/src/it/scala/org/apache/scrunch/interpreter/InterpreterJarTest.scala b/scrunch/src/it/scala/org/apache/scrunch/interpreter/InterpreterJarTest.scala index 993d7e4..519dae4 100644 --- a/scrunch/src/it/scala/org/apache/scrunch/interpreter/InterpreterJarTest.scala +++ b/scrunch/src/it/scala/org/apache/scrunch/interpreter/InterpreterJarTest.scala @@ -27,13 +27,13 @@ import scala.tools.nsc.io.VirtualDirectory import com.google.common.io.Files import org.junit.Assert.assertNotNull import org.junit.Test -import org.apache.scrunch.ScrunchTestSupport +import org.apache.crunch.test.CrunchTestSupport import org.scalatest.junit.JUnitSuite /** * Tests creating jars from a {@link scala.tools.nsc.io.VirtualDirectory}. */ -class InterpreterJarTest extends ScrunchTestSupport with JUnitSuite { +class InterpreterJarTest extends CrunchTestSupport with JUnitSuite { /** * Tests transforming a virtual directory into a temporary jar file.
