use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class AbstractInboundSyncTest method test300AddDummyEmeraldAccountPosixUser.
@Test
public void test300AddDummyEmeraldAccountPosixUser() throws Exception {
// GIVEN
rememberTimeBeforeSync();
prepareNotifications();
// Preconditions
assertUsers(7);
DummyAccount account = new DummyAccount(ACCOUNT_POSIXUSER_DUMMY_USERNAME);
account.setEnabled(true);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Posix User");
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "Melee Island");
account.addAuxiliaryObjectClassName(DummyResourceContoller.DUMMY_POSIX_ACCOUNT_OBJECT_CLASS_NAME);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_POSIX_UID_NUMBER, Collections.<Object>singleton(1001));
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_POSIX_GID_NUMBER, Collections.<Object>singleton(10001));
// / WHEN
when();
displayValue("Adding dummy account", account.debugDump());
dummyResourceEmerald.addAccount(account);
waitForSyncTaskNextRun(resourceDummyEmerald);
// THEN
then();
PrismObject<ShadowType> accountPosixUser = findAccountByUsername(ACCOUNT_POSIXUSER_DUMMY_USERNAME, resourceDummyEmerald);
display("Account posixuser", accountPosixUser);
assertNotNull("No posixuser account shadow", accountPosixUser);
assertEquals("Wrong resourceRef in posixuser account", RESOURCE_DUMMY_EMERALD_OID, accountPosixUser.asObjectable().getResourceRef().getOid());
assertShadowOperationalData(accountPosixUser, SynchronizationSituationType.LINKED);
PrismObject<UserType> userPosixUser = findUserByUsername(ACCOUNT_POSIXUSER_DUMMY_USERNAME);
display("User posixuser", userPosixUser);
assertNotNull("User posixuser was not created", userPosixUser);
assertLiveLinks(userPosixUser, 1);
assertAdministrativeStatusEnabled(userPosixUser);
assertLinked(userPosixUser, accountPosixUser);
assertUsers(8);
// notifications
notificationManager.setDisabled(true);
// TODO create and test inbounds for uid and gid numbers; also other attributes
// (Actually I'm not sure it will work, as even now the auxiliary object class is
// removed right during the livesync. This has to be solved somehow...)
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class AbstractInboundSyncTest method test310ModifyDummyEmeraldAccountPosixUserUidNumber.
@Test
public void test310ModifyDummyEmeraldAccountPosixUserUidNumber() throws Exception {
// GIVEN
rememberTimeBeforeSync();
prepareNotifications();
// Preconditions
assertUsers(8);
DummyAccount account = dummyResourceEmerald.getAccountByUsername(ACCOUNT_POSIXUSER_DUMMY_USERNAME);
// / WHEN
when();
account.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_POSIX_UID_NUMBER, 1002);
displayValue("Modified dummy account", account.debugDump());
waitForSyncTaskNextRun(resourceDummyEmerald);
// THEN
then();
PrismObject<ShadowType> accountAfter = findAccountByUsername(ACCOUNT_POSIXUSER_DUMMY_USERNAME, resourceDummyEmerald);
display("Account posixuser", accountAfter);
assertNotNull("No posixuser account shadow", accountAfter);
assertEquals("Wrong resourceRef in posixuser account", RESOURCE_DUMMY_EMERALD_OID, accountAfter.asObjectable().getResourceRef().getOid());
assertShadowOperationalData(accountAfter, SynchronizationSituationType.LINKED);
PrismObject<UserType> userAfter = findUserByUsername(ACCOUNT_POSIXUSER_DUMMY_USERNAME);
display("User posixuser", userAfter);
assertNotNull("User posixuser was not created", userAfter);
assertLiveLinks(userAfter, 1);
assertAdministrativeStatusEnabled(userAfter);
assertLinked(userAfter, accountAfter);
assertUsers(8);
// notifications
notificationManager.setDisabled(true);
// TODO create and test inbounds for uid and gid numbers; also other attributes
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class AbstractInboundSyncTest method test124ModifyDummyEmeraldAccountMancombSeepevil.
@Test
public void test124ModifyDummyEmeraldAccountMancombSeepevil() throws Exception {
// GIVEN
rememberTimeBeforeSync();
prepareNotifications();
// Preconditions
assertUsers(7);
DummyAccount account = dummyResourceEmerald.getAccountByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME);
// / WHEN
when();
account.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Mancomb Seepevil");
displayValue("Modified dummy account", account.debugDump());
waitForSyncTaskNextRun(resourceDummyEmerald);
// THEN
then();
PrismObject<ShadowType> accountAfter = findAccountByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME, resourceDummyEmerald);
display("Account mancomb", accountAfter);
assertNotNull("No mancomb account shadow", accountAfter);
assertEquals("Wrong resourceRef in mancomb account", RESOURCE_DUMMY_EMERALD_OID, accountAfter.asObjectable().getResourceRef().getOid());
assertShadowOperationalData(accountAfter, SynchronizationSituationType.LINKED);
assertDummyAccountAttribute(RESOURCE_DUMMY_EMERALD_NAME, ACCOUNT_MANCOMB_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Mancomb Seepevil");
PrismObject<UserType> userAfter = findUserByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME);
display("User mancomb", userAfter);
assertNotNull("User mancomb was not created", userAfter);
assertLiveLinks(userAfter, 1);
assertAdministrativeStatusEnabled(userAfter);
assertValidFrom(userAfter, ACCOUNT_MANCOMB_VALID_FROM_DATE);
assertValidTo(userAfter, ACCOUNT_MANCOMB_VALID_TO_DATE);
assertLinked(userAfter, accountAfter);
PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PrismTestUtil.createPolyString("Mancomb Seepevil"));
assertUsers(7);
// notifications
notificationManager.setDisabled(true);
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class AbstractInboundSyncTest method test120ModifyDummyEmeraldAccountMancombSeepbad.
@Test
public void test120ModifyDummyEmeraldAccountMancombSeepbad() throws Exception {
// GIVEN
rememberTimeBeforeSync();
prepareNotifications();
// Preconditions
assertUsers(7);
DummyAccount account = dummyResourceEmerald.getAccountByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME);
// / WHEN
when();
account.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Mancomb Seepbad");
displayValue("Modified dummy account", account.debugDump());
waitForSyncTaskNextRun(resourceDummyEmerald);
// THEN
then();
PrismObject<ShadowType> accountAfter = findAccountByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME, resourceDummyEmerald);
display("Account mancomb", accountAfter);
assertNotNull("No mancomb account shadow", accountAfter);
assertEquals("Wrong resourceRef in mancomb account", RESOURCE_DUMMY_EMERALD_OID, accountAfter.asObjectable().getResourceRef().getOid());
assertShadowOperationalData(accountAfter, SynchronizationSituationType.LINKED);
assertDummyAccountAttribute(RESOURCE_DUMMY_EMERALD_NAME, ACCOUNT_MANCOMB_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Mancomb Seepbad");
PrismObject<UserType> userAfter = findUserByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME);
display("User mancomb", userAfter);
assertNotNull("User mancomb was not created", userAfter);
assertLiveLinks(userAfter, 1);
assertAdministrativeStatusEnabled(userAfter);
assertValidFrom(userAfter, ACCOUNT_MANCOMB_VALID_FROM_DATE);
assertValidTo(userAfter, ACCOUNT_MANCOMB_VALID_TO_DATE);
assertLinked(userAfter, accountAfter);
PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PrismTestUtil.createPolyString("Mancomb Seepbad"));
assertUsers(7);
// notifications
notificationManager.setDisabled(true);
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestUuid method test230ReconcileDummyUuidDeleteAugustusAddAugustina.
/**
* Augustus is deleted and Augustina re-added. They correlate to the same user.
* New shadow needs to be created.
*/
@Test
public void test230ReconcileDummyUuidDeleteAugustusAddAugustina() throws Exception {
given();
Task task = getTestTask();
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
DummyAccount oldAccount = dummyResourceUuid.getAccountByUsername(ACCOUNT_AUGUSTUS_NAME);
dummyResourceUuid.deleteAccountByName(ACCOUNT_AUGUSTUS_NAME);
assertNoDummyAccount(ACCOUNT_AUGUSTUS_NAME, ACCOUNT_AUGUSTUS_NAME);
DummyAccount account = new DummyAccount(ACCOUNT_AUGUSTINA_NAME);
account.setEnabled(true);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, ACCOUNT_AUGUSTINA_FULLNAME);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME, USER_AUGUSTUS_NAME);
dummyResourceUuid.addAccount(account);
account = dummyResourceUuid.getAccountByUsername(ACCOUNT_AUGUSTINA_NAME);
assertThat(oldAccount.getId()).withFailMessage("Account IDs not changed").isNotEqualTo(account.getId());
displayValue("Old shadow OID", augustusShadowOid);
display("Account ID " + oldAccount.getId() + " -> " + account.getId());
Task taskBefore = taskManager.getTaskPlain(TASK_RECONCILE_DUMMY_UUID_OID, result);
getDummyResource().purgeScriptHistory();
dummyAuditService.clear();
rememberCounter(InternalCounters.SHADOW_FETCH_OPERATION_COUNT);
reconciliationTaskResultListener.clear();
when();
restartTask(TASK_RECONCILE_DUMMY_UUID_OID);
then();
waitForTaskNextRunAssertSuccess(taskBefore, true);
reconciliationTaskResultListener.assertResult(RESOURCE_DUMMY_UUID_OID, 0, 1, 0, 2);
List<PrismObject<UserType>> users = modelService.searchObjects(UserType.class, null, null, task, result);
display("Users after import", users);
assertImportedUserByOid(USER_ADMINISTRATOR_OID);
assertImportedUserByOid(USER_JACK_OID);
assertImportedUserByOid(USER_BARBOSSA_OID);
assertImportedUserByUsername(USER_AUGUSTUS_NAME, RESOURCE_DUMMY_UUID_OID);
assertDummyAccountAttribute(RESOURCE_DUMMY_UUID_NAME, ACCOUNT_AUGUSTINA_NAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, ACCOUNT_AUGUSTINA_FULLNAME);
assertEquals("Unexpected number of users", 7, users.size());
displayValue("Dummy resource", getDummyResource().debugDump());
// MID-7110
// assertReconAuditModifications(1, TASK_RECONCILE_DUMMY_UUID_OID);
// Task result
PrismObject<TaskType> reconTaskAfter = getTask(TASK_RECONCILE_DUMMY_UUID_OID);
OperationResultType reconTaskResult = reconTaskAfter.asObjectable().getResult();
display("Recon task result", reconTaskResult);
// there is an error deep inside (that is expected)
TestUtil.assertSuccess(reconTaskResult.getOperation(), reconTaskResult, 4);
// @formatter:off
assertUserAfterByUsername(USER_AUGUSTUS_NAME).displayWithProjections().links().assertLinks(1, 2).by().dead(true).assertCount(2).by().dead(false).find().assertOidDifferentThan(augustusShadowOid);
// @formatter:on
}
Aggregations