UserProjectsLdapServiceImpl extends AbstractOpenEngSBConnectorService implements UserProjectsDomain { @Override public void updateRoles(List<Role> roles) { for (Role role : roles) { storeOverwriteExisting(EntryFactory.roleStructure(role)); } } UserProjectsLdapServiceImpl();  UserProjectsLdapServiceImpl(LdapDao ldapDao); @Override AliveState getAliveState(); void setLdapDao(LdapDao dao); @Override void updateAssignments(List<Assignment> assignments); @Override void updatePermissions(List<Permission> permissions); @Override void updateProjects(List<Project> projects); @Override void updateRoles(List<Role> roles); @Override void updateUsers(List<User> users); @Override void deleteAssignments(List<Assignment> assignments); @Override void deletePermissions(List<Permission> permissions); @Override void deleteProjects(List<Project> projects); @Override void deleteRoles(List<Role> roles); @Override void deleteUsers(List<User> users);  }
@Test public void testUpdateRoles_shouldCreateRole() throws LdapInvalidAttributeValueException, NoSuchNodeException, MissingParentException { Role role = createTestRole(); ldapService.updateRoles(Lists.newArrayList(role)); assertThat(ldapDao.exists(DnFactory.role(role)), is(true)); assertCorrectlyStored(role); }
@Test public void testUpdateRoles_shouldUpdateRole() throws LdapInvalidAttributeValueException, NoSuchNodeException, MissingParentException { Role role = createTestRole(); ldapService.updateRoles(Lists.newArrayList(role)); role.getPermissions().add("update"); role.getRoles().clear(); ldapService.updateRoles(Lists.newArrayList(role)); assertCorrectlyStored(role); }