You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by md...@apache.org on 2013/11/18 17:35:55 UTC

svn commit: r1543069 - /syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java

Author: mdisabatino
Date: Mon Nov 18 16:35:55 2013
New Revision: 1543069

URL: http://svn.apache.org/r1543069
Log:
SYNCOPE-436 fix test for readonly virtual attributes

Modified:
    syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java

Modified: syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java?rev=1543069&r1=1543068&r2=1543069&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java (original)
+++ syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java Mon Nov 18 16:35:55 2013
@@ -381,13 +381,13 @@ public class TaskTestITCase extends Abst
         SyncTaskTO task = taskService.read(TaskType.SYNCHRONIZATION, 11L);
         assertNotNull(task);
 
-        //  add role template
+        //  add user template
         final UserTO userTemplate = task.getUserTemplate();
         userTemplate.setResources(Collections.singleton("resource-ldap"));
         userTemplate.addVirtualAttribute(attributeTO("virtualReadOnly", ""));
 
         task.setUserTemplate(userTemplate);
-        
+
         //  add role template
         final RoleTO roleTemplate = new RoleTO();
         roleTemplate.setParent(8L);
@@ -423,6 +423,9 @@ public class TaskTestITCase extends Abst
         final List<UserTO> matchingUsers = userService.search(NodeCond.getLeafCond(usernameLeafCond));
         assertNotNull(matchingUsers);
         assertEquals(1, matchingUsers.size());
+        // Check for SYNCOPE-436
+        assertEquals("syncFromLDAP", matchingUsers.get(0).
+                getVirtualAttributeMap().get("virtualReadOnly").getValues().get(0));
 
         final RoleTO roleTO = matchingRoles.iterator().next();
         assertNotNull(roleTO);
@@ -937,35 +940,4 @@ public class TaskTestITCase extends Abst
             }
         }
     }
-
-    @Test
-    public void issueSYNCOPE436() throws InvalidSearchConditionException {
-
-        SyncTaskTO task = taskService.read(TaskType.SYNCHRONIZATION, 11L);
-        assertNotNull(task);
-
-        final UserTO template = task.getUserTemplate();
-        template.setResources(Collections.singleton("resource-ldap"));
-        template.addVirtualAttribute(attributeTO("virtualReadOnly", ""));
-        task.setUserTemplate(template);
-
-        taskService.update(task.getId(), task);
-        TaskExecTO execution = execSyncTask(11L, 50, false);
-
-        final String status = execution.getStatus();
-        assertNotNull(status);
-        assertTrue(PropagationTaskExecStatus.valueOf(status).isSuccessful());
-
-        final AttributableCond usernameLeafCond = new AttributableCond(AttributeCond.Type.EQ);
-        usernameLeafCond.setSchema("username");
-        usernameLeafCond.setExpression("syncFromLDAP");
-
-        final List<UserTO> matchingUsers = userService.search(NodeCond.getLeafCond(usernameLeafCond));
-        assertNotNull(matchingUsers);
-        assertEquals(1, matchingUsers.size());
-
-        final UserTO syncUser = matchingUsers.iterator().next();
-        final AttributeTO virAttributeTO = syncUser.getVirtualAttributeMap().get("virtualReadOnly");
-        assertEquals("syncFromLDAP", virAttributeTO.getValues().get(0));
-    }
 }
\ No newline at end of file