AbstractRestrictionProvider implements RestrictionProvider, AccessControlConstants { @Override public void writeRestrictions(String oakPath, Tree aceTree, Set<Restriction> restrictions) throws RepositoryException { if (!restrictions.isEmpty()) { Tree rTree = TreeUtil.getOrAddChild(aceTree, REP_RESTRICTIONS, NT_REP_RESTRICTIONS); for (Restriction restriction : restrictions) { rTree.setProperty(restriction.getProperty()); } } } 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 testWriteEmptyRestrictions() throws Exception { restrictionProvider.writeRestrictions(null, getAceTree(), Collections.emptySet()); }
@Test public void testWriteRestrictions() throws Exception { Restriction ntNames = restrictionProvider.createRestriction(testPath, REP_NT_NAMES, nameValues); Tree aceTree = getAceTree(); restrictionProvider.writeRestrictions(null, aceTree, Collections.singleton(ntNames)); verify(aceTree, times(1)).getChild(REP_RESTRICTIONS); verify(aceTree.getChild(REP_RESTRICTIONS), times(1)).setProperty(ntNames.getProperty()); }