You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2013/10/30 12:26:22 UTC

svn commit: r1537047 [5/5] - in /syncope/trunk: client/src/main/java/org/apache/syncope/client/rest/ common/src/main/java/org/apache/syncope/common/ common/src/main/java/org/apache/syncope/common/mod/ common/src/main/java/org/apache/syncope/common/serv...

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java Wed Oct 30 11:26:19 2013
@@ -32,13 +32,15 @@ import org.apache.http.HttpStatus;
 import org.apache.syncope.common.mod.RoleMod;
 import org.apache.syncope.common.services.RoleService;
 import org.apache.syncope.common.to.ConnObjectTO;
-import org.apache.syncope.common.to.PropagationTargetsTO;
+import org.apache.syncope.common.to.ResourceNameTO;
 import org.apache.syncope.common.to.RoleTO;
 import org.apache.syncope.common.to.SchemaTO;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.SchemaType;
 import org.apache.syncope.common.types.ClientExceptionType;
+import org.apache.syncope.common.types.ResourceAssociationActionType;
+import org.apache.syncope.common.util.CollectionWrapper;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
@@ -83,7 +85,7 @@ public class RoleTestITCase extends Abst
         newRoleTO.getAttrs().add(attributeTO("attr1", "value1"));
 
         try {
-            createRole(roleService, newRoleTO);
+            createRole(newRoleTO);
             fail();
         } catch (SyncopeClientException e) {
             assertEquals(ClientExceptionType.InvalidSyncopeRole, e.getType());
@@ -97,7 +99,7 @@ public class RoleTestITCase extends Abst
         roleTO.getVirAttrs().add(attributeTO("rvirtualdata", "rvirtualvalue"));
         roleTO.setRoleOwner(8L);
 
-        roleTO = createRole(roleService, roleTO);
+        roleTO = createRole(roleTO);
         assertNotNull(roleTO);
 
         assertNotNull(roleTO.getVirAttrMap());
@@ -125,7 +127,7 @@ public class RoleTestITCase extends Abst
         roleTO.setParent(8L);
         roleTO.setPasswordPolicy(4L);
 
-        RoleTO actual = createRole(roleService, roleTO);
+        RoleTO actual = createRole(roleTO);
         assertNotNull(actual);
 
         actual = roleService.read(actual.getId());
@@ -148,10 +150,10 @@ public class RoleTestITCase extends Abst
 
         roleTO.getResources().add("resource-ldap");
 
-        roleTO = createRole(roleService, roleTO);
+        roleTO = createRole(roleTO);
         assertNotNull(roleTO);
 
-        RoleTO deletedRole = roleService.delete(roleTO.getId());
+        RoleTO deletedRole = deleteRole(roleTO.getId());
         assertNotNull(deletedRole);
 
         try {
@@ -199,13 +201,13 @@ public class RoleTestITCase extends Abst
         RoleService roleService2 = clientFactory.create("rossini", ADMIN_PWD).getService(RoleService.class);
 
         try {
-            roleService2.selfRead(3L);
+            roleService2.readSelf(3L);
             fail();
         } catch (SyncopeClientException e) {
             assertEquals(ClientExceptionType.UnauthorizedRole, e.getType());
         }
 
-        RoleTO roleTO = roleService2.selfRead(1L);
+        RoleTO roleTO = roleService2.readSelf(1L);
         assertNotNull(roleTO);
         assertNotNull(roleTO.getAttrs());
         assertFalse(roleTO.getAttrs().isEmpty());
@@ -215,7 +217,7 @@ public class RoleTestITCase extends Abst
     public void update() {
         RoleTO roleTO = buildRoleTO("latestRole" + getUUIDString());
         roleTO.getRAttrTemplates().add("show");
-        roleTO = createRole(roleService, roleTO);
+        roleTO = createRole(roleTO);
 
         assertEquals(1, roleTO.getAttrs().size());
 
@@ -234,7 +236,7 @@ public class RoleTestITCase extends Abst
         // change password policy inheritance
         roleMod.setInheritPasswordPolicy(Boolean.FALSE);
 
-        roleTO = roleService.update(roleMod.getId(), roleMod);
+        roleTO = updateRole(roleMod);
 
         assertEquals(modName, roleTO.getName());
         assertEquals(2, roleTO.getAttrs().size());
@@ -253,7 +255,7 @@ public class RoleTestITCase extends Abst
         roleTO.getRVirAttrTemplates().add("rvirtualdata");
         roleTO.getVirAttrs().add(attributeTO("rvirtualdata", null));
 
-        roleTO = createRole(roleService, roleTO);
+        roleTO = createRole(roleTO);
 
         assertNotNull(roleTO);
         assertEquals(1, roleTO.getVirAttrs().size());
@@ -262,8 +264,7 @@ public class RoleTestITCase extends Abst
         roleMod.setId(roleTO.getId());
         roleMod.getVirAttrsToRemove().add("rvirtualdata");
 
-        roleTO = roleService.update(roleMod.getId(), roleMod);
-
+        roleTO = updateRole(roleMod);
         assertNotNull(roleTO);
         assertTrue(roleTO.getVirAttrs().isEmpty());
     }
@@ -274,7 +275,7 @@ public class RoleTestITCase extends Abst
         roleTO.getRDerAttrTemplates().add("rderivedschema");
         roleTO.getDerAttrs().add(attributeTO("rderivedschema", null));
 
-        roleTO = createRole(roleService, roleTO);
+        roleTO = createRole(roleTO);
 
         assertNotNull(roleTO);
         assertEquals(1, roleTO.getDerAttrs().size());
@@ -283,8 +284,7 @@ public class RoleTestITCase extends Abst
         roleMod.setId(roleTO.getId());
         roleMod.getDerAttrsToRemove().add("rderivedschema");
 
-        roleTO = roleService.update(roleMod.getId(), roleMod);
-
+        roleTO = updateRole(roleMod);
         assertNotNull(roleTO);
         assertTrue(roleTO.getDerAttrs().isEmpty());
     }
@@ -320,7 +320,7 @@ public class RoleTestITCase extends Abst
         // 4. update as puccini, owner of role 7 because owner of role 6 with inheritance - success
         RoleService roleService3 = clientFactory.create("puccini", ADMIN_PWD).getService(RoleService.class);
 
-        roleTO = roleService3.update(roleMod.getId(), roleMod);
+        roleTO = roleService3.update(roleMod.getId(), roleMod).readEntity(RoleTO.class);
         assertEquals("Managing Director", roleTO.getName());
 
         // issue SYNCOPE-15
@@ -342,7 +342,7 @@ public class RoleTestITCase extends Abst
         String roleName = "torename" + getUUIDString();
         roleTO.setName(roleName);
 
-        RoleTO actual = createRole(roleService, roleTO);
+        RoleTO actual = createRole(roleTO);
 
         assertNotNull(actual);
         assertEquals(roleName, actual.getName());
@@ -353,8 +353,7 @@ public class RoleTestITCase extends Abst
         String renamedRole = "renamed" + getUUIDString();
         roleMod.setName(renamedRole);
 
-        actual = roleService.update(roleMod.getId(), roleMod);
-
+        actual = updateRole(roleMod);
         assertNotNull(actual);
         assertEquals(renamedRole, actual.getName());
         assertEquals(0L, actual.getParent());
@@ -366,7 +365,7 @@ public class RoleTestITCase extends Abst
         roleTO.getEntitlements().add("USER_READ");
         roleTO.getEntitlements().add("SCHEMA_READ");
 
-        roleTO = createRole(roleService, roleTO);
+        roleTO = createRole(roleTO);
         assertNotNull(roleTO);
         assertNotNull(roleTO.getEntitlements());
         assertFalse(roleTO.getEntitlements().isEmpty());
@@ -377,7 +376,7 @@ public class RoleTestITCase extends Abst
         roleMod.setId(roleTO.getId());
         roleMod.setInheritDerAttrs(Boolean.TRUE);
 
-        roleTO = roleService.update(roleMod.getId(), roleMod);
+        roleTO = updateRole(roleMod);
         assertNotNull(roleTO);
         assertEquals(entitlements, roleTO.getEntitlements());
 
@@ -386,22 +385,22 @@ public class RoleTestITCase extends Abst
         roleMod.setModEntitlements(true);
         roleMod.getEntitlements().clear();
 
-        roleTO = roleService.update(roleMod.getId(), roleMod);
+        roleTO = updateRole(roleMod);
         assertNotNull(roleTO);
         assertTrue(roleTO.getEntitlements().isEmpty());
     }
 
     @Test
     public void unlink() {
-        RoleTO actual = createRole(roleService, buildRoleTO("unlink"));
+        RoleTO actual = createRole(buildRoleTO("unlink"));
         assertNotNull(actual);
 
         assertNotNull(readConnectorObject("resource-ldap", actual.getId()));
 
-        PropagationTargetsTO res = new PropagationTargetsTO();
-        res.getResources().add("resource-ldap");
-
-        actual = roleService.unlink(actual.getId(), res);
+        actual = roleService.associate(actual.getId(),
+                ResourceAssociationActionType.UNLINK,
+                CollectionWrapper.wrap("resource-ldap", ResourceNameTO.class)).
+                readEntity(RoleTO.class);
         assertNotNull(actual);
         assertTrue(actual.getResources().isEmpty());
 
@@ -415,15 +414,15 @@ public class RoleTestITCase extends Abst
 
     @Test
     public void unassign() {
-        RoleTO actual = createRole(roleService, buildRoleTO("unassign"));
+        RoleTO actual = createRole(buildRoleTO("unassign"));
         assertNotNull(actual);
 
         assertNotNull(readConnectorObject("resource-ldap", actual.getId()));
 
-        PropagationTargetsTO res = new PropagationTargetsTO();
-        res.getResources().add("resource-ldap");
-
-        actual = roleService.unassign(actual.getId(), res);
+        actual = roleService.associate(actual.getId(),
+                ResourceAssociationActionType.UNASSIGN,
+                CollectionWrapper.wrap("resource-ldap", ResourceNameTO.class)).
+                readEntity(RoleTO.class);
         assertNotNull(actual);
         assertTrue(actual.getResources().isEmpty());
 
@@ -435,21 +434,21 @@ public class RoleTestITCase extends Abst
             readConnectorObject("resource-ldap", actual.getId());
             fail();
         } catch (Exception e) {
-            // ignore
+            assertNotNull(e);
         }
     }
 
     @Test
     public void deprovision() {
-        RoleTO actual = createRole(roleService, buildRoleTO("deprovision"));
+        RoleTO actual = createRole(buildRoleTO("deprovision"));
         assertNotNull(actual);
 
         assertNotNull(readConnectorObject("resource-ldap", actual.getId()));
 
-        PropagationTargetsTO res = new PropagationTargetsTO();
-        res.getResources().add("resource-ldap");
-
-        actual = roleService.deprovision(actual.getId(), res);
+        actual = roleService.associate(actual.getId(),
+                ResourceAssociationActionType.DEPROVISION,
+                CollectionWrapper.wrap("resource-ldap", ResourceNameTO.class)).
+                readEntity(RoleTO.class);
         assertNotNull(actual);
         assertFalse(actual.getResources().isEmpty());
 
@@ -461,7 +460,7 @@ public class RoleTestITCase extends Abst
             readConnectorObject("resource-ldap", actual.getId());
             fail();
         } catch (Exception e) {
-            // ignore
+            assertNotNull(e);
         }
     }
 
