use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestVolatility method test110AddDummyHrAccountMancomb.
@Test
public void test110AddDummyHrAccountMancomb() throws Exception {
given();
// Preconditions
// assertUsers(5);
DummyAccount account = new DummyAccount(ACCOUNT_MANCOMB_DUMMY_USERNAME);
account.setEnabled(true);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Mancomb Seepgood");
when();
getDummyResource(RESOURCE_DUMMY_HR_NAME).addAccount(account);
waitForSyncTaskNextRun();
then();
PrismObject<ShadowType> accountMancombHr = findAccountByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME, getDummyResourceObject(RESOURCE_DUMMY_HR_NAME));
display("Account mancomb on HR", accountMancombHr);
assertNotNull("No mancomb HR account shadow", accountMancombHr);
assertEquals("Wrong resourceRef in mancomb HR account", RESOURCE_DUMMY_HR_OID, accountMancombHr.asObjectable().getResourceRef().getOid());
assertShadowOperationalData(accountMancombHr, SynchronizationSituationType.LINKED, null);
PrismObject<ShadowType> accountMancombVolatileTarget = findAccountByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME, getDummyResourceObject(RESOURCE_DUMMY_VOLATILE_NAME));
display("Account mancomb on target", accountMancombVolatileTarget);
assertNotNull("No mancomb target account shadow", accountMancombVolatileTarget);
assertEquals("Wrong resourceRef in mancomb target account", RESOURCE_DUMMY_VOLATILE_OID, accountMancombVolatileTarget.asObjectable().getResourceRef().getOid());
assertShadowOperationalData(accountMancombVolatileTarget, SynchronizationSituationType.LINKED, null);
PrismObject<UserType> userMancomb = findUserByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME);
display("User mancomb", userMancomb);
assertNotNull("User mancomb was not created", userMancomb);
assertLiveLinks(userMancomb, 2);
assertLinked(userMancomb, accountMancombHr);
assertLinked(userMancomb, accountMancombVolatileTarget);
String descriptionOnResource = getAttributeValue(accountMancombVolatileTarget.asObjectable(), DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DESCRIPTION_QNAME);
String descriptionOfUser = userMancomb.asObjectable().getDescription();
String expectedDescription = "Description of " + ACCOUNT_MANCOMB_DUMMY_USERNAME;
assertEquals("Wrong description on resource account", expectedDescription, descriptionOnResource);
assertEquals("Wrong description in user record", expectedDescription, descriptionOfUser);
// assertUsers(6);
// notifications
notificationManager.setDisabled(true);
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestBrokenResources method test401AssignTwoResourcesBroken.
/**
* Assign two resources to a user. One of them is looney, the other is not. The result should be that
* the account on the good resource is created.
* <p>
* This one dies on connector error.
*/
@Test
public void test401AssignTwoResourcesBroken() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.POSITIVE);
ObjectDelta<UserType> userDelta = createAssignTwoResourcesDelta(RESOURCE_CSVFILE_BROKEN_OID);
try {
// WHEN
when();
executeChanges(userDelta, null, task, result);
assertNotReached();
} catch (GenericConnectorException e) {
then();
displayExpectedException(e);
}
result.computeStatus();
display("executeChanges result", result);
assertFailure(result);
DummyAccount jackDummyAccount = getDummyResource().getAccountByUsername(USER_JACK_USERNAME);
assertNotNull("No jack dummy account", jackDummyAccount);
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestMultiAccount method test100ImportMuadDib.
/**
* Import another account that correlates to Paul. This has the same resource+kind+intent.
*/
@Test
public void test100ImportMuadDib() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
DummyAccount account = new DummyAccount(ACCOUNT_MUAD_DIB_USERNAME);
account.setEnabled(true);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, ACCOUNT_MUAD_DIB_FULL_NAME);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME, ACCOUNT_PAUL_ATREIDES_ID);
getDummyResource(RESOURCE_DUMMY_MULTI_GREEN_NAME).addAccount(account);
// Preconditions
assertUsers(getNumberOfUsers() + 1);
// WHEN
when();
importMultiGreenAccounts(task, result);
// THEN
then();
// @formatter:off
accountMuaddibOid = assertUserAfterByUsername(ACCOUNT_PAUL_ATREIDES_USERNAME).displayWithProjections().assertFullName(ACCOUNT_PAUL_ATREIDES_FULL_NAME).assertEmployeeNumber(ACCOUNT_PAUL_ATREIDES_ID).assertOrganizationalUnits(ACCOUNT_PAUL_ATREIDES_FULL_NAME, ACCOUNT_MUAD_DIB_FULL_NAME).links().assertLiveLinks(2).link(accountPaulOid).resolveTarget().display().assertKind(ShadowKindType.ACCOUNT).assertIntent(INTENT_DEFAULT).assertTag(accountPaulOid).end().end().by().notTags(accountPaulOid).find().resolveTarget().display().assertKind(ShadowKindType.ACCOUNT).assertIntent(INTENT_DEFAULT).assertTagIsOid().getOid();
// @formatter:on
assertUsers(getNumberOfUsers() + 1);
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestMultiAccount method test200ImportDuke.
/**
* Import another account that correlates to Paul. This has the same resource+kind+intent.
* But this is an admin account (title=duke). Therefore it will have different intent.
* And there is a custom tag expression.
*/
@Test
public void test200ImportDuke() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
DummyAccount account = new DummyAccount(ACCOUNT_DUKE_USERNAME);
account.setEnabled(true);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, ACCOUNT_DUKE_FULL_NAME);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME, ACCOUNT_PAUL_ATREIDES_ID);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, ACCOUNT_DUKE_TITLE);
getDummyResource(RESOURCE_DUMMY_MULTI_GREEN_NAME).addAccount(account);
// Preconditions
assertUsers(getNumberOfUsers() + 1);
// WHEN
when();
importMultiGreenAccounts(task, result);
// THEN
then();
// @formatter:off
accountDukeOid = assertUserAfterByUsername(ACCOUNT_PAUL_ATREIDES_USERNAME).displayWithProjections().assertFullName(ACCOUNT_PAUL_ATREIDES_FULL_NAME).assertEmployeeNumber(ACCOUNT_PAUL_ATREIDES_ID).links().assertLiveLinks(3).link(accountPaulOid).resolveTarget().display().assertKind(ShadowKindType.ACCOUNT).assertIntent(INTENT_DEFAULT).assertTag(accountPaulOid).end().end().link(accountMuaddibOid).resolveTarget().display().assertKind(ShadowKindType.ACCOUNT).assertIntent(INTENT_DEFAULT).assertTag(accountMuaddibOid).end().end().by().notTags(accountPaulOid, accountMuaddibOid).find().resolveTarget().display().assertKind(ShadowKindType.ACCOUNT).assertIntent(INTENT_ADMIN).assertTag(ACCOUNT_DUKE_TITLE).getOid();
// @formatter:on
assertUsers(getNumberOfUsers() + 1);
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestMultiAccount method test350IdahoAssignOutboundMultiaccount.
/**
* Assign Envoy account back to Idaho. Resource accounts corresponding to his organizations should be re-created.
* Moreover, envoy-idaho-ix is created "from the side", so it will be in fact discovered. See MID-6796.
*/
@Test
public void test350IdahoAssignOutboundMultiaccount() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
DummyAccount account = new DummyAccount(ACCOUNT_IDAHO_ENVOY_IX_USERNAME);
account.setEnabled(true);
getDummyResource(RESOURCE_DUMMY_MULTI_OUTBOUND_NAME).addAccount(account);
// Preconditions
assertUsers(getNumberOfUsers() + 2);
// WHEN
when();
assignAccountToUser(userIdahoOid, RESOURCE_DUMMY_MULTI_OUTBOUND_OID, INTENT_ENVOY, task, result);
// THEN
then();
// There is discovery related fatal error deep inside
assertSuccess(result, 5);
// Ix is lowercased, because it was tagged during discovery so the tag is derived from icfs:name (envoy-idaho-ix).
assertEnvoyAccounts(userIdahoOid, USER_IDAHO_NAME, PLANET_CALADAN, PLANET_IX.toLowerCase(), PLANET_GINAZ);
assertUsers(getNumberOfUsers() + 2);
}
Aggregations