Search in sources :

Example 76 with UserType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.

the class TestTrafo method test109JackAccountAdGone.

/**
	 * "Wait" a bit and the account should be gone.
	 */
@Test
public void test109JackAccountAdGone() throws Exception {
    final String TEST_NAME = "test109JackAccountAdGone";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    dummyAuditService.clear();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    clock.overrideDuration("P2D");
    waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    PrismObject<UserType> userJack = getUser(USER_JACK_OID);
    display("User after change execution", userJack);
    assertUserJack(userJack);
    assertLinks(userJack, 0);
    // Check account in dummy resource
    assertNoDummyAccountById(RESOURCE_DUMMY_AD_ID, jackAdIcfUid);
    assertNoDummyAccount(RESOURCE_DUMMY_AD_ID, ACCOUNT_JACK_AD_DN);
    // Check audit
    display("Audit", dummyAuditService);
    dummyAuditService.assertRecords(2);
    dummyAuditService.assertSimpleRecordSanity();
    dummyAuditService.assertExecutionDeltas(2);
    dummyAuditService.assertHasDelta(ChangeType.MODIFY, UserType.class);
    dummyAuditService.assertHasDelta(ChangeType.DELETE, ShadowType.class);
    dummyAuditService.assertExecutionSuccess();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 77 with UserType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.

the class TestTrafo method test125JackUnAssignAccountMail.

@Test
public void test125JackUnAssignAccountMail() throws Exception {
    final String TEST_NAME = "test125JackUnAssignAccountMail";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    dummyAuditService.clear();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    unassignAccount(USER_JACK_OID, RESOURCE_DUMMY_MAIL_OID, null, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    PrismObject<UserType> userJack = getUser(USER_JACK_OID);
    display("User after change execution", userJack);
    assertUserJack(userJack);
    String accountOid = getSingleLinkRef(userJack).getOid();
    // Check shadow
    PrismObject<ShadowType> accountShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result);
    assertAccountShadowRepo(accountShadow, accountOid, ACCOUNT_JACK_MAIL_USERNAME, resourceDummyMailType, caseIgnoreMatchingRule);
    // Check account
    PrismObject<ShadowType> accountModel = modelService.getObject(ShadowType.class, accountOid, null, task, result);
    display("Mail shadow", accountModel);
    assertAccountShadowModel(accountModel, accountOid, ACCOUNT_JACK_MAIL_USERNAME, resourceDummyMailType, caseIgnoreMatchingRule);
    assertAdministrativeStatusDisabled(accountModel);
    assertEquals("Jack Mail ICF UID has changed", jackMailIcfUid, getIcfUid(accountModel));
    // Check account in dummy resource
    assertDummyAccountById(RESOURCE_DUMMY_MAIL_ID, jackMailIcfUid);
    assertDummyAccount(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_JACK_MAIL_USERNAME);
    assertDummyAccountActivation(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_JACK_MAIL_USERNAME, false);
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_JACK_MAIL_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_INTERNET_ADDRESS_NAME, "Jack.Sparrow@" + TRAFO_MAIL_DOMAIN);
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_JACK_MAIL_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_FIRST_NAME_NAME, "Jack");
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_JACK_MAIL_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_LAST_NAME_NAME, "Sparrow");
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_JACK_MAIL_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_ID_FILE_NAME, "c:\\install\\test-id-folder\\jsparrow.id");
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_JACK_MAIL_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_SHORT_NAME_NAME, USER_JACK_USERNAME);
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_JACK_MAIL_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_MAIL_FILE_NAME_NAME, "mail\\" + USER_JACK_USERNAME);
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_JACK_MAIL_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_MAIL_DOMAIN_NAME, "TRAFO");
    // Set by inbound mappings
    PrismAsserts.assertPropertyValue(userJack, UserType.F_EMAIL_ADDRESS, "Jack.Sparrow@" + TRAFO_MAIL_DOMAIN);
    PrismAsserts.assertPropertyValue(userJack, new ItemPath(UserType.F_EXTENSION, TRAFO_EXTENSION_HOMEDIR_QNAME), "c:\\install\\test-id-folder");
    // Check audit
    display("Audit", dummyAuditService);
    dummyAuditService.assertRecords(2);
    dummyAuditService.assertSimpleRecordSanity();
    dummyAuditService.assertAnyRequestDeltas();
    dummyAuditService.assertExecutionDeltas(2);
    dummyAuditService.assertHasDelta(0, ChangeType.MODIFY, UserType.class);
    dummyAuditService.assertHasDelta(0, ChangeType.MODIFY, ShadowType.class);
    dummyAuditService.assertExecutionSuccess();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test)