@@ -476,7 +475,7 @@ public class RoleTestITCase extends Abst
         // 2. create a role *without* an attribute for that schema: it works
         RoleTO roleTO = buildRoleTO("lastRole");
         assertFalse(roleTO.getAttrMap().containsKey(badge.getName()));
-        roleTO = createRole(roleService, roleTO);
+        roleTO = createRole(roleTO);
         assertNotNull(roleTO);
         assertFalse(roleTO.getAttrMap().containsKey(badge.getName()));
 
@@ -488,7 +487,7 @@ public class RoleTestITCase extends Abst
         roleMod.getRAttrTemplates().add("badge");
 
         try {
-            roleService.update(roleMod.getId(), roleMod);
+            updateRole(roleMod);
             fail();
         } catch (SyncopeClientException e) {
             assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType());
@@ -497,7 +496,7 @@ public class RoleTestITCase extends Abst
         // 4. also add an actual attribute for badge - it will work        
         roleMod.getAttrsToUpdate().add(attributeMod(badge.getName(), "xxxxxxxxxx"));
 
-        roleTO = roleService.update(roleMod.getId(), roleMod);
+        roleTO = updateRole(roleMod);
         assertNotNull(roleTO);
         assertTrue(roleTO.getAttrMap().containsKey(badge.getName()));
     }

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java Wed Oct 30 11:26:19 2013
@@ -217,7 +217,7 @@ public class SchemaTestITCase extends Ab
 
         UserMod userMod = AttributableOperations.diff(newUserTO, userTO);
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = userService.update(userMod.getId(), userMod).readEntity(UserTO.class);
         assertNotNull(userTO);
     }
 

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java Wed Oct 30 11:26:19 2013
@@ -27,7 +27,6 @@ import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Set;
 import javax.ws.rs.core.Response;
 import org.apache.http.HttpStatus;
 import org.apache.syncope.common.mod.UserMod;
@@ -76,16 +75,31 @@ public class TaskTestITCase extends Abst
 
     private static final Long SYNC_TASK_ID = 4L;
 
+    /**
+     * Remove initial and synchronized users to make test re-runnable.
+     */
+    public void removeTestUsers() {
+        for (int i = 0; i < 10; i++) {
+            String cUserName = "test" + i;
+            try {
+                UserTO cUserTO = readUser(cUserName);
+                userService.delete(cUserTO.getId());
+            } catch (Exception e) {
+                // Ignore
+            }
+        }
+    }
+
     @Test
     public void getJobClasses() {
-        Set<JobClassTO> jobClasses = taskService.getJobClasses();
+        List<JobClassTO> jobClasses = taskService.getJobClasses();
         assertNotNull(jobClasses);
         assertFalse(jobClasses.isEmpty());
     }
 
     @Test
     public void getSyncActionsClasses() {
-        Set<SyncActionClassTO> actions = taskService.getSyncActionsClasses();
+        List<SyncActionClassTO> actions = taskService.getSyncActionsClasses();
         assertNotNull(actions);
         assertFalse(actions.isEmpty());
     }
