Search in sources :

Example 1 with FakeEdge

use of com.baidu.hugegraph.testutil.FakeObjects.FakeEdge in project incubator-hugegraph by apache.

the class EdgeCoreTest method testRemoveEdge.

@Test
public void testRemoveEdge() {
    HugeGraph graph = graph();
    Vertex james = graph.addVertex(T.label, "author", "id", 1, "name", "James Gosling", "age", 62, "lived", "Canadian");
    Vertex java = graph.addVertex(T.label, "language", "name", "java");
    Vertex java1 = graph.addVertex(T.label, "book", "name", "java-1");
    Vertex java2 = graph.addVertex(T.label, "book", "name", "java-2");
    Vertex java3 = graph.addVertex(T.label, "book", "name", "java-3");
    james.addEdge("created", java);
    Edge authored1 = james.addEdge("authored", java1);
    james.addEdge("authored", java2);
    james.addEdge("authored", java3);
    List<Edge> edges = graph.traversal().E().toList();
    Assert.assertEquals(4, edges.size());
    authored1.remove();
    edges = graph.traversal().E().toList();
    Assert.assertEquals(3, edges.size());
    Assert.assertFalse(Utils.contains(edges, new FakeEdge("authored", james, java1)));
}
Also used : HugeVertex(com.baidu.hugegraph.structure.HugeVertex) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) HugeGraph(com.baidu.hugegraph.HugeGraph) FakeEdge(com.baidu.hugegraph.testutil.FakeObjects.FakeEdge) HugeEdge(com.baidu.hugegraph.structure.HugeEdge) FakeEdge(com.baidu.hugegraph.testutil.FakeObjects.FakeEdge) Edge(org.apache.tinkerpop.gremlin.structure.Edge) Test(org.junit.Test)

Aggregations

HugeGraph (com.baidu.hugegraph.HugeGraph)1 HugeEdge (com.baidu.hugegraph.structure.HugeEdge)1 HugeVertex (com.baidu.hugegraph.structure.HugeVertex)1 FakeEdge (com.baidu.hugegraph.testutil.FakeObjects.FakeEdge)1 Edge (org.apache.tinkerpop.gremlin.structure.Edge)1 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)1 Test (org.junit.Test)1