use of com.evolveum.midpoint.xml.ns._public.common.common_3.QualifiedItemProcessingOutcomeType 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();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.QualifiedItemProcessingOutcomeType in project midpoint by Evolveum.
the class Operation method done.
default void done(ItemProcessingOutcomeType outcome, Throwable exception) {
QualifiedItemProcessingOutcomeType qualifiedOutcome = new QualifiedItemProcessingOutcomeType(PrismContext.get()).outcome(outcome);
done(qualifiedOutcome, exception);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.QualifiedItemProcessingOutcomeType in project midpoint by Evolveum.
the class OutcomeKeyedCounterTypeUtil method incrementCounter.
/**
* Increments counter corresponding to given outcome.
*/
public static int incrementCounter(List<OutcomeKeyedCounterType> counters, QualifiedItemProcessingOutcomeType outcome, PrismContext prismContext) {
OutcomeKeyedCounterType counter = findOrCreateCounter(counters, outcome, prismContext);
counter.setCount(or0(counter.getCount()) + 1);
return counter.getCount();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.QualifiedItemProcessingOutcomeType in project midpoint by Evolveum.
the class MockComponentActivityRun method runLocally.
@Override
@NotNull
protected ActivityRunResult runLocally(OperationResult result) throws CommonException {
CompositeMockWorkDefinition workDef = activity.getWorkDefinition();
int steps = workDef.getSteps();
long delay = workDef.getDelay();
LOGGER.info("Mock activity starting: id={}, steps={}, delay={}, sub-activity={}:\n{}", workDef.getMessage(), steps, delay, getMockSubActivity(), debugDumpLazily());
String itemName = workDef.getMessage() + ":" + getMockSubActivity();
Operation operation = activityState.getLiveItemProcessingStatistics().recordOperationStart(new IterativeOperationStartInfo(new IterationItemInformation(itemName, null, null, null)));
RunningTask task = taskRun.getRunningTask();
if (delay > 0) {
LOGGER.trace("Sleeping for {} msecs", delay);
MiscUtil.sleepWatchfully(System.currentTimeMillis() + delay, 100, task::canRun);
}
result.recordSuccess();
getRecorder().recordExecution(itemName);
QualifiedItemProcessingOutcomeType qualifiedOutcome = new QualifiedItemProcessingOutcomeType(getPrismContext()).outcome(ItemProcessingOutcomeType.SUCCESS);
operation.done(qualifiedOutcome, null);
incrementProgress(qualifiedOutcome);
LOGGER.info("Mock activity finished: id={}, sub-activity={}:\n{}", workDef.getMessage(), getMockSubActivity(), debugDumpLazily());
return standardRunResult();
}
Aggregations