Return-Path: X-Original-To: apmail-syncope-commits-archive@www.apache.org Delivered-To: apmail-syncope-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DD801ECA9 for ; Mon, 14 Jan 2013 14:31:38 +0000 (UTC) Received: (qmail 24511 invoked by uid 500); 14 Jan 2013 14:31:38 -0000 Delivered-To: apmail-syncope-commits-archive@syncope.apache.org Received: (qmail 24419 invoked by uid 500); 14 Jan 2013 14:31:36 -0000 Mailing-List: contact commits-help@syncope.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@syncope.apache.org Delivered-To: mailing list commits@syncope.apache.org Received: (qmail 24374 invoked by uid 99); 14 Jan 2013 14:31:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jan 2013 14:31:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jan 2013 14:31:33 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8EB7023889BB; Mon, 14 Jan 2013 14:31:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@syncope.apache.org From: mdisabatino@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130114143114.8EB7023889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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