use of com.emc.storageos.model.usergroup.UserGroupRestRep in project coprhd-controller by CoprHD.
the class ApiTestVcenter method createUserGroup.
private void createUserGroup(String domain, String key, String value) {
UserAttributeParam userAttributeParam = new UserAttributeParam();
userAttributeParam.setKey(key);
userAttributeParam.getValues().add(value);
UserGroupCreateParam param = new UserGroupCreateParam();
param.setLabel(value);
param.setDomain(domain);
param.getAttributes().add(userAttributeParam);
ClientResponse clientResponse = rSys.path(getUserGroupApi()).post(ClientResponse.class, param);
Assert.assertEquals(HttpStatus.SC_OK, clientResponse.getStatus());
UserGroupRestRep userGroupRestRep = clientResponse.getEntity(UserGroupRestRep.class);
Assert.assertNotNull(userGroupRestRep);
// Add the created tenant to cleanup list, so that at the end of this test
// the resource will be destroyed.
final String deleteObjectURL = getUserGroupApiWithId(userGroupRestRep.getId());
CleanupResource tenantToCleanup = new CleanupResource("delete", deleteObjectURL, rSys, null);
apiTestVcenter.registerEnvironmentResourceForCleanup(tenantToCleanup);
}
use of com.emc.storageos.model.usergroup.UserGroupRestRep in project coprhd-controller by CoprHD.
the class UserGroupMapper method map.
public static final UserGroupRestRep map(UserGroup from) {
if (from == null) {
_log.info("Invalid user group");
return null;
}
UserGroupRestRep to = new UserGroupRestRep();
mapDataObjectFields(from, to);
to.setDomain(from.getDomain());
if (CollectionUtils.isEmpty(from.getAttributes())) {
_log.error("Empty attributes list in user group {}", from.getLabel());
return to;
}
for (String attributeString : from.getAttributes()) {
if (StringUtils.isBlank(attributeString)) {
_log.info("Invalid attribute param string in user group {}", from.getLabel());
continue;
}
UserAttributeParam attribute = UserAttributeParam.fromString(attributeString);
to.getAttributes().add(attribute);
}
return to;
}
Aggregations