Search in sources :

Example 66 with DummyAccount

use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.

the class TestIteration method test724DarkVioletAddLe_Chuck.

/*
     * Create account with fullname Le_Chuck. This does not conflict with the orig value,
     * but it does conflict on polystring norm value.
     * User with name le_chuck.1 should be created. This is the third conflict, but the .1
     * suffix is free, therefore it is reused.
     * MID-5199
     */
@Test
public void test724DarkVioletAddLe_Chuck() throws Exception {
    // GIVEN
    dummyAuditService.clear();
    DummyAccount account = new DummyAccount(ACCOUNT_LE_CHUCK_USERNAME);
    account.setEnabled(true);
    account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, LE_CHUCK_FULLNAME);
    account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "Melee Island");
    // WHEN
    when();
    displayValue("Adding dummy account", account.debugDump());
    getDummyResource(RESOURCE_DUMMY_DARK_VIOLET_NAME).addAccount(account);
    waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true);
    // THEN
    then();
    displayAllUsers();
    assertUserNick(ACCOUNT_LECHUCK_USERNAME, LECHUCK_FULLNAME, LECHUCK_FULLNAME);
    assertUserNick(ACCOUNT_LE_CHUCK_USERNAME, LE_CHUCK_FULLNAME, LE_CHUCK_FULLNAME + ".1", "Melee Island");
    assertUserNick(ACCOUNT_SHINETOP_USERNAME, CHUCKIE_FULLNAME, CHUCKIE_FULLNAME, "Monkey Island");
    assertNoUserNick(ACCOUNT_SHINETOP_USERNAME, LECHUCK_FULLNAME + ".2");
}
Also used : DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) Test(org.testng.annotations.Test)

Example 67 with DummyAccount

use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.

the class TestInbounds method test200AssignAccountOrange.

/**
 * Not much happens here. Just ordinary account assign. Just make sure
 * that the inbound mappings do not fail for empty values and that
 * we have a good environment for the following tests.
 * MID-2689
 */
@Test
public void test200AssignAccountOrange() throws Exception {
    // GIVEN
    Task task = getTestTask();
    OperationResult result = task.getResult();
    PrismObject<UserType> userBefore = getUser(USER_GUYBRUSH_OID);
    display("User before", userBefore);
    // WHEN
    when();
    assignAccountToUser(USER_GUYBRUSH_OID, RESOURCE_DUMMY_ORANGE_OID, null, task, result);
    // THEN
    then();
    assertSuccess(result);
    PrismObject<UserType> userAfter = getUser(USER_GUYBRUSH_OID);
    display("User after", userAfter);
    assertUser(userAfter, USER_GUYBRUSH_OID, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME, USER_GUYBRUSH_GIVEN_NAME, USER_GUYBRUSH_FAMILY_NAME);
    assertAssignedAccount(userAfter, RESOURCE_DUMMY_ORANGE_OID);
    assertAssignedNoRole(userAfter);
    assertAssignments(userAfter, 1);
    assertLiveLinks(userAfter, 2);
    DummyAccount dummyAccount = assertDummyAccount(RESOURCE_DUMMY_ORANGE_NAME, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME, true);
    displayDumpable("Orange account", dummyAccount);
    guybrushShadowOrangeOid = getLiveLinkRefOid(userAfter, RESOURCE_DUMMY_ORANGE_OID);
    PrismObject<ShadowType> shadowOrange = getShadowModel(guybrushShadowOrangeOid);
    display("Orange shadow", shadowOrange);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) Test(org.testng.annotations.Test)

Example 68 with DummyAccount

use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.

the class TestInbounds method test210ModifyAccountOrangeQuoteMonkey.

/**
 * Modify 'quote' on account (through shadow). That attribute has an inbound
 * expression that passes some values to description user property.
 * This will not pass.
 * MID-2421
 */
@Test
public void test210ModifyAccountOrangeQuoteMonkey() throws Exception {
    // GIVEN
    Task task = getTestTask();
    OperationResult result = task.getResult();
    PrismObject<UserType> userBefore = getUser(USER_GUYBRUSH_OID);
    display("User before", userBefore);
    // WHEN
    modifyObjectReplaceProperty(ShadowType.class, guybrushShadowOrangeOid, getDummyResourceController(RESOURCE_DUMMY_ORANGE_NAME).getAttributePath(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_QUOTE_NAME), task, result, "Look behind you, a Three-Headed Monkey!");
    // THEN
    result.computeStatus();
    TestUtil.assertSuccess(result);
    PrismObject<UserType> userAfter = getUser(USER_GUYBRUSH_OID);
    display("User after", userAfter);
    assertUser(userAfter, USER_GUYBRUSH_OID, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME, USER_GUYBRUSH_GIVEN_NAME, USER_GUYBRUSH_FAMILY_NAME);
    assertNull("Wrong description", userAfter.asObjectable().getDescription());
    assertAssignedAccount(userAfter, RESOURCE_DUMMY_ORANGE_OID);
    assertAssignedNoRole(userAfter);
    assertAssignments(userAfter, 1);
    assertLiveLinks(userAfter, 2);
    // Second inbound expression should work here
    PrismAsserts.assertPropertyValue(userAfter, getExtensionPath(PIRACY_TALES), "Look behind you, a Three-Headed Monkey!");
    DummyAccount dummyAccount = assertDummyAccount(RESOURCE_DUMMY_ORANGE_NAME, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME, true);
    displayDumpable("Orange account", dummyAccount);
    guybrushShadowOrangeOid = getLiveLinkRefOid(userAfter, RESOURCE_DUMMY_ORANGE_OID);
    PrismObject<ShadowType> shadowOrange = getShadowModel(guybrushShadowOrangeOid);
    display("Orange shadow", shadowOrange);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) Test(org.testng.annotations.Test)

