You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/04/28 19:18:05 UTC

incubator-tinkerpop git commit: touchups to TestFileReaderWriterHelper.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 0b8b40eb6 -> ab1aaf22a


touchups to TestFileReaderWriterHelper.


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

Branch: refs/heads/master
Commit: ab1aaf22a7db1b04a3270851735eb124a03ca3ad
Parents: 0b8b40e
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Apr 28 11:17:52 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Apr 28 11:18:01 2015 -0600

----------------------------------------------------------------------
 .../computer/giraph/GiraphWorkerContext.java    |  1 -
 .../io/TestFileReaderWriterHelper.java          | 22 ++++++++++----------
 2 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ab1aaf22/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphWorkerContext.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphWorkerContext.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphWorkerContext.java
index 363c945..84a1888 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphWorkerContext.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/giraph/GiraphWorkerContext.java
@@ -26,7 +26,6 @@ import org.apache.tinkerpop.gremlin.hadoop.structure.util.ConfUtil;
 import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
 import org.apache.tinkerpop.gremlin.process.computer.util.ImmutableMemory;
 import org.apache.tinkerpop.gremlin.process.computer.util.VertexProgramPool;
-import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoPool;
 
 import java.util.Iterator;
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ab1aaf22/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/TestFileReaderWriterHelper.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/TestFileReaderWriterHelper.java b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/TestFileReaderWriterHelper.java
index e68355a..40afcbe 100644
--- a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/TestFileReaderWriterHelper.java
+++ b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/TestFileReaderWriterHelper.java
@@ -21,6 +21,7 @@
 
 package org.apache.tinkerpop.gremlin.hadoop.structure.io;
 
+import com.typesafe.config.ConfigException;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.LocalFileSystem;
 import org.apache.hadoop.fs.Path;
@@ -63,7 +64,7 @@ public class TestFileReaderWriterHelper {
         return splits;
     }
 
-    public static void validateFileSplits(final List<FileSplit> fileSplits, final Class<? extends InputFormat> inputFormatClass, final Optional<Class<? extends OutputFormat>> outFormatClass) throws Exception {
+    public static void validateFileSplits(final List<FileSplit> fileSplits, final Class<? extends InputFormat<NullWritable,VertexWritable>> inputFormatClass, final Optional<Class<? extends OutputFormat<NullWritable,VertexWritable>>> outFormatClass) throws Exception {
         File outputDirectory = TestHelper.makeTestDataPath(inputFormatClass, "hadoop-record-reader-writer-test");
         final Configuration configuration = new Configuration(false);
         configuration.set("fs.file.impl", LocalFileSystem.class.getName());
@@ -76,8 +77,8 @@ public class TestFileReaderWriterHelper {
         int outEdgeCount = 0;
         int inEdgeCount = 0;
 
-        final OutputFormat outputFormat = outFormatClass.isPresent() ? ReflectionUtils.newInstance(outFormatClass.get(), configuration) : null;
-        final RecordWriter writer = null == outputFormat ? null : outputFormat.getRecordWriter(job);
+        final OutputFormat<NullWritable,VertexWritable> outputFormat = outFormatClass.isPresent() ? ReflectionUtils.newInstance(outFormatClass.get(), configuration) : null;
+        final RecordWriter<NullWritable,VertexWritable> writer = null == outputFormat ? null : outputFormat.getRecordWriter(job);
 
         boolean foundKeyValue = false;
         for (final FileSplit split : fileSplits) {
@@ -90,16 +91,15 @@ public class TestFileReaderWriterHelper {
                 final float progress = reader.getProgress();
                 assertTrue(progress >= lastProgress);
                 assertEquals(NullWritable.class, reader.getCurrentKey().getClass());
-                final VertexWritable v = (VertexWritable) reader.getCurrentValue();
-                if (null != writer) writer.write(NullWritable.get(), v);
+                final VertexWritable vertexWritable = (VertexWritable) reader.getCurrentValue();
+                if (null != writer) writer.write(NullWritable.get(), vertexWritable);
                 vertexCount++;
-                outEdgeCount = outEdgeCount + (int) IteratorUtils.count(v.get().edges(Direction.OUT));
-                inEdgeCount = inEdgeCount + (int) IteratorUtils.count(v.get().edges(Direction.IN));
-
-                final Vertex vertex = v.get();
+                outEdgeCount = outEdgeCount + (int) IteratorUtils.count(vertexWritable.get().edges(Direction.OUT));
+                inEdgeCount = inEdgeCount + (int) IteratorUtils.count(vertexWritable.get().edges(Direction.IN));
+                //
+                final Vertex vertex = vertexWritable.get();
                 assertEquals(Integer.class, vertex.id().getClass());
-                final Object value = vertex.property("name");
-                if (((Property) value).value().equals("SUGAR MAGNOLIA")) {
+                if (vertex.value("name").equals("SUGAR MAGNOLIA")) {
                     foundKeyValue = true;
                     assertEquals(92, IteratorUtils.count(vertex.edges(Direction.OUT)));
                     assertEquals(77, IteratorUtils.count(vertex.edges(Direction.IN)));