@Test public void testDeclaredMembership() throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException { AuthorizableWrapper authWrapper = new AuthorizableWrapperImpl(adminResource); assertTrue(SlingCMSTestHelper.toStream(authWrapper.getDeclaredMembership()).anyMatch(g -> g == group2)); authWrapper = new AuthorizableWrapperImpl(throwyResource); assertFalse(authWrapper.getDeclaredMembership().hasNext()); }
@Override public Iterator<Group> getDeclaredMembership() { try { return authorizable.declaredMemberOf(); } catch (RepositoryException e) { log.error("Failed to get declared membership of authorizable: {}", authorizable, e); return Collections.emptyIterator(); } }
AuthorizableWrapperImpl implements AuthorizableWrapper { @Override public Iterator<Group> getDeclaredMembership() { try { return authorizable.declaredMemberOf(); } catch (RepositoryException e) { log.error("Failed to get declared membership of authorizable: {}", authorizable, e); return Collections.emptyIterator(); } } }
AuthorizableWrapperImpl implements AuthorizableWrapper { @Override public Iterator<Group> getDeclaredMembership() { try { return authorizable.declaredMemberOf(); } catch (RepositoryException e) { log.error("Failed to get declared membership of authorizable: {}", authorizable, e); return Collections.emptyIterator(); } } AuthorizableWrapperImpl(ResourceResolver resolver);  AuthorizableWrapperImpl(Resource resource); }
AuthorizableWrapperImpl implements AuthorizableWrapper { @Override public Iterator<Group> getDeclaredMembership() { try { return authorizable.declaredMemberOf(); } catch (RepositoryException e) { log.error("Failed to get declared membership of authorizable: {}", authorizable, e); return Collections.emptyIterator(); } } AuthorizableWrapperImpl(ResourceResolver resolver);  AuthorizableWrapperImpl(Resource resource); @Override Authorizable getAuthorizable(); @Override Iterator<Authorizable> getDeclaredMembers(); @Override Iterator<Group> getDeclaredMembership(); @Override Iterator<String> getGroupNames(); @Override String getId(); @Override Iterator<Authorizable> getMembers(); @Override Iterator<Group> getMembership(); @Override boolean isAdministrator(); @Override boolean isMember(String groupName); }
AuthorizableWrapperImpl implements AuthorizableWrapper { @Override public Iterator<Group> getDeclaredMembership() { try { return authorizable.declaredMemberOf(); } catch (RepositoryException e) { log.error("Failed to get declared membership of authorizable: {}", authorizable, e); return Collections.emptyIterator(); } } AuthorizableWrapperImpl(ResourceResolver resolver);  AuthorizableWrapperImpl(Resource resource); @Override Authorizable getAuthorizable(); @Override Iterator<Authorizable> getDeclaredMembers(); @Override Iterator<Group> getDeclaredMembership(); @Override Iterator<String> getGroupNames(); @Override String getId(); @Override Iterator<Authorizable> getMembers(); @Override Iterator<Group> getMembership(); @Override boolean isAdministrator(); @Override boolean isMember(String groupName);  }