Example 69 with DummyAccount

use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.

the class TestInbounds method test259ModifyAccountOrangeGossipRemoveRecon.

/**
 * Similar to test209ModifyAccountOrangeGossipRemove, but uses direct account modification
 * and reconciliation.
 * MID-3080
 */
@Test
public void test259ModifyAccountOrangeGossipRemoveRecon() throws Exception {
    // GIVEN
    Task task = getTestTask();
    OperationResult result = task.getResult();
    PrismObject<UserType> userBefore = getUser(USER_GUYBRUSH_OID);
    display("User before", userBefore);
    DummyAccount dummyAccountBefore = getDummyAccount(RESOURCE_DUMMY_ORANGE_NAME, USER_GUYBRUSH_USERNAME);
    dummyAccountBefore.replaceAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME);
    displayDumpable("Account orange before", dummyAccountBefore);
    // WHEN
    reconcileUser(USER_GUYBRUSH_OID, task, result);
    // THEN
    result.computeStatus();
    TestUtil.assertSuccess(result);
    PrismObject<UserType> userAfter = getUser(USER_GUYBRUSH_OID);
    display("User after", userAfter);
    assertUser(userAfter, USER_GUYBRUSH_OID, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME, USER_GUYBRUSH_GIVEN_NAME, USER_GUYBRUSH_FAMILY_NAME);
    // The inbound mapping is tolerant. It will NOT remove the value.
    assertAssignedAccount(userAfter, RESOURCE_DUMMY_ORANGE_OID);
    assertAssignedRole(userAfter, ROLE_THIEF_OID);
    assertAssignments(userAfter, 2);
    assertUser(userAfter, "after").assertLinks(1, 0);
    DummyAccount dummyAccount = assertDummyAccount(RESOURCE_DUMMY_ORANGE_NAME, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME, true);
    displayDumpable("Orange account", dummyAccount);
    guybrushShadowOrangeOid = getLiveLinkRefOid(userAfter, RESOURCE_DUMMY_ORANGE_OID);
    PrismObject<ShadowType> shadowOrange = getShadowModel(guybrushShadowOrangeOid);
    display("Orange shadow", shadowOrange);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) Test(org.testng.annotations.Test)

Example 70 with DummyAccount

use of com.evolveum.icf.dummy.resource.DummyAccount in project midpoint by Evolveum.

the class TestInbounds method test250UnlinkAccountDefaultDummy.

/**
 * Not much happens here. We just need to remove the dummy account to avoid
 * inbound expression interferences. We wanted to have the dummy account in
 * text20x because these were relative. But now it will ruin the setup.
 */
@Test
public void test250UnlinkAccountDefaultDummy() throws Exception {
    // GIVEN
    Task task = getTestTask();
    OperationResult result = task.getResult();
    PrismObject<UserType> userBefore = getUser(USER_GUYBRUSH_OID);
    display("User before", userBefore);
    ObjectDelta<UserType> unlinkDelta = createModifyUserUnlinkAccount(USER_GUYBRUSH_OID, getDummyResourceObject());
    // WHEN
    modelService.executeChanges(MiscSchemaUtil.createCollection(unlinkDelta), null, task, result);
    // THEN
    assertSuccess(result);
    PrismObject<UserType> userAfter = getUser(USER_GUYBRUSH_OID);
    display("User after", userAfter);
    assertUser(userAfter, USER_GUYBRUSH_OID, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME, USER_GUYBRUSH_GIVEN_NAME, USER_GUYBRUSH_FAMILY_NAME);
    assertAssignedAccount(userAfter, RESOURCE_DUMMY_ORANGE_OID);
    assertAssignedNoRole(userAfter);
    assertAssignments(userAfter, 1);
    assertUser(userAfter, "after").assertLinks(1, 0);
    DummyAccount dummyAccount = assertDummyAccount(RESOURCE_DUMMY_ORANGE_NAME, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_FULL_NAME, true);
    displayDumpable("Orange account", dummyAccount);
    guybrushShadowOrangeOid = getLiveLinkRefOid(userAfter, RESOURCE_DUMMY_ORANGE_OID);
    PrismObject<ShadowType> shadowOrange = getShadowModel(guybrushShadowOrangeOid);
    display("Orange shadow", shadowOrange);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) Test(org.testng.annotations.Test)

Aggregations

DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)261 Test (org.testng.annotations.Test)211 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)158 Task (com.evolveum.midpoint.task.api.Task)152 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)40 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)40 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)24 DummyGroup (com.evolveum.icf.dummy.resource.DummyGroup)20 PrismObject (com.evolveum.midpoint.prism.PrismObject)19 ArrayList (java.util.ArrayList)19 OperationProvisioningScriptsType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType)18 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)16 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)14 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)14 DummyPrivilege (com.evolveum.icf.dummy.resource.DummyPrivilege)12 AbstractInternalModelIntegrationTest (com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)12 SchemaViolationException (com.evolveum.icf.dummy.resource.SchemaViolationException)10 QName (javax.xml.namespace.QName)10 ConflictException (com.evolveum.icf.dummy.resource.ConflictException)9 DummyOrg (com.evolveum.icf.dummy.resource.DummyOrg)9