@Test @SuppressWarnings("unchecked") public void testProtectedResources() { Set<IResource> cassandraResources = givenProtectedCassandraResources(mockWrappedRoleManager); Set<IResource> actualResources = (Set<IResource>) auditRoleManager.protectedResources(); assertThat(actualResources).containsAll(cassandraResources); assertThat(actualResources).containsAll(ImmutableSet.of(DataResource.table("system_auth", "role_audit_whitelists"), DataResource.table("system_auth", "role_audit_whitelists_v2"))); assertThat(actualResources).hasSize(cassandraResources.size() + 2); }
@Override public Set<? extends IResource> protectedResources() { Set<IResource> combinedSet = Sets.newHashSet(wrappedRoleManager.protectedResources()); combinedSet.add(DataResource.table(AuthKeyspace.NAME, AuditAuthKeyspace.WHITELIST_TABLE_NAME_V1)); combinedSet.add(DataResource.table(AuthKeyspace.NAME, AuditAuthKeyspace.WHITELIST_TABLE_NAME_V2)); return ImmutableSet.copyOf(combinedSet); }
AuditRoleManager implements IRoleManager { @Override public Set<? extends IResource> protectedResources() { Set<IResource> combinedSet = Sets.newHashSet(wrappedRoleManager.protectedResources()); combinedSet.add(DataResource.table(AuthKeyspace.NAME, AuditAuthKeyspace.WHITELIST_TABLE_NAME_V1)); combinedSet.add(DataResource.table(AuthKeyspace.NAME, AuditAuthKeyspace.WHITELIST_TABLE_NAME_V2)); return ImmutableSet.copyOf(combinedSet); } }
AuditRoleManager implements IRoleManager { @Override public Set<? extends IResource> protectedResources() { Set<IResource> combinedSet = Sets.newHashSet(wrappedRoleManager.protectedResources()); combinedSet.add(DataResource.table(AuthKeyspace.NAME, AuditAuthKeyspace.WHITELIST_TABLE_NAME_V1)); combinedSet.add(DataResource.table(AuthKeyspace.NAME, AuditAuthKeyspace.WHITELIST_TABLE_NAME_V2)); return ImmutableSet.copyOf(combinedSet); } AuditRoleManager(); @VisibleForTesting  AuditRoleManager(IRoleManager wrappedRoleManager, AuditWhitelistManager whitelistManager, AuditAdapter auditAdapter, IAuthenticator authenticator); }
AuditRoleManager implements IRoleManager { @Override public Set<? extends IResource> protectedResources() { Set<IResource> combinedSet = Sets.newHashSet(wrappedRoleManager.protectedResources()); combinedSet.add(DataResource.table(AuthKeyspace.NAME, AuditAuthKeyspace.WHITELIST_TABLE_NAME_V1)); combinedSet.add(DataResource.table(AuthKeyspace.NAME, AuditAuthKeyspace.WHITELIST_TABLE_NAME_V2)); return ImmutableSet.copyOf(combinedSet); } AuditRoleManager(); @VisibleForTesting  AuditRoleManager(IRoleManager wrappedRoleManager, AuditWhitelistManager whitelistManager, AuditAdapter auditAdapter, IAuthenticator authenticator); @Override void validateConfiguration(); @Override void setup(); @Override Set<? extends IResource> protectedResources(); @Override Set<Option> supportedOptions(); @Override Set<Option> alterableOptions(); @Override void createRole(AuthenticatedUser performer, RoleResource role, RoleOptions options); @Override void alterRole(AuthenticatedUser performer, RoleResource role, RoleOptions options); @Override Map<String, String> getCustomOptions(RoleResource role); @Override void grantRole(AuthenticatedUser performer, RoleResource role, RoleResource grantee); @Override void revokeRole(AuthenticatedUser performer, RoleResource role, RoleResource revokee); @Override void dropRole(AuthenticatedUser performer, RoleResource role); @Override Set<RoleResource> getRoles(RoleResource grantee, boolean includeInherited); @Override Set<RoleResource> getAllRoles(); @Override boolean isSuper(RoleResource role); @Override boolean canLogin(RoleResource role); @Override boolean isExistingRole(RoleResource role); }
AuditRoleManager implements IRoleManager { @Override public Set<? extends IResource> protectedResources() { Set<IResource> combinedSet = Sets.newHashSet(wrappedRoleManager.protectedResources()); combinedSet.add(DataResource.table(AuthKeyspace.NAME, AuditAuthKeyspace.WHITELIST_TABLE_NAME_V1)); combinedSet.add(DataResource.table(AuthKeyspace.NAME, AuditAuthKeyspace.WHITELIST_TABLE_NAME_V2)); return ImmutableSet.copyOf(combinedSet); } AuditRoleManager(); @VisibleForTesting  AuditRoleManager(IRoleManager wrappedRoleManager, AuditWhitelistManager whitelistManager, AuditAdapter auditAdapter, IAuthenticator authenticator); @Override void validateConfiguration(); @Override void setup(); @Override Set<? extends IResource> protectedResources(); @Override Set<Option> supportedOptions(); @Override Set<Option> alterableOptions(); @Override void createRole(AuthenticatedUser performer, RoleResource role, RoleOptions options); @Override void alterRole(AuthenticatedUser performer, RoleResource role, RoleOptions options); @Override Map<String, String> getCustomOptions(RoleResource role); @Override void grantRole(AuthenticatedUser performer, RoleResource role, RoleResource grantee); @Override void revokeRole(AuthenticatedUser performer, RoleResource role, RoleResource revokee); @Override void dropRole(AuthenticatedUser performer, RoleResource role); @Override Set<RoleResource> getRoles(RoleResource grantee, boolean includeInherited); @Override Set<RoleResource> getAllRoles(); @Override boolean isSuper(RoleResource role); @Override boolean canLogin(RoleResource role); @Override boolean isExistingRole(RoleResource role);  }