You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2012/10/23 09:49:25 UTC
svn commit: r1401182 [2/2] - in /incubator/syncope/trunk:
client/src/main/java/org/apache/syncope/client/to/
client/src/main/java/org/apache/syncope/types/
console/src/main/java/org/apache/syncope/console/pages/
console/src/main/java/org/apache/syncope...
Added: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncopeSyncResultHanlder.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncopeSyncResultHanlder.java?rev=1401182&view=auto
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncopeSyncResultHanlder.java (added)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncopeSyncResultHanlder.java Tue Oct 23 07:49:23 2012
@@ -0,0 +1,546 @@
+/*
+ * 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.sync;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.syncope.client.mod.UserMod;
+import org.apache.syncope.client.search.AttributeCond;
+import org.apache.syncope.client.search.NodeCond;
+import org.apache.syncope.client.search.SyncopeUserCond;
+import org.apache.syncope.client.to.UserTO;
+import org.apache.syncope.core.notification.NotificationManager;
+import org.apache.syncope.core.persistence.beans.PropagationTask;
+import org.apache.syncope.core.persistence.beans.SchemaMapping;
+import org.apache.syncope.core.persistence.beans.SyncTask;
+import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
+import org.apache.syncope.core.persistence.beans.user.UAttrValue;
+import org.apache.syncope.core.persistence.dao.EntitlementDAO;
+import org.apache.syncope.core.persistence.dao.UserDAO;
+import org.apache.syncope.core.persistence.dao.UserSearchDAO;
+import org.apache.syncope.core.propagation.PropagationException;
+import org.apache.syncope.core.propagation.PropagationManager;
+import org.apache.syncope.core.propagation.PropagationTaskExecutor;
+import org.apache.syncope.core.quartz.AbstractTaskJob;
+import org.apache.syncope.core.rest.controller.InvalidSearchConditionException;
+import org.apache.syncope.core.rest.controller.UnauthorizedRoleException;
+import org.apache.syncope.core.rest.data.UserDataBinder;
+import org.apache.syncope.core.util.ConnObjectUtil;
+import org.apache.syncope.core.util.EntitlementUtil;
+import org.apache.syncope.core.util.NotFoundException;
+import org.apache.syncope.core.util.SchemaMappingUtil;
+import org.apache.syncope.core.workflow.UserWorkflowAdapter;
+import org.apache.syncope.core.workflow.WorkflowResult;
+import org.apache.syncope.types.ConflictResolutionAction;
+import org.apache.syncope.types.SyncPolicySpec;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.AttributeUtil;
+import org.identityconnectors.framework.common.objects.OperationalAttributes;
+import org.identityconnectors.framework.common.objects.SyncDelta;
+import org.identityconnectors.framework.common.objects.SyncDeltaType;
+import org.identityconnectors.framework.common.objects.SyncResultsHandler;
+import org.quartz.JobExecutionException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class SyncopeSyncResultHanlder implements SyncResultsHandler {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(SyncopeSyncResultHanlder.class);
+
+ /**
+ * Entitlement DAO.
+ */
+ @Autowired
+ private EntitlementDAO entitlementDAO;
+
+ /**
+ * User DAO.
+ */
+ @Autowired
+ private UserDAO userDAO;
+
+ /**
+ * User DAO.
+ */
+ @Autowired
+ private UserSearchDAO userSearchDAO;
+
+ /**
+ * ConnectorObject util.
+ */
+ @Autowired
+ private ConnObjectUtil connObjectUtil;
+
+ /**
+ * User workflow adapter.
+ */
+ @Autowired
+ private UserWorkflowAdapter wfAdapter;
+
+ /**
+ * Propagation Manager.
+ */
+ @Autowired
+ private PropagationManager propagationManager;
+
+ /**
+ * PropagationTask executor.
+ */
+ @Autowired
+ private PropagationTaskExecutor taskExecutor;
+
+ /**
+ * User data binder.
+ */
+ @Autowired
+ private UserDataBinder userDataBinder;
+
+ /**
+ * Notification Manager.
+ */
+ @Autowired
+ private NotificationManager notificationManager;
+
+ /**
+ * SyncJob actions.
+ */
+ private SyncActions actions;
+
+ private Collection<SyncResult> results;
+
+ private SyncTask syncTask;
+
+ private ConflictResolutionAction resAct;
+
+ private boolean dryRun;
+
+ public void setActions(final SyncActions actions) {
+ this.actions = actions;
+ }
+
+ public void setResults(final Collection<SyncResult> results) {
+ this.results = results;
+ }
+
+ public void setSyncTask(final SyncTask syncTask) {
+ this.syncTask = syncTask;
+ }
+
+ public void setResAct(final ConflictResolutionAction resAct) {
+ this.resAct = resAct;
+ }
+
+ public void setDryRun(final boolean dryRun) {
+ this.dryRun = dryRun;
+ }
+
+ @Override
+ public boolean handle(final SyncDelta delta) {
+ try {
+ results.addAll(doHandle(delta));
+ return true;
+ } catch (JobExecutionException e) {
+ LOG.error("Synchronization failed", e);
+ return false;
+ }
+ }
+
+ /**
+ * Find users based on mapped uid value (or previous uid value, if updated).
+ *
+ * @param delta sync delta
+ * @return list of matching users
+ */
+ private List<Long> findExistingUsers(final SyncDelta delta) {
+ final String uid = delta.getPreviousUid() == null
+ ? delta.getUid().getUidValue()
+ : delta.getPreviousUid().getUidValue();
+
+ // ---------------------------------
+ // Get sync policy specification
+ // ---------------------------------
+ SyncPolicySpec policySpec = null;
+ if (syncTask.getResource().getSyncPolicy() != null) {
+ policySpec = (SyncPolicySpec) syncTask.getResource().getSyncPolicy().getSpecification();
+ }
+ // ---------------------------------
+
+ final List<Long> result = new ArrayList<Long>();
+
+ if (policySpec == null || policySpec.getAlternativeSearchAttrs().isEmpty()) {
+ SyncopeUser found;
+ List<SyncopeUser> users;
+
+ final SchemaMapping accountIdMap =
+ SchemaMappingUtil.getAccountIdMapping(syncTask.getResource().getMappings());
+ switch (accountIdMap.getIntMappingType()) {
+ case Username:
+ found = userDAO.find(uid);
+ if (found != null) {
+ result.add(found.getId());
+ }
+ break;
+
+ case SyncopeUserId:
+ found = userDAO.find(Long.parseLong(uid));
+ if (found != null) {
+ result.add(found.getId());
+ }
+ break;
+
+ case UserSchema:
+ final UAttrValue value = new UAttrValue();
+ value.setStringValue(uid);
+ users = userDAO.findByAttrValue(accountIdMap.getIntAttrName(), value);
+ for (SyncopeUser user : users) {
+ result.add(user.getId());
+ }
+ break;
+
+ case UserDerivedSchema:
+ try {
+ users = userDAO.findByDerAttrValue(accountIdMap.getIntAttrName(), uid);
+ for (SyncopeUser user : users) {
+ result.add(user.getId());
+ }
+ } catch (InvalidSearchConditionException e) {
+ LOG.error("Could not search for matching users", e);
+ }
+ break;
+
+ default:
+ LOG.error("Invalid accountId type '{}'", accountIdMap.getIntMappingType());
+ }
+ } else {
+ // search for external attribute's name/value of each specified name
+
+ final Map<String, Attribute> extValues = new HashMap<String, Attribute>();
+
+ for (SchemaMapping mapping : syncTask.getResource().getMappings()) {
+ extValues.put(SchemaMappingUtil.getIntAttrName(mapping),
+ delta.getObject().getAttributeByName(SchemaMappingUtil.getExtAttrName(mapping)));
+ }
+
+ // search for user by attribute(s) specified in the policy
+ NodeCond searchCond = null;
+
+ for (String schema : policySpec.getAlternativeSearchAttrs()) {
+ Attribute value = extValues.get(schema);
+
+ AttributeCond.Type type;
+ String expression = null;
+
+ if (value == null || value.getValue() == null || value.getValue().isEmpty()) {
+ type = AttributeCond.Type.ISNULL;
+ } else {
+ type = AttributeCond.Type.EQ;
+ expression = value.getValue().size() > 1
+ ? value.getValue().toString()
+ : value.getValue().get(0).toString();
+ }
+
+ NodeCond nodeCond;
+ // just Username or SyncopeUserId can be selected to be used
+ if ("id".equalsIgnoreCase(schema) || "username".equalsIgnoreCase(schema)) {
+ SyncopeUserCond cond = new SyncopeUserCond();
+ cond.setSchema(schema);
+ cond.setType(type);
+ cond.setExpression(expression);
+
+ nodeCond = NodeCond.getLeafCond(cond);
+ } else {
+ AttributeCond cond = new AttributeCond();
+ cond.setSchema(schema);
+ cond.setType(type);
+ cond.setExpression(expression);
+
+ nodeCond = NodeCond.getLeafCond(cond);
+ }
+
+ searchCond = searchCond == null
+ ? nodeCond
+ : NodeCond.getAndCond(searchCond, nodeCond);
+ }
+
+ final List<SyncopeUser> users =
+ userSearchDAO.search(EntitlementUtil.getRoleIds(entitlementDAO.findAll()), searchCond);
+ for (SyncopeUser user : users) {
+ result.add(user.getId());
+ }
+ }
+
+ return result;
+ }
+
+ private List<SyncResult> createUser(SyncDelta delta, final boolean dryRun) throws JobExecutionException {
+ if (!syncTask.isPerformCreate()) {
+ LOG.debug("SyncTask not configured for create");
+ return Collections.EMPTY_LIST;
+ }
+
+ final SyncResult result = new SyncResult();
+ result.setOperation(SyncResult.Operation.CREATE);
+
+ UserTO userTO = connObjectUtil.getUserTO(delta.getObject(), syncTask);
+
+ delta = actions.beforeCreate(delta, userTO);
+
+ if (dryRun) {
+ result.setUserId(0L);
+ result.setUsername(userTO.getUsername());
+ result.setStatus(AbstractTaskJob.Status.SUCCESS);
+ } else {
+ try {
+ // --------------------------
+ // Check for status synchronization ...
+ // --------------------------
+ Boolean enabled = null;
+ if (syncTask.isSyncStatus()) {
+ Attribute status = AttributeUtil.find(OperationalAttributes.ENABLE_NAME,
+ delta.getObject().getAttributes());
+ if (status != null && status.getValue() != null && !status.getValue().isEmpty()) {
+ enabled = (Boolean) status.getValue().get(0);
+ }
+ }
+ // --------------------------
+
+ WorkflowResult<Map.Entry<Long, Boolean>> created = wfAdapter.create(userTO, true, enabled);
+
+ List<PropagationTask> tasks = propagationManager.getCreateTaskIds(created, userTO.getPassword(),
+ userTO.getVirtualAttributes(), Collections.singleton(syncTask.getResource().getName()));
+
+ taskExecutor.execute(tasks);
+
+ notificationManager.createTasks(created.getResult().getKey(), created.getPerformedTasks());
+
+ userTO = userDataBinder.getUserTO(created.getResult().getKey());
+
+ result.setUserId(created.getResult().getKey());
+ result.setUsername(userTO.getUsername());
+ result.setStatus(AbstractTaskJob.Status.SUCCESS);
+ } catch (PropagationException e) {
+ LOG.error("Could not propagate user " + delta.getUid().getUidValue(), e);
+ } catch (Exception e) {
+ result.setStatus(AbstractTaskJob.Status.FAILURE);
+ result.setMessage(e.getMessage());
+ LOG.error("Could not create user " + delta.getUid().getUidValue(), e);
+ }
+ }
+
+ actions.after(delta, userTO, result);
+ return Collections.singletonList(result);
+ }
+
+ private List<SyncResult> updateUsers(SyncDelta delta, final List<Long> users, final boolean dryRun)
+ throws JobExecutionException {
+
+ if (!syncTask.isPerformUpdate()) {
+ LOG.debug("SyncTask not configured for update");
+ return Collections.EMPTY_LIST;
+ }
+
+ LOG.debug("About to update {}", users);
+
+ List<SyncResult> results = new ArrayList<SyncResult>();
+
+ for (Long userId : users) {
+ final SyncResult result = new SyncResult();
+ result.setOperation(SyncResult.Operation.UPDATE);
+
+ try {
+ UserTO userTO = userDataBinder.getUserTO(userId);
+ try {
+
+ final UserMod userMod = connObjectUtil.getUserMod(userId, delta.getObject(), syncTask);
+ delta = actions.beforeUpdate(delta, userTO, userMod);
+
+ result.setStatus(AbstractTaskJob.Status.SUCCESS);
+ result.setUserId(userMod.getId());
+ result.setUsername(userMod.getUsername());
+
+ if (!dryRun) {
+ WorkflowResult<Map.Entry<Long, Boolean>> updated = wfAdapter.update(userMod);
+
+ List<PropagationTask> tasks = propagationManager.getUpdateTaskIds(updated,
+ userMod.getPassword(), userMod.getVirtualAttributesToBeRemoved(),
+ userMod.getVirtualAttributesToBeUpdated(),
+ Collections.singleton(syncTask.getResource().getName()));
+
+ taskExecutor.execute(tasks);
+
+ notificationManager.createTasks(updated.getResult().getKey(), updated.getPerformedTasks());
+
+ userTO = userDataBinder.getUserTO(updated.getResult().getKey());
+ }
+ } catch (PropagationException e) {
+ LOG.error("Could not propagate user " + delta.getUid().getUidValue(), e);
+ } catch (Exception e) {
+ result.setStatus(AbstractTaskJob.Status.FAILURE);
+ result.setMessage(e.getMessage());
+ LOG.error("Could not update user " + delta.getUid().getUidValue(), e);
+ }
+
+ actions.after(delta, userTO, result);
+ results.add(result);
+ } catch (NotFoundException e) {
+ LOG.error("Could not find user {}", userId, e);
+ } catch (UnauthorizedRoleException e) {
+ LOG.error("Not allowed to read user {}", userId, e);
+ }
+ }
+
+ return results;
+ }
+
+ private List<SyncResult> deleteUsers(SyncDelta delta, final List<Long> users, final boolean dryRun)
+ throws JobExecutionException {
+
+ if (!syncTask.isPerformDelete()) {
+ LOG.debug("SyncTask not configured for delete");
+ return Collections.EMPTY_LIST;
+ }
+
+ LOG.debug("About to delete {}", users);
+
+ List<SyncResult> results = new ArrayList<SyncResult>();
+
+ for (Long userId : users) {
+ try {
+ UserTO userTO = userDataBinder.getUserTO(userId);
+ delta = actions.beforeDelete(delta, userTO);
+
+ final SyncResult result = new SyncResult();
+ result.setUserId(userId);
+ result.setUsername(userTO.getUsername());
+ result.setOperation(SyncResult.Operation.DELETE);
+ result.setStatus(AbstractTaskJob.Status.SUCCESS);
+
+ if (!dryRun) {
+ try {
+ List<PropagationTask> tasks = propagationManager.getDeleteTaskIds(userId,
+ syncTask.getResource().getName());
+ taskExecutor.execute(tasks);
+
+ notificationManager.createTasks(userId, Collections.singleton("delete"));
+ } catch (Exception e) {
+ LOG.error("Could not propagate user " + userId, e);
+ }
+
+ try {
+ wfAdapter.delete(userId);
+ } catch (Exception e) {
+ result.setStatus(AbstractTaskJob.Status.FAILURE);
+ result.setMessage(e.getMessage());
+ LOG.error("Could not delete user " + userId, e);
+ }
+ }
+
+ actions.after(delta, userTO, result);
+ results.add(result);
+ } catch (NotFoundException e) {
+ LOG.error("Could not find user {}", userId, e);
+ } catch (UnauthorizedRoleException e) {
+ LOG.error("Not allowed to read user {}", userId, e);
+ }
+ }
+
+ return results;
+ }
+
+ /**
+ * Look into SyncDelta and take necessary actions (create / update / delete) on user(s).
+ *
+ * @param delta returned by the underlying connector
+ * @return list of synchronization results
+ * @throws JobExecutionException in case of synchronization failure.
+ */
+ protected final List<SyncResult> doHandle(final SyncDelta delta) throws JobExecutionException {
+ final List<SyncResult> results = new ArrayList<SyncResult>();
+
+ LOG.debug("Process '{}' for '{}'", delta.getDeltaType(), delta.getUid().getUidValue());
+
+ final List<Long> users = findExistingUsers(delta);
+
+ if (SyncDeltaType.CREATE_OR_UPDATE == delta.getDeltaType()) {
+ if (users.isEmpty()) {
+ results.addAll(createUser(delta, dryRun));
+ } else if (users.size() == 1) {
+ results.addAll(updateUsers(delta, users.subList(0, 1), dryRun));
+ } else {
+ switch (resAct) {
+ case IGNORE:
+ LOG.error("More than one match {}", users);
+ break;
+
+ case FIRSTMATCH:
+ results.addAll(updateUsers(delta, users.subList(0, 1), dryRun));
+ break;
+
+ case LASTMATCH:
+ results.addAll(updateUsers(delta, users.subList(users.size() - 1, users.size()), dryRun));
+ break;
+
+ case ALL:
+ results.addAll(updateUsers(delta, users, dryRun));
+ break;
+
+ default:
+ }
+ }
+ }
+
+ if (SyncDeltaType.DELETE == delta.getDeltaType()) {
+ if (users.isEmpty()) {
+ LOG.debug("No match found for deletion");
+ } else if (users.size() == 1) {
+ results.addAll(deleteUsers(delta, users, dryRun));
+ } else {
+ switch (resAct) {
+ case IGNORE:
+ LOG.error("More than one match {}", users);
+ break;
+
+ case FIRSTMATCH:
+ results.addAll(deleteUsers(delta, users.subList(0, 1), dryRun));
+ break;
+
+ case LASTMATCH:
+ results.addAll(deleteUsers(delta, users.subList(users.size() - 1, users.size()), dryRun));
+ break;
+
+ case ALL:
+ results.addAll(deleteUsers(delta, users, dryRun));
+ break;
+
+ default:
+ }
+ }
+ }
+
+ return results;
+ }
+}
Propchange: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncopeSyncResultHanlder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncopeSyncResultHanlder.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncopeSyncResultHanlder.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/syncope/trunk/core/src/main/resources/logback.xml
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/resources/logback.xml?rev=1401182&r1=1401181&r2=1401182&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/resources/logback.xml (original)
+++ incubator/syncope/trunk/core/src/main/resources/logback.xml Tue Oct 23 07:49:23 2012
@@ -101,7 +101,19 @@ under the License.
<appender-ref ref="main"/>
</logger>
- <logger name="org.apache.syncope.core.scheduling" additivity="false">
+ <logger name="org.apache.syncope.core.quartz" additivity="false">
+ <level value="INFO"/>
+ <appender-ref ref="main"/>
+ </logger>
+ <logger name="org.apache.syncope.core.sync" additivity="false">
+ <level value="INFO"/>
+ <appender-ref ref="main"/>
+ </logger>
+ <logger name="org.apache.syncope.core.notification" additivity="false">
+ <level value="INFO"/>
+ <appender-ref ref="main"/>
+ </logger>
+ <logger name="org.apache.syncope.core.report" additivity="false">
<level value="INFO"/>
<appender-ref ref="main"/>
</logger>
Modified: incubator/syncope/trunk/core/src/main/resources/schedulingContext.xml
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/resources/schedulingContext.xml?rev=1401182&r1=1401181&r2=1401182&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/resources/schedulingContext.xml (original)
+++ incubator/syncope/trunk/core/src/main/resources/schedulingContext.xml Tue Oct 23 07:49:23 2012
@@ -33,7 +33,7 @@ under the License.
<property name="dataSource" ref="dataSource"/>
<property name="transactionManager" ref="transactionManager"/>
<property name="jobFactory">
- <bean class="org.apache.syncope.core.scheduling.SpringBeanJobFactory"/>
+ <bean class="org.apache.syncope.core.quartz.SpringBeanJobFactory"/>
</property>
<property name="quartzProperties">
<props>
@@ -50,5 +50,5 @@ under the License.
</property>
</bean>
- <bean id="notificationJob" class="org.apache.syncope.core.scheduling.NotificationJob"/>
+ <bean id="notificationJob" class="org.apache.syncope.core.notification.NotificationJob"/>
</beans>
Modified: incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/notification/NotificationTest.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/notification/NotificationTest.java?rev=1401182&r1=1401181&r2=1401182&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/notification/NotificationTest.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/notification/NotificationTest.java Tue Oct 23 07:49:23 2012
@@ -48,7 +48,6 @@ import org.apache.syncope.core.persisten
import org.apache.syncope.core.rest.UserTestITCase;
import org.apache.syncope.core.rest.controller.TaskController;
import org.apache.syncope.core.rest.controller.UserController;
-import org.apache.syncope.core.scheduling.NotificationJob;
import org.apache.syncope.types.IntMappingType;
import org.apache.syncope.types.TraceLevel;
import org.junit.AfterClass;
Modified: incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TaskTest.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TaskTest.java?rev=1401182&r1=1401181&r2=1401182&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TaskTest.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TaskTest.java Tue Oct 23 07:49:23 2012
@@ -31,7 +31,7 @@ import org.apache.syncope.core.persisten
import org.apache.syncope.core.persistence.beans.SyncTask;
import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
-import org.apache.syncope.core.scheduling.TestSyncJobActions;
+import org.apache.syncope.core.quartz.TestSyncActions;
import org.apache.syncope.types.PropagationMode;
import org.apache.syncope.types.PropagationOperation;
import org.identityconnectors.framework.common.objects.Attribute;
@@ -138,7 +138,7 @@ public class TaskTest extends AbstractTe
assertNotNull(exception);
task.setResource(resource);
- task.setJobActionsClassName(getClass().getName());
+ task.setActionsClassName(getClass().getName());
// this save() fails because jobActionsClassName does not implement
// the right interface
@@ -150,7 +150,7 @@ public class TaskTest extends AbstractTe
}
assertNotNull(exception);
- task.setJobActionsClassName(TestSyncJobActions.class.getName());
+ task.setActionsClassName(TestSyncActions.class.getName());
// this save() finally works
task = taskDAO.save(task);
assertNotNull(task);
@@ -186,7 +186,7 @@ public class TaskTest extends AbstractTe
task.setResource(resource);
task.setName("issueSYNCOPE144");
task.setDescription("issueSYNCOPE144 Description");
- task.setJobActionsClassName(TestSyncJobActions.class.getName());
+ task.setActionsClassName(TestSyncActions.class.getName());
task = taskDAO.save(task);
assertNotNull(task);
Copied: incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/quartz/TestSyncActions.java (from r1400893, incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/scheduling/TestSyncJobActions.java)
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/quartz/TestSyncActions.java?p2=incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/quartz/TestSyncActions.java&p1=incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/scheduling/TestSyncJobActions.java&r1=1400893&r2=1401182&rev=1401182&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/scheduling/TestSyncJobActions.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/quartz/TestSyncActions.java Tue Oct 23 07:49:23 2012
@@ -16,18 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.syncope.core.scheduling;
+package org.apache.syncope.core.quartz;
-import org.apache.syncope.core.scheduling.DefaultSyncJobActions;
import java.util.Collections;
-import org.identityconnectors.framework.common.objects.SyncDelta;
-import org.quartz.JobExecutionException;
import org.apache.syncope.client.mod.AttributeMod;
import org.apache.syncope.client.mod.UserMod;
import org.apache.syncope.client.to.AttributeTO;
import org.apache.syncope.client.to.UserTO;
+import org.apache.syncope.core.sync.DefaultSyncActions;
+import org.identityconnectors.framework.common.objects.SyncDelta;
+import org.quartz.JobExecutionException;
-public class TestSyncJobActions extends DefaultSyncJobActions {
+public class TestSyncActions extends DefaultSyncActions {
private int counter = 0;
Modified: incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java?rev=1401182&r1=1401181&r2=1401182&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java Tue Oct 23 07:49:23 2012
@@ -38,10 +38,10 @@ import org.apache.syncope.client.to.Sche
import org.apache.syncope.client.to.SyncTaskTO;
import org.apache.syncope.client.to.TaskTO;
import org.apache.syncope.client.to.UserTO;
-import org.apache.syncope.core.scheduling.SyncJob;
+import org.apache.syncope.core.sync.SyncJob;
import org.apache.syncope.core.init.SpringContextInitializer;
import org.apache.syncope.types.PropagationTaskExecStatus;
-import org.apache.syncope.core.scheduling.TestSyncJobActions;
+import org.apache.syncope.core.quartz.TestSyncActions;
import org.apache.syncope.types.IntMappingType;
import org.apache.syncope.types.TraceLevel;
@@ -55,8 +55,8 @@ public class TaskTestITCase extends Abst
}
@Test
- public void getJobActionsClasses() {
- Set<String> actions = restTemplate.getForObject(BASE_URL + "task/jobActionsClasses.json", Set.class);
+ public void getSyncActionsClasses() {
+ Set<String> actions = restTemplate.getForObject(BASE_URL + "task/syncActionsClasses.json", Set.class);
assertNotNull(actions);
assertFalse(actions.isEmpty());
}
@@ -253,7 +253,7 @@ public class TaskTestITCase extends Abst
assertNotNull(task);
// add custom SyncJob actions
- task.setJobActionsClassName(TestSyncJobActions.class.getName());
+ task.setActionsClassName(TestSyncActions.class.getName());
// add user template
UserTO template = new UserTO();
@@ -282,7 +282,7 @@ public class TaskTestITCase extends Abst
SyncTaskTO actual = restTemplate.postForObject(BASE_URL + "task/update/sync", task, SyncTaskTO.class);
assertNotNull(actual);
assertEquals(task.getId(), actual.getId());
- assertEquals(TestSyncJobActions.class.getName(), actual.getJobActionsClassName());
+ assertEquals(TestSyncActions.class.getName(), actual.getActionsClassName());
SyncTaskTO taskTO = restTemplate.getForObject(BASE_URL + "task/read/{taskId}", SyncTaskTO.class, 4L);
Modified: incubator/syncope/trunk/core/src/test/resources/content.xml
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/resources/content.xml?rev=1401182&r1=1401181&r2=1401182&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/resources/content.xml (original)
+++ incubator/syncope/trunk/core/src/test/resources/content.xml Tue Oct 23 07:49:23 2012
@@ -571,19 +571,19 @@ under the License.
xmlAttributes="%3Cset%3E%0A++%3Corg.identityconnectors.framework.common.objects.Name%3E%0A++++%3Cname%3E__NAME__%3C%2Fname%3E%0A++++%3Cvalue+class%3D%22java.util.Collections%24UnmodifiableRandomAccessList%22+resolves-to%3D%22java.util.Collections%24UnmodifiableList%22%3E%0A++++++%3Cc+class%3D%22list%22%3E%0A++++++++%3Cstring%3EuserId%3C%2Fstring%3E%0A++++++%3C%2Fc%3E%0A++++++%3Clist+reference%3D%22..%2Fc%22%2F%3E%0A++++%3C%2Fvalue%3E%0A++%3C%2Forg.identityconnectors.framework.common.objects.Name%3E%0A++%3Corg.identityconnectors.framework.common.objects.Attribute%3E%0A++++%3Cname%3E__PASSWORD__%3C%2Fname%3E%0A++++%3Cvalue+class%3D%22java.util.Collections%24UnmodifiableRandomAccessList%22+resolves-to%3D%22java.util.Collections%24UnmodifiableList%22%3E%0A++++++%3Cc+class%3D%22list%22%3E%0A++++++++%3Corg.identityconnectors.common.security.GuardedString%3E%0A++++++++++%3C__readOnly%3Efalse%3C%2F__readOnly%3E%0A++++++++++%3C__disposed%3Efalse%3C%2F__disposed%3E%0A+++++++++
+%3C__encryptedBytes%3EQTOgwEhIHqtAI%2FYlgDhYc37esEF8VLDMU2IY1ciltrg%3D%3C%2F__encryptedBytes%3E%0A++++++++++%3C__base64SHA1Hash%3EW5%2FrwtdCnI8gAnIUhKcahMEnMMc%3D%3C%2F__base64SHA1Hash%3E%0A++++++++%3C%2Forg.identityconnectors.common.security.GuardedString%3E%0A++++++%3C%2Fc%3E%0A++++++%3Clist+reference%3D%22..%2Fc%22%2F%3E%0A++++%3C%2Fvalue%3E%0A++%3C%2Forg.identityconnectors.framework.common.objects.Attribute%3E%0A++%3Corg.identityconnectors.framework.common.objects.Attribute%3E%0A++++%3Cname%3Etype%3C%2Fname%3E%0A++++%3Cvalue+class%3D%22java.util.Collections%24UnmodifiableRandomAccessList%22+resolves-to%3D%22java.util.Collections%24UnmodifiableList%22%3E%0A++++++%3Cc+class%3D%22list%22%3E%0A++++++++%3Cstring%3Etype%3C%2Fstring%3E%0A++++++%3C%2Fc%3E%0A++++++%3Clist+reference%3D%22..%2Fc%22%2F%3E%0A++++%3C%2Fvalue%3E%0A++%3C%2Forg.identityconnectors.framework.common.objects.Attribute%3E%0A%3C%2Fset%3E"/>
<Task DTYPE="SyncTask" id="4" name="CSV Task" resource_name="resource-csv"
performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
- jobClassName="org.apache.syncope.core.scheduling.SyncJob"/>
- <Task DTYPE="SchedTask" id="5" name="SampleJob Task" jobClassName="org.apache.syncope.core.scheduling.SampleJob" cronExpression="0 0 0 1 * ?"/>
+ jobClassName="org.apache.syncope.core.sync.SyncJob"/>
+ <Task DTYPE="SchedTask" id="5" name="SampleJob Task" jobClassName="org.apache.syncope.core.quartz.SampleJob" cronExpression="0 0 0 1 * ?"/>
<Task DTYPE="PropagationTask" id="6" propagationMode="TWO_PHASES" propagationOperation="UPDATE"
resource_name="ws-target-resource-nopropagation" syncopeUser_id="1"
xmlAttributes="%3Cset%3E%0A++%3Corg.identityconnectors.framework.common.objects.Name%3E%0A++++%3Cname%3E__NAME__%3C%2Fname%3E%0A++++%3Cvalue+class%3D%22java.util.Collections%24UnmodifiableRandomAccessList%22+resolves-to%3D%22java.util.Collections%24UnmodifiableList%22%3E%0A++++++%3Cc+class%3D%22list%22%3E%0A++++++++%3Cstring%3EuserId%3C%2Fstring%3E%0A++++++%3C%2Fc%3E%0A++++++%3Clist+reference%3D%22..%2Fc%22%2F%3E%0A++++%3C%2Fvalue%3E%0A++%3C%2Forg.identityconnectors.framework.common.objects.Name%3E%0A++%3Corg.identityconnectors.framework.common.objects.Attribute%3E%0A++++%3Cname%3E__PASSWORD__%3C%2Fname%3E%0A++++%3Cvalue+class%3D%22java.util.Collections%24UnmodifiableRandomAccessList%22+resolves-to%3D%22java.util.Collections%24UnmodifiableList%22%3E%0A++++++%3Cc+class%3D%22list%22%3E%0A++++++++%3Corg.identityconnectors.common.security.GuardedString%3E%0A++++++++++%3C__readOnly%3Efalse%3C%2F__readOnly%3E%0A++++++++++%3C__disposed%3Efalse%3C%2F__disposed%3E%0A+++++++++
+%3C__encryptedBytes%3EQTOgwEhIHqtAI%2FYlgDhYc37esEF8VLDMU2IY1ciltrg%3D%3C%2F__encryptedBytes%3E%0A++++++++++%3C__base64SHA1Hash%3EW5%2FrwtdCnI8gAnIUhKcahMEnMMc%3D%3C%2F__base64SHA1Hash%3E%0A++++++++%3C%2Forg.identityconnectors.common.security.GuardedString%3E%0A++++++%3C%2Fc%3E%0A++++++%3Clist+reference%3D%22..%2Fc%22%2F%3E%0A++++%3C%2Fvalue%3E%0A++%3C%2Forg.identityconnectors.framework.common.objects.Attribute%3E%0A++%3Corg.identityconnectors.framework.common.objects.Attribute%3E%0A++++%3Cname%3Etype%3C%2Fname%3E%0A++++%3Cvalue+class%3D%22java.util.Collections%24UnmodifiableRandomAccessList%22+resolves-to%3D%22java.util.Collections%24UnmodifiableList%22%3E%0A++++++%3Cc+class%3D%22list%22%3E%0A++++++++%3Cstring%3Etype%3C%2Fstring%3E%0A++++++%3C%2Fc%3E%0A++++++%3Clist+reference%3D%22..%2Fc%22%2F%3E%0A++++%3C%2Fvalue%3E%0A++%3C%2Forg.identityconnectors.framework.common.objects.Attribute%3E%0A++%3Corg.identityconnectors.framework.common.objects.Attribute%3E%0A++++%3Cname%3Eful
lname%3C%2Fname%3E%0A++++%3Cvalue+class%3D%22java.util.Collections%24UnmodifiableRandomAccessList%22+resolves-to%3D%22java.util.Collections%24UnmodifiableList%22%3E%0A++++++%3Cc+class%3D%22list%22%3E%0A++++++++%3Cstring%3Efullname%3C%2Fstring%3E%0A++++++%3C%2Fc%3E%0A++++++%3Clist+reference%3D%22..%2Fc%22%2F%3E%0A++++%3C%2Fvalue%3E%0A++%3C%2Forg.identityconnectors.framework.common.objects.Attribute%3E%0A%3C%2Fset%3E%0A"/>
<Task DTYPE="SyncTask" id="7" name="TestDB Task" resource_name="resource-testdb"
performCreate="1" performUpdate="1" performDelete="0" syncStatus="1" fullReconciliation="1"
- jobClassName="org.apache.syncope.core.scheduling.SyncJob"/>
+ jobClassName="org.apache.syncope.core.sync.SyncJob"/>
<Task DTYPE="NotificationTask" id="8" sender="admin@prova.org" subject="Notification for SYNCOPE-81"
textBody="NOTIFICATION-81" htmlBody="NOTIFICATION-81" traceLevel="ALL"/>
<Task DTYPE="SyncTask" id="9" name="TestDB2 Task" resource_name="resource-testdb2"
performCreate="1" performUpdate="1" performDelete="0" syncStatus="1" fullReconciliation="1"
- jobClassName="org.apache.syncope.core.scheduling.SyncJob"/>
+ jobClassName="org.apache.syncope.core.sync.SyncJob"/>
<NotificationTask_recipients notificationtask_id="8" address="recipient@prova.org"/>