public PendingOperationAsserter<R> assertResultStatus(OperationResultStatusType expected) { assertEquals("Wrong result status in "+desc(), expected, pendingOperation.getResultStatus()); return this; }
public static boolean isOverPeriod(XMLGregorianCalendar now, Duration period, PendingOperationType pendingOperation) { if (!isCompleted(pendingOperation.getResultStatus())) { return false; } XMLGregorianCalendar completionTimestamp = pendingOperation.getCompletionTimestamp(); if (completionTimestamp == null) { return false; } return isOverPeriod(now, period, completionTimestamp); }
private boolean needsRefresh(PendingOperationType pendingOperation) { PendingOperationExecutionStatusType executionStatus = pendingOperation.getExecutionStatus(); if (executionStatus == null) { // LEGACY: 3.7 and earlier return OperationResultStatusType.IN_PROGRESS.equals(pendingOperation.getResultStatus()); } else { return PendingOperationExecutionStatusType.EXECUTING.equals(executionStatus); } }
private PendingOperationType findExistingPendingOperation(PrismObject<ShadowType> currentShadow, ObjectDelta<ShadowType> proposedDelta, boolean processInProgress) throws SchemaException { for (PendingOperationType pendingOperation: currentShadow.asObjectable().getPendingOperation()) { OperationResultStatusType resultStatus = pendingOperation.getResultStatus(); if (!isInProgressOrRequested(resultStatus, processInProgress)) { continue; } ObjectDeltaType deltaType = pendingOperation.getDelta(); if (deltaType == null) { continue; } ObjectDelta<Objectable> delta = DeltaConvertor.createObjectDelta(deltaType, prismContext); if (!matchPendingDelta(delta, proposedDelta)) { continue; } return pendingOperation; } return null; }
@Override protected void assertTest528Deltas(PrismObject<ShadowType> shadowRepo, OperationResult result) { assertPendingOperationDeltas(shadowRepo, 3); ObjectDeltaType deltaModify = null; ObjectDeltaType deltaAdd = null; ObjectDeltaType deltaDelete = null; for (PendingOperationType pendingOperation: shadowRepo.asObjectable().getPendingOperation()) { assertEquals("Wrong status in pending delta", OperationResultStatusType.SUCCESS, pendingOperation.getResultStatus()); } } }
if (!resultStatus.equals(operation.getResultStatus())) { return false;
private void expirePendingOperations(ProvisioningContext ctx, PrismObject<ShadowType> repoShadow, ObjectDelta<ShadowType> shadowDelta, XMLGregorianCalendar now, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException { ShadowType shadowType = repoShadow.asObjectable(); Duration gracePeriod = ProvisioningUtil.getGracePeriod(ctx); Duration pendingOperationRetentionPeriod = ProvisioningUtil.getPendingOperationRetentionPeriod(ctx); Duration expirePeriod = XmlTypeConverter.longerDuration(gracePeriod, pendingOperationRetentionPeriod); for (PendingOperationType pendingOperation: shadowType.getPendingOperation()) { if (ProvisioningUtil.isOverPeriod(now, expirePeriod, pendingOperation)) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Deleting pending operation because it is completed '{}' and expired: {}", pendingOperation.getResultStatus().value(), pendingOperation); } shadowDelta.addModificationDeleteContainer(ShadowType.F_PENDING_OPERATION, pendingOperation.clone()); } } }
private PendingOperationType findPendingOperation(PrismObject<ShadowType> shadow, OperationResultStatusType expectedResult, ItemPath itemPath) { List<PendingOperationType> pendingOperations = shadow.asObjectable().getPendingOperation(); for (PendingOperationType pendingOperation: pendingOperations) { OperationResultStatusType result = pendingOperation.getResultStatus(); if (result == null) { result = OperationResultStatusType.IN_PROGRESS; } if (pendingOperation.getResultStatus() != expectedResult) { continue; } if (itemPath == null) { return pendingOperation; } ObjectDeltaType delta = pendingOperation.getDelta(); assertNotNull("No delta in pending operation in "+shadow, delta); for (ItemDeltaType itemDelta: delta.getItemDelta()) { ItemPath deltaPath = itemDelta.getPath().getItemPath(); if (itemPath.equivalent(deltaPath)) { return pendingOperation; } } } return null; }
protected PendingOperationType assertPendingOperation( PrismObject<ShadowType> shadow, PendingOperationType pendingOperation, XMLGregorianCalendar requestStart, XMLGregorianCalendar requestEnd, PendingOperationExecutionStatusType expectedExecutionStatus, OperationResultStatusType expectedResultStatus, XMLGregorianCalendar completionStart, XMLGregorianCalendar completionEnd) { assertNotNull("No operation ", pendingOperation); ObjectDeltaType deltaType = pendingOperation.getDelta(); assertNotNull("No delta in pending operation in "+shadow, deltaType); // TODO: check content of pending operations in the shadow TestUtil.assertBetween("No request timestamp in pending operation in "+shadow, requestStart, requestEnd, pendingOperation.getRequestTimestamp()); PendingOperationExecutionStatusType executiontStatus = pendingOperation.getExecutionStatus(); assertEquals("Wrong execution status in pending operation in "+shadow, expectedExecutionStatus, executiontStatus); OperationResultStatusType resultStatus = pendingOperation.getResultStatus(); assertEquals("Wrong result status in pending operation in "+shadow, expectedResultStatus, resultStatus); // TODO: assert other timestamps if (expectedExecutionStatus == PendingOperationExecutionStatusType.COMPLETED) { TestUtil.assertBetween("No completion timestamp in pending operation in "+shadow, completionStart, completionEnd, pendingOperation.getCompletionTimestamp()); } return pendingOperation; }
if (pendingOperation.getResultStatus() != null) { PropertyDelta<OperationResultStatusType> resultStatusDelta = createPendingOperationDelta(containerDefinition, containerPath, PendingOperationType.F_RESULT_STATUS, null); if (!opStateResultStatusType.equals(pendingOperation.getResultStatus())) { PropertyDelta<OperationResultStatusType> resultStatusDelta = createPendingOperationDelta(containerDefinition, containerPath, PendingOperationType.F_RESULT_STATUS, opStateResultStatusType);
@Override protected void assertTest526Deltas(PrismObject<ShadowType> shadowRepo, OperationResult result) { assertPendingOperationDeltas(shadowRepo, 3); ObjectDeltaType deltaModify = null; ObjectDeltaType deltaAdd = null; ObjectDeltaType deltaDisable = null; for (PendingOperationType pendingOperation: shadowRepo.asObjectable().getPendingOperation()) { ObjectDeltaType delta = pendingOperation.getDelta(); if (ChangeTypeType.ADD.equals(delta.getChangeType())) { deltaAdd = delta; assertEquals("Wrong status in add delta", OperationResultStatusType.SUCCESS, pendingOperation.getResultStatus()); } if (ChangeTypeType.MODIFY.equals(delta.getChangeType()) && OperationResultStatusType.SUCCESS.equals(pendingOperation.getResultStatus())) { deltaModify = delta; } if (ChangeTypeType.MODIFY.equals(delta.getChangeType()) && OperationResultStatusType.IN_PROGRESS.equals(pendingOperation.getResultStatus())) { deltaDisable = delta; } } assertNotNull("No add pending delta", deltaAdd); assertNotNull("No modify pending delta", deltaModify); assertNotNull("No disable pending delta", deltaDisable); }
protected void assertTest526Deltas(PrismObject<ShadowType> shadowRepo, OperationResult result) { assertPendingOperationDeltas(shadowRepo, 3); ObjectDeltaType deltaModify = null; ObjectDeltaType deltaAdd = null; ObjectDeltaType deltaDelete = null; for (PendingOperationType pendingOperation: shadowRepo.asObjectable().getPendingOperation()) { ObjectDeltaType delta = pendingOperation.getDelta(); if (ChangeTypeType.ADD.equals(delta.getChangeType())) { deltaAdd = delta; assertEquals("Wrong status in add delta", OperationResultStatusType.SUCCESS, pendingOperation.getResultStatus()); } if (ChangeTypeType.MODIFY.equals(delta.getChangeType())) { deltaModify = delta; assertEquals("Wrong status in modify delta", OperationResultStatusType.SUCCESS, pendingOperation.getResultStatus()); } if (ChangeTypeType.DELETE.equals(delta.getChangeType())) { deltaDelete = delta; assertEquals("Wrong status in delete delta", OperationResultStatusType.IN_PROGRESS, pendingOperation.getResultStatus()); } } assertNotNull("No add pending delta", deltaAdd); assertNotNull("No modify pending delta", deltaModify); assertNotNull("No delete pending delta", deltaDelete); }
continue; if (expectedResult != null && !expectedResult.equals(pendingOperation.getResultStatus())) { continue;
private PendingOperationType assertPendingOperation( PrismObject<ShadowType> shadow, PendingOperationType pendingOperation, XMLGregorianCalendar requestStart, XMLGregorianCalendar requestEnd, OperationResultStatusType expectedStatus, XMLGregorianCalendar completionStart, XMLGregorianCalendar completionEnd) { assertNotNull("No operation ", pendingOperation); ObjectDeltaType deltaType = pendingOperation.getDelta(); assertNotNull("No delta in pending operation in "+shadow, deltaType); // TODO: check content of pending operations in the shadow TestUtil.assertBetween("No request timestamp in pending operation in "+shadow, requestStart, requestEnd, pendingOperation.getRequestTimestamp()); OperationResultStatusType status = pendingOperation.getResultStatus(); assertEquals("Wrong status in pending operation in "+shadow, expectedStatus, status); if (expectedStatus != OperationResultStatusType.IN_PROGRESS) { TestUtil.assertBetween("No completion timestamp in pending operation in "+shadow, completionStart, completionEnd, pendingOperation.getCompletionTimestamp()); } return pendingOperation; }
boolean resourceReadIsCachingOnly = ProvisioningUtil.resourceReadIsCachingOnly(ctx.getResource()); for (PendingOperationType pendingOperation: sortedOperations) { OperationResultStatusType resultStatus = pendingOperation.getResultStatus(); PendingOperationExecutionStatusType executionStatus = pendingOperation.getExecutionStatus(); if (OperationResultStatusType.NOT_APPLICABLE.equals(resultStatus)) {
protected void assertTest528Deltas(PrismObject<ShadowType> shadowRepo, OperationResult result) { assertPendingOperationDeltas(shadowRepo, 3); ObjectDeltaType deltaModify = null; ObjectDeltaType deltaAdd = null; ObjectDeltaType deltaDelete = null; for (PendingOperationType pendingOperation: shadowRepo.asObjectable().getPendingOperation()) { assertEquals("Wrong status in pending delta", OperationResultStatusType.SUCCESS, pendingOperation.getResultStatus()); ObjectDeltaType delta = pendingOperation.getDelta(); if (ChangeTypeType.ADD.equals(delta.getChangeType())) { deltaAdd = delta; } if (ChangeTypeType.MODIFY.equals(delta.getChangeType())) { deltaModify = delta; } if (ChangeTypeType.DELETE.equals(delta.getChangeType())) { deltaDelete = delta; } } assertNotNull("No add pending delta", deltaAdd); assertNotNull("No modify pending delta", deltaModify); assertNotNull("No delete pending delta", deltaDelete); }
if (newStatusType.equals(pendingOperation.getResultStatus())) { continue;