You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/04/24 17:46:06 UTC

[20/31] incubator-tinkerpop git commit: Finalize some variables in a test.

Finalize some variables in a test.


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

Branch: refs/heads/master
Commit: d33e31a9e1b6093b296182aa21f8fc5e7f708994
Parents: 4c29a83
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 24 09:31:21 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 24 09:31:21 2015 -0400

----------------------------------------------------------------------
 .../io/gryo/GryoRecordReaderWriterTest.java     | 33 ++++++++++----------
 1 file changed, 16 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d33e31a9/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java
index 67cee16..cf15b2f 100644
--- a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java
+++ b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordReaderWriterTest.java
@@ -47,28 +47,27 @@ import static org.junit.Assert.assertTrue;
  * @author Joshua Shinavier (http://fortytwo.net)
  */
 public class GryoRecordReaderWriterTest {
-    // todo: gotta fix this one after the gryo refactoring
     @Test
     @org.junit.Ignore
     public void testAll() throws Exception {
-        Configuration configuration = new Configuration(false);
+        final Configuration configuration = new Configuration(false);
         configuration.set("fs.file.impl", LocalFileSystem.class.getName());
         configuration.set("fs.default.name", "file:///");
 
-        File testFile = new File(HadoopGraphProvider.PATHS.get("grateful-dead-vertices.kryo"));
-        FileSplit split = new FileSplit(
+        final File testFile = new File(HadoopGraphProvider.PATHS.get("grateful-dead-vertices.kryo"));
+        final FileSplit split = new FileSplit(
                 new Path(testFile.getAbsoluteFile().toURI().toString()), 0,
                 testFile.length(), null);
         System.out.println("reading Gryo file " + testFile.getAbsolutePath() + " (" + testFile.length() + " bytes)");
 
-        GryoInputFormat inputFormat = ReflectionUtils.newInstance(GryoInputFormat.class, configuration);
-        TaskAttemptContext job = new TaskAttemptContext(configuration, new TaskAttemptID());
-        RecordReader reader = inputFormat.createRecordReader(split, job);
+        final GryoInputFormat inputFormat = ReflectionUtils.newInstance(GryoInputFormat.class, configuration);
+        final TaskAttemptContext job = new TaskAttemptContext(configuration, new TaskAttemptID());
+        final RecordReader reader = inputFormat.createRecordReader(split, job);
 
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        try (DataOutputStream dos = new DataOutputStream(bos)) {
-            GryoOutputFormat outputFormat = new GryoOutputFormat();
-            RecordWriter writer = outputFormat.getRecordWriter(job, dos);
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        try (final DataOutputStream dos = new DataOutputStream(bos)) {
+            final GryoOutputFormat outputFormat = new GryoOutputFormat();
+            final RecordWriter writer = outputFormat.getRecordWriter(job, dos);
 
             float lastProgress = -1f;
             int count = 0;
@@ -76,16 +75,16 @@ public class GryoRecordReaderWriterTest {
             while (reader.nextKeyValue()) {
                 //System.out.println("" + reader.getProgress() + "> " + reader.getCurrentKey() + ": " + reader.getCurrentValue());
                 count++;
-                float progress = reader.getProgress();
+                final float progress = reader.getProgress();
                 assertTrue(progress >= lastProgress);
                 assertEquals(NullWritable.class, reader.getCurrentKey().getClass());
-                VertexWritable v = (VertexWritable) reader.getCurrentValue();
+                final VertexWritable v = (VertexWritable) reader.getCurrentValue();
                 writer.write(NullWritable.get(), v);
 
-                Vertex vertex = v.get();
+                final Vertex vertex = v.get();
                 assertEquals(Integer.class, vertex.id().getClass());
 
-                Object value = vertex.property("name");
+                final Object value = vertex.property("name");
                 if (((Property) value).value().equals("SUGAR MAGNOLIA")) {
                     foundKeyValue = true;
                     assertEquals(92, IteratorUtils.count(vertex.edges(Direction.OUT)));
@@ -99,9 +98,9 @@ public class GryoRecordReaderWriterTest {
         }
 
         //System.out.println("bos: " + new String(bos.toByteArray()));
-        String[] lines = new String(bos.toByteArray()).split("\\x3a\\x15.\\x11\\x70...");
+        final String[] lines = new String(bos.toByteArray()).split("\\x3a\\x15.\\x11\\x70...");
         assertEquals(808, lines.length);
-        String line42 = lines[41];
+        final String line42 = lines[41];
         //System.out.println("line42: " + line42);
         assertTrue(line42.contains("ITS ALL OVER NO"));
     }