Example 78 with UserType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.

the class TestTrafo method test129JackAccountMailGone.

/**
	 * "Wait" a bit and the account should be gone.
	 */
@Test
public void test129JackAccountMailGone() throws Exception {
    final String TEST_NAME = "test129JackAccountMailGone";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    dummyAuditService.clear();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    clock.overrideDuration("P2D");
    waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    PrismObject<UserType> userJack = getUser(USER_JACK_OID);
    display("User after change execution", userJack);
    assertUserJack(userJack);
    assertLinks(userJack, 0);
    // Check account in dummy resource
    assertNoDummyAccountById(RESOURCE_DUMMY_MAIL_ID, jackMailIcfUid);
    assertNoDummyAccount(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_JACK_MAIL_USERNAME);
    // Set by inbound mappings, this should stay
    PrismAsserts.assertPropertyValue(userJack, UserType.F_EMAIL_ADDRESS, "Jack.Sparrow@" + TRAFO_MAIL_DOMAIN);
    PrismAsserts.assertPropertyValue(userJack, TRAFO_EXTENSION_HOMEDIR_PATH, "c:\\install\\test-id-folder");
    // Check audit
    display("Audit", dummyAuditService);
    dummyAuditService.assertRecords(2);
    dummyAuditService.assertSimpleRecordSanity();
    dummyAuditService.assertExecutionDeltas(2);
    dummyAuditService.assertHasDelta(ChangeType.MODIFY, UserType.class);
    dummyAuditService.assertHasDelta(ChangeType.DELETE, ShadowType.class);
    dummyAuditService.assertExecutionSuccess();
    // Clean up the data set by inbound. These could ruin next tests
    modifyUserReplace(USER_JACK_OID, UserType.F_EMAIL_ADDRESS, task, result);
    modifyUserReplace(USER_JACK_OID, TRAFO_EXTENSION_HOMEDIR_PATH, task, result);
    userJack = getUser(USER_JACK_OID);
    display("Clean jack", userJack);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 79 with UserType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.

the class TestTrafo method test200Smith111Add.

/**
	 * Attempt to add two employees that are boh "John Smith". This is the first user. Everything shouyld do as normal.
	 * Note: this is a different case than jack-angelica. Jack and Angelica are "externists". Smithes are employees (type "T")
	 */
@Test
public void test200Smith111Add() throws Exception {
    final String TEST_NAME = "test200Smith111Add";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    dummyAuditService.clear();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    addObject(USER_SMITH111_FILE);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    PrismObject<UserType> userSmith = getUser(USER_SMITH111_OID);
    display("User smith111 after change execution", userSmith);
    assertUser(userSmith, USER_SMITH111_OID, USER_SMITH111_USERNAME, "John Smith", "John", "Smith");
    assertLinks(userSmith, 2);
    String accountAdOid = getLinkRefOid(userSmith, RESOURCE_DUMMY_AD_OID);
    String accountMailOid = getLinkRefOid(userSmith, RESOURCE_DUMMY_MAIL_OID);
    // AD ACCOUNT
    // Check shadow
    PrismObject<ShadowType> accountAdShadow = repositoryService.getObject(ShadowType.class, accountAdOid, null, result);
    assertAccountShadowRepo(accountAdShadow, accountAdOid, ACCOUNT_SMITH111_AD_DN, resourceDummyAdType, caseIgnoreMatchingRule);
    // Check account
    PrismObject<ShadowType> accountAdModel = modelService.getObject(ShadowType.class, accountAdOid, null, task, result);
    display("AD shadow", accountAdModel);
    assertAccountShadowModel(accountAdModel, accountAdOid, ACCOUNT_SMITH111_AD_DN, resourceDummyAdType, caseIgnoreMatchingRule);
    assertAdministrativeStatusEnabled(accountAdModel);
    smith111AdIcfUid = getIcfUid(accountAdModel);
    // Check account in dummy resource
    assertDummyAccountById(RESOURCE_DUMMY_AD_ID, smith111AdIcfUid);
    assertDummyAccount(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN);
    assertDummyAccountActivation(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN, true);
    assertDummyAccountAttribute(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_SAM_ACCOUNT_NAME_NAME, ACCOUNT_SMITH111_AD_SAM_NAME);
    assertDummyAccountAttribute(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_USER_PRINCIPAL_NAME_NAME, ACCOUNT_SMITH111_AD_SAM_NAME + "@" + TRAFO_MAIL_DOMAIN);
    assertDummyAccountAttribute(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_GIVEN_NAME_NAME, "John");
    assertDummyAccountAttribute(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_SN_NAME, "Smith");
    assertDummyAccountAttribute(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_MAIL_NAME, "John.Smith@" + TRAFO_MAIL_DOMAIN);
    assertDummyAccountNoAttribute(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_TELEPHONE_NUMBER_NAME);
    assertDummyAccountAttribute(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_USER_SHARED_FOLDER_OTHER_NAME, "\\\\medusa\\User\\Smith_smith111");
    // MAIL ACCOUNT
    // Check shadow
    PrismObject<ShadowType> accountMailShadow = repositoryService.getObject(ShadowType.class, accountMailOid, null, result);
    assertAccountShadowRepo(accountMailShadow, accountMailOid, ACCOUNT_SMITH111_MAIL_USERNAME, resourceDummyMailType, caseIgnoreMatchingRule);
    // Check account
    PrismObject<ShadowType> accountMailModel = modelService.getObject(ShadowType.class, accountMailOid, null, task, result);
    display("Mail shadow", accountMailModel);
    assertAccountShadowModel(accountMailModel, accountMailOid, ACCOUNT_SMITH111_MAIL_USERNAME, resourceDummyMailType, caseIgnoreMatchingRule);
    assertAdministrativeStatusEnabled(accountMailModel);
    smith111MailIcfUid = getIcfUid(accountMailModel);
    // Check account in dummy resource
    assertDummyAccountById(RESOURCE_DUMMY_MAIL_ID, smith111MailIcfUid);
    assertDummyAccount(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME);
    assertDummyAccountActivation(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME, true);
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_INTERNET_ADDRESS_NAME, "John.Smith@" + TRAFO_MAIL_DOMAIN);
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_FIRST_NAME_NAME, "John");
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_LAST_NAME_NAME, "Smith");
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_ID_FILE_NAME, "c:\\install\\test-id-folder\\jsmith.id");
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_SHORT_NAME_NAME, "PS111", "jsmith");
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_MAIL_FILE_NAME_NAME, "mail\\js111");
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_MAIL_DOMAIN_NAME, "TRAFO");
    // Set by inbound mappings
    PrismAsserts.assertPropertyValue(userSmith, UserType.F_EMAIL_ADDRESS, "John.Smith@" + TRAFO_MAIL_DOMAIN);
    PrismAsserts.assertPropertyValue(userSmith, new ItemPath(UserType.F_EXTENSION, TRAFO_EXTENSION_HOMEDIR_QNAME), "\\\\medusa\\User\\Smith_smith111");
    // Check audit
    display("Audit", dummyAuditService);
    dummyAuditService.assertRecords(5);
    dummyAuditService.assertSimpleRecordSanity();
    dummyAuditService.assertAnyRequestDeltas();
    dummyAuditService.assertExecutionDeltas(0, 3);
    // primary
    dummyAuditService.assertHasDelta(0, ChangeType.ADD, UserType.class);
    // link
    dummyAuditService.assertHasDelta(0, ChangeType.MODIFY, UserType.class);
    // AD account
    dummyAuditService.assertHasDelta(0, ChangeType.ADD, ShadowType.class);
    dummyAuditService.assertExecutionDeltas(1, 3);
    // link, inbound (2 deltas)
    dummyAuditService.assertHasDelta(1, ChangeType.MODIFY, UserType.class);
    // Mail account
    dummyAuditService.assertHasDelta(1, ChangeType.ADD, ShadowType.class);
    dummyAuditService.assertExecutionDeltas(2, 2);
    // inbound
    dummyAuditService.assertHasDelta(2, ChangeType.MODIFY, UserType.class);
    // AD account
    dummyAuditService.assertHasDelta(2, ChangeType.MODIFY, ShadowType.class);
    dummyAuditService.assertExecutionDeltas(3, 1);
    // inbound - SHOULD THIS BE HERE?? FIXME
    dummyAuditService.assertHasDelta(3, ChangeType.MODIFY, UserType.class);
    dummyAuditService.assertExecutionSuccess();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test)

