syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [1/5] syncope git commit: [SYNCOPE-670] #resolve
Date Fri, 22 May 2015 10:24:40 GMT
Repository: syncope
Updated Branches:
  refs/heads/1_2_X b43c9c86d -> 15cca152d
  refs/heads/master d489e8c59 -> 22a9e12e5


[SYNCOPE-670] #resolve


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/15cca152
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/15cca152
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/15cca152

Branch: refs/heads/1_2_X
Commit: 15cca152d4abdfa42fe31a5f00f9c848cf31548b
Parents: b43c9c8
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Fri May 22 11:42:16 2015 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Fri May 22 11:42:16 2015 +0200

----------------------------------------------------------------------
 .../syncope/common/services/ReportService.java  |  6 +-
 .../syncope/common/services/TaskService.java    |  6 +-
 .../propagation/impl/PropagationManager.java    |  6 +-
 .../rest/controller/AbstractJobController.java  | 97 ++++++++++++--------
 .../core/rest/controller/ReportController.java  |  8 +-
 .../core/rest/controller/TaskController.java    |  8 +-
 .../core/rest/controller/UserController.java    |  4 +-
 .../data/AbstractAttributableDataBinder.java    |  2 +-
 .../core/services/ReportServiceImpl.java        |  8 +-
 .../syncope/core/services/TaskServiceImpl.java  |  8 +-
 .../activiti/ActivitiUserWorkflowAdapter.java   |  6 +-
 .../workflow/user/activiti/task/Update.java     | 11 ++-
 .../syncope/core/rest/TaskTestITCase.java       | 29 +++---
 13 files changed, 111 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/15cca152/common/src/main/java/org/apache/syncope/common/services/ReportService.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/syncope/common/services/ReportService.java b/common/src/main/java/org/apache/syncope/common/services/ReportService.java
