use of org.gluu.oxtrust.model.scim.ScimPerson in project oxTrust by GluuFederation.
the class BulkWebService method bulkOperation.
@POST
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response bulkOperation(@Context HttpServletRequest request, @HeaderParam("Authorization") String authorization, ScimBulkOperation operation) throws Exception {
Response authorizationResponse = processAuthorization(authorization);
if (authorizationResponse != null) {
return authorizationResponse;
}
String domain;
URL reconstructedURL;
reconstructedURL = new URL(request.getScheme(), request.getServerName(), request.getServerPort(), "");
domain = reconstructedURL.toString();
log.info(" getting list of BulkRequest ");
List<BulkRequests> bulkRequests = operation.getOperations();
ScimBulkResponse scimBulkResponse = new ScimBulkResponse();
List<BulkResponses> listResponses = new ArrayList<BulkResponses>();
for (BulkRequests oneRequest : bulkRequests) {
log.info(" checking operations ");
if (oneRequest.getPath().contains("Users")) {
log.info(" operations is for Users ");
log.info(" method : " + oneRequest.getMethod());
if (oneRequest.getMethod().equalsIgnoreCase("POST")) {
log.info(" method is post ");
String bulkId = oneRequest.getBulkId();
String method = oneRequest.getMethod();
ScimPerson person = oneRequest.getData();
boolean status = createUser(person);
if (status) {
log.info(" POST status is true ");
BulkResponses bulkResponses = new BulkResponses();
bulkResponses.setBulkId(bulkId);
bulkResponses.setMethod(method);
GluuCustomPerson gluuPerson = personService.getPersonByUid(person.getUserName());
String iD = gluuPerson.getInum();
String location = (new StringBuilder()).append(domain).append("/oxTrust/seam/resource/restv1/Users/").append(iD).toString();
bulkResponses.setLocation(location);
BulkResponseStatus result = new BulkResponseStatus();
result.setCode("201");
bulkResponses.setStatus(result);
listResponses.add(bulkResponses);
} else if (!status) {
log.info(" POST status is false ");
BulkResponses bulkResponses = new BulkResponses();
bulkResponses.setBulkId(bulkId);
bulkResponses.setMethod(method);
BulkResponseStatus result = new BulkResponseStatus();
result.setCode("400");
result.setDescription("Request is unparseable, syntactically incorrect, or violates schema.");
bulkResponses.setStatus(result);
listResponses.add(bulkResponses);
}
} else if (oneRequest.getMethod().equalsIgnoreCase("PUT")) {
log.info(" Status is PUT ");
String method = oneRequest.getMethod();
String version = oneRequest.getVersion();
String path = oneRequest.getPath();
ScimPerson person = oneRequest.getData();
String personiD = getId(path);
log.info(" Inum : " + getId(path));
boolean status = updateUser(personiD, person);
if (status) {
log.info(" PUT status is true ");
BulkResponses bulkResponses = new BulkResponses();
bulkResponses.setMethod(method);
String iD = personiD;
String location = (new StringBuilder()).append(domain).append("/oxTrust/seam/resource/restv1/Users/").append(iD).toString();
bulkResponses.setLocation(location);
EntityTag eTag = new EntityTag(version, true);
String newVersion = eTag.getValue();
bulkResponses.setVersion(newVersion);
BulkResponseStatus result = new BulkResponseStatus();
result.setCode("200");
bulkResponses.setStatus(result);
listResponses.add(bulkResponses);
} else if (!status) {
log.info(" PUT status is false ");
BulkResponses bulkResponses = new BulkResponses();
bulkResponses.setMethod(method);
bulkResponses.setVersion(version);
BulkResponseStatus result = new BulkResponseStatus();
result.setCode("400");
result.setDescription("Request is unparseable, syntactically incorrect, or violates schema.");
bulkResponses.setStatus(result);
listResponses.add(bulkResponses);
}
} else if (oneRequest.getMethod().equalsIgnoreCase("DELETE")) {
log.info(" Operation is DELETE ");
String method = oneRequest.getMethod();
String path = oneRequest.getPath();
String personiD = getId(path);
boolean status = deleteUser(personiD);
if (status) {
log.info(" DELETE operation is true ");
BulkResponses bulkResponses = new BulkResponses();
bulkResponses.setMethod(method);
String location = (new StringBuilder()).append(domain).append("/oxTrust/seam/resource/restv1/Users/").append(personiD).toString();
bulkResponses.setLocation(location);
BulkResponseStatus result = new BulkResponseStatus();
result.setCode("200");
bulkResponses.setStatus(result);
listResponses.add(bulkResponses);
} else if (!status) {
log.info(" DELETE operation is False ");
BulkResponses bulkResponses = new BulkResponses();
bulkResponses.setMethod(method);
BulkResponseStatus result = new BulkResponseStatus();
result.setCode("400");
result.setDescription("Request is unparseable, syntactically incorrect, or violates schema.");
bulkResponses.setStatus(result);
listResponses.add(bulkResponses);
}
}
//
} else if (oneRequest.getPath().contains("Groups")) {
if (oneRequest.getMethod().equalsIgnoreCase("POST")) {
log.info(" method is post ");
String bulkId = oneRequest.getBulkId();
String method = oneRequest.getMethod();
ScimGroup group = copyUtils.copy(oneRequest.getData(), null);
boolean status = createGroup(group);
if (status) {
log.info(" POST status is true ");
BulkResponses bulkResponses = new BulkResponses();
bulkResponses.setBulkId(bulkId);
bulkResponses.setMethod(method);
GluuGroup gluuGroup = groupService.getGroupByDisplayName(group.getDisplayName());
String iD = gluuGroup.getInum();
String location = (new StringBuilder()).append(domain).append("/oxTrust/seam/resource/restv1/Groups/").append(iD).toString();
bulkResponses.setLocation(location);
BulkResponseStatus result = new BulkResponseStatus();
result.setCode("201");
bulkResponses.setStatus(result);
listResponses.add(bulkResponses);
} else if (!status) {
log.info(" POST status is false ");
BulkResponses bulkResponses = new BulkResponses();
bulkResponses.setBulkId(bulkId);
bulkResponses.setMethod(method);
BulkResponseStatus result = new BulkResponseStatus();
result.setCode("400");
result.setDescription("Request is unparseable, syntactically incorrect, or violates schema.");
bulkResponses.setStatus(result);
listResponses.add(bulkResponses);
}
} else if (oneRequest.getMethod().equalsIgnoreCase("PUT")) {
log.info(" Status is PUT ");
String method = oneRequest.getMethod();
String version = oneRequest.getVersion();
String path = oneRequest.getPath();
ScimGroup group = copyUtils.copy(oneRequest.getData(), null);
String groupiD = getId(path);
boolean status = updateGroup(groupiD, group);
if (status) {
log.info(" PUT status is true ");
BulkResponses bulkResponses = new BulkResponses();
bulkResponses.setMethod(method);
String iD = groupiD;
String location = (new StringBuilder()).append(domain).append("/oxTrust/seam/resource/restv1/Groups/").append(iD).toString();
bulkResponses.setLocation(location);
EntityTag eTag = new EntityTag(version, true);
String newVersion = eTag.getValue();
bulkResponses.setVersion(newVersion);
BulkResponseStatus result = new BulkResponseStatus();
result.setCode("200");
bulkResponses.setStatus(result);
listResponses.add(bulkResponses);
} else if (!status) {
log.info(" PUT status is false ");
BulkResponses bulkResponses = new BulkResponses();
bulkResponses.setMethod(method);
bulkResponses.setVersion(version);
BulkResponseStatus result = new BulkResponseStatus();
result.setCode("400");
result.setDescription("Request is unparseable, syntactically incorrect, or violates schema.");
bulkResponses.setStatus(result);
listResponses.add(bulkResponses);
}
} else if (oneRequest.getMethod().equalsIgnoreCase("DELETE")) {
log.info(" Operation is DELETE ");
String method = oneRequest.getMethod();
String path = oneRequest.getPath();
String groupiD = getId(path);
boolean status = deleteGroup(groupiD);
if (status) {
log.info(" DELETE operation is true ");
BulkResponses bulkResponses = new BulkResponses();
bulkResponses.setMethod(method);
String location = (new StringBuilder()).append(domain).append("/oxTrust/seam/resource/restv1/Groups/").append(groupiD).toString();
bulkResponses.setLocation(location);
BulkResponseStatus result = new BulkResponseStatus();
result.setCode("200");
bulkResponses.setStatus(result);
listResponses.add(bulkResponses);
} else if (!status) {
log.info(" DELETE operation is False ");
BulkResponses bulkResponses = new BulkResponses();
bulkResponses.setMethod(method);
BulkResponseStatus result = new BulkResponseStatus();
result.setCode("400");
result.setDescription("Request is unparseable, syntactically incorrect, or violates schema.");
bulkResponses.setStatus(result);
listResponses.add(bulkResponses);
}
}
}
}
List<String> schemas = new ArrayList<String>();
schemas.add(Constants.SCIM1_CORE_SCHEMA_ID);
scimBulkResponse.setSchemas(schemas);
scimBulkResponse.setOperations(listResponses);
URI location = new URI("/Bulk/");
return Response.ok(scimBulkResponse).location(location).build();
}
use of org.gluu.oxtrust.model.scim.ScimPerson in project oxTrust by GluuFederation.
the class OxChooserWebService method addUser.
@Path("/AddUser")
@POST
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response addUser(@HeaderParam("Authorization") String authorization, ScimPerson person) throws Exception {
Response authorizationResponse = processAuthorization(authorization);
if (authorizationResponse != null) {
return authorizationResponse;
}
// Return HTTP response with status code 201 Created
log.debug(" copying gluuperson ");
GluuCustomPerson gluuPerson = copyUtils.copy(person, null, false);
if (gluuPerson == null) {
return getErrorResponse("Failed to create user", Response.Status.BAD_REQUEST.getStatusCode());
}
try {
log.debug(" generating inum ");
String inum = personService.generateInumForNewPerson();
log.debug(" getting DN ");
String dn = personService.getDnForPerson(inum);
log.debug(" getting iname ");
String iname = personService.generateInameForNewPerson(person.getUserName());
log.debug(" setting dn ");
gluuPerson.setDn(dn);
log.debug(" setting inum ");
gluuPerson.setInum(inum);
log.debug(" setting iname ");
gluuPerson.setIname(iname);
log.debug(" setting commonName ");
gluuPerson.setCommonName(gluuPerson.getGivenName() + " " + gluuPerson.getSurname());
log.info("gluuPerson.getMemberOf().size() : " + gluuPerson.getMemberOf().size());
if (person.getGroups().size() > 0) {
log.info(" jumping to groupMembersAdder ");
log.info("gluuPerson.getDn() : " + gluuPerson.getDn());
serviceUtil.groupMembersAdder(gluuPerson, gluuPerson.getDn());
}
log.debug("adding new GluuPerson");
personService.addPerson(gluuPerson);
final ScimPerson newPerson = copyUtils.copy(gluuPerson, null);
String uri = "/oxChooser/AddUser/" + newPerson.getId();
return Response.created(URI.create(uri)).entity(newPerson).build();
} catch (Exception ex) {
log.error("Failed to add user", ex);
return getErrorResponse(INTERNAL_SERVER_ERROR_MESSAGE, Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
}
}
use of org.gluu.oxtrust.model.scim.ScimPerson in project oxTrust by GluuFederation.
the class OxChooserWebService method editUser.
@Path("/EditUser/{email}")
@GET
@POST
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response editUser(@HeaderParam("Authorization") String authorization, @PathParam("email") String email, ScimPerson person_update) throws Exception {
Response authorizationResponse = processAuthorization(authorization);
if (authorizationResponse != null) {
return authorizationResponse;
}
try {
GluuCustomPerson gluuPerson = personService.getPersonByEmail(email);
if (gluuPerson == null) {
return getErrorResponse("Resource " + email + " not found", Response.Status.NOT_FOUND.getStatusCode());
}
GluuCustomPerson newGluuPesron = copyUtils.copy(person_update, gluuPerson, true);
if (person_update.getGroups().size() > 0) {
serviceUtil.groupMembersAdder(newGluuPesron, personService.getDnForPerson(gluuPerson.getUid()));
}
personService.updatePerson(newGluuPesron);
log.debug(" person updated ");
ScimPerson newPerson = copyUtils.copy(newGluuPesron, null);
URI location = new URI("/oxChooser/AddUser/" + gluuPerson.getUid());
return Response.ok(newPerson).location(location).build();
} catch (EntryPersistenceException ex) {
return getErrorResponse("Resource " + email + " not found", Response.Status.NOT_FOUND.getStatusCode());
} catch (Exception ex) {
log.error("Exception: ", ex);
ex.printStackTrace();
return getErrorResponse(INTERNAL_SERVER_ERROR_MESSAGE, Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
}
}
use of org.gluu.oxtrust.model.scim.ScimPerson in project oxTrust by GluuFederation.
the class CopyUtilsTestCreate method testCopyScim1CreateException.
@Test
public void testCopyScim1CreateException() throws Exception {
GluuCustomPerson destination = null;
ScimPerson source = new ScimPerson();
source.setActive("true");
ScimPersonAddresses address = new ScimPersonAddresses();
address.setCountry("country");
address.setFormatted("formatted");
address.setLocality("locality");
address.setPostalCode("postalCode");
address.setPrimary("address_primary");
address.setRegion("region");
address.setStreetAddress("streetAddress");
address.setType("address_type");
List<ScimPersonAddresses> addresses = new ArrayList<ScimPersonAddresses>();
addresses.add(address);
source.setAddresses(addresses);
List<ScimCustomAttributes> customAttributes = new ArrayList<ScimCustomAttributes>();
ScimCustomAttributes customattribute = new ScimCustomAttributes();
customattribute.setName("custom_name");
List<String> values = new ArrayList<String>();
String value = "value";
values.add(value);
customattribute.setValues(values);
customAttributes.add(customattribute);
source.setCustomAttributes(customAttributes);
source.setDisplayName("displayName");
ScimPersonEmails email = new ScimPersonEmails();
email.setPrimary("email_primary");
email.setType("email_type");
email.setValue("email_value");
List<ScimPersonEmails> emails = new ArrayList<ScimPersonEmails>();
emails.add(email);
source.setEmails(emails);
ScimEntitlements entitlement = new ScimEntitlements();
entitlement.setValue("entitlement_value");
List<ScimEntitlements> entitlements = new ArrayList<ScimEntitlements>();
entitlements.add(entitlement);
source.setEntitlements(entitlements);
source.setExternalId("externalId");
ScimPersonGroups group = new ScimPersonGroups();
group.setDisplay("group_display");
group.setValue("group_value");
List<ScimPersonGroups> groups = new ArrayList<ScimPersonGroups>();
groups.add(group);
source.setGroups(groups);
source.setId("id");
ScimPersonIms personims = new ScimPersonIms();
personims.setType("ims_type");
personims.setValue("ims_value");
List<ScimPersonIms> ims = new ArrayList<ScimPersonIms>();
ims.add(personims);
source.setIms(ims);
source.setLocale("locale");
PersonMeta meta = new PersonMeta();
meta.setCreated("created");
meta.setLastModified("lastModified");
meta.setLocation("location");
meta.setVersion("version");
source.setMeta(meta);
ScimName name = new ScimName();
name.setFamilyName("familyName");
name.setGivenName("givenName");
name.setHonorificPrefix("honorificPrefix");
name.setHonorificSuffix("honorificSuffix");
name.setMiddleName("middleName");
source.setName(name);
source.setNickName("nickName");
source.setPassword("password");
ScimPersonPhones phonenumber = new ScimPersonPhones();
phonenumber.setType("phone_type");
phonenumber.setValue("phone_value");
List<ScimPersonPhones> phoneNumbers = new ArrayList<ScimPersonPhones>();
phoneNumbers.add(phonenumber);
source.setPhoneNumbers(phoneNumbers);
ScimPersonPhotos photo = new ScimPersonPhotos();
photo.setType("photo_type");
photo.setValue("photo_value");
List<ScimPersonPhotos> photos = new ArrayList<ScimPersonPhotos>();
photos.add(photo);
source.setPhotos(photos);
source.setPreferredLanguage("preferredLanguage");
source.setProfileUrl("profileUrl");
ScimRoles role = new ScimRoles();
role.setValue("role_value");
List<ScimRoles> roles = new ArrayList<ScimRoles>();
roles.add(role);
source.setRoles(roles);
List<String> schemas = new ArrayList<String>();
schemas.add("shema");
source.setSchemas(schemas);
source.setTimezone("timezone");
source.setTitle("title");
source.setUserName("exception");
source.setUserType("userType");
Scimx509Certificates cert = new Scimx509Certificates();
cert.setValue("cert_value");
List<Scimx509Certificates> x509Certificates = new ArrayList<Scimx509Certificates>();
x509Certificates.add(cert);
source.setX509Certificates(x509Certificates);
GluuCustomPerson copy = copyUtils.copy(source, destination, false);
assertNull(copy);
}
use of org.gluu.oxtrust.model.scim.ScimPerson in project oxTrust by GluuFederation.
the class CopyUtilsTestCreate method testCopyScim1FilledCreate.
@Test
public void testCopyScim1FilledCreate() throws Exception {
GluuCustomPerson destination = new GluuCustomPerson();
ScimPerson source = new ScimPerson();
source.setActive("true");
ScimPersonAddresses address = new ScimPersonAddresses();
address.setCountry("country");
address.setFormatted("formatted");
address.setLocality("locality");
address.setPostalCode("postalCode");
address.setPrimary("address_primary");
address.setRegion("region");
address.setStreetAddress("streetAddress");
address.setType("address_type");
List<ScimPersonAddresses> addresses = new ArrayList<ScimPersonAddresses>();
addresses.add(address);
source.setAddresses(addresses);
List<ScimCustomAttributes> customAttributes = new ArrayList<ScimCustomAttributes>();
ScimCustomAttributes customattribute = new ScimCustomAttributes();
customattribute.setName("custom_name");
List<String> values = new ArrayList<String>();
String value = "value";
values.add(value);
customattribute.setValues(values);
customAttributes.add(customattribute);
source.setCustomAttributes(customAttributes);
source.setDisplayName("displayName");
ScimPersonEmails email = new ScimPersonEmails();
email.setPrimary("email_primary");
email.setType("email_type");
email.setValue("email_value");
List<ScimPersonEmails> emails = new ArrayList<ScimPersonEmails>();
emails.add(email);
source.setEmails(emails);
ScimEntitlements entitlement = new ScimEntitlements();
entitlement.setValue("entitlement_value");
List<ScimEntitlements> entitlements = new ArrayList<ScimEntitlements>();
entitlements.add(entitlement);
source.setEntitlements(entitlements);
source.setExternalId("externalId");
ScimPersonGroups group = new ScimPersonGroups();
group.setDisplay("group_display");
group.setValue("group_value");
List<ScimPersonGroups> groups = new ArrayList<ScimPersonGroups>();
groups.add(group);
source.setGroups(groups);
source.setId("id");
ScimPersonIms personims = new ScimPersonIms();
personims.setType("ims_type");
personims.setValue("ims_value");
List<ScimPersonIms> ims = new ArrayList<ScimPersonIms>();
ims.add(personims);
source.setIms(ims);
source.setLocale("locale");
PersonMeta meta = new PersonMeta();
meta.setCreated("created");
meta.setLastModified("lastModified");
meta.setLocation("location");
meta.setVersion("version");
source.setMeta(meta);
ScimName name = new ScimName();
name.setFamilyName("familyName");
name.setGivenName("givenName");
name.setHonorificPrefix("honorificPrefix");
name.setHonorificSuffix("honorificSuffix");
name.setMiddleName("middleName");
source.setName(name);
source.setNickName("nickName");
source.setPassword("password");
ScimPersonPhones phonenumber = new ScimPersonPhones();
phonenumber.setType("phone_type");
phonenumber.setValue("phone_value");
List<ScimPersonPhones> phoneNumbers = new ArrayList<ScimPersonPhones>();
phoneNumbers.add(phonenumber);
source.setPhoneNumbers(phoneNumbers);
ScimPersonPhotos photo = new ScimPersonPhotos();
photo.setType("photo_type");
photo.setValue("photo_value");
List<ScimPersonPhotos> photos = new ArrayList<ScimPersonPhotos>();
photos.add(photo);
source.setPhotos(photos);
source.setPreferredLanguage("preferredLanguage");
source.setProfileUrl("profileUrl");
ScimRoles role = new ScimRoles();
role.setValue("role_value");
List<ScimRoles> roles = new ArrayList<ScimRoles>();
roles.add(role);
source.setRoles(roles);
List<String> schemas = new ArrayList<String>();
schemas.add("shema");
source.setSchemas(schemas);
source.setTimezone("timezone");
source.setTitle("title");
source.setUserName("userName");
source.setUserType("userType");
Scimx509Certificates cert = new Scimx509Certificates();
cert.setValue("cert_value");
List<Scimx509Certificates> x509Certificates = new ArrayList<Scimx509Certificates>();
x509Certificates.add(cert);
source.setX509Certificates(x509Certificates);
GluuCustomPerson copy = copyUtils.copy(source, destination, false);
assertNotNull(copy);
assertEquals(copy.getUid(), "userName");
assertEquals(copy.getGivenName(), "givenName");
assertEquals(copy.getSurname(), "familyName");
assertEquals(copy.getDisplayName(), "displayName");
assertEquals(copy.getPreferredLanguage(), "preferredLanguage");
assertEquals(copy.getTimezone(), "timezone");
assertEquals(copy.getUserPassword(), "password");
assertNotNull(copy.getMemberOf());
assertEquals(copy.getMemberOf().size(), 1);
assertEquals(copy.getMemberOf().get(0), "Mocked DN");
assertEquals(copy.getAttribute(GLUU_STATUS), "true");
assertNull(copy.getAttribute(OX_TRUST_PHOTOS_TYPE));
assertNull(copy.getAttribute(OX_TRUST_PHONE_TYPE));
assertNull(copy.getAttribute(OX_TRUST_ADDRESS_PRIMARY));
assertNull(copy.getAttribute(OX_TRUST_ADDRESS_TYPE));
assertNull(copy.getAttribute(OX_TRUST_COUNTRY));
assertNull(copy.getAttribute(OX_TRUST_POSTAL_CODE));
assertNull(copy.getAttribute(OX_TRUST_REGION));
assertNull(copy.getAttribute(OX_TRUST_LOCALITY));
assertNull(copy.getAttribute(OX_TRUST_ADDRESS_FORMATTED));
assertNull(copy.getAttribute(OX_TRUST_STREET));
assertNull(copy.getAttribute(OX_TRUST_EMAIL_PRIMARY));
assertNull(copy.getAttribute(OX_TRUST_EMAIL_TYPE));
assertEquals(copy.getAttribute(OX_TRUST_META_LOCATION), "location");
assertEquals(copy.getAttribute(OX_TRUST_META_VERSION), "version");
assertEquals(copy.getAttribute(OX_TRUST_META_LAST_MODIFIED), "lastModified");
assertEquals(copy.getAttribute(OX_TRUST_META_CREATED), "created");
assertEquals(copy.getAttribute(OX_TRUSTX509_CERTIFICATE), "[{\"value\":\"cert_value\"}]");
assertEquals(copy.getAttribute(OX_TRUST_ENTITLEMENTS), "[{\"value\":\"entitlement_value\"}]");
assertEquals(copy.getAttribute(OX_TRUST_ROLE), "[{\"value\":\"role_value\"}]");
assertEquals(copy.getAttribute(OX_TRUST_ACTIVE), "true");
assertEquals(copy.getAttribute(OX_TRUST_LOCALE), "locale");
assertEquals(copy.getAttribute(OX_TRUST_TITLE), "title");
assertEquals(copy.getAttribute(OX_TRUST_USER_TYPE), "userType");
assertEquals(copy.getAttribute(OX_TRUST_PHOTOS), "[{\"value\":\"photo_value\",\"type\":\"photo_type\"}]");
assertEquals(copy.getAttribute(OX_TRUST_IMS_VALUE), "[{\"value\":\"ims_value\",\"type\":\"ims_type\"}]");
assertEquals(copy.getAttribute(OX_TRUST_PHONE_VALUE), "[{\"value\":\"phone_value\",\"type\":\"phone_type\"}]");
assertEquals(copy.getAttribute(OX_TRUST_ADDRESSES), "[{\"type\":\"address_type\",\"streetAddress\":\"streetAddress\",\"locality\":\"locality\",\"region\":\"region\",\"postalCode\":\"postalCode\",\"country\":\"country\",\"formatted\":\"formatted\",\"primary\":\"address_primary\"}]");
assertEquals(copy.getAttribute(OX_TRUST_EMAIL), "[{\"value\":\"email_value\",\"type\":\"email_type\",\"primary\":\"email_primary\"}]");
assertEquals(copy.getAttribute(OX_TRUST_PROFILE_URL), "profileUrl");
assertEquals(copy.getAttribute(OX_TRUST_NICK_NAME), "nickName");
assertEquals(copy.getAttribute(OX_TRUST_EXTERNAL_ID), "externalId");
assertEquals(copy.getAttribute(OX_TRUSTHONORIFIC_SUFFIX), "honorificSuffix");
assertEquals(copy.getAttribute(OX_TRUSTHONORIFIC_PREFIX), "honorificPrefix");
assertEquals(copy.getAttribute(OX_TRUST_MIDDLE_NAME), "middleName");
assertNull(copy.getAssociatedClient());
assertNull(copy.getBaseDn());
assertNull(copy.getCommonName());
List<GluuCustomAttribute> customAttributes2 = copy.getCustomAttributes();
assertNotNull(customAttributes2);
assertEquals(customAttributes2.size(), 32);
assertEquals(copy.getDisplayName(), "displayName");
assertNull(copy.getDn());
assertEquals(copy.getGivenName(), "givenName");
assertNull(copy.getGluuAllowPublication());
GluuCustomAttribute gluuCustomAttribute = copy.getGluuCustomAttribute("custom_name");
assertNotNull(gluuCustomAttribute);
assertEquals(gluuCustomAttribute.getName(), "custom_name");
assertEquals(gluuCustomAttribute.getValue(), "value");
assertNull(gluuCustomAttribute.getDate());
assertEquals(gluuCustomAttribute.getDisplayValue(), "value");
assertNull(gluuCustomAttribute.getMetadata());
assertEquals(gluuCustomAttribute.getValues()[0], "value");
assertNull(copy.getGluuOptOuts());
assertNull(copy.getIname());
assertNull(copy.getMail());
assertEquals(copy.getMemberOf().get(0), "Mocked DN");
assertNull(copy.getNetworkPoken());
assertNull(copy.getCreationDate());
assertEquals(copy.getPreferredLanguage(), "preferredLanguage");
assertNull(copy.getSLAManager());
assertNull(copy.getSourceServerName());
assertNull(copy.getStatus());
assertEquals(copy.getSurname(), "familyName");
assertEquals(copy.getTimezone(), "timezone");
assertEquals(copy.getUid(), "userName");
assertEquals(copy.getUserPassword(), "password");
}
Aggregations