@@ -290,7 +304,7 @@ public class TaskTestITCase extends Abst
             assertTrue(Integer.valueOf(userTO.getAttrMap().get("fullname").getValues().get(0)) <= 10);
 
             // check for user template
-            userTO = userService.read("test7");
+            userTO = readUser("test7");
             assertNotNull(userTO);
             assertEquals("TYPE_OTHER", userTO.getAttrMap().get("type").getValues().get(0));
             assertEquals(2, userTO.getResources().size());
@@ -299,7 +313,7 @@ public class TaskTestITCase extends Abst
             assertEquals(1, userTO.getMemberships().size());
             assertTrue(userTO.getMemberships().get(0).getAttrMap().containsKey("subscriptionDate"));
 
-            userTO = userService.read("test8");
+            userTO = readUser("test8");
             assertNotNull(userTO);
             assertEquals("TYPE_8", userTO.getAttrMap().get("type").getValues().get(0));
 
@@ -311,12 +325,11 @@ public class TaskTestITCase extends Abst
             // Check for issue 215:
             // * expected disabled user test1
             // * expected enabled user test2
-
-            userTO = userService.read("test1");
+            userTO = readUser("test1");
             assertNotNull(userTO);
             assertEquals("suspended", userTO.getStatus());
 
-            userTO = userService.read("test3");
+            userTO = readUser("test3");
             assertNotNull(userTO);
             assertEquals("active", userTO.getStatus());
 
@@ -353,7 +366,7 @@ public class TaskTestITCase extends Abst
         assertNotNull(execution.getStatus());
         assertTrue(PropagationTaskExecStatus.valueOf(execution.getStatus()).isSuccessful());
 
-        UserTO userTO = userService.read("testuser1");
+        UserTO userTO = readUser("testuser1");
         assertNotNull(userTO);
         assertEquals("reconciled@syncope.apache.org", userTO.getAttrMap().get("userId").getValues().get(0));
         assertEquals("suspended", userTO.getStatus());
@@ -367,7 +380,7 @@ public class TaskTestITCase extends Abst
         assertNotNull(execution.getStatus());
         assertTrue(PropagationTaskExecStatus.valueOf(execution.getStatus()).isSuccessful());
 
-        userTO = userService.read("testuser1");
+        userTO = readUser("testuser1");
         assertNotNull(userTO);
         assertEquals("active", userTO.getStatus());
     }
@@ -375,6 +388,7 @@ public class TaskTestITCase extends Abst
     @Test
     public void reconcileFromLDAP()
             throws InvalidSearchConditionException {
+
         // Update sync task
         SyncTaskTO task = taskService.read(11L);
         assertNotNull(task);
@@ -626,13 +640,13 @@ public class TaskTestITCase extends Abst
             assertNotNull(status);
             assertTrue(PropagationTaskExecStatus.valueOf(status).isSuccessful());
 
-            userTO = userService.read("testuser2");
+            userTO = readUser("testuser2");
             assertNotNull(userTO);
             assertEquals("testuser2@syncope.apache.org", userTO.getAttrMap().get("userId").getValues().get(0));
             assertEquals(2, userTO.getMemberships().size());
             assertEquals(4, userTO.getResources().size());
         } finally {
-            UserTO dUserTO = userService.delete(userTO.getId());
+            UserTO dUserTO = deleteUser(userTO.getId());
             assertNotNull(dUserTO);
         }
     }
@@ -671,7 +685,7 @@ public class TaskTestITCase extends Abst
         execSyncTask(10L, 20, false);
 
         // 3. read e-mail address for user created by the SyncTask first execution
-        UserTO userTO = userService.read("issuesyncope230");
+        UserTO userTO = readUser("issuesyncope230");
         assertNotNull(userTO);
         String email = userTO.getAttrMap().get("email").getValues().iterator().next();
         assertNotNull(email);
@@ -684,7 +698,7 @@ public class TaskTestITCase extends Abst
         execSyncTask(10L, 20, false);
 
         // 6. verify that the e-mail was updated
-        userTO = userService.read("issuesyncope230");
+        userTO = readUser("issuesyncope230");
         assertNotNull(userTO);
         email = userTO.getAttrMap().get("email").getValues().iterator().next();
         assertNotNull(email);
@@ -744,7 +758,6 @@ public class TaskTestITCase extends Abst
             assertNotNull(task);
 
             // add user template
-
             AttributeTO newAttrTO = new AttributeTO();
             newAttrTO.setSchema("firstname");
             newAttrTO.getValues().add("");
@@ -770,7 +783,7 @@ public class TaskTestITCase extends Abst
             assertNotNull(taskExecTO.getStatus());
             assertTrue(PropagationTaskExecStatus.valueOf(taskExecTO.getStatus()).isSuccessful());
 
-            userTO = userService.read(userTO.getUsername());
+            userTO = userService.read(userTO.getId());
             assertNotNull(userTO);
             assertNotNull(userTO.getAttrMap().get("firstname").getValues().get(0));
         } finally {
@@ -819,7 +832,7 @@ public class TaskTestITCase extends Abst
         userMod.getAttrsToRemove().add("email");
         userMod.getAttrsToUpdate().add(attributeMod("email", "s258@apache.org"));
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userService.update(userMod.getId(), userMod);
 
         execSyncTask(actual.getId(), 50, false);
 
@@ -906,23 +919,8 @@ public class TaskTestITCase extends Abst
             bulkAction.getTargets().add(String.valueOf(taskTO.getId()));
         }
 
-        taskService.bulkAction(bulkAction);
+        taskService.bulk(bulkAction);
 
         assertFalse(taskService.list(TaskType.PROPAGATION).containsAll(after));
     }
-
-    /**
-     * Remove initial and synchronized users to make test re-runnable.
-     */
-    public void removeTestUsers() {
-        for (int i = 0; i < 10; i++) {
-            String cUserName = "test" + i;
-            try {
-                UserTO cUserTO = userService.read(cUserName);
-                userService.delete(cUserTO.getId());
-            } catch (Exception e) {
-                // Ignore
-            }
-        }
-    }
-}
\ No newline at end of file
+}

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserRequestTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserRequestTestITCase.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserRequestTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserRequestTestITCase.java Wed Oct 30 11:26:19 2013
@@ -44,7 +44,6 @@ import org.apache.syncope.common.to.User
 import org.apache.syncope.common.types.ClientExceptionType;
 import org.apache.syncope.common.types.UserRequestType;
 import org.apache.syncope.common.validation.SyncopeClientException;
-import org.apache.syncope.common.validation.SyncopeClientException;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runners.MethodSorters;
@@ -70,15 +69,15 @@ public class UserRequestTestITCase exten
         Response response = configurationService.create(configurationTO);
         assertNotNull(response);
         assertEquals(HttpStatus.SC_CREATED, response.getStatus());
-        configurationTO =
-                adminClient.getObject(response.getLocation(), ConfigurationService.class, ConfigurationTO.class);
+        configurationTO = adminClient.getObject(response.getLocation(), ConfigurationService.class,
+                ConfigurationTO.class);
         assertNotNull(configurationTO);
 
         UserTO userTO = UserTestITCase.getUniqueSampleTO("selfcreate@syncope.apache.org");
 
         // 2. get unauthorized when trying to request user create
