@Test public void testAddEdge() { Develops develops = createElement(); edgeGraph.addEdge(develops, marko, vadas); InOrder inOrder = inOrder(g, traversal); switch (should) { case CREATE: inOrder.verify(g, times(1)).V(); inOrder.verify(traversal, times(1)).hasId(marko.id()); inOrder.verify(traversal, times(1)).as("from"); inOrder.verify(traversal, times(1)).V(); inOrder.verify(traversal, times(1)).hasId(vadas.id()); inOrder.verify(traversal, times(1)).as("to"); inOrder.verify(traversal, times(1)).addE(develops.label()); inOrder.verify(traversal, times(1)).as("edge"); inOrder.verify(traversal, times(1)).from("from"); verify(traversal, times(1)).property("since", develops.since()); break; case MERGE: inOrder.verify(g, times(1)).inject(1); inOrder.verify(traversal, times(1)).coalesce(traversal, traversal); break; case REPLACE: inOrder.verify(g, times(1)).inject(1); inOrder.verify(traversal, times(1)).coalesce(traversal, traversal, traversal); break; case INSERT: inOrder.verify(g, times(1)).inject(1); inOrder.verify(traversal, times(1)).hasId(marko.id()); inOrder.verify(traversal, times(1)).as("from"); inOrder.verify(traversal, times(1)).outE(develops.label()); inOrder.verify(traversal, times(1)).as("edge"); inOrder.verify(traversal, times(1)).inV(); inOrder.verify(traversal, times(1)).hasId(vadas.id()); inOrder.verify(traversal, times(1)).as("to"); inOrder.verify(traversal, times(1)).select("edge"); inOrder.verify(traversal, times(1)).choose(__.value()); inOrder.verify(g, times(1)).V(); inOrder.verify(traversal, times(1)).hasId(marko.id()); inOrder.verify(traversal, times(1)).as("from"); inOrder.verify(traversal, times(1)).V(); inOrder.verify(traversal, times(1)).hasId(vadas.id()); inOrder.verify(traversal, times(1)).as("to"); inOrder.verify(traversal, times(1)).addE(develops.label()); inOrder.verify(traversal, times(1)).as("edge"); inOrder.verify(traversal, times(1)).from("from"); verify(traversal, times(1)).property("since", develops.since()); inOrder.verify(traversal, times(1)).coalesce(traversal, traversal); break; case IGNORE: inOrder.verify(g, times(1)).inject(1); inOrder.verify(traversal, times(1)).coalesce(traversal, traversal); break; default: break; } }
public <E extends Edge> Edge addEdge(E edge, org.apache.tinkerpop.gremlin.structure.Vertex from, AnyTraversal anyTraversal) { if (from == null) { throw Edge.Exceptions.missingEdgeVertex(Direction.OUT, edge, from); } List<Vertex> tos = query.by(anyTraversal).list(Vertex.class); if (tos == null || tos.isEmpty()) { throw Edge.Exceptions.missingEdgeVertex(Direction.IN, edge, anyTraversal); } tos.forEach(to -> { edge.to(to); addEdge(edge, from, to.delegate()); }); return edge; }
EdgeGraph extends ElementGraph { public <E extends Edge> Edge addEdge(E edge, org.apache.tinkerpop.gremlin.structure.Vertex from, AnyTraversal anyTraversal) { if (from == null) { throw Edge.Exceptions.missingEdgeVertex(Direction.OUT, edge, from); } List<Vertex> tos = query.by(anyTraversal).list(Vertex.class); if (tos == null || tos.isEmpty()) { throw Edge.Exceptions.missingEdgeVertex(Direction.IN, edge, anyTraversal); } tos.forEach(to -> { edge.to(to); addEdge(edge, from, to.delegate()); }); return edge; } }
EdgeGraph extends ElementGraph { public <E extends Edge> Edge addEdge(E edge, org.apache.tinkerpop.gremlin.structure.Vertex from, AnyTraversal anyTraversal) { if (from == null) { throw Edge.Exceptions.missingEdgeVertex(Direction.OUT, edge, from); } List<Vertex> tos = query.by(anyTraversal).list(Vertex.class); if (tos == null || tos.isEmpty()) { throw Edge.Exceptions.missingEdgeVertex(Direction.IN, edge, anyTraversal); } tos.forEach(to -> { edge.to(to); addEdge(edge, from, to.delegate()); }); return edge; } EdgeGraph(Graph graph, Query query, GraphTraversalSource g); }
EdgeGraph extends ElementGraph { public <E extends Edge> Edge addEdge(E edge, org.apache.tinkerpop.gremlin.structure.Vertex from, AnyTraversal anyTraversal) { if (from == null) { throw Edge.Exceptions.missingEdgeVertex(Direction.OUT, edge, from); } List<Vertex> tos = query.by(anyTraversal).list(Vertex.class); if (tos == null || tos.isEmpty()) { throw Edge.Exceptions.missingEdgeVertex(Direction.IN, edge, anyTraversal); } tos.forEach(to -> { edge.to(to); addEdge(edge, from, to.delegate()); }); return edge; } EdgeGraph(Graph graph, Query query, GraphTraversalSource g); org.apache.tinkerpop.gremlin.structure.Edge delegate(Edge edge); Edge addEdge(E edge, org.apache.tinkerpop.gremlin.structure.Vertex from,
      AnyTraversal anyTraversal); Edge addEdge(E edge, org.apache.tinkerpop.gremlin.structure.Vertex from,
      SubTraversal... subTraversals); Edge removeEdge(E edge); void reset(); }
EdgeGraph extends ElementGraph { public <E extends Edge> Edge addEdge(E edge, org.apache.tinkerpop.gremlin.structure.Vertex from, AnyTraversal anyTraversal) { if (from == null) { throw Edge.Exceptions.missingEdgeVertex(Direction.OUT, edge, from); } List<Vertex> tos = query.by(anyTraversal).list(Vertex.class); if (tos == null || tos.isEmpty()) { throw Edge.Exceptions.missingEdgeVertex(Direction.IN, edge, anyTraversal); } tos.forEach(to -> { edge.to(to); addEdge(edge, from, to.delegate()); }); return edge; } EdgeGraph(Graph graph, Query query, GraphTraversalSource g); org.apache.tinkerpop.gremlin.structure.Edge delegate(Edge edge); Edge addEdge(E edge, org.apache.tinkerpop.gremlin.structure.Vertex from,
      AnyTraversal anyTraversal); Edge addEdge(E edge, org.apache.tinkerpop.gremlin.structure.Vertex from,
      SubTraversal... subTraversals); Edge removeEdge(E edge); void reset();  }