use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class AbstractSynchronizationStoryTest method test600AddDummyGreenAccountCalypso.
/**
* Calypso is a protected account. It should not be touched by the sync.
*/
@Test
public void test600AddDummyGreenAccountCalypso() throws Exception {
given();
rememberTimeBeforeSync();
prepareNotifications();
// Preconditions
assertUsers(8 + getNumberOfExtraDummyUsers());
DummyAccount account = new DummyAccount(ACCOUNT_CALYPSO_DUMMY_USERNAME);
account.setEnabled(true);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Calypso");
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "The Seven Seas");
when();
getDummyResource(RESOURCE_DUMMY_GREEN_NAME).addAccount(account);
waitForSyncTaskNextRunAssertSuccess(getDummyResourceObject(RESOURCE_DUMMY_GREEN_NAME));
then();
PrismObject<ShadowType> accountShadow = findAccountByUsername(ACCOUNT_CALYPSO_DUMMY_USERNAME, getDummyResourceObject(RESOURCE_DUMMY_GREEN_NAME));
display("Account calypso", accountShadow);
assertNotNull("No calypso account shadow", accountShadow);
assertEquals("Wrong resourceRef in calypso account", RESOURCE_DUMMY_GREEN_OID, accountShadow.asObjectable().getResourceRef().getOid());
assertTrue("Calypso shadow is NOT protected", accountShadow.asObjectable().isProtectedObject());
PrismObject<UserType> userCalypso = findUserByUsername(ACCOUNT_CALYPSO_DUMMY_USERNAME);
display("User calypso", userCalypso);
assertNull("User calypso was created, it should not", userCalypso);
assertUsers(8 + getNumberOfExtraDummyUsers());
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class AbstractSynchronizationStoryTest method test110AddDummyGreenAccountMancomb.
@Test
public void test110AddDummyGreenAccountMancomb() throws Exception {
given();
rememberTimeBeforeSync();
prepareNotifications();
// Preconditions
assertUsers(6);
DummyAccount account = new DummyAccount(ACCOUNT_MANCOMB_DUMMY_USERNAME);
account.setEnabled(true);
account.setValidFrom(ACCOUNT_MANCOMB_VALID_FROM_DATE);
account.setValidTo(ACCOUNT_MANCOMB_VALID_TO_DATE);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Mancomb Seepgood");
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "Melee Island");
when();
getDummyResource(RESOURCE_DUMMY_GREEN_NAME).addAccount(account);
waitForSyncTaskNextRunAssertSuccess(getDummyResourceObject(RESOURCE_DUMMY_GREEN_NAME));
then();
PrismObject<ShadowType> accountMancomb = findAccountByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME, getDummyResourceObject(RESOURCE_DUMMY_GREEN_NAME));
display("Account mancomb", accountMancomb);
assertNotNull("No mancomb account shadow", accountMancomb);
assertEquals("Wrong resourceRef in mancomb account", RESOURCE_DUMMY_GREEN_OID, accountMancomb.asObjectable().getResourceRef().getOid());
assertShadowOperationalData(accountMancomb, SynchronizationSituationType.LINKED);
assertValidFrom(accountMancomb, ACCOUNT_MANCOMB_VALID_FROM_DATE);
assertValidTo(accountMancomb, ACCOUNT_MANCOMB_VALID_TO_DATE);
PrismObject<UserType> userMancomb = findUserByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME);
display("User mancomb", userMancomb);
assertNotNull("User mancomb was not created", userMancomb);
assertLiveLinks(userMancomb, 1);
assertAdministrativeStatusEnabled(userMancomb);
assertValidFrom(userMancomb, ACCOUNT_MANCOMB_VALID_FROM_DATE);
assertValidTo(userMancomb, ACCOUNT_MANCOMB_VALID_TO_DATE);
assertLinked(userMancomb, accountMancomb);
assertUsers(7);
String syncTaskOid = getSyncTaskOid(getDummyResourceObject(RESOURCE_DUMMY_GREEN_NAME));
PrismObject<TaskType> syncTaskTree = getTaskTree(syncTaskOid);
OperationStatsType stats = TaskOperationStatsUtil.getOperationStatsFromTree(syncTaskTree.asObjectable(), prismContext);
displayValue("sync task stats", TaskOperationStatsUtil.format(stats));
if (isReconciliation()) {
// Checking MID-6532 implementation (if multi-part tasks)
// TODO check for other kinds of sync tasks, improve asserts
ProvisioningStatisticsType provisioningStatistics = stats.getEnvironmentalPerformanceInformation().getProvisioningStatistics();
assertThat(provisioningStatistics.getEntry()).hasSize(1);
assertThat(provisioningStatistics.getEntry().get(0).getResourceRef().getOid()).isEqualTo(RESOURCE_DUMMY_GREEN_OID);
assertThat(getOrig(provisioningStatistics.getEntry().get(0).getResourceRef().getTargetName())).isEqualTo("Dummy Resource Green");
// search and sometimes get
assertThat(provisioningStatistics.getEntry().get(0).getOperation()).isNotEmpty();
// MID-6930: We should process exactly 1 item even for partitioned reconciliation:
// mancomb must not be processed in the 3rd part!
assertPerformance(syncTaskOid, "progress").display().child(ModelPublicConstants.RECONCILIATION_RESOURCE_OBJECTS_ID).assertItemsProcessed(1).end().child(ModelPublicConstants.RECONCILIATION_REMAINING_SHADOWS_ID).assertItemsProcessed(0);
}
// notifications
displayAllNotifications();
assertSingleDummyTransportMessageContaining("simpleAccountNotifier-SUCCESS", "Channel: " + getExpectedChannel());
notificationManager.setDisabled(true);
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class AbstractSynchronizationStoryTest method test370ModifyDummyGreenAccountWally.
/**
* Change fullname on the green account. There is an inbound mapping to the user so it should propagate.
* There is also outbound mapping from the user to dummy account, therefore it should propagate there as well.
*/
@Test
public void test370ModifyDummyGreenAccountWally() throws Exception {
given();
Task task = getTestTask();
OperationResult result = task.getResult();
repoAddObjectFromFile(USER_TEMPLATE_SYNC_FILENAME, result);
assumeUserTemplate(USER_TEMPLATE_SYNC_OID, getDummyResourceObject(RESOURCE_DUMMY_GREEN_NAME).asObjectable(), "default account type", result);
rememberTimeBeforeSync();
prepareNotifications();
DummyAccount wallyDummyAccount = getDummyResource(RESOURCE_DUMMY_GREEN_NAME).getAccountByUsername(ACCOUNT_WALLY_DUMMY_USERNAME);
when();
wallyDummyAccount.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Wally B. Feed");
// Wait for sync task to pick up the change
waitForSyncTaskNextRunAssertSuccess(getDummyResourceObject(RESOURCE_DUMMY_GREEN_NAME));
// Make sure that the "kickback" sync cycle of the other resource runs to completion
// We want to check the state after it gets stable
// and it could spoil the next test
// Make sure we have steady state
waitForSyncActivityCompleted(RESOURCE_DUMMY_DEFAULT_NAME, RESOURCE_DUMMY_GREEN_NAME, RESOURCE_DUMMY_BLUE_NAME);
then();
dumpSyncTaskTree(getDummyResourceObject(), result);
dumpSyncTaskTree(getDummyResourceObject(RESOURCE_DUMMY_GREEN_NAME), result);
dumpSyncTaskTree(getDummyResourceObject(RESOURCE_DUMMY_BLUE_NAME), result);
PrismObject<UserType> userWally = findUserByUsername(ACCOUNT_WALLY_DUMMY_USERNAME);
display("User wally", userWally);
assertNotNull("User wally disappeared", userWally);
assertUser(userWally, userWallyOid, ACCOUNT_WALLY_DUMMY_USERNAME, "Wally B. Feed", null, "Wally B. Feed from Sync");
PrismObject<ShadowType> accountWallyBlue = checkWallyAccount(getDummyResourceObject(RESOURCE_DUMMY_BLUE_NAME), getDummyResource(RESOURCE_DUMMY_BLUE_NAME), "blue", "Wally Feed");
if (alwaysCheckTimestamp) {
assertShadowOperationalData(accountWallyBlue, SynchronizationSituationType.LINKED);
}
PrismObject<ShadowType> accountWallyGreen = checkWallyAccount(getDummyResourceObject(RESOURCE_DUMMY_GREEN_NAME), getDummyResource(RESOURCE_DUMMY_GREEN_NAME), "green", "Wally B. Feed");
assertShadowOperationalData(accountWallyGreen, SynchronizationSituationType.LINKED);
PrismObject<ShadowType> accountWallyDefault;
// See MID-2518
if (isReconciliation()) {
// Can be iether "Wally Feed" or "Wally B. Feed". Both are correct. Depends on he order of recon
// task execution.
accountWallyDefault = checkWallyAccount(getDummyResourceObject(), getDummyResource(), "default", null);
} else {
accountWallyDefault = checkWallyAccount(getDummyResourceObject(), getDummyResource(), "default", "Wally B. Feed");
}
assertShadowOperationalData(accountWallyDefault, SynchronizationSituationType.LINKED);
assertLiveLinks(userWally, 3);
assertLinked(userWally, accountWallyGreen);
assertLinked(userWally, accountWallyBlue);
assertLinked(userWally, accountWallyDefault);
assertUsers(8 + getNumberOfExtraDummyUsers());
// notifications
notificationManager.setDisabled(true);
// checkDummyTransportMessages("accountPasswordNotifier", 0);
// checkDummyTransportMessages("userPasswordNotifier", 0);
// checkDummyTransportMessages("simpleAccountNotifier-SUCCESS", 1);
// checkDummyTransportMessages("simpleAccountNotifier-FAILURE", 0);
// checkDummyTransportMessages("simpleAccountNotifier-ADD-SUCCESS", 0);
// checkDummyTransportMessagesAtLeast("simpleUserNotifier", 1); // actually I dont understand why sometimes is here 1, sometimes 2 messages (has to do something with mapping username->familyname)
// checkDummyTransportMessages("simpleUserNotifier-ADD", 0);
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestImportRecon method test230ReconcileDummyRename.
@Test
public void test230ReconcileDummyRename() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
getDummyResource().setBreakMode(BreakMode.NONE);
getDummyResource().getAccountByUsername(ACCOUNT_GUYBRUSH_DUMMY_USERNAME).setModifyBreakMode(BreakMode.NONE);
PrismObject<UserType> userHerman = findUserByUsername(ACCOUNT_HERMAN_DUMMY_USERNAME);
String hermanShadowOid = getSingleLinkOid(userHerman);
assertShadows(14);
getDummyResource().renameAccount(ACCOUNT_HERMAN_DUMMY_USERNAME, ACCOUNT_HERMAN_DUMMY_USERNAME, ACCOUNT_HTM_NAME);
DummyAccount dummyAccountHtm = getDummyAccount(null, ACCOUNT_HTM_NAME);
dummyAccountHtm.replaceAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, ACCOUNT_HTM_FULL_NAME);
getDummyResource().purgeScriptHistory();
dummyAuditService.clear();
rememberCounter(InternalCounters.SHADOW_FETCH_OPERATION_COUNT);
reconciliationResultListener.clear();
// WHEN
when();
restartTask(TASK_RECONCILE_DUMMY_OID);
Task taskAfter = waitForTaskFinish(TASK_RECONCILE_DUMMY_OID, false, DEFAULT_TASK_WAIT_TIMEOUT, true);
// THEN
then();
dumpStatistics(taskAfter);
assertTask(taskAfter, "task after").display().activityState(RECONCILIATION_RESOURCE_OBJECTS_PATH).synchronizationStatistics().display().assertTransition(LINKED, LINKED, LINKED, null, 4, 0, // guybrush, elaine, rapp, stan
0).assertTransition(null, UNMATCHED, LINKED, null, 1, 0, // htm (new name for ht)
0).assertTransition(null, null, null, PROTECTED, 0, 0, // daviejones, calypso
2).assertTransitions(3).end().itemProcessingStatistics().display().assertTotalCounts(5, 0, 2).end().progress().display().assertCommitted(5, 0, 2).assertNoUncommitted().end().end().activityState(RECONCILIATION_REMAINING_SHADOWS_PATH).itemProcessingStatistics().display().assertTotalCounts(3, 0, // 1 renamed, 2 protected
0).end().progress().display().assertCommitted(3, 0, 0).assertNoUncommitted().end().end().assertProgress(10);
dumpShadowSituations(RESOURCE_DUMMY_OID, result);
assertCounterIncrement(InternalCounters.SHADOW_FETCH_OPERATION_COUNT, 6);
reconciliationResultListener.assertResult(RESOURCE_DUMMY_OID, 0, 7, 0, 3);
List<PrismObject<UserType>> users = modelService.searchObjects(UserType.class, null, null, task, result);
display("Users after import", users);
assertImportedUserByUsername(ACCOUNT_HTM_NAME, RESOURCE_DUMMY_OID);
// not deleted. reaction=unlink
assertImportedUserByUsername(ACCOUNT_HERMAN_DUMMY_USERNAME);
assertRepoShadow(hermanShadowOid).assertTombstone();
assertImportedUserByOid(USER_ADMINISTRATOR_OID);
assertImportedUserByOid(USER_JACK_OID);
assertImportedUserByOid(USER_BARBOSSA_OID);
assertImportedUserByOid(USER_GUYBRUSH_OID, RESOURCE_DUMMY_OID);
assertDummyAccountAttribute(null, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Dubrish Freepweed");
assertDummyAccountAttribute(null, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "Melee Island");
assertDummyAccountAttribute(null, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME, "Feather duster");
assertDummyAccountAttribute(null, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, "rum");
assertDummyAccountAttribute(null, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_QUOTE_NAME, "Arr!", "I want to be a pirate!");
assertImportedUserByOid(USER_RAPP_OID, RESOURCE_DUMMY_OID, RESOURCE_DUMMY_LIME_OID);
assertNoImporterUserByUsername(ACCOUNT_DAVIEJONES_DUMMY_USERNAME);
assertNoImporterUserByUsername(ACCOUNT_CALYPSO_DUMMY_USERNAME);
assertDummyAccountAttribute(null, ACCOUNT_CALYPSO_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Calypso");
assertEquals("Unexpected number of users", getNumberOfUsers() + 5, users.size());
displayValue("Dummy resource", getDummyResource().debugDump());
display("Script history", getDummyResource().getScriptHistory());
ArrayList<ProvisioningScriptSpec> scripts = new ArrayList<>();
addReconScripts(scripts, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, "Guybrush Threepwood", false);
addReconScripts(scripts, ACCOUNT_ELAINE_DUMMY_USERNAME, "Elaine Marley", false);
addReconScripts(scripts, USER_RAPP_USERNAME, USER_RAPP_FULLNAME, false);
addReconScripts(scripts, ACCOUNT_STAN_NAME, ACCOUNT_STAN_FULLNAME, false);
addReconScripts(scripts, ACCOUNT_HTM_NAME, ACCOUNT_HTM_FULL_NAME, true);
IntegrationTestTools.assertScripts(getDummyResource().getScriptHistory(), scripts.toArray(new ProvisioningScriptSpec[0]));
// MID-7110
// assertReconAuditModifications(1, TASK_RECONCILE_DUMMY_OID);
assertShadows(15);
// Task result
PrismObject<TaskType> reconTaskAfter = getTask(TASK_RECONCILE_DUMMY_OID);
OperationResultType reconTaskResult = reconTaskAfter.asObjectable().getResult();
display("Recon task result", reconTaskResult);
// There's (expected) "object not found" error related to ht that was renamed.
TestUtil.assertSuccess("reconciliation", reconTaskResult, 4);
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestImportRecon method test410ReconcileDummyLimeKatePassword.
@Test
public void test410ReconcileDummyLimeKatePassword() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
DummyAccount accountKate = dummyResourceLime.getAccountByUsername(ACCOUNT_CAPSIZE_NAME);
accountKate.setPassword("d0d3c4h3dr0n");
PrismObject<UserType> userBefore = findUserByUsername(ACCOUNT_CAPSIZE_NAME);
dummyResourceLime.purgeScriptHistory();
dummyAuditService.clear();
reconciliationResultListener.clear();
// WHEN
when();
reconcileUser(userBefore.getOid(), task, result);
// THEN
then();
assertSuccess(result);
PrismObject<UserType> userAfter = findUserByUsername(ACCOUNT_CAPSIZE_NAME);
display("User after reconcile", userAfter);
assertPassword(userAfter, "d0d3c4h3dr0n");
// MID-7110
// displayDumpable("Audit", dummyAuditService);
// dummyAuditService.assertRecords(2);
// dummyAuditService.assertSimpleRecordSanity();
// dummyAuditService.assertAnyRequestDeltas();
// dummyAuditService.assertExecutionDeltas(1);
// dummyAuditService.assertHasDelta(ChangeType.MODIFY, UserType.class);
// PrismAsserts.assertModifications(dummyAuditService.getExecutionDelta(0).getObjectDelta(), 11);
// dummyAuditService.assertTarget(userBefore.getOid());
// dummyAuditService.assertExecutionSuccess();
assertUsers(getNumberOfUsers() + 6);
displayValue("Dummy resource (lime)", dummyResourceLime.debugDump());
}
Aggregations