@Test public void testAddBudgetPersonWithAppointments() throws Exception { assertTrue(budget.getBudgetPersons().isEmpty()); BudgetPerson testPerson = new BudgetPerson(); KcPerson person = kcPersonService.getKcPersonByPersonId(testAppointmentPersonId); testPerson.setPersonId(testAppointmentPersonId); budgetPersonService.addBudgetPerson(budget, testPerson); assertFalse(person.getExtendedAttributes().getPersonAppointments().isEmpty()); assertTrue( person.getExtendedAttributes().getPersonAppointments().size() == budget.getBudgetPersons().size()); }
@Override protected List<KcPerson> getPersonsInRole(String roleName) { KcAuthorizationService kraAuthorizationService = KcServiceLocator.getService(KcAuthorizationService.class); KcPersonService kcPersonService = KcServiceLocator.getService(KcPersonService.class); List<String> users = kraAuthorizationService.getPrincipalsInRole(roleName, getProtocol()); final List<KcPerson> persons = new ArrayList<KcPerson>(); for (String userId : users) { KcPerson person = kcPersonService.getKcPersonByPersonId(userId); if (person != null && person.getActive()) { persons.add(person); } } return persons; }