incubator-crunch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwi...@apache.org
Subject [27/33] CRUNCH-8: Moving the code into multiple Maven modules. Contributed by Matthias Friedrich
Date Wed, 11 Jul 2012 05:14:47 GMT
http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/TermFrequencyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/TermFrequencyTest.java b/src/test/java/org/apache/crunch/TermFrequencyTest.java
deleted file mode 100644
index fced0ee..0000000
--- a/src/test/java/org/apache/crunch/TermFrequencyTest.java
+++ /dev/null
@@ -1,134 +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.crunch;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Serializable;
-
-import org.junit.Test;
-
-import org.apache.crunch.impl.mem.MemPipeline;
-import org.apache.crunch.impl.mr.MRPipeline;
-import org.apache.crunch.io.At;
-import org.apache.crunch.io.ReadableSourceTarget;
-import org.apache.crunch.lib.Aggregate;
-import org.apache.crunch.test.FileHelper;
-import org.apache.crunch.types.PTypeFamily;
-import org.apache.crunch.types.writable.WritableTypeFamily;
-
-@SuppressWarnings("serial")
-public class TermFrequencyTest implements Serializable {  
-  
-  @Test
-  public void testTermFrequencyWithNoTransform() throws IOException {
-    run(new MRPipeline(TermFrequencyTest.class), WritableTypeFamily.getInstance(), false);
-  }
-  
-  @Test
-  public void testTermFrequencyWithTransform() throws IOException {
-    run(new MRPipeline(TermFrequencyTest.class), WritableTypeFamily.getInstance(), true);
-  }
-  
-  @Test
-  public void testTermFrequencyNoTransformInMemory() throws IOException {
-    run(MemPipeline.getInstance(), WritableTypeFamily.getInstance(), false);  
-  }
-
-  @Test
-  public void testTermFrequencyWithTransformInMemory() throws IOException {
-    run(MemPipeline.getInstance(), WritableTypeFamily.getInstance(), true);
-  }
-  
-
-  public void run(Pipeline pipeline, PTypeFamily typeFamily, boolean transformTF) throws IOException {
-    String input = FileHelper.createTempCopyOf("docs.txt");
-    
-    File transformedOutput = FileHelper.createOutputPath();
-    File tfOutput = FileHelper.createOutputPath();
-    
-    PCollection<String> docs = pipeline.readTextFile(input);
-    
-    PTypeFamily ptf = docs.getTypeFamily();
-    
-    /*
-     * Input: String
-     * Input title  text
-     * 
-     * Output: PTable<Pair<String, String>, Long> 
-     * Pair<Pair<word, title>, count in title>
-     */
-    PTable<Pair<String, String>, Long> tf = Aggregate.count(docs.parallelDo("term document frequency",
-        new DoFn<String, Pair<String, String>>() {
-      @Override
-      public void process(String doc, Emitter<Pair<String, String>> emitter) {
-        String[] kv = doc.split("\t");
-        String title = kv[0];
-        String text = kv[1];
-        for (String word : text.split("\\W+")) {
-          if(word.length() > 0) {
-            Pair<String, String> pair = Pair.of(word.toLowerCase(), title);
-            emitter.emit(pair);
-          }
-        }
-      }
-    }, ptf.pairs(ptf.strings(), ptf.strings())));
-    
-    if(transformTF) {
-      /*
-       * Input: Pair<Pair<String, String>, Long>
-       * Pair<Pair<word, title>, count in title>
-       * 
-       * Output: PTable<String, Pair<String, Long>>
-       * PTable<word, Pair<title, count in title>>
-       */
-      PTable<String, Pair<String, Long>> wordDocumentCountPair = tf.parallelDo("transform wordDocumentPairCount",
-          new MapFn<Pair<Pair<String, String>, Long>, Pair<String, Pair<String, Long>>>() {
-            @Override
-            public Pair<String, Pair<String, Long>> map(Pair<Pair<String, String>, Long> input) {
-              Pair<String, String> wordDocumentPair = input.first();            
-              return Pair.of(wordDocumentPair.first(), Pair.of(wordDocumentPair.second(), input.second()));
-            }
-        }, ptf.tableOf(ptf.strings(), ptf.pairs(ptf.strings(), ptf.longs())));
-      
-      pipeline.writeTextFile(wordDocumentCountPair, transformedOutput.getAbsolutePath());
-    }
-    
-    SourceTarget<String> st = At.textFile(tfOutput.getAbsolutePath());
-    pipeline.write(tf, st);
-    
-    pipeline.run();
-    
-    // test the case we should see
-    Iterable<String> lines = ((ReadableSourceTarget<String>) st).read(pipeline.getConfiguration());
-    boolean passed = false;
-    for (String line : lines) {
-      if ("[well,A]\t0".equals(line)) {
-        fail("Found " + line + " but well is in Document A 1 time");
-      }
-      if ("[well,A]\t1".equals(line)) {
-        passed = true;
-      }
-    }
-    assertTrue(passed);
-    pipeline.done();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/TextPairTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/TextPairTest.java b/src/test/java/org/apache/crunch/TextPairTest.java
deleted file mode 100644
index 2a966c4..0000000
--- a/src/test/java/org/apache/crunch/TextPairTest.java
+++ /dev/null
@@ -1,69 +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.crunch;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-
-import org.junit.Test;
-
-import org.apache.crunch.impl.mr.MRPipeline;
-import org.apache.crunch.io.From;
-import org.apache.crunch.test.FileHelper;
-import org.apache.crunch.types.writable.Writables;
-
-public class TextPairTest  {
-
-  @Test
-  public void testWritables() throws IOException {
-    run(new MRPipeline(TextPairTest.class));
-  }
-  
-  private static final String CANARY = "Writables.STRING_TO_TEXT";
-  
-  public static PCollection<Pair<String, String>> wordDuplicate(PCollection<String> words) {
-    return words.parallelDo("my word duplicator", new DoFn<String, Pair<String, String>>() {
-      public void process(String line, Emitter<Pair<String, String>> emitter) {
-        for (String word : line.split("\\W+")) {
-          if(word.length() > 0) {
-            Pair<String, String> pair = Pair.of(CANARY, word);
-            emitter.emit(pair);
-          }
-        }
-      }
-    }, Writables.pairs(Writables.strings(), Writables.strings()));
-  }
-  
-  public void run(Pipeline pipeline) throws IOException {
-    String input = FileHelper.createTempCopyOf("shakes.txt");
-        
-    PCollection<String> shakespeare = pipeline.read(From.textFile(input));
-    Iterable<Pair<String, String>> lines = pipeline.materialize(wordDuplicate(shakespeare));    
-    boolean passed = false;
-    for (Pair<String, String> line : lines) {
-      if (line.first().contains(CANARY)) {
-        passed = true;
-        break;
-      }
-    }
-    
-    pipeline.done();
-    assertTrue(passed);
-  }  
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/TupleNClassCastBugTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/TupleNClassCastBugTest.java b/src/test/java/org/apache/crunch/TupleNClassCastBugTest.java
deleted file mode 100644
index 5c22e2b..0000000
--- a/src/test/java/org/apache/crunch/TupleNClassCastBugTest.java
+++ /dev/null
@@ -1,95 +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.crunch;
-
-import static com.google.common.io.Resources.getResource;
-import static com.google.common.io.Resources.newInputStreamSupplier;
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.List;
-
-import org.junit.Test;
-
-import org.apache.crunch.impl.mr.MRPipeline;
-import org.apache.crunch.types.PTypeFamily;
-import org.apache.crunch.types.avro.AvroTypeFamily;
-import org.apache.crunch.types.writable.WritableTypeFamily;
-import com.google.common.io.Files;
-
-public class TupleNClassCastBugTest {
-
-  public static PCollection<TupleN> mapGroupDo(PCollection<String> lines, PTypeFamily ptf) {
-    PTable<String, TupleN> mapped = lines.parallelDo(new MapFn<String, Pair<String, TupleN>>() {
-
-      @Override
-      public Pair<String, TupleN> map(String line) {
-        String[] columns = line.split("\\t");
-        String docId = columns[0];
-        String docLine = columns[1];
-        return Pair.of(docId, new TupleN(docId, docLine));
-      }
-    }, ptf.tableOf(ptf.strings(), ptf.tuples(ptf.strings(), ptf.strings())));
-    return mapped.groupByKey().parallelDo(new DoFn<Pair<String, Iterable<TupleN>>, TupleN>() {
-      @Override
-      public void process(Pair<String, Iterable<TupleN>> input, Emitter<TupleN> tupleNEmitter) {
-        for (TupleN tuple : input.second()) {
-          tupleNEmitter.emit(tuple);
-        }
-      }
-    }, ptf.tuples(ptf.strings(), ptf.strings()));
-  }
-
-  @Test
-  public void testWritables() throws IOException {
-    run(new MRPipeline(TupleNClassCastBugTest.class), WritableTypeFamily.getInstance());
-  }
-
-  @Test
-  public void testAvro() throws IOException {
-    run(new MRPipeline(TupleNClassCastBugTest.class), AvroTypeFamily.getInstance());
-  }
-
-  public void run(Pipeline pipeline, PTypeFamily typeFamily) throws IOException {
-    File input = File.createTempFile("docs", "txt");
-    input.deleteOnExit();
-    Files.copy(newInputStreamSupplier(getResource("docs.txt")), input);
-
-    File output = File.createTempFile("output", "");
-    String outputPath = output.getAbsolutePath();
-    output.delete();
-
-    PCollection<String> docLines = pipeline.readTextFile(input.getAbsolutePath());
-    pipeline.writeTextFile(mapGroupDo(docLines, typeFamily), outputPath);
-    pipeline.done();
-
-    // *** We are not directly testing the output, we are looking for a ClassCastException
-    // *** which is thrown in a different thread during the reduce phase. If all is well
-    // *** the file will exist and have six lines. Otherwise the bug is present.
-    File outputFile = new File(output, "part-r-00000");
-    List<String> lines = Files.readLines(outputFile, Charset.defaultCharset());
-    int lineCount = 0;
-    for (String line : lines) {
-      lineCount++;
-    }
-    assertEquals(6, lineCount);
-    output.deleteOnExit();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/TupleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/TupleTest.java b/src/test/java/org/apache/crunch/TupleTest.java
deleted file mode 100644
index f259acc..0000000
--- a/src/test/java/org/apache/crunch/TupleTest.java
+++ /dev/null
@@ -1,142 +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.crunch;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import org.junit.Test;
-
-import org.apache.crunch.types.TupleFactory;
-
-public class TupleTest {
-  private String first = "foo";
-  private Integer second = 1729;
-  private Double third = 64.2;
-  private Boolean fourth = false;
-  private Float fifth = 17.29f;
-  
-  @Test
-  public void testTuple3() {
-    Tuple3<String, Integer, Double> t = new Tuple3<String, Integer, Double>(first, second, third);
-    assertEquals(3, t.size());
-    assertEquals(first, t.first());
-    assertEquals(second, t.second());
-    assertEquals(third, t.third());
-    assertEquals(first, t.get(0));
-    assertEquals(second, t.get(1));
-    assertEquals(third, t.get(2));
-    try {
-      t.get(-1);
-      fail();
-    } catch (IndexOutOfBoundsException e) {
-      // expected
-    }
-  }
-  
-  @Test
-  public void testTuple3Equality() {
-    Tuple3<String, Integer, Double> t = new Tuple3<String, Integer, Double>(first, second, third);
-    assertTrue(t.equals(new Tuple3(first, second, third)));
-    assertFalse(t.equals(new Tuple3(first, null, third)));
-    assertFalse((new Tuple3(null, null, null)).equals(t));
-    assertTrue((new Tuple3(first, null, null)).equals(new Tuple3(first, null, null)));
-  }
-  
-  @Test
-  public void testTuple4() {
-    Tuple4<String, Integer, Double, Boolean> t = 
-      new Tuple4<String, Integer, Double, Boolean>(first, second, third, fourth);
-    assertEquals(4, t.size());
-    assertEquals(first, t.first());
-    assertEquals(second, t.second());
-    assertEquals(third, t.third());
-    assertEquals(fourth, t.fourth());
-    assertEquals(first, t.get(0));
-    assertEquals(second, t.get(1));
-    assertEquals(third, t.get(2));
-    assertEquals(fourth, t.get(3));
-    try {
-      t.get(-1);
-      fail();
-    } catch (IndexOutOfBoundsException e) {
-      // expected
-    }
-  }
-
-  @Test
-  public void testTuple4Equality() {
-    Tuple4<String, Integer, Double, Boolean> t = 
-      new Tuple4<String, Integer, Double, Boolean>(first, second, third, fourth);
-    assertFalse(t.equals(new Tuple3(first, second, third)));
-    assertFalse(t.equals(new Tuple4(first, null, third, null)));
-    assertFalse((new Tuple4(null, null, null, null)).equals(t));
-    assertTrue((new Tuple4(first, null, third, null)).equals(
-        new Tuple4(first, null, third, null)));
-  }
-
-  @Test
-  public void testTupleN() {
-    TupleN t = new TupleN(first, second, third, fourth, fifth);
-    assertEquals(5, t.size());
-    assertEquals(first, t.get(0));
-    assertEquals(second, t.get(1));
-    assertEquals(third, t.get(2));
-    assertEquals(fourth, t.get(3));
-    assertEquals(fifth, t.get(4));
-    try {
-      t.get(-1);
-      fail();
-    } catch (IndexOutOfBoundsException e) {
-      // expected
-    }
-  }
-
-  @Test
-  public void testTupleNEquality() {
-	TupleN t = new TupleN(first, second, third, fourth, fifth);
-	assertTrue(t.equals(new TupleN(first, second, third, fourth, fifth)));
-    assertFalse(t.equals(new TupleN(first, null, third, null)));
-    assertFalse((new TupleN(null, null, null, null, null)).equals(t));
-    assertTrue((new TupleN(first, second, third, null, null)).equals(
-        new TupleN(first, second, third, null, null)));
-  }
-
-  @Test
-  public void testTupleFactory() {
-    checkTuple(TupleFactory.PAIR.makeTuple("a", "b"), Pair.class, "a", "b");
-    checkTuple(TupleFactory.TUPLE3.makeTuple("a", "b", "c"), Tuple3.class, "a", "b", "c");
-    checkTuple(TupleFactory.TUPLE4.makeTuple("a", "b", "c", "d"), Tuple4.class, "a", "b", "c", "d");
-    checkTuple(TupleFactory.TUPLEN.makeTuple("a", "b", "c", "d", "e"), TupleN.class, "a", "b", "c", "d", "e");
-
-    checkTuple(TupleFactory.TUPLEN.makeTuple("a", "b"), TupleN.class, "a", "b");
-    checkTuple(TupleFactory.TUPLEN.makeTuple("a", "b", "c"), TupleN.class, "a", "b", "c");
-    checkTuple(TupleFactory.TUPLEN.makeTuple("a", "b", "c", "d"), TupleN.class, "a", "b", "c", "d");
-    checkTuple(TupleFactory.TUPLEN.makeTuple("a", "b", "c", "d", "e"), TupleN.class, "a", "b", "c", "d", "e");
-  }
-
-  private void checkTuple(Tuple t, Class<? extends Tuple> type, Object... values) {
-    assertEquals(type, t.getClass());
-    assertEquals(values.length, t.size());
-    for (int i = 0; i < values.length; i++)
-      assertEquals(values[i], t.get(i));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/WordCountHBaseTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/WordCountHBaseTest.java b/src/test/java/org/apache/crunch/WordCountHBaseTest.java
deleted file mode 100644
index 10459ce..0000000
--- a/src/test/java/org/apache/crunch/WordCountHBaseTest.java
+++ /dev/null
@@ -1,207 +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.crunch;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Random;
-import java.util.jar.JarEntry;
-import java.util.jar.JarOutputStream;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.client.Get;
-import org.apache.hadoop.hbase.client.HTable;
-import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.client.Result;
-import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.mapred.TaskAttemptContext;
-import org.apache.hadoop.filecache.DistributedCache;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.crunch.impl.mr.MRPipeline;
-import org.apache.crunch.io.hbase.HBaseSourceTarget;
-import org.apache.crunch.io.hbase.HBaseTarget;
-import org.apache.crunch.lib.Aggregate;
-import org.apache.crunch.types.writable.Writables;
-import org.apache.crunch.util.DistCache;
-import com.google.common.io.ByteStreams;
-
-public class WordCountHBaseTest {
-  protected static final Log LOG = LogFactory.getLog(WordCountHBaseTest.class);
-
-  private static final byte[] COUNTS_COLFAM = Bytes.toBytes("cf");
-  private static final byte[] WORD_COLFAM = Bytes.toBytes("cf");
-
-  private HBaseTestingUtility hbaseTestUtil = new HBaseTestingUtility();
-  
-  @SuppressWarnings("serial")
-  public static PCollection<Put> wordCount(PTable<ImmutableBytesWritable, Result> words) {
-    PTable<String, Long> counts = Aggregate.count(words.parallelDo(
-        new DoFn<Pair<ImmutableBytesWritable, Result>, String>() {
-          @Override
-          public void process(Pair<ImmutableBytesWritable, Result> row, Emitter<String> emitter) {
-            byte[] word = row.second().getValue(WORD_COLFAM, null);
-            if (word != null) {
-              emitter.emit(Bytes.toString(word));
-            }
-          }
-        }, words.getTypeFamily().strings()));
-
-    return counts.parallelDo("convert to put",
-        new DoFn<Pair<String, Long>, Put>() {
-          @Override
-          public void process(Pair<String, Long> input, Emitter<Put> emitter) {
-            Put put = new Put(Bytes.toBytes(input.first()));
-            put.add(COUNTS_COLFAM, null,
-                Bytes.toBytes(input.second()));
-            emitter.emit(put);
-          }
-
-        }, Writables.writables(Put.class));
-  }
-
-  @SuppressWarnings("deprecation")
-  @Before
-  public void setUp() throws Exception {
-    Configuration conf = hbaseTestUtil.getConfiguration();
-    File tmpDir = File.createTempFile("logdir", "");
-    tmpDir.delete();
-    tmpDir.mkdir();
-    tmpDir.deleteOnExit();
-    conf.set("hadoop.log.dir", tmpDir.getAbsolutePath());
-    conf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/1");
-    conf.setInt("hbase.master.info.port", -1);
-    conf.setInt("hbase.regionserver.info.port", -1);
-
-    hbaseTestUtil.startMiniZKCluster();
-    hbaseTestUtil.startMiniCluster();
-    hbaseTestUtil.startMiniMapReduceCluster(1);
-    
-    // For Hadoop-2.0.0, we have to do a bit more work.
-    if (TaskAttemptContext.class.isInterface()) {
-      conf = hbaseTestUtil.getConfiguration();
-      FileSystem fs = FileSystem.get(conf);
-      Path tmpPath = new Path("target", "WordCountHBaseTest-tmpDir");
-      FileSystem localFS = FileSystem.getLocal(conf);
-      for (FileStatus jarFile : localFS.listStatus(new Path("target/lib/"))) {
-        Path target = new Path(tmpPath, jarFile.getPath().getName());
-        fs.copyFromLocalFile(jarFile.getPath(), target);
-        DistributedCache.addFileToClassPath(target, conf, fs);
-      }
-    
-      // Create a programmatic container for this jar.
-      JarOutputStream jos = new JarOutputStream(new FileOutputStream("WordCountHBaseTest.jar"));
-      File baseDir = new File("target/test-classes");
-      String prefix = "org/apache/crunch/";
-      jarUp(jos, baseDir, prefix + "WordCountHBaseTest.class");
-      jarUp(jos, baseDir, prefix + "WordCountHBaseTest$1.class");
-      jarUp(jos, baseDir, prefix + "WordCountHBaseTest$2.class");
-      jos.close();
-
-      Path target = new Path(tmpPath, "WordCountHBaseTest.jar");
-      fs.copyFromLocalFile(true, new Path("WordCountHBaseTest.jar"), target);
-      DistributedCache.addFileToClassPath(target, conf, fs);
-    }
-  }
-  
-  private void jarUp(JarOutputStream jos, File baseDir, String classDir) throws IOException {
-    File file = new File(baseDir, classDir);
-    JarEntry e = new JarEntry(classDir);
-    e.setTime(file.lastModified());
-    jos.putNextEntry(e);
-    ByteStreams.copy(new FileInputStream(file), jos);
-    jos.closeEntry();
-  }
-  
-  @Test
-  public void testWordCount() throws IOException {
-    run(new MRPipeline(WordCountHBaseTest.class, hbaseTestUtil.getConfiguration()));
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    hbaseTestUtil.shutdownMiniMapReduceCluster();
-    hbaseTestUtil.shutdownMiniCluster();
-    hbaseTestUtil.shutdownMiniZKCluster();
-  }
-  
-  public void run(Pipeline pipeline) throws IOException {
-    
-    Random rand = new Random();
-    int postFix = Math.abs(rand.nextInt());
-    String inputTableName = "crunch_words_" + postFix;
-    String outputTableName = "crunch_counts_" + postFix;
-
-    try {
-      
-      HTable inputTable = hbaseTestUtil.createTable(Bytes.toBytes(inputTableName),
-          WORD_COLFAM);
-      HTable outputTable = hbaseTestUtil.createTable(Bytes.toBytes(outputTableName),
-          COUNTS_COLFAM);
-  
-      int key = 0;
-      key = put(inputTable, key, "cat");
-      key = put(inputTable, key, "cat");
-      key = put(inputTable, key, "dog");
-      Scan scan = new Scan();
-      scan.addColumn(WORD_COLFAM, null);
-      HBaseSourceTarget source = new HBaseSourceTarget(inputTableName, scan);
-      PTable<ImmutableBytesWritable, Result> shakespeare = pipeline.read(source);
-      pipeline.write(wordCount(shakespeare), new HBaseTarget(outputTableName));
-      pipeline.done();
-      
-      assertIsLong(outputTable, "cat", 2);
-      assertIsLong(outputTable, "dog", 1);    
-    } finally {
-      // not quite sure...
-    }
-  }
-  
-  protected int put(HTable table, int key, String value) throws IOException {
-    Put put = new Put(Bytes.toBytes(key));
-    put.add(WORD_COLFAM, null, Bytes.toBytes(value));    
-    table.put(put);
-    return key + 1;
-  }
-  
-  protected void assertIsLong(HTable table, String key, long i) throws IOException {
-    Get get = new Get(Bytes.toBytes(key));
-    get.addColumn(COUNTS_COLFAM, null);
-    Result result = table.get(get);
-    
-    byte[] rawCount = result.getValue(COUNTS_COLFAM, null);
-    assertTrue(rawCount != null);
-    assertEquals(new Long(i), new Long(Bytes.toLong(rawCount)));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/WordCountTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/WordCountTest.java b/src/test/java/org/apache/crunch/WordCountTest.java
deleted file mode 100644
index 01a81e9..0000000
--- a/src/test/java/org/apache/crunch/WordCountTest.java
+++ /dev/null
@@ -1,172 +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.crunch;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.List;
-
-import org.junit.Test;
-
-import org.apache.crunch.impl.mr.MRPipeline;
-import org.apache.crunch.io.At;
-import org.apache.crunch.io.To;
-import org.apache.crunch.lib.Aggregate;
-import org.apache.crunch.test.FileHelper;
-import org.apache.crunch.types.PTypeFamily;
-import org.apache.crunch.types.avro.AvroTypeFamily;
-import org.apache.crunch.types.writable.WritableTypeFamily;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import com.google.common.io.Files;
-
-public class WordCountTest {
-
-  enum WordCountStats {
-    ANDS
-  };
-
-  public static PTable<String, Long> wordCount(PCollection<String> words, PTypeFamily typeFamily) {
-    return Aggregate.count(words.parallelDo(new DoFn<String, String>() {
-
-      @Override
-      public void process(String line, Emitter<String> emitter) {
-        for (String word : line.split("\\s+")) {
-          emitter.emit(word);
-          if ("and".equals(word)) {
-            increment(WordCountStats.ANDS);
-          }
-        }
-      }
-    }, typeFamily.strings()));
-  }
-
-  public static PTable<String, Long> substr(PTable<String, Long> ptable) {
-    return ptable.parallelDo(new DoFn<Pair<String, Long>, Pair<String, Long>>() {
-
-      public void process(Pair<String, Long> input, Emitter<Pair<String, Long>> emitter) {
-        if (input.first().length() > 0) {
-          emitter.emit(Pair.of(input.first().substring(0, 1), input.second()));
-        }
-      }
-    }, ptable.getPTableType());
-  }
-
-  private boolean runSecond = false;
-  private boolean useToOutput = false;
-
-  @Test
-  public void testWritables() throws IOException {
-    run(new MRPipeline(WordCountTest.class), WritableTypeFamily.getInstance());
-  }
-
-  @Test
-  public void testWritablesWithSecond() throws IOException {
-    runSecond = true;
-    run(new MRPipeline(WordCountTest.class), WritableTypeFamily.getInstance());
-  }
-
-  @Test
-  public void testWritablesWithSecondUseToOutput() throws IOException {
-    runSecond = true;
-    useToOutput = true;
-    run(new MRPipeline(WordCountTest.class), WritableTypeFamily.getInstance());
-  }
-
-  @Test
-  public void testAvro() throws IOException {
-    run(new MRPipeline(WordCountTest.class), AvroTypeFamily.getInstance());
-  }
-
-  @Test
-  public void testAvroWithSecond() throws IOException {
-    runSecond = true;
-    run(new MRPipeline(WordCountTest.class), AvroTypeFamily.getInstance());
-  }
-
-  @Test
-  public void testWithTopWritable() throws IOException {
-    runWithTop(WritableTypeFamily.getInstance());
-  }
-
-  @Test
-  public void testWithTopAvro() throws IOException {
-    runWithTop(AvroTypeFamily.getInstance());
-  }
-
-  public static void runWithTop(PTypeFamily tf) throws IOException {
-    Pipeline pipeline = new MRPipeline(WordCountTest.class);
-    String inputPath = FileHelper.createTempCopyOf("shakes.txt");
-
-    PCollection<String> shakespeare = pipeline.read(At.textFile(inputPath, tf.strings()));
-    PTable<String, Long> wordCount = wordCount(shakespeare, tf);
-    List<Pair<String, Long>> top5 = Lists.newArrayList(Aggregate.top(wordCount, 5, true)
-        .materialize());
-    assertEquals(
-        ImmutableList.of(Pair.of("", 1470L), Pair.of("the", 620L), Pair.of("and", 427L),
-            Pair.of("of", 396L), Pair.of("to", 367L)), top5);
-  }
-
-  public void run(Pipeline pipeline, PTypeFamily typeFamily) throws IOException {
-    String inputPath = FileHelper.createTempCopyOf("shakes.txt");
-    File output = FileHelper.createOutputPath();
-    String outputPath = output.getAbsolutePath();
-
-    PCollection<String> shakespeare = pipeline.read(At.textFile(inputPath, typeFamily.strings()));
-    PTable<String, Long> wordCount = wordCount(shakespeare, typeFamily);
-    if (useToOutput) {
-      wordCount.write(To.textFile(outputPath));
-    } else {
-      pipeline.writeTextFile(wordCount, outputPath);
-    }
-
-    if (runSecond) {
-      File substrCount = File.createTempFile("substr", "");
-      String substrPath = substrCount.getAbsolutePath();
-      substrCount.delete();
-      PTable<String, Long> we = substr(wordCount).groupByKey().combineValues(
-          CombineFn.<String> SUM_LONGS());
-      pipeline.writeTextFile(we, substrPath);
-    }
-    PipelineResult res = pipeline.done();
-    assertTrue(res.succeeded());
-    List<PipelineResult.StageResult> stageResults = res.getStageResults();
-    if (runSecond) {
-      assertEquals(2, stageResults.size());
-    } else {
-      assertEquals(1, stageResults.size());
-      assertEquals(427, stageResults.get(0).getCounterValue(WordCountStats.ANDS));
-    }
-
-    File outputFile = new File(outputPath, "part-r-00000");
-    List<String> lines = Files.readLines(outputFile, Charset.defaultCharset());
-    boolean passed = false;
-    for (String line : lines) {
-      if (line.startsWith("Macbeth\t28")) {
-        passed = true;
-        break;
-      }
-    }
-    assertTrue(passed);
-    output.deleteOnExit();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/fn/ExtractKeyFnTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/fn/ExtractKeyFnTest.java b/src/test/java/org/apache/crunch/fn/ExtractKeyFnTest.java
deleted file mode 100644
index 205809e..0000000
--- a/src/test/java/org/apache/crunch/fn/ExtractKeyFnTest.java
+++ /dev/null
@@ -1,46 +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.crunch.fn;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import org.apache.crunch.MapFn;
-import org.apache.crunch.Pair;
-
-@SuppressWarnings("serial")
-public class ExtractKeyFnTest {
-
-	protected static final MapFn<String, Integer> mapFn = new MapFn<String, Integer>() {
-		@Override
-		public Integer map(String input) {
-			return input.hashCode();
-		}
-	};
-
-	protected static final ExtractKeyFn<Integer, String> one = new ExtractKeyFn<Integer, String>(
-			mapFn);
-
-	@Test
-	public void test() {
-		StoreLastEmitter<Pair<Integer, String>> emitter = StoreLastEmitter.create();
-		one.process("boza", emitter);
-		assertEquals(Pair.of("boza".hashCode(), "boza"), emitter.getLast());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/fn/MapKeysTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/fn/MapKeysTest.java b/src/test/java/org/apache/crunch/fn/MapKeysTest.java
deleted file mode 100644
index 323f276..0000000
--- a/src/test/java/org/apache/crunch/fn/MapKeysTest.java
+++ /dev/null
@@ -1,53 +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.crunch.fn;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import org.apache.crunch.Pair;
-
-
-@SuppressWarnings("serial")
-public class MapKeysTest {
-  
-  protected static final MapKeysFn<String, Integer, Integer> one = new MapKeysFn<String, Integer, Integer>() {
-    @Override
-    public Integer map(String input) {
-      return 1;
-    }
-  };
-  
-  protected static final MapKeysFn<String, Integer, Integer> two = new MapKeysFn<String, Integer, Integer>() {
-    @Override
-    public Integer map(String input) {
-      return 2;
-    }
-  };
-  
-  @Test
-  public void test() {
-    StoreLastEmitter<Pair<Integer, Integer>> emitter = StoreLastEmitter.create();
-    one.process(Pair.of("k", Integer.MAX_VALUE), emitter);
-    assertEquals(Pair.of(1, Integer.MAX_VALUE), emitter.getLast());
-    two.process(Pair.of("k", Integer.MAX_VALUE), emitter);
-    assertEquals(Pair.of(2, Integer.MAX_VALUE), emitter.getLast());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/fn/MapValuesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/fn/MapValuesTest.java b/src/test/java/org/apache/crunch/fn/MapValuesTest.java
deleted file mode 100644
index cf971a1..0000000
--- a/src/test/java/org/apache/crunch/fn/MapValuesTest.java
+++ /dev/null
@@ -1,51 +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.crunch.fn;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import org.apache.crunch.Pair;
-
-@SuppressWarnings("serial")
-public class MapValuesTest {
-  
-  static final MapValuesFn<String, String, Integer> one = new MapValuesFn<String, String, Integer>() {
-    @Override
-    public Integer map(String input) {
-      return 1;
-    }
-  };
-  
-  static final MapValuesFn<String, String, Integer> two = new MapValuesFn<String, String, Integer>() {
-    @Override
-    public Integer map(String input) {
-      return 2;
-    }
-  };
-  
-  @Test
-  public void test() {
-    StoreLastEmitter<Pair<String, Integer>> emitter = StoreLastEmitter.create();
-    one.process(Pair.of("k", "v"), emitter);
-    assertEquals(Pair.of("k", 1), emitter.getLast());
-    two.process(Pair.of("k", "v"), emitter);
-    assertEquals(Pair.of("k", 2), emitter.getLast());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/fn/PairMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/fn/PairMapTest.java b/src/test/java/org/apache/crunch/fn/PairMapTest.java
deleted file mode 100644
index 28e2459..0000000
--- a/src/test/java/org/apache/crunch/fn/PairMapTest.java
+++ /dev/null
@@ -1,53 +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.crunch.fn;
-
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-import org.apache.crunch.MapFn;
-import org.apache.crunch.Pair;
-
-@SuppressWarnings("serial")
-public class PairMapTest {
-  
-  static final MapFn<String, Integer> one = new MapFn<String, Integer>() {
-    @Override
-    public Integer map(String input) {
-      return 1;
-    }
-  };
-  
-  static final MapFn<String, Integer> two = new MapFn<String, Integer>() {
-    @Override
-    public Integer map(String input) {
-      return 2;
-    }
-  };
-  
-  @Test
-  public void testPairMap() {
-    StoreLastEmitter<Pair<Integer, Integer>> emitter = StoreLastEmitter.create();
-    PairMapFn<String, String, Integer, Integer> fn = new PairMapFn<String, String, Integer, Integer>(one, two);
-    fn.process(Pair.of("a", "b"), emitter);
-    Pair<Integer, Integer> pair = emitter.getLast();
-    assertTrue(pair.first() == 1);
-    assertTrue(pair.second() == 2);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/fn/StoreLastEmitter.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/fn/StoreLastEmitter.java b/src/test/java/org/apache/crunch/fn/StoreLastEmitter.java
deleted file mode 100644
index 2632957..0000000
--- a/src/test/java/org/apache/crunch/fn/StoreLastEmitter.java
+++ /dev/null
@@ -1,41 +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.crunch.fn;
-
-import org.apache.crunch.Emitter;
-
-class StoreLastEmitter<T> implements Emitter<T> {
-  private T last;
-
-  @Override
-  public void emit(T emitted) {
-    last = emitted;
-  }
-  
-  public T getLast() {
-    return last;
-  }
-  
-  @Override
-  public void flush() {
-  }
-  
-  public static <T> StoreLastEmitter<T> create() {
-    return new StoreLastEmitter<T>();
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/impl/mem/MemPipelineFileWritingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/impl/mem/MemPipelineFileWritingTest.java b/src/test/java/org/apache/crunch/impl/mem/MemPipelineFileWritingTest.java
deleted file mode 100644
index 442a563..0000000
--- a/src/test/java/org/apache/crunch/impl/mem/MemPipelineFileWritingTest.java
+++ /dev/null
@@ -1,53 +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.crunch.impl.mem;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.util.List;
-
-import org.apache.crunch.PCollection;
-import org.apache.crunch.Pipeline;
-import com.google.common.base.Charsets;
-import com.google.common.collect.ImmutableList;
-import com.google.common.io.Files;
-
-import org.junit.Test;
-
-public class MemPipelineFileWritingTest {
-  @Test
-  public void testMemPipelineFileWriter() throws Exception {
-    File tmpDir = Files.createTempDir();
-    tmpDir.delete();
-    Pipeline p = MemPipeline.getInstance();
-    PCollection<String> lines = MemPipeline.collectionOf("hello", "world");
-    p.writeTextFile(lines, tmpDir.getAbsolutePath());
-    p.done();
-    assertTrue(tmpDir.exists());
-    File[] files = tmpDir.listFiles();
-    assertTrue(files != null && files.length > 0);
-    for (File f : files) {
-      if (!f.getName().startsWith(".")) {
-        List<String> txt = Files.readLines(f, Charsets.UTF_8);
-        assertEquals(ImmutableList.of("hello", "world"), txt);
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/impl/mr/MRPipelineTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/impl/mr/MRPipelineTest.java b/src/test/java/org/apache/crunch/impl/mr/MRPipelineTest.java
deleted file mode 100644
index 9d10e97..0000000
--- a/src/test/java/org/apache/crunch/impl/mr/MRPipelineTest.java
+++ /dev/null
@@ -1,77 +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.crunch.impl.mr;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.crunch.SourceTarget;
-import org.apache.crunch.impl.mr.collect.PCollectionImpl;
-import org.apache.crunch.io.ReadableSourceTarget;
-import org.apache.crunch.types.avro.Avros;
-
-public class MRPipelineTest {
-
-  private MRPipeline pipeline;
-
-  @Before
-  public void setUp() throws IOException {
-    pipeline = spy(new MRPipeline(MRPipelineTest.class));
-  }
-
-  @Test
-  public void testGetMaterializeSourceTarget_AlreadyMaterialized() {
-    PCollectionImpl<String> materializedPcollection = mock(PCollectionImpl.class);
-    ReadableSourceTarget<String> readableSourceTarget = mock(ReadableSourceTarget.class);
-    when(materializedPcollection.getMaterializedAt()).thenReturn(readableSourceTarget);
-
-    assertEquals(readableSourceTarget, pipeline.getMaterializeSourceTarget(materializedPcollection));
-  }
-
-  @Test
-  public void testGetMaterializeSourceTarget_NotMaterialized_HasOutput() {
-
-    PCollectionImpl<String> pcollection = mock(PCollectionImpl.class);
-    ReadableSourceTarget<String> readableSourceTarget = mock(ReadableSourceTarget.class);
-    when(pcollection.getPType()).thenReturn(Avros.strings());
-    doReturn(readableSourceTarget).when(pipeline).createIntermediateOutput(Avros.strings());
-    when(pcollection.getMaterializedAt()).thenReturn(null);
-
-    assertEquals(readableSourceTarget, pipeline.getMaterializeSourceTarget(pcollection));
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testGetMaterializeSourceTarget_NotMaterialized_NotReadableSourceTarget() {
-    PCollectionImpl<String> pcollection = mock(PCollectionImpl.class);
-    SourceTarget<String> nonReadableSourceTarget = mock(SourceTarget.class);
-    when(pcollection.getPType()).thenReturn(Avros.strings());
-    doReturn(nonReadableSourceTarget).when(pipeline).createIntermediateOutput(Avros.strings());
-    when(pcollection.getMaterializedAt()).thenReturn(null);
-
-    pipeline.getMaterializeSourceTarget(pcollection);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/impl/mr/collect/DoCollectionImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/impl/mr/collect/DoCollectionImplTest.java b/src/test/java/org/apache/crunch/impl/mr/collect/DoCollectionImplTest.java
deleted file mode 100644
index 96fbd7e..0000000
--- a/src/test/java/org/apache/crunch/impl/mr/collect/DoCollectionImplTest.java
+++ /dev/null
@@ -1,118 +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.crunch.impl.mr.collect;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-
-import org.junit.Test;
-
-import org.apache.crunch.DoFn;
-import org.apache.crunch.Emitter;
-import org.apache.crunch.impl.mr.plan.DoNode;
-import org.apache.crunch.types.PType;
-import org.apache.crunch.types.writable.Writables;
-
-public class DoCollectionImplTest {
-  
-  
-
-  @Test
-  public void testGetSizeInternal_NoScaleFactor() {
-    runScaleTest(100L, 1.0f, 100L);
-  }
-  
-  @Test
-  public void testGetSizeInternal_ScaleFactorBelowZero() {
-    runScaleTest(100L, 0.5f, 50L);
-  }
-  
-  @Test
-  public void testGetSizeInternal_ScaleFactorAboveZero() {
-    runScaleTest(100L, 1.5f, 150L);
-  }
-  
-  private void runScaleTest(long inputSize, float scaleFactor, long expectedScaledSize){
-    PCollectionImpl<String> parentCollection = new SizedPCollectionImpl(
-        "Sized collection", inputSize);
-    
-    DoCollectionImpl<String> doCollectionImpl = new DoCollectionImpl<String>(
-        "Scaled collection", parentCollection, new ScaledFunction(scaleFactor),
-        Writables.strings());
-
-    assertEquals(expectedScaledSize, doCollectionImpl.getSizeInternal()); 
-  }
-  
-
-  static class ScaledFunction extends DoFn<String, String>{
-    
-    private float scaleFactor;
-
-    public ScaledFunction(float scaleFactor){
-      this.scaleFactor = scaleFactor;
-    }
-
-    @Override
-    public void process(String input, Emitter<String> emitter) {
-      emitter.emit(input);
-    }
-    
-    @Override
-    public float scaleFactor() {
-      return scaleFactor;
-    }
-    
-  }
-
-  static class SizedPCollectionImpl extends PCollectionImpl<String> {
-
-    private long internalSize;
-
-    public SizedPCollectionImpl(String name, long internalSize) {
-      super(name);
-      this.internalSize = internalSize;
-    }
-
-    @Override
-    public PType getPType() {
-      return null;
-    }
-
-    @Override
-    public DoNode createDoNode() {
-      return null;
-    }
-
-    @Override
-    public List getParents() {
-      return null;
-    }
-
-    @Override
-    protected void acceptInternal(Visitor visitor) {
-    }
-
-    @Override
-    protected long getSizeInternal() {
-      return internalSize;
-    }
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/impl/mr/collect/DoTableImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/impl/mr/collect/DoTableImplTest.java b/src/test/java/org/apache/crunch/impl/mr/collect/DoTableImplTest.java
deleted file mode 100644
index d5a9722..0000000
--- a/src/test/java/org/apache/crunch/impl/mr/collect/DoTableImplTest.java
+++ /dev/null
@@ -1,88 +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.crunch.impl.mr.collect;
-
-import static org.apache.crunch.types.writable.Writables.strings;
-import static org.apache.crunch.types.writable.Writables.tableOf;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-import static org.mockito.Mockito.when;
-
-import org.junit.Test;
-
-import org.apache.crunch.DoFn;
-import org.apache.crunch.Emitter;
-import org.apache.crunch.Pair;
-
-public class DoTableImplTest {
-
-	@Test
-	public void testGetSizeInternal_NoScaleFactor() {
-		runScaleTest(100L, 1.0f, 100L);
-	}
-
-	@Test
-	public void testGetSizeInternal_ScaleFactorBelowZero() {
-		runScaleTest(100L, 0.5f, 50L);
-	}
-
-	@Test
-	public void testGetSizeInternal_ScaleFactorAboveZero() {
-		runScaleTest(100L, 1.5f, 150L);
-	}
-
-	private void runScaleTest(long inputSize, float scaleFactor, long expectedScaledSize) {
-		
-		@SuppressWarnings("unchecked")
-		PCollectionImpl<String> parentCollection = (PCollectionImpl<String>) mock(PCollectionImpl.class);
-		
-		when(parentCollection.getSize()).thenReturn(inputSize);
-
-		DoTableImpl<String, String> doTableImpl = new DoTableImpl<String, String>("Scalled table collection",
-				parentCollection, new TableScaledFunction(scaleFactor), tableOf(strings(),
-						strings()));
-
-		assertEquals(expectedScaledSize, doTableImpl.getSizeInternal());
-		
-		verify(parentCollection).getSize();
-		
-		verifyNoMoreInteractions(parentCollection);
-	}
-
-	static class TableScaledFunction extends DoFn<String, Pair<String, String>> {
-
-		private float scaleFactor;
-
-		public TableScaledFunction(float scaleFactor) {
-			this.scaleFactor = scaleFactor;
-		}
-
-		@Override
-		public float scaleFactor() {
-			return scaleFactor;
-		}
-
-		@Override
-		public void process(String input, Emitter<Pair<String, String>> emitter) {
-			emitter.emit(Pair.of(input, input));
-
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/impl/mr/collect/UnionCollectionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/impl/mr/collect/UnionCollectionTest.java b/src/test/java/org/apache/crunch/impl/mr/collect/UnionCollectionTest.java
deleted file mode 100644
index 7347383..0000000
--- a/src/test/java/org/apache/crunch/impl/mr/collect/UnionCollectionTest.java
+++ /dev/null
@@ -1,161 +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.crunch.impl.mr.collect;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-import org.apache.crunch.PCollection;
-import org.apache.crunch.PTableKeyValueTest;
-import org.apache.crunch.Pipeline;
-import org.apache.crunch.impl.mem.MemPipeline;
-import org.apache.crunch.impl.mr.MRPipeline;
-import org.apache.crunch.io.At;
-import org.apache.crunch.io.To;
-import org.apache.crunch.test.FileHelper;
-import org.apache.crunch.types.PTypeFamily;
-import org.apache.crunch.types.avro.AvroTypeFamily;
-import org.apache.crunch.types.avro.Avros;
-import org.apache.crunch.types.writable.WritableTypeFamily;
-import com.google.common.collect.Lists;
-
-@RunWith(value = Parameterized.class)
-public class UnionCollectionTest {
-
-	private static final Log LOG = LogFactory.getLog(UnionCollectionTest.class);
-
-	private PTypeFamily typeFamily;
-	private Pipeline pipeline;
-	private PCollection<String> union;
-
-	private ArrayList<String> EXPECTED = Lists.newArrayList("a", "a", "b", "c", "c", "d", "e");
-
-	@Before
-	@SuppressWarnings("unchecked")
-	public void setUp() throws IOException {
-		String inputFile1 = FileHelper.createTempCopyOf("set1.txt");
-		String inputFile2 = FileHelper.createTempCopyOf("set2.txt");
-
-		PCollection<String> firstCollection = pipeline.read(At.textFile(inputFile1,
-				typeFamily.strings()));
-		PCollection<String> secondCollection = pipeline.read(At.textFile(inputFile2,
-				typeFamily.strings()));
-
-		LOG.info("Test fixture: [" + pipeline.getClass().getSimpleName() + " : "
-				+ typeFamily.getClass().getSimpleName() + "]  First: "
-				+ Lists.newArrayList(firstCollection.materialize().iterator()) + ", Second: "
-				+ Lists.newArrayList(secondCollection.materialize().iterator()));
-
-		union = secondCollection.union(firstCollection);
-	}
-
-	@After
-	public void tearDown() {
-		pipeline.done();
-	}
-
-	@Parameters
-	public static Collection<Object[]> data() throws IOException {
-		Object[][] data = new Object[][] {
-				{ WritableTypeFamily.getInstance(), new MRPipeline(PTableKeyValueTest.class) },
-				{ WritableTypeFamily.getInstance(), MemPipeline.getInstance() },
-				{ AvroTypeFamily.getInstance(), new MRPipeline(PTableKeyValueTest.class) },
-				{ AvroTypeFamily.getInstance(), MemPipeline.getInstance() } };
-		return Arrays.asList(data);
-	}
-
-	public UnionCollectionTest(PTypeFamily typeFamily, Pipeline pipeline) {
-		this.typeFamily = typeFamily;
-		this.pipeline = pipeline;
-	}
-
-	@Test
-	public void unionMaterializeShouldNotThrowNPE() {
-		checkMaterialized(union.materialize());
-		checkMaterialized(pipeline.materialize(union));
-	}
-
-	private void checkMaterialized(Iterable<String> materialized) {
-
-		List<String> materializedValues = Lists.newArrayList(materialized.iterator());
-		Collections.sort(materializedValues);
-		LOG.info("Materialized union: " + materializedValues);
-
-		assertEquals(EXPECTED, materializedValues);
-	}
-
-	@Test
-	public void unionWriteShouldNotThrowNPE() throws IOException {
-
-		File outputPath1 = FileHelper.createOutputPath();
-		File outputPath2 = FileHelper.createOutputPath();
-		File outputPath3 = FileHelper.createOutputPath();
-
-		if (typeFamily == AvroTypeFamily.getInstance()) {
-			union.write(To.avroFile(outputPath1.getAbsolutePath()));
-			pipeline.write(union, To.avroFile(outputPath2.getAbsolutePath()));
-
-			pipeline.run();
-
-			checkFileContents(outputPath1.getAbsolutePath());
-			checkFileContents(outputPath2.getAbsolutePath());
-
-		} else {
-
-			union.write(To.textFile(outputPath1.getAbsolutePath()));
-			pipeline.write(union, To.textFile(outputPath2.getAbsolutePath()));
-			pipeline.writeTextFile(union, outputPath3.getAbsolutePath());
-
-			pipeline.run();
-
-			checkFileContents(outputPath1.getAbsolutePath());
-			checkFileContents(outputPath2.getAbsolutePath());
-			checkFileContents(outputPath3.getAbsolutePath());
-		}
-
-	}
-
-	private void checkFileContents(String filePath) throws IOException {
-
-		List<String> fileContentValues = (typeFamily != AvroTypeFamily.getInstance() || !(pipeline instanceof MRPipeline)) ? Lists
-				.newArrayList(pipeline.read(At.textFile(filePath, typeFamily.strings())).materialize()
-						.iterator()) : Lists.newArrayList(pipeline.read(At.avroFile(filePath, Avros.strings()))
-				.materialize().iterator());
-
-		Collections.sort(fileContentValues);
-
-		LOG.info("Saved Union: " + fileContentValues);
-		assertEquals(EXPECTED, fileContentValues);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/impl/mr/plan/JobNameBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/impl/mr/plan/JobNameBuilderTest.java b/src/test/java/org/apache/crunch/impl/mr/plan/JobNameBuilderTest.java
deleted file mode 100644
index 0e0b9d8..0000000
--- a/src/test/java/org/apache/crunch/impl/mr/plan/JobNameBuilderTest.java
+++ /dev/null
@@ -1,41 +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.crunch.impl.mr.plan;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import org.apache.crunch.types.writable.Writables;
-import com.google.common.collect.Lists;
-
-public class JobNameBuilderTest {
-
-  @Test
-  public void testBuild() {
-    final String pipelineName = "PipelineName";
-    final String nodeName = "outputNode";
-    DoNode doNode = DoNode.createOutputNode(nodeName, Writables.strings());
-    JobNameBuilder jobNameBuilder = new JobNameBuilder(pipelineName);
-    jobNameBuilder.visit(Lists.newArrayList(doNode));
-    String jobName = jobNameBuilder.build();
-    
-    assertEquals(String.format("%s: %s", pipelineName, nodeName), jobName);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/io/CompositePathIterableTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/io/CompositePathIterableTest.java b/src/test/java/org/apache/crunch/io/CompositePathIterableTest.java
deleted file mode 100644
index f32873c..0000000
--- a/src/test/java/org/apache/crunch/io/CompositePathIterableTest.java
+++ /dev/null
@@ -1,81 +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.crunch.io;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.LocalFileSystem;
-import org.apache.hadoop.fs.Path;
-import org.junit.Test;
-
-import org.apache.crunch.io.text.TextFileReaderFactory;
-import org.apache.crunch.test.FileHelper;
-import org.apache.crunch.types.writable.Writables;
-import com.google.common.collect.Lists;
-import com.google.common.io.Files;
-
-
-public class CompositePathIterableTest {
-
-  
-  @Test
-  public void testCreate_FilePresent() throws IOException{
-    String inputFilePath = FileHelper.createTempCopyOf("set1.txt");
-    Configuration conf = new Configuration();
-    LocalFileSystem local = FileSystem.getLocal(conf);
-    
-    Iterable<String> iterable = CompositePathIterable.create(local, new Path(inputFilePath), new TextFileReaderFactory<String>(Writables.strings(), conf));
-    
-    assertEquals(Lists.newArrayList("b", "c", "a", "e"), Lists.newArrayList(iterable));
-    
-  }
-  
-  @Test
-  public void testCreate_DirectoryPresentButNoFiles() throws IOException{
-    String inputFilePath = Files.createTempDir().getAbsolutePath();
- 
-    Configuration conf = new Configuration();
-    LocalFileSystem local = FileSystem.getLocal(conf);
-    
-    Iterable<String> iterable = CompositePathIterable.create(local, new Path(inputFilePath), new TextFileReaderFactory<String>(Writables.strings(), conf));
-    
-    assertTrue(Lists.newArrayList(iterable).isEmpty());
-  }
-  
-  @Test(expected=IOException.class)
-  public void testCreate_DirectoryNotPresent() throws IOException{
-    File inputFileDir = Files.createTempDir();
-    inputFileDir.delete();
-    
-    // Sanity check
-    assertFalse(inputFileDir.exists());
-    
-    Configuration conf = new Configuration();
-    LocalFileSystem local = FileSystem.getLocal(conf);
-    
-    CompositePathIterable.create(local, new Path(inputFileDir.getAbsolutePath()), new TextFileReaderFactory<String>(Writables.strings(), conf));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/io/SourceTargetHelperTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/io/SourceTargetHelperTest.java b/src/test/java/org/apache/crunch/io/SourceTargetHelperTest.java
deleted file mode 100644
index a1dbb5f..0000000
--- a/src/test/java/org/apache/crunch/io/SourceTargetHelperTest.java
+++ /dev/null
@@ -1,59 +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.crunch.io;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.LocalFileSystem;
-import org.apache.hadoop.fs.Path;
-import org.junit.Test;
-
-public class SourceTargetHelperTest {
-
-	@Test
-	public void testGetNonexistentPathSize() throws Exception {
-		File tmp = File.createTempFile("pathsize", "");
-		Path tmpPath = new Path(tmp.getAbsolutePath());
-		tmp.delete();
-		FileSystem fs = FileSystem.getLocal(new Configuration());
-		assertEquals(-1L, SourceTargetHelper.getPathSize(fs, tmpPath));
-	}
-
-	@Test
-	public void testGetNonExistentPathSize_NonExistantPath() throws IOException {
-		FileSystem mockFs = new MockFileSystem();
-		assertEquals(-1L, SourceTargetHelper.getPathSize(mockFs, new Path("does/not/exist")));
-	}
-
-	/**
-	 * Mock FileSystem that returns null for {@link FileSystem#listStatus(Path)}.
-	 */
-	static class MockFileSystem extends LocalFileSystem {
-
-		@Override
-		public FileStatus[] listStatus(Path f) throws IOException {
-			return null;
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/io/avro/AvroFileReaderFactoryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/io/avro/AvroFileReaderFactoryTest.java b/src/test/java/org/apache/crunch/io/avro/AvroFileReaderFactoryTest.java
deleted file mode 100644
index 885ed61..0000000
--- a/src/test/java/org/apache/crunch/io/avro/AvroFileReaderFactoryTest.java
+++ /dev/null
@@ -1,158 +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.crunch.io.avro;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.avro.Schema;
-import org.apache.avro.file.DataFileWriter;
-import org.apache.avro.generic.GenericData;
-import org.apache.avro.generic.GenericDatumWriter;
-import org.apache.avro.generic.GenericRecord;
-import org.apache.avro.reflect.ReflectData;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.crunch.test.Person;
-import org.apache.crunch.types.avro.Avros;
-import com.google.common.collect.Lists;
-
-public class AvroFileReaderFactoryTest {
-
-	private File avroFile;
-
-	@Before
-	public void setUp() throws IOException {
-		// InputSupplier<InputStream> inputStreamSupplier =
-		// newInputStreamSupplier(getResource("person.avro"));
-		avroFile = File.createTempFile("test", ".av");
-	}
-
-	@After
-	public void tearDown() {
-		avroFile.delete();
-	}
-
-	private void populateGenericFile(List<GenericRecord> genericRecords,
-			Schema outputSchema) throws IOException {
-		FileOutputStream outputStream = new FileOutputStream(this.avroFile);
-		GenericDatumWriter<GenericRecord> genericDatumWriter = new GenericDatumWriter<GenericRecord>(
-				outputSchema);
-
-		DataFileWriter<GenericRecord> dataFileWriter = new DataFileWriter<GenericRecord>(
-				genericDatumWriter);
-		dataFileWriter.create(outputSchema, outputStream);
-
-		for (GenericRecord record : genericRecords) {
-			dataFileWriter.append(record);
-		}
-
-		dataFileWriter.close();
-		outputStream.close();
-
-	}
-
-	@Test
-	public void testRead_GenericReader() throws IOException {
-		GenericRecord savedRecord = new GenericData.Record(Person.SCHEMA$);
-		savedRecord.put("name", "John Doe");
-		savedRecord.put("age", 42);
-		savedRecord.put("siblingnames", Lists.newArrayList("Jimmy", "Jane"));
-		populateGenericFile(Lists.newArrayList(savedRecord), Person.SCHEMA$);
-
-		AvroFileReaderFactory<GenericData.Record> genericReader = new AvroFileReaderFactory<GenericData.Record>(
-				Avros.generics(Person.SCHEMA$), new Configuration());
-		Iterator<GenericData.Record> recordIterator = genericReader.read(
-				FileSystem.getLocal(new Configuration()), new Path(
-						this.avroFile.getAbsolutePath()));
-
-		GenericRecord genericRecord = recordIterator.next();
-		assertEquals(savedRecord, genericRecord);
-		assertFalse(recordIterator.hasNext());
-	}
-
-	@Test
-	public void testRead_SpecificReader() throws IOException {
-		GenericRecord savedRecord = new GenericData.Record(Person.SCHEMA$);
-		savedRecord.put("name", "John Doe");
-		savedRecord.put("age", 42);
-		savedRecord.put("siblingnames", Lists.newArrayList("Jimmy", "Jane"));
-		populateGenericFile(Lists.newArrayList(savedRecord), Person.SCHEMA$);
-
-		AvroFileReaderFactory<Person> genericReader = new AvroFileReaderFactory<Person>(
-				Avros.records(Person.class), new Configuration());
-		Iterator<Person> recordIterator = genericReader.read(FileSystem
-				.getLocal(new Configuration()),
-				new Path(this.avroFile.getAbsolutePath()));
-
-		Person expectedPerson = new Person();
-		expectedPerson.setAge(42);
-		expectedPerson.setName("John Doe");
-		List<CharSequence> siblingNames = Lists.newArrayList();
-		siblingNames.add("Jimmy");
-		siblingNames.add("Jane");
-		expectedPerson.setSiblingnames(siblingNames);
-
-		Person person = recordIterator.next();
-
-		assertEquals(expectedPerson, person);
-		assertFalse(recordIterator.hasNext());
-	}
-
-	@Test
-	public void testRead_ReflectReader() throws IOException {
-		Schema reflectSchema = ReflectData.get().getSchema(PojoPerson.class);
-		GenericRecord savedRecord = new GenericData.Record(reflectSchema);
-		savedRecord.put("name", "John Doe");
-		populateGenericFile(Lists.newArrayList(savedRecord), reflectSchema);
-
-		AvroFileReaderFactory<PojoPerson> genericReader = new AvroFileReaderFactory<PojoPerson>(
-				Avros.reflects(PojoPerson.class), new Configuration());
-		Iterator<PojoPerson> recordIterator = genericReader.read(FileSystem
-				.getLocal(new Configuration()),
-				new Path(this.avroFile.getAbsolutePath()));
-
-		PojoPerson person = recordIterator.next();
-
-		assertEquals("John Doe", person.getName());
-		assertFalse(recordIterator.hasNext());
-	}
-
-	public static class PojoPerson {
-		private String name;
-
-		public String getName() {
-			return name;
-		}
-
-		public void setName(String name) {
-			this.name = name;
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/io/avro/AvroFileSourceTargetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/io/avro/AvroFileSourceTargetTest.java b/src/test/java/org/apache/crunch/io/avro/AvroFileSourceTargetTest.java
deleted file mode 100644
index 599f569..0000000
--- a/src/test/java/org/apache/crunch/io/avro/AvroFileSourceTargetTest.java
+++ /dev/null
@@ -1,153 +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.crunch.io.avro;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.List;
-
-import org.apache.avro.Schema;
-import org.apache.avro.file.DataFileWriter;
-import org.apache.avro.generic.GenericData;
-import org.apache.avro.generic.GenericData.Record;
-import org.apache.avro.generic.GenericDatumWriter;
-import org.apache.avro.generic.GenericRecord;
-import org.apache.avro.reflect.ReflectData;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.crunch.PCollection;
-import org.apache.crunch.Pipeline;
-import org.apache.crunch.impl.mr.MRPipeline;
-import org.apache.crunch.io.At;
-import org.apache.crunch.io.avro.AvroFileReaderFactoryTest.PojoPerson;
-import org.apache.crunch.test.Person;
-import org.apache.crunch.types.avro.Avros;
-import com.google.common.collect.Lists;
-
-@SuppressWarnings("serial")
-public class AvroFileSourceTargetTest implements Serializable {
-
-	private transient File avroFile;
-
-	@Before
-	public void setUp() throws IOException {
-		avroFile = File.createTempFile("test", ".avro");
-	}
-
-	@After
-	public void tearDown() {
-		avroFile.delete();
-	}
-
-	private void populateGenericFile(List<GenericRecord> genericRecords,
-			Schema schema) throws IOException {
-		FileOutputStream outputStream = new FileOutputStream(this.avroFile);
-		GenericDatumWriter<GenericRecord> genericDatumWriter = new GenericDatumWriter<GenericRecord>(
-				schema);
-
-		DataFileWriter<GenericRecord> dataFileWriter = new DataFileWriter<GenericRecord>(
-				genericDatumWriter);
-		dataFileWriter.create(schema, outputStream);
-
-		for (GenericRecord record : genericRecords) {
-			dataFileWriter.append(record);
-		}
-
-		dataFileWriter.close();
-		outputStream.close();
-
-	}
-
-	@Test
-	public void testSpecific() throws IOException {
-		GenericRecord savedRecord = new GenericData.Record(Person.SCHEMA$);
-		savedRecord.put("name", "John Doe");
-		savedRecord.put("age", 42);
-		savedRecord.put("siblingnames", Lists.newArrayList("Jimmy", "Jane"));
-		populateGenericFile(Lists.newArrayList(savedRecord), Person.SCHEMA$);
-
-		Pipeline pipeline = new MRPipeline(AvroFileSourceTargetTest.class);
-		PCollection<Person> genericCollection = pipeline.read(At.avroFile(
-				avroFile.getAbsolutePath(), Avros.records(Person.class)));
-
-		List<Person> personList = Lists.newArrayList(genericCollection
-				.materialize());
-
-		Person expectedPerson = new Person();
-		expectedPerson.setName("John Doe");
-		expectedPerson.setAge(42);
-
-		List<CharSequence> siblingNames = Lists.newArrayList();
-		siblingNames.add("Jimmy");
-		siblingNames.add("Jane");
-		expectedPerson.setSiblingnames(siblingNames);
-
-		assertEquals(Lists.newArrayList(expectedPerson),
-				Lists.newArrayList(personList));
-	}
-
-	@Test
-	public void testGeneric() throws IOException {
-		String genericSchemaJson = Person.SCHEMA$.toString().replace("Person",
-				"GenericPerson");
-		Schema genericPersonSchema = new Schema.Parser()
-				.parse(genericSchemaJson);
-		GenericRecord savedRecord = new GenericData.Record(genericPersonSchema);
-		savedRecord.put("name", "John Doe");
-		savedRecord.put("age", 42);
-		savedRecord.put("siblingnames", Lists.newArrayList("Jimmy", "Jane"));
-		populateGenericFile(Lists.newArrayList(savedRecord),
-				genericPersonSchema);
-
-		Pipeline pipeline = new MRPipeline(AvroFileSourceTargetTest.class);
-		PCollection<Record> genericCollection = pipeline
-				.read(At.avroFile(avroFile.getAbsolutePath(),
-						Avros.generics(genericPersonSchema)));
-
-		List<Record> recordList = Lists.newArrayList(genericCollection
-				.materialize());
-
-		assertEquals(Lists.newArrayList(savedRecord),
-				Lists.newArrayList(recordList));
-	}
-
-	@Test
-	public void testReflect() throws IOException {
-		Schema pojoPersonSchema = ReflectData.get().getSchema(PojoPerson.class);
-		GenericRecord savedRecord = new GenericData.Record(pojoPersonSchema);
-		savedRecord.put("name", "John Doe");
-		populateGenericFile(Lists.newArrayList(savedRecord), pojoPersonSchema);
-
-		Pipeline pipeline = new MRPipeline(AvroFileSourceTargetTest.class);
-		PCollection<PojoPerson> personCollection = pipeline.read(At.avroFile(
-				avroFile.getAbsolutePath(), Avros.reflects(PojoPerson.class)));
-
-		List<PojoPerson> recordList = Lists.newArrayList(personCollection
-				.materialize());
-
-		assertEquals(1, recordList.size());
-		PojoPerson person = recordList.get(0);
-		assertEquals("John Doe", person.getName());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/83acb813/src/test/java/org/apache/crunch/io/avro/AvroFileSourceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/crunch/io/avro/AvroFileSourceTest.java b/src/test/java/org/apache/crunch/io/avro/AvroFileSourceTest.java
deleted file mode 100644
index 1f04c67..0000000
--- a/src/test/java/org/apache/crunch/io/avro/AvroFileSourceTest.java
+++ /dev/null
@@ -1,82 +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.crunch.io.avro;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.avro.generic.GenericData.Record;
-import org.apache.avro.mapred.AvroJob;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.mapreduce.Job;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.crunch.test.Person;
-import org.apache.crunch.types.avro.AvroType;
-import org.apache.crunch.types.avro.Avros;
-
-public class AvroFileSourceTest {
-
-	private Job job;
-	File tempFile;
-
-	@Before
-	public void setUp() throws IOException {
-		job = new Job();
-		tempFile = File.createTempFile("test", ".avr");
-	}
-
-	@After
-	public void tearDown() {
-		tempFile.delete();
-	}
-
-	@Test
-	public void testConfigureJob_SpecificData() throws IOException {
-		AvroType<Person> avroSpecificType = Avros.records(Person.class);
-		AvroFileSource<Person> personFileSource = new AvroFileSource<Person>(
-				new Path(tempFile.getAbsolutePath()), avroSpecificType);
-
-		personFileSource.configureSource(job, -1);
-
-		assertFalse(job.getConfiguration().getBoolean(AvroJob.INPUT_IS_REFLECT,
-				true));
-		assertEquals(Person.SCHEMA$.toString(),
-				job.getConfiguration().get(AvroJob.INPUT_SCHEMA));
-	}
-
-	@Test
-	public void testConfigureJob_GenericData() throws IOException {
-		AvroType<Record> avroGenericType = Avros.generics(Person.SCHEMA$);
-		AvroFileSource<Record> personFileSource = new AvroFileSource<Record>(
-				new Path(tempFile.getAbsolutePath()), avroGenericType);
-
-		personFileSource.configureSource(job, -1);
-
-		assertTrue(job.getConfiguration().getBoolean(AvroJob.INPUT_IS_REFLECT,
-				false));
-
-	}
-
-}


Mime
View raw message