use of org.gluu.oxtrust.model.scim2.User in project openstack4j by ContainX.
the class KeystoneUserServiceTests method crud_User_Test.
/**
* CRUD user tests
*
* @throws Exception
*/
public void crud_User_Test() throws Exception {
// --create
respondWith(JSON_USER_CREATE);
User newUser = osv3().identity().users().create(USER_DOMAIN_ID, "foobar", "secret", "foobar@example.org", true);
assertEquals(newUser.getName(), "foobar");
assertEquals(newUser.getDomainId(), USER_DOMAIN_ID);
assertEquals(newUser.getEmail(), "foobar@example.org");
assertEquals(newUser.isEnabled(), true);
assertNotNull(newUser.getId());
// --read
respondWith(JSON_USER_READ);
User user = osv3().identity().users().getByName("foobar", USER_DOMAIN_ID);
assertEquals(user.getId(), newUser.getId());
assertEquals(user.getName(), "foobar");
assertEquals(user.getEmail(), "foobar@example.org");
assertEquals(user.isEnabled(), true);
assertEquals(user.getDomainId(), USER_DOMAIN_ID);
String crudUserId = user.getId();
// --update
respondWith(JSON_USER_UPDATE);
User updatedUser = osv3().identity().users().update(KeystoneUser.builder().id(crudUserId).email("updatedFoobar@example.org").enabled(true).build());
assertEquals(updatedUser.getEmail(), "updatedFoobar@example.org");
assertEquals(updatedUser.getName(), "foobar");
assertEquals(updatedUser.isEnabled(), true);
assertEquals(updatedUser.getId(), crudUserId);
assertEquals(updatedUser.getDomainId(), USER_DOMAIN_ID);
// --delete
respondWith(204);
ActionResponse response_delete = osv3().identity().users().delete(crudUserId);
assertTrue(response_delete.isSuccess());
}
use of org.gluu.oxtrust.model.scim2.User in project openstack4j by ContainX.
the class KeystoneUserServiceTests method getUser_byId_Test.
/**
* get speciific user by user identifier
*
* @throws Exception
*/
public void getUser_byId_Test() throws Exception {
respondWith(JSON_USER_GET_BYID);
User user = osv3().identity().users().get(USER_ID);
assertEquals(user.getId(), USER_ID);
assertEquals(user.getName(), USER_NAME);
assertEquals(user.getDomainId(), USER_DOMAIN_ID);
}
use of org.gluu.oxtrust.model.scim2.User in project openstack4j by ContainX.
the class KeystoneUserServiceTests method getUser_byName_byDomainId_Test.
/**
* returns the user specified by name and domain.
*
* @throws Exception
*/
public void getUser_byName_byDomainId_Test() throws Exception {
respondWith(JSON_USER_GET_BYNAME_BYDOMAINID);
User user = osv3().identity().users().getByName(USER_NAME, USER_DOMAIN_ID);
assertEquals(user.getName(), USER_NAME);
assertEquals(user.getId(), USER_ID);
assertEquals(user.getDomainId(), USER_DOMAIN_ID);
}
use of org.gluu.oxtrust.model.scim2.User in project camel by apache.
the class UserProducer method messageToUser.
private User messageToUser(Message message) {
User project = message.getBody(User.class);
if (project == null) {
Map headers = message.getHeaders();
UserBuilder builder = Builders.user();
ObjectHelper.notEmpty(message.getHeader(OpenstackConstants.NAME, String.class), "Name");
builder.name(message.getHeader(OpenstackConstants.NAME, String.class));
if (headers.containsKey(KeystoneConstants.DOMAIN_ID)) {
builder.domainId(message.getHeader(KeystoneConstants.DOMAIN_ID, String.class));
}
if (headers.containsKey(KeystoneConstants.DESCRIPTION)) {
builder.description(message.getHeader(KeystoneConstants.DESCRIPTION, String.class));
}
if (headers.containsKey(KeystoneConstants.PASSWORD)) {
builder.password(message.getHeader(KeystoneConstants.PASSWORD, String.class));
}
if (headers.containsKey(KeystoneConstants.EMAIL)) {
builder.email(message.getHeader(KeystoneConstants.EMAIL, String.class));
}
project = builder.build();
}
return project;
}
use of org.gluu.oxtrust.model.scim2.User in project camel by apache.
the class UserProducer method doGet.
private void doGet(Exchange exchange) {
final Message msg = exchange.getIn();
final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(KeystoneConstants.USER_ID, String.class), String.class);
ObjectHelper.notEmpty(id, "User ID");
final User result = osV3Client.identity().users().get(id);
msg.setBody(result);
}
Aggregations