CompositeUserRoleListService implements IUserRoleListService { public void setStrategy( STRATEGY strategy ) { this.activeStrategy = strategy; } 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 testSetStrategy() throws Exception { compositeService = new CompositeUserRoleListService( Collections.<IUserRoleListService>emptyList() ); assertEquals( CompositeUserRoleListService.STRATEGY.FIRST_MATCH, compositeService.getActiveStrategy() ); compositeService.setStrategy( CompositeUserRoleListService.STRATEGY.ADDITIVE ); assertEquals( CompositeUserRoleListService.STRATEGY.ADDITIVE, compositeService.getActiveStrategy() ); compositeService.setStrategy( CompositeUserRoleListService.STRATEGY.FIRST_MATCH ); assertEquals( CompositeUserRoleListService.STRATEGY.FIRST_MATCH, compositeService.getActiveStrategy() ); }