assertNotNull(userTO);
assertTrue(userTO.getResources().isEmpty());
// 2. update assigning a resource forcing mandatory constraints: must
// fail with RequiredValuesMissing
UserMod userMod = new UserMod();
userMod.setId(userTO.getId());
userMod.setPassword("newPassword");
userMod.addResourceToBeAdded("ws-target-resource-2");
SyncopeClientException sce = null;
try {
userTO = restTemplate.postForObject(BASE_URL + "user/update", userMod, UserTO.class);
} catch (SyncopeClientCompositeErrorException scce) {
sce = scce.getException(SyncopeClientExceptionType.RequiredValuesMissing);
}
assertNotNull(sce);
// 3. update assigning a resource NOT forcing mandatory constraints
// AND primary: must fail with PropagationException
userMod = new UserMod();
userMod.setId(userTO.getId());
userMod.setPassword("newPassword");
userMod.addResourceToBeAdded("ws-target-resource-1");
sce = null;
try {
userTO = restTemplate.postForObject(BASE_URL + "user/update", userMod, UserTO.class);
} catch (SyncopeClientCompositeErrorException scce) {
sce = scce.getException(SyncopeClientExceptionType.Propagation);
}
assertNotNull(sce);
// 4. update assigning a resource NOT forcing mandatory constraints
// BUT not primary: must succeed
userMod = new UserMod();
userMod.setId(userTO.getId());
userMod.setPassword("newPassword");
userMod.addResourceToBeAdded("resource-db");
sce = null;
try {
userTO = restTemplate.postForObject(BASE_URL + "user/update", userMod, UserTO.class);
} catch (SyncopeClientCompositeErrorException scce) {