-        UserRequestService anonymousUserRequestService =
-                clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(UserRequestService.class);
+        UserRequestService anonymousUserRequestService = clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).
+                getService(UserRequestService.class);
         try {
             createUserRequest(anonymousUserRequestService, new UserRequestTO(userTO));
             fail();
@@ -92,8 +91,8 @@ public class UserRequestTestITCase exten
         response = configurationService.create(configurationTO);
         assertNotNull(response);
         assertEquals(HttpStatus.SC_CREATED, response.getStatus());
-        configurationTO =
-                adminClient.getObject(response.getLocation(), ConfigurationService.class, ConfigurationTO.class);
+        configurationTO = adminClient.getObject(response.getLocation(), ConfigurationService.class,
+                ConfigurationTO.class);
         assertNotNull(configurationTO);
 
         // 4. as anonymous, request user create works
@@ -134,8 +133,8 @@ public class UserRequestTestITCase exten
         }
 
         // 3. auth as user just created
-        UserRequestService userRequestService2 =
-                clientFactory.create(userTO.getUsername(), initialPassword).getService(UserRequestService.class);
+        UserRequestService userRequestService2 = clientFactory.create(userTO.getUsername(), initialPassword).getService(
+                UserRequestService.class);
 
         // 4. update with same password: not matching password policy
         try {
@@ -150,8 +149,8 @@ public class UserRequestTestITCase exten
         createUserRequest(userRequestService2, new UserRequestTO(userMod));
 
         // 6. user password has not changed yet
-        UserService userService1 =
-                clientFactory.create(userTO.getUsername(), userMod.getPassword()).getService(UserService.class);
+        UserService userService1 = clientFactory.create(userTO.getUsername(), userMod.getPassword()).getService(
+                UserService.class);
         try {
             userService1.readSelf();
             fail("Credentials are not updated yet, thus request should raise AccessControlException");
@@ -160,12 +159,12 @@ public class UserRequestTestITCase exten
         }
 
         // 7. actually update user
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = userService.update(userMod.getId(), userMod).readEntity(UserTO.class);
         assertNotNull(userTO);
 
         // 8. user password has now changed
-        UserService userService2 =
-                clientFactory.create(userTO.getUsername(), userMod.getPassword()).getService(UserService.class);
+        UserService userService2 = clientFactory.create(userTO.getUsername(), userMod.getPassword()).getService(
+                UserService.class);
         try {
             UserTO user = userService2.readSelf();
             assertNotNull(user);
@@ -192,8 +191,8 @@ public class UserRequestTestITCase exten
         }
 
         // 3. auth as user just created
-        UserRequestService userRequestService2 =
-                clientFactory.create(userTO.getUsername(), initialPassword).getService(UserRequestService.class);
+        UserRequestService userRequestService2 = clientFactory.create(userTO.getUsername(), initialPassword).getService(
+                UserRequestService.class);
 
         // 4. now request user delete works
         createUserRequest(userRequestService2, new UserRequestTO(userTO.getId()));
@@ -220,12 +219,12 @@ public class UserRequestTestITCase exten
         UserTO userTO = UserTestITCase.getUniqueSampleTO(USERNAME);
         final String initialPassword = userTO.getPassword();
 
-        UserRequestService selfservice =
-                clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(UserRequestService.class);
+        UserRequestService selfservice = clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(
+                UserRequestService.class);
         Response response = createUserRequest(selfservice, new UserRequestTO(userTO));
 
-        UserRequestTO userRequest =
-                adminClient.getObject(response.getLocation(), UserRequestService.class, UserRequestTO.class);
+        UserRequestTO userRequest = adminClient.getObject(response.getLocation(), UserRequestService.class,
+                UserRequestTO.class);
         assertNotNull(userRequest);
         assertEquals(UserRequestType.CREATE, userRequest.getType());
         assertTrue(userRequest.getUsername().endsWith(USERNAME));
@@ -234,7 +233,7 @@ public class UserRequestTestITCase exten
         assertNull(userRequest.getExecutionDate());
 
         try {
-            userService.read(userTO.getUsername());
+            userService.read(userTO.getId());
             fail();
         } catch (Exception ignore) {
             assertNotNull(ignore);
@@ -248,7 +247,8 @@ public class UserRequestTestITCase exten
         assertNotNull(userRequest.getClaimDate());
         assertNull(userRequest.getExecutionDate());
 
-        assertNotNull(userRequestService.executeCreate(userRequest.getId(), userTO));
+        userTO = userRequestService.executeCreate(userRequest.getId(), userTO);
+        assertNotNull(userTO);
 
         userRequest = userRequestService.read(userRequest.getId());
         assertTrue(userRequest.isExecuted());
@@ -261,7 +261,7 @@ public class UserRequestTestITCase exten
             assertFalse(userRequestTO.isExecuted());
         }
 
-        userTO = userService.read(userTO.getUsername());
+        userTO = userService.read(userTO.getId());
         assertNotNull(userTO);
 
         UserMod userMod = new UserMod();
@@ -293,7 +293,7 @@ public class UserRequestTestITCase exten
             assertFalse(userRequestTO.isExecuted());
         }
 
