@Test public void checkReturnsANonValidValidationResultWhenAtLeastOneOfTheChecksFails() { TinkerPopGraphManager graph = makeGraph("id1", "id2"); DatabaseValidator instance = new DatabaseValidator(graph, nonValidDatabaseCheck()); ValidationResult validationResult = instance.check(); assertThat(validationResult.isValid(), is(false)); }
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();  }