use of org.umlg.sqlg.structure.RecordId in project sqlg by pietermartin.
the class TestBatchStreamVertex method testAccessPropertyFromVertexWhileStreaming.
@Test(expected = IllegalStateException.class)
public void testAccessPropertyFromVertexWhileStreaming() {
Vertex v1 = this.sqlgGraph.addVertex(T.label, "Person", "name", "a1");
Vertex v2 = this.sqlgGraph.addVertex(T.label, "Person", "name", "a2");
v1.addEdge("friend", v2);
this.sqlgGraph.tx().commit();
this.sqlgGraph.tx().streamingBatchModeOn();
LinkedHashMap<String, Object> properties = new LinkedHashMap<>();
for (int i = 0; i < 100; i++) {
properties.put("name", "aa" + i);
this.sqlgGraph.streamVertex("Person", properties);
properties.clear();
}
RecordId recordId = (RecordId) v1.id();
Assert.assertEquals("a1", SqlgVertex.of(this.sqlgGraph, recordId.getId(), recordId.getSchemaTable().getSchema(), recordId.getSchemaTable().getTable()).value("name"));
this.sqlgGraph.tx().commit();
}
use of org.umlg.sqlg.structure.RecordId in project sqlg by pietermartin.
the class TestBatchStreamVertex method testAccessPropertyFromEdgeWhileStreaming.
@Test(expected = IllegalStateException.class)
public void testAccessPropertyFromEdgeWhileStreaming() {
Vertex v1 = this.sqlgGraph.addVertex(T.label, "Person", "name", "a1");
Vertex v2 = this.sqlgGraph.addVertex(T.label, "Person", "name", "a2");
Edge e1 = v1.addEdge("friend", v2);
this.sqlgGraph.tx().commit();
this.sqlgGraph.tx().streamingBatchModeOn();
LinkedHashMap<String, Object> properties = new LinkedHashMap<>();
for (int i = 0; i < 100; i++) {
properties.put("name", "aa" + i);
this.sqlgGraph.streamVertex("Person", properties);
properties.clear();
}
RecordId recordId = (RecordId) e1.id();
// Assert.assertEquals("a1", SqlgEdge.of(this.sqlgGraph, recordId.getId(), recordId.getSchemaTable().getSchema(), recordId.getSchemaTable().getTable()).value("name"));
Assert.assertEquals("a1", this.sqlgGraph.traversal().E(recordId).next().value("name"));
this.sqlgGraph.tx().commit();
}
Aggregations