Permalink
Browse files

updated the VertexTestSuite to ensure that deleting a vertex removes …

…associated edges and does not call concurrency modification errors in TinkerGraph.
  • Loading branch information...
1 parent ca90bff commit 9f6cc8d469f665515403ec2e15bd6ab8164fbbfe @okram okram committed Jun 30, 2010
Showing with 24 additions and 0 deletions.
  1. +24 −0 src/test/java/com/tinkerpop/blueprints/pgm/VertexTestSuite.java
@@ -105,6 +105,30 @@ public void testRemoveVertex(final Graph graph) {
assertEquals(0, count(graph.getVertices()));
}
+ public void testRemoveVertexWithEdges(final Graph graph) {
+ List<String> ids = generateIds(2);
+ Vertex v1 = graph.addVertex(convertId(ids.get(0)));
+ Vertex v2 = graph.addVertex(convertId(ids.get(1)));
+ graph.addEdge(null, v1, v2, convertId("knows"));
+ if (config.supportsVertexIteration)
+ assertEquals(2, count(graph.getVertices()));
+ if (config.supportsEdgeIteration)
+ assertEquals(1, count(graph.getEdges()));
+
+ graph.removeVertex(v1);
+ if (config.supportsVertexIteration)
+ assertEquals(1, count(graph.getVertices()));
+ if (config.supportsEdgeIteration)
+ assertEquals(0, count(graph.getEdges()));
+
+ graph.removeVertex(v2);
+ if (config.supportsVertexIteration)
+ assertEquals(0, count(graph.getVertices()));
+ if (config.supportsEdgeIteration)
+ assertEquals(0, count(graph.getEdges()));
+
+ }
+
public void testGetNonExistantVertices(final Graph graph) {
try {
assertNull(graph.getVertex("asbv"));

0 comments on commit 9f6cc8d

Please sign in to comment.