@Test public void checkCallsInitAndFinish() { TinkerPopGraphManager graph = makeGraph("1"); DatabaseCheck databaseCheck1 = mock(DatabaseCheck.class); DatabaseCheck databaseCheck2 = mock(DatabaseCheck.class); DatabaseValidator instance = new DatabaseValidator(graph, databaseCheck1, databaseCheck2); instance.check(); InOrder inOrder = inOrder(databaseCheck1, databaseCheck2); inOrder.verify(databaseCheck1).init(any(Graph.class), any(GraphDatabaseService.class)); inOrder.verify(databaseCheck2).init(any(Graph.class), any(GraphDatabaseService.class)); inOrder.verify(databaseCheck1).check(any(Vertex.class)); inOrder.verify(databaseCheck2).check(any(Vertex.class)); inOrder.verify(databaseCheck1).finish(); inOrder.verify(databaseCheck2).finish(); }
public ValidationResult check() { GraphTraversal<Vertex, Vertex> traversal = graphManager.getGraph().traversal().V(); List<ValidationResult> validationResults = Lists.newArrayList(); for (DatabaseCheck databaseCheck : databaseChecks) { databaseCheck.init(graphManager.getGraph(), graphManager.getGraphDatabase()); } while (traversal.hasNext()) { Vertex vertex = traversal.next(); for (DatabaseCheck databaseCheck : databaseChecks) { validationResults.add(databaseCheck.check(vertex)); } } for (DatabaseCheck databaseCheck : databaseChecks) { databaseCheck.finish(); } return new CompositeValidationResult(validationResults); }
DatabaseValidator { public ValidationResult check() { GraphTraversal<Vertex, Vertex> traversal = graphManager.getGraph().traversal().V(); List<ValidationResult> validationResults = Lists.newArrayList(); for (DatabaseCheck databaseCheck : databaseChecks) { databaseCheck.init(graphManager.getGraph(), graphManager.getGraphDatabase()); } while (traversal.hasNext()) { Vertex vertex = traversal.next(); for (DatabaseCheck databaseCheck : databaseChecks) { validationResults.add(databaseCheck.check(vertex)); } } for (DatabaseCheck databaseCheck : databaseChecks) { databaseCheck.finish(); } return new CompositeValidationResult(validationResults); } }
DatabaseValidator { public ValidationResult check() { GraphTraversal<Vertex, Vertex> traversal = graphManager.getGraph().traversal().V(); List<ValidationResult> validationResults = Lists.newArrayList(); for (DatabaseCheck databaseCheck : databaseChecks) { databaseCheck.init(graphManager.getGraph(), graphManager.getGraphDatabase()); } while (traversal.hasNext()) { Vertex vertex = traversal.next(); for (DatabaseCheck databaseCheck : databaseChecks) { validationResults.add(databaseCheck.check(vertex)); } } for (DatabaseCheck databaseCheck : databaseChecks) { databaseCheck.finish(); } return new CompositeValidationResult(validationResults); } DatabaseValidator(TinkerPopGraphManager graphManager, DatabaseCheck... databaseChecks); }
DatabaseValidator { public ValidationResult check() { GraphTraversal<Vertex, Vertex> traversal = graphManager.getGraph().traversal().V(); List<ValidationResult> validationResults = Lists.newArrayList(); for (DatabaseCheck databaseCheck : databaseChecks) { databaseCheck.init(graphManager.getGraph(), graphManager.getGraphDatabase()); } while (traversal.hasNext()) { Vertex vertex = traversal.next(); for (DatabaseCheck databaseCheck : databaseChecks) { validationResults.add(databaseCheck.check(vertex)); } } for (DatabaseCheck databaseCheck : databaseChecks) { databaseCheck.finish(); } return new CompositeValidationResult(validationResults); } DatabaseValidator(TinkerPopGraphManager graphManager, DatabaseCheck... databaseChecks); ValidationResult check(); }
DatabaseValidator { public ValidationResult check() { GraphTraversal<Vertex, Vertex> traversal = graphManager.getGraph().traversal().V(); List<ValidationResult> validationResults = Lists.newArrayList(); for (DatabaseCheck databaseCheck : databaseChecks) { databaseCheck.init(graphManager.getGraph(), graphManager.getGraphDatabase()); } while (traversal.hasNext()) { Vertex vertex = traversal.next(); for (DatabaseCheck databaseCheck : databaseChecks) { validationResults.add(databaseCheck.check(vertex)); } } for (DatabaseCheck databaseCheck : databaseChecks) { databaseCheck.finish(); } return new CompositeValidationResult(validationResults); } DatabaseValidator(TinkerPopGraphManager graphManager, DatabaseCheck... databaseChecks); ValidationResult check();  }