}
graph.shutdown();
}
public void testReIndexingOfElements() {
KeyIndexableGraph graph = (KeyIndexableGraph) graphTest.generateGraph();
if (graph.getFeatures().supportsVertexKeyIndex) {
Vertex vertex = graph.addVertex(null);
vertex.setProperty("name", "marko");
assertEquals(count(graph.getVertices("name", "marko")), 1);
assertEquals(graph.getVertices("name", "marko").iterator().next(), vertex);
graph.createKeyIndex("name", Vertex.class);
assertEquals(count(graph.getVertices("name", "marko")), 1);
assertEquals(graph.getVertices("name", "marko").iterator().next(), vertex);
}
if (graph.getFeatures().supportsEdgeKeyIndex) {
Edge edge = graph.addEdge(null, graph.addVertex(null), graph.addVertex(null), graphTest.convertLabel("knows"));
edge.setProperty("date", 2012);
assertEquals(count(graph.getEdges("date", 2012)), 1);
assertEquals(graph.getEdges("date", 2012).iterator().next(), edge);
graph.createKeyIndex("date", Edge.class);
assertEquals(count(graph.getEdges("date", 2012)), 1);
assertEquals(graph.getEdges("date", 2012).iterator().next(), edge);
}
graph.shutdown();
}