incubator-crunch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwi...@apache.org
Subject git commit: CRUNCH-52: Fix integration tests to run under CI
Date Sat, 08 Sep 2012 05:27:01 GMT
Updated Branches:
  refs/heads/master 32c33eb6c -> 867314ef6


CRUNCH-52: Fix integration tests to run under CI


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

Branch: refs/heads/master
Commit: 867314ef6dd255fa33d38fa2763499dccead256b
Parents: 32c33eb
Author: Josh Wills <jwills@apache.org>
Authored: Fri Sep 7 22:26:05 2012 -0700
Committer: Josh Wills <jwills@apache.org>
Committed: Fri Sep 7 22:26:05 2012 -0700

----------------------------------------------------------------------
 .../crunch/io/avro/AvroFileSourceTargetIT.java     |    7 +----
 .../org/apache/crunch/io/avro/AvroPipelineIT.java  |   20 +++++---------
 2 files changed, 8 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/867314ef/crunch/src/it/java/org/apache/crunch/io/avro/AvroFileSourceTargetIT.java
----------------------------------------------------------------------
diff --git a/crunch/src/it/java/org/apache/crunch/io/avro/AvroFileSourceTargetIT.java b/crunch/src/it/java/org/apache/crunch/io/avro/AvroFileSourceTargetIT.java
index 7334e91..5deacd1 100644
--- a/crunch/src/it/java/org/apache/crunch/io/avro/AvroFileSourceTargetIT.java
+++ b/crunch/src/it/java/org/apache/crunch/io/avro/AvroFileSourceTargetIT.java
@@ -57,12 +57,7 @@ public class AvroFileSourceTargetIT implements Serializable {
 
   @Before
   public void setUp() throws IOException {
-    avroFile = File.createTempFile("test", ".avro");
-  }
-
-  @After
-  public void tearDown() {
-    avroFile.delete();
+    avroFile = tmpDir.getFile("test.avro");
   }
 
   private void populateGenericFile(List<GenericRecord> genericRecords, Schema schema)
throws IOException {

http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/867314ef/crunch/src/it/java/org/apache/crunch/io/avro/AvroPipelineIT.java
----------------------------------------------------------------------
diff --git a/crunch/src/it/java/org/apache/crunch/io/avro/AvroPipelineIT.java b/crunch/src/it/java/org/apache/crunch/io/avro/AvroPipelineIT.java
index b096a42..22892ec 100644
--- a/crunch/src/it/java/org/apache/crunch/io/avro/AvroPipelineIT.java
+++ b/crunch/src/it/java/org/apache/crunch/io/avro/AvroPipelineIT.java
@@ -41,7 +41,6 @@ import org.apache.crunch.test.Person;
 import org.apache.crunch.test.TemporaryPath;
 import org.apache.crunch.test.TemporaryPaths;
 import org.apache.crunch.types.avro.Avros;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -56,12 +55,7 @@ public class AvroPipelineIT implements Serializable {
 
   @Before
   public void setUp() throws IOException {
-    avroFile = File.createTempFile("test", ".avro");
-  }
-
-  @After
-  public void tearDown() {
-    avroFile.delete();
+    avroFile = tmpDir.getFile("test.avro");
   }
 
   private void populateGenericFile(List<GenericRecord> genericRecords, Schema schema)
throws IOException {
@@ -91,17 +85,17 @@ public class AvroPipelineIT implements Serializable {
     Pipeline pipeline = new MRPipeline(AvroFileSourceTargetIT.class, tmpDir.getDefaultConfiguration());
     PCollection<Person> genericCollection = pipeline.read(At.avroFile(avroFile.getAbsolutePath(),
         Avros.records(Person.class)));
-    File file = tmpDir.getRootFile();
-    Target textFile = To.textFile(file.getAbsolutePath());
+    File outputFile = tmpDir.getFile("output");
+    Target textFile = To.textFile(outputFile.getAbsolutePath());
     pipeline.write(genericCollection, textFile);
     pipeline.run();
     Person person = genericCollection.materialize().iterator().next();
-    Collection<File> listFiles = FileUtils.listFiles(file, null, false);
-    File outputFile = null;
+    Collection<File> listFiles = FileUtils.listFiles(outputFile, null, false);
+    File partFile = null;
     for (File foundfile : listFiles) {
-      outputFile = foundfile;
+      partFile = foundfile;
     }
-    String outputString = FileUtils.readFileToString(outputFile);
+    String outputString = FileUtils.readFileToString(partFile);
     assertTrue(outputString.contains(person.toString()));
   }
 }


Mime
View raw message