@Test public void test_filter() throws Exception { try (InputStream input = this.getClass().getResourceAsStream("/oak-index/filter.xml")) { DefaultWorkspaceFilter filter = new DefaultWorkspaceFilter(); filter.load(input); Collection<ValidationMessage> messages = validator.validate(filter); ValidationExecutorTest.assertViolation(messages, new ValidationMessage(ValidationMessageSeverity.ERROR, String.format(OakIndexDefinitionValidator.MESSAGE_POTENTIAL_INDEX_IN_FILTER, rootPackagePath,"/oak:index/ccProfile")), new ValidationMessage(ValidationMessageSeverity.ERROR, String .format(OakIndexDefinitionValidator.MESSAGE_POTENTIAL_INDEX_IN_FILTER, rootPackagePath, "/apps/project/oak:index/indexDef")), new ValidationMessage(ValidationMessageSeverity.ERROR, String .format(OakIndexDefinitionValidator.MESSAGE_POTENTIAL_INDEX_IN_FILTER, rootPackagePath, "/apps/anotherproject/oak:index"))); } }
@Override public @Nullable Collection<ValidationMessage> validate(@NotNull WorkspaceFilter filter) { Collection<ValidationMessage> violations = new LinkedList<>(); violations.addAll(collectIndexPaths(filter.getFilterSets())); return violations; }
OakIndexDefinitionValidator implements FilterValidator, DocumentViewXmlValidator { @Override public @Nullable Collection<ValidationMessage> validate(@NotNull WorkspaceFilter filter) { Collection<ValidationMessage> violations = new LinkedList<>(); violations.addAll(collectIndexPaths(filter.getFilterSets())); return violations; } }
OakIndexDefinitionValidator implements FilterValidator, DocumentViewXmlValidator { @Override public @Nullable Collection<ValidationMessage> validate(@NotNull WorkspaceFilter filter) { Collection<ValidationMessage> violations = new LinkedList<>(); violations.addAll(collectIndexPaths(filter.getFilterSets())); return violations; } OakIndexDefinitionValidator(Path path, ValidationMessageSeverity defaultMessageSeverity); }
OakIndexDefinitionValidator implements FilterValidator, DocumentViewXmlValidator { @Override public @Nullable Collection<ValidationMessage> validate(@NotNull WorkspaceFilter filter) { Collection<ValidationMessage> violations = new LinkedList<>(); violations.addAll(collectIndexPaths(filter.getFilterSets())); return violations; } OakIndexDefinitionValidator(Path path, ValidationMessageSeverity defaultMessageSeverity); @Override @Nullable Collection<ValidationMessage> validate(@NotNull WorkspaceFilter filter); Collection<ValidationMessage> collectIndexPaths(List<PathFilterSet> pathFilters); @Override @Nullable Collection<ValidationMessage> validate(@NotNull DocViewNode node, @NotNull String nodePath, @NotNull Path filePath, boolean isRoot); @Override @Nullable Collection<ValidationMessage> done(); }
OakIndexDefinitionValidator implements FilterValidator, DocumentViewXmlValidator { @Override public @Nullable Collection<ValidationMessage> validate(@NotNull WorkspaceFilter filter) { Collection<ValidationMessage> violations = new LinkedList<>(); violations.addAll(collectIndexPaths(filter.getFilterSets())); return violations; } OakIndexDefinitionValidator(Path path, ValidationMessageSeverity defaultMessageSeverity); @Override @Nullable Collection<ValidationMessage> validate(@NotNull WorkspaceFilter filter); Collection<ValidationMessage> collectIndexPaths(List<PathFilterSet> pathFilters); @Override @Nullable Collection<ValidationMessage> validate(@NotNull DocViewNode node, @NotNull String nodePath, @NotNull Path filePath, boolean isRoot); @Override @Nullable Collection<ValidationMessage> done();  }