}
public void testUpdateSingleValuedEntityAttr() throws Exception
{
// first assert that the sample user is equal to the corresponding user in LDAP
EntityImpl sampleUser = getDefaultJoeSmith();
basicTestCases.testFetchSingleEntity(entityManager, sampleUser);
// next, try some identity transformation checks to assert that updating works
// 1. test attribute modification
sampleUser.setAttribute(GIVEN_NAME_DEF.getName(), "Joe Smith modified");
entityManager.updateEntity(sampleUser);
basicTestCases.testFetchSingleEntity(entityManager, sampleUser);
// test attribute removal
sampleUser = new EntityImpl("user", "jsmith", userAttrDefs);
sampleUser
.setInternalId("cn=jsmith, ou=People, ou=OrgUnit3, o=sevenSeas");
sampleUser.setAttribute(UID_DEF.getName(), "jsmith");
sampleUser.setAttribute(CN_DEF.getName(), "jsmith");
sampleUser.setAttribute(SN_DEF.getName(), "jsmith");
entityManager.updateEntity(sampleUser);
basicTestCases.testFetchSingleEntity(entityManager, sampleUser);
// add "lastname" attribute value
sampleUser = new EntityImpl("user", "jsmith", userAttrDefs);
sampleUser
.setInternalId("cn=jsmith, ou=People, ou=OrgUnit3, o=sevenSeas");
sampleUser.setAttribute(UID_DEF.getName(), "jsmith");
sampleUser.setAttribute(CN_DEF.getName(), "jsmith");
sampleUser.setAttribute(SN_DEF.getName(), "jsmith");
sampleUser.setAttribute(LAST_NAME_DEF.getName(), "jsmith");
entityManager.updateEntity(sampleUser);
basicTestCases.testFetchSingleEntity(entityManager, sampleUser);
// test attribute removal of required attribute ("lastname") with a required default value set for it
sampleUser = new EntityImpl("user", "jsmith", userAttrDefs);
sampleUser
.setInternalId("cn=jsmith, ou=People, ou=OrgUnit3, o=sevenSeas");
sampleUser.setAttribute(CN_DEF.getName(), "jsmith");
sampleUser.setAttribute(SN_DEF.getName(), "jsmith");
sampleUser.setAttribute(UID_DEF.getName(), "jsmith");
entityManager.updateEntity(sampleUser);
basicTestCases.testFetchSingleEntity(entityManager, sampleUser);