Search in sources :

Example 81 with DummyAccount

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);
}
Also used : DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) Test(org.testng.annotations.Test)

Example 82 with DummyAccount

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);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) GenericConnectorException(com.evolveum.midpoint.provisioning.api.GenericConnectorException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) Test(org.testng.annotations.Test) AbstractConfiguredModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractConfiguredModelIntegrationTest)

Example 83 with DummyAccount

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);
}
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) AbstractInitializedModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)

Example 84 with DummyAccount

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);
}
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) AbstractInitializedModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)

Example 85 with DummyAccount

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);
}
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) AbstractInitializedModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)

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