// update user virtual attribute and check virtual attribute value update propagation
// ----------------------------------
UserMod userMod = new UserMod();
userMod.setId(userTO.getId());
AttributeMod attrMod = new AttributeMod();
attrMod.setSchema("virtualdata");
attrMod.getValuesToBeRemoved().add("virtualvalue");
attrMod.getValuesToBeAdded().add("virtualvalue2");
userMod.getVirAttrsToUpdate().add(attrMod);
userTO = updateUser(userMod);
assertNotNull(userTO);
assertFalse(userTO.getPropagationStatusTOs().isEmpty());
assertEquals("ws-target-resource-2", userTO.getPropagationStatusTOs().get(0).getResource());
assertEquals(PropagationTaskExecStatus.SUBMITTED, userTO.getPropagationStatusTOs().get(0).getStatus());
connObjectTO = resourceService.getConnectorObject(RESOURCE_NAME_WS2, SubjectType.USER, userTO.getId());
assertNotNull(connObjectTO);
assertEquals("virtualvalue2", connObjectTO.getAttrMap().get("NAME").getValues().get(0));
// ----------------------------------
// ----------------------------------
// suspend/reactivate user and check virtual attribute value (unchanged)
// ----------------------------------
StatusMod statusMod = new StatusMod();
statusMod.setType(StatusMod.ModType.SUSPEND);
userTO = userService.status(userTO.getId(), statusMod).readEntity(UserTO.class);
assertEquals("suspended", userTO.getStatus());
connObjectTO = resourceService.getConnectorObject(RESOURCE_NAME_WS2, SubjectType.USER, userTO.getId());
assertNotNull(connObjectTO);
assertFalse(connObjectTO.getAttrMap().get("NAME").getValues().isEmpty());
assertEquals("virtualvalue2", connObjectTO.getAttrMap().get("NAME").getValues().get(0));
statusMod = new StatusMod();
statusMod.setType(StatusMod.ModType.REACTIVATE);
userTO = userService.status(userTO.getId(), statusMod).readEntity(UserTO.class);
assertEquals("active", userTO.getStatus());
connObjectTO = resourceService.getConnectorObject(RESOURCE_NAME_WS2, SubjectType.USER, userTO.getId());
assertNotNull(connObjectTO);
assertFalse(connObjectTO.getAttrMap().get("NAME").getValues().isEmpty());
assertEquals("virtualvalue2", connObjectTO.getAttrMap().get("NAME").getValues().get(0));
// ----------------------------------
// ----------------------------------
// update user attribute and check virtual attribute value (unchanged)
// ----------------------------------
userMod = new UserMod();
userMod.setId(userTO.getId());
attrMod = new AttributeMod();
attrMod.setSchema("surname");
attrMod.getValuesToBeRemoved().add("Surname");
attrMod.getValuesToBeAdded().add("Surname2");
userMod.getAttrsToUpdate().add(attrMod);
userTO = updateUser(userMod);
assertNotNull(userTO);