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/28 12:37:20 UTC
incubator-tinkerpop git commit: Formatting and cleanup in the hadoop
reader/writer tests for splitting files.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master 7040b8c62 -> e7e3cceae
Formatting and cleanup in the hadoop reader/writer tests for splitting files.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/e7e3ccea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/e7e3ccea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/e7e3ccea
Branch: refs/heads/master
Commit: e7e3cceaec8f70cde48bee68eb1ed35ab2cad52d
Parents: 7040b8c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Apr 28 06:36:30 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Apr 28 06:36:30 2015 -0400
----------------------------------------------------------------------
.../GraphSONRecordReaderWriterTest.java | 34 ++++++++++----------
.../io/gryo/GryoRecordReaderWriterTest.java | 2 +-
2 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e7e3ccea/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReaderWriterTest.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReaderWriterTest.java b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReaderWriterTest.java
index 10f019d..a626202 100644
--- a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReaderWriterTest.java
+++ b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReaderWriterTest.java
@@ -51,25 +51,25 @@ import static org.junit.Assert.assertTrue;
public class GraphSONRecordReaderWriterTest {
@Test
- public void testAll() throws Exception {
- Configuration configuration = new Configuration(false);
+ public void shouldSplitFile() throws Exception {
+ 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.ldjson"));
- FileSplit split = new FileSplit(
+ final File testFile = new File(HadoopGraphProvider.PATHS.get("grateful-dead-vertices.ldjson"));
+ final FileSplit split = new FileSplit(
new Path(testFile.getAbsoluteFile().toURI().toString()), 0,
testFile.length(), null);
System.out.println("reading GraphSON adjacency file " + testFile.getAbsolutePath() + " (" + testFile.length() + " bytes)");
- GraphSONInputFormat inputFormat = ReflectionUtils.newInstance(GraphSONInputFormat.class, configuration);
- TaskAttemptContext job = new TaskAttemptContext(configuration, new TaskAttemptID());
- RecordReader reader = inputFormat.createRecordReader(split, job);
+ final GraphSONInputFormat inputFormat = ReflectionUtils.newInstance(GraphSONInputFormat.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)) {
- GraphSONOutputFormat outputFormat = new GraphSONOutputFormat();
- RecordWriter writer = outputFormat.getRecordWriter(job, dos);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try (final DataOutputStream dos = new DataOutputStream(bos)) {
+ final GraphSONOutputFormat outputFormat = new GraphSONOutputFormat();
+ final RecordWriter writer = outputFormat.getRecordWriter(job, dos);
float lastProgress = -1f;
int count = 0;
@@ -77,16 +77,16 @@ public class GraphSONRecordReaderWriterTest {
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 (null != value && ((Property) value).value().equals("SUGAR MAGNOLIA")) {
foundKeyValue = true;
assertEquals(92, IteratorUtils.count(vertex.edges(Direction.OUT)));
@@ -100,9 +100,9 @@ public class GraphSONRecordReaderWriterTest {
}
//System.out.println("bos: " + new String(bos.toByteArray()));
- String[] lines = new String(bos.toByteArray()).split("\n");
+ final String[] lines = new String(bos.toByteArray()).split("\n");
assertEquals(808, lines.length);
- String line42 = lines[41];
+ final String line42 = lines[41];
assertTrue(line42.contains("outV"));
assertTrue(line42.contains("ITS ALL OVER NOW"));
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e7e3ccea/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 03c6f47..d231691 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
@@ -51,7 +51,7 @@ import static org.junit.Assert.assertTrue;
*/
public class GryoRecordReaderWriterTest {
@Test
- public void testAll() throws Exception {
+ public void shouldSplitFile() throws Exception {
final Configuration configuration = new Configuration(false);
configuration.set("fs.file.impl", LocalFileSystem.class.getName());
configuration.set("fs.default.name", "file:///");