You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by pi...@apache.org on 2016/03/30 08:39:04 UTC
[10/40] incubator-tinkerpop git commit: corrected an issues in tree()
tests that made neo4j tests fail
corrected an issues in tree() tests that made neo4j tests fail
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/8f2fd159
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/8f2fd159
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/8f2fd159
Branch: refs/heads/TINKERPOP-968
Commit: 8f2fd1591114fd9e6a667b55de1caa2e000b7254
Parents: fab3473
Author: Dylan Millikin <dm...@apache.org>
Authored: Sat Mar 26 22:56:54 2016 +0100
Committer: Dylan Millikin <dm...@apache.org>
Committed: Sat Mar 26 22:56:54 2016 +0100
----------------------------------------------------------------------
.../gremlin/structure/SerializationTest.java | 24 +++++++++++---------
1 file changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8f2fd159/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
index a99bcd5..8d02c72 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/SerializationTest.java
@@ -232,7 +232,7 @@ public class SerializationTest {
final GryoWriter gryoWriter = gryoIo.writer().create();
final GryoReader gryoReader = gryoIo.reader().create();
- final Tree before = g.V(1).out().properties("name").tree().next();
+ final Tree before = g.V(convertToVertexId("marko")).out().properties("name").tree().next();
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
gryoWriter.writeObject(outputStream, before);
@@ -376,17 +376,17 @@ public class SerializationTest {
@LoadGraphWith(LoadGraphWith.GraphData.MODERN)
public void shouldSerializeTree() throws Exception {
final ObjectMapper mapper = graph.io(GraphSONIo.build()).mapper().create().createMapper();
- final Tree t = g.V(1).out().properties("name").tree().next();
+ final Tree t = g.V(convertToVertexId("marko")).out().properties("name").tree().next();
final String json = mapper.writeValueAsString(t);
final HashMap<String, Object> m = (HashMap<String, Object>) mapper.readValue(json, mapTypeReference);
// Check Structure
assertEquals(1, m.size());
- assertTrue(m.containsKey("1"));
+ assertTrue(m.containsKey(convertToVertexId("marko").toString()));
// Check Structure n+1
- final HashMap<String, Object> branch = (HashMap<String, Object>) m.get("1");
+ final HashMap<String, Object> branch = (HashMap<String, Object>) m.get(convertToVertexId("marko").toString());
assertEquals(2, branch.size());
assertTrue(branch.containsKey(GraphSONTokens.KEY));
assertTrue(branch.containsKey(GraphSONTokens.VALUE));
@@ -397,7 +397,7 @@ public class SerializationTest {
assertTrue(branchKey.containsKey(GraphSONTokens.LABEL));
assertTrue(branchKey.containsKey(GraphSONTokens.TYPE));
assertTrue(branchKey.containsKey(GraphSONTokens.PROPERTIES));
- assertEquals(1, branchKey.get(GraphSONTokens.ID));
+ assertEquals(convertToVertexId("marko").toString(), branchKey.get(GraphSONTokens.ID).toString());
assertEquals("person", branchKey.get(GraphSONTokens.LABEL));
assertEquals("vertex", branchKey.get(GraphSONTokens.TYPE));
final HashMap<String, List<HashMap<String, Object>>> branchKeyProps = (HashMap<String, List<HashMap<String, Object>>>) branchKey.get(GraphSONTokens.PROPERTIES);
@@ -407,21 +407,23 @@ public class SerializationTest {
//Check n+1 value (traversed element)
final HashMap<String, Object> branchValue = (HashMap<String, Object>) branch.get(GraphSONTokens.VALUE);
assertEquals(3, branchValue.size());
- assertTrue(branchValue.containsKey("2"));
- assertTrue(branchValue.containsKey("3"));
- assertTrue(branchValue.containsKey("4"));
+ assertTrue(branchValue.containsKey(convertToVertexId("vadas").toString()));
+ assertTrue(branchValue.containsKey(convertToVertexId("lop").toString()));
+ assertTrue(branchValue.containsKey(convertToVertexId("josh").toString()));
// Check that vp[] functioned properly
- final HashMap<String, HashMap<String, Object>> branch2 = (HashMap<String, HashMap<String, Object>>) branchValue.get("2");
+ final HashMap<String, HashMap<String, Object>> branch2 = (HashMap<String, HashMap<String, Object>>) branchValue.get(convertToVertexId("vadas").toString());
assertTrue(branch2.containsKey(GraphSONTokens.KEY));
assertTrue(branch2.containsKey(GraphSONTokens.VALUE));
- final HashMap<String, HashMap<String, Object>> branch2Prop = (HashMap<String, HashMap<String, Object>>) branch2.get(GraphSONTokens.VALUE).get("2");
+
+ final Map.Entry entry = branch2.get(GraphSONTokens.VALUE).entrySet().iterator().next();
+ final HashMap<String, HashMap<String, Object>> branch2Prop = (HashMap<String, HashMap<String, Object>>) entry.getValue();
assertTrue(branch2Prop.get(GraphSONTokens.KEY).containsKey(GraphSONTokens.ID));
assertTrue(branch2Prop.get(GraphSONTokens.KEY).containsKey(GraphSONTokens.VALUE));
assertTrue(branch2Prop.get(GraphSONTokens.KEY).containsKey(GraphSONTokens.LABEL));
assertEquals("name", branch2Prop.get(GraphSONTokens.KEY).get(GraphSONTokens.LABEL));
assertEquals("vadas", branch2Prop.get(GraphSONTokens.KEY).get(GraphSONTokens.VALUE));
- assertEquals(2, branch2Prop.get(GraphSONTokens.KEY).get(GraphSONTokens.ID));
+ assertEquals(entry.getKey().toString(), branch2Prop.get(GraphSONTokens.KEY).get(GraphSONTokens.ID).toString());
}
}
}