syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbernha...@apache.org
Subject svn commit: r1421363 - in /syncope/branches/cxf: ./ common/src/main/java/org/apache/syncope/mod/ common/src/main/java/org/apache/syncope/services/ core/src/main/java/org/apache/syncope/core/rest/ core/src/main/java/org/apache/syncope/core/rest/controll...
Date Thu, 13 Dec 2012 16:24:57 GMT
Author: jbernhardt
Date: Thu Dec 13 16:24:56 2012
New Revision: 1421363

URL: http://svn.apache.org/viewvc?rev=1421363&view=rev
Log:
[SYNCOPE-231]
Modified activation/suspension interface
Fixes of UserControllerITCase

Added:
    syncope/branches/cxf/common/src/main/java/org/apache/syncope/mod/StatusMod.java
Modified:
    syncope/branches/cxf/   (props changed)
    syncope/branches/cxf/common/src/main/java/org/apache/syncope/services/UnauthorizedRoleException.java
    syncope/branches/cxf/common/src/main/java/org/apache/syncope/services/UserService.java
    syncope/branches/cxf/core/src/main/java/org/apache/syncope/core/rest/QueryResourceInfoComperator.java
    syncope/branches/cxf/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
    syncope/branches/cxf/core/src/test/java/org/apache/syncope/core/rest/AbstractUserTestITCase.java

Propchange: syncope/branches/cxf/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Dec 13 16:24:56 2012
@@ -1,3 +1,2 @@
-target
 .subversion
 .pom.xml.swp

Added: syncope/branches/cxf/common/src/main/java/org/apache/syncope/mod/StatusMod.java
URL: http://svn.apache.org/viewvc/syncope/branches/cxf/common/src/main/java/org/apache/syncope/mod/StatusMod.java?rev=1421363&view=auto
==============================================================================
--- syncope/branches/cxf/common/src/main/java/org/apache/syncope/mod/StatusMod.java (added)
+++ syncope/branches/cxf/common/src/main/java/org/apache/syncope/mod/StatusMod.java Thu Dec 13 16:24:56 2012
@@ -0,0 +1,121 @@
+/*
+ * 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.mod;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.syncope.AbstractBaseBean;
+
+@XmlType
+@XmlRootElement
+public class StatusMod extends AbstractBaseBean {
+
+    public enum Status {
+        ACTIVATE, REACTIVATE, SUSPEND;
+    }
+
+    public StatusMod(long id, Status status) {
+        this.id = id;
+        this.status = status;
+    }
+
+    public StatusMod() {
+    }
+
+    private Status status;
+
+    private String token;
+
+    private static final long serialVersionUID = 1338094801957616986L;
+
+    private long id;
+
+    private boolean updateInternal = true;
+
+    private boolean updateRemote = true;
+
+    private final Set<String> excludeResources = new HashSet<String>();
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public boolean isUpdateInternal() {
+        return updateInternal;
+    }
+
+    public void setUpdateInternal(boolean updateInternal) {
+        this.updateInternal = updateInternal;
+    }
+
+    public boolean isUpdateRemote() {
+        return updateRemote;
+    }
+
+    public void setUpdateRemote(boolean updateRemote) {
+        this.updateRemote = updateRemote;
+    }
+
+    @XmlElementWrapper(name = "excludeResources")
+    @XmlElement(name = "resource")
+    public Set<String> getExcludeResources() {
+        return excludeResources;
+    }
+
+    /**
+     * @return the status
+     */
+    public Status getStatus() {
+        return status;
+    }
+
+    /**
+     * @param status
+     *            the status to set
+     */
+    public void setStatus(Status status) {
+        this.status = status;
+    }
+
+    /**
+     * @return the token
+     */
+    public String getToken() {
+        return token;
+    }
+
+    /**
+     * @param token
+     *            the token to set
+     */
+    public void setToken(String token) {
+        this.token = token;
+    }
+
+}

Modified: syncope/branches/cxf/common/src/main/java/org/apache/syncope/services/UnauthorizedRoleException.java
URL: http://svn.apache.org/viewvc/syncope/branches/cxf/common/src/main/java/org/apache/syncope/services/UnauthorizedRoleException.java?rev=1421363&r1=1421362&r2=1421363&view=diff
==============================================================================
--- syncope/branches/cxf/common/src/main/java/org/apache/syncope/services/UnauthorizedRoleException.java (original)
+++ syncope/branches/cxf/common/src/main/java/org/apache/syncope/services/UnauthorizedRoleException.java Thu Dec 13 16:24:56 2012
@@ -21,7 +21,7 @@ package org.apache.syncope.services;
 import java.util.Collections;
 import java.util.Set;
 
