CompositeUserRoleListService implements IUserRoleListService { @Override public List<String> getUsersInRole( final ITenant tenant, final String role ) { return collectResultsForOperation( new CompositeOperation() { @Override public List<String> perform( IUserRoleListService service ) { return service.getUsersInRole( tenant, role ); } } ); } CompositeUserRoleListService( List<IUserRoleListService> delegates ); void setStrategy( STRATEGY strategy ); void setStrategy( String strategy ); STRATEGY getActiveStrategy(); @Override List<String> getAllRoles(); @Override List<String> getSystemRoles(); @Override List<String> getAllRoles( final ITenant tenant ); @Override List<String> getAllUsers(); @Override List<String> getAllUsers( final ITenant tenant ); @Override List<String> getUsersInRole( final ITenant tenant, final String role ); @Override List<String> getRolesForUser( final ITenant tenant, final String username );  }
@Test public void testGetUsersInRole() throws Exception { List<String> allUsers = compositeService.getUsersInRole( mockTenant, "ceo" ); assertEquals( 1, allUsers.size() ); compositeService.setStrategy( CompositeUserRoleListService.STRATEGY.ADDITIVE ); allUsers = compositeService.getUsersInRole( mockTenant, "ceo" ); assertEquals( 2, allUsers.size() ); assertTrue( unsortedEqualArrays( allUsers.toArray( new String[allUsers.size()] ), new String[]{"ted", "suzy"} ) ); }