Search in sources :

Example 1 with PendingOperationType

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

the class AbstractManualResourceTest method test270RecomputeWillAfter10min.

/**
	 * ff 10min. Refresh. Oldest delta should expire.
	 */
@Test
public void test270RecomputeWillAfter10min() throws Exception {
    final String TEST_NAME = "test130RefreshAccountWillAfter10min";
    displayTestTile(TEST_NAME);
    // GIVEN
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    clock.overrideDuration("PT10M");
    PrismObject<ShadowType> shadowBefore = modelService.getObject(ShadowType.class, accountWillOid, null, task, result);
    display("Shadow before", shadowBefore);
    // WHEN
    displayWhen(TEST_NAME);
    recomputeUser(userWillOid, task, result);
    // THEN
    displayThen(TEST_NAME);
    assertSuccess(result);
    PrismObject<ShadowType> shadowRepo = repositoryService.getObject(ShadowType.class, accountWillOid, null, result);
    display("Repo shadow", shadowRepo);
    assertPendingOperationDeltas(shadowRepo, 2);
    PendingOperationType pendingOperation = findPendingOperation(shadowRepo, OperationResultStatusType.SUCCESS, SchemaConstants.PATH_PASSWORD_VALUE);
    assertPendingOperation(shadowRepo, pendingOperation, accountWillSecondReqestTimestampStart, accountWillSecondReqestTimestampEnd, OperationResultStatusType.SUCCESS, accountWillSecondCompletionTimestampStart, accountWillSecondCompletionTimestampEnd);
    pendingOperation = findPendingOperation(shadowRepo, OperationResultStatusType.SUCCESS, SchemaConstants.PATH_PASSWORD_VALUE);
    assertPendingOperation(shadowRepo, pendingOperation, accountWillSecondReqestTimestampStart, accountWillSecondReqestTimestampEnd, OperationResultStatusType.SUCCESS, accountWillSecondCompletionTimestampStart, accountWillSecondCompletionTimestampEnd);
    assertShadowActivationAdministrativeStatusFromCache(shadowRepo, ActivationStatusType.ENABLED);
    assertAttribute(shadowRepo, ATTR_USERNAME_QNAME, USER_WILL_NAME);
    assertAttributeFromCache(shadowRepo, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME_PIRATE);
    PrismObject<ShadowType> shadowModel = modelService.getObject(ShadowType.class, accountWillOid, null, task, result);
    display("Model shadow", shadowModel);
    ShadowType shadowTypeProvisioning = shadowModel.asObjectable();
    assertShadowName(shadowModel, USER_WILL_NAME);
    assertEquals("Wrong kind (provisioning)", ShadowKindType.ACCOUNT, shadowTypeProvisioning.getKind());
    if (supportsBackingStore()) {
        assertShadowActivationAdministrativeStatus(shadowModel, ActivationStatusType.DISABLED);
    } else {
        assertShadowActivationAdministrativeStatus(shadowModel, ActivationStatusType.ENABLED);
    }
    assertAttribute(shadowModel, ATTR_USERNAME_QNAME, USER_WILL_NAME);
    assertAttribute(shadowModel, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME_PIRATE);
    assertAttributeFromBackingStore(shadowModel, ATTR_DESCRIPTION_QNAME, ACCOUNT_WILL_DESCRIPTION_MANUAL);
    assertShadowPassword(shadowModel);
    assertPendingOperationDeltas(shadowModel, 2);
    pendingOperation = findPendingOperation(shadowModel, OperationResultStatusType.SUCCESS, SchemaConstants.PATH_PASSWORD_VALUE);
    assertPendingOperation(shadowRepo, pendingOperation, accountWillSecondReqestTimestampStart, accountWillSecondReqestTimestampEnd, OperationResultStatusType.SUCCESS, accountWillSecondCompletionTimestampStart, accountWillSecondCompletionTimestampEnd);
    PrismObject<ShadowType> shadowModelFuture = modelService.getObject(ShadowType.class, accountWillOid, SelectorOptions.createCollection(GetOperationOptions.createPointInTimeType(PointInTimeType.FUTURE)), task, result);
    display("Model shadow (future)", shadowModelFuture);
    assertShadowName(shadowModelFuture, USER_WILL_NAME);
    assertEquals("Wrong kind (provisioning)", ShadowKindType.ACCOUNT, shadowModelFuture.asObjectable().getKind());
    assertShadowActivationAdministrativeStatus(shadowModelFuture, ActivationStatusType.ENABLED);
    assertAttribute(shadowModelFuture, ATTR_USERNAME_QNAME, USER_WILL_NAME);
    assertAttribute(shadowModelFuture, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME_PIRATE);
    assertAttributeFromBackingStore(shadowModelFuture, ATTR_DESCRIPTION_QNAME, ACCOUNT_WILL_DESCRIPTION_MANUAL);
    assertShadowPassword(shadowModelFuture);
    assertCase(willLastCaseOid, SchemaConstants.CASE_STATE_CLOSED);
    assertCase(willSecondLastCaseOid, SchemaConstants.CASE_STATE_CLOSED);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) PendingOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test) AbstractConfiguredModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractConfiguredModelIntegrationTest)

