@Test public void testUncoveredAncestorNodesFailure() throws IOException, ConfigurationException { DefaultWorkspaceFilter filter = new DefaultWorkspaceFilter(); try (InputStream input = this.getClass().getResourceAsStream("/filter.xml")) { filter.load(input); } validator = new AdvancedFilterValidator( factory, ValidationMessageSeverity.ERROR, AdvancedFilterValidatorFactory.DEFAULT_SEVERITY_FOR_UNCOVERED_ANCESTOR_NODES, ValidationMessageSeverity.ERROR, ValidationMessageSeverity.ERROR, false, dependenciesMetaInfo, filter, validRoots); ValidationExecutorTest.assertViolation(validator.validateJcrPath(getStandardNodeContext("/apps"), false), ValidationMessageSeverity.INFO, new ValidationMessage(ValidationMessageSeverity.INFO, String.format(AdvancedFilterValidator.MESSAGE_ANCESTOR_NODE_NOT_COVERED_BUT_VALID_ROOT, "/apps"))); ValidationExecutorTest.assertViolation(validator.validateJcrPath(getStandardNodeContext("/apps/test4"), false), ValidationMessageSeverity.INFO, new ValidationMessage(ValidationMessageSeverity.INFO, String.format(AdvancedFilterValidator.MESSAGE_ANCESTOR_NODE_NOT_COVERED, "/apps/test4"))); validator = new AdvancedFilterValidator( factory, ValidationMessageSeverity.ERROR, ValidationMessageSeverity.ERROR, ValidationMessageSeverity.ERROR, ValidationMessageSeverity.ERROR, false, dependenciesMetaInfo, filter, validRoots); ValidationExecutorTest.assertViolation(validator.validateJcrPath(getStandardNodeContext("/apps/test4"), false), ValidationMessageSeverity.INFO, new ValidationMessage(ValidationMessageSeverity.ERROR, String.format(AdvancedFilterValidator.MESSAGE_ANCESTOR_NODE_NOT_COVERED, "/apps/test4"))); validRoots.add("/someroot"); validator = new AdvancedFilterValidator( factory, ValidationMessageSeverity.ERROR, ValidationMessageSeverity.WARN, ValidationMessageSeverity.ERROR, ValidationMessageSeverity.ERROR, false, dependenciesMetaInfo, filter, Collections.emptyList()); ValidationExecutorTest.assertViolation(validator.validateJcrPath(getStandardNodeContext("/apps"), false), ValidationMessageSeverity.WARN, new ValidationMessage(ValidationMessageSeverity.WARN, String.format(AdvancedFilterValidator.MESSAGE_ANCESTOR_NODE_NOT_COVERED, "/apps"))); }
@Override public @Nullable Collection<ValidationMessage> validateJcrPath(@NotNull NodeContext nodeContext, boolean isFolder) { if (!isFolder) { return validateFileNodePath(nodeContext.getNodePath()); } else { return null; } }
AdvancedFilterValidator implements GenericMetaInfDataValidator, FilterValidator, DocumentViewXmlValidator, JcrPathValidator { @Override public @Nullable Collection<ValidationMessage> validateJcrPath(@NotNull NodeContext nodeContext, boolean isFolder) { if (!isFolder) { return validateFileNodePath(nodeContext.getNodePath()); } else { return null; } } }
AdvancedFilterValidator implements GenericMetaInfDataValidator, FilterValidator, DocumentViewXmlValidator, JcrPathValidator { @Override public @Nullable Collection<ValidationMessage> validateJcrPath(@NotNull NodeContext nodeContext, boolean isFolder) { if (!isFolder) { return validateFileNodePath(nodeContext.getNodePath()); } else { return null; } } AdvancedFilterValidator(@NotNull DocumentBuilderFactory factory, @NotNull ValidationMessageSeverity defaultSeverity, @NotNull ValidationMessageSeverity severityForUncoveredAncestorNodes, @NotNull ValidationMessageSeverity severityForUncoveredFilterRootAncestors, @NotNull ValidationMessageSeverity severityForOrphanedFilterEntries, boolean isSubPackage, @NotNull Collection<PackageInfo> dependenciesMetaInfo, @NotNull WorkspaceFilter filter, @NotNull Collection<String> validRoots); }
AdvancedFilterValidator implements GenericMetaInfDataValidator, FilterValidator, DocumentViewXmlValidator, JcrPathValidator { @Override public @Nullable Collection<ValidationMessage> validateJcrPath(@NotNull NodeContext nodeContext, boolean isFolder) { if (!isFolder) { return validateFileNodePath(nodeContext.getNodePath()); } else { return null; } } AdvancedFilterValidator(@NotNull DocumentBuilderFactory factory, @NotNull ValidationMessageSeverity defaultSeverity, @NotNull ValidationMessageSeverity severityForUncoveredAncestorNodes, @NotNull ValidationMessageSeverity severityForUncoveredFilterRootAncestors, @NotNull ValidationMessageSeverity severityForOrphanedFilterEntries, boolean isSubPackage, @NotNull Collection<PackageInfo> dependenciesMetaInfo, @NotNull WorkspaceFilter filter, @NotNull Collection<String> validRoots); void setFilterValidators(Map<String, FilterValidator> filterValidators); @Override Collection<ValidationMessage> done(); @Override Collection<ValidationMessage> validate(@NotNull WorkspaceFilter filter); @Override @Nullable Collection<ValidationMessage> validateJcrPath(@NotNull NodeContext nodeContext,
            boolean isFolder); @Override @Nullable Collection<ValidationMessage> validate(@NotNull DocViewNode node, @NotNull NodeContext nodeContext,
            boolean isRoot); @Override Collection<ValidationMessage> validateMetaInfData(@NotNull InputStream input, @NotNull Path filePath, @NotNull Path basePath); @Override boolean shouldValidateMetaInfData(@NotNull Path filePath); }
AdvancedFilterValidator implements GenericMetaInfDataValidator, FilterValidator, DocumentViewXmlValidator, JcrPathValidator { @Override public @Nullable Collection<ValidationMessage> validateJcrPath(@NotNull NodeContext nodeContext, boolean isFolder) { if (!isFolder) { return validateFileNodePath(nodeContext.getNodePath()); } else { return null; } } AdvancedFilterValidator(@NotNull DocumentBuilderFactory factory, @NotNull ValidationMessageSeverity defaultSeverity, @NotNull ValidationMessageSeverity severityForUncoveredAncestorNodes, @NotNull ValidationMessageSeverity severityForUncoveredFilterRootAncestors, @NotNull ValidationMessageSeverity severityForOrphanedFilterEntries, boolean isSubPackage, @NotNull Collection<PackageInfo> dependenciesMetaInfo, @NotNull WorkspaceFilter filter, @NotNull Collection<String> validRoots); void setFilterValidators(Map<String, FilterValidator> filterValidators); @Override Collection<ValidationMessage> done(); @Override Collection<ValidationMessage> validate(@NotNull WorkspaceFilter filter); @Override @Nullable Collection<ValidationMessage> validateJcrPath(@NotNull NodeContext nodeContext,
            boolean isFolder); @Override @Nullable Collection<ValidationMessage> validate(@NotNull DocViewNode node, @NotNull NodeContext nodeContext,
            boolean isRoot); @Override Collection<ValidationMessage> validateMetaInfData(@NotNull InputStream input, @NotNull Path filePath, @NotNull Path basePath); @Override boolean shouldValidateMetaInfData(@NotNull Path filePath);  }