You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by fm...@apache.org on 2013/01/04 15:35:26 UTC

svn commit: r1428893 - in /syncope/branches/1_0_X/core/src: main/java/org/apache/syncope/core/propagation/PropagationManager.java test/java/org/apache/syncope/core/rest/UserTestITCase.java

Author: fmartelli
Date: Fri Jan  4 14:35:26 2013
New Revision: 1428893

URL: http://svn.apache.org/viewvc?rev=1428893&view=rev
Log:
SYNCOPE-260 - Fixes branch version. Need to be manually merged on the trunk

Modified:
    syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/PropagationManager.java
    syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java

Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/PropagationManager.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/PropagationManager.java?rev=1428893&r1=1428892&r2=1428893&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/PropagationManager.java (original)
+++ syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/propagation/PropagationManager.java Fri Jan  4 14:35:26 2013
@@ -199,11 +199,12 @@ public class PropagationManager {
             final Set<String> syncResourceNames)
             throws NotFoundException {
 
-        return getUpdateTaskIds(user, // SyncopeUser to be updated on external resources
+        return getUpdateTaskIds(
+                user, // SyncopeUser to be updated on external resources
                 null, // no propagation by resources
                 null, // no password
-                null, // no virtual attributes to be managed
-                null, // no virtual attributes to be managed
+                Collections.<String>emptySet(), // no virtual attributes to be managed
+                Collections.<AttributeMod>emptySet(), // no virtual attributes to be managed
                 enable, // status to be propagated
                 syncResourceNames);
     }
@@ -218,7 +219,12 @@ public class PropagationManager {
     public List<PropagationTask> getUpdateTaskIds(final WorkflowResult<Map.Entry<Long, Boolean>> wfResult)
             throws NotFoundException {
 
-        return getUpdateTaskIds(wfResult, null, null, null, null);
+        return getUpdateTaskIds(
+                wfResult,
+                null,
+                Collections.<String>emptySet(),
+                Collections.<AttributeMod>emptySet(),
+                null);
     }
 
     /**
@@ -347,7 +353,8 @@ public class PropagationManager {
      */
     private Map.Entry<String, Attribute> prepareAttribute(final SchemaMapping mapping, final SyncopeUser user,
             final String password, final Set<String> vAttrsToBeRemoved,
-            final Map<String, AttributeMod> vAttrsToBeUpdated) throws ClassNotFoundException {
+            final Map<String, AttributeMod> vAttrsToBeUpdated)
+            throws ClassNotFoundException {
 
         final List<AbstractAttributable> attributables = new ArrayList<AbstractAttributable>();
 
@@ -743,19 +750,18 @@ public class PropagationManager {
                             LOG.debug("{} not found on external resource: ignoring delete", task.getAccountId());
                         } else {
                             /*
-                             * We must choose here whether to
-                             *  a. actually delete the provided user from the external resource
-                             *  b. just update the provided user data onto the external resource
+                             * We must choose here whether to a. actually delete the provided user from the external
+                             * resource b. just update the provided user data onto the external resource
                              *
                              * (a) happens when either there is no user associated with the PropagationTask (this takes
                              * place when the task is generated via UserController.delete()) or the provided updated
                              * user hasn't the current resource assigned (when the task is generated via
                              * UserController.update()).
                              *
-                             * (b) happens when the provided updated user does have the current resource assigned
-                             * (when the task is generated via UserController.update()): this basically means that
-                             * before such update, this user used to have the current resource assigned by more than
-                             * one mean (for example, two different memberships with the same resource).
+                             * (b) happens when the provided updated user does have the current resource assigned (when
+                             * the task is generated via UserController.update()): this basically means that before such
+                             * update, this user used to have the current resource assigned by more than one mean (for
+                             * example, two different memberships with the same resource).
                              */
 
                             SyncopeUser user = null;

Modified: syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java?rev=1428893&r1=1428892&r2=1428893&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java (original)
+++ syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java Fri Jan  4 14:35:26 2013
@@ -2082,6 +2082,30 @@ public class UserTestITCase extends Abst
         // ----------------------------------
 
         // ----------------------------------
+        // suspend/reactivate user and check virtual attribute value (unchanged)
+        // ----------------------------------
+        userTO = restTemplate.getForObject(BASE_URL + "user/suspend/" + userTO.getId(), UserTO.class);
+        assertEquals("suspended", userTO.getStatus());
+
+        connObjectTO = restTemplate.getForObject(
+                BASE_URL + "/resource/{resourceName}/read/{objectId}.json",
+                ConnObjectTO.class, "ws-target-resource-2", userTO.getUsername());
+        assertNotNull(connObjectTO);
+        assertFalse(connObjectTO.getAttributeMap().get("NAME").getValues().isEmpty());
+        assertEquals("virtualvalue2", connObjectTO.getAttributeMap().get("NAME").getValues().get(0));
+        
+        userTO = restTemplate.getForObject(BASE_URL + "user/reactivate/" + userTO.getId(), UserTO.class);
+        assertEquals("active", userTO.getStatus());
+        
+        connObjectTO = restTemplate.getForObject(
+                BASE_URL + "/resource/{resourceName}/read/{objectId}.json",
+                ConnObjectTO.class, "ws-target-resource-2", userTO.getUsername());
+        assertNotNull(connObjectTO);
+        assertFalse(connObjectTO.getAttributeMap().get("NAME").getValues().isEmpty());
+        assertEquals("virtualvalue2", connObjectTO.getAttributeMap().get("NAME").getValues().get(0));
+        // ----------------------------------
+
+        // ----------------------------------
         // update user attribute and check virtual attribute value (unchanged)
         // ----------------------------------
         userMod = new UserMod();