//-----------------------------
UserTO userTO = new UserTO();
userTO.setPassword("password123");
userTO.setUsername("test9");
AttributeTO firstnameTO = new AttributeTO();
firstnameTO.setSchema("firstname");
firstnameTO.addValue("nome9");
userTO.addAttribute(firstnameTO);
AttributeTO surnameTO = new AttributeTO();
surnameTO.setSchema("surname");
surnameTO.addValue("cognome");
userTO.addAttribute(surnameTO);
AttributeTO typeTO = new AttributeTO();
typeTO.setSchema("type");
typeTO.addValue("a type");
userTO.addAttribute(typeTO);
AttributeTO fullnameTO = new AttributeTO();
fullnameTO.setSchema("fullname");
fullnameTO.addValue("nome cognome");
userTO.addAttribute(fullnameTO);
AttributeTO userIdTO = new AttributeTO();
userIdTO.setSchema("userId");
userIdTO.addValue("user5@syncope.apache.org");
userTO.addAttribute(userIdTO);
AttributeTO emailTO = new AttributeTO();
emailTO.setSchema("email");
emailTO.addValue("user5@syncope.apache.org");
userTO.addAttribute(emailTO);
// add a derived attribute (accountId for csvdir)
AttributeTO csvuseridTO = new AttributeTO();
csvuseridTO.setSchema("csvuserid");
userTO.addDerivedAttribute(csvuseridTO);
userTO = restTemplate.postForObject(BASE_URL + "user/create", userTO, UserTO.class);
assertNotNull(userTO);
//-----------------------------
Integer usersPre = restTemplate.getForObject(BASE_URL + "user/count.json", Integer.class);
assertNotNull(usersPre);
// Update sync task
SyncTaskTO task = restTemplate.getForObject(BASE_URL + "task/read/{taskId}", SyncTaskTO.class, 4);
assertNotNull(task);
// add custom SyncJob actions
task.setJobActionsClassName(TestSyncJobActions.class.getName());
// add user template
UserTO template = new UserTO();
AttributeTO attrTO = new AttributeTO();
attrTO.setSchema("type");
attrTO.addValue("email == 'test8@syncope.apache.org'? 'TYPE_8': 'TYPE_OTHER'");
template.addAttribute(attrTO);
attrTO = new AttributeTO();
attrTO.setSchema("cn");
template.addDerivedAttribute(attrTO);
template.addResource("resource-testdb");
MembershipTO membershipTO = new MembershipTO();
membershipTO.setRoleId(8L);
AttributeTO membershipAttr = new AttributeTO();
membershipAttr.setSchema("subscriptionDate");
membershipAttr.addValue("'2009-08-18T16:33:12.203+0200'");
membershipTO.addAttribute(membershipAttr);
template.addMembership(membershipTO);
task.setUserTemplate(template);