use of org.apache.directory.api.ldap.model.entry.DefaultModification in project midpoint by Evolveum.
the class AbstractAdLdapTest method doAdditionalRenameModifications.
@Override
protected void doAdditionalRenameModifications(LdapNetworkConnection connection) throws LdapException {
Modification mod = new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, ATTRIBUTE_SAM_ACCOUNT_NAME_NAME, ACCOUNT_HTM_UID);
connection.modify(toAccountDn(ACCOUNT_HTM_UID, ACCOUNT_HTM_CN), mod);
display("Modified " + toAccountDn(ACCOUNT_HT_UID, ACCOUNT_HT_CN) + " " + ATTRIBUTE_SAM_ACCOUNT_NAME_NAME + " -> " + ACCOUNT_HTM_UID + ": " + mod);
}
use of org.apache.directory.api.ldap.model.entry.DefaultModification in project midpoint by Evolveum.
the class AbstractLdapSynchronizationTest method test822ModifyAccountHt.
@Test
public void test822ModifyAccountHt() throws Exception {
final String TEST_NAME = "test822ModifyAccountHt";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
long tsStart = System.currentTimeMillis();
// WHEN
TestUtil.displayWhen(TEST_NAME);
LdapNetworkConnection connection = ldapConnect();
Modification modCn = new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, "sn", ACCOUNT_HT_SN_MODIFIED);
connection.modify(toAccountDn(ACCOUNT_HT_UID, ACCOUNT_HT_CN), modCn);
ldapDisconnect(connection);
waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
long tsEnd = System.currentTimeMillis();
PrismObject<UserType> user = findUserByUsername(ACCOUNT_HT_UID);
assertNotNull("No user " + ACCOUNT_HT_UID + " created", user);
assertUser(user, user.getOid(), ACCOUNT_HT_UID, ACCOUNT_HT_CN, ACCOUNT_HT_GIVENNAME, ACCOUNT_HT_SN_MODIFIED);
assertStepSyncToken(getSyncTaskOid(), 7, tsStart, tsEnd);
}
use of org.apache.directory.api.ldap.model.entry.DefaultModification in project midpoint by Evolveum.
the class AbstractLdapSynchronizationTest method test802ModifyAccountHt.
// Do not change cn here. This triggers rename in the AD case.
@Test
public void test802ModifyAccountHt() throws Exception {
final String TEST_NAME = "test802ModifyAccountHt";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
long tsStart = System.currentTimeMillis();
// WHEN
TestUtil.displayWhen(TEST_NAME);
LdapNetworkConnection connection = ldapConnect();
Modification modCn = new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, "sn", ACCOUNT_HT_SN_MODIFIED);
connection.modify(toAccountDn(ACCOUNT_HT_UID, ACCOUNT_HT_CN), modCn);
ldapDisconnect(connection);
waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
long tsEnd = System.currentTimeMillis();
PrismObject<UserType> user = findUserByUsername(ACCOUNT_HT_UID);
assertNotNull("No user " + ACCOUNT_HT_UID + " created", user);
assertUser(user, user.getOid(), ACCOUNT_HT_UID, ACCOUNT_HT_CN, ACCOUNT_HT_GIVENNAME, ACCOUNT_HT_SN_MODIFIED);
assertStepSyncToken(getSyncTaskOid(), 2, tsStart, tsEnd);
}
Aggregations