Example 2 with PendingOperationType

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

the class AbstractManualResourceTest method test202RecomputeWill.

@Test
public void test202RecomputeWill() throws Exception {
    final String TEST_NAME = "test202RecomputeWill";
    displayTestTile(TEST_NAME);
    // GIVEN
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    // WHEN
    displayWhen(TEST_NAME);
    recomputeUser(userWillOid, task, result);
    // THEN
    displayThen(TEST_NAME);
    assertSuccess(result);
    PrismObject<ShadowType> shadowRepo = repositoryService.getObject(ShadowType.class, accountWillOid, null, result);
    display("Repo shadow", shadowRepo);
    PendingOperationType pendingOperation = assertSinglePendingOperation(shadowRepo, accountWillReqestTimestampStart, accountWillReqestTimestampEnd);
    assertNotNull("No ID in pending operation", pendingOperation.getId());
    // Still old data in the repo. The operation is not completed yet.
    assertShadowActivationAdministrativeStatusFromCache(shadowRepo, ActivationStatusType.ENABLED);
    assertAttribute(shadowRepo, ATTR_USERNAME_QNAME, USER_WILL_NAME);
    assertAttributeFromCache(shadowRepo, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME);
    PrismObject<ShadowType> shadowModel = modelService.getObject(ShadowType.class, accountWillOid, null, task, result);
    display("Model shadow", shadowModel);
    ShadowType shadowTypeProvisioning = shadowModel.asObjectable();
    assertShadowName(shadowModel, USER_WILL_NAME);
    assertEquals("Wrong kind (provisioning)", ShadowKindType.ACCOUNT, shadowTypeProvisioning.getKind());
    assertShadowActivationAdministrativeStatus(shadowModel, ActivationStatusType.ENABLED);
    assertAttribute(shadowModel, ATTR_USERNAME_QNAME, USER_WILL_NAME);
    assertAttribute(shadowModel, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME);
    assertShadowPassword(shadowModel);
    assertSinglePendingOperation(shadowModel, accountWillReqestTimestampStart, accountWillReqestTimestampEnd);
    PrismObject<ShadowType> shadowProvisioningFuture = modelService.getObject(ShadowType.class, accountWillOid, SelectorOptions.createCollection(GetOperationOptions.createPointInTimeType(PointInTimeType.FUTURE)), task, result);
    display("Model shadow (future)", shadowProvisioningFuture);
    assertShadowName(shadowProvisioningFuture, USER_WILL_NAME);
    assertEquals("Wrong kind (provisioning)", ShadowKindType.ACCOUNT, shadowProvisioningFuture.asObjectable().getKind());
    assertShadowActivationAdministrativeStatus(shadowProvisioningFuture, ActivationStatusType.ENABLED);
    assertAttribute(shadowProvisioningFuture, ATTR_USERNAME_QNAME, USER_WILL_NAME);
    assertAttribute(shadowProvisioningFuture, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME_PIRATE);
    assertShadowPassword(shadowProvisioningFuture);
    assertCase(willLastCaseOid, SchemaConstants.CASE_STATE_OPEN);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) PendingOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test) AbstractConfiguredModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractConfiguredModelIntegrationTest)

Example 3 with PendingOperationType

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

the class AbstractManualResourceTest method assertWillAfterCreateCaseClosed.

private void assertWillAfterCreateCaseClosed(final String TEST_NAME, boolean backingStoreUpdated) throws Exception {
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    PrismObject<ShadowType> shadowRepo = repositoryService.getObject(ShadowType.class, accountWillOid, null, result);
    display("Repo shadow", shadowRepo);
    assertSinglePendingOperation(shadowRepo, accountWillReqestTimestampStart, accountWillReqestTimestampEnd, OperationResultStatusType.SUCCESS, accountWillCompletionTimestampStart, accountWillCompletionTimestampEnd);
    assertAttribute(shadowRepo, ATTR_USERNAME_QNAME, USER_WILL_NAME);
    assertAttributeFromCache(shadowRepo, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME);
    assertShadowActivationAdministrativeStatusFromCache(shadowRepo, ActivationStatusType.ENABLED);
    PrismObject<ShadowType> shadowModel = modelService.getObject(ShadowType.class, accountWillOid, null, task, result);
    display("Model shadow", shadowModel);
    ShadowType shadowTypeProvisioning = shadowModel.asObjectable();
    assertShadowName(shadowModel, USER_WILL_NAME);
    assertEquals("Wrong kind (provisioning)", ShadowKindType.ACCOUNT, shadowTypeProvisioning.getKind());
    assertAttribute(shadowModel, ATTR_USERNAME_QNAME, USER_WILL_NAME);
    if (!supportsBackingStore() || backingStoreUpdated) {
        assertAttribute(shadowModel, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME);
        assertAttributeFromBackingStore(shadowModel, ATTR_DESCRIPTION_QNAME, ACCOUNT_WILL_DESCRIPTION_MANUAL);
        assertShadowActivationAdministrativeStatus(shadowModel, ActivationStatusType.ENABLED);
        assertShadowPassword(shadowModel);
    }
    PendingOperationType pendingOperation = assertSinglePendingOperation(shadowModel, accountWillReqestTimestampStart, accountWillReqestTimestampEnd, OperationResultStatusType.SUCCESS, accountWillCompletionTimestampStart, accountWillCompletionTimestampEnd);
    assertCase(willLastCaseOid, SchemaConstants.CASE_STATE_CLOSED);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) PendingOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 4 with PendingOperationType

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

