syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdisabat...@apache.org
Subject svn commit: r1432929 - /syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
Date Mon, 14 Jan 2013 14:31:14 GMT
Author: mdisabatino
Date: Mon Jan 14 14:31:14 2013
New Revision: 1432929

URL: http://svn.apache.org/viewvc?rev=1432929&view=rev
Log:
SYNCOPE-272 merge from branch 1_0_X

Modified:
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java

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=1432929&r1=1432928&r2=1432929&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 Mon
Jan 14 14:31:14 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.rest;
 
+import java.util.Collections;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -30,6 +31,7 @@ import java.util.Set;
 import org.apache.syncope.client.search.AttributableCond;
 import org.apache.syncope.client.search.MembershipCond;
 import org.apache.syncope.client.search.NodeCond;
+import org.apache.syncope.client.to.AttributeTO;
 import org.apache.syncope.client.to.MembershipTO;
 import org.apache.syncope.client.to.NotificationTO;
 import org.apache.syncope.client.to.NotificationTaskTO;
@@ -654,4 +656,58 @@ public class TaskTestITCase extends Abst
         }
         return taskTO.getExecutions().get(0);
     }
+
+    @Test
+    public void issueSYNCOPE272() {
+
+        //Create user with testdb resource
+        UserTO userTO = new UserTO();
+        userTO.setUsername("syncope272@syncope.apache.org");
+        userTO.setPassword("password");
+        userTO.addAttribute(attributeTO("firstname", "syncope272"));
+        userTO.addAttribute(attributeTO("surname", "syncope272"));
+        userTO.addAttribute(attributeTO("userId", "syncope272@syncope.apache.org"));
+        userTO.addAttribute(attributeTO("fullname", "syncope272"));
+        userTO.addResource("resource-testdb");
+
+        userTO = userService.create(userTO);
+
+        assertNotNull(userTO);
+        assertEquals(1, userTO.getPropagationTOs().size());
+        assertTrue(userTO.getPropagationTOs().get(0).getStatus().isSuccessful());
+
+        // Update sync task
+        SyncTaskTO task = taskService.read(SYNC_TASK_ID, SyncTaskTO.class);
+        assertNotNull(task);
+
+        // add user template
+
+        AttributeTO newAttrTO = new AttributeTO();
+        newAttrTO.setSchema("firstname");
+        newAttrTO.setValues(Collections.singletonList(""));
+
+        UserTO template = new UserTO();
+        template.addAttribute(newAttrTO);
+        template.addAttribute(attributeTO("userId", "'test'"));
+        template.addAttribute(attributeTO("fullname", "'test'"));
+        template.addAttribute(attributeTO("surname", "'test'"));
+        template.addResource("resource-testdb");
+
+        task.setUserTemplate(template);
+
+        SyncTaskTO actual = taskService.update(task.getId(), task);
+        assertNotNull(actual);
+        assertEquals(task.getId(), actual.getId());
+
+        TaskExecTO taskExecTO = execTask(SyncTaskTO.class, SYNC_TASK_ID, 50, false);
+        assertNotNull(actual);
+        assertEquals(task.getId(), actual.getId());
+
+        assertNotNull(taskExecTO.getStatus());
+        assertTrue(PropagationTaskExecStatus.valueOf(taskExecTO.getStatus()).isSuccessful());
+
+        userTO = userService.read("syncope272@syncope.apache.org");
+        assertNotNull(userTO);
+        assertNotNull(userTO.getAttributeMap().get("firstname").getValues().get(0));
+    }
 }
\ No newline at end of file



Mime
View raw message