-        assertNotNull(userService.read(userTO.getUsername()));
+        assertNotNull(userService.read(userTO.getId()));
 
         try {
             clientFactory.create(userTO.getUsername(), "new" + initialPassword).
@@ -305,8 +305,7 @@ public class UserRequestTestITCase exten
 
         assertNotNull(clientFactory.create(userTO.getUsername(), newpwd).getService(UserService.class).readSelf());
 
-        selfservice =
-                clientFactory.create(userTO.getUsername(), newpwd).getService(UserRequestService.class);
+        selfservice = clientFactory.create(userTO.getUsername(), newpwd).getService(UserRequestService.class);
         response = createUserRequest(selfservice, new UserRequestTO(userTO.getId()));
 
         userRequest = adminClient.getObject(response.getLocation(), UserRequestService.class, UserRequestTO.class);
@@ -325,7 +324,7 @@ public class UserRequestTestITCase exten
         }
 
         try {
-            userService.read(userTO.getUsername());
+            userService.read(userTO.getId());
             fail();
         } catch (Exception ignore) {
             assertNotNull(ignore);
@@ -338,8 +337,8 @@ public class UserRequestTestITCase exten
     public void executeNoClaim() {
         UserTO userTO = UserTestITCase.getUniqueSampleTO("reqnoclaim@syncope.apache.org");
 
-        final UserRequestService selfservice =
-                clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(UserRequestService.class);
+        final UserRequestService selfservice = clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(
+                UserRequestService.class);
 
         final UserRequestTO userRequest = adminClient.getObject(
                 createUserRequest(selfservice, new UserRequestTO(userTO)).getLocation(),

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java?rev=1537047&r1=1537046&r2=1537047&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java Wed Oct 30 11:26:19 2013
@@ -39,6 +39,7 @@ import org.apache.http.HttpStatus;
 
 import org.apache.syncope.common.mod.AttributeMod;
 import org.apache.syncope.common.mod.MembershipMod;
+import org.apache.syncope.common.mod.StatusMod;
 import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.services.PolicyService;
 import org.apache.syncope.common.services.ResourceService;
@@ -54,10 +55,9 @@ import org.apache.syncope.common.to.Mapp
 import org.apache.syncope.common.to.MappingTO;
 import org.apache.syncope.common.to.MembershipTO;
 import org.apache.syncope.common.to.PasswordPolicyTO;
-import org.apache.syncope.common.to.PropagationRequestTO;
 import org.apache.syncope.common.to.PropagationStatusTO;
-import org.apache.syncope.common.to.PropagationTargetsTO;
 import org.apache.syncope.common.to.PropagationTaskTO;
+import org.apache.syncope.common.to.ResourceNameTO;
 import org.apache.syncope.common.to.ResourceTO;
 import org.apache.syncope.common.to.RoleTO;
 import org.apache.syncope.common.to.UserTO;
@@ -70,8 +70,10 @@ import org.apache.syncope.common.types.M
 import org.apache.syncope.common.types.PolicyType;
 import org.apache.syncope.common.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.types.ClientExceptionType;
+import org.apache.syncope.common.types.ResourceAssociationActionType;
 import org.apache.syncope.common.types.TaskType;
 import org.apache.syncope.common.util.AttributableOperations;
+import org.apache.syncope.common.util.CollectionWrapper;
 import org.apache.syncope.common.validation.SyncopeClientException;
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
 import org.apache.syncope.core.persistence.dao.NotFoundException;
@@ -235,7 +237,7 @@ public class UserTestITCase extends Abst
         userMod.getResourcesToAdd().add("ws-target-resource-2");
 
         try {
-            userTO = userService.update(userMod.getId(), userMod);
+            userTO = updateUser(userMod);
             fail();
         } catch (SyncopeClientException e) {
             assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType());
@@ -248,7 +250,7 @@ public class UserTestITCase extends Abst
         userMod.setPassword("newPassword");
         userMod.getResourcesToAdd().add("ws-target-resource-1");
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertNotNull(userTO.getPropagationStatusTOs().get(0).getFailureReason());
 
         // 4. update assigning a resource NOT forcing mandatory constraints
@@ -259,7 +261,7 @@ public class UserTestITCase extends Abst
         userMod.getResourcesToAdd().add("resource-db");
 
         try {
-            userTO = userService.update(userMod.getId(), userMod);
+            updateUser(userMod);
             fail();
         } catch (SyncopeClientException e) {
             assertEquals(ClientExceptionType.InvalidSyncopeUser, e.getType());
@@ -679,7 +681,7 @@ public class UserTestITCase extends Abst
         userMod.setId(userTO.getId());
         userMod.setPassword("anotherPassword123");
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertNotNull(userTO);
     }
 
@@ -700,7 +702,7 @@ public class UserTestITCase extends Abst
 
         long id = userTO.getId();
 
-        userTO = userService.delete(id);
+        userTO = deleteUser(id);
 
         assertNotNull(userTO);
         assertEquals(id, userTO.getId());
@@ -728,7 +730,7 @@ public class UserTestITCase extends Abst
 
         long id = userTO.getId();
         userTO = userService.read(id);
-        userTO = userService.delete(userTO.getId());
+        userTO = deleteUser(userTO.getId());
 
         assertNotNull(userTO);
         assertEquals(id, userTO.getId());
@@ -798,7 +800,7 @@ public class UserTestITCase extends Abst
     @Test
     public void readWithMailAddressAsUserName() {
         UserTO userTO = createUser(getUniqueSampleTO("mail@domain.org"));
-        userTO = userService.read(userTO.getUsername());
+        userTO = userService.read(userTO.getId());
         assertNotNull(userTO);
     }
 
@@ -814,7 +816,7 @@ public class UserTestITCase extends Abst
         userMod.setId(userTO.getId());
         userMod.getDerAttrsToRemove().add("cn");
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
 
         assertNotNull(userTO);
         assertNotNull(userTO.getDerAttrMap());
@@ -883,7 +885,7 @@ public class UserTestITCase extends Abst
         userMod.getMembershipsToAdd().add(membershipMod);
         userMod.getMembershipsToRemove().add(userTO.getMemberships().iterator().next().getId());
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertNotNull(userTO);
 
         // issue SYNCOPE-15
@@ -927,7 +929,7 @@ public class UserTestITCase extends Abst
         userMod.setId(userTO.getId());
         userMod.setPassword("newPassword123");
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
 
         // check for changePwdDate
         assertNotNull(userTO.getChangePwdDate());
@@ -989,7 +991,7 @@ public class UserTestITCase extends Abst
 
         userMod.getAttrsToUpdate().add(attributeMod("surname", "surname"));
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
 
         assertNotNull(userTO);
 
@@ -1042,39 +1044,14 @@ public class UserTestITCase extends Abst
 
         assertEquals("created", userTO.getStatus());
 
-        userTO = userService.activate(userTO.getId(), userTO.getToken());
+        StatusMod statusMod = new StatusMod();
+        statusMod.setType(StatusMod.ModType.ACTIVATE);
+        statusMod.setToken(userTO.getToken());
+        userTO = userService.status(userTO.getId(), statusMod).readEntity(UserTO.class);
 
         assertNotNull(userTO);
         assertNull(userTO.getToken());
         assertNull(userTO.getTokenExpireTime());
-
-        assertEquals("active", userTO.getStatus());
-    }
-
-    @Test
-    public void createActivateByUsername() {
-        Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForUsers());
-
-        UserTO userTO = getUniqueSampleTO("createActivateByUsername@syncope.apache.org");
-
-        MembershipTO membershipTO = new MembershipTO();
-        membershipTO.setRoleId(11L);
-        userTO.getMemberships().add(membershipTO);
-
-        userTO = createUser(userTO);
-
-        assertNotNull(userTO);
-        assertNotNull(userTO.getToken());
-        assertNotNull(userTO.getTokenExpireTime());
-
-        assertEquals("created", userTO.getStatus());
-
-        userTO = userService.activateByUsername(userTO.getUsername(), userTO.getToken());
-
-        assertNotNull(userTO);
-        assertNull(userTO.getToken());
-        assertNull(userTO.getTokenExpireTime());
-
         assertEquals("active", userTO.getStatus());
     }
 
@@ -1093,39 +1070,15 @@ public class UserTestITCase extends Abst
                 ? "active"
                 : "created", userTO.getStatus());
 
-        userTO = userService.suspend(userTO.getId());
-
-        assertNotNull(userTO);
-        assertEquals("suspended", userTO.getStatus());
-
-        userTO = userService.reactivate(userTO.getId());
-
-        assertNotNull(userTO);
-        assertEquals("active", userTO.getStatus());
-    }
-
-    @Test
-    public void suspendReactivateByUsername() {
-        UserTO userTO = getUniqueSampleTO("suspendReactivateByUsername@syncope.apache.org");
-
-        MembershipTO membershipTO = new MembershipTO();
-        membershipTO.setRoleId(7L);
-        userTO.getMemberships().add(membershipTO);
-
-        userTO = createUser(userTO);
-
-        assertNotNull(userTO);
-        assertEquals(ActivitiDetector.isActivitiEnabledForUsers()
-                ? "active"
-                : "created", userTO.getStatus());
-
-        userTO = userService.suspendByUsername(userTO.getUsername());
-
+        StatusMod statusMod = new StatusMod();
+        statusMod.setType(StatusMod.ModType.SUSPEND);
+        userTO = userService.status(userTO.getId(), statusMod).readEntity(UserTO.class);
         assertNotNull(userTO);
         assertEquals("suspended", userTO.getStatus());
 
-        userTO = userService.reactivateByUsername(userTO.getUsername());
-
+        statusMod = new StatusMod();
+        statusMod.setType(StatusMod.ModType.REACTIVATE);
+        userTO = userService.status(userTO.getId(), statusMod).readEntity(UserTO.class);
         assertNotNull(userTO);
         assertEquals("active", userTO.getStatus());
     }
