use of com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType in project midpoint by Evolveum.
the class AbstractManualResourceTest method test212UpdateBackingStoreAndGetAccountWill.
@Test
public void test212UpdateBackingStoreAndGetAccountWill() throws Exception {
final String TEST_NAME = "test212UpdateBackingStoreAndGetAccountWill";
displayTestTile(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
backingStoreUpdateWill(USER_WILL_FULL_NAME_PIRATE, ActivationStatusType.ENABLED, USER_WILL_PASSWORD_OLD);
// WHEN
displayWhen(TEST_NAME);
PrismObject<ShadowType> shadowModel = modelService.getObject(ShadowType.class, accountWillOid, null, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
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);
PendingOperationType pendingOperation = assertSinglePendingOperation(shadowModel, accountWillReqestTimestampStart, accountWillReqestTimestampEnd, OperationResultStatusType.SUCCESS, accountWillCompletionTimestampStart, accountWillCompletionTimestampEnd);
PrismObject<ShadowType> shadowRepo = repositoryService.getObject(ShadowType.class, accountWillOid, null, result);
display("Repo shadow", shadowRepo);
assertSinglePendingOperation(shadowRepo, accountWillReqestTimestampStart, accountWillReqestTimestampEnd, OperationResultStatusType.SUCCESS, accountWillCompletionTimestampStart, accountWillCompletionTimestampEnd);
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);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType in project midpoint by Evolveum.
the class AbstractManualResourceTest method test260ClosePasswordChangeCaseAndRecomputeWill.
/**
* Password change/enable case is closed. The account should be disabled. But there is still the other
* delta pending.
*/
@Test
public void test260ClosePasswordChangeCaseAndRecomputeWill() throws Exception {
final String TEST_NAME = "test260ClosePasswordChangeCaseAndRecomputeWill";
displayTestTile(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
closeCase(willSecondLastCaseOid);
accountWillSecondCompletionTimestampStart = clock.currentTimeXMLGregorianCalendar();
// WHEN
displayWhen(TEST_NAME);
recomputeUser(userWillOid, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
accountWillSecondCompletionTimestampEnd = clock.currentTimeXMLGregorianCalendar();
PrismObject<ShadowType> shadowRepo = repositoryService.getObject(ShadowType.class, accountWillOid, null, result);
display("Repo shadow", shadowRepo);
assertPendingOperationDeltas(shadowRepo, 3);
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, 3);
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);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType in project midpoint by Evolveum.
the class AbstractManualResourceTest method test302RecomputeWill.
/**
* Recompute. Make sure model will not try to delete the account again.
*/
@Test
public void test302RecomputeWill() throws Exception {
final String TEST_NAME = "test302RecomputeWill";
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);
display("result", result);
assertSuccess(result);
PrismObject<ShadowType> shadowRepo = repositoryService.getObject(ShadowType.class, accountWillOid, null, result);
display("Repo shadow", shadowRepo);
assertPendingOperationDeltas(shadowRepo, 1);
PendingOperationType pendingOperation = findPendingOperation(shadowRepo, OperationResultStatusType.IN_PROGRESS, null);
assertPendingOperation(shadowRepo, pendingOperation, 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_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());
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, 1);
pendingOperation = findPendingOperation(shadowModel, OperationResultStatusType.IN_PROGRESS, null);
assertPendingOperation(shadowModel, pendingOperation, accountWillReqestTimestampStart, accountWillReqestTimestampEnd);
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);
assertShadowDead(shadowModelFuture);
assertShadowPassword(shadowModelFuture);
// Make sure that the account is still linked
PrismObject<UserType> userAfter = getUser(userWillOid);
display("User after", userAfter);
String accountWillOidAfter = getSingleLinkOid(userAfter);
assertEquals(accountWillOid, accountWillOidAfter);
assertNoAssignments(userAfter);
assertNotNull("No async reference in result", willLastCaseOid);
assertCase(willLastCaseOid, SchemaConstants.CASE_STATE_OPEN);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType in project midpoint by Evolveum.
the class AbstractManualResourceTest method test280RecomputeWillAfter5min.
/**
* ff 5min. Refresh. Another delta should expire.
*/
@Test
public void test280RecomputeWillAfter5min() throws Exception {
final String TEST_NAME = "test280RecomputeWillAfter5min";
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);
assertPendingOperationDeltas(shadowRepo, 1);
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());
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, 1);
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);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType in project midpoint by Evolveum.
the class AbstractManualResourceTest method test240CloseDisableCaseAndReadAccountWill.
/**
* Disable case is closed. The account should be disabled. But there is still the other
* delta pending.
* Do NOT explicitly refresh the shadow in this case. Just reading it should cause the refresh.
*/
@Test
public void test240CloseDisableCaseAndReadAccountWill() throws Exception {
final String TEST_NAME = "test240CloseDisableCaseAndReadAccountWill";
displayTestTile(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
closeCase(willLastCaseOid);
accountWillCompletionTimestampStart = clock.currentTimeXMLGregorianCalendar();
// WHEN
displayWhen(TEST_NAME);
PrismObject<ShadowType> shadowModel = modelService.getObject(ShadowType.class, accountWillOid, null, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
accountWillCompletionTimestampEnd = clock.currentTimeXMLGregorianCalendar();
PrismObject<ShadowType> shadowRepo = repositoryService.getObject(ShadowType.class, accountWillOid, null, result);
display("Repo shadow", shadowRepo);
assertPendingOperationDeltas(shadowRepo, 3);
PendingOperationType pendingOperation = findPendingOperation(shadowRepo, OperationResultStatusType.SUCCESS, SchemaConstants.PATH_ACTIVATION_ADMINISTRATIVE_STATUS);
assertPendingOperation(shadowRepo, pendingOperation, accountWillReqestTimestampStart, accountWillReqestTimestampEnd, OperationResultStatusType.SUCCESS, accountWillCompletionTimestampStart, accountWillCompletionTimestampEnd);
pendingOperation = findPendingOperation(shadowRepo, OperationResultStatusType.IN_PROGRESS, SchemaConstants.PATH_PASSWORD_VALUE);
assertPendingOperation(shadowRepo, pendingOperation, accountWillSecondReqestTimestampStart, accountWillSecondReqestTimestampEnd);
assertShadowActivationAdministrativeStatusFromCache(shadowRepo, ActivationStatusType.DISABLED);
assertAttribute(shadowRepo, ATTR_USERNAME_QNAME, USER_WILL_NAME);
assertAttributeFromCache(shadowRepo, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME_PIRATE);
display("Model shadow", shadowModel);
ShadowType shadowTypeModel = shadowModel.asObjectable();
assertShadowName(shadowModel, USER_WILL_NAME);
assertEquals("Wrong kind (provisioning)", ShadowKindType.ACCOUNT, shadowTypeModel.getKind());
if (supportsBackingStore()) {
assertShadowActivationAdministrativeStatus(shadowModel, ActivationStatusType.ENABLED);
} else {
assertShadowActivationAdministrativeStatus(shadowModel, ActivationStatusType.DISABLED);
}
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, 3);
pendingOperation = findPendingOperation(shadowModel, OperationResultStatusType.SUCCESS, SchemaConstants.PATH_ACTIVATION_ADMINISTRATIVE_STATUS);
assertPendingOperation(shadowModel, pendingOperation, accountWillReqestTimestampStart, accountWillReqestTimestampEnd, OperationResultStatusType.SUCCESS, accountWillCompletionTimestampStart, accountWillCompletionTimestampEnd);
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);
// TODO
// assertShadowPassword(shadowProvisioningFuture);
assertCase(willLastCaseOid, SchemaConstants.CASE_STATE_CLOSED);
assertCase(willSecondLastCaseOid, SchemaConstants.CASE_STATE_OPEN);
}
Aggregations