On 14/04/2012 16:42, Francesco Chicchiriccò wrote:
> On 13/04/2012 14:23, ernst Developer wrote:
>> Yes you are right, but I copied from different methods, to make it
>> clear, and did do that good enough.
>> How does this look?
>>
>>
>> So the correct flow is:
>>
>>>             UserMod userMod = new UserMod();
>>>             userMod.setId(userId);
>>>             Set<AttributeMod> attributesToBeUpdated = new
>>>     HashSet<AttributeMod>();
>>>             AttributeMod ourProperty = new AttributeMod();
>>>             ourProperty.setSchema(ourPropertyName);
>>>             ourProperty.setValuesToBeAdded(Arrays.asList(new
>>>     String[]{isoDateTime}));
>>>             attributesToBeUpdated.add(ourProperty);
>>>             userMod.setAttributesToBeUpdated(attributesToBeUpdated);
>>>             UserTO modifiedUser =
>>>     restTemplate.postForObject(url, userMod, UserTO.class);
>>
>
> Ernst,
> this looks very strange: I cannot think of a "general" reason why this
> password gets modified.
>
> To be sure, I've added the following test case to UserTestITCase.java
> in Syncope core sources, and this run smoothly:

Updated code - first version edited with vi on a remote machine, a
didn't notice some omissions:

    @Test
    public void updateWithoutPassword() {
        UserTO userTO =
getSampleTO("[email protected]");

        userTO = restTemplate.postForObject(BASE_URL + "user/create",
userTO, UserTO.class);
        assertNotNull(userTO);
        String encodedPwd = userTO.getPassword();

        AttributeMod attributeMod = new AttributeMod();
        attributeMod.setSchema("subscriptionDate");
        attributeMod.addValueToBeAdded("2010-08-18T16:33:12.203+0200");

        UserMod userMod = new UserMod();
        userMod.setId(userTO.getId());
        userMod.addAttributeToBeUpdated(attributeMod);

        userTO = restTemplate.postForObject(BASE_URL + "user/update",
userMod, UserTO.class);
        assertNotNull(userTO);
        assertEquals(encodedPwd, userTO.getPassword());
    }


> I'd suggest to check if there is something in your own setup (maybe
> bound with sync / provisioning) or even if some URL / parameter are
> not correct.

Regards.

-- 
Francesco Chicchiriccò

Apache Cocoon PMC and Apache Syncope PPMC Member
http://people.apache.org/~ilgrosso/

Reply via email to