@Test public void dropIntIndexTest() { ThunderGraph thunderGraph = new ThunderGraph(this.dbPath); try { thunderGraph.createKeyIndex("name1", Vertex.class); thunderGraph.commit(); Vertex v1 = thunderGraph.addVertex(null); v1.setProperty("name1", 1); Vertex v2 = thunderGraph.addVertex(null); v2.setProperty("name1", 1); Vertex v3 = thunderGraph.addVertex(null); v3.setProperty("name1", 1); thunderGraph.commit(); Assert.assertEquals(3, count(thunderGraph.getVertices("name1", 1))); Assert.assertEquals(3, thunderGraph.getDbEntries(DbEnum.VERTEX_INT_INDEX)); thunderGraph.dropKeyIndex("name1", Vertex.class); thunderGraph.commit(); // Still finds it just not via the index Assert.assertEquals(0, thunderGraph.getDbEntries(DbEnum.VERTEX_INT_INDEX)); Assert.assertEquals(3, count(thunderGraph.getVertices("name1", 1))); } finally { thunderGraph.shutdown(); } }
@Test public void deleteIndexedVertex() { ThunderGraph thunderGraph = new ThunderGraph(this.dbPath); try { thunderGraph.createKeyIndex("name", Vertex.class); Vertex v1 = thunderGraph.addVertex(null); v1.setProperty("name", 1); thunderGraph.commit(); Assert.assertEquals(1, thunderGraph.getDbEntries(DbEnum.VERTEX_INT_INDEX)); v1.remove(); thunderGraph.commit(); Assert.assertEquals(0, thunderGraph.getDbEntries(DbEnum.VERTEX_INT_INDEX)); } finally { thunderGraph.shutdown(); } }