AbstractRestrictionProvider implements RestrictionProvider, AccessControlConstants { @NotNull @Override public Set<Restriction> readRestrictions(String oakPath, @NotNull Tree aceTree) { if (isUnsupportedPath(oakPath)) { return Collections.emptySet(); } else { Set<Restriction> restrictions = new HashSet<>(); for (PropertyState propertyState : getRestrictionsTree(aceTree).getProperties()) { String propName = propertyState.getName(); if (isRestrictionProperty(propName) && supported.containsKey(propName)) { RestrictionDefinition def = supported.get(propName); if (def.getRequiredType() == propertyState.getType()) { restrictions.add(createRestriction(propertyState, def)); } } } return restrictions; } } AbstractRestrictionProvider(@NotNull Map<String, ? extends RestrictionDefinition> definitions); @NotNull @Override Set<RestrictionDefinition> getSupportedRestrictions(String oakPath); @NotNull @Override Restriction createRestriction(String oakPath, @NotNull String oakName, @NotNull Value value); @NotNull @Override Restriction createRestriction(String oakPath, @NotNull String oakName, @NotNull Value... values); @NotNull @Override Set<Restriction> readRestrictions(String oakPath, @NotNull Tree aceTree); @Override void writeRestrictions(String oakPath, Tree aceTree, Set<Restriction> restrictions); @Override void validateRestrictions(String oakPath, @NotNull Tree aceTree);  }
@Test public void testReadRestrictionsForUnsupportedPath() { Set<Restriction> restrictions = restrictionProvider.readRestrictions(unsupportedPath, getAceTree()); assertTrue(restrictions.isEmpty()); }
@Test public void testReadRestrictions() throws Exception { Restriction r = restrictionProvider.createRestriction(testPath, REP_GLOB, globValue); Tree aceTree = getAceTree(r); Set<Restriction> restrictions = restrictionProvider.readRestrictions(testPath, aceTree); assertEquals(1, restrictions.size()); assertTrue(restrictions.contains(r)); }