WhiteboardRestrictionProvider extends AbstractServiceTracker<RestrictionProvider> implements RestrictionProvider { @NotNull @Override public RestrictionPattern getPattern(@Nullable String oakPath, @NotNull Tree tree) { return getProvider().getPattern(oakPath, tree); } WhiteboardRestrictionProvider(); @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 testDefaultGetPattern() { assertSame(RestrictionPattern.EMPTY, new WhiteboardRestrictionProvider().getPattern(PathUtils.ROOT_PATH, tree)); }
@Test public void testStartedGetPattern() { Whiteboard wb = new DefaultWhiteboard(); WhiteboardRestrictionProvider wrp = new WhiteboardRestrictionProvider(); wrp.start(wb); assertSame(RestrictionPattern.EMPTY, wrp.getPattern(PathUtils.ROOT_PATH, tree)); }
@Test(expected = RestrictionException.class) public void testRegisteredGetPattern() { registered.getPattern(PathUtils.ROOT_PATH, tree); }
@Test public void testGetPatternFromRestrictions() { Restriction r = mock(Restriction.class); restrictionProvider.getPattern("/testPath", ImmutableSet.of(r)); verify(registered, times(1)).getPattern("/testPath", ImmutableSet.of(r)); }