use of com.evolveum.midpoint.repo.common.tasks.handlers.CommonMockActivityHelper in project midpoint by Evolveum.
the class SimpleMockActivityRun method runLocally.
@Override
@NotNull
protected ActivityRunResult runLocally(OperationResult result) throws SchemaException, ObjectNotFoundException, ObjectAlreadyExistsException {
String message = activity.getWorkDefinition().getMessage();
Operation operation = activityState.getLiveItemProcessingStatistics().recordOperationStart(new IterativeOperationStartInfo(new IterationItemInformation(message, null, null, null)));
// to avoid wall clock time of 0 (failing throughput-assuming tests)
MiscUtil.sleepCatchingInterruptedException(10);
LOGGER.info("Message: {}", message);
getRecorder().recordExecution(message);
CommonMockActivityHelper helper = getActivityHandler().getMockHelper();
helper.increaseExecutionCount(activityState, result);
try {
helper.failIfNeeded(this, activity.getWorkDefinition().getInitialFailures());
QualifiedItemProcessingOutcomeType qualifiedOutcome = new QualifiedItemProcessingOutcomeType(getPrismContext()).outcome(ItemProcessingOutcomeType.SUCCESS);
operation.done(qualifiedOutcome, null);
incrementProgress(qualifiedOutcome);
} catch (Exception e) {
QualifiedItemProcessingOutcomeType qualifiedOutcome = new QualifiedItemProcessingOutcomeType(getPrismContext()).outcome(ItemProcessingOutcomeType.FAILURE);
operation.done(qualifiedOutcome, e);
incrementProgress(qualifiedOutcome);
throw e;
}
return standardRunResult();
}
Aggregations