-public class UnauthorizedRoleException extends Exception {
+public class UnauthorizedRoleException extends RuntimeException {
 
     private static final long serialVersionUID = -7794737282296676827L;
 

Modified: syncope/branches/cxf/common/src/main/java/org/apache/syncope/services/UserService.java
URL: http://svn.apache.org/viewvc/syncope/branches/cxf/common/src/main/java/org/apache/syncope/services/UserService.java?rev=1421363&r1=1421362&r2=1421363&view=diff
==============================================================================
--- syncope/branches/cxf/common/src/main/java/org/apache/syncope/services/UserService.java (original)
+++ syncope/branches/cxf/common/src/main/java/org/apache/syncope/services/UserService.java Thu Dec 13 16:24:56 2012
@@ -19,20 +19,19 @@
 package org.apache.syncope.services;
 
 import java.util.List;
-import java.util.Set;
 
 import javax.ws.rs.DELETE;
 import javax.ws.rs.DefaultValue;
-import javax.ws.rs.FormParam;
 import javax.ws.rs.GET;
+import javax.ws.rs.MatrixParam;
 import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Response;
 
 import org.apache.syncope.NotFoundException;
+import org.apache.syncope.mod.StatusMod;
 import org.apache.syncope.mod.UserMod;
 import org.apache.syncope.propagation.PropagationException;
 import org.apache.syncope.search.NodeCond;
@@ -48,8 +47,8 @@ public interface UserService {
     @GET
     @PreAuthorize("hasRole('USER_READ')")
     @Transactional(readOnly = true)
-    public abstract Boolean verifyPassword(@QueryParam("uname") String username,
-            @QueryParam("pw") final String password);
+    public abstract Boolean verifyPassword(@MatrixParam("uname") String username,
+            @MatrixParam("pwd") final String password);
 
     @GET
     @Path("/count")
@@ -84,7 +83,7 @@ public interface UserService {
     @GET
     @PreAuthorize("hasRole('USER_READ')")
     @Transactional(readOnly = true, rollbackFor = { Throwable.class })
-    public abstract UserTO read(@QueryParam("uname") final String username) throws NotFoundException,
+    public abstract UserTO read(@MatrixParam("uname") final String username) throws NotFoundException,
             UnauthorizedRoleException;
 
     @POST
@@ -110,31 +109,17 @@ public interface UserService {
     @POST
     @Path("/{userId}")
     @PreAuthorize("hasRole('USER_UPDATE')")
-    public abstract UserTO update(@PathParam("userId") final Long userId, final UserMod userMod) throws NotFoundException, PropagationException,
-            UnauthorizedRoleException, WorkflowException;
+    public abstract UserTO update(@PathParam("userId") final Long userId, final UserMod userMod)
+            throws NotFoundException, PropagationException, UnauthorizedRoleException, WorkflowException;
 
-    @PUT
-    @Path("/user/{userId}/status/active")
+    @POST
+    @Path("/user/{userId}/status")
     @PreAuthorize("hasRole('USER_UPDATE')")
     @Transactional(rollbackFor = { Throwable.class })
-    public abstract UserTO activate(@PathParam("userId") final Long userId,
-            @FormParam("token") final String token,
-            @FormParam("resourceNames") final Set<String> resourceNames,
-            @FormParam("performLocally") @DefaultValue("true") final Boolean performLocally,
-            @FormParam("performRemotely") @DefaultValue("true") final Boolean performRemotely)
+    public abstract UserTO setStatus(@PathParam("userId") final Long userId, final StatusMod statusUpdate)
             throws WorkflowException, NotFoundException, UnauthorizedRoleException, PropagationException;
 
     @DELETE
-    @Path("/user/{userId}/status/active")
-    @PreAuthorize("hasRole('USER_UPDATE')")
-    @Transactional(rollbackFor = { Throwable.class })
-    public abstract UserTO suspend(@PathParam("userId") final Long userId,
-            @FormParam("resourceNames") final Set<String> resourceNames,
-            @FormParam("performLocally") @DefaultValue("true") final Boolean performLocally,
-            @FormParam("performRemotely") @DefaultValue("true") final Boolean performRemotely)
-            throws NotFoundException, WorkflowException, UnauthorizedRoleException, PropagationException;
-
-    @DELETE
     @Path("/{userId}")
     @PreAuthorize("hasRole('USER_DELETE')")
     public abstract Response delete(@PathParam("userId") final Long userId) throws NotFoundException,

Modified: syncope/branches/cxf/core/src/main/java/org/apache/syncope/core/rest/QueryResourceInfoComperator.java
URL: http://svn.apache.org/viewvc/syncope/branches/cxf/core/src/main/java/org/apache/syncope/core/rest/QueryResourceInfoComperator.java?rev=1421363&r1=1421362&r2=1421363&view=diff
==============================================================================
--- syncope/branches/cxf/core/src/main/java/org/apache/syncope/core/rest/QueryResourceInfoComperator.java (original)
+++ syncope/branches/cxf/core/src/main/java/org/apache/syncope/core/rest/QueryResourceInfoComperator.java Thu Dec 13 16:24:56 2012
@@ -81,7 +81,9 @@ public class QueryResourceInfoComperator
 
         // Get Request QueryParams
         String query = (String) message.get(Message.QUERY_STRING);
+        String path = (String) message.get(Message.REQUEST_URI);
         Map<String, List<String>> qParams = JAXRSUtils.getStructuredParams(query, "&", true, false);
+        Map<String, List<String>> mParams = JAXRSUtils.getMatrixParams(path, true);
         // Get Request Headers
         Map<?, ?> qHeader = (java.util.Map<?, ?>) message.get(Message.PROTOCOL_HEADERS);
 
@@ -89,20 +91,23 @@ public class QueryResourceInfoComperator
         for (Parameter p : params) {
             switch (p.getType()) {
             case QUERY:
-            case FORM:
                 if (qParams.containsKey(p.getName()))
                     rate += 2;
                 else if (p.getDefaultValue() == null)
                     rate -= 1;
                 break;
+            case MATRIX:
+                if (mParams.containsKey(p.getName()))
+                    rate += 2;
+                else if (p.getDefaultValue() == null)
+                    rate -= 1;
+                break;
             case HEADER:
                 if (qHeader.containsKey(p.getName()))
                     rate += 2;
                 else if (p.getDefaultValue() == null)
                     rate -= 1;
                 break;
-            default:
-                break;
             }
         }
         return rate;

Modified: syncope/branches/cxf/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
URL: http://svn.apache.org/viewvc/syncope/branches/cxf/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java?rev=1421363&r1=1421362&r2=1421363&view=diff
==============================================================================
--- syncope/branches/cxf/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java (original)
+++ syncope/branches/cxf/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java Thu Dec 13 16:24:56 2012
@@ -45,7 +45,9 @@ import org.apache.syncope.core.util.Conn
 import org.apache.syncope.core.util.EntitlementUtil;
 import org.apache.syncope.core.workflow.UserWorkflowAdapter;
 import org.apache.syncope.core.workflow.WorkflowResult;
+import org.apache.syncope.mod.StatusMod;
 import org.apache.syncope.mod.UserMod;
+import org.apache.syncope.mod.StatusMod.Status;
 import org.apache.syncope.propagation.PropagationException;
 import org.apache.syncope.search.NodeCond;
 import org.apache.syncope.services.ContextAware;
@@ -277,7 +279,8 @@ public class UserController implements U
         List<PropagationTask> tasks = propagationManager.getCreateTaskIds(created, userTO.getPassword(),
                 userTO.getVirtualAttributes());
 
-        //final List<PropagationTO> propagations = new ArrayList<PropagationTO>();
+        // final List<PropagationTO> propagations = new
+        // ArrayList<PropagationTO>();
 
         taskExecutor.execute(tasks, new PropagationHandler() {
 
@@ -297,14 +300,14 @@ public class UserController implements U
                     propagation.setAfterObj(connObjectUtil.getConnObjectTO(afterObj));
                 }
 
-               // propagations.add(propagation);
+                // propagations.add(propagation);
             }
         });
 
         notificationManager.createTasks(created.getResult().getKey(), created.getPerformedTasks());
 
         final UserTO savedTO = userDataBinder.getUserTO(created.getResult().getKey());
-        //savedTO.setPropagationTOs(propagations);
+        // savedTO.setPropagationTOs(propagations);
 
         LOG.debug("About to return created user\n{}", savedTO);
 
@@ -316,8 +319,8 @@ public class UserController implements U
     }
 
     @Override
-    public UserTO update(final Long userId, final UserMod userMod) throws NotFoundException, PropagationException,
-            UnauthorizedRoleException, WorkflowException {
+    public UserTO update(final Long userId, final UserMod userMod) throws NotFoundException,
+            PropagationException, UnauthorizedRoleException, WorkflowException {
 
         userMod.setId(userId);
 
@@ -366,98 +369,63 @@ public class UserController implements U
     }
 
     @Override
-    public UserTO activate(final Long userId, final String token, final Set<String> resourceNames,
-            final Boolean performLocally, final Boolean performRemotely) throws WorkflowException,
+    public UserTO setStatus(final Long userId, StatusMod userStatus) throws WorkflowException,
             NotFoundException, UnauthorizedRoleException, PropagationException {
 
-        LOG.debug("About to activate " + userId);
+        LOG.debug("About to " + userStatus.getStatus() + " for userId " + userId);
 
         SyncopeUser user = userDAO.find(userId);
         if (user == null) {
             throw new NotFoundException("User " + userId);
         }
 
-        return setStatus(user, token, resourceNames, performLocally, performRemotely, true, "activate");
-    }
-
-    @Deprecated
-    public UserTO activate(final String username, final String token,
-            final Set<String> resourceNames, final Boolean performLocally, final Boolean performRemotely)
-            throws WorkflowException, NotFoundException, UnauthorizedRoleException, PropagationException {
-
-        LOG.debug("About to activate " + username);
-
-        SyncopeUser user = userDAO.find(username);
-        if (user == null) {
-            throw new NotFoundException("User " + username);
+        WorkflowResult<Long> updated;
+        if (userStatus.isUpdateInternal()) {
+            switch (userStatus.getStatus()) {
+            case SUSPEND:
+                updated = wfAdapter.suspend(user.getId());
+                break;
+            case REACTIVATE:
+                updated = wfAdapter.reactivate(user.getId());
+                break;
+            default:
+                updated = wfAdapter.activate(user.getId(), userStatus.getToken());
+            }
+        } else {
+            updated = new WorkflowResult<Long>(user.getId(), null, userStatus.getStatus().toString());
         }
 
-        return setStatus(user, token, resourceNames, performLocally, performRemotely, true, "activate");
-    }
-
-    @Deprecated
-    public UserTO suspend(final String username, final Set<String> resourceNames,
-            final Boolean performLocally, final Boolean performRemotely) throws NotFoundException,
-            WorkflowException, UnauthorizedRoleException, PropagationException {
-
-        LOG.debug("About to suspend " + username);
-
-        SyncopeUser user = userDAO.find(username);
-
-        if (user == null) {
-            throw new NotFoundException("User " + username);
+        // Resources to exclude from propagation.
+        Set<String> resources = new HashSet<String>();
+        if (userStatus.isUpdateRemote()) {
+            if (userStatus.getExcludeResources() != null) {
+                resources.addAll(user.getResourceNames());
+                resources.removeAll(userStatus.getExcludeResources());
+            }
+        } else {
+            resources.addAll(user.getResourceNames());
         }
 
-        return setStatus(user, null, resourceNames, performLocally, performRemotely, false, "suspend");
-    }
-
-    @Override
-    public UserTO suspend(final Long userId, final Set<String> resourceNames, final Boolean performLocally,
-            final Boolean performRemotely) throws NotFoundException, WorkflowException,
-            UnauthorizedRoleException, PropagationException {
-
-        LOG.debug("About to suspend " + userId);
-
-        SyncopeUser user = userDAO.find(userId);
-        if (user == null) {
-            throw new NotFoundException("User " + userId);
-        }
+        Boolean userEnabled = userStatus.getStatus() != Status.SUSPEND;
+        List<PropagationTask> tasks = propagationManager.getUpdateTaskIds(user, userEnabled, resources);
 
-        return setStatus(user, null, resourceNames, performLocally, performRemotely, false, "suspend");
-    }
+        taskExecutor.execute(tasks);
+        notificationManager.createTasks(updated.getResult(), updated.getPerformedTasks());
 
-    @Deprecated
-    public UserTO reactivate(Long userId, final Set<String> resourceNames,
-            final Boolean performLocally,
-            final Boolean performRemotely)
-            throws NotFoundException, WorkflowException, UnauthorizedRoleException, PropagationException {
+        final UserTO savedTO = userDataBinder.getUserTO(updated.getResult());
 
-        LOG.debug("About to reactivate " + userId);
+        auditManager.audit(
+                Category.user,
+                UserSubCategory.setStatus,
+                Result.success,
+                "Successfully changed status to " + savedTO.getStatus() + " for user: "
+                        + savedTO.getUsername());
 
-        SyncopeUser user = userDAO.find(userId);
-        if (user == null) {
-            throw new NotFoundException("User " + userId);
-        }
+        LOG.debug("About to return updated user\n{}", savedTO);
 
-        return setStatus(user, null, resourceNames, performLocally, performRemotely, true, "reactivate");
+        return savedTO;
     }
 
-    @Deprecated
-    public UserTO reactivate(String username,
-            final Set<String> resourceNames,
-            final Boolean performLocally,
-            final Boolean performRemotely)
-            throws NotFoundException, WorkflowException, UnauthorizedRoleException, PropagationException {
-
-        LOG.debug("About to reactivate " + username);
-
-        SyncopeUser user = userDAO.find(username);
-        if (user == null) {
-            throw new NotFoundException("User " + username);
-        }
-
-        return setStatus(user, null, resourceNames, performLocally, performRemotely, true, "reactivate");
-    }
 
     @Override
     public Response delete(final Long userId) throws NotFoundException, WorkflowException,
@@ -570,56 +538,6 @@ public class UserController implements U
         return savedTO;
     }
 
-    private UserTO setStatus(final SyncopeUser user, final String token, final Set<String> resourceNames,
-            final boolean performLocally, final boolean performRemotely, final boolean status,
-            final String task) throws NotFoundException, WorkflowException, UnauthorizedRoleException,
-            PropagationException {
-
-        LOG.debug("About to set status of {}" + user);
-
-        WorkflowResult<Long> updated;
-        if (performLocally) {
-            if ("suspend".equals(task)) {
-                updated = wfAdapter.suspend(user.getId());
-            } else if ("reactivate".equals(task)) {
-                updated = wfAdapter.reactivate(user.getId());
-            } else {
-                updated = wfAdapter.activate(user.getId(), token);
-            }
-        } else {
-            updated = new WorkflowResult<Long>(user.getId(), null, task);
-        }
-
-        // Resources to exclude from propagation.
-        Set<String> resources = new HashSet<String>();
-        if (performRemotely) {
-            if (resourceNames != null) {
-                resources.addAll(user.getResourceNames());
-                resources.removeAll(resourceNames);
-            }
-        } else {
-            resources.addAll(user.getResourceNames());
-        }
-
-        List<PropagationTask> tasks = propagationManager.getUpdateTaskIds(user, status, resources);
-
-        taskExecutor.execute(tasks);
-        notificationManager.createTasks(updated.getResult(), updated.getPerformedTasks());
-
-        final UserTO savedTO = userDataBinder.getUserTO(updated.getResult());
-
-        auditManager.audit(
-                Category.user,
-                UserSubCategory.setStatus,
-                Result.success,
-                "Successfully changed status to " + savedTO.getStatus() + " for user: "
-                        + savedTO.getUsername());
-
-        LOG.debug("About to return updated user\n{}", savedTO);
-
-        return savedTO;
-    }
-
     protected void doDelete(final Long userId) throws NotFoundException, WorkflowException,
             PropagationException, UnauthorizedRoleException {
         // Note here that we can only notify about "delete", not any other
@@ -631,8 +549,8 @@ public class UserController implements U
 
         List<PropagationTask> tasks = propagationManager.getDeleteTaskIds(userId);
 
-        //final UserTO userTO = new UserTO();
-        //userTO.setId(userId);
+        // final UserTO userTO = new UserTO();
+        // userTO.setId(userId);
 
         taskExecutor.execute(tasks, new PropagationHandler() {
 
@@ -652,7 +570,7 @@ public class UserController implements U
                     propagation.setAfterObj(connObjectUtil.getConnObjectTO(after));
                 }
 
-                //userTO.addPropagationTO(propagation);
+                // userTO.addPropagationTO(propagation);
             }
         });
 

Modified: syncope/branches/cxf/core/src/test/java/org/apache/syncope/core/rest/AbstractUserTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/branches/cxf/core/src/test/java/org/apache/syncope/core/rest/AbstractUserTestITCase.java?rev=1421363&r1=1421362&r2=1421363&view=diff
==============================================================================
--- syncope/branches/cxf/core/src/test/java/org/apache/syncope/core/rest/AbstractUserTestITCase.java (original)
+++ syncope/branches/cxf/core/src/test/java/org/apache/syncope/core/rest/AbstractUserTestITCase.java Thu Dec 13 16:24:56 2012
@@ -50,6 +50,8 @@ import org.apache.syncope.core.init.Spri
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
 import org.apache.syncope.mod.AttributeMod;
 import org.apache.syncope.mod.MembershipMod;
+import org.apache.syncope.mod.StatusMod;
+import org.apache.syncope.mod.StatusMod.Status;
 import org.apache.syncope.mod.UserMod;
 import org.apache.syncope.propagation.PropagationException;
 import org.apache.syncope.search.AttributeCond;
@@ -148,8 +150,8 @@ public abstract class AbstractUserTestIT
     public void createUserWithNoPropagation() throws PropagationException, UnauthorizedRoleException,
             WorkflowException, NotFoundException {
         // get task list
-        List<PropagationTaskTO> tasks = Arrays.asList(restTemplate.getForObject(
-                BASE_URL + "task/propagation/list.json", PropagationTaskTO[].class));
+        List<PropagationTaskTO> tasks = Arrays.asList(restTemplate.getForObject(BASE_URL
+                + "task/propagation/list.json", PropagationTaskTO[].class));
 
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
@@ -199,15 +201,19 @@ public abstract class AbstractUserTestIT
     // This test should be moved to PolicyTestITCase
     /*
      * This test has been introduced to verify and solve the following issue:
-     * http://code.google.com/p/syncope/issues/detail?id=172. Creations of a new user without having a global password
-     * policy stored into the local repository used to fail with a null pointer exception. This bug has been fixed
-     * introducing a simple control.
+     * http://code.google.com/p/syncope/issues/detail?id=172. Creations of a new
+     * user without having a global password policy stored into the local
+     * repository used to fail with a null pointer exception. This bug has been
+     * fixed introducing a simple control.
      */
     @Ignore
-    public void issue172() throws PropagationException, UnauthorizedRoleException, WorkflowException, NotFoundException {
-        // This test causes sideeffects to other tests, which depend on policy with the id 2L. ReCreating this policy
+    public void issue172() throws PropagationException, UnauthorizedRoleException, WorkflowException,
+            NotFoundException {
+        // This test causes sideeffects to other tests, which depend on policy
+        // with the id 2L. ReCreating this policy
         // after deletion is not sufficient, because another ID will be assigned
-        PolicyTO policyTO = restTemplate.getForObject(BASE_URL + "policy/read/{id}", PasswordPolicyTO.class, 2L);
+        PolicyTO policyTO = restTemplate.getForObject(BASE_URL + "policy/read/{id}", PasswordPolicyTO.class,
+                2L);
 
         assertNotNull(policyTO);
 
@@ -219,14 +225,15 @@ public abstract class AbstractUserTestIT
             userCreateAndGet(userTO);
 
         } finally {
-            policyTO = restTemplate
-                    .postForObject(BASE_URL + "policy/password/create", policyTO, PasswordPolicyTO.class);
+            policyTO = restTemplate.postForObject(BASE_URL + "policy/password/create", policyTO,
+                    PasswordPolicyTO.class);
             assertNotNull(policyTO);
         }
     }
 
     @Test
-    public void issue186() throws PropagationException, UnauthorizedRoleException, WorkflowException, NotFoundException {
+    public void issue186() throws PropagationException, UnauthorizedRoleException, WorkflowException,
+            NotFoundException {
         // 1. create an user with strict mandatory attributes only
         String uid = getSampleEmail();
         UserTO userTO = new UserTO();
@@ -264,7 +271,8 @@ public abstract class AbstractUserTestIT
             fail("Exception required");
         } catch (Exception scce) {
             // TODO Fix error handling
-            // sce = scce.getException(SyncopeClientExceptionType.RequiredValuesMissing);
+            // sce =
+            // scce.getException(SyncopeClientExceptionType.RequiredValuesMissing);
             assertNotNull(scce);
         }
 
@@ -342,7 +350,8 @@ public abstract class AbstractUserTestIT
             userService.create(userTO);
             fail("Exception expected");
         } catch (Exception scce) {
-            // sce = scce.getException(SyncopeClientExceptionType.RequiredValuesMissing);
+            // sce =
+            // scce.getException(SyncopeClientExceptionType.RequiredValuesMissing);
             assertNotNull(scce);
         }
 
@@ -354,21 +363,22 @@ public abstract class AbstractUserTestIT
 
     @Test
     @Ignore
-    public void testEnforceMandatoryConditionOnDerived() throws PropagationException, UnauthorizedRoleException,
-            WorkflowException, NotFoundException {
+    public void testEnforceMandatoryConditionOnDerived() throws PropagationException,
+            UnauthorizedRoleException, WorkflowException, NotFoundException {
         ResourceTO resourceTO;
 
         try {
-            resourceTO = restTemplate.getForObject(BASE_URL + "/resource/read/{resourceName}.json", ResourceTO.class,
-                    "resource-csv-enforcing");
+            resourceTO = restTemplate.getForObject(BASE_URL + "/resource/read/{resourceName}.json",
+                    ResourceTO.class, "resource-csv-enforcing");
         } catch (Exception e) {
-            resourceTO = restTemplate.getForObject(BASE_URL + "/resource/read/{resourceName}.json", ResourceTO.class,
-                    "resource-csv");
+            resourceTO = restTemplate.getForObject(BASE_URL + "/resource/read/{resourceName}.json",
+                    ResourceTO.class, "resource-csv");
 
             resourceTO.setName("resource-csv-enforcing");
             resourceTO.setEnforceMandatoryCondition(true);
             // FIXME create operation fails
-            resourceTO = restTemplate.postForObject(BASE_URL + "resource/create.json", resourceTO, ResourceTO.class);
+            resourceTO = restTemplate.postForObject(BASE_URL + "resource/create.json", resourceTO,
+                    ResourceTO.class);
         }
 
         assertNotNull(resourceTO);
@@ -381,7 +391,8 @@ public abstract class AbstractUserTestIT
             userTO = userCreateAndGet(userTO);
             fail("SyncopeClientExceptionType expected");
         } catch (Exception scce) {
-            // sce = scce.getException(SyncopeClientExceptionType.RequiredValuesMissing);
+            // sce =
+            // scce.getException(SyncopeClientExceptionType.RequiredValuesMissing);
             assertNotNull(scce);
         }
 
@@ -395,7 +406,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test
-    public void issue147() throws PropagationException, UnauthorizedRoleException, WorkflowException, NotFoundException {
+    public void issue147() throws PropagationException, UnauthorizedRoleException, WorkflowException,
+            NotFoundException {
         // 1. create an user without role nor resources
         UserTO userTO = getSampleTO();
 
@@ -414,7 +426,8 @@ public abstract class AbstractUserTestIT
             fail("Exception expected");
         } catch (Exception scce) {
             // TODO Exception Handling
-            // sce = scce.getException(SyncopeClientExceptionType.RequiredValuesMissing);
+            // sce =
+            // scce.getException(SyncopeClientExceptionType.RequiredValuesMissing);
         }
         // assertNotNull(sce);
 
@@ -463,8 +476,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test(expected = BadRequestException.class)
-    public void createWithInvalidPassword() throws PropagationException, UnauthorizedRoleException, WorkflowException,
-            NotFoundException {
+    public void createWithInvalidPassword() throws PropagationException, UnauthorizedRoleException,
+            WorkflowException, NotFoundException {
         UserTO userTO = getSampleTO("invalidpasswd@syncope.apache.org");
         userTO.setPassword("pass");
 
@@ -472,8 +485,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test(expected = BadRequestException.class)
-    public void createWithInvalidUsername() throws PropagationException, UnauthorizedRoleException, WorkflowException,
-            NotFoundException {
+    public void createWithInvalidUsername() throws PropagationException, UnauthorizedRoleException,
+            WorkflowException, NotFoundException {
         UserTO userTO = getSampleTO("invalidusername@syncope.apache.org");
         userTO.setUsername("us");
 
@@ -515,8 +528,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test(expected = BadRequestException.class)
-    public void createWithException() throws PropagationException, UnauthorizedRoleException, WorkflowException,
-            NotFoundException {
+    public void createWithException() throws PropagationException, UnauthorizedRoleException,
+            WorkflowException, NotFoundException {
         AttributeTO attributeTO = new AttributeTO();
         attributeTO.setSchema("userId");
         attributeTO.addValue("userId@nowhere.org");
@@ -528,10 +541,11 @@ public abstract class AbstractUserTestIT
     }
 
     @Test
-    public void create() throws PropagationException, UnauthorizedRoleException, WorkflowException, NotFoundException {
+    public void create() throws PropagationException, UnauthorizedRoleException, WorkflowException,
+            NotFoundException {
         // get task list
-        List<PropagationTaskTO> tasks = Arrays.asList(restTemplate.getForObject(
-                BASE_URL + "task/propagation/list.json", PropagationTaskTO[].class));
+        List<PropagationTaskTO> tasks = Arrays.asList(restTemplate.getForObject(BASE_URL
+                + "task/propagation/list.json", PropagationTaskTO[].class));
 
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
@@ -608,7 +622,8 @@ public abstract class AbstractUserTestIT
         assertEquals(newMaxId, maxId);
 
         // get last task
-        taskTO = restTemplate.getForObject(BASE_URL + "task/read/{taskId}.json", PropagationTaskTO.class, newMaxId);
+        taskTO = restTemplate.getForObject(BASE_URL + "task/read/{taskId}.json", PropagationTaskTO.class,
+                newMaxId);
 
         assertNotNull(taskTO);
         assertEquals(maxTaskExecutions, taskTO.getExecutions().size());
@@ -752,8 +767,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test
-    public void createWithApproval() throws PropagationException, UnauthorizedRoleException, WorkflowException,
-            NotFoundException {
+    public void createWithApproval() throws PropagationException, UnauthorizedRoleException,
+            WorkflowException, NotFoundException {
         Assume.assumeTrue(SpringContextInitializer.isActivitiConfigured());
 
         JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
@@ -807,8 +822,8 @@ public abstract class AbstractUserTestIT
         assertEquals(Collections.singleton("resource-testdb"), userTO.getResources());
 
         try {
-            final String username = jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?", String.class,
-                    userTO.getUsername());
+            final String username = jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?",
+                    String.class, userTO.getUsername());
             assertEquals(userTO.getUsername(), username);
         } catch (EmptyResultDataAccessException e) {
             fail(e.getMessage());
@@ -824,7 +839,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test
-    public void delete() throws WorkflowException, PropagationException, UnauthorizedRoleException, NotFoundException {
+    public void delete() throws WorkflowException, PropagationException, UnauthorizedRoleException,
+            NotFoundException {
         try {
             userService.delete(0L);
             fail("User should not be found");
@@ -863,9 +879,9 @@ public abstract class AbstractUserTestIT
         UserTO userTO = getSampleTO(uid);
         // specify a propagation
         userTO.addResource("resource-testdb");
-        userCreateAndGet(userTO);
 
-        userTO = userService.read(uid);
+        userTO = userCreateAndGet(userTO);
+
         Response response = userService.delete(userTO.getId());
 
         assertNotNull(response);
@@ -1019,7 +1035,8 @@ public abstract class AbstractUserTestIT
         ResourceCond ws1 = new ResourceCond();
         ws1.setResourceName("ws-target-resource-list-mappings-2");
 
-        NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getNotLeafCond(ws2), NodeCond.getLeafCond(ws1));
+        NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getNotLeafCond(ws2),
+                NodeCond.getLeafCond(ws1));
 
         assertTrue(searchCondition.checkValidity());
 
@@ -1077,8 +1094,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test
-    public void updateWithouPassword() throws PropagationException, UnauthorizedRoleException, WorkflowException,
-            NotFoundException {
+    public void updateWithouPassword() throws PropagationException, UnauthorizedRoleException,
+            WorkflowException, NotFoundException {
         UserTO userTO = getSampleTO();
 
         userTO = userCreateAndGet(userTO);
@@ -1098,8 +1115,8 @@ public abstract class AbstractUserTestIT
 
     // @Test(expected = SyncopeClientCompositeErrorException.class)
     @Test(expected = BadRequestException.class)
-    public void updateInvalidPassword() throws PropagationException, UnauthorizedRoleException, WorkflowException,
-            NotFoundException {
+    public void updateInvalidPassword() throws PropagationException, UnauthorizedRoleException,
+            WorkflowException, NotFoundException {
         UserTO userTO = getSampleTO();
 
         userTO = userCreateAndGet(userTO);
@@ -1114,8 +1131,8 @@ public abstract class AbstractUserTestIT
 
     // @Test(expected = SyncopeClientCompositeErrorException.class)
     @Test(expected = BadRequestException.class)
-    public void updateSamePassword() throws PropagationException, UnauthorizedRoleException, WorkflowException,
-            NotFoundException {
+    public void updateSamePassword() throws PropagationException, UnauthorizedRoleException,
+            WorkflowException, NotFoundException {
         UserTO userTO = getSampleTO();
 
         userTO = userCreateAndGet(userTO);
@@ -1129,7 +1146,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test
-    public void update() throws PropagationException, UnauthorizedRoleException, WorkflowException, NotFoundException {
+    public void update() throws PropagationException, UnauthorizedRoleException, WorkflowException,
+            NotFoundException {
         String email = getSampleEmail();
         UserTO userTO = getSampleTO(email);
 
@@ -1218,8 +1236,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test
-    public void updatePasswordOnly() throws PropagationException, UnauthorizedRoleException, WorkflowException,
-            NotFoundException {
+    public void updatePasswordOnly() throws PropagationException, UnauthorizedRoleException,
+            WorkflowException, NotFoundException {
         List<PropagationTaskTO> beforeTasks = Arrays.asList(restTemplate.getForObject(BASE_URL
                 + "task/propagation/list", PropagationTaskTO[].class));
         assertNotNull(beforeTasks);
@@ -1250,8 +1268,8 @@ public abstract class AbstractUserTestIT
         passwordTestUser.setPassword("newPassword123", CipherAlgorithm.SHA1, 0);
         assertEquals(passwordTestUser.getPassword(), userTO.getPassword());
 
-        List<PropagationTaskTO> afterTasks = Arrays.asList(restTemplate.getForObject(
-                BASE_URL + "task/propagation/list", PropagationTaskTO[].class));
+        List<PropagationTaskTO> afterTasks = Arrays.asList(restTemplate.getForObject(BASE_URL
+                + "task/propagation/list", PropagationTaskTO[].class));
         assertNotNull(afterTasks);
         assertFalse(afterTasks.isEmpty());
 
@@ -1259,11 +1277,11 @@ public abstract class AbstractUserTestIT
     }
 
     @Test
-    public void verifyTaskRegistration() throws PropagationException, UnauthorizedRoleException, WorkflowException,
-            NotFoundException {
+    public void verifyTaskRegistration() throws PropagationException, UnauthorizedRoleException,
+            WorkflowException, NotFoundException {
         // get task list
-        List<PropagationTaskTO> tasks = Arrays.asList(restTemplate.getForObject(BASE_URL + "task/propagation/list",
-                PropagationTaskTO[].class));
+        List<PropagationTaskTO> tasks = Arrays.asList(restTemplate.getForObject(BASE_URL
+                + "task/propagation/list", PropagationTaskTO[].class));
 
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
@@ -1292,7 +1310,8 @@ public abstract class AbstractUserTestIT
         assertNotNull(userTO);
 
         // get the new task list
-        tasks = Arrays.asList(restTemplate.getForObject(BASE_URL + "task/propagation/list", PropagationTaskTO[].class));
+        tasks = Arrays.asList(restTemplate.getForObject(BASE_URL + "task/propagation/list",
+                PropagationTaskTO[].class));
 
         assertNotNull(tasks);
         assertFalse(tasks.isEmpty());
@@ -1326,7 +1345,8 @@ public abstract class AbstractUserTestIT
         assertNotNull(userTO);
 
         // get the new task list
-        tasks = Arrays.asList(restTemplate.getForObject(BASE_URL + "task/propagation/list", PropagationTaskTO[].class));
+        tasks = Arrays.asList(restTemplate.getForObject(BASE_URL + "task/propagation/list",
+                PropagationTaskTO[].class));
 
         // get max task id
         maxId = newMaxId;
@@ -1353,7 +1373,8 @@ public abstract class AbstractUserTestIT
         userService.delete(userTO.getId());
 
         // get the new task list
-        tasks = Arrays.asList(restTemplate.getForObject(BASE_URL + "task/propagation/list", PropagationTaskTO[].class));
+        tasks = Arrays.asList(restTemplate.getForObject(BASE_URL + "task/propagation/list",
+                PropagationTaskTO[].class));
 
         // get max task id
         maxId = newMaxId;
@@ -1389,8 +1410,10 @@ public abstract class AbstractUserTestIT
 
         assertEquals("created", userTO.getStatus());
 
-        userTO = userService.activate(userTO.getId(), userTO.getToken(), new HashSet<String>(), Boolean.TRUE,
-                Boolean.TRUE);
+        StatusMod statusMod = new StatusMod(userTO.getId(), Status.ACTIVATE);
+        statusMod.setToken(userTO.getToken());
+
+        userTO = userService.setStatus(statusMod.getId(), statusMod);
 
         assertNotNull(userTO);
         assertNull(userTO.getToken());
@@ -1401,8 +1424,8 @@ public abstract class AbstractUserTestIT
 
     @Test
     @Ignore
-    public void createActivateByUsername() throws PropagationException, UnauthorizedRoleException, WorkflowException,
-            NotFoundException {
+    public void createActivateByUsername() throws PropagationException, UnauthorizedRoleException,
+            WorkflowException, NotFoundException {
         Assume.assumeTrue(SpringContextInitializer.isActivitiConfigured());
 
         UserTO userTO = getSampleTO("createActivateByUsername@syncope.apache.org");
@@ -1419,9 +1442,8 @@ public abstract class AbstractUserTestIT
 
         assertEquals("created", userTO.getStatus());
 
-        userTO = restTemplate.getForObject(
-                BASE_URL + "user/activateByUsername/{username}.json?token=" + userTO.getToken(), UserTO.class,
-                userTO.getUsername());
+        userTO = restTemplate.getForObject(BASE_URL + "user/activateByUsername/{username}.json?token="
+                + userTO.getToken(), UserTO.class, userTO.getUsername());
 
         assertNotNull(userTO);
         assertNull(userTO.getToken());
@@ -1431,8 +1453,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test
-    public void suspendReactivate() throws PropagationException, UnauthorizedRoleException, WorkflowException,
-            NotFoundException {
+    public void suspendReactivate() throws PropagationException, UnauthorizedRoleException,
+            WorkflowException, NotFoundException {
         UserTO userTO = getSampleTO();
 
         MembershipTO membershipTO = new MembershipTO();
@@ -1442,14 +1464,19 @@ public abstract class AbstractUserTestIT
         userTO = userCreateAndGet(userTO);
 
         assertNotNull(userTO);
-        assertEquals(SpringContextInitializer.isActivitiConfigured() ? "active" : "created", userTO.getStatus());
+        assertEquals(SpringContextInitializer.isActivitiConfigured()
+                ? "active"
+                : "created", userTO.getStatus());
+
+        StatusMod statusMod = new StatusMod(userTO.getId(), Status.SUSPEND);
 
-        userTO = restTemplate.getForObject(BASE_URL + "user/suspend/" + userTO.getId(), UserTO.class);
+        userTO = userService.setStatus(userTO.getId(), statusMod);
 
         assertNotNull(userTO);
         assertEquals("suspended", userTO.getStatus());
 
-        userTO = restTemplate.getForObject(BASE_URL + "user/reactivate/" + userTO.getId(), UserTO.class);
+        statusMod.setStatus(Status.REACTIVATE);
+        userTO = userService.setStatus(userTO.getId(), statusMod);
 
         assertNotNull(userTO);
         assertEquals("active", userTO.getStatus());
@@ -1468,7 +1495,9 @@ public abstract class AbstractUserTestIT
         userTO = userCreateAndGet(userTO);
 
         assertNotNull(userTO);
-        assertEquals(SpringContextInitializer.isActivitiConfigured() ? "active" : "created", userTO.getStatus());
+        assertEquals(SpringContextInitializer.isActivitiConfigured()
+                ? "active"
+                : "created", userTO.getStatus());
 
         userTO = restTemplate.getForObject(BASE_URL + "user/suspendByUsername/{username}.json", UserTO.class,
                 userTO.getUsername());
@@ -1476,8 +1505,8 @@ public abstract class AbstractUserTestIT
         assertNotNull(userTO);
         assertEquals("suspended", userTO.getStatus());
 
-        userTO = restTemplate.getForObject(BASE_URL + "user/reactivateByUsername/{username}.json", UserTO.class,
-                userTO.getUsername());
+        userTO = restTemplate.getForObject(BASE_URL + "user/reactivateByUsername/{username}.json",
+                UserTO.class, userTO.getUsername());
 
         assertNotNull(userTO);
         assertEquals("active", userTO.getStatus());
@@ -1486,7 +1515,7 @@ public abstract class AbstractUserTestIT
     @Test
     public void suspendReactivateOnResource() throws PropagationException, UnauthorizedRoleException,
             WorkflowException, NotFoundException {
-        UserTO userTO = getSampleTO("suspreactonresource@syncope.apache.org");
+        UserTO userTO = getSampleTO();
 
         userTO.getMemberships().clear();
         userTO.getResources().clear();
@@ -1497,8 +1526,8 @@ public abstract class AbstractUserTestIT
         assertNotNull(dbTable);
         userTO.addResource(dbTable.getName());
 
-        ResourceTO ldap = restTemplate.getForObject(BASE_URL + "/resource/read/{resourceName}.json", ResourceTO.class,
-                "resource-ldap");
+        ResourceTO ldap = restTemplate.getForObject(BASE_URL + "/resource/read/{resourceName}.json",
+                ResourceTO.class, "resource-ldap");
 
         assertNotNull(ldap);
         userTO.addResource(ldap.getName());
@@ -1506,12 +1535,15 @@ public abstract class AbstractUserTestIT
         userTO = userCreateAndGet(userTO);
 
         assertNotNull(userTO);
-        assertEquals(SpringContextInitializer.isActivitiConfigured() ? "active" : "created", userTO.getStatus());
-
-        String query = "?resourceNames=" + dbTable.getName() + "&resourceNames=" + ldap.getName()
-                + "&performLocally=true"; // check also performLocally
+        assertEquals(SpringContextInitializer.isActivitiConfigured()
+                ? "active"
+                : "created", userTO.getStatus());
+
+        StatusMod statusMod = new StatusMod(userTO.getId(), Status.SUSPEND);
+        statusMod.getExcludeResources().add(dbTable.getName());
+        statusMod.getExcludeResources().add(ldap.getName());
 
-        userTO = restTemplate.getForObject(BASE_URL + "user/suspend/" + userTO.getId() + query, UserTO.class);
+        userTO = userService.setStatus(userTO.getId(), statusMod);
 
         assertNotNull(userTO);
         assertEquals("suspended", userTO.getStatus());
@@ -1520,10 +1552,11 @@ public abstract class AbstractUserTestIT
         assertNotNull(dbTableUID);
 
         ConnObjectTO connObjectTO = restTemplate.getForObject(BASE_URL
-                + "/resource/{resourceName}/read/{objectId}.json", ConnObjectTO.class, dbTable.getName(), dbTableUID);
+                + "/resource/{resourceName}/read/{objectId}.json", ConnObjectTO.class, dbTable.getName(),
+                dbTableUID);
 
-        assertFalse(Boolean.parseBoolean(connObjectTO.getAttributeMap().get(OperationalAttributes.ENABLE_NAME)
-                .getValues().get(0)));
+        assertFalse(Boolean.parseBoolean(connObjectTO.getAttributeMap()
+                .get(OperationalAttributes.ENABLE_NAME).getValues().get(0)));
 
         String ldapUID = userTO.getUsername();
         assertNotNull(ldapUID);
@@ -1533,11 +1566,13 @@ public abstract class AbstractUserTestIT
 
         assertNotNull(connObjectTO);
 
-        query = "?resourceNames=" + ldap.getName() + "&performLocally=false"; // check
-                                                                              // also
-                                                                              // performLocally
+        statusMod.setStatus(Status.REACTIVATE);
+        statusMod.getExcludeResources().clear();
+        statusMod.getExcludeResources().add(ldap.getName());
+        // check also performLocally
+        statusMod.setUpdateInternal(false);
 
-        userTO = restTemplate.getForObject(BASE_URL + "user/reactivate/" + userTO.getId() + query, UserTO.class);
+        userTO = userService.setStatus(userTO.getId(), statusMod);
 
         assertNotNull(userTO);
         assertEquals("suspended", userTO.getStatus());
@@ -1545,14 +1580,15 @@ public abstract class AbstractUserTestIT
         connObjectTO = restTemplate.getForObject(BASE_URL + "/resource/{resourceName}/read/{objectId}.json",
                 ConnObjectTO.class, dbTable.getName(), dbTableUID);
 
-        assertFalse(Boolean.parseBoolean(connObjectTO.getAttributeMap().get(OperationalAttributes.ENABLE_NAME)
-                .getValues().get(0)));
+        assertFalse(Boolean.parseBoolean(connObjectTO.getAttributeMap()
+                .get(OperationalAttributes.ENABLE_NAME).getValues().get(0)));
 
-        query = "?resourceNames=" + dbTable.getName() + "&performLocally=true"; // check
-                                                                                // also
-                                                                                // performLocally
+        statusMod.getExcludeResources().clear();
+        statusMod.getExcludeResources().add(dbTable.getName());
+        // check also performLocally
+        statusMod.setUpdateInternal(true);
 
-        userTO = restTemplate.getForObject(BASE_URL + "user/reactivate/" + userTO.getId() + query, UserTO.class);
+        userTO = userService.setStatus(userTO.getId(), statusMod);
 
         assertNotNull(userTO);
         assertEquals("active", userTO.getStatus());
@@ -1564,8 +1600,8 @@ public abstract class AbstractUserTestIT
                 .getValues().get(0)));
     }
 
-    public void updateMultivalueAttribute() throws PropagationException, UnauthorizedRoleException, WorkflowException,
-            NotFoundException {
+    public void updateMultivalueAttribute() throws PropagationException, UnauthorizedRoleException,
+            WorkflowException, NotFoundException {
         UserTO userTO = getSampleTO();
         userTO.getResources().clear();
         userTO.getDerivedAttributes().clear();
@@ -1595,7 +1631,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test(expected = EmptyResultDataAccessException.class)
-    public void issue213() throws PropagationException, UnauthorizedRoleException, WorkflowException, NotFoundException {
+    public void issue213() throws PropagationException, UnauthorizedRoleException, WorkflowException,
+            NotFoundException {
         UserTO userTO = getSampleTO();
         userTO.addResource("resource-testdb");
 
@@ -1623,7 +1660,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test
-    public void issue234() throws PropagationException, UnauthorizedRoleException, WorkflowException, NotFoundException {
+    public void issue234() throws PropagationException, UnauthorizedRoleException, WorkflowException,
+            NotFoundException {
         String uid = getSampleEmail();
         UserTO userTO = getSampleTO(uid);
         userTO.addResource("resource-ldap");
@@ -1644,7 +1682,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test
-    public void issue270() throws NotFoundException, UnauthorizedRoleException, PropagationException, WorkflowException {
+    public void issue270() throws NotFoundException, UnauthorizedRoleException, PropagationException,
+            WorkflowException {
         // 1. create a new user without virtual attributes
         UserTO original = getSampleTO();
         // be sure to remove all virtual attributes
@@ -1714,7 +1753,8 @@ public abstract class AbstractUserTestIT
     @Test
     @Ignore
     // Are propagations required after create?
-    public void issue281() throws PropagationException, UnauthorizedRoleException, WorkflowException, NotFoundException {
+    public void issue281() throws PropagationException, UnauthorizedRoleException, WorkflowException,
+            NotFoundException {
         UserTO userTO = getSampleTO();
         userTO.getResources().clear();
         userTO.getMemberships().clear();
@@ -1738,7 +1778,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test
-    public void issue288() throws PropagationException, UnauthorizedRoleException, WorkflowException, NotFoundException {
+    public void issue288() throws PropagationException, UnauthorizedRoleException, WorkflowException,
+            NotFoundException {
         UserTO userTO = getSampleTO();
 
         AttributeTO attributeTO = new AttributeTO();
@@ -1756,8 +1797,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test
-    public void roleAttrPropagation() throws PropagationException, UnauthorizedRoleException, WorkflowException,
-            NotFoundException {
+    public void roleAttrPropagation() throws PropagationException, UnauthorizedRoleException,
+            WorkflowException, NotFoundException {
         UserTO userTO = getSampleTO();
         userTO.getResources().clear();
         userTO.getMemberships().clear();
@@ -1790,8 +1831,8 @@ public abstract class AbstractUserTestIT
     }
 
     @Test
-    public void membershipAttrPropagation() throws PropagationException, UnauthorizedRoleException, WorkflowException,
-            NotFoundException {
+    public void membershipAttrPropagation() throws PropagationException, UnauthorizedRoleException,
+            WorkflowException, NotFoundException {
         UserTO userTO = getSampleTO();
         userTO.getResources().clear();
         userTO.getMemberships().clear();
@@ -1922,9 +1963,9 @@ public abstract class AbstractUserTestIT
         assertNotNull(actual);
         assertEquals(1, actual.getMemberships().size());
 
-        connObjectTO = restTemplate
-                .getForObject(BASE_URL + "/resource/{resourceName}/read/{objectId}.json", ConnObjectTO.class,
-                        "resource-csv", actual.getDerivedAttributeMap().get("csvuserid").getValues().get(0));
+        connObjectTO = restTemplate.getForObject(BASE_URL + "/resource/{resourceName}/read/{objectId}.json",
+                ConnObjectTO.class, "resource-csv", actual.getDerivedAttributeMap().get("csvuserid")
+                        .getValues().get(0));
 
         assertNotNull(connObjectTO);
         // -----------------------------------
@@ -1943,9 +1984,9 @@ public abstract class AbstractUserTestIT
         assertEquals(1, actual.getMemberships().size());
         assertFalse(actual.getResources().isEmpty());
 
-        connObjectTO = restTemplate
-                .getForObject(BASE_URL + "/resource/{resourceName}/read/{objectId}.json", ConnObjectTO.class,
-                        "resource-csv", actual.getDerivedAttributeMap().get("csvuserid").getValues().get(0));
+        connObjectTO = restTemplate.getForObject(BASE_URL + "/resource/{resourceName}/read/{objectId}.json",
+                ConnObjectTO.class, "resource-csv", actual.getDerivedAttributeMap().get("csvuserid")
+                        .getValues().get(0));
 
         assertNotNull(connObjectTO);
         // -----------------------------------
@@ -1964,8 +2005,9 @@ public abstract class AbstractUserTestIT
         assertTrue(actual.getResources().isEmpty());
 
         try {
-            restTemplate.getForObject(BASE_URL + "/resource/{resourceName}/read/{objectId}.json", ConnObjectTO.class,
-                    "resource-csv", actual.getDerivedAttributeMap().get("csvuserid").getValues().get(0));
+            restTemplate.getForObject(BASE_URL + "/resource/{resourceName}/read/{objectId}.json",
+                    ConnObjectTO.class, "resource-csv", actual.getDerivedAttributeMap().get("csvuserid")
+                            .getValues().get(0));
             fail("SyncopeClientCompositeErrorException expected");
         } catch (Exception e) {
             // assertNotNull(e.getException(SyncopeClientExceptionType.NotFound));
@@ -2033,7 +2075,8 @@ public abstract class AbstractUserTestIT
         UserMod userMod = new UserMod();
         userMod.setId(actual.getId());
 
-        MembershipTO membershipTO = actual.getMemberships().get(0).getRoleId() == 12L ? actual.getMemberships().get(0)
+        MembershipTO membershipTO = actual.getMemberships().get(0).getRoleId() == 12L
+                ? actual.getMemberships().get(0)
                 : actual.getMemberships().get(1);
 
         userMod.addMembershipToBeRemoved(membershipTO.getId());
@@ -2069,16 +2112,18 @@ public abstract class AbstractUserTestIT
         userTO = userCreateAndGet(userTO);
         assertNotNull(userTO);
         // assertFalse(userTO.getPropagationTOs().isEmpty());
-        // assertEquals("resource-ldap", userTO.getPropagationTOs().get(0).getResourceName());
-        // assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationTOs().get(0).getStatus());
+        // assertEquals("resource-ldap",
+        // userTO.getPropagationTOs().get(0).getResourceName());
+        // assertEquals(PropagationTaskExecStatus.SUCCESS,
+        // userTO.getPropagationTOs().get(0).getStatus());
 
         // 2. delete this user
         userService.delete(userTO.getId());
 
         // 3. try (and fail) to find this user on the external LDAP resource
         try {
-            restTemplate.getForObject(BASE_URL + "resource/{resourceName}/read/{objectId}.json", ConnObjectTO.class,
-                    "resource-ldap", userTO.getUsername());
+            restTemplate.getForObject(BASE_URL + "resource/{resourceName}/read/{objectId}.json",
+                    ConnObjectTO.class, "resource-ldap", userTO.getUsername());
             fail("This entry should not be present on this resource");
         } catch (Exception sccee) {
             // TODO Should be NotFound exception
@@ -2089,8 +2134,8 @@ public abstract class AbstractUserTestIT
     @Ignore
     public void issueSYNCOPE51() throws PropagationException, UnauthorizedRoleException, WorkflowException,
             NotFoundException {
-        ConfigurationTO defaultConfigurationTO = restTemplate.getForObject(BASE_URL + "configuration/read/{key}.json",
-                ConfigurationTO.class, "password.cipher.algorithm");
+        ConfigurationTO defaultConfigurationTO = restTemplate.getForObject(BASE_URL
+                + "configuration/read/{key}.json", ConfigurationTO.class, "password.cipher.algorithm");
 
         ConfigurationTO configurationTO = new ConfigurationTO();
         configurationTO.setKey("password.cipher.algorithm");
@@ -2110,8 +2155,8 @@ public abstract class AbstractUserTestIT
                 userCreateAndGet(userTO);
                 fail();
             } catch (SyncopeClientCompositeErrorException e) {
-                assertTrue(e.getException(SyncopeClientExceptionType.NotFound).getElements().iterator().next()
-                        .contains("MD5"));
+                assertTrue(e.getException(SyncopeClientExceptionType.NotFound).getElements().iterator()
+                        .next().contains("MD5"));
             }
         } finally {
             ConfigurationTO oldConfTO = wc.post(defaultConfigurationTO, ConfigurationTO.class);



Mime
View raw message