use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignStateType.CLOSED 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.AccessCertificationCampaignStateType.CLOSED 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);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignStateType.CLOSED in project midpoint by Evolveum.
the class AbstractManualResourceTest method test204CloseCaseAndRecomputeWill.
/**
* Case is closed. The operation is complete.
*/
@Test
public void test204CloseCaseAndRecomputeWill() throws Exception {
final String TEST_NAME = "test204CloseCaseAndRecomputeWill";
displayTestTile(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
closeCase(willLastCaseOid);
accountWillCompletionTimestampStart = clock.currentTimeXMLGregorianCalendar();
// WHEN
displayWhen(TEST_NAME);
recomputeUser(userWillOid, 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);
assertSinglePendingOperation(shadowRepo, accountWillReqestTimestampStart, accountWillReqestTimestampEnd, OperationResultStatusType.SUCCESS, accountWillCompletionTimestampStart, accountWillCompletionTimestampEnd);
assertShadowActivationAdministrativeStatusFromCache(shadowRepo, ActivationStatusType.ENABLED);
assertAttribute(shadowRepo, ATTR_USERNAME_QNAME, USER_WILL_NAME);
assertAttributeFromCache(shadowRepo, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME_PIRATE);
PrismObject<ShadowType> shadowProvisioning = modelService.getObject(ShadowType.class, accountWillOid, null, task, result);
display("Model shadow", shadowProvisioning);
ShadowType shadowTypeProvisioning = shadowProvisioning.asObjectable();
assertShadowName(shadowProvisioning, USER_WILL_NAME);
assertEquals("Wrong kind (provisioning)", ShadowKindType.ACCOUNT, shadowTypeProvisioning.getKind());
assertShadowActivationAdministrativeStatus(shadowProvisioning, ActivationStatusType.ENABLED);
assertAttribute(shadowProvisioning, ATTR_USERNAME_QNAME, USER_WILL_NAME);
if (supportsBackingStore()) {
assertAttribute(shadowProvisioning, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME);
} else {
assertAttribute(shadowProvisioning, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME_PIRATE);
}
assertAttributeFromBackingStore(shadowProvisioning, ATTR_DESCRIPTION_QNAME, ACCOUNT_WILL_DESCRIPTION_MANUAL);
assertShadowPassword(shadowProvisioning);
PendingOperationType pendingOperation = assertSinglePendingOperation(shadowProvisioning, accountWillReqestTimestampStart, accountWillReqestTimestampEnd, OperationResultStatusType.SUCCESS, accountWillCompletionTimestampStart, accountWillCompletionTimestampEnd);
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);
assertAttributeFromBackingStore(shadowProvisioningFuture, ATTR_DESCRIPTION_QNAME, ACCOUNT_WILL_DESCRIPTION_MANUAL);
assertShadowPassword(shadowProvisioningFuture);
assertCase(willLastCaseOid, SchemaConstants.CASE_STATE_CLOSED);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignStateType.CLOSED in project midpoint by Evolveum.
the class CleanUpTaskHandler method runInternal.
private TaskRunResult runInternal(Task task) {
LOGGER.trace("CleanUpTaskHandler.run starting");
long progress = task.getProgress();
OperationResult opResult = new OperationResult(OperationConstants.CLEANUP);
TaskRunResult runResult = new TaskRunResult();
runResult.setOperationResult(opResult);
CleanupPoliciesType cleanupPolicies = task.getExtensionPropertyRealValue(SchemaConstants.MODEL_EXTENSION_CLEANUP_POLICIES);
if (cleanupPolicies != null) {
LOGGER.info("Using task-specific cleanupPolicies: {}", cleanupPolicies);
} else {
PrismObject<SystemConfigurationType> systemConfig;
try {
systemConfig = repositoryService.getObject(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, opResult);
} catch (ObjectNotFoundException ex) {
LOGGER.error("Cleanup: Object does not exist: {}", ex.getMessage(), ex);
opResult.recordFatalError("Object does not exist: " + ex.getMessage(), ex);
runResult.setRunResultStatus(TaskRunResultStatus.PERMANENT_ERROR);
runResult.setProgress(progress);
return runResult;
} catch (SchemaException ex) {
LOGGER.error("Cleanup: Error dealing with schema: {}", ex.getMessage(), ex);
opResult.recordFatalError("Error dealing with schema: " + ex.getMessage(), ex);
runResult.setRunResultStatus(TaskRunResultStatus.PERMANENT_ERROR);
runResult.setProgress(progress);
return runResult;
}
SystemConfigurationType systemConfigType = systemConfig.asObjectable();
cleanupPolicies = systemConfigType.getCleanupPolicy();
}
if (cleanupPolicies == null) {
LOGGER.trace("Cleanup: No clean up polices specified. Finishing clean up task.");
opResult.computeStatus();
runResult.setRunResultStatus(TaskRunResultStatus.FINISHED);
runResult.setProgress(progress);
return runResult;
}
CleanupPolicyType auditCleanupPolicy = cleanupPolicies.getAuditRecords();
if (auditCleanupPolicy != null) {
try {
auditService.cleanupAudit(auditCleanupPolicy, opResult);
} catch (Exception ex) {
LOGGER.error("Cleanup: {}", ex.getMessage(), ex);
opResult.recordFatalError(ex.getMessage(), ex);
runResult.setRunResultStatus(TaskRunResultStatus.PERMANENT_ERROR);
runResult.setProgress(progress);
}
} else {
LOGGER.trace("Cleanup: No clean up policy for audit specified. Finishing clean up task.");
}
CleanupPolicyType closedTasksPolicy = cleanupPolicies.getClosedTasks();
if (closedTasksPolicy != null) {
try {
taskManager.cleanupTasks(closedTasksPolicy, task, opResult);
} catch (Exception ex) {
LOGGER.error("Cleanup: {}", ex.getMessage(), ex);
opResult.recordFatalError(ex.getMessage(), ex);
runResult.setRunResultStatus(TaskRunResultStatus.PERMANENT_ERROR);
runResult.setProgress(progress);
}
} else {
LOGGER.trace("Cleanup: No clean up policy for closed tasks specified. Finishing clean up task.");
}
CleanupPolicyType reportCleanupPolicy = cleanupPolicies.getOutputReports();
if (reportCleanupPolicy != null) {
try {
if (reportManager == null) {
//TODO improve dependencies for report-impl (probably for tests) and set autowire to required
LOGGER.error("Report manager was not autowired, reports cleanup will be skipped.");
} else {
reportManager.cleanupReports(reportCleanupPolicy, opResult);
}
} catch (Exception ex) {
LOGGER.error("Cleanup: {}", ex.getMessage(), ex);
opResult.recordFatalError(ex.getMessage(), ex);
runResult.setRunResultStatus(TaskRunResultStatus.PERMANENT_ERROR);
runResult.setProgress(progress);
}
} else {
LOGGER.trace("Cleanup: No clean up policy for report specified. Finishing clean up task.");
}
opResult.computeStatus();
// This "run" is finished. But the task goes on ...
runResult.setRunResultStatus(TaskRunResultStatus.FINISHED);
runResult.setProgress(progress);
LOGGER.trace("CleanUpTaskHandler.run stopping");
return runResult;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignStateType.CLOSED in project midpoint by Evolveum.
the class SimpleCampaignStageNotifier method getBody.
@Override
protected String getBody(Event event, GeneralNotifierType generalNotifierType, String transport, Task task, OperationResult result) {
StringBuilder body = new StringBuilder();
CertCampaignStageEvent csEvent = (CertCampaignStageEvent) event;
AccessCertificationCampaignType campaign = csEvent.getCampaign();
body.append("A certification campaign stage ");
if (csEvent.isAdd()) {
body.append("has been started");
} else if (csEvent.isDelete()) {
body.append("has been closed");
} else if (csEvent.isModify()) {
body.append("is about to be closed");
}
body.append(".");
body.append("\n\nCampaign: ");
body.append(certHelper.getCampaignNameAndOid(csEvent));
body.append("\nState: ");
body.append(certHelper.formatState(csEvent));
// the event is generated in the real time
body.append("\n\nTime: ").append(new Date());
AccessCertificationStageType stage = CertCampaignTypeUtil.getCurrentStage(campaign);
if (stage != null) {
body.append("\n\nStage start time: ").append(XmlTypeConverter.toDate(stage.getStartTimestamp()));
body.append("\nStage deadline time: ").append(XmlTypeConverter.toDate(stage.getDeadline()));
if (csEvent.isModify() && stage.getDeadline() != null) {
long delta = XmlTypeConverter.toMillis(stage.getDeadline()) - System.currentTimeMillis();
if (delta > 0) {
body.append("\n\nStage ends in ");
body.append(DurationFormatUtils.formatDurationWords(delta, true, true));
} else if (delta < 0) {
body.append("\n\nStage should have ended ");
body.append(DurationFormatUtils.formatDurationWords(-delta, true, true));
body.append(" ago");
}
}
}
body.append("\n");
if (csEvent.isAdd() || csEvent.isDelete()) {
body.append("\nRequester: ").append(formatRequester(event, result));
body.append("\nOperation status: ").append(certHelper.formatStatus(csEvent));
body.append("\n");
}
body.append("\n");
certHelper.appendStatistics(body, campaign, task, result);
body.append("\n\n");
functions.addRequesterAndChannelInformation(body, event, result);
return body.toString();
}
Aggregations