@@ -1152,11 +1105,12 @@ public class UserTestITCase extends Abst
         long userId = userTO.getId();
 
         // Suspend with effect on syncope, ldap and db => user should be suspended in syncope and all resources
-        PropagationRequestTO propagationRequestTO = new PropagationRequestTO();
-        propagationRequestTO.setOnSyncope(true);
-        propagationRequestTO.getResources().add(RESOURCE_NAME_TESTDB);
-        propagationRequestTO.getResources().add(RESOURCE_NAME_LDAP);
-        userTO = userService.suspend(userId, propagationRequestTO);
+        StatusMod statusMod = new StatusMod();
+        statusMod.setType(StatusMod.ModType.SUSPEND);
+        statusMod.setOnSyncope(true);
+        statusMod.getResourceNames().add(RESOURCE_NAME_TESTDB);
+        statusMod.getResourceNames().add(RESOURCE_NAME_LDAP);
+        userTO = userService.status(userId, statusMod).readEntity(UserTO.class);
         assertNotNull(userTO);
         assertEquals("suspended", userTO.getStatus());
 
@@ -1167,11 +1121,13 @@ public class UserTestITCase extends Abst
         assertNotNull(connObjectTO);
 
         // Suspend and reactivate only on ldap => db and syncope should still show suspended
-        propagationRequestTO = new PropagationRequestTO();
-        propagationRequestTO.setOnSyncope(false);
-        propagationRequestTO.getResources().add(RESOURCE_NAME_LDAP);
-        userTO = userService.suspend(userId, propagationRequestTO);
-        userTO = userService.reactivate(userId, propagationRequestTO);
+        statusMod = new StatusMod();
+        statusMod.setType(StatusMod.ModType.SUSPEND);
+        statusMod.setOnSyncope(false);
+        statusMod.getResourceNames().add(RESOURCE_NAME_LDAP);
+        userService.status(userId, statusMod);
+        statusMod.setType(StatusMod.ModType.REACTIVATE);
+        userTO = userService.status(userId, statusMod).readEntity(UserTO.class);
         assertNotNull(userTO);
         assertEquals("suspended", userTO.getStatus());
 
@@ -1179,11 +1135,12 @@ public class UserTestITCase extends Abst
         assertFalse(getBooleanAttribute(connObjectTO, OperationalAttributes.ENABLE_NAME));
 
         // Reactivate on syncope and db => syncope and db should show the user as active
-        propagationRequestTO = new PropagationRequestTO();
-        propagationRequestTO.setOnSyncope(true);
-        propagationRequestTO.getResources().add(RESOURCE_NAME_TESTDB);
+        statusMod = new StatusMod();
+        statusMod.setType(StatusMod.ModType.REACTIVATE);
+        statusMod.setOnSyncope(true);
+        statusMod.getResourceNames().add(RESOURCE_NAME_TESTDB);
 
-        userTO = userService.reactivate(userId, propagationRequestTO);
+        userTO = userService.status(userId, statusMod).readEntity(UserTO.class);
         assertNotNull(userTO);
         assertEquals("active", userTO.getStatus());
 
@@ -1212,7 +1169,7 @@ public class UserTestITCase extends Abst
         userMod.setId(userTO.getId());
         userMod.getAttrsToUpdate().add(loginDateMod);
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertNotNull(userTO);
 
         loginDate = userTO.getAttrMap().get("loginDate");
@@ -1241,8 +1198,7 @@ public class UserTestITCase extends Abst
         userMod.setId(userTO.getId());
         userMod.getResourcesToRemove().add(RESOURCE_NAME_TESTDB);
 
-        userTO = userService.update(userMod.getId(), userMod);
-
+        userTO = updateUser(userMod);
         assertTrue(userTO.getResources().isEmpty());
 
         jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?", String.class, userTO.getUsername());
@@ -1261,10 +1217,8 @@ public class UserTestITCase extends Abst
         userMod.setId(userTO.getId());
         userMod.setUsername("1" + userTO.getUsername());
 
-        userTO = userService.update(userMod.getId(), userMod);
-
+        userTO = updateUser(userMod);
         assertNotNull(userTO);
-
         assertEquals("1" + inUserTO.getUsername(), userTO.getUsername());
     }
 
@@ -1291,8 +1245,7 @@ public class UserTestITCase extends Abst
 
         assertNotNull(userMod);
 
-        toBeUpdated = userService.update(userMod.getId(), userMod);
-
+        toBeUpdated = updateUser(userMod);
         assertNotNull(toBeUpdated);
 
         assertFalse(toBeUpdated.getVirAttrs().isEmpty());
@@ -1316,7 +1269,7 @@ public class UserTestITCase extends Abst
         userMod.setPassword("123password");
         userMod.getResourcesToAdd().add(RESOURCE_NAME_TESTDB);
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertNotNull(userTO);
 
         final List<PropagationStatusTO> propagations = userTO.getPropagationStatusTOs();
@@ -1445,7 +1398,7 @@ public class UserTestITCase extends Abst
         userMod.getVirAttrsToUpdate().add(attributeMod("virtualdata", "virtualupdated"));
 
         // 3. update virtual attribute
-        actual = userService.update(userMod.getId(), userMod);
+        actual = updateUser(userMod);
         assertNotNull(actual);
 
         // 4. check for virtual attribute value
@@ -1491,7 +1444,7 @@ public class UserTestITCase extends Abst
 
         userMod.getMembershipsToRemove().add(actual.getMemberships().get(0).getId());
 
-        actual = userService.update(userMod.getId(), userMod);
+        actual = updateUser(userMod);
         assertNotNull(actual);
         assertEquals(1, actual.getMemberships().size());
 
@@ -1507,7 +1460,7 @@ public class UserTestITCase extends Abst
 
         userMod.getResourcesToRemove().add(actual.getResources().iterator().next());
 
-        actual = userService.update(userMod.getId(), userMod);
+        actual = updateUser(userMod);
         assertNotNull(actual);
         assertEquals(1, actual.getMemberships().size());
         assertFalse(actual.getResources().isEmpty());
@@ -1524,7 +1477,7 @@ public class UserTestITCase extends Abst
 
         userMod.getMembershipsToRemove().add(actual.getMemberships().get(0).getId());
 
-        actual = userService.update(userMod.getId(), userMod);
+        actual = updateUser(userMod);
         assertNotNull(actual);
         assertTrue(actual.getMemberships().isEmpty());
         assertTrue(actual.getResources().isEmpty());
@@ -1586,7 +1539,7 @@ public class UserTestITCase extends Abst
 
         userMod.getMembershipsToRemove().add(membershipTO.getId());
 
-        actual = userService.update(userMod.getId(), userMod);
+        actual = updateUser(userMod);
         assertNotNull(actual);
         assertEquals(1, actual.getMemberships().size());
 
@@ -1691,7 +1644,7 @@ public class UserTestITCase extends Abst
 
         userMod.getVirAttrsToUpdate().add(attrMod);
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertNotNull(userTO);
         assertFalse(userTO.getPropagationStatusTOs().isEmpty());
         assertEquals("ws-target-resource-2", userTO.getPropagationStatusTOs().get(0).getResource());
