@Test
public void testIDAssignment() {
for (int trial = 0; trial < 100; trial++) {
for (boolean flush : new boolean[]{true, false}) {
TitanGraph graph = getInMemoryGraph();
int numVertices = 100;
List<TitanVertex> vertices = new ArrayList<TitanVertex>(numVertices);
List<InternalRelation> relations = new ArrayList<InternalRelation>();
TitanVertex old = null;
for (int i = 0; i < numVertices; i++) {
TitanVertex next = (TitanVertex) graph.addVertex(null);
InternalRelation edge = null;
if (old != null) {
edge = (InternalRelation) graph.addEdge(null, old, next, "knows");
}
InternalRelation property = (InternalRelation) next.addProperty("age", 25);
if (flush) {
idAssigner.assignID((InternalVertex) next);
idAssigner.assignID(property);
if (edge != null) idAssigner.assignID(edge);
} else {
relations.add(property);
if (edge != null) relations.add(edge);
}
vertices.add(next);
old = next;
}
if (!flush) idAssigner.assignIDs(relations);
if (trial == -1) {
for (TitanVertex v : vertices) {
System.out.println(idAssigner.getIDManager().getPartitionID(v.getID()));
}
System.out.println("_____________________________________________");
}
graph.rollback();
graph.shutdown();
}
}
}