http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/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 deleted file mode 100644 index 2fb035c..0000000 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.apache.syncope.core.provisioning.camel.processor; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.springframework.beans.factory.annotation.Autowired; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.syncope.common.lib.to.AttrTO; -import org.apache.syncope.common.lib.to.GroupTO; -import org.apache.syncope.common.lib.types.AnyTypeKind; -import org.apache.syncope.core.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.PropagationManager; -import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; -import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; -import org.springframework.stereotype.Component; - -@Component -public class GroupCreateInSyncProcessor implements Processor { - - @Autowired - protected PropagationManager propagationManager; - - @Autowired - protected PropagationTaskExecutor taskExecutor; - - @Override - @SuppressWarnings("unchecked") - public void process(final Exchange exchange) { - WorkflowResult<Long> created = (WorkflowResult) exchange.getIn().getBody(); - - 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) { - groupOwnerMap.put(created.getResult(), groupOwner.getValues().iterator().next()); - } - - List<PropagationTask> tasks = propagationManager.getCreateTasks( - AnyTypeKind.GROUP, - created.getResult(), - created.getPropByRes(), - groupTO.getVirAttrs(), - excludedResources); - PropagationReporter propagationReporter = - ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class); - taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync); - - exchange.getOut().setBody(new ImmutablePair<>(created.getResult(), null)); - } -}
http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInPullProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInPullProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInPullProcessor.java new file mode 100644 index 0000000..2790c57 --- /dev/null +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInPullProcessor.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.core.provisioning.camel.processor; + +import java.util.Map; +import org.apache.camel.Processor; +import org.apache.camel.Exchange; +import org.apache.syncope.common.lib.patch.UserPatch; +import org.apache.syncope.core.persistence.api.dao.UserDAO; +import org.apache.syncope.core.persistence.api.entity.user.User; +import org.apache.syncope.core.provisioning.api.WorkflowResult; +import org.apache.syncope.core.workflow.api.UserWorkflowAdapter; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class UserSetStatusInPullProcessor implements Processor { + + @Autowired + protected UserDAO userDAO; + + @Autowired + protected UserWorkflowAdapter uwfAdapter; + + @SuppressWarnings("unchecked") + @Override + public void process(final Exchange exchange) { + WorkflowResult<Map.Entry<UserPatch, Boolean>> updated = (WorkflowResult) exchange.getIn().getBody(); + + Boolean enabled = exchange.getProperty("enabled", Boolean.class); + Long key = exchange.getProperty("key", Long.class); + + if (enabled != null) { + User user = userDAO.find(key); + + WorkflowResult<Long> enableUpdate = null; + if (user.isSuspended() == null) { + enableUpdate = uwfAdapter.activate(key, null); + } else if (enabled && user.isSuspended()) { + enableUpdate = uwfAdapter.reactivate(key); + } else if (!enabled && !user.isSuspended()) { + enableUpdate = uwfAdapter.suspend(key); + } + + if (enableUpdate != null) { + if (enableUpdate.getPropByRes() != null) { + updated.getPropByRes().merge(enableUpdate.getPropByRes()); + updated.getPropByRes().purge(); + } + updated.getPerformedTasks().addAll(enableUpdate.getPerformedTasks()); + } + } + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/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 deleted file mode 100644 index ead8d4f..0000000 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.core.provisioning.camel.processor; - -import java.util.Map; -import org.apache.camel.Processor; -import org.apache.camel.Exchange; -import org.apache.syncope.common.lib.patch.UserPatch; -import org.apache.syncope.core.persistence.api.dao.UserDAO; -import org.apache.syncope.core.persistence.api.entity.user.User; -import org.apache.syncope.core.provisioning.api.WorkflowResult; -import org.apache.syncope.core.workflow.api.UserWorkflowAdapter; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class UserSetStatusInSyncProcessor implements Processor { - - @Autowired - protected UserDAO userDAO; - - @Autowired - protected UserWorkflowAdapter uwfAdapter; - - @SuppressWarnings("unchecked") - @Override - public void process(final Exchange exchange) { - WorkflowResult<Map.Entry<UserPatch, Boolean>> updated = (WorkflowResult) exchange.getIn().getBody(); - - Boolean enabled = exchange.getProperty("enabled", Boolean.class); - Long key = exchange.getProperty("key", Long.class); - - if (enabled != null) { - User user = userDAO.find(key); - - WorkflowResult<Long> enableUpdate = null; - if (user.isSuspended() == null) { - enableUpdate = uwfAdapter.activate(key, null); - } else if (enabled && user.isSuspended()) { - enableUpdate = uwfAdapter.reactivate(key); - } else if (!enabled && !user.isSuspended()) { - enableUpdate = uwfAdapter.suspend(key); - } - - if (enableUpdate != null) { - if (enableUpdate.getPropByRes() != null) { - updated.getPropByRes().merge(enableUpdate.getPropByRes()); - updated.getPropByRes().purge(); - } - updated.getPerformedTasks().addAll(enableUpdate.getPerformedTasks()); - } - } - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInPullProcessor.java ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInPullProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInPullProcessor.java new file mode 100644 index 0000000..f24db22 --- /dev/null +++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInPullProcessor.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.core.provisioning.camel.processor; + +import java.util.List; +import java.util.Set; +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.syncope.common.lib.patch.UserPatch; +import org.apache.syncope.core.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.PropagationManager; +import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter; +import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class UserUpdateInPullProcessor implements Processor { + + @Autowired + protected PropagationManager propagationManager; + + @Autowired + protected PropagationTaskExecutor taskExecutor; + + @SuppressWarnings("unchecked") + @Override + 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); + 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/61a7fdd3/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 deleted file mode 100644 index 7c4d6e0..0000000 --- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.core.provisioning.camel.processor; - -import java.util.List; -import java.util.Set; -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.syncope.common.lib.patch.UserPatch; -import org.apache.syncope.core.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.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 UserUpdateInSyncProcessor implements Processor { - - private static final Logger LOG = LoggerFactory.getLogger(UserUpdateInSyncProcessor.class); - - @Autowired - protected PropagationManager propagationManager; - - @Autowired - protected PropagationTaskExecutor taskExecutor; - - @SuppressWarnings("unchecked") - @Override - 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); - 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/61a7fdd3/ext/camel/provisioning-camel/src/main/resources/groupRoutes.xml ---------------------------------------------------------------------- diff --git a/ext/camel/provisioning-camel/src/main/resources/groupRoutes.xml b/ext/camel/provisioning-camel/src/main/resources/groupRoutes.xml index 8e1b914..d7875dc 100644 --- a/ext/camel/provisioning-camel/src/main/resources/groupRoutes.xml +++ b/ext/camel/provisioning-camel/src/main/resources/groupRoutes.xml @@ -38,21 +38,21 @@ under the License. </doTry> </route> - <route id="createGroupSync"> - <from uri="direct:createGroupInSync"/> + <route id="createGroupPull"> + <from uri="direct:createGroupInPull"/> <setProperty propertyName="any"> <simple>${body}</simple> </setProperty> <doTry> <bean ref="gwfAdapter" method="create(${body})"/> - <process ref="groupCreateInSyncProcessor"/> - <to uri="direct:createGroupInSyncPort"/> + <process ref="groupCreateInPullProcessor"/> + <to uri="direct:createGroupInPullPort"/> <doCatch> <exception>java.lang.RuntimeException</exception> <handled> <constant>false</constant> </handled> - <to uri="direct:createGroupInSyncPort"/> + <to uri="direct:createGroupInPullPort"/> </doCatch> </doTry> </route> http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/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 cbf2902..e218b68 100644 --- a/ext/camel/provisioning-camel/src/main/resources/userRoutes.xml +++ b/ext/camel/provisioning-camel/src/main/resources/userRoutes.xml @@ -58,26 +58,26 @@ under the License. </doTry> </route> - <route id="updateUserInSync"> - <from uri="direct:updateUserInSync"/> + <route id="updateUserInPull"> + <from uri="direct:updateUserInPull"/> <doTry> <bean ref="uwfAdapter" method="update(${body})"/> - <to uri="direct:userInSync"/> + <to uri="direct:userInPull"/> <doCatch> <exception>java.lang.RuntimeException</exception> <handled> <constant>false</constant> </handled> - <to uri="direct:updateInSyncPort"/> + <to uri="direct:updateInPullPort"/> </doCatch> </doTry> </route> - <route id="userInSync"> - <from uri="direct:userInSync"/> - <process ref="userSetStatusInSyncProcessor"/> - <process ref="userUpdateInSyncProcessor"/> - <to uri="direct:updateInSyncPort"/> + <route id="userInPull"> + <from uri="direct:userInPull"/> + <process ref="userSetStatusInPullProcessor"/> + <process ref="userUpdateInPullProcessor"/> + <to uri="direct:updateInPullPort"/> </route> <route id="deleteUser"> http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/build-tools/src/main/resources/content.ldif ---------------------------------------------------------------------- diff --git a/fit/build-tools/src/main/resources/content.ldif b/fit/build-tools/src/main/resources/content.ldif index aa47af5..982728b 100644 --- a/fit/build-tools/src/main/resources/content.ldif +++ b/fit/build-tools/src/main/resources/content.ldif @@ -29,21 +29,21 @@ objectClass: groupOfUniqueNames objectClass: top cn: testLDAPGroup uniqueMember: uid=admin,ou=system -uniqueMember: uid=syncFromLDAP,ou=People,o=isp -owner: uid=syncFromLDAP,ou=People,o=isp +uniqueMember: uid=pullFromLDAP,ou=People,o=isp +owner: uid=pullFromLDAP,ou=People,o=isp -DN: uid=syncFromLDAP,ou=People,o=isp +DN: uid=pullFromLDAP,ou=People,o=isp objectClass: organizationalPerson objectClass: person objectClass: inetOrgPerson objectClass: top -cn: syncFromLDAP +cn: pullFromLDAP description: Active -mail: [email protected] +mail: [email protected] sn: Surname -uid: syncFromLDAP +uid: pullFromLDAP userpassword:: cGFzc3dvcmQxMjM= -givenname: syncFromLDAP +givenname: pullFromLDAP registeredAddress: 5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8 jpegPhoto:: /9j/4AAQSkZJRgABAQEBKwErAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoH BwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQk http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/build-tools/src/main/resources/testdb.sql ---------------------------------------------------------------------- diff --git a/fit/build-tools/src/main/resources/testdb.sql b/fit/build-tools/src/main/resources/testdb.sql index 03f9f96..0bbab3e 100644 --- a/fit/build-tools/src/main/resources/testdb.sql +++ b/fit/build-tools/src/main/resources/testdb.sql @@ -36,14 +36,14 @@ INSERT INTO test2 VALUES ('rossini', 'password321', 'true'); INSERT INTO test2 VALUES ('verdi', 'password321', 'true'); -- this table is for issueSYNCOPE230 -DROP TABLE testsync IF EXISTS; -CREATE TABLE testsync ( +DROP TABLE testpull IF EXISTS; +CREATE TABLE testpull ( id NUMBER(10) PRIMARY KEY, username VARCHAR(80), surname VARCHAR(80), email VARCHAR(80)); -INSERT INTO testsync VALUES (965, 'issuesyncope230', 'Surname', '[email protected]'); +INSERT INTO testpull VALUES (965, 'issuesyncope230', 'Surname', '[email protected]'); DROP TABLE testPRINTER IF EXISTS; CREATE TABLE testPRINTER ( http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/PrefixMappingItemTransformer.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/PrefixMappingItemTransformer.java b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/PrefixMappingItemTransformer.java index c620541..3d79fda 100644 --- a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/PrefixMappingItemTransformer.java +++ b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/PrefixMappingItemTransformer.java @@ -41,9 +41,9 @@ public class PrefixMappingItemTransformer extends DefaultMappingItemTransformer } @Override - public List<Object> beforeSync(final List<Object> values) { + public List<Object> beforePull(final List<Object> values) { if (values == null || values.isEmpty() || values.get(0) == null) { - return super.beforeSync(values); + return super.beforePull(values); } else { List<Object> newValues = new ArrayList<>(values); newValues.set(0, StringUtils.substringAfter(values.get(0).toString(), PREFIX)); http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestPullActions.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestPullActions.java b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestPullActions.java new file mode 100644 index 0000000..81624f1 --- /dev/null +++ b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestPullActions.java @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.fit.core.reference; + +import org.apache.commons.collections4.IterableUtils; +import org.apache.syncope.common.lib.patch.AnyPatch; +import org.apache.syncope.common.lib.patch.AttrPatch; +import org.apache.syncope.common.lib.to.AnyTO; +import org.apache.syncope.common.lib.to.AttrTO; +import org.apache.syncope.common.lib.to.UserTO; +import org.apache.syncope.common.lib.types.PatchOperation; +import org.apache.syncope.core.provisioning.api.pushpull.IgnoreProvisionException; +import org.apache.syncope.core.provisioning.api.pushpull.ProvisioningProfile; +import org.apache.syncope.core.provisioning.java.pushpull.DefaultPullActions; +import org.identityconnectors.framework.common.objects.SyncDelta; +import org.quartz.JobExecutionException; + +/** + * Test pull action. + */ +public class TestPullActions extends DefaultPullActions { + + private int counter = 0; + + @Override + public <A extends AnyTO> SyncDelta beforeProvision( + final ProvisioningProfile<?, ?> profile, final SyncDelta delta, final A any) + throws JobExecutionException { + + AttrTO attrTO = null; + for (int i = 0; i < any.getPlainAttrs().size(); i++) { + AttrTO plainAttr = IterableUtils.get(any.getPlainAttrs(), i); + if ("fullname".equals(plainAttr.getSchema())) { + attrTO = plainAttr; + } + } + if (attrTO == null) { + attrTO = new AttrTO(); + attrTO.setSchema("fullname"); + any.getPlainAttrs().add(attrTO); + } + attrTO.getValues().clear(); + attrTO.getValues().add(String.valueOf(counter++)); + + return delta; + } + + @Override + public <A extends AnyTO> SyncDelta beforeAssign( + final ProvisioningProfile<?, ?> profile, final SyncDelta delta, final A any) + throws JobExecutionException { + + if (any instanceof UserTO && "test2".equals(UserTO.class.cast(any).getUsername())) { + throw new IgnoreProvisionException(); + } + + return delta; + } + + @Override + public <A extends AnyTO, M extends AnyPatch> SyncDelta beforeUpdate( + final ProvisioningProfile<?, ?> profile, + final SyncDelta delta, + final A any, + final M anyPatch) throws JobExecutionException { + + AttrPatch fullnamePatch = null; + for (AttrPatch attrPatch : anyPatch.getPlainAttrs()) { + if ("fullname".equals(attrPatch.getAttrTO().getSchema())) { + fullnamePatch = attrPatch; + } + } + if (fullnamePatch == null) { + fullnamePatch = new AttrPatch.Builder(). + operation(PatchOperation.ADD_REPLACE). + attrTO(new AttrTO.Builder().schema("fullname").build()). + build(); + } + + fullnamePatch.getAttrTO().getValues().clear(); + fullnamePatch.getAttrTO().getValues().add(String.valueOf(counter++)); + + return delta; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestPullRule.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestPullRule.java b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestPullRule.java new file mode 100644 index 0000000..71d36a7 --- /dev/null +++ b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestPullRule.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.fit.core.reference; + +import org.apache.syncope.core.persistence.api.dao.search.AttributeCond; +import org.apache.syncope.core.persistence.api.dao.search.SearchCond; +import org.identityconnectors.framework.common.objects.ConnectorObject; +import org.apache.syncope.core.provisioning.api.pushpull.PullCorrelationRule; + +/** + * Test pull rule relying on <tt>email</tt> attribute value. + */ +public class TestPullRule implements PullCorrelationRule { + + @Override + public SearchCond getSearchCond(final ConnectorObject connObj) { + AttributeCond cond = new AttributeCond(); + cond.setSchema("email"); + cond.setType(AttributeCond.Type.EQ); + cond.setExpression(connObj.getName().getNameValue()); + + return SearchCond.getLeafCond(cond); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestReconciliationFilterBuilder.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestReconciliationFilterBuilder.java b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestReconciliationFilterBuilder.java index 1603083..05beee2 100644 --- a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestReconciliationFilterBuilder.java +++ b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestReconciliationFilterBuilder.java @@ -18,7 +18,7 @@ */ package org.apache.syncope.fit.core.reference; -import org.apache.syncope.core.provisioning.java.syncpull.DefaultReconciliationFilterBuilder; +import org.apache.syncope.core.provisioning.java.pushpull.DefaultReconciliationFilterBuilder; import org.identityconnectors.framework.common.objects.AttributeBuilder; import org.identityconnectors.framework.common.objects.filter.Filter; import org.identityconnectors.framework.common.objects.filter.FilterBuilder; http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncActions.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncActions.java b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncActions.java deleted file mode 100644 index 19b172f..0000000 --- a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncActions.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.fit.core.reference; - -import org.apache.commons.collections4.IterableUtils; -import org.apache.syncope.common.lib.patch.AnyPatch; -import org.apache.syncope.common.lib.patch.AttrPatch; -import org.apache.syncope.common.lib.to.AnyTO; -import org.apache.syncope.common.lib.to.AttrTO; -import org.apache.syncope.common.lib.to.UserTO; -import org.apache.syncope.common.lib.types.PatchOperation; -import org.apache.syncope.core.provisioning.api.syncpull.IgnoreProvisionException; -import org.apache.syncope.core.provisioning.api.syncpull.ProvisioningProfile; -import org.apache.syncope.core.provisioning.java.syncpull.DefaultSyncActions; -import org.identityconnectors.framework.common.objects.SyncDelta; -import org.quartz.JobExecutionException; - -/** - * Test synchronization action. - */ -public class TestSyncActions extends DefaultSyncActions { - - private int counter = 0; - - @Override - public <A extends AnyTO> SyncDelta beforeProvision( - final ProvisioningProfile<?, ?> profile, final SyncDelta delta, final A any) - throws JobExecutionException { - - AttrTO attrTO = null; - for (int i = 0; i < any.getPlainAttrs().size(); i++) { - AttrTO plainAttr = IterableUtils.get(any.getPlainAttrs(), i); - if ("fullname".equals(plainAttr.getSchema())) { - attrTO = plainAttr; - } - } - if (attrTO == null) { - attrTO = new AttrTO(); - attrTO.setSchema("fullname"); - any.getPlainAttrs().add(attrTO); - } - attrTO.getValues().clear(); - attrTO.getValues().add(String.valueOf(counter++)); - - return delta; - } - - @Override - public <A extends AnyTO> SyncDelta beforeAssign( - final ProvisioningProfile<?, ?> profile, final SyncDelta delta, final A any) - throws JobExecutionException { - - if (any instanceof UserTO && "test2".equals(UserTO.class.cast(any).getUsername())) { - throw new IgnoreProvisionException(); - } - - return delta; - } - - @Override - public <A extends AnyTO, M extends AnyPatch> SyncDelta beforeUpdate( - final ProvisioningProfile<?, ?> profile, - final SyncDelta delta, - final A any, - final M anyPatch) throws JobExecutionException { - - AttrPatch fullnamePatch = null; - for (AttrPatch attrPatch : anyPatch.getPlainAttrs()) { - if ("fullname".equals(attrPatch.getAttrTO().getSchema())) { - fullnamePatch = attrPatch; - } - } - if (fullnamePatch == null) { - fullnamePatch = new AttrPatch.Builder(). - operation(PatchOperation.ADD_REPLACE). - attrTO(new AttrTO.Builder().schema("fullname").build()). - build(); - } - - fullnamePatch.getAttrTO().getValues().clear(); - fullnamePatch.getAttrTO().getValues().add(String.valueOf(counter++)); - - return delta; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncRule.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncRule.java b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncRule.java deleted file mode 100644 index 5a1624a..0000000 --- a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/TestSyncRule.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.fit.core.reference; - -import org.apache.syncope.core.persistence.api.dao.search.AttributeCond; -import org.apache.syncope.core.persistence.api.dao.search.SearchCond; -import org.apache.syncope.core.provisioning.api.syncpull.SyncCorrelationRule; -import org.identityconnectors.framework.common.objects.ConnectorObject; - -/** - * Test synchronization rule relying on <tt>email</tt> attribute value. - */ -public class TestSyncRule implements SyncCorrelationRule { - - @Override - public SearchCond getSearchCond(final ConnectorObject connObj) { - AttributeCond cond = new AttributeCond(); - cond.setSchema("email"); - cond.setType(AttributeCond.Type.EQ); - cond.setExpression(connObj.getName().getNameValue()); - - return SearchCond.getLeafCond(cond); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java index a64bcb8..f71d3b9 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java @@ -89,6 +89,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import static org.junit.Assert.assertNotNull; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:testJDBCContext.xml" }) public abstract class AbstractITCase { @@ -115,7 +117,7 @@ public abstract class AbstractITCase { protected static final String RESOURCE_NAME_CSV = "resource-csv"; - protected static final String RESOURCE_NAME_DBSYNC = "resource-db-sync"; + protected static final String RESOURCE_NAME_DBPULL = "resource-db-pull"; protected static final String RESOURCE_NAME_DBVIRATTR = "resource-db-virattr"; http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/test/java/org/apache/syncope/fit/cli/CLIITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/cli/CLIITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/cli/CLIITCase.java index 5995146..0a78dd3 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/cli/CLIITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/cli/CLIITCase.java @@ -49,6 +49,10 @@ import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + @FixMethodOrder(MethodSorters.JVM) public class CLIITCase extends AbstractITCase { http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/test/java/org/apache/syncope/fit/console/BulkActionITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/BulkActionITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/BulkActionITCase.java index 49b6d21..28d43b9 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/BulkActionITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/BulkActionITCase.java @@ -258,7 +258,7 @@ public class BulkActionITCase extends AbstractConsoleITCase { } @Test - public void executeSyncTask() { + public void executePullTask() { wicketTester.clickLink("body:topologyLI:topology"); wicketTester.executeAjaxEvent("body:resources:2:resources:0:res", Constants.ON_CLICK); wicketTester.clickLink("body:toggle:togglePanelContainer:container:actions:propagation"); http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LogsITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LogsITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LogsITCase.java index c7a8ee3..f17f906 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LogsITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LogsITCase.java @@ -34,6 +34,8 @@ import org.apache.wicket.util.visit.IVisitor; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertNotNull; + public class LogsITCase extends AbstractConsoleITCase { private final static String CONTAINER_PATH = "body:content:tabbedPanel:panel:loggerContainer"; http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/test/java/org/apache/syncope/fit/console/ParametersITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/ParametersITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/ParametersITCase.java index 389a7be..da1b6af 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/ParametersITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/ParametersITCase.java @@ -30,6 +30,8 @@ import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; +import static org.junit.Assert.assertNotNull; + @FixMethodOrder(MethodSorters.JVM) public class ParametersITCase extends AbstractConsoleITCase { http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/test/java/org/apache/syncope/fit/console/RolesITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/RolesITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/RolesITCase.java index 5a1c851..7c5e497 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/RolesITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/RolesITCase.java @@ -29,6 +29,8 @@ import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; +import static org.junit.Assert.assertNull; + @FixMethodOrder(MethodSorters.JVM) public class RolesITCase extends AbstractConsoleITCase { http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/test/java/org/apache/syncope/fit/console/SecurityQuestionsITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/SecurityQuestionsITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/SecurityQuestionsITCase.java index a3bb92d..62501be 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/SecurityQuestionsITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/SecurityQuestionsITCase.java @@ -31,6 +31,9 @@ import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + @FixMethodOrder(MethodSorters.JVM) public class SecurityQuestionsITCase extends AbstractConsoleITCase { http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java index 0c41d5b..c9f013b 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java @@ -48,7 +48,7 @@ public class TopologyITCase extends AbstractConsoleITCase { wicketTester.assertComponent("body:toggle:togglePanelContainer:container:actions:delete", AjaxLink.class); wicketTester.assertComponent("body:toggle:togglePanelContainer:container:actions:edit", AjaxLink.class); wicketTester.assertComponent("body:toggle:togglePanelContainer:container:actions:propagation", AjaxLink.class); - wicketTester.assertComponent("body:toggle:togglePanelContainer:container:actions:synchronization", + wicketTester.assertComponent("body:toggle:togglePanelContainer:container:actions:pull", AjaxLink.class); wicketTester.assertComponent("body:toggle:togglePanelContainer:container:actions:push", AjaxLink.class); wicketTester.executeAjaxEvent("body:syncope", Constants.ON_CLICK); @@ -60,10 +60,10 @@ public class TopologyITCase extends AbstractConsoleITCase { } @Test - public void executeSyncTask() { + public void executePullTask() { wicketTester.clickLink("body:topologyLI:topology"); wicketTester.executeAjaxEvent("body:resources:2:resources:0:res", Constants.ON_CLICK); - wicketTester.clickLink("body:toggle:togglePanelContainer:container:actions:synchronization"); + wicketTester.clickLink("body:toggle:togglePanelContainer:container:actions:pull"); wicketTester.clickLink("body:toggle:outerObjectsRepeater:1:outer:form:content:tasks:firstLevelContainer:" + "first:container:content:searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable:" + "body:rows:1:cells:10:cell:panelExecute:executeLink"); http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java index 00ce952..82ed255 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AbstractTaskITCase.java @@ -47,7 +47,7 @@ import org.apache.syncope.fit.AbstractITCase; public abstract class AbstractTaskITCase extends AbstractITCase { - protected static final Long SYNC_TASK_ID = 4L; + protected static final Long PULL_TASK_ID = 4L; protected static final Long SCHED_TASK_ID = 5L; http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java index 8e825ea..f047593 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java @@ -174,7 +174,7 @@ public class LoggerITCase extends AbstractITCase { for (EventCategoryTO eventCategoryTO : events) { if (AnyTypeKind.USER.name().toLowerCase().equals(eventCategoryTO.getCategory())) { if (RESOURCE_NAME_LDAP.equals(eventCategoryTO.getSubcategory()) - && EventCategoryType.SYNCHRONIZATION == eventCategoryTO.getType()) { + && EventCategoryType.PULL == eventCategoryTO.getType()) { assertTrue(eventCategoryTO.getEvents().contains(ResourceOperation.CREATE.name().toLowerCase())); assertTrue(eventCategoryTO.getEvents().contains(ResourceOperation.UPDATE.name().toLowerCase())); assertTrue(eventCategoryTO.getEvents().contains(ResourceOperation.DELETE.name().toLowerCase())); @@ -210,7 +210,7 @@ public class LoggerITCase extends AbstractITCase { found = false; for (EventCategoryTO eventCategoryTO : events) { if (EventCategoryType.TASK == eventCategoryTO.getType() - && "SyncJobDelegate".equals(eventCategoryTO.getCategory())) { + && "PullJobDelegate".equals(eventCategoryTO.getCategory())) { found = true; } } http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java index bfbf63d..2a44c3d 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/MultitenancyITCase.java @@ -40,7 +40,7 @@ import org.apache.syncope.common.lib.to.ProvisionTO; import org.apache.syncope.common.lib.to.ProvisioningResult; import org.apache.syncope.common.lib.to.RealmTO; import org.apache.syncope.common.lib.to.ResourceTO; -import org.apache.syncope.common.lib.to.SyncTaskTO; +import org.apache.syncope.common.lib.to.PullTaskTO; import org.apache.syncope.common.lib.to.ExecTO; import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.common.lib.types.AnyTypeKind; @@ -49,7 +49,7 @@ import org.apache.syncope.common.lib.types.LoggerType; import org.apache.syncope.common.lib.types.MappingPurpose; import org.apache.syncope.common.lib.types.PropagationTaskExecStatus; import org.apache.syncope.common.lib.types.SchemaType; -import org.apache.syncope.common.lib.types.SyncMode; +import org.apache.syncope.common.lib.types.PullMode; import org.apache.syncope.common.rest.api.beans.AnySearchQuery; import org.apache.syncope.common.rest.api.beans.SchemaQuery; import org.apache.syncope.common.rest.api.service.ConnectorService; @@ -133,7 +133,7 @@ public class MultitenancyITCase extends AbstractITCase { } @Test - public void createResourceAndSync() { + public void createResourceAndPull() { // read connector ConnInstanceTO conn = adminClient.getService(ConnectorService.class).read(100L, Locale.ENGLISH.getLanguage()); assertNotNull(conn); @@ -188,13 +188,13 @@ public class MultitenancyITCase extends AbstractITCase { resource = adminClient.getService(ResourceService.class).read(resource.getKey()); assertNotNull(resource); - // create sync task - SyncTaskTO task = new SyncTaskTO(); - task.setName("LDAP Sync Task"); + // create pull task + PullTaskTO task = new PullTaskTO(); + task.setName("LDAP Pull Task"); task.setActive(true); task.setDestinationRealm(SyncopeConstants.ROOT_REALM); task.setResource(resource.getKey()); - task.setSyncMode(SyncMode.FULL_RECONCILIATION); + task.setPullMode(PullMode.FULL_RECONCILIATION); task.setPerformCreate(true); response = adminClient.getService(TaskService.class).create(task); @@ -203,7 +203,7 @@ public class MultitenancyITCase extends AbstractITCase { Long.valueOf(StringUtils.substringAfterLast(response.getLocation().toASCIIString(), "/")), true); assertNotNull(resource); - // synchronize + // pull ExecTO execution = AbstractTaskITCase.execProvisioningTask( adminClient.getService(TaskService.class), task.getKey(), 50, false); @@ -212,10 +212,10 @@ public class MultitenancyITCase extends AbstractITCase { assertNotNull(status); assertEquals(PropagationTaskExecStatus.SUCCESS, PropagationTaskExecStatus.valueOf(status)); - // verify that synchronized user is found + // verify that pulled user is found PagedResult<UserTO> matchingUsers = adminClient.getService(UserService.class).search( new AnySearchQuery.Builder().realm(SyncopeConstants.ROOT_REALM). - fiql(SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("syncFromLDAP").query()). + fiql(SyncopeClient.getUserSearchConditionBuilder().is("username").equalTo("pullFromLDAP").query()). build()); assertNotNull(matchingUsers); assertEquals(1, matchingUsers.getResult().size()); http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java index cf7f335..10f0f56 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PolicyITCase.java @@ -31,15 +31,15 @@ import org.apache.commons.lang3.SerializationUtils; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.policy.AccountPolicyTO; import org.apache.syncope.common.lib.policy.PasswordPolicyTO; -import org.apache.syncope.common.lib.policy.SyncPolicyTO; +import org.apache.syncope.common.lib.policy.PullPolicyTO; import org.apache.syncope.common.lib.policy.DefaultAccountRuleConf; import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.lib.types.ClientExceptionType; import org.apache.syncope.common.lib.policy.DefaultPasswordRuleConf; import org.apache.syncope.common.lib.types.PolicyType; -import org.apache.syncope.common.lib.policy.SyncPolicySpec; +import org.apache.syncope.common.lib.policy.PullPolicySpec; import org.apache.syncope.fit.AbstractITCase; -import org.apache.syncope.fit.core.reference.TestSyncRule; +import org.apache.syncope.fit.core.reference.TestPullRule; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; @@ -47,21 +47,21 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.JVM) public class PolicyITCase extends AbstractITCase { - private SyncPolicyTO buildSyncPolicyTO() { - SyncPolicyTO policy = new SyncPolicyTO(); + private PullPolicyTO buildPullPolicyTO() { + PullPolicyTO policy = new PullPolicyTO(); - SyncPolicySpec spec = new SyncPolicySpec(); - spec.getCorrelationRules().put(AnyTypeKind.USER.name(), TestSyncRule.class.getName()); + PullPolicySpec spec = new PullPolicySpec(); + spec.getCorrelationRules().put(AnyTypeKind.USER.name(), TestPullRule.class.getName()); policy.setSpecification(spec); - policy.setDescription("Sync policy"); + policy.setDescription("Pull policy"); return policy; } @Test public void listByType() { - List<SyncPolicyTO> policyTOs = policyService.list(PolicyType.SYNC); + List<PullPolicyTO> policyTOs = policyService.list(PolicyType.PULL); assertNotNull(policyTOs); assertFalse(policyTOs.isEmpty()); @@ -86,8 +86,8 @@ public class PolicyITCase extends AbstractITCase { } @Test - public void getSyncPolicy() { - SyncPolicyTO policyTO = policyService.read(1L); + public void getPullPolicy() { + PullPolicyTO policyTO = policyService.read(1L); assertNotNull(policyTO); assertTrue(policyTO.getUsedByRealms().isEmpty()); @@ -95,8 +95,8 @@ public class PolicyITCase extends AbstractITCase { @Test public void createMissingDescription() { - SyncPolicyTO policy = new SyncPolicyTO(); - policy.setSpecification(new SyncPolicySpec()); + PullPolicyTO policy = new PullPolicyTO(); + policy.setSpecification(new PullPolicySpec()); try { createPolicy(policy); @@ -108,13 +108,13 @@ public class PolicyITCase extends AbstractITCase { @Test public void create() { - SyncPolicyTO policy = buildSyncPolicyTO(); + PullPolicyTO policy = buildPullPolicyTO(); - SyncPolicyTO policyTO = createPolicy(policy); + PullPolicyTO policyTO = createPolicy(policy); assertNotNull(policyTO); - assertEquals(PolicyType.SYNC, policyTO.getType()); - assertEquals(TestSyncRule.class.getName(), + assertEquals(PolicyType.PULL, policyTO.getType()); + assertEquals(TestPullRule.class.getName(), policyTO.getSpecification().getCorrelationRules().get(AnyTypeKind.USER.name())); } @@ -144,9 +144,9 @@ public class PolicyITCase extends AbstractITCase { @Test public void delete() { - SyncPolicyTO policy = buildSyncPolicyTO(); + PullPolicyTO policy = buildPullPolicyTO(); - SyncPolicyTO policyTO = createPolicy(policy); + PullPolicyTO policyTO = createPolicy(policy); assertNotNull(policyTO); policyService.delete(policyTO.getKey()); @@ -161,7 +161,7 @@ public class PolicyITCase extends AbstractITCase { @Test public void getCorrelationRules() { - assertEquals(2, syncopeService.platform().getSyncCorrelationRules().size()); + assertEquals(2, syncopeService.platform().getPullCorrelationRules().size()); } @Test
