diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/LensUtil.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/LensUtil.java index 3fda5c6cfd0..ee104480dd8 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/LensUtil.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/LensUtil.java @@ -35,6 +35,7 @@ import com.evolveum.midpoint.common.refinery.RefinedResourceSchema; import com.evolveum.midpoint.common.refinery.ResourceShadowDiscriminator; import com.evolveum.midpoint.model.api.PolicyViolationException; +import com.evolveum.midpoint.model.api.context.SynchronizationPolicyDecision; import com.evolveum.midpoint.model.common.expression.Expression; import com.evolveum.midpoint.model.common.expression.ExpressionEvaluationContext; import com.evolveum.midpoint.model.common.expression.ExpressionFactory; @@ -380,9 +381,8 @@ public void visit(I pvwo) { continue; } if (filterExistingValues && !hasValue(itemExisting, value, valueMatcher, comparator)) { - // temporarily changed from .trace to .info in order to assist with problems like MID-2368 - LOGGER.info("Value {} NOT deleted to delta for item {} the item does not have that value in {}", - new Object[]{value, itemPath, contextDescription}); + LOGGER.trace("Value {} NOT deleted to delta for item {} the item does not have that value in {} (matcher: {})", + new Object[]{value, itemPath, contextDescription, valueMatcher}); continue; } LOGGER.trace("Value {} deleted to delta for item {} in {}", @@ -618,11 +618,16 @@ public static void loadFullAccount(LensContext context return; } } - LOGGER.trace("Loading full resource object {} from provisioning", accCtx); - try{ - GetOperationOptions getOptions = GetOperationOptions.createDoNotDiscovery(); - getOptions.setAllowNotFound(true); + + GetOperationOptions getOptions = GetOperationOptions.createAllowNotFound(); + if (SchemaConstants.CHANGE_CHANNEL_DISCOVERY.equals(context.getChannel())) { + LOGGER.trace("Loading full resource object {} from provisioning - with doNotDiscover to avoid loops", accCtx); + getOptions.setDoNotDiscovery(true); + } else { + LOGGER.trace("Loading full resource object {} from provisioning (discovery enabled)", accCtx); + } + try { Collection> options = SelectorOptions.createCollection(getOptions); PrismObject objectOld = provisioningService.getObject(ShadowType.class, accCtx.getOid(), options, @@ -632,12 +637,20 @@ public static void loadFullAccount(LensContext context ShadowType oldShadow = objectOld.asObjectable(); accCtx.determineFullShadowFlag(oldShadow.getFetchResult()); - } catch (ObjectNotFoundException ex){ + } catch (ObjectNotFoundException ex) { + LOGGER.trace("Load of full resource object {} ended with ObjectNotFoundException (options={})", accCtx, getOptions); if (accCtx.isDelete()){ //this is OK, shadow was deleted, but we will continue in processing with old shadow..and set it as full so prevent from other full loading accCtx.setFullShadow(true); - } else - throw ex; + } else { + accCtx.setSynchronizationPolicyDecision(SynchronizationPolicyDecision.BROKEN); + if (GetOperationOptions.isDoNotDiscovery(getOptions)) { + LOGGER.error("Load of full resource object {} resulted in ObjectNotFoundException (discovery disabled to avoid loops)", accCtx, getOptions); + throw ex; + } else { + // Setting the context to broken should be enough here. + } + } } accCtx.recompute(); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ConsolidationProcessor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ConsolidationProcessor.java index d4473800ca9..ce016b55cc7 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ConsolidationProcessor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ConsolidationProcessor.java @@ -252,7 +252,8 @@ public boolean isAuthoritative() { // That may be a waste of resources if the weak mapping results in no change anyway. // Let's be very very lazy about fetching the account from the resource. if (!projCtx.hasFullShadow() && - (hasActiveWeakMapping(squeezedAttributes, projCtx) || hasActiveWeakMapping(squeezedAssociations, projCtx))) { + (hasActiveWeakMapping(squeezedAttributes, projCtx) || hasActiveWeakMapping(squeezedAssociations, projCtx) + || (hasActiveStrongMapping(squeezedAttributes, projCtx) || hasActiveStrongMapping(squeezedAssociations, projCtx)))) { // Full account was not yet loaded. This will cause problems as // the weak mapping may be applied even though it should not be // applied @@ -260,12 +261,20 @@ public boolean isAuthoritative() { // of all // account's attributes.Therefore load the account now, but with // doNotDiscovery options.. + + // We also need to get account if there are strong mappings. Strong mappings + // should always be applied. So reading the account now will indirectly + // trigger reconciliation which makes sure that the strong mappings are + // applied. // By getting accounts from provisioning, there might be a problem with // resource availability. We need to know, if the account was read full // or we have only the shadow from the repository. If we have only // shadow, the weak mappings may applied even if they should not be. LensUtil.loadFullAccount(context, projCtx, provisioningService, result); + if (projCtx.getSynchronizationPolicyDecision() == SynchronizationPolicyDecision.BROKEN) { + return null; + } } boolean completeAccount = projCtx.hasFullShadow(); @@ -388,10 +397,12 @@ public int compare(PrismContainerValue o1, PrismContainerValue o2) { if (o1 == null && o2 == null){ + LOGGER.trace("Comparing {} and {}: 0 (A)", o1, o2); return 0; } if (o1 == null || o2 == null){ + LOGGER.trace("Comparing {} and {}: 2 (B)", o1, o2); return 1; } @@ -404,9 +415,11 @@ public int compare(PrismContainerValue o1, String oid1 = ref1 != null ? ref1.getOid() : null; String oid2 = ref2 != null ? ref2.getOid() : null; if (ObjectUtils.equals(oid1, oid2)) { + LOGGER.trace("Comparing {} and {}: 0 (C)", o1, o2); return 0; } + LOGGER.trace("Comparing {} and {}: 1 (D)", o1, o2); return 1; } }; @@ -565,6 +578,23 @@ private boolean hasActiveWeakMap } return false; } + + private boolean hasActiveStrongMapping( + Map>> squeezedAttributes, LensProjectionContext accCtx) throws SchemaException { + for (Map.Entry>> entry : squeezedAttributes.entrySet()) { + DeltaSetTriple> ivwoTriple = entry.getValue(); + for (ItemValueWithOrigin ivwo: ivwoTriple.getAllValues()) { + PrismValueDeltaSetTripleProducer mapping = ivwo.getMapping(); + if (mapping.getStrength() == MappingStrengthType.STRONG) { + // Do not optimize for "nothing changed" case here. We want to make + // sure that the values of strong mappings are applied even if nothing + // has changed. + return true; + } + } + } + return false; + } private void consolidateValuesModifyProjection(LensContext context, LensProjectionContext accCtx, OperationResult result) diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/InboundProcessor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/InboundProcessor.java index 8310b1ef1b3..67a54fb7ce7 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/InboundProcessor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/InboundProcessor.java @@ -146,22 +146,22 @@ void processInboundFocal(LensContext context, Task task } try { - for (LensProjectionContext accountContext : context.getProjectionContexts()) { - if (!accountContext.isCanProject()){ + for (LensProjectionContext projectionContext : context.getProjectionContexts()) { + if (!projectionContext.isCanProject()){ LOGGER.trace("Skipping processing of inbound expressions for projection {}: there is a limit to propagate changes only from resource {}", - accountContext.getResourceShadowDiscriminator(), context.getTriggeredResourceOid()); + projectionContext.getResourceShadowDiscriminator(), context.getTriggeredResourceOid()); continue; } - ResourceShadowDiscriminator rat = accountContext.getResourceShadowDiscriminator(); + ResourceShadowDiscriminator rat = projectionContext.getResourceShadowDiscriminator(); - ObjectDelta aPrioriDelta = getAPrioriDelta(context, accountContext); + ObjectDelta aPrioriDelta = getAPrioriDelta(context, projectionContext); - if (!accountContext.isDoReconciliation() && aPrioriDelta == null && !LensUtil.hasDependentContext(context, accountContext) && !accountContext.isFullShadow()) { + if (!projectionContext.isDoReconciliation() && aPrioriDelta == null && !LensUtil.hasDependentContext(context, projectionContext) && !projectionContext.isFullShadow()) { LOGGER.trace("Skipping processing of inbound expressions for projection {}: no reconciliation and no a priori delta and no dependent context", rat); continue; } - RefinedObjectClassDefinition accountDefinition = accountContext.getStructuralObjectClassDefinition(); + RefinedObjectClassDefinition accountDefinition = projectionContext.getStructuralObjectClassDefinition(); if (accountDefinition == null) { LOGGER.error("Definition for account type {} not found in the context, but it " + "should be there, dumping context:\n{}", rat, context.debugDump()); @@ -169,7 +169,7 @@ void processInboundFocal(LensContext context, Task task + " not found in the context, but it should be there"); } - processInboundExpressionsForProjection(context, accountContext, accountDefinition, aPrioriDelta, task, now, result); + processInboundExpressionsForProjection(context, projectionContext, accountDefinition, aPrioriDelta, task, now, result); } } finally { @@ -189,24 +189,24 @@ private boolean isDeleteAccountDelta(LensProjectionContext accountContext) throw } private void processInboundExpressionsForProjection(LensContext context, - LensProjectionContext accContext, + LensProjectionContext projContext, RefinedObjectClassDefinition accountDefinition, ObjectDelta aPrioriDelta, Task task, XMLGregorianCalendar now, OperationResult result) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException, ConfigurationException { - if (aPrioriDelta == null && accContext.getObjectCurrent() == null) { + if (aPrioriDelta == null && projContext.getObjectCurrent() == null) { LOGGER.trace("Nothing to process in inbound, both a priori delta and current account were null."); return; } - PrismObject accountCurrent = accContext.getObjectCurrent(); - PrismObject accountNew = accContext.getObjectNew(); + PrismObject accountCurrent = projContext.getObjectCurrent(); + PrismObject accountNew = projContext.getObjectNew(); for (QName accountAttributeName : accountDefinition.getNamesOfAttributesWithInboundExpressions()) { PropertyDelta accountAttributeDelta = null; if (aPrioriDelta != null) { accountAttributeDelta = aPrioriDelta.findPropertyDelta(new ItemPath(SchemaConstants.C_ATTRIBUTES), accountAttributeName); - if (accountAttributeDelta == null && !accContext.isFullShadow()) { + if (accountAttributeDelta == null && !projContext.isFullShadow()) { LOGGER.trace("Skipping inbound for {} in {}: Not a full shadow and account a priori delta exists, but doesn't have change for processed property.", - accountAttributeName, accContext.getResourceShadowDiscriminator()); + accountAttributeName, projContext.getResourceShadowDiscriminator()); continue; } } @@ -215,14 +215,14 @@ private void processInboundExpressionsForProjection(LensCo if (attrDef.isIgnored(LayerType.MODEL)) { LOGGER.trace("Skipping inbound for attribute {} in {} because the attribute is ignored", new Object[]{ - PrettyPrinter.prettyPrint(accountAttributeName), accContext.getResourceShadowDiscriminator()}); + PrettyPrinter.prettyPrint(accountAttributeName), projContext.getResourceShadowDiscriminator()}); continue; } List inboundMappingTypes = attrDef.getInboundMappingTypes(); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Processing inbound for {} in {}; ({} mappings)", new Object[]{ - PrettyPrinter.prettyPrint(accountAttributeName), accContext.getResourceShadowDiscriminator(), inboundMappingTypes.size()}); + PrettyPrinter.prettyPrint(accountAttributeName), projContext.getResourceShadowDiscriminator(), inboundMappingTypes.size()}); } if (!inboundMappingTypes.isEmpty()) { @@ -233,7 +233,7 @@ private void processInboundExpressionsForProjection(LensCo if (access != null) { if (access.isRead() == null || !access.isRead()) { LOGGER.warn("Inbound mapping for non-readable attribute {} in {}, skipping", - accountAttributeName, accContext.getHumanReadableName()); + accountAttributeName, projContext.getHumanReadableName()); continue; } } @@ -263,22 +263,25 @@ private void processInboundExpressionsForProjection(LensCo if (aPrioriDelta != null && accountAttributeDelta != null) { LOGGER.trace("Processing inbound from a priori delta."); userPropertyDelta = evaluateInboundMapping(context, inboundMappingType, accountAttributeName, null, accountAttributeDelta, - focus, accountNew, accContext.getResource(), task, result); + focus, accountNew, projContext.getResource(), task, result); } else if (accountCurrent != null) { - if (!accContext.isFullShadow()) { - LOGGER.warn("Attempted to execute inbound expression on account shadow {} WITHOUT full account. Trying to load the account now.", accContext.getOid()); // todo change to trace level eventually + if (!projContext.isFullShadow()) { + LOGGER.warn("Attempted to execute inbound expression on account shadow {} WITHOUT full account. Trying to load the account now.", projContext.getOid()); // todo change to trace level eventually try { - LensUtil.loadFullAccount(context, accContext, provisioningService, result); - accountCurrent = accContext.getObjectCurrent(); + LensUtil.loadFullAccount(context, projContext, provisioningService, result); + if (projContext.getSynchronizationPolicyDecision() == SynchronizationPolicyDecision.BROKEN) { + return; + } + accountCurrent = projContext.getObjectCurrent(); } catch (ObjectNotFoundException|SecurityViolationException|CommunicationException|ConfigurationException e) { - LOGGER.warn("Couldn't load account with shadow OID {} because of {}, setting context as broken and skipping inbound processing on it", accContext.getOid(), e.getMessage()); - accContext.setSynchronizationPolicyDecision(SynchronizationPolicyDecision.BROKEN); + LOGGER.warn("Couldn't load account with shadow OID {} because of {}, setting context as broken and skipping inbound processing on it", projContext.getOid(), e.getMessage()); + projContext.setSynchronizationPolicyDecision(SynchronizationPolicyDecision.BROKEN); return; } - if (!accContext.isFullShadow()) { - if (accContext.getResourceShadowDiscriminator().getOrder() > 0) { + if (!projContext.isFullShadow()) { + if (projContext.getResourceShadowDiscriminator().getOrder() > 0) { // higher-order context. It is OK not to load this - LOGGER.trace("Skipped load of higher-order account with shadow OID {} skipping inbound processing on it", accContext.getOid()); + LOGGER.trace("Skipped load of higher-order account with shadow OID {} skipping inbound processing on it", projContext.getOid()); return; } // TODO: is it good to mark as broken? what is @@ -286,15 +289,15 @@ private void processInboundExpressionsForProjection(LensCo // assignment and the account was added directly // it can cause that the account will be // unlinked from the user FIXME - LOGGER.warn("Couldn't load account with shadow OID {}, setting context as broken and skipping inbound processing on it", accContext.getOid()); - accContext.setSynchronizationPolicyDecision(SynchronizationPolicyDecision.BROKEN); + LOGGER.warn("Couldn't load account with shadow OID {}, setting context as broken and skipping inbound processing on it", projContext.getOid()); + projContext.setSynchronizationPolicyDecision(SynchronizationPolicyDecision.BROKEN); return; } } LOGGER.trace("Processing inbound from account sync absolute state (currentAccount)."); PrismProperty oldAccountProperty = accountCurrent.findProperty(new ItemPath(ShadowType.F_ATTRIBUTES, accountAttributeName)); userPropertyDelta = evaluateInboundMapping(context, inboundMappingType, accountAttributeName, oldAccountProperty, null, - focus, accountNew, accContext.getResource(), task, result); + focus, accountNew, projContext.getResource(), task, result); } if (userPropertyDelta != null && !userPropertyDelta.isEmpty()) { @@ -308,19 +311,19 @@ private void processInboundExpressionsForProjection(LensCo } } - if (isDeleteAccountDelta(accContext)){ + if (isDeleteAccountDelta(projContext)){ // we don't need to do inbound if account was deleted return; } processSpecialPropertyInbound(accountDefinition.getCredentialsInbound(), SchemaConstants.PATH_PASSWORD_VALUE, - context.getFocusContext().getObjectNew(), accContext, accountDefinition, context, task, now, result); + context.getFocusContext().getObjectNew(), projContext, accountDefinition, context, task, now, result); processSpecialPropertyInbound(accountDefinition.getActivationBidirectionalMappingType(ActivationType.F_ADMINISTRATIVE_STATUS), SchemaConstants.PATH_ACTIVATION_ADMINISTRATIVE_STATUS, - context.getFocusContext().getObjectNew(), accContext, accountDefinition, context, task, now, result); + context.getFocusContext().getObjectNew(), projContext, accountDefinition, context, task, now, result); processSpecialPropertyInbound(accountDefinition.getActivationBidirectionalMappingType(ActivationType.F_VALID_FROM), SchemaConstants.PATH_ACTIVATION_VALID_FROM, - context.getFocusContext().getObjectNew(), accContext, accountDefinition, context, task, now, result); + context.getFocusContext().getObjectNew(), projContext, accountDefinition, context, task, now, result); processSpecialPropertyInbound(accountDefinition.getActivationBidirectionalMappingType(ActivationType.F_VALID_TO), SchemaConstants.PATH_ACTIVATION_VALID_TO, - context.getFocusContext().getObjectNew(), accContext, accountDefinition, context, task, now, result); + context.getFocusContext().getObjectNew(), projContext, accountDefinition, context, task, now, result); } /** diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ProjectionValuesProcessor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ProjectionValuesProcessor.java index b5999d4e50e..51caee469cb 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ProjectionValuesProcessor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ProjectionValuesProcessor.java @@ -162,6 +162,9 @@ private void processProjections(LensContext context, if (policyDecision != null && policyDecision == SynchronizationPolicyDecision.UNLINK) { // We will not update accounts that are being unlinked. // we cannot skip deleted accounts here as the delete delta will be skipped as well + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Skipping processing of value for {} because the decision is {}", projContext.getHumanReadableName(), policyDecision); + } return; } @@ -169,6 +172,9 @@ private void processProjections(LensContext context, if (!projContext.hasFullShadow() && hasIterationExpression(projContext)) { LensUtil.loadFullAccount(context, projContext, provisioningService, result); + if (projContext.getSynchronizationPolicyDecision() == SynchronizationPolicyDecision.BROKEN) { + return; + } } int maxIterations = determineMaxIterations(projContext); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ReconciliationProcessor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ReconciliationProcessor.java index b471e1f50f5..824b27a277a 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ReconciliationProcessor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ReconciliationProcessor.java @@ -132,12 +132,18 @@ void processReconciliationFocus(LensContext context, // reconciliation is cheap if the shadow is already fetched // therefore just do it if (!projCtx.isDoReconciliation() && !projCtx.isFullShadow()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Skipping reconciliation of {}: no doReconciliation and no full shadow", projCtx.getHumanReadableName()); + } return; } SynchronizationPolicyDecision policyDecision = projCtx.getSynchronizationPolicyDecision(); if (policyDecision != null && (policyDecision == SynchronizationPolicyDecision.DELETE || policyDecision == SynchronizationPolicyDecision.UNLINK)) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Skipping reconciliation of {}: decision={}", projCtx.getHumanReadableName(), policyDecision); + } return; } @@ -157,6 +163,10 @@ void processReconciliationFocus(LensContext context, projCtx.recompute(); } + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Starting reconciliation of {}", projCtx.getHumanReadableName()); + } RefinedObjectClassDefinition rOcDef = projCtx.getStructuralObjectClassDefinition(); @@ -207,8 +217,8 @@ private void reconcileProjectionAttributes( + projCtx.getResourceShadowDiscriminator()); } - DeltaSetTriple,PrismPropertyDefinition>> pvwoTriple = squeezedAttributes - .get(attrName); + DeltaSetTriple,PrismPropertyDefinition>> pvwoTriple = + squeezedAttributes.get(attrName); if (attributeDefinition.isIgnored(LayerType.MODEL)) { LOGGER.trace("Skipping reconciliation of attribute {} because it is ignored", attrName); @@ -292,15 +302,16 @@ private void reconcileProjectionAttributes( if (shouldBeMapping == null) { continue; } + Object shouldBeRealValue = shouldBePvwo.getItemValue().getValue(); if (shouldBeMapping.getStrength() != MappingStrengthType.STRONG && (!arePValues.isEmpty() || hasStrongShouldBePValue)) { // weak or normal value and the attribute already has a // value. Skip it. // we cannot override it as it might have been legally // changed directly on the projection resource object + LOGGER.trace("Skipping reconciliation of value {} of the attribute {}: the mapping is not strong" , shouldBeRealValue, attributeDefinition.getName().getLocalPart()); continue; } - Object shouldBeRealValue = shouldBePvwo.getItemValue().getValue(); if (!isInValues(valueMatcher, shouldBeRealValue, arePValues)) { if (attributeDefinition.isSingleValue()) { if (hasValue) { @@ -308,9 +319,11 @@ private void reconcileProjectionAttributes( "Attempt to set more than one value for single-valued attribute " + attrName + " in " + projCtx.getResourceShadowDiscriminator()); } + LOGGER.trace("Reconciliation: REPLACING value {} of the attribute {}" , shouldBeRealValue, attributeDefinition.getName().getLocalPart()); recordDelta(valueMatcher, projCtx, attributeDefinition, ModificationType.REPLACE, shouldBeRealValue, shouldBePvwo.getConstruction().getSource()); } else { + LOGGER.trace("Reconciliation: ADDING value {} of the attribute {}" , shouldBeRealValue, attributeDefinition.getName().getLocalPart()); recordDelta(valueMatcher, projCtx, attributeDefinition, ModificationType.ADD, shouldBeRealValue, shouldBePvwo.getConstruction().getSource()); } @@ -522,7 +535,7 @@ private void checkType(Object o) { } } - private void decideIfTolerate(LensProjectionContext accCtx, + private void decideIfTolerate(LensProjectionContext projCtx, RefinedAttributeDefinition attributeDefinition, Collection> arePValues, Collection,PrismPropertyDefinition>> shouldBePValues, @@ -530,13 +543,13 @@ private void decideIfTolerate(LensProjectionContext accCtx, for (PrismPropertyValue isPValue : arePValues){ if (matchPattern(attributeDefinition.getTolerantValuePattern(), isPValue, valueMatcher)){ - LOGGER.trace("Value {} of the attribute {} match with tolerant value pattern. Value will be NOT DELETED." , new Object[]{isPValue, attributeDefinition}); + LOGGER.trace("Reconciliation: KEEPING value {} of the attribute {}: match with tolerant value pattern." , isPValue, attributeDefinition.getName().getLocalPart()); continue; } if (matchPattern(attributeDefinition.getIntolerantValuePattern(), isPValue, valueMatcher)){ - LOGGER.trace("Value {} of the attribute {} match with intolerant value pattern. Value will be DELETED." , new Object[]{isPValue, attributeDefinition}); - recordDelta(valueMatcher, accCtx, attributeDefinition, ModificationType.DELETE, + LOGGER.trace("Reconciliation: DELETING value {} of the attribute {}: match with intolerant value pattern." , isPValue, attributeDefinition.getName().getLocalPart()); + recordDelta(valueMatcher, projCtx, attributeDefinition, ModificationType.DELETE, isPValue.getValue(), null); continue; } @@ -544,7 +557,8 @@ private void decideIfTolerate(LensProjectionContext accCtx, if (!attributeDefinition.isTolerant()) { if (!isInPvwoValues(valueMatcher, isPValue.getValue(), shouldBePValues)) { - recordDelta(valueMatcher, accCtx, attributeDefinition, ModificationType.DELETE, + LOGGER.trace("Reconciliation: DELETING value {} of the attribute {}" , isPValue, attributeDefinition.getName().getLocalPart()); + recordDelta(valueMatcher, projCtx, attributeDefinition, ModificationType.DELETE, isPValue.getValue(), null); } } diff --git a/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestReconScript.java b/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestReconScript.java index 9ebee1cfa76..3b54b3a3a38 100644 --- a/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestReconScript.java +++ b/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestReconScript.java @@ -106,7 +106,7 @@ public void test002testReconcileScriptsWhenReconciling() throws Exception{ waitForTaskStart(TASK_RECON_DUMMY_OID, false, DEFAULT_TASK_WAIT_TIMEOUT); - waitForTaskNextRun(TASK_RECON_DUMMY_OID, false, DEFAULT_TASK_WAIT_TIMEOUT); + waitForTaskNextRunAssertSuccess(TASK_RECON_DUMMY_OID, false, DEFAULT_TASK_WAIT_TIMEOUT); waitForTaskFinish(TASK_RECON_DUMMY_OID, false); @@ -148,7 +148,7 @@ public void test003testReconcileScriptsAddUserAction() throws Exception{ // waitForTaskStart(TASK_RECON_DUMMY_OID, false, DEFAULT_TASK_WAIT_TIMEOUT); // - waitForTaskNextRun(TASK_RECON_DUMMY_OID, false, DEFAULT_TASK_WAIT_TIMEOUT); + waitForTaskNextRunAssertSuccess(TASK_RECON_DUMMY_OID, false, DEFAULT_TASK_WAIT_TIMEOUT); waitForTaskFinish(TASK_RECON_DUMMY_OID, true); @@ -206,7 +206,7 @@ public void test005TestDryRunDelete() throws Exception{ waitForTaskStart(TASK_RECON_DUMMY_OID, false); - waitForTaskNextRun(TASK_RECON_DUMMY_OID, false); + waitForTaskNextRunAssertSuccess(TASK_RECON_DUMMY_OID, false); waitForTaskFinish(TASK_RECON_DUMMY_OID, false); @@ -239,7 +239,7 @@ public void test005TestReconDelete() throws Exception{ waitForTaskStart(TASK_RECON_DUMMY_OID, false); - waitForTaskNextRun(TASK_RECON_DUMMY_OID, false); + waitForTaskNextRunAssertSuccess(TASK_RECON_DUMMY_OID, false); waitForTaskFinish(TASK_RECON_DUMMY_OID, false); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java index 832e4015a03..9fbe2148f5e 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java @@ -157,6 +157,7 @@ public class AbstractConfiguredModelIntegrationTest extends AbstractModelIntegra protected static final String RESOURCE_DUMMY_UPCASE_OID = "10000000-0000-0000-0000-000000001204"; protected static final String RESOURCE_DUMMY_UPCASE_NAME = "upcase"; protected static final String RESOURCE_DUMMY_UPCASE_NAMESPACE = MidPointConstants.NS_RI; + protected static final QName RESOURCE_DUMMY_UPCASE_ASSOCIATION_GROUP_QNAME = new QName(RESOURCE_DUMMY_UPCASE_NAMESPACE, "group"); protected static final String RESOURCE_DUMMY_FAKE_FILENAME = COMMON_DIR + "/resource-dummy-fake.xml"; protected static final String RESOURCE_DUMMY_FAKE_OID = "10000000-0000-0000-0000-00000000000f"; @@ -295,7 +296,7 @@ public class AbstractConfiguredModelIntegrationTest extends AbstractModelIntegra public static final String GROUP_DUMMY_TESTERS_DESCRIPTION = "To boldly go where no pirate has gone before"; public static final File GROUP_SHADOW_JOKER_DUMMY_UPCASE_FILE = new File(COMMON_DIR, "group-shadow-dummy-upcase-joker.xml"); - public static final String GROUP_SHADOW_JOKER_DUMMY_UPCASE_OID = "c0c010c0-d34d-b33f-f00d-22220004000e"; + public static final String GROUP_SHADOW_JOKER_DUMMY_UPCASE_OID = "bc2a1d98-9ca4-11e4-a600-001e8c717e5b"; public static final String GROUP_SHADOW_JOKER_DUMMY_UPCASE_NAME = "joker"; public static final String GROUP_JOKER_DUMMY_UPCASE_NAME = "JOKER"; diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestCaseIgnore.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestCaseIgnore.java index e3b866da020..1520b59566d 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestCaseIgnore.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestCaseIgnore.java @@ -216,8 +216,8 @@ public void test131ModifyUserJackAssignAccount() throws Exception { } @Test - public void test133SeachShadows() throws Exception { - final String TEST_NAME="test133SeachShadows"; + public void test133SeachAccountShadows() throws Exception { + final String TEST_NAME="test133SeachAccountShadows"; TestUtil.displayTestTile(this, TEST_NAME); // GIVEN @@ -265,6 +265,8 @@ public void test133SeachShadows() throws Exception { assertSteadyResources(); } + // TODO: searchGroupShadows + @Test public void test139ModifyUserJackUnassignAccount() throws Exception { final String TEST_NAME = "test139ModifyUserJackUnassignAccount"; @@ -495,21 +497,24 @@ public void test161JackAssignRoleJoker() throws Exception { // Check shadow rememberShadowFetchOperationCount(); - PrismObject accountShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result); - display("Repo shadow", accountShadow); + PrismObject accountRepoShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result); + display("Repo shadow", accountRepoShadow); assertShadowFetchOperationCountIncrement(0); - assertAccountShadowRepo(accountShadow, accountOid, "jack", resourceDummyUpcaseType); + assertAccountShadowRepo(accountRepoShadow, accountOid, "jack", resourceDummyUpcaseType); // Check account rememberShadowFetchOperationCount(); - PrismObject accountModel = modelService.getObject(ShadowType.class, accountOid, null, task, result); - display("Model shadow", accountModel); + PrismObject accountModelShadow = modelService.getObject(ShadowType.class, accountOid, null, task, result); + display("Model shadow", accountModelShadow); assertShadowFetchOperationCountIncrement(1); - assertAccountShadowModel(accountModel, accountOid, "jack", resourceDummyUpcaseType, uidMatchingRule); + assertAccountShadowModel(accountModelShadow, accountOid, "jack", resourceDummyUpcaseType, uidMatchingRule); assertDummyAccount(RESOURCE_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDummyAccountAttribute(RESOURCE_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME, "title", "JoKeR"); assertDummyGroupMember(RESOURCE_DUMMY_UPCASE_NAME, GROUP_JOKER_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME); + + IntegrationTestTools.assertAssociation(accountModelShadow, RESOURCE_DUMMY_UPCASE_ASSOCIATION_GROUP_QNAME, + GROUP_SHADOW_JOKER_DUMMY_UPCASE_OID); } @Test diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java index 5d9c05e7b38..5b5bb707917 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java @@ -172,7 +172,7 @@ public void test132ModifyUserJackAssignAccountTest() throws Exception { result.computeStatus(); TestUtil.assertSuccess("executeChanges result", result); XMLGregorianCalendar endTime = clock.currentTimeXMLGregorianCalendar(); - assertShadowFetchOperationCountIncrement(0); + assertShadowFetchOperationCountIncrement(1); PrismObject userJack = getUser(USER_JACK_OID); display("User after change execution", userJack); @@ -238,7 +238,7 @@ public void test135ModifyUserJackFullName() throws Exception { TestUtil.displayThen(TEST_NAME); result.computeStatus(); TestUtil.assertSuccess("executeChanges result", result); - assertShadowFetchOperationCountIncrement(0); + assertShadowFetchOperationCountIncrement(2); PrismObject userJack = getUser(USER_JACK_OID); display("User after change execution", userJack); @@ -309,7 +309,7 @@ public void test147ModifyUserJackUnAssignAccountDefault() throws Exception { result.computeStatus(); TestUtil.assertSuccess("executeChanges result", result); XMLGregorianCalendar endTime = clock.currentTimeXMLGregorianCalendar(); - assertShadowFetchOperationCountIncrement(0); + assertShadowFetchOperationCountIncrement(1); PrismObject userJack = getUser(USER_JACK_OID); display("User after change execution", userJack); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIteration.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIteration.java index 48b8ee2bcae..820697dbb3b 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIteration.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIteration.java @@ -436,9 +436,10 @@ public void test210GuybrushAssignAccountDummyPink() throws Exception { dummyAuditService.assertRecords(2); dummyAuditService.assertSimpleRecordSanity(); dummyAuditService.assertAnyRequestDeltas(); - dummyAuditService.assertExecutionDeltas(3); + dummyAuditService.assertExecutionDeltas(4); dummyAuditService.assertHasDelta(ChangeType.MODIFY, UserType.class); dummyAuditService.assertHasDelta(ChangeType.ADD, ShadowType.class); + dummyAuditService.assertHasDelta(ChangeType.MODIFY, ShadowType.class); dummyAuditService.assertExecutionSuccess(); } @@ -1609,7 +1610,7 @@ public void test530GuybrushAssignAccountDummyMagenta() throws Exception { // Check audit display("Audit", dummyAuditService); - dummyAuditService.assertRecords(3); + dummyAuditService.assertRecords(2); dummyAuditService.assertSimpleRecordSanity(); dummyAuditService.assertAnyRequestDeltas(); dummyAuditService.assertExecutionDeltas(3); @@ -1784,7 +1785,7 @@ public void test710DarkVioletAddLeChuck() throws Exception { display("Adding dummy account", account.debugDump()); dummyResourceDarkViolet.addAccount(account); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1814,7 +1815,7 @@ public void test712DarkVioletAddCharles() throws Exception { display("Adding dummy account", account.debugDump()); dummyResourceDarkViolet.addAccount(account); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1846,7 +1847,7 @@ public void test714DarkVioletAddShinetop() throws Exception { display("Adding dummy account", account.debugDump()); dummyResourceDarkViolet.addAccount(account); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1870,7 +1871,7 @@ public void test716DarkVioletDeleteCharles() throws Exception { dummyResourceDarkViolet.deleteAccountByName(ACCOUNT_CHARLES_USERNAME); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1896,7 +1897,7 @@ public void test720DarkVioletModifyShinetopLocation() throws Exception { account.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "Monkey Island"); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1923,7 +1924,7 @@ public void test722DarkVioletModifyShinetopFullName() throws Exception { account.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, CHUCKIE_FULLNAME); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1958,7 +1959,7 @@ public void test730DarkVioletAddBarbossa() throws Exception { display("Adding dummy account", account.debugDump()); dummyResourceDarkViolet.addAccount(account); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1989,7 +1990,7 @@ public void test750DarkVioletAddMatusalem() throws Exception { display("Adding dummy account", account.debugDump()); dummyResourceDarkViolet.addAccount(account); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -2019,7 +2020,7 @@ public void test752DarkVioletAddDiplomatico() throws Exception { display("Adding dummy account", account.debugDump()); dummyResourceDarkViolet.addAccount(account); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -2055,7 +2056,7 @@ public void test754DarkVioletAddMilionario() throws Exception { display("Adding dummy account", account.debugDump()); dummyResourceDarkViolet.addAccount(account); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -2081,7 +2082,7 @@ public void test756DarkVioletDeleteDiplomatico() throws Exception { dummyResourceDarkViolet.deleteAccountByName(ACCOUNT_DIPLOMATICO_USERNAME); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -2107,7 +2108,7 @@ public void test760DarkVioletModifyMillonarioLocation() throws Exception { account.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "Northern Peru"); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -2137,7 +2138,7 @@ public void test762DarkVioletModifyMillonarioFullName() throws Exception { account.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, RON_FULLNAME); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -2168,7 +2169,7 @@ public void test764DarkVioletModifyMatusalemFullName() throws Exception { account.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, RON_FULLNAME); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_DARK_VIOLET_OID, true); // THEN TestUtil.displayThen(TEST_NAME); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestMapping.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestMapping.java index d49e7ca346f..74085c43197 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestMapping.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestMapping.java @@ -694,13 +694,52 @@ public void test126ModifyAccountShipDelete() throws Exception { dummyAuditService.assertExecutionOutcome(OperationResultStatus.FATAL_ERROR); } + /** + * Organization is used in the expression for "ship" attribute. But it is not specified as a source. + * Nevertheless the mapping is strong, therefore the result should be applied anyway. + * Reconciliation should be triggered. + */ + @Test + public void test128ModifyUserOrganization() throws Exception { + final String TEST_NAME = "test128ModifyUserOrganization"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = taskManager.createTaskInstance(TestMapping.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + dummyAuditService.clear(); + + // WHEN + modifyUserReplace(USER_JACK_OID, UserType.F_ORGANIZATION, task, result, + PrismTestUtil.createPolyString("Brethren of the Coast")); + + // THEN + result.computeStatus(); + TestUtil.assertSuccess(result); + + PrismObject userJack = getUser(USER_JACK_OID); + display("User after change execution", userJack); + assertUserJack(userJack, "Captain Jack Sparrow", "Jack", "Sparrow"); + + assertAccountShip(userJack, "Captain Jack Sparrow", "Brethren of the Coast / Black Pearl", dummyResourceCtlRed, task); + + // Check audit + display("Audit", dummyAuditService); + dummyAuditService.assertSimpleRecordSanity(); + dummyAuditService.assertRecords(2); + dummyAuditService.assertAnyRequestDeltas(); + dummyAuditService.assertExecutionDeltas(2); + dummyAuditService.assertHasDelta(ChangeType.MODIFY, UserType.class); + dummyAuditService.assertHasDelta(ChangeType.MODIFY, ShadowType.class); + dummyAuditService.assertExecutionSuccess(); + } /** * Note: red resource disables account on unsassign, does NOT delete it */ @Test - public void test128ModifyUserUnassignAccountRed() throws Exception { - final String TEST_NAME = "test128ModifyUserUnassignAccountRed"; + public void test138ModifyUserUnassignAccountRed() throws Exception { + final String TEST_NAME = "test138ModifyUserUnassignAccountRed"; TestUtil.displayTestTile(this, TEST_NAME); // GIVEN @@ -738,7 +777,7 @@ public void test128ModifyUserUnassignAccountRed() throws Exception { XMLGregorianCalendar disableTimestamp = accountRed.asObjectable().getActivation().getDisableTimestamp(); TestUtil.assertBetween("Wrong disableTimestamp", start, end, disableTimestamp); - assertAccountShip(userJack, "Captain Jack Sparrow", "Black Pearl", false, dummyResourceCtlRed, task); + assertAccountShip(userJack, "Captain Jack Sparrow", "Brethren of the Coast / Black Pearl", false, dummyResourceCtlRed, task); // Check if dummy resource account is gone assertNoDummyAccount("jack"); @@ -759,8 +798,8 @@ public void test128ModifyUserUnassignAccountRed() throws Exception { * So let's delete the account explicitly to make room for the following tests */ @Test - public void test129DeleteAccountRed() throws Exception { - final String TEST_NAME = "test129DeleteAccountRed"; + public void test139DeleteAccountRed() throws Exception { + final String TEST_NAME = "test139DeleteAccountRed"; TestUtil.displayTestTile(this, TEST_NAME); // GIVEN diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestMappingInbound.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestMappingInbound.java index e0d62fca007..78f862f16c8 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestMappingInbound.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestMappingInbound.java @@ -261,7 +261,7 @@ protected void waitForSyncTaskStart() throws Exception { } protected void waitForSyncTaskNextRun() throws Exception { - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_TEA_GREEN_OID, false, 10000); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_TEA_GREEN_OID, false, 10000); } private void assertAccount(PrismObject userJack, String name, String expectedFullName, String shipAttributeName, String expectedShip, diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelServiceContract.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelServiceContract.java index 65776f85a85..e272eadb04a 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelServiceContract.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelServiceContract.java @@ -833,8 +833,8 @@ public void test121ModifyUserAddAccountRef() throws Exception { result.computeStatus(); TestUtil.assertSuccess("executeChanges result", result); - // Fetching just the repo shadow, not full account. No recon, so no problem. - assertShadowFetchOperationCountIncrement(0); + // There is strong mapping. Complete account is fetched. + assertShadowFetchOperationCountIncrement(1); PrismObject userJack = getUser(USER_JACK_OID); assertUserJack(userJack); @@ -866,7 +866,7 @@ public void test121ModifyUserAddAccountRef() throws Exception { notificationManager.setDisabled(true); checkDummyTransportMessages("accountPasswordNotifier", 0); checkDummyTransportMessages("userPasswordNotifier", 0); - checkDummyTransportMessages("simpleAccountNotifier-SUCCESS", 0); + checkDummyTransportMessages("simpleAccountNotifier-SUCCESS", 1); checkDummyTransportMessages("simpleAccountNotifier-FAILURE", 0); checkDummyTransportMessages("simpleAccountNotifier-ADD-SUCCESS", 0); checkDummyTransportMessages("simpleUserNotifier", 0); @@ -1123,10 +1123,11 @@ public void test131ModifyUserJackAssignAccount() throws Exception { */ @Test public void test132ModifyAccountJackDummy() throws Exception { - TestUtil.displayTestTile(this, "test132ModifyAccountJackDummy"); + final String TEST_NAME = "test132ModifyAccountJackDummy"; + TestUtil.displayTestTile(this, TEST_NAME); // GIVEN - Task task = taskManager.createTaskInstance(TestModelServiceContract.class.getName() + ".test132ModifyAccountJackDummy"); + Task task = taskManager.createTaskInstance(TestModelServiceContract.class.getName() + "." + TEST_NAME); OperationResult result = task.getResult(); preTestCleanup(AssignmentPolicyEnforcementType.FULL); @@ -1144,7 +1145,8 @@ public void test132ModifyAccountJackDummy() throws Exception { // THEN result.computeStatus(); TestUtil.assertSuccess("executeChanges result", result); - assertShadowFetchOperationCountIncrement(0); + // There is strong mapping. Complete account is fetched. + assertShadowFetchOperationCountIncrement(1); PrismObject userJack = getUser(USER_JACK_OID); display("User after change execution", userJack); @@ -1382,7 +1384,8 @@ public void test148ModifyUserJackUnassignAccountPositiveEnforcement() throws Exc TestUtil.displayThen(TEST_NAME); result.computeStatus(); TestUtil.assertSuccess("executeChanges result", result); - assertShadowFetchOperationCountIncrement(0); + // There is strong mapping. Complete account is fetched. + assertShadowFetchOperationCountIncrement(1); PrismObject userJack = getUser(USER_JACK_OID); display("User after change execution", userJack); @@ -1814,7 +1817,8 @@ public void test164ModifyUserJackUnassignAccountNoneEnforcement() throws Excepti // THEN result.computeStatus(); TestUtil.assertSuccess("executeChanges result", result); - assertShadowFetchOperationCountIncrement(0); + // Strong mappings + assertShadowFetchOperationCountIncrement(1); PrismObject userJack = getUser(USER_JACK_OID); display("User after change execution", userJack); @@ -2330,7 +2334,8 @@ public void test195ModifyUserJack() throws Exception { // THEN result.computeStatus(); TestUtil.assertSuccess("executeChanges result", result); - assertShadowFetchOperationCountIncrement(0); + // Strong mappings + assertShadowFetchOperationCountIncrement(1); PrismObject userJack = getUser(USER_JACK_OID); display("User after change execution", userJack); @@ -2399,7 +2404,8 @@ public void test196ModifyUserJackLocationEmpty() throws Exception { // THEN result.computeStatus(); TestUtil.assertSuccess("executeChanges result", result); - assertShadowFetchOperationCountIncrement(0); + // Strong mappings + assertShadowFetchOperationCountIncrement(1); PrismObject userJack = getUser(USER_JACK_OID); display("User after change execution", userJack); @@ -2775,7 +2781,8 @@ public void test212RenameUserMorgan() throws Exception { // THEN result.computeStatus(); TestUtil.assertSuccess("executeChanges result", result); - assertShadowFetchOperationCountIncrement(0); + // Strong mappings + assertShadowFetchOperationCountIncrement(1); PrismObject userMorgan = modelService.getObject(UserType.class, USER_MORGAN_OID, null, task, result); UserType userMorganType = userMorgan.asObjectable(); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestPreviewChanges.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestPreviewChanges.java index 9cdd83d7e49..ae168c24066 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestPreviewChanges.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestPreviewChanges.java @@ -584,7 +584,11 @@ public void test221ModifyUserAddAccountRef() throws Exception { assertNull("Unexpected account primary delta", accountPrimaryDelta); ObjectDelta accountSecondaryDelta = accContext.getSecondaryDelta(); - assertNull("Unexpected account secondary delta", accountSecondaryDelta); + assertEquals("Unexpected size of account secondary delta: "+accountSecondaryDelta, 2, accountSecondaryDelta.getModifications().size()); + PrismAsserts.assertPropertyAdd(accountSecondaryDelta, + dummyResourceCtl.getAttributePath(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME), "rum"); + PrismAsserts.assertPropertyAdd(accountSecondaryDelta, + dummyResourceCtl.getAttributePath(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_QUOTE_NAME), "Arr!"); } // MAPPING TESTS @@ -646,7 +650,11 @@ public void test300ModifyElaineAccountDummyReplace() throws Exception { "Elaine Threepwood"); ObjectDelta accountSecondaryDelta = accContext.getSecondaryDelta(); - assertNull("Unexpected account secondary delta", accountSecondaryDelta); + assertEquals("Unexpected size of account secondary delta: "+accountSecondaryDelta, 2, accountSecondaryDelta.getModifications().size()); + PrismAsserts.assertPropertyAdd(accountSecondaryDelta, + dummyResourceCtl.getAttributePath(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME), "rum"); + PrismAsserts.assertPropertyAdd(accountSecondaryDelta, + dummyResourceCtl.getAttributePath(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_QUOTE_NAME), "Arr!"); } /** @@ -705,7 +713,11 @@ public void test301ModifyElaineAccountDummyDeleteAdd() throws Exception { getAttributePath(resourceDummy, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME), "Elaine Marley"); ObjectDelta accountSecondaryDelta = accContext.getSecondaryDelta(); - assertNull("Unexpected account secondary delta", accountSecondaryDelta); + assertEquals("Unexpected size of account secondary delta: "+accountSecondaryDelta, 2, accountSecondaryDelta.getModifications().size()); + PrismAsserts.assertPropertyAdd(accountSecondaryDelta, + dummyResourceCtl.getAttributePath(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME), "rum"); + PrismAsserts.assertPropertyAdd(accountSecondaryDelta, + dummyResourceCtl.getAttributePath(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_QUOTE_NAME), "Arr!"); } /** @@ -955,10 +967,14 @@ public void test600ModifyElaineUserDummyReplace() throws Exception { ObjectDelta accountSecondaryDelta = accContext.getSecondaryDelta(); assertNotNull("No account secondary delta (default)", accountSecondaryDelta); - PrismAsserts.assertModifications(accountSecondaryDelta, 1); + PrismAsserts.assertModifications(accountSecondaryDelta, 3); PrismAsserts.assertPropertyReplace(accountSecondaryDelta, getAttributePath(resourceDummy, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME), "Elaine Threepwood"); + PrismAsserts.assertPropertyAdd(accountSecondaryDelta, + dummyResourceCtl.getAttributePath(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME), "rum"); + PrismAsserts.assertPropertyAdd(accountSecondaryDelta, + dummyResourceCtl.getAttributePath(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_QUOTE_NAME), "Arr!"); // RED dummy resource: strong mappings accContext = modelContext.findProjectionContext( @@ -971,10 +987,13 @@ public void test600ModifyElaineUserDummyReplace() throws Exception { accountSecondaryDelta = accContext.getSecondaryDelta(); assertNotNull("No account secondary delta (red)", accountSecondaryDelta); - PrismAsserts.assertModifications(accountSecondaryDelta, 1); + PrismAsserts.assertModifications(accountSecondaryDelta, 2); PrismAsserts.assertPropertyReplace(accountSecondaryDelta, getAttributePath(resourceDummyRed, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME), "Elaine Threepwood"); + PrismAsserts.assertPropertyAdd(accountSecondaryDelta, + getAttributePath(resourceDummyRed, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_QUOTE_NAME), + "null -- red resource"); // BLUE dummy resource: weak mappings accContext = modelContext.findProjectionContext( @@ -1060,8 +1079,12 @@ public void test610ModifyElaineUserAccountDummyReplace() throws Exception { "Elaine LeChuck"); ObjectDelta accountSecondaryDelta = accContext.getSecondaryDelta(); - assertNull("Unexpected account secondary delta (default)", accountSecondaryDelta); - + assertEquals("Unexpected size of account secondary delta (default): "+accountSecondaryDelta, 2, accountSecondaryDelta.getModifications().size()); + PrismAsserts.assertPropertyAdd(accountSecondaryDelta, + dummyResourceCtl.getAttributePath(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME), "rum"); + PrismAsserts.assertPropertyAdd(accountSecondaryDelta, + dummyResourceCtl.getAttributePath(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_QUOTE_NAME), "Arr!"); + // RED dummy resource: strong mappings accContext = modelContext.findProjectionContext( new ResourceShadowDiscriminator(RESOURCE_DUMMY_RED_OID, ShadowKindType.ACCOUNT, null)); @@ -1072,10 +1095,13 @@ public void test610ModifyElaineUserAccountDummyReplace() throws Exception { assertNull("Unexpected account primary delta (red)", accountPrimaryDelta); accountSecondaryDelta = accContext.getSecondaryDelta(); assertNotNull("No account secondary delta (red)", accountSecondaryDelta); - PrismAsserts.assertModifications(accountSecondaryDelta, 1); + PrismAsserts.assertModifications(accountSecondaryDelta, 2); PrismAsserts.assertPropertyReplace(accountSecondaryDelta, getAttributePath(resourceDummyRed, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME), "Elaine Threepwood"); + PrismAsserts.assertPropertyAdd(accountSecondaryDelta, + getAttributePath(resourceDummyRed, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_QUOTE_NAME), + "null -- red resource"); // BLUE dummy resource: weak mappings accContext = modelContext.findProjectionContext( @@ -1330,12 +1356,18 @@ public void test700DisableElaineAccountTwoResources() throws Exception { PrismAsserts.assertPropertyReplace(accountPrimaryDelta, ACTIVATION_ADMINISTRATIVE_STATUS_PATH, ActivationStatusType.DISABLED); ObjectDelta accountSecondaryDelta = accContextDefault.getSecondaryDelta(); - PrismAsserts.assertModifications(accountSecondaryDelta, 2); + PrismAsserts.assertModifications(accountSecondaryDelta, 4); assertNotNull("No disableTimestamp delta in account secodary delta (default)", accountSecondaryDelta.findPropertyDelta( new ItemPath(ShadowType.F_ACTIVATION, ActivationType.F_DISABLE_TIMESTAMP))); PrismAsserts.assertPropertyReplace(accountSecondaryDelta, SchemaConstants.PATH_ACTIVATION_DISABLE_REASON, SchemaConstants.MODEL_DISABLE_REASON_EXPLICIT); + PrismAsserts.assertPropertyAdd(accountSecondaryDelta, + getAttributePath(resourceDummy, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME), + "rum"); + PrismAsserts.assertPropertyAdd(accountSecondaryDelta, + getAttributePath(resourceDummy, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_QUOTE_NAME), + "Arr!"); ModelProjectionContext accContextBlue = modelContext.findProjectionContext( new ResourceShadowDiscriminator(RESOURCE_DUMMY_BLUE_OID, ShadowKindType.ACCOUNT, null)); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestTriggerTask.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestTriggerTask.java index 4d76afa195f..567d717d0a1 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestTriggerTask.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestTriggerTask.java @@ -140,7 +140,7 @@ public void test105NoTrigger() throws Exception { /// WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -170,7 +170,7 @@ public void test110TriggerCalledAgain() throws Exception { /// WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -198,7 +198,7 @@ public void test115NoTriggerAgain() throws Exception { /// WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestUserTemplate.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestUserTemplate.java index f2478020641..2946bf89de9 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestUserTemplate.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestUserTemplate.java @@ -949,7 +949,7 @@ public void test800Kaboom() throws Exception { clock.override(now); // WHEN - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); // THEN PrismObject userJack = modelService.getObject(UserType.class, USER_JACK_OID, null, task, result); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestVolatility.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestVolatility.java index d762974c354..1137e73ab86 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestVolatility.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestVolatility.java @@ -373,7 +373,7 @@ protected void waitForSyncTaskStart() throws Exception { } protected void waitForSyncTaskNextRun() throws Exception { - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, false, 10000); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, false, 10000); } private void assertAccount(PrismObject userJack, String name, String expectedFullName, String shipAttributeName, String expectedShip, diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractInboundSyncTest.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractInboundSyncTest.java index 1542c9b84cb..3518b590eb2 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractInboundSyncTest.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractInboundSyncTest.java @@ -206,7 +206,7 @@ protected void waitForSyncTaskStart(PrismObject resource) throws E } protected void waitForSyncTaskNextRun(PrismObject resource) throws Exception { - waitForTaskNextRun(getSyncTaskOid(resource), false, getWaitTimeout()); + waitForTaskNextRunAssertSuccess(getSyncTaskOid(resource), false, getWaitTimeout()); } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractObjTemplateSyncTest.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractObjTemplateSyncTest.java index ce33e1cc6cc..37561de1579 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractObjTemplateSyncTest.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractObjTemplateSyncTest.java @@ -205,7 +205,7 @@ protected void waitForSyncTaskStart(PrismObject resource) throws E } protected void waitForSyncTaskNextRun(PrismObject resource) throws Exception { - waitForTaskNextRun(getSyncTaskOid(resource), false, getWaitTimeout()); + waitForTaskNextRunAssertSuccess(getSyncTaskOid(resource), false, getWaitTimeout()); } protected void rememberTimeBeforeSync() { diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractSynchronizationStoryTest.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractSynchronizationStoryTest.java index 25fce05c9f7..d77c8acaf70 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractSynchronizationStoryTest.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractSynchronizationStoryTest.java @@ -33,6 +33,7 @@ import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; +import org.opensaml.ws.wsaddressing.IsReferenceParameterBearing; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.ContextConfiguration; @@ -51,12 +52,14 @@ import com.evolveum.midpoint.prism.xml.XmlTypeConverter; import com.evolveum.midpoint.schema.constants.ObjectTypes; import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.schema.result.OperationResultStatus; import com.evolveum.midpoint.schema.util.ObjectTypeUtil; import com.evolveum.midpoint.schema.util.ResourceTypeUtil; import com.evolveum.midpoint.task.api.Task; import com.evolveum.midpoint.test.DummyResourceContoller; import com.evolveum.midpoint.test.IntegrationTestTools; import com.evolveum.midpoint.test.util.TestUtil; +import com.evolveum.midpoint.util.DebugUtil; import com.evolveum.midpoint.util.MiscUtil; import com.evolveum.midpoint.util.exception.CommunicationException; import com.evolveum.midpoint.util.exception.ConfigurationException; @@ -98,6 +101,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti super.initSystem(initTask, initResult); assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE); +// DebugUtil.setDetailedDebugDump(true); } protected abstract void importSyncTask(PrismObject resource) throws FileNotFoundException; @@ -111,6 +115,10 @@ protected int getWaitTimeout() { protected int getNumberOfExtraDummyUsers() { return 0; } + + protected boolean isReconciliation() { + return false; + } @Test @@ -158,7 +166,7 @@ public void test110AddDummyGreenAccountMancomb() throws Exception { dummyResourceGreen.addAccount(account); - waitForSyncTaskNextRun(resourceDummyGreen); + waitForSyncTaskNextRunAssertSuccess(resourceDummyGreen); // THEN TestUtil.displayThen(TEST_NAME); @@ -233,7 +241,7 @@ public void test210AddDummyGreenAccountWally() throws Exception { dummyResourceCtlGreen.addAccount(ACCOUNT_WALLY_DUMMY_USERNAME, "Wally Feed", "Scabb Island"); // Wait for sync task to pick up the change - waitForSyncTaskNextRun(resourceDummyGreen); + waitForSyncTaskNextRunAssertSuccess(resourceDummyGreen); // THEN TestUtil.displayThen(TEST_NAME); @@ -284,13 +292,13 @@ public void test220AddDummyBlueAccountWally() throws Exception { // Wait for sync task to pick up the change // However, blue is not authoritative regarding creating new users, so wally will not be created at this time - waitForSyncTaskNextRun(resourceDummyBlue); + waitForSyncTaskNextRunAssertSuccess(resourceDummyBlue); // Make sure that the "kickback" sync cycle of the other resource runs to completion // We want to check the state after it gets stable // and it could spoil the next test - waitForSyncTaskNextRun(resourceDummyGreen); - waitForSyncTaskNextRun(resourceDummyBlue); + waitForSyncTaskNextRunAssertSuccess(resourceDummyGreen); + waitForSyncTaskNextRunAssertSuccess(resourceDummyBlue); // THEN TestUtil.displayThen(TEST_NAME); @@ -343,13 +351,13 @@ public void test315AddDummyBlueAccountMancomb() throws Exception { dummyResourceCtlBlue.addAccount(ACCOUNT_MANCOMB_DUMMY_USERNAME, "Mancomb Seepgood", "Melee Island"); // Wait for sync task to pick up the change - waitForSyncTaskNextRun(resourceDummyBlue); + waitForSyncTaskNextRunAssertSuccess(resourceDummyBlue); // Make sure that the "kickback" sync cycle of the other resource runs to completion // We want to check the state after it gets stable // and it could spoil the next test - waitForSyncTaskNextRun(resourceDummyGreen); - waitForSyncTaskNextRun(resourceDummyBlue); + waitForSyncTaskNextRunAssertSuccess(resourceDummyGreen); + waitForSyncTaskNextRunAssertSuccess(resourceDummyBlue); // THEN TestUtil.displayThen(TEST_NAME); @@ -403,7 +411,7 @@ public void test350ImportLiveSyncTaskDummyDefault() throws Exception { waitForSyncTaskStart(resourceDummy); // Dummy resource has some extra users that may be created in recon, so let's give it a chance to do it now - waitForSyncTaskNextRun(resourceDummy); + waitForSyncTaskNextRunAssertSuccess(resourceDummy); assertUsers(7 + getNumberOfExtraDummyUsers()); } @@ -436,9 +444,9 @@ public void test360ModifyUserAddDummyDefaultAccount() throws Exception { TestUtil.displayThen(TEST_NAME); // Make sure we have steady state - waitForSyncTaskNextRun(resourceDummy); - waitForSyncTaskNextRun(resourceDummyBlue); - waitForSyncTaskNextRun(resourceDummyGreen); + waitForSyncTaskNextRunAssertSuccess(resourceDummy); + waitForSyncTaskNextRunAssertSuccess(resourceDummyBlue); + waitForSyncTaskNextRunAssertSuccess(resourceDummyGreen); PrismObject accountWallyDefault = checkWallyAccount(resourceDummy, dummyResource, "default", "Wally Feed"); assertShadowOperationalData(accountWallyDefault, SynchronizationSituationType.LINKED); @@ -543,15 +551,15 @@ public void test370ModifyDummyGreenAccountWally() throws Exception { wallyDummyAccount.replaceAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Wally B. Feed"); // Wait for sync task to pick up the change - waitForSyncTaskNextRun(resourceDummyGreen); + waitForSyncTaskNextRunAssertSuccess(resourceDummyGreen); // Make sure that the "kickback" sync cycle of the other resource runs to completion // We want to check the state after it gets stable // and it could spoil the next test - waitForSyncTaskNextRun(resourceDummyBlue); - waitForSyncTaskNextRun(resourceDummyGreen); + waitForSyncTaskNextRunAssertSuccess(resourceDummyBlue); + waitForSyncTaskNextRunAssertSuccess(resourceDummyGreen); // Make sure we have steady state - waitForSyncTaskNextRun(resourceDummy); + waitForSyncTaskNextRunAssertSuccess(resourceDummy); // THEN TestUtil.displayThen(TEST_NAME); @@ -565,7 +573,13 @@ public void test370ModifyDummyGreenAccountWally() throws Exception { if (allwaysCheckTimestamp) assertShadowOperationalData(accountWallyBlue, SynchronizationSituationType.LINKED); PrismObject accountWallyGreen = checkWallyAccount(resourceDummyGreen, dummyResourceGreen, "green", "Wally B. Feed"); assertShadowOperationalData(accountWallyGreen, SynchronizationSituationType.LINKED); - PrismObject accountWallyDefault = checkWallyAccount(resourceDummy, dummyResource, "default", "Wally B. Feed"); + PrismObject accountWallyDefault; + // See MID-2518 + if (isReconciliation()) { + accountWallyDefault = checkWallyAccount(resourceDummy, dummyResource, "default", "Wally Feed"); + } else { + accountWallyDefault = checkWallyAccount(resourceDummy, dummyResource, "default", "Wally B. Feed"); + } assertShadowOperationalData(accountWallyDefault, SynchronizationSituationType.LINKED); assertLinks(userWally, 3); @@ -609,9 +623,9 @@ public void test380ModifyUserWallyFullName() throws Exception { modifyUserReplace(userWallyOid, UserType.F_FULL_NAME, task, result, PrismTestUtil.createPolyString("Bloodnose")); // Wait for sync tasks to pick up the change and have some chance to screw things - waitForSyncTaskNextRun(resourceDummy); - waitForSyncTaskNextRun(resourceDummyBlue); - waitForSyncTaskNextRun(resourceDummyGreen); + waitForSyncTaskNextRunAssertSuccess(resourceDummy); + waitForSyncTaskNextRunAssertSuccess(resourceDummyBlue); + waitForSyncTaskNextRunAssertSuccess(resourceDummyGreen); // THEN TestUtil.displayThen(TEST_NAME); @@ -672,9 +686,9 @@ public void test400DeleteDummyDefaultAccount() throws Exception { display("Dummy (default) resource", dummyResource.debugDump()); // Make sure we have steady state - waitForSyncTaskNextRun(resourceDummy); - waitForSyncTaskNextRun(resourceDummyBlue); - waitForSyncTaskNextRun(resourceDummyGreen); + waitForSyncTaskNextRunAssertSuccess(resourceDummy); + waitForSyncTaskNextRunAssertSuccess(resourceDummyBlue); + waitForSyncTaskNextRunAssertSuccess(resourceDummyGreen); // THEN TestUtil.displayThen(TEST_NAME); @@ -730,9 +744,9 @@ public void test410DeleteDummyGreenAccount() throws Exception { dummyResourceGreen.deleteAccountByName(ACCOUNT_WALLY_DUMMY_USERNAME); // Make sure we have steady state - waitForSyncTaskNextRun(resourceDummy); - waitForSyncTaskNextRun(resourceDummyBlue); - waitForSyncTaskNextRun(resourceDummyGreen); + waitForSyncTaskNextRunAssertSuccess(resourceDummy); + OperationResult takResultBlue = waitForSyncTaskNextRun(resourceDummyBlue); + waitForSyncTaskNextRunAssertSuccess(resourceDummyGreen); // THEN TestUtil.displayThen(TEST_NAME); @@ -752,6 +766,17 @@ public void test410DeleteDummyGreenAccount() throws Exception { assertUsers(6 + getNumberOfExtraDummyUsers()); + if (isReconciliation()) { + if (takResultBlue.getStatus() == OperationResultStatus.PARTIAL_ERROR) { + // Blue resource recon may fail. The user may be deleted before the blue + // recon task finishes. If the result (user, accouts) is OK then tolarate this error. + } else { + TestUtil.assertSuccess("Blue resource syncronization has failed", takResultBlue); + } + } else { + TestUtil.assertSuccess("Blue resource syncronization has failed", takResultBlue); + } + // notifications notificationManager.setDisabled(true); // checkDummyTransportMessages("accountPasswordNotifier", 0); @@ -781,7 +806,7 @@ public void test510AddDummyGreenAccountWallyUserTemplate() throws Exception { dummyResourceCtlGreen.addAccount(ACCOUNT_WALLY_DUMMY_USERNAME, "Wally Feed", "Scabb Island"); // Wait for sync task to pick up the change - waitForSyncTaskNextRun(resourceDummyGreen); + waitForSyncTaskNextRunAssertSuccess(resourceDummyGreen); // THEN TestUtil.displayThen(TEST_NAME); @@ -832,7 +857,7 @@ public void test600AddDummyGreenAccountCalypso() throws Exception { dummyResourceGreen.addAccount(account); - waitForSyncTaskNextRun(resourceDummyGreen); + waitForSyncTaskNextRunAssertSuccess(resourceDummyGreen); // THEN TestUtil.displayThen(TEST_NAME); @@ -878,7 +903,7 @@ public void test700AddDummyGreenAccountXjojo() throws Exception { dummyResourceGreen.addAccount(account); - waitForSyncTaskNextRun(resourceDummyGreen); + waitForSyncTaskNextRunAssertSuccess(resourceDummyGreen); // THEN TestUtil.displayThen(TEST_NAME); @@ -933,10 +958,14 @@ protected void waitForSyncTaskStart(PrismObject resource) throws E waitForTaskStart(getSyncTaskOid(resource), false, getWaitTimeout()); } - protected void waitForSyncTaskNextRun(PrismObject resource) throws Exception { - waitForTaskNextRun(getSyncTaskOid(resource), false, getWaitTimeout()); + protected OperationResult waitForSyncTaskNextRunAssertSuccess(PrismObject resource) throws Exception { + return waitForTaskNextRunAssertSuccess(getSyncTaskOid(resource), false, getWaitTimeout()); } - + + protected OperationResult waitForSyncTaskNextRun(PrismObject resource) throws Exception { + return waitForTaskNextRun(getSyncTaskOid(resource), false, getWaitTimeout()); + } + private PrismObject checkWallyAccount(PrismObject resource, DummyResource dummy, String resourceDesc, String expectedFullName) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, ConnectException, FileNotFoundException { return checkWallyAccount(resource, dummy, resourceDesc, expectedFullName, null, null); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestImportRecon.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestImportRecon.java index 5da31d7a3a1..3b56878240e 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestImportRecon.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestImportRecon.java @@ -355,15 +355,7 @@ public void test150ImportFromResourceDummy() throws Exception { TestUtil.displayThen(TEST_NAME); TestUtil.assertSuccess(task.getResult()); - // First fetch: search in import handler - // 6 fetches: fetchback to correctly process inbound (import changes the account). - // The accounts are modified during import as there are also outbound mappings in - // ther dummy resource. As the import is in fact just a recon the "fetchbacks" happens. - // One is because of counting resource objects before importing them. -// assertShadowFetchOperationCountIncrement(8); - - // WHY???? - assertShadowFetchOperationCountIncrement(2); + assertShadowFetchOperationCountIncrement(3); users = modelService.searchObjects(UserType.class, null, null, task, result); display("Users after import", users); @@ -417,7 +409,7 @@ public void test155ImportFromResourceDummyAgain() throws Exception { // Even though there are outbound mappings these were already processes // by previous import run. There are no account modifications this time. // Therefore there should be no "fetchbacks". - assertShadowFetchOperationCountIncrement(1); + assertShadowFetchOperationCountIncrement(2); List> users = modelService.searchObjects(UserType.class, null, null, task, result); display("Users after import", users); @@ -470,10 +462,7 @@ public void test160ImportFromResourceDummyLime() throws Exception { TestUtil.displayThen(TEST_NAME); TestUtil.assertSuccess(task.getResult()); - // One fetch: search in import handler - // There are no outbound mappings in lime resource, therefore there are no - // modifications of accounts during import, therefore there are no "fetchbacks". - assertShadowFetchOperationCountIncrement(1); + assertShadowFetchOperationCountIncrement(2); assertImportedUserByOid(USER_ADMINISTRATOR_OID); assertImportedUserByOid(USER_JACK_OID); @@ -544,9 +533,7 @@ public void test200ReconcileDummy() throws Exception { // THEN TestUtil.displayThen(TEST_NAME); - // First fetch: searchIterative - // Second fetch: "fetchback" of modified account (guybrush) - assertShadowFetchOperationCountIncrement(2); + assertShadowFetchOperationCountIncrement(3); reconciliationTaskResultListener.assertResult(RESOURCE_DUMMY_OID, 0, 7, 0, 0); @@ -705,9 +692,7 @@ public void test219ReconcileDummyFixed() throws Exception { // THEN TestUtil.displayThen(TEST_NAME); - // First fetch: searchIterative - // Second fetch: "fetchback" of modified account (guybrush) - assertShadowFetchOperationCountIncrement(2); + assertShadowFetchOperationCountIncrement(3); reconciliationTaskResultListener.assertResult(RESOURCE_DUMMY_OID, 0, 7, 0, 0); @@ -863,9 +848,7 @@ public void test229ReconcileDummyFixed() throws Exception { // THEN TestUtil.displayThen(TEST_NAME); - // First fetch: searchIterative - // Second fetch: "fetchback" of modified account (guybrush) - assertShadowFetchOperationCountIncrement(2); + assertShadowFetchOperationCountIncrement(3); reconciliationTaskResultListener.assertResult(RESOURCE_DUMMY_OID, 0, 7, 0, 0); @@ -951,9 +934,7 @@ public void test230ReconcileDummyRename() throws Exception { // THEN TestUtil.displayThen(TEST_NAME); - // First fetch: searchIterative - // Second fetch: "fetchback" of modified account (htm) - assertShadowFetchOperationCountIncrement(2); + assertShadowFetchOperationCountIncrement(3); reconciliationTaskResultListener.assertResult(RESOURCE_DUMMY_OID, 0, 7, 0, 1); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestReconTask.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestReconTask.java index 3de95e00481..68c121c4b3e 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestReconTask.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestReconTask.java @@ -36,7 +36,12 @@ @ContextConfiguration(locations = {"classpath:ctx-model-intest-test-main.xml"}) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) public class TestReconTask extends AbstractSynchronizationStoryTest { - + + @Override + protected boolean isReconciliation() { + return true; + } + @Override public void initSystem(Task initTask, OperationResult initResult) throws Exception { super.initSystem(initTask, initResult); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestUuid.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestUuid.java index c9d41eb9d99..12100f544a9 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestUuid.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestUuid.java @@ -215,7 +215,7 @@ public void test210ReconcileDummyUuidAddAugustus() throws Exception { // THEN TestUtil.displayThen(TEST_NAME); - waitForTaskNextRun(TASK_RECONCILE_DUMMY_UUID_OID, true); + waitForTaskNextRunAssertSuccess(TASK_RECONCILE_DUMMY_UUID_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -292,7 +292,7 @@ public void test220ReconcileDummyUuidDeleteAddAugustus() throws Exception { // THEN TestUtil.displayThen(TEST_NAME); - waitForTaskNextRun(TASK_RECONCILE_DUMMY_UUID_OID, true); + waitForTaskNextRunAssertSuccess(TASK_RECONCILE_DUMMY_UUID_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -371,7 +371,7 @@ public void test230ReconcileDummyUuidDeleteAugustusAddAugustina() throws Excepti // THEN TestUtil.displayThen(TEST_NAME); - waitForTaskNextRun(TASK_RECONCILE_DUMMY_UUID_OID, true); + waitForTaskNextRunAssertSuccess(TASK_RECONCILE_DUMMY_UUID_OID, true); // THEN TestUtil.displayThen(TEST_NAME); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java index 049226e4ac1..6a402758647 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java @@ -248,7 +248,7 @@ private void testJackAssignRoleJudgeValid(final String TEST_NAME, ActivationType // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -279,7 +279,7 @@ private void testJackAssignRoleJudgeInvalid(final String TEST_NAME, ActivationTy // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -609,7 +609,7 @@ public void test130BarbossaAssignJudgeEnabled() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -651,7 +651,7 @@ public void test131BarbossaAssignSailorEnabled() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -693,7 +693,7 @@ public void test132BarbossaDisableAssignmentJudge() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -734,7 +734,7 @@ public void test133BarbossaDisableAssignmentSailor() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -862,7 +862,7 @@ public void test136BarbossaDisableBothAssignments() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -914,7 +914,7 @@ public void test137BarbossaEnableBothAssignments() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -972,7 +972,7 @@ public void test139BarbossaDisableBothAssignmentsUnassign() throws Exception { modelService.executeChanges(MiscSchemaUtil.createCollection(objectDelta), null, task, result); assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); PrismObject user = getUser(USER_BARBOSSA_OID); display("User after", user); @@ -1001,7 +1001,7 @@ public void test139BarbossaDisableBothAssignmentsUnassign() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1051,7 +1051,7 @@ public void test140BarbossaAssignRedJudgeEnabled() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1093,7 +1093,7 @@ public void test141BarbossaAssignRedSailorEnabled() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1135,7 +1135,7 @@ public void test142BarbossaDisableAssignmentRedJudge() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1176,7 +1176,7 @@ public void test143BarbossaDisableAssignmentRedSailor() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1308,7 +1308,7 @@ public void test146BarbossaDisableBothRedAssignments() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1364,7 +1364,7 @@ public void test147BarbossaEnableBothRedAssignments() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1422,7 +1422,7 @@ public void test149BarbossaDisableBothRedAssignmentsUnassign() throws Exception modelService.executeChanges(MiscSchemaUtil.createCollection(objectDelta), null, task, result); assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); PrismObject user = getUser(USER_BARBOSSA_OID); display("User after", user); @@ -1452,7 +1452,7 @@ public void test149BarbossaDisableBothRedAssignmentsUnassign() throws Exception // WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1496,7 +1496,7 @@ public void test190HermanGoesInvalid() throws Exception { /// WHEN TestUtil.displayWhen(TEST_NAME); - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1600,7 +1600,7 @@ public void test210JackAssignAndUnassignAccountRed() throws Exception { TestUtil.assertSuccess(result); // Let's wait for the task to give it a change to screw up - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); PrismObject userJack = getUser(USER_JACK_OID); display("Jack", userJack); @@ -1641,7 +1641,7 @@ public void test215JackDummyAccountDeleteAfterMonth() throws Exception { TestUtil.displayWhen(TEST_NAME); clock.override(time); - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1689,8 +1689,8 @@ public void test220AddDrake() throws Exception { // THEN // Give the tasks a chance to screw up - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); // Make sure that it is effectivelly disabled PrismObject userDrakeAfter = getUser(USER_DRAKE_OID); @@ -1714,8 +1714,8 @@ public void test222Drake4DaysBeforeValidFrom() throws Exception { // WHEN // just wait - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); // THEN // Make sure that it is effectivelly disabled @@ -1742,8 +1742,8 @@ public void test224Drake1DaysAfterValidFrom() throws Exception { // WHEN // just wait - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); // THEN PrismObject userDrakeAfter = getUser(USER_DRAKE_OID); @@ -1769,8 +1769,8 @@ public void test226Drake1DayBeforeValidTo() throws Exception { // WHEN // just wait - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); // THEN PrismObject userDrakeAfter = getUser(USER_DRAKE_OID); @@ -1796,8 +1796,8 @@ public void test228Drake1DayAfterValidTo() throws Exception { // WHEN // just wait - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); // THEN PrismObject userDrakeAfter = getUser(USER_DRAKE_OID); @@ -1824,8 +1824,8 @@ public void test230Drake20DaysAfterValidTo() throws Exception { // WHEN // just wait - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); // THEN PrismObject userDrakeAfter = getUser(USER_DRAKE_OID); @@ -1852,8 +1852,8 @@ public void test232Drake40DaysAfterValidTo() throws Exception { // WHEN // just wait - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); // THEN PrismObject userDrakeAfter = getUser(USER_DRAKE_OID); @@ -1934,7 +1934,7 @@ public void test310HermanAssignJudgeBecomesValid() throws Exception { // WHEN // just wait - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); assertRoleJudgeValid(TEST_NAME, task, result); } @@ -1955,7 +1955,7 @@ public void test315HermanAssignJudgeBecomesInValid() throws Exception { // WHEN // just wait - waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_VALIDITY_SCANNER_OID, true); assertRoleJudgeInValid(TEST_NAME, task, result); } diff --git a/model/model-intest/src/test/resources/caseignore/role-joker.xml b/model/model-intest/src/test/resources/caseignore/role-joker.xml index b66e1d7982b..3d4d1df1091 100644 --- a/model/model-intest/src/test/resources/caseignore/role-joker.xml +++ b/model/model-intest/src/test/resources/caseignore/role-joker.xml @@ -35,6 +35,7 @@ ri:group + strong diff --git a/model/model-intest/src/test/resources/common/resource-dummy-red.xml b/model/model-intest/src/test/resources/common/resource-dummy-red.xml index 5265b8ba5f5..08ba40582c7 100644 --- a/model/model-intest/src/test/resources/common/resource-dummy-red.xml +++ b/model/model-intest/src/test/resources/common/resource-dummy-red.xml @@ -184,9 +184,24 @@ Ship strong + $user/organizationalUnit + + + diff --git a/model/model-intest/src/test/resources/common/user-elaine.xml b/model/model-intest/src/test/resources/common/user-elaine.xml index 12b43cc6891..6e656cbab6f 100644 --- a/model/model-intest/src/test/resources/common/user-elaine.xml +++ b/model/model-intest/src/test/resources/common/user-elaine.xml @@ -55,4 +55,12 @@ enabled + + + + P1ranhaD0GZ + + + + diff --git a/model/model-intest/src/test/resources/common/user-guybrush.xml b/model/model-intest/src/test/resources/common/user-guybrush.xml index ff61e1b26a7..08b7c083305 100644 --- a/model/model-intest/src/test/resources/common/user-guybrush.xml +++ b/model/model-intest/src/test/resources/common/user-guybrush.xml @@ -1,6 +1,6 @@ - - - - - - - + + + + xM4rksTh3Sp0t + + + diff --git a/model/model-intest/src/test/resources/logback-test.xml b/model/model-intest/src/test/resources/logback-test.xml index 83acf3cc76d..8101896001c 100644 --- a/model/model-intest/src/test/resources/logback-test.xml +++ b/model/model-intest/src/test/resources/logback-test.xml @@ -48,10 +48,12 @@ - + + + - + @@ -62,7 +64,7 @@ - --> + diff --git a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java index 5d389c91e23..a6561813924 100644 --- a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java +++ b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java @@ -96,6 +96,7 @@ import com.evolveum.midpoint.test.util.TestUtil; import com.evolveum.midpoint.util.DebugUtil; import com.evolveum.midpoint.util.DisplayableValue; +import com.evolveum.midpoint.util.Holder; import com.evolveum.midpoint.util.MiscUtil; import com.evolveum.midpoint.util.QNameUtil; import com.evolveum.midpoint.util.exception.CommunicationException; @@ -1892,27 +1893,37 @@ public void timeout() { IntegrationTestTools.waitFor("Waiting for task " + taskOid + " start", checker, timeout, DEFAULT_TASK_SLEEP_TIME); } - protected void waitForTaskNextRun(String taskOid, boolean checkSubresult) throws Exception { - waitForTaskNextRun(taskOid, checkSubresult, DEFAULT_TASK_WAIT_TIMEOUT); + protected OperationResult waitForTaskNextRunAssertSuccess(String taskOid, boolean checkSubresult) throws Exception { + return waitForTaskNextRunAssertSuccess(taskOid, checkSubresult, DEFAULT_TASK_WAIT_TIMEOUT); } - protected void waitForTaskNextRun(final String taskOid, final boolean checkSubresult, final int timeout) throws Exception { + protected OperationResult waitForTaskNextRunAssertSuccess(final String taskOid, final boolean checkSubresult, final int timeout) throws Exception { + OperationResult taskResult = waitForTaskNextRun(taskOid, checkSubresult, timeout); + if (isError(taskResult, checkSubresult)) { + assert false : "Error in task "+taskOid+": "+TestUtil.getErrorMessage(taskResult)+"\n\n"+taskResult.debugDump(); + } + return taskResult; + } + + protected OperationResult waitForTaskNextRun(final String taskOid, final boolean checkSubresult, final int timeout) throws Exception { final OperationResult waitResult = new OperationResult(AbstractIntegrationTest.class+".waitForTaskNextRun"); Task origTask = taskManager.getTask(taskOid, waitResult); final Long origLastRunStartTimestamp = origTask.getLastRunStartTimestamp(); final Long origLastRunFinishTimestamp = origTask.getLastRunFinishTimestamp(); + final Holder taskResultHolder = new Holder<>(); Checker checker = new Checker() { @Override public boolean check() throws Exception { Task freshTask = taskManager.getTask(taskOid, waitResult); - OperationResult result = freshTask.getResult(); + OperationResult taskResult = freshTask.getResult(); // display("Times", longTimeToString(origLastRunStartTimestamp) + "-" + longTimeToString(origLastRunStartTimestamp) // + " : " + longTimeToString(freshTask.getLastRunStartTimestamp()) + "-" + longTimeToString(freshTask.getLastRunFinishTimestamp())); - if (verbose) display("Check result", result); - if (isError(result, checkSubresult)) { - assert false : "Error in "+freshTask+": "+TestUtil.getErrorMessage(result)+"\n\n"+result.debugDump(); + if (verbose) display("Check result", taskResult); + taskResultHolder.setValue(taskResult); + if (isError(taskResult, checkSubresult)) { + return true; } - if (isUknown(result, checkSubresult)) { + if (isUknown(taskResult, checkSubresult)) { return false; } if (freshTask.getLastRunFinishTimestamp() == null) { @@ -1940,6 +1951,7 @@ public void timeout() { } }; IntegrationTestTools.waitFor("Waiting for task " + taskOid + " next run", checker, timeout, DEFAULT_TASK_SLEEP_TIME); + return taskResultHolder.getValue(); } private String longTimeToString(Long longTime) { diff --git a/samples/resources/ad/ad-resource-simple.xml b/samples/resources/ad/ad-resource-simple.xml index 82dbf654747..0f3a7a9e7d5 100644 --- a/samples/resources/ad/ad-resource-simple.xml +++ b/samples/resources/ad/ad-resource-simple.xml @@ -40,7 +40,7 @@ This resource definition contains only the very basic definitions for midPoint t Basic Active Directory - + diff --git a/testing/conntest/src/test/java/com/evolveum/midpoint/testing/conntest/AbstractLdapConnTest.java b/testing/conntest/src/test/java/com/evolveum/midpoint/testing/conntest/AbstractLdapConnTest.java index 719c290f85b..565552d1bb6 100644 --- a/testing/conntest/src/test/java/com/evolveum/midpoint/testing/conntest/AbstractLdapConnTest.java +++ b/testing/conntest/src/test/java/com/evolveum/midpoint/testing/conntest/AbstractLdapConnTest.java @@ -680,7 +680,7 @@ public void test800ImportSyncTask() throws Exception { result.computeStatus(); TestUtil.assertSuccess(result); - waitForTaskNextRun(getSyncTaskOid(), true); + waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true); long tsEnd = System.currentTimeMillis(); @@ -701,7 +701,7 @@ public void test801SyncAddAccountHt() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); addLdapAccount(ACCOUNT_HT_UID, ACCOUNT_HT_CN, ACCOUNT_HT_GIVENNAME, ACCOUNT_HT_SN); - waitForTaskNextRun(getSyncTaskOid(), true); + waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true); // THEN TestUtil.displayThen(TEST_NAME); @@ -737,7 +737,7 @@ public void test802ModifyAccountHt() throws Exception { connection.modify(toDn(ACCOUNT_HT_UID), modCn); ldapDisconnect(connection); - waitForTaskNextRun(getSyncTaskOid(), true); + waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true); // THEN TestUtil.displayThen(TEST_NAME); @@ -768,7 +768,7 @@ public void test810SyncAddGroupMonkeys() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); addLdapGroup(GROUP_MONKEYS_CN, GROUP_MONKEYS_DESCRIPTION, "uid=fake,"+getPeopleLdapSuffix()); - waitForTaskNextRun(getSyncTaskOid(), true); + waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true); // THEN TestUtil.displayThen(TEST_NAME); @@ -811,7 +811,7 @@ public void test817RenameAccount() throws Exception { ldapDisconnect(connection); - waitForTaskNextRun(getSyncTaskOid(), true); + waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true); // THEN TestUtil.displayThen(TEST_NAME); @@ -846,7 +846,7 @@ public void test818DeleteAccountHtm() throws Exception { TestUtil.displayWhen(TEST_NAME); deleteLdapEntry(toDn("htm")); - waitForTaskNextRun(getSyncTaskOid(), true); + waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true); // THEN TestUtil.displayThen(TEST_NAME); @@ -910,7 +910,7 @@ public void test820ImportSyncTaskInetOrgPerson() throws Exception { result.computeStatus(); TestUtil.assertSuccess(result); - waitForTaskNextRun(getSyncTaskOid(), true); + waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true); long tsEnd = System.currentTimeMillis(); @@ -934,7 +934,7 @@ public void test821SyncAddAccountHt() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); addLdapAccount(ACCOUNT_HT_UID, ACCOUNT_HT_CN, ACCOUNT_HT_GIVENNAME, ACCOUNT_HT_SN); - waitForTaskNextRun(getSyncTaskOid(), true); + waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true); // THEN TestUtil.displayThen(TEST_NAME); @@ -970,7 +970,7 @@ public void test822ModifyAccountHt() throws Exception { connection.modify(toDn(ACCOUNT_HT_UID), modCn); ldapDisconnect(connection); - waitForTaskNextRun(getSyncTaskOid(), true); + waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1012,7 +1012,7 @@ public void test837RenameAccount() throws Exception { ldapDisconnect(connection); - waitForTaskNextRun(getSyncTaskOid(), true); + waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true); // THEN TestUtil.displayThen(TEST_NAME); @@ -1049,7 +1049,7 @@ public void test838DeleteAccountHtm() throws Exception { TestUtil.displayWhen(TEST_NAME); deleteLdapEntry(toDn("htm")); - waitForTaskNextRun(getSyncTaskOid(), true); + waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true); // THEN TestUtil.displayThen(TEST_NAME); diff --git a/testing/consistency-mechanism/src/test/java/com/evolveum/midpoint/testing/consistency/ConsistencyTest.java b/testing/consistency-mechanism/src/test/java/com/evolveum/midpoint/testing/consistency/ConsistencyTest.java index 8ba1b738d57..a6cf23f4501 100644 --- a/testing/consistency-mechanism/src/test/java/com/evolveum/midpoint/testing/consistency/ConsistencyTest.java +++ b/testing/consistency-mechanism/src/test/java/com/evolveum/midpoint/testing/consistency/ConsistencyTest.java @@ -2097,7 +2097,7 @@ public void test800Reconciliation() throws Exception { // WHEN repoAddObjectFromFile(TASK_OPENDJ_RECONCILIATION_FILENAME, TaskType.class, result); verbose = true; - waitForTaskNextRun(TASK_OPENDJ_RECONCILIATION_OID, false, 60000); + waitForTaskNextRunAssertSuccess(TASK_OPENDJ_RECONCILIATION_OID, false, 60000); // THEN @@ -2165,7 +2165,7 @@ public void test801testReconciliationRename() throws Exception{ LOGGER.info("start running task"); // WHEN repoAddObjectFromFile(TASK_OPENDJ_RECONCILIATION_FILENAME, TaskType.class, result); - waitForTaskNextRun(TASK_OPENDJ_RECONCILIATION_OID, false, 60000); + waitForTaskNextRunAssertSuccess(TASK_OPENDJ_RECONCILIATION_OID, false, 60000); // THEN diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestOrgSync.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestOrgSync.java index 3c341308943..b56d2cd7426 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestOrgSync.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestOrgSync.java @@ -319,7 +319,7 @@ public void test100AddHrAccountHerman() throws Exception { // WHEN dummyResourceHr.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject user = findUserByUsername(ACCOUNT_HERMAN_USERNAME); @@ -360,7 +360,7 @@ public void test105AddHrAccountLemonhead() throws Exception { // WHEN dummyResourceHr.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject user = findUserByUsername(ACCOUNT_LEMONHEAD_USERNAME); @@ -403,7 +403,7 @@ public void test106AddHrAccountSharptooth() throws Exception { // WHEN dummyResourceHr.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject user = findUserByUsername(ACCOUNT_SHARPTOOTH_USERNAME); @@ -446,7 +446,7 @@ public void test107AddHrAccountRedskull() throws Exception { // WHEN dummyResourceHr.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject user = findUserByUsername(ACCOUNT_REDSKULL_USERNAME); @@ -486,7 +486,7 @@ public void test108RedskullGoesVegeratian() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); account.removeAttributeValue(DUMMY_ACCOUNT_ATTRIBUTE_HR_RESPONSIBILITIES, RESP_CANIBALISM); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -525,7 +525,7 @@ public void test109HrDeleteRedskull() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); dummyResourceHr.deleteAccountByName(ACCOUNT_REDSKULL_USERNAME); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -559,7 +559,7 @@ public void test110AddHrAccountGuybrush() throws Exception { // WHEN dummyResourceHr.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject user = findUserByUsername(ACCOUNT_GUYBRUSH_USERNAME); @@ -604,7 +604,7 @@ public void test115AddHrAccountMancomb() throws Exception { // WHEN dummyResourceHr.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject user = findUserByUsername(ACCOUNT_MANCOMB_USERNAME); @@ -651,7 +651,7 @@ public void test117AddHrAccountCobb() throws Exception { // WHEN dummyResourceHr.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject user = findUserByUsername(ACCOUNT_COBB_USERNAME); @@ -698,7 +698,7 @@ public void test130AddHrAccountLargo() throws Exception { // WHEN dummyResourceHr.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject user = findUserByUsername(ACCOUNT_LARGO_USERNAME); @@ -750,7 +750,7 @@ public void test140AddHrAccountWally() throws Exception { // WHEN dummyResourceHr.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject user = findUserByUsername(ACCOUNT_WALLY_USERNAME); @@ -794,7 +794,7 @@ public void test142AddHrAccountAugustus() throws Exception { // WHEN dummyResourceHr.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject user = findUserByUsername(ACCOUNT_AUGUSTUS_USERNAME); @@ -838,7 +838,7 @@ public void test185AddHrAccountStan() throws Exception { // WHEN dummyResourceHr.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject user = findUserByUsername(ACCOUNT_STAN_USERNAME); @@ -884,7 +884,7 @@ public void test186AddHrAccountCapsize() throws Exception { // WHEN dummyResourceHr.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject user = findUserByUsername(ACCOUNT_CAPSIZE_USERNAME); @@ -930,7 +930,7 @@ public void test187AddHrAccountRogersSr() throws Exception { // WHEN dummyResourceHr.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject user = findUserByUsername(ACCOUNT_ROGERSSR_USERNAME); @@ -977,7 +977,7 @@ public void test190AddHrAccountTeleke() throws Exception { // WHEN dummyResourceHr.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject user = findUserByUsername(ACCOUNT_TELEKE_USERNAME); diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestTrafo.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestTrafo.java index 999eff31b3f..78de7084e95 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestTrafo.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestTrafo.java @@ -413,7 +413,7 @@ public void test109JackAccountAdGone() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); clock.overrideDuration("P2D"); - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); @@ -601,7 +601,7 @@ public void test129JackAccountMailGone() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); clock.overrideDuration("P2D"); - waitForTaskNextRun(TASK_TRIGGER_SCANNER_OID, true); + waitForTaskNextRunAssertSuccess(TASK_TRIGGER_SCANNER_OID, true); // THEN TestUtil.displayThen(TEST_NAME); diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestUniversity.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestUniversity.java index 43f5e2b3996..bf73da91b20 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestUniversity.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestUniversity.java @@ -198,7 +198,7 @@ public void test100AddComeniusUniversity() throws Exception { // WHEN dummyResourceHr.addPrivilege(comenius); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN PrismObject org = getAndAssertFunctionalOrg("UK"); @@ -232,7 +232,7 @@ public void test110AddComeniusStructure() throws Exception { dummyResourceHr.addPrivilege(srcFmfi); dummyResourceHr.addPrivilege(srcVc); dummyResourceHr.addPrivilege(srcPrif); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true); // THEN dumpOrgTree(); @@ -298,7 +298,7 @@ public void test120MoveComputingCentre() throws Exception { // WHEN srcVc.replaceAttributeValue(DUMMY_PRIVILEGE_ATTRIBUTE_HR_ORGPATH, "UK:PRIF"); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_HR_OID, true, 999999999); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_HR_OID, true, 999999999); // THEN dumpOrgTree(); diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestVillage.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestVillage.java index e3afb1a8f7a..2698dc186a0 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestVillage.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestVillage.java @@ -358,7 +358,7 @@ public void test100AddSrcAccountHerman() throws Exception { // WHEN dummyResourceSrc.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); // THEN PrismObject user = findUserByUsername(USER_HERMAN_NAME); @@ -461,7 +461,7 @@ public void test105ModifySrcAccountHermanRemoveLoc() throws Exception { // WHEN account.replaceAttributeValues(DUMMY_ACCOUNT_ATTRIBUTE_SRC_LOC); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); // THEN PrismObject user = findUserByUsername(USER_HERMAN_NAME); @@ -497,7 +497,7 @@ public void test107ModifySrcAccountHermanAddLoc() throws Exception { // WHEN account.replaceAttributeValues(DUMMY_ACCOUNT_ATTRIBUTE_SRC_LOC, ACCOUNT_HERMAN_LOC); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); // THEN PrismObject user = findUserByUsername(USER_HERMAN_NAME); @@ -516,7 +516,7 @@ public void test108ModifySrcAccountHermanRemoveLoc() throws Exception { // WHEN account.replaceAttributeValues(DUMMY_ACCOUNT_ATTRIBUTE_SRC_LOC); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); // THEN PrismObject user = findUserByUsername(USER_HERMAN_NAME); @@ -558,7 +558,7 @@ public void test110AddSrcAccountLemonhead() throws Exception { // WHEN dummyResourceSrc.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); // THEN PrismObject userAfter = findUserByUsername(USER_LEMONHEAD_NAME); @@ -582,7 +582,7 @@ public void test120AddSrcAccountWally() throws Exception { // WHEN dummyResourceSrc.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); // THEN PrismObject userAfter = findUserByUsername(USER_WALLY_NAME); @@ -641,7 +641,7 @@ public void test130AddSrcAccountMancomb() throws Exception { // WHEN dummyResourceSrc.addAccount(newAccount); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); // THEN PrismObject userAfter = findUserByUsername(USER_MANCOMB_NAME); @@ -697,7 +697,7 @@ public void test150ModifySrcAccountHermanReplaceOrg() throws Exception { // WHEN account.replaceAttributeValues(DUMMY_ACCOUNT_ATTRIBUTE_SRC_ORG, ORG_INFRA_NAME); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); // THEN PrismObject user = findUserByUsername(getUsername(ACCOUNT_HERMAN_FIST_NAME, ACCOUNT_HERMAN_LAST_NAME, ORG_INFRA_NAME)); @@ -722,7 +722,7 @@ public void test152ModifySrcAccountHermanDeleteOrg() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); account.replaceAttributeValues(DUMMY_ACCOUNT_ATTRIBUTE_SRC_ORG); - waitForTaskNextRun(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); + waitForTaskNextRunAssertSuccess(TASK_LIVE_SYNC_DUMMY_SOURCE_OID, true); // THEN TestUtil.displayThen(TEST_NAME);