index 47a75ac..fefca5f 100644
--- a/common/src/main/java/org/apache/syncope/common/services/ReportService.java
+++ b/common/src/main/java/org/apache/syncope/common/services/ReportService.java
@@ -205,15 +205,15 @@ public interface ReportService extends JAXRSService {
     @GET
     @Path("jobs")
     @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-    List<ReportExecTO> list(@MatrixParam("type") JobStatusType type);
+    List<ReportExecTO> listJobs(@MatrixParam("type") JobStatusType type);
 
     /**
      * Execute a control action on an existing report
      *
-     * @param action
      * @param reportId id of report
+     * @param action
      */
     @POST
     @Path("{reportId}")
-    void process(@QueryParam("action") JobAction action, @PathParam("reportId") Long reportId);
+    void actionJob(@PathParam("reportId") Long reportId, @QueryParam("action") JobAction
action);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/15cca152/common/src/main/java/org/apache/syncope/common/services/TaskService.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/syncope/common/services/TaskService.java b/common/src/main/java/org/apache/syncope/common/services/TaskService.java
index 70929db..5b197c6 100644
--- a/common/src/main/java/org/apache/syncope/common/services/TaskService.java
+++ b/common/src/main/java/org/apache/syncope/common/services/TaskService.java
@@ -254,15 +254,15 @@ public interface TaskService extends JAXRSService {
     @GET
     @Path("jobs")
     @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-    List<TaskExecTO> list(@MatrixParam("type") JobStatusType type);
+    List<TaskExecTO> listJobs(@MatrixParam("type") JobStatusType type);
 
     /**
      * Execute a control action on an existing task
      *
-     * @param action
      * @param taskId id of task
+     * @param action
      */
     @POST
     @Path("{taskId}")
-    void process(@QueryParam("action") JobAction action, @PathParam("taskId") Long taskId);
+    void actionJob(@PathParam("taskId") Long taskId, @QueryParam("action") JobAction action);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/15cca152/core/src/main/java/org/apache/syncope/core/propagation/impl/PropagationManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/propagation/impl/PropagationManager.java
b/core/src/main/java/org/apache/syncope/core/propagation/impl/PropagationManager.java
index 4ec1964..eddbbb4 100644
--- a/core/src/main/java/org/apache/syncope/core/propagation/impl/PropagationManager.java
+++ b/core/src/main/java/org/apache/syncope/core/propagation/impl/PropagationManager.java
@@ -309,7 +309,7 @@ public class PropagationManager {
         } else {
             // b. generate the propagation task list in two phases: first the ones containing
password,
             // the the rest (with no password)
-            final PropagationByResource origPropByRes = new PropagationByResource();
+            PropagationByResource origPropByRes = new PropagationByResource();
             origPropByRes.merge(wfResult.getPropByRes());
 
             Set<String> pwdResourceNames = new HashSet<String>(userMod.getPwdPropRequest().getResourceNames());
@@ -644,9 +644,9 @@ public class PropagationManager {
 
             // update vAttrsToBeUpdated as well
             for (AbstractVirAttr virAttr : subject.getVirAttrs()) {
-                final String schema = virAttr.getSchema().getName();
+                String schema = virAttr.getSchema().getName();
 
-                final AttributeMod attributeMod = new AttributeMod();
+                AttributeMod attributeMod = new AttributeMod();
                 attributeMod.setSchema(schema);
                 attributeMod.getValuesToBeAdded().addAll(virAttr.getValues());
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/15cca152/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractJobController.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractJobController.java
b/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractJobController.java
index 4726330..ca759d9 100644
--- a/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractJobController.java
+++ b/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractJobController.java
@@ -24,6 +24,8 @@ import java.util.ArrayList;
 import java.util.List;
 import org.apache.syncope.common.AbstractBaseBean;
 import org.apache.syncope.common.to.AbstractExecTO;
+import org.apache.syncope.common.to.ReportExecTO;
+import org.apache.syncope.common.to.TaskExecTO;
 import org.apache.syncope.common.types.JobAction;
 import org.apache.syncope.common.types.JobStatusType;
 import org.quartz.JobExecutionContext;
@@ -42,97 +44,114 @@ abstract class AbstractJobController<T extends AbstractBaseBean>
extends Abstrac
 
     protected abstract Long getIdFromJobName(JobKey jobKey);
 
-    public <E extends AbstractExecTO> List<E> list(final JobStatusType type,
final Class<E> reference) {
+    private <E extends AbstractExecTO> void setTaskOrReportId(final E jobExecTO, final
Long taskOrReportId) {
+        if (jobExecTO instanceof TaskExecTO) {
+            ((TaskExecTO) jobExecTO).setTask(taskOrReportId);
+        } else if (jobExecTO instanceof ReportExecTO) {
+            ((ReportExecTO) jobExecTO).setReport(taskOrReportId);
+        }
+    }
+
+    public <E extends AbstractExecTO> List<E> listJobs(final JobStatusType type,
final Class<E> reference) {
         List<E> jobExecTOs = new ArrayList<E>();
 
         switch (type) {
             case ALL:
                 try {
                     for (String groupName : scheduler.getScheduler().getJobGroupNames())
{
-                        for (JobKey jobKey : scheduler.getScheduler().getJobKeys(GroupMatcher.jobGroupEquals(groupName)))
{
+                        for (JobKey jobKey
+                                : scheduler.getScheduler().getJobKeys(GroupMatcher.jobGroupEquals(groupName)))
{
 
                             Long jobId = getIdFromJobName(jobKey);
                             if (jobId != null) {
                                 List<? extends Trigger> jobTriggers = scheduler.getScheduler().getTriggersOfJob(jobKey);
-                                if (jobTriggers.size() > 0) {
+                                if (jobTriggers.isEmpty()) {
+                                    E jobExecTO = reference.newInstance();
+                                    setTaskOrReportId(jobExecTO, jobId);
+                                    jobExecTO.setStatus("Not Scheduled");
+
+                                    jobExecTOs.add(jobExecTO);
+                                } else {
                                     for (Trigger t : jobTriggers) {
                                         E jobExecTO = reference.newInstance();
-                                        jobExecTO.setId(jobId);
-                                        jobExecTO.
-                                                setStatus(scheduler.getScheduler().getTriggerState(t.getKey()).name());
+                                        setTaskOrReportId(jobExecTO, jobId);
+                                        jobExecTO.setStatus(
+                                                scheduler.getScheduler().getTriggerState(t.getKey()).name());
                                         jobExecTO.setStartDate(t.getStartTime());
+
                                         jobExecTOs.add(jobExecTO);
                                     }
-                                } else {
-                                    E jobExecTO = reference.newInstance();
-                                    jobExecTO.setId(jobId);
-                                    jobExecTO.setStatus("Not Scheduled");
-                                    jobExecTOs.add(jobExecTO);
                                 }
                             }
                         }
                     }
-                } catch (SchedulerException ex) {
-                    LOG.debug("Problems during retrieving all scheduled jobs {}", ex);
-                } catch (InstantiationException ex) {
-                    LOG.debug("Problems during instantiating {}  {}", reference, ex);
-                } catch (IllegalAccessException ex) {
-                    LOG.debug("Problems during accessing {}  {}", reference, ex);
+                } catch (SchedulerException e) {
+                    LOG.debug("Problems while retrieving all scheduled jobs", e);
+                } catch (InstantiationException e) {
+                    LOG.debug("Problems while instantiating {}", reference, e);
+                } catch (IllegalAccessException e) {
+                    LOG.debug("Problems while accessing {}", reference, e);
                 }
                 break;
+
             case RUNNING:
                 try {
                     for (JobExecutionContext jec : scheduler.getScheduler().getCurrentlyExecutingJobs())
{
                         Long jobId = getIdFromJobName(jec.getJobDetail().getKey());
                         if (jobId != null) {
                             E jobExecTO = reference.newInstance();
-                            jobExecTO.setId(jobId);
-                            jobExecTO.setStatus(scheduler.getScheduler().getTriggerState(jec.getTrigger().getKey()).
-                                    name());
+                            setTaskOrReportId(jobExecTO, jobId);
+                            jobExecTO.setStatus(
+                                    scheduler.getScheduler().getTriggerState(jec.getTrigger().getKey()).name());
                             jobExecTO.setStartDate(jec.getFireTime());
+
                             jobExecTOs.add(jobExecTO);
                         }
                     }
-                } catch (SchedulerException ex) {
-                    LOG.debug("Problems during retrieving all currently executing jobs {}",
ex);
-                } catch (InstantiationException ex) {
-                    LOG.debug("Problems during instantiating {}  {}", reference, ex);
-                } catch (IllegalAccessException ex) {
-                    LOG.debug("Problems during accessing {}  {}", reference, ex);
+                } catch (SchedulerException e) {
+                    LOG.debug("Problems while retrieving all currently executing jobs", e);
+                } catch (InstantiationException e) {
+                    LOG.debug("Problems while instantiating {}", reference, e);
+                } catch (IllegalAccessException e) {
+                    LOG.debug("Problems while accessing {}", reference, e);
                 }
                 break;
+
             case SCHEDULED:
                 try {
                     for (String groupName : scheduler.getScheduler().getJobGroupNames())
{
-                        for (JobKey jobKey : scheduler.getScheduler().getJobKeys(GroupMatcher.jobGroupEquals(groupName)))
{
+                        for (JobKey jobKey
+                                : scheduler.getScheduler().getJobKeys(GroupMatcher.jobGroupEquals(groupName)))
{
+
                             Long jobId = getIdFromJobName(jobKey);
                             if (jobId != null) {
                                 List<? extends Trigger> jobTriggers = scheduler.getScheduler().getTriggersOfJob(jobKey);
                                 for (Trigger t : jobTriggers) {
                                     E jobExecTO = reference.newInstance();
-                                    jobExecTO.setId(jobId);
+                                    setTaskOrReportId(jobExecTO, jobId);
                                     jobExecTO.setStatus(scheduler.getScheduler().getTriggerState(t.getKey()).name());
                                     jobExecTO.setStartDate(t.getStartTime());
+
                                     jobExecTOs.add(jobExecTO);
                                 }
                             }
                         }
                     }
-                } catch (SchedulerException ex) {
-                    LOG.debug("Problems during retrieving all scheduled jobs {}", ex);
-                } catch (InstantiationException ex) {
-                    LOG.debug("Problems during instantiating {}  {}", reference, ex);
-                } catch (IllegalAccessException ex) {
-                    LOG.debug("Problems during accessing {}  {}", reference, ex);
+                } catch (SchedulerException e) {
+                    LOG.debug("Problems while retrieving all scheduled jobs", e);
+                } catch (InstantiationException e) {
+                    LOG.debug("Problems while instantiating {}", reference, e);
+                } catch (IllegalAccessException e) {
+                    LOG.debug("Problems while accessing {}", reference, e);
                 }
                 break;
+
             default:
         }
         return jobExecTOs;
     }
 
-    protected void process(JobAction action, String jobName) {
-
+    protected void actionJob(final String jobName, final JobAction action) {
         if (jobName != null) {
             JobKey jobKey = new JobKey(jobName, Scheduler.DEFAULT_GROUP);
             try {
@@ -141,14 +160,16 @@ abstract class AbstractJobController<T extends AbstractBaseBean>
extends Abstrac
                         case START:
                             scheduler.getScheduler().triggerJob(jobKey);
                             break;
+
                         case STOP:
                             scheduler.getScheduler().interrupt(jobKey);
                             break;
+
                         default:
                     }
                 }
-            } catch (SchedulerException ex) {
-                LOG.debug("Problems during {} operation on job with id {}", action.toString(),
ex);
+            } catch (SchedulerException e) {
+                LOG.debug("Problems during {} operation on job with id {}", action.toString(),
jobName, e);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/15cca152/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java
b/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java
index 0f8d4bf..0210058 100644
--- a/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java
+++ b/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java
@@ -343,18 +343,18 @@ public class ReportController extends AbstractJobController<ReportTO>
{
 
     @Override
     @PreAuthorize("hasRole('REPORT_LIST')")
-    public <E extends AbstractExecTO> List<E> list(JobStatusType type, Class<E>
reference) {
-        return super.list(type, reference);
+    public <E extends AbstractExecTO> List<E> listJobs(final JobStatusType type,
Class<E> reference) {
+        return super.listJobs(type, reference);
     }
 
     @PreAuthorize("hasRole('REPORT_EXECUTE')")
-    public void process(JobAction action, Long reportId) {
+    public void actionJob(final Long reportId, final JobAction action) {
         Report report = reportDAO.find(reportId);
         if (report == null) {
             throw new NotFoundException("Report " + reportId);
         }
         String jobName = JobInstanceLoader.getJobName(report);
-        process(action, jobName);
+        actionJob(jobName, action);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/15cca152/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java
b/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java
index b493069..aca40e2 100644
--- a/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java
+++ b/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java
@@ -407,18 +407,18 @@ public class TaskController extends AbstractJobController<AbstractTaskTO>
{
 
     @Override
     @PreAuthorize("hasRole('TASK_LIST')")
-    public <E extends AbstractExecTO> List<E> list(JobStatusType type, Class<E>
reference) {
-        return super.list(type, reference);
+    public <E extends AbstractExecTO> List<E> listJobs(final JobStatusType type,
final Class<E> reference) {
+        return super.listJobs(type, reference);
     }
 
     @PreAuthorize("hasRole('TASK_EXECUTE')")
-    public void process(JobAction action, Long taskId) {
+    public void actionJob(final Long taskId, final JobAction action) {
         Task task = taskDAO.find(taskId);
         if (task == null) {
             throw new NotFoundException("Task " + taskId);
         }
         String jobName = JobInstanceLoader.getJobName(task);
-        process(action, jobName);
+        actionJob(jobName, action);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/15cca152/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
b/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
index be426b7..f989f4d 100644
--- a/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
+++ b/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
@@ -275,7 +275,7 @@ public class UserController extends AbstractSubjectController<UserTO,
UserMod> {
         List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(updated);
         if (tasks.isEmpty()) {
             // SYNCOPE-459: take care of user virtual attributes ...
-            final PropagationByResource propByResVirAttr = binder.fillVirtual(
+            PropagationByResource propByResVirAttr = binder.fillVirtual(
                     updated.getResult().getKey().getId(),
                     actual.getVirAttrsToRemove(),
                     actual.getVirAttrsToUpdate());
@@ -311,7 +311,7 @@ public class UserController extends AbstractSubjectController<UserTO,
UserMod> {
             }
         }
 
-        final UserTO updatedTO = binder.getUserTO(updated.getResult().getKey().getId());
+        UserTO updatedTO = binder.getUserTO(updated.getResult().getKey().getId());
         updatedTO.getPropagationStatusTOs().addAll(propagationReporter.getStatuses());
         return updatedTO;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/15cca152/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java
b/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java
index dbcb40a..43b6df7 100644
--- a/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java
+++ b/core/src/main/java/org/apache/syncope/core/rest/data/AbstractAttributableDataBinder.java
@@ -503,7 +503,7 @@ public abstract class AbstractAttributableDataBinder {
                             externalResources, IntMappingType.MembershipVirtualSchema, propByRes);
                 }
 
-                final List<String> values = new ArrayList<String>(virAttr.getValues());
+                List<String> values = new ArrayList<String>(virAttr.getValues());
                 values.removeAll(vAttrToBeUpdated.getValuesToBeRemoved());
                 values.addAll(vAttrToBeUpdated.getValuesToBeAdded());
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/15cca152/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java b/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java
index a4176fb..c4a31c7 100644
--- a/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java
+++ b/core/src/main/java/org/apache/syncope/core/services/ReportServiceImpl.java
@@ -132,12 +132,12 @@ public class ReportServiceImpl extends AbstractServiceImpl implements
ReportServ
     }
     
     @Override
-    public List<ReportExecTO> list(JobStatusType type) {
-        return controller.list(type, ReportExecTO.class);
+    public List<ReportExecTO> listJobs(final JobStatusType type) {
+        return controller.listJobs(type, ReportExecTO.class);
     }
     
     @Override
-    public void process(JobAction action, Long reportId) {
-        controller.process(action, reportId);
+    public void actionJob(final Long reportId, final JobAction action) {
+        controller.actionJob(reportId, action);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/15cca152/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java b/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java
index 51b140a..16a6741 100644
--- a/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java
+++ b/core/src/main/java/org/apache/syncope/core/services/TaskServiceImpl.java
@@ -159,12 +159,12 @@ public class TaskServiceImpl extends AbstractServiceImpl implements
TaskService
     }
 
     @Override
-    public List<TaskExecTO> list(JobStatusType type) {
-        return controller.list(type, TaskExecTO.class);
+    public List<TaskExecTO> listJobs(final JobStatusType type) {
+        return controller.listJobs(type, TaskExecTO.class);
     }
 
     @Override
-    public void process(JobAction action, Long taskId) {
-        controller.process(action, taskId);
+    public void actionJob(final Long taskId, final JobAction action) {
+        controller.actionJob(taskId, action);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/15cca152/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
index 00fa956..e15942e 100644
--- a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
+++ b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/ActivitiUserWorkflowAdapter.java
@@ -359,13 +359,15 @@ public class ActivitiUserWorkflowAdapter extends AbstractUserWorkflowAdapter
{
 
         PropagationByResource propByRes =
                 runtimeService.getVariable(user.getWorkflowId(), PROP_BY_RESOURCE, PropagationByResource.class);
+        UserMod updatedMod =
+                runtimeService.getVariable(user.getWorkflowId(), USER_MOD, UserMod.class);
 
-        saveForFormSubmit(updated, userMod.getPassword(), propByRes);
+        saveForFormSubmit(updated, updatedMod.getPassword(), propByRes);
 
         Boolean propagateEnable = runtimeService.getVariable(user.getWorkflowId(), PROPAGATE_ENABLE,
Boolean.class);
 
         return new WorkflowResult<Map.Entry<UserMod, Boolean>>(
-                new SimpleEntry<UserMod, Boolean>(userMod, propagateEnable), propByRes,
tasks);
+                new SimpleEntry<UserMod, Boolean>(updatedMod, propagateEnable), propByRes,
tasks);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/15cca152/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Update.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Update.java
b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Update.java
index dda6f30..e110df9 100644
--- a/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Update.java
+++ b/core/src/main/java/org/apache/syncope/core/workflow/user/activiti/task/Update.java
@@ -41,15 +41,18 @@ public class Update extends AbstractActivitiServiceTask {
                 runtimeService.getVariable(executionId, ActivitiUserWorkflowAdapter.USER_MOD,
UserMod.class);
 
         // update password internally only if required
-        UserMod actualMod = SerializationUtils.clone(userMod);
-        if (actualMod.getPwdPropRequest() != null && !actualMod.getPwdPropRequest().isOnSyncope())
{
-            actualMod.setPassword(null);
+        UserMod updatedMod = SerializationUtils.clone(userMod);
+        String updatedPwd = updatedMod.getPassword();
+        if (updatedMod.getPwdPropRequest() != null && !updatedMod.getPwdPropRequest().isOnSyncope())
{
+            updatedMod.setPassword(null);
         }
         // update SyncopeUser
-        PropagationByResource propByRes = dataBinder.update(user, actualMod);
+        PropagationByResource propByRes = dataBinder.update(user, updatedMod);
+        updatedMod.setPassword(updatedPwd);
 
         // report updated user and propagation by resource as result
         runtimeService.setVariable(executionId, ActivitiUserWorkflowAdapter.SYNCOPE_USER,
user);
+        runtimeService.setVariable(executionId, ActivitiUserWorkflowAdapter.USER_MOD, updatedMod);
         runtimeService.setVariable(executionId, ActivitiUserWorkflowAdapter.PROP_BY_RESOURCE,
propByRes);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/15cca152/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java b/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
index 115f2c6..6309ef8 100644
--- a/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
+++ b/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
@@ -1450,58 +1450,55 @@ public class TaskTestITCase extends AbstractTest {
 
     @Test
     public void issueSYNCOPE660() {
-        List<TaskExecTO> list = taskService.list(JobStatusType.ALL);
+        List<TaskExecTO> list = taskService.listJobs(JobStatusType.ALL);
         int old_size = list.size();
 
-        list = taskService.list(JobStatusType.SCHEDULED);
-
         SchedTaskTO task = new SchedTaskTO();
         task.setName("issueSYNCOPE660");
         task.setDescription("issueSYNCOPE660 Description");
         task.setJobClassName(TestSampleJob.class.getName());
 
         Response response = taskService.create(task);
-        SchedTaskTO actual = getObject(response.getLocation(), TaskService.class, SchedTaskTO.class);
+        task = getObject(response.getLocation(), TaskService.class, SchedTaskTO.class);
 
-        list = taskService.list(JobStatusType.ALL);
-        assertEquals(list.size(), old_size + 1);
+        list = taskService.listJobs(JobStatusType.ALL);
+        assertEquals(old_size + 1, list.size());
 
-        taskService.process(JobAction.START, actual.getId());
+        taskService.actionJob(task.getId(), JobAction.START);
 
         int i = 0, maxit = 50;
 
-        // wait for task exec completion (executions incremented)
         do {
             try {
                 Thread.sleep(1000);
             } catch (InterruptedException e) {
+                // ignore
             }
 
-            list = taskService.list(JobStatusType.RUNNING);
-
+            list = taskService.listJobs(JobStatusType.RUNNING);
             assertNotNull(list);
             i++;
         } while (list.size() < 1 && i < maxit);
 
-        assertEquals(list.size(), 1);
+        assertEquals(1, list.size());
+        assertEquals(task.getId(), list.get(0).getTask());
 
-        taskService.process(JobAction.STOP, actual.getId());
+        taskService.actionJob(task.getId(), JobAction.STOP);
 
         i = 0;
 
-        // wait for task exec completion (executions incremented)
         do {
             try {
                 Thread.sleep(1000);
             } catch (InterruptedException e) {
+                // ignore
             }
 
-            list = taskService.list(JobStatusType.RUNNING);
-
+            list = taskService.listJobs(JobStatusType.RUNNING);
             assertNotNull(list);
             i++;
         } while (list.size() >= 1 && i < maxit);
 
-        assertEquals(list.size(), 0);
+        assertTrue(list.isEmpty());
     }
 }


Mime
View raw message