@@ -1705,7 +1658,9 @@ public class UserTestITCase extends Abst
         // ----------------------------------
         // suspend/reactivate user and check virtual attribute value (unchanged)
         // ----------------------------------
-        userTO = userService.suspend(userTO.getId());
+        StatusMod statusMod = new StatusMod();
+        statusMod.setType(StatusMod.ModType.SUSPEND);
+        userTO = userService.status(userTO.getId(), statusMod).readEntity(UserTO.class);
         assertEquals("suspended", userTO.getStatus());
 
         connObjectTO = readConnectorObject("ws-target-resource-2", userTO.getId());
@@ -1713,7 +1668,9 @@ public class UserTestITCase extends Abst
         assertFalse(connObjectTO.getAttrMap().get("NAME").getValues().isEmpty());
         assertEquals("virtualvalue2", connObjectTO.getAttrMap().get("NAME").getValues().get(0));
 
-        userTO = userService.reactivate(userTO.getId());
+        statusMod = new StatusMod();
+        statusMod.setType(StatusMod.ModType.REACTIVATE);
+        userTO = userService.status(userTO.getId(), statusMod).readEntity(UserTO.class);
         assertEquals("active", userTO.getStatus());
 
         connObjectTO = readConnectorObject("ws-target-resource-2", userTO.getId());
@@ -1735,7 +1692,7 @@ public class UserTestITCase extends Abst
 
         userMod.getAttrsToUpdate().add(attrMod);
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertNotNull(userTO);
         assertFalse(userTO.getPropagationStatusTOs().isEmpty());
         assertEquals("ws-target-resource-2", userTO.getPropagationStatusTOs().get(0).getResource());
@@ -1757,7 +1714,7 @@ public class UserTestITCase extends Abst
         userMod.setId(userTO.getId());
         userMod.getVirAttrsToRemove().add("virtualdata");
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertNotNull(userTO);
         assertTrue(userTO.getVirAttrs().isEmpty());
         assertFalse(userTO.getPropagationStatusTOs().isEmpty());
@@ -1814,7 +1771,7 @@ public class UserTestITCase extends Abst
         // this resource has not a mapping for Password
         userMod.getResourcesToAdd().add("ws-target-resource-update");
 
-        userTO = userService.update(userTO.getId(), userMod);
+        userTO = updateUser(userMod);
         assertNotNull(userTO);
     }
 
@@ -1864,11 +1821,12 @@ public class UserTestITCase extends Abst
         UserMod userMod = new UserMod();
         userMod.setId(userTO.getId());
         userMod.setPassword(getUUIDString());
-        PropagationRequestTO pwdPropRequest = new PropagationRequestTO();
-        pwdPropRequest.getResources().add(RESOURCE_NAME_TESTDB);
+        StatusMod pwdPropRequest = new StatusMod();
+        pwdPropRequest.setOnSyncope(false);
+        pwdPropRequest.getResourceNames().add(RESOURCE_NAME_TESTDB);
         userMod.setPwdPropRequest(pwdPropRequest);
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
 
         // 3a. Chech that only a single propagation took place
         assertNotNull(userTO.getPropagationStatusTOs());
@@ -1909,7 +1867,7 @@ public class UserTestITCase extends Abst
         UserTO userTO = getUniqueSampleTO("syncope136_AES@apache.org");
         userTO.getResources().clear();
 
-        userTO = userService.create(userTO).readEntity(UserTO.class);
+        userTO = createUser(userTO);
         assertNotNull(userTO);
 
         // 4. update user, assign a propagation primary resource but don't provide any password
@@ -1917,7 +1875,7 @@ public class UserTestITCase extends Abst
         userMod.setId(userTO.getId());
         userMod.getResourcesToAdd().add("ws-target-resource-1");
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertNotNull(userTO);
 
         // 5. verify that propagation was successful
@@ -1940,7 +1898,7 @@ public class UserTestITCase extends Abst
         UserTO userTO = getUniqueSampleTO("syncope136_Random@apache.org");
         userTO.getResources().clear();
 
-        userTO = userService.create(userTO).readEntity(UserTO.class);
+        userTO = createUser(userTO);
         assertNotNull(userTO);
 
         // 2. update user, assign a propagation primary resource but don't provide any password
@@ -1948,7 +1906,7 @@ public class UserTestITCase extends Abst
         userMod.setId(userTO.getId());
         userMod.getResourcesToAdd().add(RESOURCE_NAME_LDAP);
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertNotNull(userTO);
 
         // 3. verify that propagation was successful
@@ -2017,7 +1975,7 @@ public class UserTestITCase extends Abst
         userMod.getVirAttrsToUpdate().add(virtualdata);
 
         // 3. update virtual attribute
-        actual = userService.update(actual.getId(), userMod);
+        actual = updateUser(userMod);
         assertNotNull(actual);
 
         // 4. check for virtual attribute value
@@ -2057,7 +2015,7 @@ public class UserTestITCase extends Abst
             userMod.getAttrsToRemove().add("type");
             userMod.getAttrsToUpdate().add(attributeMod);
 
-            UserTO userTO = userService.update(i, userMod);
+            UserTO userTO = updateUser(userMod);
             assertEquals("a type", userTO.getAttrMap().get("type").getValues().get(0));
         }
     }
@@ -2077,21 +2035,21 @@ public class UserTestITCase extends Abst
         assertEquals(11, bulkAction.getTargets().size());
 
         bulkAction.setOperation(BulkAction.Type.SUSPEND);
-        BulkActionRes res = userService.bulkAction(bulkAction);
+        BulkActionRes res = userService.bulk(bulkAction);
         assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
         assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
         assertEquals("suspended", userService.read(
                 Long.parseLong(res.getResultByStatus(Status.SUCCESS).get(3).toString())).getStatus());
 
         bulkAction.setOperation(BulkAction.Type.REACTIVATE);
-        res = userService.bulkAction(bulkAction);
+        res = userService.bulk(bulkAction);
         assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
         assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
         assertEquals("active", userService.read(
                 Long.parseLong(res.getResultByStatus(Status.SUCCESS).get(3).toString())).getStatus());
 
         bulkAction.setOperation(BulkAction.Type.DELETE);
-        res = userService.bulkAction(bulkAction);
+        res = userService.bulk(bulkAction);
         assertEquals(10, res.getResultByStatus(Status.SUCCESS).size());
         assertEquals(1, res.getResultByStatus(Status.FAILURE).size());
     }
@@ -2113,7 +2071,7 @@ public class UserTestITCase extends Abst
         roleTO.setParent(8L);
         roleTO.getResources().add(RESOURCE_NAME_LDAP);
 
-        roleTO = createRole(roleService, roleTO);
+        roleTO = createRole(roleTO);
         assertNotNull(roleTO);
 
         // 2. create user with LDAP resource and membership of the above role
@@ -2138,7 +2096,7 @@ public class UserTestITCase extends Abst
         userMod.setId(userTO.getId());
         userMod.getMembershipsToRemove().add(userTO.getMemberships().iterator().next().getId());
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertTrue(userTO.getResources().contains(RESOURCE_NAME_LDAP));
 
         // 5. read role on resource, check that user DN was removed from uniqueMember
