use of com.baidu.hugegraph.backend.tx.GraphTransaction in project incubator-hugegraph by apache.
the class VertexCoreTest method testAddVertexWithTx.
@Test
public void testAddVertexWithTx() {
HugeGraph graph = graph();
GraphTransaction tx = params().openTransaction();
tx.addVertex(T.label, "book", "name", "java-4");
tx.addVertex(T.label, "book", "name", "java-5");
try {
tx.commit();
} finally {
tx.close();
}
long count = graph.traversal().V().count().next();
Assert.assertEquals(2, count);
}
use of com.baidu.hugegraph.backend.tx.GraphTransaction in project incubator-hugegraph by apache.
the class VertexCoreTest method testRemoveVertexAfterAddVertexWithTx.
@Test
public void testRemoveVertexAfterAddVertexWithTx() {
HugeGraph graph = graph();
GraphTransaction tx = params().openTransaction();
Vertex java1 = tx.addVertex(T.label, "book", "name", "java-1");
tx.addVertex(T.label, "book", "name", "java-2");
tx.commit();
java1.remove();
tx.commit();
tx.close();
List<Vertex> vertices = graph.traversal().V().toList();
Assert.assertEquals(1, vertices.size());
assertNotContains(vertices, T.label, "book", "name", "java-1");
}
Aggregations