UserProjectsLdapServiceImpl extends AbstractOpenEngSBConnectorService implements UserProjectsDomain { @Override public void updateUsers(List<User> users) { for (User user : users) { storeOverwriteExisting(EntryFactory.userStructure(user)); } } 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 testUpdateUsers_shouldCreateUser() throws LdapInvalidAttributeValueException, NoSuchNodeException, MissingParentException { User user = createTestUser(); ldapService.updateUsers(Lists.newArrayList(user)); assertThat(ldapDao.exists(DnFactory.user(user)), is(true)); assertCredentialsCorrectlyStored(user); assertAttributesCorrectlyStored(user); }
@Test public void testUpdateUsers_shouldUpdateUser() throws NoSuchNodeException, MissingParentException, LdapInvalidAttributeValueException { User user = createTestUser(); ldapService.updateUsers(Lists.newArrayList(user)); Credential credential = user.getCredentials().iterator().next(); credential.setValue(credential.getValue() + "new"); Attribute attribute1 = user.getAttributes().iterator().next(); attribute1.getValues().add("new"); Attribute attribute2 = createTestAttribute("attribute2", "value"); user.getAttributes().add(attribute2); ldapService.updateUsers(Lists.newArrayList(user)); assertCredentialsCorrectlyStored(user); assertAttributesCorrectlyStored(user); }