http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java index 474a3f2..fbe34d1 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java @@ -32,19 +32,14 @@ import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; import org.apache.syncope.core.provisioning.api.WorkflowResult; -import org.apache.syncope.core.provisioning.api.propagation.PropagationException; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component public class GroupCreateInSyncProcessor implements Processor { - private static final Logger LOG = LoggerFactory.getLogger(GroupCreateInSyncProcessor.class); - @Autowired protected PropagationManager propagationManager; @@ -59,6 +54,7 @@ public class GroupCreateInSyncProcessor implements Processor { GroupTO groupTO = exchange.getProperty("any", GroupTO.class); Map<Long, String> groupOwnerMap = exchange.getProperty("groupOwnerMap", Map.class); Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class); + Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class); AttrTO groupOwner = groupTO.getPlainAttrMap().get(StringUtils.EMPTY); if (groupOwner != null) { @@ -73,12 +69,7 @@ public class GroupCreateInSyncProcessor implements Processor { excludedResources); PropagationReporter propagationReporter = ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - try { - taskExecutor.execute(tasks, propagationReporter); - } catch (PropagationException e) { - LOG.error("Error propagation primary resource", e); - propagationReporter.onPrimaryResourceFailure(tasks); - } + taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync); exchange.getOut().setBody(new ImmutablePair<>(created.getResult(), null)); }
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java index b0bddef..1c08e8a 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java @@ -28,20 +28,15 @@ import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; import org.apache.syncope.core.provisioning.api.WorkflowResult; -import org.apache.syncope.core.provisioning.api.propagation.PropagationException; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class GroupCreateProcessor implements Processor { - private static final Logger LOG = LoggerFactory.getLogger(GroupCreateProcessor.class); - @Autowired protected PropagationManager propagationManager; @@ -54,6 +49,7 @@ public class GroupCreateProcessor implements Processor { WorkflowResult<Long> created = (WorkflowResult) exchange.getIn().getBody(); GroupTO any = exchange.getProperty("any", GroupTO.class); Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class); + Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class); List<PropagationTask> tasks = propagationManager.getCreateTasks( AnyTypeKind.GROUP, @@ -63,12 +59,7 @@ public class GroupCreateProcessor implements Processor { excludedResources); PropagationReporter propagationReporter = ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - try { - taskExecutor.execute(tasks, propagationReporter); - } catch (PropagationException e) { - LOG.error("Error propagation primary resource", e); - propagationReporter.onPrimaryResourceFailure(tasks); - } + taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync); exchange.getOut().setBody(new ImmutablePair<>( created.getResult(), propagationReporter.getStatuses())); http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java index 96b328e..8603af2 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java @@ -29,21 +29,16 @@ import org.apache.syncope.common.lib.types.PropagationByResource; import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.persistence.api.dao.GroupDAO; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; -import org.apache.syncope.core.provisioning.api.propagation.PropagationException; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class GroupDeleteProcessor implements Processor { - private static final Logger LOG = LoggerFactory.getLogger(GroupDeleteProcessor.class); - @Autowired protected GroupWorkflowAdapter gwfAdapter; @@ -61,6 +56,7 @@ public class GroupDeleteProcessor implements Processor { Long key = exchange.getIn().getBody(Long.class); @SuppressWarnings("unchecked") Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class); + Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class); List<PropagationTask> tasks = new ArrayList<>(); @@ -94,12 +90,7 @@ public class GroupDeleteProcessor implements Processor { PropagationReporter propagationReporter = ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - try { - taskExecutor.execute(tasks, propagationReporter); - } catch (PropagationException e) { - LOG.error("Error propagation primary resource", e); - propagationReporter.onPrimaryResourceFailure(tasks); - } + taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync); exchange.setProperty("statuses", propagationReporter.getStatuses()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java index a5c0875..dd50c45 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java @@ -28,20 +28,15 @@ import org.apache.syncope.common.lib.types.ResourceOperation; import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.persistence.api.dao.GroupDAO; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; -import org.apache.syncope.core.provisioning.api.propagation.PropagationException; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class GroupDeprovisionProcessor implements Processor { - private static final Logger LOG = LoggerFactory.getLogger(GroupDeprovisionProcessor.class); - @Autowired protected PropagationManager propagationManager; @@ -56,6 +51,7 @@ public class GroupDeprovisionProcessor implements Processor { public void process(final Exchange exchange) { Long key = exchange.getIn().getBody(Long.class); List<String> resources = exchange.getProperty("resources", List.class); + Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class); PropagationByResource propByRes = new PropagationByResource(); propByRes.addAll(ResourceOperation.DELETE, resources); @@ -67,12 +63,7 @@ public class GroupDeprovisionProcessor implements Processor { CollectionUtils.removeAll(groupDAO.authFind(key).getResourceNames(), resources)); PropagationReporter propagationReporter = ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - try { - taskExecutor.execute(tasks, propagationReporter); - } catch (PropagationException e) { - LOG.error("Error propagation primary resource", e); - propagationReporter.onPrimaryResourceFailure(tasks); - } + taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync); exchange.getOut().setBody(propagationReporter.getStatuses()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupProvisionProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupProvisionProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupProvisionProcessor.java index b7ecc6f..def3ca3 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupProvisionProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupProvisionProcessor.java @@ -26,20 +26,15 @@ import org.apache.syncope.common.lib.types.PropagationByResource; import org.apache.syncope.common.lib.types.ResourceOperation; import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; -import org.apache.syncope.core.provisioning.api.propagation.PropagationException; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class GroupProvisionProcessor implements Processor { - private static final Logger LOG = LoggerFactory.getLogger(GroupProvisionProcessor.class); - @Autowired protected PropagationManager propagationManager; @@ -51,6 +46,7 @@ public class GroupProvisionProcessor implements Processor { public void process(final Exchange exchange) { Long key = exchange.getIn().getBody(Long.class); List<String> resources = exchange.getProperty("resources", List.class); + Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class); PropagationByResource propByRes = new PropagationByResource(); propByRes.addAll(ResourceOperation.UPDATE, resources); @@ -65,12 +61,7 @@ public class GroupProvisionProcessor implements Processor { null); PropagationReporter propagationReporter = ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - try { - taskExecutor.execute(tasks, propagationReporter); - } catch (PropagationException e) { - LOG.error("Error propagation primary resource", e); - propagationReporter.onPrimaryResourceFailure(tasks); - } + taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync); exchange.getOut().setBody(propagationReporter.getStatuses()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java index 599f54b..18aeac2 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java @@ -29,7 +29,6 @@ import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; import org.apache.syncope.core.provisioning.api.VirAttrHandler; import org.apache.syncope.core.provisioning.api.WorkflowResult; -import org.apache.syncope.core.provisioning.api.propagation.PropagationException; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; @@ -58,6 +57,7 @@ public class GroupUpdateProcessor implements Processor { WorkflowResult<Long> updated = (WorkflowResult) exchange.getIn().getBody(); GroupPatch groupPatch = exchange.getProperty("anyPatch", GroupPatch.class); Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class); + Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class); List<PropagationTask> tasks = propagationManager.getUpdateTasks( AnyTypeKind.GROUP, @@ -69,12 +69,7 @@ public class GroupUpdateProcessor implements Processor { excludedResources); PropagationReporter propagationReporter = ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - try { - taskExecutor.execute(tasks, propagationReporter); - } catch (PropagationException e) { - LOG.error("Error propagation primary resource", e); - propagationReporter.onPrimaryResourceFailure(tasks); - } + taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync); exchange.getOut().setBody(new ImmutablePair<>(updated.getResult(), propagationReporter.getStatuses())); } http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java index 8a19609..05b2e75 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java @@ -26,20 +26,15 @@ import org.apache.syncope.common.lib.patch.UserPatch; import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; import org.apache.syncope.core.provisioning.api.WorkflowResult; -import org.apache.syncope.core.provisioning.api.propagation.PropagationException; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class UserConfirmPwdResetProcessor implements Processor { - private static final Logger LOG = LoggerFactory.getLogger(UserConfirmPwdResetProcessor.class); - @Autowired protected PropagationManager propagationManager; @@ -55,11 +50,6 @@ public class UserConfirmPwdResetProcessor implements Processor { PropagationReporter propReporter = ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - try { - taskExecutor.execute(tasks, propReporter); - } catch (PropagationException e) { - LOG.error("Error propagation primary resource", e); - propReporter.onPrimaryResourceFailure(tasks); - } + taskExecutor.execute(tasks, propReporter, false); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java index 1a9dd72..51b8e83 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java @@ -28,7 +28,6 @@ import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; import org.apache.syncope.core.provisioning.api.WorkflowResult; -import org.apache.syncope.core.provisioning.api.propagation.PropagationException; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; @@ -55,6 +54,7 @@ public class UserCreateProcessor implements Processor { WorkflowResult<Pair<Long, Boolean>> created = (WorkflowResult) exchange.getIn().getBody(); UserTO actual = exchange.getProperty("actual", UserTO.class); Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class); + Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class); List<PropagationTask> tasks = propagationManager.getUserCreateTasks( created.getResult().getKey(), @@ -65,12 +65,7 @@ public class UserCreateProcessor implements Processor { excludedResources); PropagationReporter propagationReporter = ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - try { - taskExecutor.execute(tasks, propagationReporter); - } catch (PropagationException e) { - LOG.error("Error propagation primary resource {}", e); - propagationReporter.onPrimaryResourceFailure(tasks); - } + taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync); exchange.getOut().setBody( new ImmutablePair<>(created.getResult().getKey(), propagationReporter.getStatuses())); http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java index 5838e01..328b091 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java @@ -28,20 +28,15 @@ import org.apache.syncope.common.lib.types.ResourceOperation; import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.persistence.api.dao.UserDAO; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; -import org.apache.syncope.core.provisioning.api.propagation.PropagationException; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class UserDeleteProcessor implements Processor { - private static final Logger LOG = LoggerFactory.getLogger(UserDeleteProcessor.class); - @Autowired protected UserDAO userDAO; @@ -56,6 +51,7 @@ public class UserDeleteProcessor implements Processor { public void process(final Exchange exchange) throws Exception { Long key = (Long) exchange.getIn().getBody(); Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class); + Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class); PropagationByResource propByRes = new PropagationByResource(); propByRes.set(ResourceOperation.DELETE, userDAO.findAllResourceNames(userDAO.authFind(key))); @@ -73,12 +69,7 @@ public class UserDeleteProcessor implements Processor { PropagationReporter propagationReporter = ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - try { - taskExecutor.execute(tasks, propagationReporter); - } catch (PropagationException e) { - LOG.error("Error propagation primary resource", e); - propagationReporter.onPrimaryResourceFailure(tasks); - } + taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync); exchange.setProperty("statuses", propagationReporter.getStatuses()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java index 522af51..2438f17 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java @@ -28,20 +28,15 @@ import org.apache.syncope.common.lib.types.ResourceOperation; import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.persistence.api.dao.UserDAO; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; -import org.apache.syncope.core.provisioning.api.propagation.PropagationException; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class UserDeprovisionProcessor implements Processor { - private static final Logger LOG = LoggerFactory.getLogger(UserDeprovisionProcessor.class); - @Autowired protected PropagationManager propagationManager; @@ -56,6 +51,7 @@ public class UserDeprovisionProcessor implements Processor { Long key = exchange.getIn().getBody(Long.class); @SuppressWarnings("unchecked") List<String> resources = exchange.getProperty("resources", List.class); + Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class); PropagationByResource propByRes = new PropagationByResource(); propByRes.set(ResourceOperation.DELETE, resources); @@ -67,12 +63,7 @@ public class UserDeprovisionProcessor implements Processor { CollectionUtils.removeAll(userDAO.findAllResourceNames(userDAO.authFind(key)), resources)); PropagationReporter propagationReporter = ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - try { - taskExecutor.execute(tasks, propagationReporter); - } catch (PropagationException e) { - LOG.error("Error propagation primary resource", e); - propagationReporter.onPrimaryResourceFailure(tasks); - } + taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync); exchange.getOut().setBody(propagationReporter.getStatuses()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserProvisionProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserProvisionProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserProvisionProcessor.java index 04c9ac9..324d54c 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserProvisionProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserProvisionProcessor.java @@ -35,20 +35,15 @@ import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.persistence.api.dao.UserDAO; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; import org.apache.syncope.core.provisioning.api.WorkflowResult; -import org.apache.syncope.core.provisioning.api.propagation.PropagationException; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class UserProvisionProcessor implements Processor { - private static final Logger LOG = LoggerFactory.getLogger(UserProvisionProcessor.class); - @Autowired protected PropagationManager propagationManager; @@ -65,6 +60,7 @@ public class UserProvisionProcessor implements Processor { String password = exchange.getProperty("password", String.class); @SuppressWarnings("unchecked") List<String> resources = exchange.getProperty("resources", List.class); + Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class); UserPatch userPatch = new UserPatch(); userPatch.setKey(key); @@ -92,12 +88,7 @@ public class UserProvisionProcessor implements Processor { List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(wfResult, changePwd, null); PropagationReporter propagationReporter = ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - try { - taskExecutor.execute(tasks, propagationReporter); - } catch (PropagationException e) { - LOG.error("Error propagation primary resource", e); - propagationReporter.onPrimaryResourceFailure(tasks); - } + taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync); exchange.getOut().setBody(propagationReporter.getStatuses()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java index fbe4c20..ead8d4f 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java @@ -44,7 +44,7 @@ public class UserSetStatusInSyncProcessor implements Processor { WorkflowResult<Map.Entry<UserPatch, Boolean>> updated = (WorkflowResult) exchange.getIn().getBody(); Boolean enabled = exchange.getProperty("enabled", Boolean.class); - Long key = exchange.getProperty("userKey", Long.class); + Long key = exchange.getProperty("key", Long.class); if (enabled != null) { User user = userDAO.find(key); http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java index 068f003..4877140 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java @@ -31,20 +31,15 @@ import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.persistence.api.dao.UserDAO; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; import org.apache.syncope.core.provisioning.api.WorkflowResult; -import org.apache.syncope.core.provisioning.api.propagation.PropagationException; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class UserStatusPropagationProcessor implements Processor { - private static final Logger LOG = LoggerFactory.getLogger(UserStatusPropagationProcessor.class); - @Autowired protected PropagationManager propagationManager; @@ -58,8 +53,8 @@ public class UserStatusPropagationProcessor implements Processor { @Override public void process(final Exchange exchange) { WorkflowResult<Long> updated = (WorkflowResult) exchange.getIn().getBody(); - StatusPatch statusPatch = exchange.getProperty("statusPatch", StatusPatch.class); + Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class); PropagationByResource propByRes = new PropagationByResource(); propByRes.addAll(ResourceOperation.UPDATE, statusPatch.getResources()); @@ -74,12 +69,7 @@ public class UserStatusPropagationProcessor implements Processor { PropagationReporter propReporter = ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - try { - taskExecutor.execute(tasks, propReporter); - } catch (PropagationException e) { - LOG.error("Error propagation primary resource", e); - propReporter.onPrimaryResourceFailure(tasks); - } + taskExecutor.execute(tasks, propReporter, nullPriorityAsync); exchange.getOut().setBody(new ImmutablePair<>(updated.getResult(), propReporter.getStatuses())); } http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java index 8b49a5d..6c1d3a3 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java @@ -28,7 +28,6 @@ import org.apache.syncope.common.lib.patch.UserPatch; import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; import org.apache.syncope.core.provisioning.api.WorkflowResult; -import org.apache.syncope.core.provisioning.api.propagation.PropagationException; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; @@ -53,17 +52,13 @@ public class UserUpdateInSyncProcessor implements Processor { public void process(final Exchange exchange) { WorkflowResult<Pair<UserPatch, Boolean>> updated = (WorkflowResult) exchange.getIn().getBody(); Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class); + Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class); List<PropagationTask> tasks = propagationManager.getUserUpdateTasks( updated, updated.getResult().getKey().getPassword() != null, excludedResources); PropagationReporter propagationReporter = ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - try { - taskExecutor.execute(tasks, propagationReporter); - } catch (PropagationException e) { - LOG.error("Error propagation primary resource", e); - propagationReporter.onPrimaryResourceFailure(tasks); - } + taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync); exchange.getOut().setBody(new ImmutablePair<>( updated.getResult().getKey().getKey(), propagationReporter.getStatuses())); http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java index 8f175dd..57233a6 100644 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java @@ -28,20 +28,15 @@ import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.persistence.api.entity.task.PropagationTask; import org.apache.syncope.core.provisioning.api.VirAttrHandler; import org.apache.syncope.core.provisioning.api.WorkflowResult; -import org.apache.syncope.core.provisioning.api.propagation.PropagationException; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class UserUpdateProcessor implements Processor { - private static final Logger LOG = LoggerFactory.getLogger(UserUpdateProcessor.class); - @Autowired protected PropagationManager propagationManager; @@ -55,16 +50,12 @@ public class UserUpdateProcessor implements Processor { @SuppressWarnings("unchecked") public void process(final Exchange exchange) { WorkflowResult<Pair<UserPatch, Boolean>> updated = (WorkflowResult) exchange.getIn().getBody(); + Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class); List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(updated); PropagationReporter propagationReporter = ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - try { - taskExecutor.execute(tasks, propagationReporter); - } catch (PropagationException e) { - LOG.error("Error propagation primary resource", e); - propagationReporter.onPrimaryResourceFailure(tasks); - } + taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync); exchange.getOut().setBody(new ImmutablePair<>( updated.getResult().getKey().getKey(), propagationReporter.getStatuses())); http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/resources/provisioning.properties ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/resources/provisioning.properties b/ext/camel/provisioning-camel/src/main/resources/provisioning.properties index ab3b256..41f21ad 100644 --- a/ext/camel/provisioning-camel/src/main/resources/provisioning.properties +++ b/ext/camel/provisioning-camel/src/main/resources/provisioning.properties @@ -17,6 +17,10 @@ camel.directory=${conf.directory} asyncConnectorFacadeExecutor.poolSize=10 + +# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor +propagationTaskExecutorAsyncExecutor.poolSize=5-25 +propagationTaskExecutorAsyncExecutor.queueCapacity=100 propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor userProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelUserProvisioningManager http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/resources/userRoutes.xml ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/resources/userRoutes.xml b/ext/camel/provisioning-camel/src/main/resources/userRoutes.xml index 38e48f3..cbf2902 100644 --- a/ext/camel/provisioning-camel/src/main/resources/userRoutes.xml +++ b/ext/camel/provisioning-camel/src/main/resources/userRoutes.xml @@ -232,7 +232,7 @@ under the License. <route id="confirmPwdReset"> <from uri="direct:confirmPwdReset"/> <doTry> - <bean ref="uwfAdapter" method="confirmPasswordReset(${property.userKey},${property.token},${property.password})"/> + <bean ref="uwfAdapter" method="confirmPasswordReset(${property.key},${property.token},${property.password})"/> <process ref="userConfirmPwdResetProcessor"/> <to uri="direct:confirmPwdResetPort"/> <doCatch> http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/main/resources/all/provisioning.properties ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/main/resources/all/provisioning.properties b/fit/core-reference/src/main/resources/all/provisioning.properties index 9c979a2..8147828 100644 --- a/fit/core-reference/src/main/resources/all/provisioning.properties +++ b/fit/core-reference/src/main/resources/all/provisioning.properties @@ -17,6 +17,10 @@ camel.directory=${conf.directory} asyncConnectorFacadeExecutor.poolSize=10 + +# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor +propagationTaskExecutorAsyncExecutor.poolSize=5-25 +propagationTaskExecutorAsyncExecutor.queueCapacity=100 propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor userProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelUserProvisioningManager http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/main/resources/mariadb/provisioning.properties ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/main/resources/mariadb/provisioning.properties b/fit/core-reference/src/main/resources/mariadb/provisioning.properties index ca365dc..5b6539d 100644 --- a/fit/core-reference/src/main/resources/mariadb/provisioning.properties +++ b/fit/core-reference/src/main/resources/mariadb/provisioning.properties @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. asyncConnectorFacadeExecutor.poolSize=10 + +# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor +propagationTaskExecutorAsyncExecutor.poolSize=5-25 +propagationTaskExecutorAsyncExecutor.queueCapacity=100 propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/main/resources/mysql/provisioning.properties ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/main/resources/mysql/provisioning.properties b/fit/core-reference/src/main/resources/mysql/provisioning.properties index 428be67..acb8a8a 100644 --- a/fit/core-reference/src/main/resources/mysql/provisioning.properties +++ b/fit/core-reference/src/main/resources/mysql/provisioning.properties @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. asyncConnectorFacadeExecutor.poolSize=10 + +# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor +propagationTaskExecutorAsyncExecutor.poolSize=5-25 +propagationTaskExecutorAsyncExecutor.queueCapacity=100 propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/main/resources/oracle/provisioning.properties ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/main/resources/oracle/provisioning.properties b/fit/core-reference/src/main/resources/oracle/provisioning.properties index a507de0..a71d41e 100644 --- a/fit/core-reference/src/main/resources/oracle/provisioning.properties +++ b/fit/core-reference/src/main/resources/oracle/provisioning.properties @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. asyncConnectorFacadeExecutor.poolSize=10 + +# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor +propagationTaskExecutorAsyncExecutor.poolSize=5-25 +propagationTaskExecutorAsyncExecutor.queueCapacity=100 propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/main/resources/postgres/provisioning.properties ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/main/resources/postgres/provisioning.properties b/fit/core-reference/src/main/resources/postgres/provisioning.properties index 1be02bf..4b578ba 100644 --- a/fit/core-reference/src/main/resources/postgres/provisioning.properties +++ b/fit/core-reference/src/main/resources/postgres/provisioning.properties @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. asyncConnectorFacadeExecutor.poolSize=10 + +# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor +propagationTaskExecutorAsyncExecutor.poolSize=5-25 +propagationTaskExecutorAsyncExecutor.queueCapacity=100 propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/main/resources/provisioning.properties ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/main/resources/provisioning.properties b/fit/core-reference/src/main/resources/provisioning.properties index a14ae19..dae8ca8 100644 --- a/fit/core-reference/src/main/resources/provisioning.properties +++ b/fit/core-reference/src/main/resources/provisioning.properties @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. asyncConnectorFacadeExecutor.poolSize=10 + +# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor +propagationTaskExecutorAsyncExecutor.poolSize=5-25 +propagationTaskExecutorAsyncExecutor.queueCapacity=100 propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/main/resources/sqlserver/provisioning.properties ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/main/resources/sqlserver/provisioning.properties b/fit/core-reference/src/main/resources/sqlserver/provisioning.properties index 4cb4b80..510eae0 100644 --- a/fit/core-reference/src/main/resources/sqlserver/provisioning.properties +++ b/fit/core-reference/src/main/resources/sqlserver/provisioning.properties @@ -15,6 +15,10 @@ # specific language governing permissions and limitations # under the License. asyncConnectorFacadeExecutor.poolSize=10 + +# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor +propagationTaskExecutorAsyncExecutor.poolSize=5-25 +propagationTaskExecutorAsyncExecutor.queueCapacity=100 propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java index 3e4381d..9aaf034 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java @@ -30,6 +30,7 @@ import javax.naming.Context; import javax.naming.NamingException; import javax.naming.directory.InitialDirContext; import javax.sql.DataSource; +import javax.ws.rs.core.GenericType; import javax.ws.rs.core.Response; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; @@ -46,6 +47,7 @@ import org.apache.syncope.common.lib.to.AnyObjectTO; import org.apache.syncope.common.lib.to.AttrTO; import org.apache.syncope.common.lib.to.ResourceTO; import org.apache.syncope.common.lib.to.GroupTO; +import org.apache.syncope.common.lib.to.ProvisioningResult; import org.apache.syncope.common.lib.to.RoleTO; import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.common.lib.types.ConnConfProperty; @@ -274,34 +276,6 @@ public abstract class AbstractITCase { return new AttrPatch.Builder().operation(PatchOperation.ADD_REPLACE).attrTO(attrTO(schema, value)).build(); } - protected UserTO createUser(final UserTO userTO) { - return createUser(userTO, true); - } - - protected UserTO createUser(final UserTO userTO, final boolean storePassword) { - Response response = userService.create(userTO, storePassword); - if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) { - Exception ex = clientFactory.getExceptionMapper().fromResponse(response); - if (ex != null) { - throw (RuntimeException) ex; - } - } - return response.readEntity(UserTO.class); - } - - protected UserTO readUser(final String username) { - return userService.read(Long.valueOf( - userService.getUserKey(username).getHeaderString(RESTHeaders.USER_KEY))); - } - - protected UserTO updateUser(final UserPatch userPatch) { - return userService.update(userPatch).readEntity(UserTO.class); - } - - protected UserTO deleteUser(final Long key) { - return userService.delete(key).readEntity(UserTO.class); - } - public <T> T getObject(final URI location, final Class<?> serviceClass, final Class<T> resultClass) { WebClient webClient = WebClient.fromClient(WebClient.client(adminClient.getService(serviceClass))); webClient.accept(clientFactory.getContentType().getMediaType()).to(location.toASCIIString(), false); @@ -333,7 +307,39 @@ public abstract class AbstractITCase { return getObject(response.getLocation(), RoleService.class, RoleTO.class); } - protected AnyObjectTO createAnyObject(final AnyObjectTO anyObjectTO) { + protected UserTO readUser(final String username) { + return userService.read(Long.valueOf(userService.getUserKey(username).getHeaderString(RESTHeaders.USER_KEY))); + } + + protected ProvisioningResult<UserTO> createUser(final UserTO userTO) { + return createUser(userTO, true); + } + + protected ProvisioningResult<UserTO> createUser(final UserTO userTO, final boolean storePassword) { + Response response = userService.create(userTO, storePassword); + if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) { + Exception ex = clientFactory.getExceptionMapper().fromResponse(response); + if (ex != null) { + throw (RuntimeException) ex; + } + } + return response.readEntity(new GenericType<ProvisioningResult<UserTO>>() { + }); + } + + protected ProvisioningResult<UserTO> updateUser(final UserPatch userPatch) { + return userService.update(userPatch). + readEntity(new GenericType<ProvisioningResult<UserTO>>() { + }); + } + + protected ProvisioningResult<UserTO> deleteUser(final Long key) { + return userService.delete(key). + readEntity(new GenericType<ProvisioningResult<UserTO>>() { + }); + } + + protected ProvisioningResult<AnyObjectTO> createAnyObject(final AnyObjectTO anyObjectTO) { Response response = anyObjectService.create(anyObjectTO); if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) { Exception ex = clientFactory.getExceptionMapper().fromResponse(response); @@ -341,18 +347,23 @@ public abstract class AbstractITCase { throw (RuntimeException) ex; } } - return response.readEntity(AnyObjectTO.class); + return response.readEntity(new GenericType<ProvisioningResult<AnyObjectTO>>() { + }); } - protected AnyObjectTO updateAnyObject(final AnyObjectPatch anyObjectPatch) { - return anyObjectService.update(anyObjectPatch).readEntity(AnyObjectTO.class); + protected ProvisioningResult<AnyObjectTO> updateAnyObject(final AnyObjectPatch anyObjectPatch) { + return anyObjectService.update(anyObjectPatch). + readEntity(new GenericType<ProvisioningResult<AnyObjectTO>>() { + }); } - protected AnyObjectTO deleteAnyObject(final Long key) { - return anyObjectService.delete(key).readEntity(AnyObjectTO.class); + protected ProvisioningResult<AnyObjectTO> deleteAnyObject(final Long key) { + return anyObjectService.delete(key). + readEntity(new GenericType<ProvisioningResult<AnyObjectTO>>() { + }); } - protected GroupTO createGroup(final GroupTO groupTO) { + protected ProvisioningResult<GroupTO> createGroup(final GroupTO groupTO) { Response response = groupService.create(groupTO); if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) { Exception ex = clientFactory.getExceptionMapper().fromResponse(response); @@ -360,15 +371,20 @@ public abstract class AbstractITCase { throw (RuntimeException) ex; } } - return response.readEntity(GroupTO.class); + return response.readEntity(new GenericType<ProvisioningResult<GroupTO>>() { + }); } - protected GroupTO updateGroup(final GroupPatch groupPatch) { - return groupService.update(groupPatch).readEntity(GroupTO.class); + protected ProvisioningResult<GroupTO> updateGroup(final GroupPatch groupPatch) { + return groupService.update(groupPatch). + readEntity(new GenericType<ProvisioningResult<GroupTO>>() { + }); } - protected GroupTO deleteGroup(final Long key) { - return groupService.delete(key).readEntity(GroupTO.class); + protected ProvisioningResult<GroupTO> deleteGroup(final Long key) { + return groupService.delete(key). + readEntity(new GenericType<ProvisioningResult<GroupTO>>() { + }); } @SuppressWarnings("unchecked") http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AnyObjectITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AnyObjectITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AnyObjectITCase.java index 5474744..78bb011 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AnyObjectITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AnyObjectITCase.java @@ -57,7 +57,7 @@ public class AnyObjectITCase extends AbstractITCase { public void create() { AnyObjectTO anyObjectTO = getSampleTO("create"); - anyObjectTO = createAnyObject(anyObjectTO); + anyObjectTO = createAnyObject(anyObjectTO).getAny(); assertNotNull(anyObjectTO); ConnObjectTO connObjectTO = @@ -78,10 +78,10 @@ public class AnyObjectITCase extends AbstractITCase { AnyObjectTO anyObjectTO = getSampleTO("deletable"); anyObjectTO.setRealm("/even"); - anyObjectTO = createAnyObject(anyObjectTO); + anyObjectTO = createAnyObject(anyObjectTO).getAny(); assertNotNull(anyObjectTO); - AnyObjectTO deletedAnyObject = deleteAnyObject(anyObjectTO.getKey()); + AnyObjectTO deletedAnyObject = deleteAnyObject(anyObjectTO.getKey()).getAny(); assertNotNull(deletedAnyObject); try { @@ -113,7 +113,7 @@ public class AnyObjectITCase extends AbstractITCase { @Test public void update() { AnyObjectTO anyObjectTO = getSampleTO("update"); - anyObjectTO = createAnyObject(anyObjectTO); + anyObjectTO = createAnyObject(anyObjectTO).getAny(); assertEquals(1, anyObjectTO.getPlainAttrs().size()); @@ -122,7 +122,7 @@ public class AnyObjectITCase extends AbstractITCase { String newLocation = "new" + getUUIDString(); anyObjectPatch.getPlainAttrs().add(attrAddReplacePatch("location", newLocation)); - anyObjectTO = updateAnyObject(anyObjectPatch); + anyObjectTO = updateAnyObject(anyObjectPatch).getAny(); assertEquals(newLocation, anyObjectTO.getPlainAttrMap().get("location").getValues().get(0)); } @@ -130,7 +130,7 @@ public class AnyObjectITCase extends AbstractITCase { @Test public void readAttrs() { AnyObjectTO anyObjectTO = getSampleTO("readAttrs"); - anyObjectTO = createAnyObject(anyObjectTO); + anyObjectTO = createAnyObject(anyObjectTO).getAny(); assertNotNull(anyObjectTO); Set<AttrTO> attrs = anyObjectService.read(anyObjectTO.getKey(), SchemaType.PLAIN); @@ -143,7 +143,7 @@ public class AnyObjectITCase extends AbstractITCase { @Test public void updateAttr() { AnyObjectTO anyObjectTO = getSampleTO("updateAttr"); - anyObjectTO = createAnyObject(anyObjectTO); + anyObjectTO = createAnyObject(anyObjectTO).getAny(); assertNotNull(anyObjectTO); AttrTO updated = attrTO("location", "newlocation"); @@ -156,7 +156,7 @@ public class AnyObjectITCase extends AbstractITCase { @Test public void deleteAttr() { AnyObjectTO anyObjectTO = getSampleTO("deleteAttr"); - anyObjectTO = createAnyObject(anyObjectTO); + anyObjectTO = createAnyObject(anyObjectTO).getAny(); assertNotNull(anyObjectTO); assertNotNull(anyObjectTO.getPlainAttrMap().get("location")); http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java index 262d34e..e5cf78b 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java @@ -28,6 +28,7 @@ import java.security.AccessControlException; import java.util.HashSet; import java.util.Map; import java.util.Set; +import javax.ws.rs.core.GenericType; import javax.ws.rs.core.Response; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.Predicate; @@ -45,6 +46,7 @@ import org.apache.syncope.common.lib.to.BulkActionResult; import org.apache.syncope.common.lib.to.MembershipTO; import org.apache.syncope.common.lib.to.PagedResult; import org.apache.syncope.common.lib.to.PlainSchemaTO; +import org.apache.syncope.common.lib.to.ProvisioningResult; import org.apache.syncope.common.lib.to.RoleTO; import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.common.lib.to.WorkflowFormPropertyTO; @@ -140,7 +142,7 @@ public class AuthenticationITCase extends AbstractITCase { UserTO userTO = UserITCase.getUniqueSampleTO("a...@test.org"); userTO.getRoles().add(roleTO.getKey()); - userTO = createUser(userTO); + userTO = createUser(userTO).getAny(); assertNotNull(userTO); // 3. read the schema created above (as admin) - success @@ -170,7 +172,7 @@ public class AuthenticationITCase extends AbstractITCase { UserTO userTO = UserITCase.getUniqueSampleTO("testuserr...@test.org"); userTO.getRoles().add(2L); - userTO = createUser(userTO); + userTO = createUser(userTO).getAny(); assertNotNull(userTO); UserService userService2 = clientFactory.create(userTO.getUsername(), "password123"). @@ -195,7 +197,7 @@ public class AuthenticationITCase extends AbstractITCase { UserTO userTO = UserITCase.getUniqueSampleTO("testusersea...@test.org"); userTO.getRoles().add(1L); - userTO = createUser(userTO); + userTO = createUser(userTO).getAny(); assertNotNull(userTO); // 1. user assigned to role 1, with search entitlement on realms /odd and /even: won't find anything with @@ -257,7 +259,7 @@ public class AuthenticationITCase extends AbstractITCase { // 2. as admin, create delegated admin user, and assign the role just created UserTO delegatedAdmin = UserITCase.getUniqueSampleTO("ad...@syncope.apache.org"); delegatedAdmin.getRoles().add(roleKey); - delegatedAdmin = createUser(delegatedAdmin); + delegatedAdmin = createUser(delegatedAdmin).getAny(); delegatedAdminKey = delegatedAdmin.getKey(); // 3. instantiate a delegate user service client, for further operatins @@ -279,7 +281,8 @@ public class AuthenticationITCase extends AbstractITCase { Response response = delegatedUserService.create(user); assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); - user = response.readEntity(UserTO.class); + user = response.readEntity(new GenericType<ProvisioningResult<UserTO>>() { + }).getAny(); assertEquals("surname", user.getPlainAttrMap().get("surname").getValues().get(0)); // 5. as delegated, update user attempting to move under realm / -> fail @@ -301,7 +304,8 @@ public class AuthenticationITCase extends AbstractITCase { response = delegatedUserService.update(userPatch); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); - user = response.readEntity(UserTO.class); + user = response.readEntity(new GenericType<ProvisioningResult<UserTO>>() { + }).getAny(); assertEquals("surname2", user.getPlainAttrMap().get("surname").getValues().get(0)); // 7. as delegated, delete user @@ -328,7 +332,7 @@ public class AuthenticationITCase extends AbstractITCase { UserTO userTO = UserITCase.getUniqueSampleTO("checkfailedlo...@syncope.apache.org"); userTO.getRoles().add(2L); - userTO = createUser(userTO); + userTO = createUser(userTO).getAny(); assertNotNull(userTO); long userId = userTO.getKey(); @@ -354,7 +358,7 @@ public class AuthenticationITCase extends AbstractITCase { userTO.setRealm("/odd"); userTO.getRoles().add(2L); - userTO = createUser(userTO); + userTO = createUser(userTO).getAny(); long userKey = userTO.getKey(); assertNotNull(userTO); @@ -384,7 +388,8 @@ public class AuthenticationITCase extends AbstractITCase { StatusPatch reactivate = new StatusPatch(); reactivate.setKey(userTO.getKey()); reactivate.setType(StatusPatchType.REACTIVATE); - userTO = userService.status(reactivate).readEntity(UserTO.class); + userTO = userService.status(reactivate).readEntity(new GenericType<ProvisioningResult<UserTO>>() { + }).getAny(); assertNotNull(userTO); assertEquals("active", userTO.getStatus()); @@ -399,7 +404,7 @@ public class AuthenticationITCase extends AbstractITCase { UserTO userTO = UserITCase.getUniqueSampleTO("createwithrej...@syncope.apache.org"); userTO.getMemberships().add(new MembershipTO.Builder().group(9L).build()); - userTO = createUser(userTO); + userTO = createUser(userTO).getAny(); assertNotNull(userTO); assertEquals("createApproval", userTO.getStatus()); @@ -437,7 +442,7 @@ public class AuthenticationITCase extends AbstractITCase { user.setRealm("/even/two"); user.setPassword("password123"); user.getResources().add(RESOURCE_NAME_TESTDB); - user = createUser(user); + user = createUser(user).getAny(); assertNotNull(user); // 2. unlink the resource from the created user @@ -451,7 +456,7 @@ public class AuthenticationITCase extends AbstractITCase { UserPatch userPatch = new UserPatch(); userPatch.setKey(user.getKey()); userPatch.setPassword(new PasswordPatch.Builder().value("password234").build()); - user = updateUser(userPatch); + user = updateUser(userPatch).getAny(); assertNotNull(user); // 4. check that the db resource has still the initial password value http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java index 4ddcaa3..7b18109 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java @@ -164,7 +164,7 @@ public class CamelRouteITCase extends AbstractITCase { userTO.getPlainAttrs().add(attrTO("surname", userId)); userTO.getPlainAttrs().add(attrTO("camelAttribute", "false")); - userTO = createUser(userTO); + userTO = createUser(userTO).getAny(); assertNotNull(userTO); assertEquals("true", CollectionUtils.get(userTO.getPlainAttrs(), 3).getValues().get(0)); } finally { http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java index 17ba8c8..3ddb2c8 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java @@ -34,6 +34,7 @@ import javax.naming.NamingException; import javax.naming.directory.DirContext; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; +import javax.ws.rs.core.GenericType; import javax.ws.rs.core.Response; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.Predicate; @@ -61,6 +62,7 @@ import org.apache.syncope.common.lib.to.ResourceTO; import org.apache.syncope.common.lib.to.GroupTO; import org.apache.syncope.common.lib.to.MappingTO; import org.apache.syncope.common.lib.to.ProvisionTO; +import org.apache.syncope.common.lib.to.ProvisioningResult; import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.lib.types.AttrSchemaType; @@ -85,7 +87,7 @@ public class GroupITCase extends AbstractITCase { public static GroupTO getBasicSampleTO(final String name) { GroupTO groupTO = new GroupTO(); - groupTO.setRealm("/"); + groupTO.setRealm(SyncopeConstants.ROOT_REALM); groupTO.setName(name + getUUIDString()); return groupTO; } @@ -105,7 +107,7 @@ public class GroupITCase extends AbstractITCase { groupTO.getVirAttrs().add(attrTO("rvirtualdata", "rvirtualvalue")); groupTO.setGroupOwner(8L); - groupTO = createGroup(groupTO); + groupTO = createGroup(groupTO).getAny(); assertNotNull(groupTO); assertNotNull(groupTO.getVirAttrMap()); @@ -125,7 +127,7 @@ public class GroupITCase extends AbstractITCase { groupPatch.setKey(groupTO.getKey()); groupPatch.setGroupOwner(new LongReplacePatchItem()); - assertNull(updateGroup(groupPatch).getGroupOwner()); + assertNull(updateGroup(groupPatch).getAny().getGroupOwner()); } @Test @@ -142,10 +144,10 @@ public class GroupITCase extends AbstractITCase { groupTO.getResources().add(RESOURCE_NAME_LDAP); - groupTO = createGroup(groupTO); + groupTO = createGroup(groupTO).getAny(); assertNotNull(groupTO); - GroupTO deletedGroup = deleteGroup(groupTO.getKey()); + GroupTO deletedGroup = deleteGroup(groupTO.getKey()).getAny(); assertNotNull(deletedGroup); try { @@ -206,7 +208,7 @@ public class GroupITCase extends AbstractITCase { @Test public void update() { GroupTO groupTO = getSampleTO("latestGroup" + getUUIDString()); - groupTO = createGroup(groupTO); + groupTO = createGroup(groupTO).getAny(); assertEquals(1, groupTO.getPlainAttrs().size()); @@ -216,7 +218,7 @@ public class GroupITCase extends AbstractITCase { groupPatch.setName(new StringReplacePatchItem.Builder().value(modName).build()); groupPatch.getPlainAttrs().add(attrAddReplacePatch("show", "FALSE")); - groupTO = updateGroup(groupPatch); + groupTO = updateGroup(groupPatch).getAny(); assertEquals(modName, groupTO.getName()); assertEquals(2, groupTO.getPlainAttrs().size()); @@ -227,7 +229,7 @@ public class GroupITCase extends AbstractITCase { GroupTO groupTO = getBasicSampleTO("withderived" + getUUIDString()); groupTO.getDerAttrs().add(attrTO("rderivedschema", null)); - groupTO = createGroup(groupTO); + groupTO = createGroup(groupTO).getAny(); assertNotNull(groupTO); assertEquals(1, groupTO.getDerAttrs().size()); @@ -238,7 +240,7 @@ public class GroupITCase extends AbstractITCase { attrTO(new AttrTO.Builder().schema("rderivedschema").build()). build()); - groupTO = updateGroup(groupPatch); + groupTO = updateGroup(groupPatch).getAny(); assertNotNull(groupTO); assertTrue(groupTO.getDerAttrs().isEmpty()); } @@ -274,7 +276,8 @@ public class GroupITCase extends AbstractITCase { // 4. update as puccini, owner of group 6 - success GroupService groupService3 = clientFactory.create("puccini", ADMIN_PWD).getService(GroupService.class); - groupTO = groupService3.update(groupPatch).readEntity(GroupTO.class); + groupTO = groupService3.update(groupPatch).readEntity(new GenericType<ProvisioningResult<GroupTO>>() { + }).getAny(); assertEquals("Director", groupTO.getName()); // issue SYNCOPE-15 @@ -292,7 +295,7 @@ public class GroupITCase extends AbstractITCase { groupTO.setName(groupName); groupTO.setRealm("/"); - GroupTO actual = createGroup(groupTO); + GroupTO actual = createGroup(groupTO).getAny(); assertNotNull(actual); assertEquals(groupName, actual.getName()); @@ -302,14 +305,14 @@ public class GroupITCase extends AbstractITCase { String renamedGroup = "renamed" + getUUIDString(); groupPatch.setName(new StringReplacePatchItem.Builder().value(renamedGroup).build()); - actual = updateGroup(groupPatch); + actual = updateGroup(groupPatch).getAny(); assertNotNull(actual); assertEquals(renamedGroup, actual.getName()); } @Test public void unlink() { - GroupTO actual = createGroup(getSampleTO("unlink")); + GroupTO actual = createGroup(getSampleTO("unlink")).getAny(); assertNotNull(actual); assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey())); @@ -333,7 +336,7 @@ public class GroupITCase extends AbstractITCase { GroupTO groupTO = getSampleTO("link"); groupTO.getResources().clear(); - GroupTO actual = createGroup(groupTO); + GroupTO actual = createGroup(groupTO).getAny(); assertNotNull(actual); try { @@ -363,7 +366,7 @@ public class GroupITCase extends AbstractITCase { @Test public void unassign() { - GroupTO actual = createGroup(getSampleTO("unassign")); + GroupTO actual = createGroup(getSampleTO("unassign")).getAny(); assertNotNull(actual); assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey())); @@ -392,7 +395,7 @@ public class GroupITCase extends AbstractITCase { GroupTO groupTO = getSampleTO("assign"); groupTO.getResources().clear(); - GroupTO actual = createGroup(groupTO); + GroupTO actual = createGroup(groupTO).getAny(); assertNotNull(actual); try { @@ -416,7 +419,7 @@ public class GroupITCase extends AbstractITCase { @Test public void deprovision() { - GroupTO actual = createGroup(getSampleTO("deprovision")); + GroupTO actual = createGroup(getSampleTO("deprovision")).getAny(); assertNotNull(actual); assertNotNull(actual.getKey()); @@ -446,7 +449,7 @@ public class GroupITCase extends AbstractITCase { GroupTO groupTO = getSampleTO("assign" + getUUIDString()); groupTO.getResources().clear(); - GroupTO actual = createGroup(groupTO); + GroupTO actual = createGroup(groupTO).getAny(); assertNotNull(actual); try { @@ -474,7 +477,7 @@ public class GroupITCase extends AbstractITCase { GroupTO groupTO = getSampleTO("assign" + getUUIDString()); groupTO.getResources().clear(); - GroupTO actual = createGroup(groupTO); + GroupTO actual = createGroup(groupTO).getAny(); assertNotNull(actual); try { @@ -526,7 +529,7 @@ public class GroupITCase extends AbstractITCase { // 2. create a group *without* an attribute for that schema: it works GroupTO groupTO = getSampleTO("lastGroup"); assertFalse(groupTO.getPlainAttrMap().containsKey(badge.getKey())); - groupTO = createGroup(groupTO); + groupTO = createGroup(groupTO).getAny(); assertNotNull(groupTO); assertFalse(groupTO.getPlainAttrMap().containsKey(badge.getKey())); @@ -554,7 +557,7 @@ public class GroupITCase extends AbstractITCase { // 5. also add an actual attribute for badge - it will work groupPatch.getPlainAttrs().add(attrAddReplacePatch(badge.getKey(), "xxxxxxxxxx")); - groupTO = updateGroup(groupPatch); + groupTO = updateGroup(groupPatch).getAny(); assertNotNull(groupTO); assertTrue(groupTO.getPlainAttrMap().containsKey(badge.getKey())); } finally { @@ -619,7 +622,7 @@ public class GroupITCase extends AbstractITCase { GroupTO group = getBasicSampleTO("dynMembership"); group.setUDynMembershipCond("cool==true"); - group = createGroup(group); + group = createGroup(group).getAny(); assertNotNull(group); assertTrue(userService.read(4L).getDynGroups().contains(group.getKey())); @@ -652,11 +655,12 @@ public class GroupITCase extends AbstractITCase { group.getPlainAttrs().add(attrTO("title", "first")); group.getResources().add(RESOURCE_NAME_LDAP); - group = createGroup(group); - assertNotNull(group); - assertEquals(1, group.getPropagationStatusTOs().size()); - assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource()); - assertEquals(PropagationTaskExecStatus.SUCCESS, group.getPropagationStatusTOs().get(0).getStatus()); + ProvisioningResult<GroupTO> result = createGroup(group); + assertNotNull(result); + assertEquals(1, result.getPropagationStatuses().size()); + assertEquals(RESOURCE_NAME_LDAP, result.getPropagationStatuses().get(0).getResource()); + assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus()); + group = result.getAny(); // 2. update succeeds GroupPatch patch = new GroupPatch(); @@ -664,11 +668,12 @@ public class GroupITCase extends AbstractITCase { patch.getPlainAttrs().add(new AttrPatch.Builder(). operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "second")).build()); - group = groupService.update(patch).readEntity(GroupTO.class); - assertNotNull(group); - assertEquals(1, group.getPropagationStatusTOs().size()); - assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource()); - assertEquals(PropagationTaskExecStatus.SUCCESS, group.getPropagationStatusTOs().get(0).getStatus()); + result = updateGroup(patch); + assertNotNull(result); + assertEquals(1, result.getPropagationStatuses().size()); + assertEquals(RESOURCE_NAME_LDAP, result.getPropagationStatuses().get(0).getResource()); + assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus()); + group = result.getAny(); // 3. set capability override with only search allowed, but not enable ldap.getCapabilitiesOverride().add(ConnectorCapability.SEARCH); @@ -685,11 +690,12 @@ public class GroupITCase extends AbstractITCase { patch.getPlainAttrs().add(new AttrPatch.Builder(). operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "third")).build()); - group = groupService.update(patch).readEntity(GroupTO.class); - assertNotNull(group); - assertEquals(1, group.getPropagationStatusTOs().size()); - assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource()); - assertEquals(PropagationTaskExecStatus.SUCCESS, group.getPropagationStatusTOs().get(0).getStatus()); + result = updateGroup(patch); + assertNotNull(result); + assertEquals(1, result.getPropagationStatuses().size()); + assertEquals(RESOURCE_NAME_LDAP, result.getPropagationStatuses().get(0).getResource()); + assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus()); + group = result.getAny(); // 5. enable capability override ldap.setOverrideCapabilities(true); @@ -706,11 +712,11 @@ public class GroupITCase extends AbstractITCase { patch.getPlainAttrs().add(new AttrPatch.Builder(). operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "fourth")).build()); - group = groupService.update(patch).readEntity(GroupTO.class); - assertNotNull(group); - assertEquals(1, group.getPropagationStatusTOs().size()); - assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource()); - assertEquals(PropagationTaskExecStatus.NOT_ATTEMPTED, group.getPropagationStatusTOs().get(0).getStatus()); + result = updateGroup(patch); + assertNotNull(result); + assertEquals(1, result.getPropagationStatuses().size()); + assertEquals(RESOURCE_NAME_LDAP, result.getPropagationStatuses().get(0).getResource()); + assertEquals(PropagationTaskExecStatus.NOT_ATTEMPTED, result.getPropagationStatuses().get(0).getStatus()); } finally { ldap.getCapabilitiesOverride().clear(); ldap.setOverrideCapabilities(false); @@ -725,7 +731,7 @@ public class GroupITCase extends AbstractITCase { // 1. create new LDAP resource having ConnObjectKey mapped to a derived attribute ResourceTO newLDAP = resourceService.read(RESOURCE_NAME_LDAP); newLDAP.setKey("new-ldap"); - newLDAP.setPropagationPrimary(true); + newLDAP.setPropagationPriority(0); for (ProvisionTO provision : newLDAP.getProvisions()) { provision.getVirSchemas().clear(); @@ -756,7 +762,7 @@ public class GroupITCase extends AbstractITCase { groupTO.getResources().clear(); groupTO.getResources().add("new-ldap"); - groupTO = createGroup(groupTO); + groupTO = createGroup(groupTO).getAny(); assertNotNull(groupTO); // 3. update the group @@ -764,7 +770,7 @@ public class GroupITCase extends AbstractITCase { groupPatch.setKey(groupTO.getKey()); groupPatch.getPlainAttrs().add(attrAddReplacePatch("icon", "anotherIcon")); - groupTO = updateGroup(groupPatch); + groupTO = updateGroup(groupPatch).getAny(); assertNotNull(groupTO); // 4. check that a single group exists in LDAP for the group created and updated above @@ -826,7 +832,7 @@ public class GroupITCase extends AbstractITCase { GroupTO groupTO = getBasicSampleTO("syncope717"); groupTO.getPlainAttrs().add(attrTO(doubleSchemaName, "11.23")); - groupTO = createGroup(groupTO); + groupTO = createGroup(groupTO).getAny(); assertNotNull(groupTO); assertEquals("11.23", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0)); @@ -844,7 +850,7 @@ public class GroupITCase extends AbstractITCase { patch.setKey(groupTO.getKey()); patch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(attrTO(doubleSchemaName, "11.257")).build()); - groupTO = updateGroup(patch); + groupTO = updateGroup(patch).getAny(); assertNotNull(groupTO); assertEquals("11.257", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0)); @@ -857,7 +863,7 @@ public class GroupITCase extends AbstractITCase { patch.setKey(groupTO.getKey()); patch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(attrTO(doubleSchemaName, "11.23")).build()); - groupTO = updateGroup(patch); + groupTO = updateGroup(patch).getAny(); assertNotNull(groupTO); assertEquals("11.23", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0)); }