Example 80 with UserType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.UserType in project midpoint by Evolveum.

the class TestTrafo method test300Smith111Rename.

/**
	 * Attempt to rename two employees that are boh "John Smith". This is the first user. Everything shouyld do as normal.
	 * Note: this is a different case than jack-angelica. Jack and Angelica are "externists". Smithes are employees (type "T")
	 */
@Test
public void test300Smith111Rename() throws Exception {
    final String TEST_NAME = "test300Smith111Rename";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    dummyAuditService.clear();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    //        addObject(USER_SMITH111_FILE);
    //        TestUtil.displayThen(TEST_NAME);
    //		result.computeStatus();
    //        TestUtil.assertSuccess(result);
    PrismObject<UserType> userSmith = getUser(USER_SMITH111_OID);
    display("User smith111 before change execution", userSmith);
    assertUser(userSmith, USER_SMITH111_OID, USER_SMITH111_USERNAME, "John Smith", "John", "Smith");
    assertLinks(userSmith, 2);
    String accountAdOid = getLinkRefOid(userSmith, RESOURCE_DUMMY_AD_OID);
    String accountMailOid = getLinkRefOid(userSmith, RESOURCE_DUMMY_MAIL_OID);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    Collection<? extends ItemDelta> fullNameModification = PropertyDelta.createModificationReplacePropertyCollection(UserType.F_FAMILY_NAME, userSmith.getDefinition(), new PolyString("Smither", "smither"));
    ObjectDelta.createModifyDelta(userSmith.getOid(), fullNameModification, UserType.class, prismContext);
    modifyUserReplace(userSmith.getOid(), UserType.F_FAMILY_NAME, task, result, new PolyString("Smither", "smither"));
    // AD ACCOUNT
    // Check shadow
    PrismObject<ShadowType> accountAdShadow = repositoryService.getObject(ShadowType.class, accountAdOid, null, result);
    display("AD shadow", accountAdShadow);
    assertAccountShadowRepo(accountAdShadow, accountAdOid, ACCOUNT_SMITH111_AD_DN_AFTER_RENAME, resourceDummyAdType, caseIgnoreMatchingRule);
    // Check account
    PrismObject<ShadowType> accountAdModel = modelService.getObject(ShadowType.class, accountAdOid, null, task, result);
    display("AD shadow", accountAdModel);
    assertAccountShadowModel(accountAdModel, accountAdOid, ACCOUNT_SMITH111_AD_DN_AFTER_RENAME, resourceDummyAdType, caseIgnoreMatchingRule);
    assertAdministrativeStatusEnabled(accountAdModel);
    smith111AdIcfUid = getIcfUid(accountAdModel);
    // Check account in dummy resource
    assertDummyAccountById(RESOURCE_DUMMY_AD_ID, smith111AdIcfUid);
    assertDummyAccount(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN_AFTER_RENAME);
    assertDummyAccountActivation(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN_AFTER_RENAME, true);
    assertDummyAccountAttribute(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN_AFTER_RENAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_SAM_ACCOUNT_NAME_NAME, ACCOUNT_SMITH111_AD_SAM_NAME);
    assertDummyAccountAttribute(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN_AFTER_RENAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_USER_PRINCIPAL_NAME_NAME, ACCOUNT_SMITH111_AD_SAM_NAME + "@" + TRAFO_MAIL_DOMAIN);
    assertDummyAccountAttribute(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN_AFTER_RENAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_GIVEN_NAME_NAME, "John");
    assertDummyAccountAttribute(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN_AFTER_RENAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_SN_NAME, "Smither");
    assertDummyAccountAttribute(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN_AFTER_RENAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_MAIL_NAME, "John.Smither@" + TRAFO_MAIL_DOMAIN);
    assertDummyAccountNoAttribute(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN_AFTER_RENAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_TELEPHONE_NUMBER_NAME);
    assertDummyAccountAttribute(RESOURCE_DUMMY_AD_ID, ACCOUNT_SMITH111_AD_DN_AFTER_RENAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_AD_USER_SHARED_FOLDER_OTHER_NAME, "\\\\medusa\\User\\Smither_smith111");
    // MAIL ACCOUNT
    // Check shadow
    PrismObject<ShadowType> accountMailShadow = repositoryService.getObject(ShadowType.class, accountMailOid, null, result);
    assertAccountShadowRepo(accountMailShadow, accountMailOid, ACCOUNT_SMITH111_MAIL_USERNAME_AFTER_RENAME, resourceDummyMailType, caseIgnoreMatchingRule);
    // Check account
    PrismObject<ShadowType> accountMailModel = modelService.getObject(ShadowType.class, accountMailOid, null, task, result);
    display("Mail shadow", accountMailModel);
    assertAccountShadowModel(accountMailModel, accountMailOid, ACCOUNT_SMITH111_MAIL_USERNAME_AFTER_RENAME, resourceDummyMailType, caseIgnoreMatchingRule);
    assertAdministrativeStatusEnabled(accountMailModel);
    smith111MailIcfUid = getIcfUid(accountMailModel);
    // Check account in dummy resource
    assertDummyAccountById(RESOURCE_DUMMY_MAIL_ID, smith111MailIcfUid);
    assertDummyAccount(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME_AFTER_RENAME);
    assertDummyAccountActivation(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME_AFTER_RENAME, true);
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME_AFTER_RENAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_INTERNET_ADDRESS_NAME, "John.Smither@" + TRAFO_MAIL_DOMAIN);
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME_AFTER_RENAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_FIRST_NAME_NAME, "John");
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME_AFTER_RENAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_LAST_NAME_NAME, "Smither");
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME_AFTER_RENAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_ID_FILE_NAME, "c:\\install\\test-id-folder\\jsmith.id");
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME_AFTER_RENAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_SHORT_NAME_NAME, "PS111", "jsmither");
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME_AFTER_RENAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_MAIL_FILE_NAME_NAME, "mail\\js111");
    assertDummyAccountAttribute(RESOURCE_DUMMY_MAIL_ID, ACCOUNT_SMITH111_MAIL_USERNAME_AFTER_RENAME, DUMMY_ACCOUNT_ATTRIBUTE_MAIL_MAIL_DOMAIN_NAME, "TRAFO");
    PrismObject<UserType> userSmithAfter = getUser(USER_SMITH111_OID);
    display("User smith111 after change execution", userSmithAfter);
    // Set by inbound mappings
    PrismAsserts.assertPropertyValue(userSmithAfter, UserType.F_EMAIL_ADDRESS, "John.Smither@" + TRAFO_MAIL_DOMAIN);
    // [pmed] This is nondeterministic: extension/homedir is filled-in from both AD and Mail resources. (With different values.)
    // So it's hard to say which value will be there in the end.
    // PrismAsserts.assertPropertyValue(userSmithAfter,
    //		new ItemPath(UserType.F_EXTENSION, TRAFO_EXTENSION_HOMEDIR_QNAME), "\\\\medusa\\User\\Smither_smith111");
    // Check audit
    display("Audit", dummyAuditService);
    dummyAuditService.assertRecords(5);
    dummyAuditService.assertSimpleRecordSanity();
    dummyAuditService.assertAnyRequestDeltas();
    dummyAuditService.assertExecutionDeltas(0, 2);
    // primary
    dummyAuditService.assertHasDelta(0, ChangeType.MODIFY, UserType.class);
    //        dummyAuditService.asserHasDelta(0,ChangeType.MODIFY, UserType.class); // link
    // AD account (outbound)
    dummyAuditService.assertHasDelta(0, ChangeType.MODIFY, ShadowType.class);
    dummyAuditService.assertExecutionDeltas(1, 2);
    // link, inbound (2 deltas)
    dummyAuditService.assertHasDelta(1, ChangeType.MODIFY, UserType.class);
    // Mail account (outboud)
    dummyAuditService.assertHasDelta(1, ChangeType.MODIFY, ShadowType.class);
    dummyAuditService.assertExecutionDeltas(2, 2);
    // inbound
    dummyAuditService.assertHasDelta(2, ChangeType.MODIFY, UserType.class);
    // AD account (mail change compued from outboud)
    dummyAuditService.assertHasDelta(2, ChangeType.MODIFY, ShadowType.class);
    dummyAuditService.assertExecutionDeltas(3, 1);
    // inbound - SHOULD THIS BE HERE?? FIXME
    dummyAuditService.assertHasDelta(3, ChangeType.MODIFY, UserType.class);
    dummyAuditService.assertExecutionSuccess();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Aggregations

UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)903 Test (org.testng.annotations.Test)767 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)741 Task (com.evolveum.midpoint.task.api.Task)576 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)217 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)192 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)104 PrismObject (com.evolveum.midpoint.prism.PrismObject)100 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)99 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)88 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)85 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)84 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)83 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)77 ArrayList (java.util.ArrayList)74 QName (javax.xml.namespace.QName)74 File (java.io.File)72 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)58 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)55 PrismAsserts.assertEqualsPolyString (com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString)55