Search in sources :

Example 71 with User

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());
}
Also used : User(org.activiti.engine.identity.User) UserQuery(org.activiti.engine.identity.UserQuery)

Example 72 with User

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());
}
Also used : User(org.activiti.engine.identity.User) UserQuery(org.activiti.engine.identity.UserQuery)

Example 73 with User

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());
}
Also used : User(org.activiti.engine.identity.User)

Example 74 with User

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());
}
Also used : User(org.activiti.engine.identity.User) Picture(org.activiti.engine.identity.Picture)

Example 75 with User

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());
}
Also used : User(org.activiti.engine.identity.User)

Aggregations

User (org.activiti.engine.identity.User)94 Group (org.activiti.engine.identity.Group)22 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)12 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)10 Task (org.activiti.engine.task.Task)10 JsonNode (com.fasterxml.jackson.databind.JsonNode)9 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)9 Picture (org.activiti.engine.identity.Picture)9 StringEntity (org.apache.http.entity.StringEntity)9 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)9 ArrayList (java.util.ArrayList)7 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)7 HttpPut (org.apache.http.client.methods.HttpPut)7 HttpGet (org.apache.http.client.methods.HttpGet)6 UserQuery (org.activiti.engine.identity.UserQuery)5 HttpDelete (org.apache.http.client.methods.HttpDelete)5 HttpPost (org.apache.http.client.methods.HttpPost)4 Item (com.vaadin.data.Item)3 ActivitiException (org.activiti.engine.ActivitiException)3 IdentityService (org.activiti.engine.IdentityService)3