use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestMultiAccount method test020ImportPaulAtreides.
/**
* Sanity/preparation. Import absolutely ordinary account.
*/
@Test
public void test020ImportPaulAtreides() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
DummyAccount account = new DummyAccount(ACCOUNT_PAUL_ATREIDES_USERNAME);
account.setEnabled(true);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, ACCOUNT_PAUL_ATREIDES_FULL_NAME);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME, ACCOUNT_PAUL_ATREIDES_ID);
// account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, TITLE_DUKE);
getDummyResource(RESOURCE_DUMMY_MULTI_GREEN_NAME).addAccount(account);
// Preconditions
assertUsers(getNumberOfUsers());
// WHEN
when();
importMultiGreenAccounts(task, result);
// THEN
then();
// @formatter:off
accountPaulOid = assertUserAfterByUsername(ACCOUNT_PAUL_ATREIDES_USERNAME).displayWithProjections().assertFullName(ACCOUNT_PAUL_ATREIDES_FULL_NAME).assertEmployeeNumber(ACCOUNT_PAUL_ATREIDES_ID).assertOrganizationalUnits(ACCOUNT_PAUL_ATREIDES_FULL_NAME).singleLink().resolveTarget().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 test210ImportMahdi.
/**
* Import yet another admin account that correlates to Paul.
*/
@Test
public void test210ImportMahdi() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
DummyAccount account = new DummyAccount(ACCOUNT_MAHDI_USERNAME);
account.setEnabled(true);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, ACCOUNT_MAHDI_FULL_NAME);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME, ACCOUNT_PAUL_ATREIDES_ID);
account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, ACCOUNT_MAHDI_TITLE);
getDummyResource(RESOURCE_DUMMY_MULTI_GREEN_NAME).addAccount(account);
// Preconditions
assertUsers(getNumberOfUsers() + 1);
// WHEN
when();
importMultiGreenAccounts(task, result);
// THEN
then();
// @formatter:off
assertUserAfterByUsername(ACCOUNT_PAUL_ATREIDES_USERNAME).displayWithProjections().assertFullName(ACCOUNT_PAUL_ATREIDES_FULL_NAME).assertEmployeeNumber(ACCOUNT_PAUL_ATREIDES_ID).links().assertLiveLinks(4).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().link(accountDukeOid).resolveTarget().display().assertKind(ShadowKindType.ACCOUNT).assertIntent(INTENT_ADMIN).assertTag(ACCOUNT_DUKE_TITLE).end().end().by().notTags(accountPaulOid, accountMuaddibOid, ACCOUNT_DUKE_TITLE).find().resolveTarget().display().assertKind(ShadowKindType.ACCOUNT).assertIntent(INTENT_ADMIN).assertTag(ACCOUNT_MAHDI_TITLE).getOid();
// @formatter:on
assertUsers(getNumberOfUsers() + 1);
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestTaskReporting method test110ImportWithSingleMalformedAccount.
@Test
public void test110ImportWithSingleMalformedAccount() throws Exception {
given();
Task task = getTestTask();
OperationResult result = task.getResult();
// This will cause problem when updating shadow
DummyAccount account = RESOURCE_DUMMY_SOURCE.controller.getDummyResource().getAccountByUsername(MALFORMED_SHADOW_NAME);
account.replaceAttributeValue(ATTR_NUMBER, "WRONG");
// Other kinds of failures are still disabled, to check last failed object name in case of malformed accounts
when();
rerunTaskErrorsOk(TASK_IMPORT.oid, result);
then();
stabilize();
// @formatter:off
assertTask(TASK_IMPORT.oid, "import task after").display().assertPartialError().assertClosed().assertProgress(9).rootItemProcessingInformation().display().assertSuccessCount(8).assertFailureCount(1).assertLastFailureObjectName("u-000001").end().rootSynchronizationInformation().display().assertTransition(LINKED, LINKED, LINKED, null, 8, 0, // Those 9 records were already linked and remain so.
0).assertTransition(LINKED, null, null, null, 0, 1, // Malformed account has a LINKED shadow
0).assertTransitions(2).end();
// @formatter:on
// TODO assert redirected errors in the task
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestTaskReporting method createAccount.
private void createAccount(int i) throws ObjectAlreadyExistsException, SchemaViolationException, ConnectException, FileNotFoundException, ConflictException, InterruptedException {
String name = formatAccountName(i);
DummyAccount account = RESOURCE_DUMMY_SOURCE.controller.addAccount(name);
account.addAttributeValue(ATTR_NUMBER, i);
account.addAttributeValue(ATTR_FAILURE_MODE, getFailureMode(i));
}
use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.
the class TestThresholds method test199ModifyAccountDescription.
/**
* Modifies description (-> cost center) of each 4th account, to trigger cost center modification policy rule.
* - fullName of each 25th, to allow full name modification policy rule to pass (4 users are changed).
*/
@Test
public void test199ModifyAccountDescription() throws Exception {
for (int i = 0; i < ACCOUNTS; i += 4) {
DummyAccount account = getAccount(i);
account.replaceAttributeValue(ATTR_DESCRIPTION_NAME, "changed");
System.out.println("Changed description (cost center): " + account.getName());
}
}
Aggregations