@Test public void fixAddsMissingEdges() { UUID rel1Id = UUID.fromString("ff65089c-2ded-4af0-95e7-0476979f96b8"); UUID rel2Id = UUID.fromString("a628b090-ec7f-4608-9356-61728355ad5a"); GraphWrapper wrapper = newGraph().withVertex("v1", v -> v.withTimId("id1")) .withVertex("v2", v -> v.withTimId("id2") .withOutgoingRelation("relatedTo", "v1", r -> r.withTim_id(rel1Id).withRev(2) .withIsLatest(true) .withModified(changeWithTimestamp(10000L)) .withCreated(changeWithTimestamp(1500L)) ) ) .withVertex("v3", v -> v.withTimId("id3") .withOutgoingRelation("relatedTo", "v2", r -> r.withTim_id(rel2Id).withRev(4) .withIsLatest(true) .withModified(changeWithTimestamp(10000L)) .withCreated(changeWithTimestamp(1000L)) ) ) .wrap(); DatabaseFixer databaseFixer = new DatabaseFixer(wrapper); databaseFixer.fix(); assertThat(wrapper.getGraph().traversal().E().has("tim_id", rel1Id.toString()).toList(), containsInAnyOrder( likeEdge().withId(rel1Id.toString()).withProperty("rev", 1).withModifiedTimestamp(1500L), likeEdge().withId(rel1Id.toString()).withProperty("rev", 2).withModifiedTimestamp(10000L) )); assertThat(wrapper.getGraph().traversal().E().has("tim_id", rel2Id.toString()).toList(), containsInAnyOrder( likeEdge().withId(rel2Id.toString()).withProperty("rev", 1).withModifiedTimestamp(1000L), likeEdge().withId(rel2Id.toString()).withProperty("rev", 2).withModifiedTimestamp(1000L), likeEdge().withId(rel2Id.toString()).withProperty("rev", 3).withModifiedTimestamp(1000L), likeEdge().withId(rel2Id.toString()).withProperty("rev", 4).withModifiedTimestamp(10000L) )); }
public void fix() { Graph graph = graphWrapper .getGraph(); fixEdges(graph); fixVertices(graph); }
DatabaseFixer { public void fix() { Graph graph = graphWrapper .getGraph(); fixEdges(graph); fixVertices(graph); } }
DatabaseFixer { public void fix() { Graph graph = graphWrapper .getGraph(); fixEdges(graph); fixVertices(graph); } DatabaseFixer(GraphWrapper graphWrapper); }
DatabaseFixer { public void fix() { Graph graph = graphWrapper .getGraph(); fixEdges(graph); fixVertices(graph); } DatabaseFixer(GraphWrapper graphWrapper); void fix(); Optional<Edge> getPreviousVersion(Edge edge); }
DatabaseFixer { public void fix() { Graph graph = graphWrapper .getGraph(); fixEdges(graph); fixVertices(graph); } DatabaseFixer(GraphWrapper graphWrapper); void fix(); Optional<Edge> getPreviousVersion(Edge edge);  }