syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1535657 - in /syncope/trunk: ./ common/src/main/java/org/apache/syncope/common/services/ core/src/main/java/org/apache/syncope/core/services/ core/src/test/java/org/apache/syncope/core/rest/
Date Fri, 25 Oct 2013 08:40:10 GMT
Author: ilgrosso
Date: Fri Oct 25 08:40:09 2013
New Revision: 1535657

URL: http://svn.apache.org/r1535657
Log:
[SYNCOPE-426] Merge from 1_1_X

Modified:
    syncope/trunk/   (props changed)
    syncope/trunk/common/src/main/java/org/apache/syncope/common/services/UserService.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java

Propchange: syncope/trunk/
------------------------------------------------------------------------------
  Merged /syncope/branches/1_1_X:r1535064-1535655

Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/UserService.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/UserService.java?rev=1535657&r1=1535656&r2=1535657&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/services/UserService.java
(original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/services/UserService.java
Fri Oct 25 08:40:09 2013
@@ -207,7 +207,7 @@ public interface UserService {
      * @param userMod modification to be applied to user matching the provided userId
      * @return Updated user.
      */
-    @PUT
+    @POST
     @Path("{userId}")
     @Descriptions({
         @Description(target = DocTarget.METHOD, value = "Updates user matching the provided
userId"),

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java?rev=1535657&r1=1535656&r2=1535657&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/RoleServiceImpl.java
Fri Oct 25 08:40:09 2013
@@ -110,6 +110,7 @@ public class RoleServiceImpl extends Abs
 
     @Override
     public RoleTO update(final Long roleId, final RoleMod roleMod) {
+        roleMod.setId(roleId);
         return controller.update(roleMod);
     }
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java?rev=1535657&r1=1535656&r2=1535657&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java
(original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/UserServiceImpl.java
Fri Oct 25 08:40:09 2013
@@ -165,6 +165,7 @@ public class UserServiceImpl extends Abs
 
     @Override
     public UserTO update(final Long userId, final UserMod userMod) {
+        userMod.setId(userId);
         return controller.update(userMod);
     }
 

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=1535657&r1=1535656&r2=1535657&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 Fri
Oct 25 08:40:09 2013
@@ -142,8 +142,7 @@ public class UserTestITCase extends Abst
 
     @Test
     public void selfRead() {
-        UserService userService2 =
-                clientFactory.create("rossini", ADMIN_PWD).getService(UserService.class);
+        UserService userService2 = clientFactory.create("rossini", ADMIN_PWD).getService(UserService.class);
 
         try {
             userService2.read(1L);
@@ -207,8 +206,8 @@ public class UserTestITCase extends Abst
         } finally {
             for (PasswordPolicyTO policyTO : policies) {
                 Response response = policyService.create(policyTO);
-                PasswordPolicyTO cPolicyTO =
-                        adminClient.getObject(response.getLocation(), PolicyService.class,
PasswordPolicyTO.class);
+                PasswordPolicyTO cPolicyTO = adminClient.getObject(
+                        response.getLocation(), PolicyService.class, PasswordPolicyTO.class);
                 assertNotNull(cPolicyTO);
             }
         }
@@ -470,8 +469,8 @@ public class UserTestITCase extends Abst
         assertEquals(maxTaskExecutions, taskTO.getExecutions().size());
 
         // 3. verify password
-        UserService userService1 =
-                clientFactory.create(newUserTO.getUsername(), "password123").getService(UserService.class);
+        UserService userService1 = clientFactory.create(
+                newUserTO.getUsername(), "password123").getService(UserService.class);
         try {
             UserTO user = userService1.readSelf();
             assertNotNull(user);
@@ -479,8 +478,8 @@ public class UserTestITCase extends Abst
             fail("Credentials should be valid and not cause AccessControlException");
         }
 
-        UserService userService2 =
-                clientFactory.create(newUserTO.getUsername(), "passwordXX").getService(UserService.class);
+        UserService userService2 = clientFactory.create(
+                newUserTO.getUsername(), "passwordXX").getService(UserService.class);
         try {
             userService2.readSelf();
             fail("Credentials are invalid, thus request should raise AccessControlException");
@@ -577,8 +576,8 @@ public class UserTestITCase extends Abst
         assertNull(form.getOwner());
 
         // 3. claim task from rossini, not in role 7 (designated for approval in workflow
definition): fail
-        UserWorkflowService userService2 =
-                clientFactory.create("rossini", ADMIN_PWD).getService(UserWorkflowService.class);
+        UserWorkflowService userService2 = clientFactory.create(
+                "rossini", ADMIN_PWD).getService(UserWorkflowService.class);
 
         try {
             userService2.claimForm(form.getTaskId());
@@ -588,8 +587,8 @@ public class UserTestITCase extends Abst
         }
 
         // 4. claim task from bellini, in role 7
-        UserWorkflowService userService3 =
-                clientFactory.create("bellini", ADMIN_PWD).getService(UserWorkflowService.class);
+        UserWorkflowService userService3 = clientFactory.create(
+                "bellini", ADMIN_PWD).getService(UserWorkflowService.class);
 
         form = userService3.claimForm(form.getTaskId());
         assertNotNull(form);
@@ -610,7 +609,7 @@ public class UserTestITCase extends Abst
         Exception exception = null;
         try {
             jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?",
-                    new String[] {userTO.getUsername()}, Integer.class);
+                    new String[] { userTO.getUsername() }, Integer.class);
         } catch (EmptyResultDataAccessException e) {
             exception = e;
         }
@@ -644,7 +643,7 @@ public class UserTestITCase extends Abst
         Exception exception = null;
         try {
             jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?",
-                    new String[] {userTO.getUsername()}, Integer.class);
+                    new String[] { userTO.getUsername() }, Integer.class);
         } catch (EmptyResultDataAccessException e) {
             exception = e;
         }
@@ -968,7 +967,6 @@ public class UserTestITCase extends Abst
         // --------------------------------------
         // Create operation
         // --------------------------------------
-
         UserTO userTO = getUniqueSampleTO("t@p.mode");
 
         // add a membership
@@ -1857,16 +1855,16 @@ public class UserTestITCase extends Abst
 
         final String pwdOnSyncope = userTO.getPassword();
 
-        ConnObjectTO userOnDb =
-                resourceService.getConnectorObject(RESOURCE_NAME_TESTDB, AttributableType.USER,
userTO.getId());
+        ConnObjectTO userOnDb = resourceService.getConnectorObject(
+                RESOURCE_NAME_TESTDB, AttributableType.USER, userTO.getId());
         final AttributeTO pwdOnTestDbAttr = userOnDb.getAttrMap().get(OperationalAttributes.PASSWORD_NAME);
         assertNotNull(pwdOnTestDbAttr);
         assertNotNull(pwdOnTestDbAttr.getValues());
         assertFalse(pwdOnTestDbAttr.getValues().isEmpty());
         final String pwdOnTestDb = pwdOnTestDbAttr.getValues().iterator().next();
 
-        ConnObjectTO userOnDb2 =
-                resourceService.getConnectorObject("resource-testdb2", AttributableType.USER,
userTO.getId());
+        ConnObjectTO userOnDb2 = resourceService.getConnectorObject(
+                "resource-testdb2", AttributableType.USER, userTO.getId());
         final AttributeTO pwdOnTestDb2Attr = userOnDb2.getAttrMap().get(OperationalAttributes.PASSWORD_NAME);
         assertNotNull(pwdOnTestDb2Attr);
         assertNotNull(pwdOnTestDb2Attr.getValues());
@@ -2140,8 +2138,8 @@ public class UserTestITCase extends Abst
         assertTrue(userTO.getResources().contains(RESOURCE_NAME_LDAP));
 
         // 3. read role on resource, check that user DN is included in uniqueMember
-        ConnObjectTO connObj =
-                resourceService.getConnectorObject(RESOURCE_NAME_LDAP, AttributableType.ROLE,
roleTO.getId());
+        ConnObjectTO connObj = resourceService.getConnectorObject(
+                RESOURCE_NAME_LDAP, AttributableType.ROLE, roleTO.getId());
         assertNotNull(connObj);
         assertTrue(connObj.getAttrMap().get("uniqueMember").getValues().
                 contains("uid=" + userTO.getUsername() + ",ou=people,o=isp"));
@@ -2190,8 +2188,8 @@ public class UserTestITCase extends Abst
         assertTrue(userTO.getResources().contains(RESOURCE_NAME_LDAP));
 
         // 3. read user on resource
-        ConnObjectTO connObj =
-                resourceService.getConnectorObject(RESOURCE_NAME_LDAP, AttributableType.USER,
userTO.getId());
+        ConnObjectTO connObj = resourceService.getConnectorObject(
+                RESOURCE_NAME_LDAP, AttributableType.USER, userTO.getId());
         assertNotNull(connObj);
 
         // 4. remove role
@@ -2376,8 +2374,8 @@ public class UserTestITCase extends Abst
         assertNotNull(form);
 
         // 3. first claim ny bellini ....
-        UserWorkflowService userService3 =
-                clientFactory.create("bellini", ADMIN_PWD).getService(UserWorkflowService.class);
+        UserWorkflowService userService3 = clientFactory.create(
+                "bellini", ADMIN_PWD).getService(UserWorkflowService.class);
 
         form = userService3.claimForm(form.getTaskId());
         assertNotNull(form);
@@ -2552,4 +2550,17 @@ public class UserTestITCase extends Abst
         userTO = userService.update(userMod.getId(), userMod);
         assertEquals("14", userTO.getAttrMap().get("makeItDouble").getValues().get(0));
     }
+
+    @Test
+    public void issueSYNCOPE426() {
+        UserTO userTO = getUniqueSampleTO("syncope426@syncope.apache.org");
+        userTO = createUser(userTO);
+        assertNotNull(userTO);
+
+        UserMod userMod = new UserMod();
+        userMod.setPassword("anotherPassword123");
+        userTO = userService.update(userTO.getId(), userMod);
+        assertNotNull(userTO);
+    }
+
 }



Mime
View raw message