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/13 19:22:51 UTC
[30/43] incubator-tinkerpop git commit: Remove
GraphProvider.reconstituteGraphSONIdentifier method TINKERPOP3-581
Remove GraphProvider.reconstituteGraphSONIdentifier method TINKERPOP3-581
This method is no longer relevant as we can assume that complex identifiers will either be toString() values that can be filtered by the Graph.vertices/edges or if not using toString and instead going for a more complex format (which is discourage for sake of non-jvm devs) must be supported by filters to Graph.vertices/edges
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/bcc55bf6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/bcc55bf6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/bcc55bf6
Branch: refs/heads/master
Commit: bcc55bf674f6fccbb8c8e053e18cb6cdae4dc3c2
Parents: 7ee771f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 12:09:36 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 12:09:36 2015 -0400
----------------------------------------------------------------------
.../apache/tinkerpop/gremlin/GraphProvider.java | 20 --------------------
.../tinkerpop/gremlin/structure/IoTest.java | 20 ++++++++++----------
2 files changed, 10 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/bcc55bf6/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
index f61ed0a..749026d 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
@@ -221,26 +221,6 @@ public interface GraphProvider {
public void loadGraphData(final Graph graph, final LoadGraphWith loadGraphWith, final Class testClass, final String testName);
/**
- * Converts the GraphSON representation of an identifier to the implementation's representation of an identifier.
- * When serializing a mapper identifier type to GraphSON an implementer will typically specify a mapper serializer
- * in {@link org.apache.tinkerpop.gremlin.structure.Graph.Io}. That will serialize the identifier to a GraphSON representation.
- * When the GraphSON is deserialized, the identifier is written to an
- * {@link Attachable} object where it is passed to a user supplied
- * conversion {@link java.util.function.Function} that ultimately processes it. It is in this conversion process
- * that vendor specific identifier conversion would occur (if desired). This method mimics that conversion by
- * providing the mechanism that a test can use to do the conversion.
- *
- * @param clazz The {@link Element} class that represents the identifier.
- * @param id The identifier to convert.
- * @param <ID> The type of the identifier.
- * @return The reconstituted identifier.
- */
- public default <ID> ID reconstituteGraphSONIdentifier(final Class<? extends Element> clazz, final Object id) {
- // todo: do we still need this?
- return (ID) id;
- }
-
- /**
* Get the set of concrete implementations of certain classes and interfaces utilized by the test suite. This
* method should return any implementations or extensions of the following interfaces or classes:
* <ul>
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/bcc55bf6/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
index 17170fc..d73cd75 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
@@ -882,9 +882,9 @@ public class IoTest extends AbstractGremlinTest {
final GraphSONReader reader = graph.io().graphSONReader().mapper(graph.io().graphSONMapper().embedTypes(true).create()).create();
try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
reader.readEdge(bais, detachedEdge -> {
- assertEquals(e.id(), graphProvider.reconstituteGraphSONIdentifier(Edge.class, detachedEdge.id()));
- assertEquals(v1.id(), graphProvider.reconstituteGraphSONIdentifier(Vertex.class, detachedEdge.outVertex().id()));
- assertEquals(v2.id(), graphProvider.reconstituteGraphSONIdentifier(Vertex.class, detachedEdge.inVertex().id()));
+ assertEquals(e.id(), graph.edges(detachedEdge.id()).next().id());
+ assertEquals(v1.id(), graph.vertices(detachedEdge.outVertex().id()).next().id());
+ assertEquals(v2.id(), graph.vertices(detachedEdge.inVertex().id()).next().id());
assertEquals(v1.label(), detachedEdge.outVertex().label());
assertEquals(v2.label(), detachedEdge.inVertex().label());
assertEquals(e.label(), detachedEdge.label());
@@ -1665,25 +1665,25 @@ public class IoTest extends AbstractGremlinTest {
final GraphSONReader reader = graph.io().graphSONReader().mapper(graph.io().graphSONMapper().embedTypes(true).create()).create();
try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
reader.readVertex(bais, Direction.BOTH, detachedVertex -> {
- assertEquals(v1.id(), graphProvider.reconstituteGraphSONIdentifier(Vertex.class, detachedVertex.id()));
+ assertEquals(v1.id(), graph.vertices(detachedVertex.id()).next().id());
assertEquals(v1.label(), detachedVertex.label());
assertEquals(1, IteratorUtils.count(detachedVertex.properties()));
assertEquals(v1.value("name"), detachedVertex.value("name").toString());
vertexCalled.set(true);
return null;
}, detachedEdge -> {
- if (graphProvider.reconstituteGraphSONIdentifier(Edge.class, detachedEdge.id()).equals(e1.id())) {
- assertEquals(v2.id(), graphProvider.reconstituteGraphSONIdentifier(Vertex.class, detachedEdge.outVertex().id()));
- assertEquals(v1.id(), graphProvider.reconstituteGraphSONIdentifier(Vertex.class, detachedEdge.inVertex().id()));
+ if (graph.edges(detachedEdge.id()).next().id().equals(e1.id())) {
+ assertEquals(v2.id(), graph.vertices(detachedEdge.outVertex().id()).next().id());
+ assertEquals(v1.id(), graph.vertices(detachedEdge.inVertex().id()).next().id());
assertEquals(v1.label(), detachedEdge.outVertex().label());
assertEquals(v2.label(), detachedEdge.inVertex().label());
assertEquals(e1.label(), detachedEdge.label());
assertEquals(1, IteratorUtils.count(detachedEdge.properties()));
assertEquals(0.5f, detachedEdge.value("weight"), 0.00001f);
edge1Called.set(true);
- } else if (graphProvider.reconstituteGraphSONIdentifier(Edge.class, detachedEdge.id()).equals(e2.id())) {
- assertEquals(v1.id(), graphProvider.reconstituteGraphSONIdentifier(Vertex.class, detachedEdge.outVertex().id()));
- assertEquals(v2.id(), graphProvider.reconstituteGraphSONIdentifier(Vertex.class, detachedEdge.inVertex().id()));
+ } else if (graph.edges(detachedEdge.id()).next().id().equals(e2.id())) {
+ assertEquals(v1.id(), graph.vertices(detachedEdge.outVertex().id()).next().id());
+ assertEquals(v2.id(), graph.vertices(detachedEdge.inVertex().id()).next().id());
assertEquals(v1.label(), detachedEdge.outVertex().label());
assertEquals(v2.label(), detachedEdge.inVertex().label());
assertEquals(e1.label(), detachedEdge.label());