use of org.activiti.engine.identity.User in project Activiti by Activiti.
the class UserQueryTest method testQueryByLastName.
public void testQueryByLastName() {
UserQuery query = identityService.createUserQuery().userLastName("Bear");
verifyQueryResults(query, 1);
User result = query.singleResult();
assertEquals("fozzie", result.getId());
}
use of org.activiti.engine.identity.User in project Activiti by Activiti.
the class UserQueryTest method testQueryByFirstName.
public void testQueryByFirstName() {
UserQuery query = identityService.createUserQuery().userFirstName("Gonzo");
verifyQueryResults(query, 1);
User result = query.singleResult();
assertEquals("gonzo", result.getId());
}
use of org.activiti.engine.identity.User in project Activiti by Activiti.
the class IdentityServiceTest method testDeleteMembershipUnexistingGroup.
public void testDeleteMembershipUnexistingGroup() {
User johndoe = identityService.newUser("johndoe");
identityService.saveUser(johndoe);
// No exception should be thrown when group doesn't exist
identityService.deleteMembership(johndoe.getId(), "unexistinggroup");
identityService.deleteUser(johndoe.getId());
}
use of org.activiti.engine.identity.User in project Activiti by Activiti.
the class IdentityServiceTest method testUserPicture.
public void testUserPicture() {
// First, create a new user
User user = identityService.newUser("johndoe");
identityService.saveUser(user);
String userId = user.getId();
Picture picture = new Picture("niceface".getBytes(), "image/string");
identityService.setUserPicture(userId, picture);
picture = identityService.getUserPicture(userId);
// Fetch and update the user
user = identityService.createUserQuery().userId("johndoe").singleResult();
assertTrue("byte arrays differ", Arrays.equals("niceface".getBytes(), picture.getBytes()));
assertEquals("image/string", picture.getMimeType());
//interface defintion states that setting picture to null should delete it
identityService.setUserPicture(userId, null);
assertNull("it should be possible to nullify user picture", identityService.getUserPicture(userId));
user = identityService.createUserQuery().userId("johndoe").singleResult();
assertNull("it should be possible to delete user picture", identityService.getUserPicture(userId));
identityService.deleteUser(user.getId());
}
use of org.activiti.engine.identity.User in project Activiti by Activiti.
the class IdentityServiceTest method testCreateMembershipUnexistingGroup.
public void testCreateMembershipUnexistingGroup() {
User johndoe = identityService.newUser("johndoe");
identityService.saveUser(johndoe);
try {
identityService.createMembership(johndoe.getId(), "unexistinggroup");
fail("Expected exception");
} catch (RuntimeException re) {
// Exception expected
}
identityService.deleteUser(johndoe.getId());
}
Aggregations