@Test public void testCreateRole() { AuthenticatedUser authenticatedUser = mock(AuthenticatedUser.class); RoleResource role = mock(RoleResource.class); RoleOptions roleOptions = mock(RoleOptions.class); auditRoleManager.createRole(authenticatedUser, role, roleOptions); verify(mockAuditWhitelistManager).createRoleOption(eq(roleOptions)); verify(mockWrappedRoleManager).createRole(eq(authenticatedUser), eq(role), eq(roleOptions)); }
@Override public void createRole(AuthenticatedUser performer, RoleResource role, RoleOptions options) throws RequestValidationException, RequestExecutionException { whitelistManager.createRoleOption(options); wrappedRoleManager.createRole(performer, role, options); }
AuditRoleManager implements IRoleManager { @Override public void createRole(AuthenticatedUser performer, RoleResource role, RoleOptions options) throws RequestValidationException, RequestExecutionException { whitelistManager.createRoleOption(options); wrappedRoleManager.createRole(performer, role, options); } }
AuditRoleManager implements IRoleManager { @Override public void createRole(AuthenticatedUser performer, RoleResource role, RoleOptions options) throws RequestValidationException, RequestExecutionException { whitelistManager.createRoleOption(options); wrappedRoleManager.createRole(performer, role, options); } AuditRoleManager(); @VisibleForTesting  AuditRoleManager(IRoleManager wrappedRoleManager, AuditWhitelistManager whitelistManager, AuditAdapter auditAdapter, IAuthenticator authenticator); }
AuditRoleManager implements IRoleManager { @Override public void createRole(AuthenticatedUser performer, RoleResource role, RoleOptions options) throws RequestValidationException, RequestExecutionException { whitelistManager.createRoleOption(options); wrappedRoleManager.createRole(performer, role, options); } 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 void createRole(AuthenticatedUser performer, RoleResource role, RoleOptions options) throws RequestValidationException, RequestExecutionException { whitelistManager.createRoleOption(options); wrappedRoleManager.createRole(performer, role, options); } 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);  }