Search in sources :

Example 16 with UserQuery

use of org.camunda.bpm.engine.identity.UserQuery in project camunda-bpm-platform by camunda.

the class UserQueryTest method testQueryByInvalidLastName.

public void testQueryByInvalidLastName() {
    UserQuery query = identityService.createUserQuery().userLastName("invalid");
    verifyQueryResults(query, 0);
    try {
        identityService.createUserQuery().userLastName(null).singleResult();
        fail();
    } catch (ProcessEngineException e) {
    }
}
Also used : UserQuery(org.camunda.bpm.engine.identity.UserQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 17 with UserQuery

use of org.camunda.bpm.engine.identity.UserQuery in project camunda-bpm-platform by camunda.

the class UserQueryTest method testQueryByInvalidFirstName.

public void testQueryByInvalidFirstName() {
    UserQuery query = identityService.createUserQuery().userFirstName("invalid");
    verifyQueryResults(query, 0);
    try {
        identityService.createUserQuery().userFirstName(null).singleResult();
        fail();
    } catch (ProcessEngineException e) {
    }
}
Also used : UserQuery(org.camunda.bpm.engine.identity.UserQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 18 with UserQuery

use of org.camunda.bpm.engine.identity.UserQuery in project camunda-bpm-platform by camunda.

the class UserQueryTest method testQueryByMemberOfGroup.

public void testQueryByMemberOfGroup() {
    UserQuery query = identityService.createUserQuery().memberOfGroup("muppets");
    verifyQueryResults(query, 3);
    query = identityService.createUserQuery().memberOfGroup("frogs");
    verifyQueryResults(query, 1);
    User result = query.singleResult();
    assertEquals("kermit", result.getId());
}
Also used : User(org.camunda.bpm.engine.identity.User) UserQuery(org.camunda.bpm.engine.identity.UserQuery)

Example 19 with UserQuery

use of org.camunda.bpm.engine.identity.UserQuery in project camunda-bpm-platform by camunda.

the class UserQueryTest method testQuerySorting.

public void testQuerySorting() {
    // asc
    assertEquals(3, identityService.createUserQuery().orderByUserId().asc().count());
    assertEquals(3, identityService.createUserQuery().orderByUserEmail().asc().count());
    assertEquals(3, identityService.createUserQuery().orderByUserFirstName().asc().count());
    assertEquals(3, identityService.createUserQuery().orderByUserLastName().asc().count());
    // desc
    assertEquals(3, identityService.createUserQuery().orderByUserId().desc().count());
    assertEquals(3, identityService.createUserQuery().orderByUserEmail().desc().count());
    assertEquals(3, identityService.createUserQuery().orderByUserFirstName().desc().count());
    assertEquals(3, identityService.createUserQuery().orderByUserLastName().desc().count());
    // Combined with criteria
    UserQuery query = identityService.createUserQuery().userLastNameLike("%ea%").orderByUserFirstName().asc();
    List<User> users = query.list();
    assertEquals(2, users.size());
    assertEquals("Fozzie", users.get(0).getFirstName());
    assertEquals("Gonzo", users.get(1).getFirstName());
}
Also used : User(org.camunda.bpm.engine.identity.User) UserQuery(org.camunda.bpm.engine.identity.UserQuery)

Example 20 with UserQuery

use of org.camunda.bpm.engine.identity.UserQuery in project camunda-bpm-platform by camunda.

the class UserQueryTest method testQueryById.

public void testQueryById() {
    UserQuery query = identityService.createUserQuery().userId("kermit");
    verifyQueryResults(query, 1);
}
Also used : UserQuery(org.camunda.bpm.engine.identity.UserQuery)

Aggregations

UserQuery (org.camunda.bpm.engine.identity.UserQuery)41 User (org.camunda.bpm.engine.identity.User)24 Test (org.junit.Test)17 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)8 Matchers.anyString (org.mockito.Matchers.anyString)8 UserCredentialsDto (org.camunda.bpm.engine.rest.dto.identity.UserCredentialsDto)5 Group (org.camunda.bpm.engine.identity.Group)4 GroupQuery (org.camunda.bpm.engine.identity.GroupQuery)4 Authentication (org.camunda.bpm.engine.impl.identity.Authentication)4 HashMap (java.util.HashMap)3 UserProfileDto (org.camunda.bpm.engine.rest.dto.identity.UserProfileDto)3 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)3 Response (com.jayway.restassured.response.Response)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)2 CaseDefinition (org.camunda.bpm.engine.repository.CaseDefinition)2 CaseDefinitionQuery (org.camunda.bpm.engine.repository.CaseDefinitionQuery)2 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)2 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)2