the class AbstractManualResourceTest method test104RecomputeWill.

@Test
public void test104RecomputeWill() throws Exception {
    final String TEST_NAME = "test104RecomputeWill";
    displayTestTile(TEST_NAME);
    // GIVEN
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    // WHEN
    displayWhen(TEST_NAME);
    recomputeUser(userWillOid, task, result);
    // THEN
    displayThen(TEST_NAME);
    assertSuccess(result);
    PrismObject<ShadowType> shadowRepo = repositoryService.getObject(ShadowType.class, accountWillOid, null, result);
    display("Repo shadow", shadowRepo);
    assertSinglePendingOperation(shadowRepo, accountWillReqestTimestampStart, accountWillReqestTimestampEnd);
    assertAttribute(shadowRepo, ATTR_USERNAME_QNAME, USER_WILL_NAME);
    assertAttributeFromCache(shadowRepo, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME);
    assertNoAttribute(shadowRepo, ATTR_DESCRIPTION_QNAME);
    assertShadowActivationAdministrativeStatusFromCache(shadowRepo, ActivationStatusType.ENABLED);
    assertNoShadowPassword(shadowRepo);
    assertShadowExists(shadowRepo, false);
    PrismObject<ShadowType> shadowModel = modelService.getObject(ShadowType.class, accountWillOid, null, task, result);
    display("Model shadow", shadowModel);
    ShadowType shadowTypeProvisioning = shadowModel.asObjectable();
    assertShadowName(shadowModel, USER_WILL_NAME);
    assertEquals("Wrong kind (provisioning)", ShadowKindType.ACCOUNT, shadowTypeProvisioning.getKind());
    assertAttribute(shadowModel, ATTR_USERNAME_QNAME, USER_WILL_NAME);
    assertAttributeFromCache(shadowModel, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME);
    assertNoAttribute(shadowModel, ATTR_DESCRIPTION_QNAME);
    assertShadowActivationAdministrativeStatusFromCache(shadowModel, ActivationStatusType.ENABLED);
    assertNoShadowPassword(shadowModel);
    PendingOperationType pendingOperation = assertSinglePendingOperation(shadowModel, accountWillReqestTimestampStart, accountWillReqestTimestampEnd);
    assertCase(pendingOperation.getAsynchronousOperationReference(), SchemaConstants.CASE_STATE_OPEN);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) PendingOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test) AbstractConfiguredModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractConfiguredModelIntegrationTest)

Example 5 with PendingOperationType

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

the class AbstractManualResourceTest method test120RecomputeWillAfter5min.

/**
	 * ff 5min, everything should be the same (grace not expired yet)
	 */
@Test
public void test120RecomputeWillAfter5min() throws Exception {
    final String TEST_NAME = "test120RecomputeWillAfter5min";
    displayTestTile(TEST_NAME);
    // GIVEN
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    clock.overrideDuration("PT5M");
    // WHEN
    displayWhen(TEST_NAME);
    recomputeUser(userWillOid, task, result);
    // THEN
    displayThen(TEST_NAME);
    assertSuccess(result);
    PrismObject<ShadowType> shadowRepo = repositoryService.getObject(ShadowType.class, accountWillOid, null, result);
    display("Repo shadow", shadowRepo);
    assertSinglePendingOperation(shadowRepo, accountWillReqestTimestampStart, accountWillReqestTimestampEnd, OperationResultStatusType.SUCCESS, accountWillCompletionTimestampStart, accountWillCompletionTimestampEnd);
    PrismObject<ShadowType> shadowModel = modelService.getObject(ShadowType.class, accountWillOid, null, task, result);
    PendingOperationType pendingOperation = assertSinglePendingOperation(shadowModel, accountWillReqestTimestampStart, accountWillReqestTimestampEnd, OperationResultStatusType.SUCCESS, accountWillCompletionTimestampStart, accountWillCompletionTimestampEnd);
    assertCase(willLastCaseOid, SchemaConstants.CASE_STATE_CLOSED);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) PendingOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test) AbstractConfiguredModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractConfiguredModelIntegrationTest)

Aggregations

PendingOperationType (com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType)43 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)41 Task (com.evolveum.midpoint.task.api.Task)41 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)41 Test (org.testng.annotations.Test)38 AbstractConfiguredModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractConfiguredModelIntegrationTest)19 AbstractProvisioningIntegrationTest (com.evolveum.midpoint.provisioning.impl.AbstractProvisioningIntegrationTest)19 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)4 OperationResultStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType)4 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)4 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)3 ItemDeltaType (com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)2 ProtectedStringType (com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType)2