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 9bfc1d682f9..5d241afbb08 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 @@ -122,7 +122,7 @@ public static void traceContext(Trace logger, String acti new Object[]{activity, phase, context.dump(showTriples)}); } } - + public static ResourceType getResource(LensContext context, String resourceOid, ProvisioningService provisioningService, OperationResult result) throws ObjectNotFoundException, CommunicationException, SchemaException, ConfigurationException, SecurityViolationException { @@ -607,7 +607,7 @@ public static void loadFullAccount(LensContext context return; } } - LOGGER.trace("Loading full account {} from provisioning", accCtx); + LOGGER.trace("Loading full resource object {} from provisioning", accCtx); try{ GetOperationOptions getOptions = GetOperationOptions.createDoNotDiscovery(); @@ -622,7 +622,7 @@ public static void loadFullAccount(LensContext context accCtx.determineFullShadowFlag(oldShadow.getFetchResult()); } catch (ObjectNotFoundException ex){ - if (accCtx.isDelete() || context.getFocusContext().isDelete()){ + 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 @@ -633,7 +633,7 @@ public static void loadFullAccount(LensContext context if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Loaded full account:\n{}", accCtx.debugDump()); + LOGGER.trace("Loaded full resource object:\n{}", accCtx.debugDump()); } } diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/DependencyProcessor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/DependencyProcessor.java index 7e84a75979d..b27b3ab90ac 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/DependencyProcessor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/DependencyProcessor.java @@ -207,6 +207,9 @@ private LensProjectionContext determineProjectionWaveDepr if (LOGGER.isTraceEnabled()) { LOGGER.trace("DEP(rev): {}", outDependency); } + LOGGER.trace("projection context: {}", projectionContext ); + LOGGER.trace("dependency source context: {}", dependencySourceContext); + LOGGER.trace("in dependency {} \nout dependency {}", inDependency, outDependency); if (inDependency != null && isHigerOrder(outDependency, inDependency)) { // There is incomming dependency. Deal only with dependencies of this order and lower // otherwise we can end up in endless loop even for legal dependencies. @@ -233,7 +236,9 @@ private LensProjectionContext determineProjectionWaveDepr // Wave for this context was set during the run of this method (it was not set when we // started, we checked at the beginning). Therefore this context must have been visited again. // therefore there is a circular dependency. Therefore we need to create another context to split it. - resultAccountContext = createAnotherContext(context, projectionContext, determinedOrder); + if (!projectionContext.isDelete()){ + resultAccountContext = createAnotherContext(context, projectionContext, determinedOrder); + } } // LOGGER.trace("Wave for {}: {}", resultAccountContext.getResourceAccountType(), wave); resultAccountContext.setWave(determinedWave); @@ -287,6 +292,19 @@ private boolean isHigerOrder(ResourceObjectTypeDependencyType a, } return ao > bo; } + + private boolean isLowerOrder(ResourceObjectTypeDependencyType a, + ResourceObjectTypeDependencyType b) { + Integer ao = a.getOrder(); + Integer bo = b.getOrder(); + if (ao == null) { + ao = 0; + } + if (bo == null) { + bo = 0; + } + return ao < bo; + } /** * Find context that has the closest order to the dependency. diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestScience.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestScience.java index 4c4e6c75326..a3fef8d1e91 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestScience.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestScience.java @@ -29,10 +29,13 @@ import org.testng.annotations.AfterClass; import org.testng.annotations.Test; +import com.evolveum.icf.dummy.resource.DummyAccount; import com.evolveum.icf.dummy.resource.DummyObjectClass; import com.evolveum.icf.dummy.resource.DummyResource; import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.PrismProperty; +import com.evolveum.midpoint.prism.path.ItemPath; +import com.evolveum.midpoint.prism.util.PrismAsserts; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.task.api.Task; import com.evolveum.midpoint.test.DummyResourceContoller; @@ -88,6 +91,10 @@ public class TestScience extends AbstractStoryTest { private static final String DUMMY_ACCOUNT_ATTRIBUTE_STATS_DESC_NAME = "Desc"; + private static final String NS_RESOURCE_INSTANCE = "http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"; + + private static final QName UNIX_INTERNAL_ID = new QName(NS_RESOURCE_INSTANCE, DummyAccount.ATTR_INTERNAL_ID); + protected static DummyResource dummyResourceUnix; protected static DummyResourceContoller dummyResourceCtlUnix; @@ -203,9 +210,15 @@ public void test100jackAssignRoleStatistics() throws Exception { PrismObject shadowOpenDj = provisioningService.getObject(ShadowType.class, accountOpenDjOid, null, task, result); IntegrationTestTools.display("AD account: ", shadowOpenDj); - PrismProperty generatedValue = userJack.findExtensionItem(SCIENCE_EXTENSION_UID_QNAME); - assertNotNull("Generated id value must not be null", generatedValue); - assertFalse("Generated value must not be empty", generatedValue.isEmpty()); + + //internalId on unix dummy resource and title on openDJ simulation must be the same + PrismProperty unixId = shadowUnix.findProperty(new ItemPath(ShadowType.F_ATTRIBUTES, UNIX_INTERNAL_ID)); + PrismProperty openDjSyncedId = shadowOpenDj.findProperty(new ItemPath(ShadowType.F_ATTRIBUTES, new QName(NS_RESOURCE_INSTANCE, "title"))); + PrismAsserts.assertEquals("Unix id was not synced to the opendj properly.", String.valueOf(unixId.getAnyRealValue()), openDjSyncedId.getAnyRealValue()); + +// PrismProperty generatedValue = userJack.findExtensionItem(SCIENCE_EXTENSION_UID_QNAME); +// assertNotNull("Generated id value must not be null", generatedValue); +// assertFalse("Generated value must not be empty", generatedValue.isEmpty()); } diff --git a/testing/story/src/test/resources/science/resource-dummy-unix.xml b/testing/story/src/test/resources/science/resource-dummy-unix.xml index e390e747051..9ed7cb6d710 100644 --- a/testing/story/src/test/resources/science/resource-dummy-unix.xml +++ b/testing/story/src/test/resources/science/resource-dummy-unix.xml @@ -147,10 +147,10 @@ - + relaxed - +