CompositeRestrictionProvider implements RestrictionProvider { @Override public void writeRestrictions(String oakPath, Tree aceTree, Set<Restriction> restrictions) throws RepositoryException { for (Restriction r : restrictions) { RestrictionProvider rp = getProvider(oakPath, getName(r)); rp.writeRestrictions(oakPath, aceTree, Collections.singleton(r)); } } private  CompositeRestrictionProvider(@NotNull Collection<? extends RestrictionProvider> providers); static RestrictionProvider newInstance(@NotNull RestrictionProvider... providers); static RestrictionProvider newInstance(@NotNull Collection<? extends RestrictionProvider> providers); @NotNull @Override Set<RestrictionDefinition> getSupportedRestrictions(@Nullable String oakPath); @NotNull @Override Restriction createRestriction(@Nullable String oakPath, @NotNull String oakName, @NotNull Value value); @NotNull @Override Restriction createRestriction(@Nullable String oakPath, @NotNull String oakName, @NotNull Value... values); @NotNull @Override Set<Restriction> readRestrictions(@Nullable String oakPath, @NotNull Tree aceTree); @Override void writeRestrictions(String oakPath, Tree aceTree, Set<Restriction> restrictions); @Override void validateRestrictions(@Nullable String oakPath, @NotNull Tree aceTree); @NotNull @Override RestrictionPattern getPattern(@Nullable String oakPath, @NotNull Tree tree); @NotNull @Override RestrictionPattern getPattern(@Nullable String oakPath, @NotNull Set<Restriction> restrictions);  }
@Test public void testWriteEmptyRestrictions() throws Exception { provider.writeRestrictions("/test", getAceTree(), Collections.emptySet()); }
@Test public void testWriteRestrictions() throws Exception { Tree aceTree = getAceTree(); provider.writeRestrictions("/test", aceTree, ImmutableSet.of(LONGS_RESTRICTION, GLOB_RESTRICTION)); verify(rp1, times(1)).writeRestrictions("/test", aceTree, Collections.singleton(GLOB_RESTRICTION)); verify(rp2, times(1)).writeRestrictions("/test", aceTree, Collections.singleton(LONGS_RESTRICTION)); }