@@ -2164,7 +2122,7 @@ public class UserTestITCase extends Abst
         roleTO.setParent(8L);
         roleTO.getResources().add(RESOURCE_NAME_LDAP);
 
-        roleTO = createRole(roleService, roleTO);
+        roleTO = createRole(roleTO);
         assertNotNull(roleTO);
 
         // 2. create user with membership of the above role
@@ -2211,7 +2169,7 @@ public class UserTestITCase extends Abst
         UserMod userMod = new UserMod();
         userMod.setId(userTO.getId());
         userMod.getResourcesToAdd().add(RESOURCE_NAME_TESTDB);
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertEquals(RESOURCE_NAME_TESTDB, userTO.getResources().iterator().next());
         assertFalse(userTO.getPropagationStatusTOs().get(0).getStatus().isSuccessful());
         assertNotNull(userTO.getPropagationStatusTOs().get(0).getFailureReason());
@@ -2220,11 +2178,11 @@ public class UserTestITCase extends Abst
         userMod = new UserMod();
         userMod.setId(userTO.getId());
         userMod.setPassword(getUUIDString());
-        PropagationRequestTO pwdPropRequest = new PropagationRequestTO();
-        pwdPropRequest.getResources().add(RESOURCE_NAME_TESTDB);
+        StatusMod pwdPropRequest = new StatusMod();
+        pwdPropRequest.getResourceNames().add(RESOURCE_NAME_TESTDB);
         userMod.setPwdPropRequest(pwdPropRequest);
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertEquals(RESOURCE_NAME_TESTDB, userTO.getResources().iterator().next());
         assertTrue(userTO.getPropagationStatusTOs().get(0).getStatus().isSuccessful());
     }
@@ -2287,13 +2245,13 @@ public class UserTestITCase extends Abst
         userMod.getVirAttrsToUpdate().add(attributeMod("virtualdata", "test@testoneone.com"));
         // check Syncope change password
 
-        PropagationRequestTO pwdPropRequest = new PropagationRequestTO();
-        //change pwd on Syncope
-        pwdPropRequest.getResources().add("ws-target-resource-2");
+        StatusMod pwdPropRequest = new StatusMod();
+        //change pwd on external resource
+        pwdPropRequest.getResourceNames().add("ws-target-resource-2");
         //change pwd on Syncope
         pwdPropRequest.setOnSyncope(true);
         userMod.setPwdPropRequest(pwdPropRequest);
-        toBeUpdated = userService.update(userMod.getId(), userMod);
+        toBeUpdated = updateUser(userMod);
         assertNotNull(toBeUpdated);
         assertEquals("test@testoneone.com", toBeUpdated.getVirAttrs().get(0).getValues().get(0));
         // check if propagates correctly with assertEquals on size of tasks list
@@ -2324,7 +2282,7 @@ public class UserTestITCase extends Abst
         userMod.setPassword("newPassword");
         userMod.getResourcesToAdd().add("ws-target-resource-1");
         userMod.getResourcesToAdd().add("resource-testdb");
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertEquals("ws-target-resource-1", userTO.getPropagationStatusTOs().get(1).getResource());
         assertNotNull(userTO.getPropagationStatusTOs().get(1).getFailureReason());
         assertEquals(PropagationTaskExecStatus.UNSUBMITTED, userTO.getPropagationStatusTOs().get(1).getStatus());
@@ -2410,14 +2368,14 @@ public class UserTestITCase extends Abst
             userService.read(userTO.getId());
             fail();
         } catch (Exception ignore) {
-            // ignore
+            assertNotNull(ignore);
         }
 
         try {
             userWorkflowService.getFormsByName(userTO.getId(), "Create approval");
             fail();
         } catch (Exception ignore) {
-            // ignore
+            assertNotNull(ignore);
         }
     }
 
@@ -2437,10 +2395,10 @@ public class UserTestITCase extends Abst
         ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_CSV, actual.getId());
         assertNotNull(connObjectTO);
 
-        PropagationTargetsTO res = new PropagationTargetsTO();
-        res.getResources().add(RESOURCE_NAME_CSV);
-
-        actual = userService.unlink(actual.getId(), res);
+        actual = userService.associate(actual.getId(),
+                ResourceAssociationActionType.UNLINK,
+                CollectionWrapper.wrap(RESOURCE_NAME_CSV, ResourceNameTO.class)).
+                readEntity(UserTO.class);
         assertNotNull(actual);
         assertTrue(actual.getResources().isEmpty());
 
@@ -2469,10 +2427,10 @@ public class UserTestITCase extends Abst
         ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_CSV, actual.getId());
         assertNotNull(connObjectTO);
 
-        PropagationTargetsTO res = new PropagationTargetsTO();
-        res.getResources().add(RESOURCE_NAME_CSV);
-
-        actual = userService.unassign(actual.getId(), res);
+        actual = userService.associate(actual.getId(),
+                ResourceAssociationActionType.UNASSIGN,
+                CollectionWrapper.wrap(RESOURCE_NAME_CSV, ResourceNameTO.class)).
+                readEntity(UserTO.class);
         assertNotNull(actual);
         assertTrue(actual.getResources().isEmpty());
 
@@ -2484,7 +2442,7 @@ public class UserTestITCase extends Abst
             readConnectorObject(RESOURCE_NAME_CSV, actual.getId());
             fail();
         } catch (Exception e) {
-            // ignore
+            assertNotNull(e);
         }
     }
 
@@ -2504,10 +2462,10 @@ public class UserTestITCase extends Abst
         ConnObjectTO connObjectTO = readConnectorObject(RESOURCE_NAME_CSV, actual.getId());
         assertNotNull(connObjectTO);
 
-        PropagationTargetsTO res = new PropagationTargetsTO();
-        res.getResources().add(RESOURCE_NAME_CSV);
-
-        actual = userService.deprovision(actual.getId(), res);
+        actual = userService.associate(actual.getId(),
+                ResourceAssociationActionType.DEPROVISION,
+                CollectionWrapper.wrap(RESOURCE_NAME_CSV, ResourceNameTO.class)).
+                readEntity(UserTO.class);
         assertNotNull(actual);
         assertFalse(actual.getResources().isEmpty());
 
@@ -2519,7 +2477,7 @@ public class UserTestITCase extends Abst
             readConnectorObject(RESOURCE_NAME_CSV, actual.getId());
             fail();
         } catch (Exception e) {
-            // ignore
+            assertNotNull(e);
         }
     }
 
@@ -2536,7 +2494,7 @@ public class UserTestITCase extends Abst
         userMod.getAttrsToRemove().add("makeItDouble");
         userMod.getAttrsToUpdate().add(attributeMod("makeItDouble", "7"));
 
-        userTO = userService.update(userMod.getId(), userMod);
+        userTO = updateUser(userMod);
         assertEquals("14", userTO.getAttrMap().get("makeItDouble").getValues().get(0));
     }
 
@@ -2548,7 +2506,7 @@ public class UserTestITCase extends Abst
 
         UserMod userMod = new UserMod();
         userMod.setPassword("anotherPassword123");
-        userTO = userService.update(userTO.getId(), userMod);
+        userTO = userService.update(userTO.getId(), userMod).readEntity(UserTO.class);
         assertNotNull(userTO);
     }