Package org.camunda.bpm.engine.identity

Examples of org.camunda.bpm.engine.identity.UserQuery


    when(mockTaskService.createTaskQuery()).thenReturn(mockTaskQuery);
  }

  private void createIdentityMocks() {
    // identity
    UserQuery sampleUserQuery = mock(UserQuery.class);
    GroupQuery sampleGroupQuery = mock(GroupQuery.class);
    List<User> mockUsers = new ArrayList<User>();
    User mockUser = MockProvider.createMockUser();
    mockUsers.add(mockUser);

    // user query
    when(sampleUserQuery.memberOfGroup(anyString())).thenReturn(sampleUserQuery);
    when(sampleUserQuery.list()).thenReturn(mockUsers);

    // group query
    List<Group> mockGroups = MockProvider.createMockGroups();
    when(sampleGroupQuery.groupMember(anyString())).thenReturn(sampleGroupQuery);
    when(sampleGroupQuery.orderByGroupName()).thenReturn(sampleGroupQuery);
View Full Code Here


  public void setUpRuntimeData() {
    mockQuery = setUpMockUserQuery(MockProvider.createMockUsers());
  }

  private UserQuery setUpMockUserQuery(List<User> list) {
    UserQuery sampleUserQuery = mock(UserQuery.class);
    when(sampleUserQuery.list()).thenReturn(list);
    when(sampleUserQuery.count()).thenReturn((long) list.size());
 
    when(processEngine.getIdentityService().createUserQuery()).thenReturn(sampleUserQuery);
 
    return sampleUserQuery;
  }
View Full Code Here

  }

  public List<UserProfileDto> queryUsers(UserQueryDto queryDto, Integer firstResult, Integer maxResults) {

    queryDto.setObjectMapper(getObjectMapper());
    UserQuery query = queryDto.toQuery(getProcessEngine());

    List<User> resultList;
    if(firstResult != null || maxResults != null) {
      resultList = executePaginatedQuery(query, firstResult, maxResults);
    } else {
      resultList = query.list();
    }

    return UserProfileDto.fromUserList(resultList);
  }
View Full Code Here

    UserQueryDto queryDto = new UserQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
    return getUserCount(queryDto);
  }

  protected CountResultDto getUserCount(UserQueryDto queryDto) {
    UserQuery query = queryDto.toQuery(getProcessEngine());
    long count = query.count();
    return new CountResultDto(count);
  }
View Full Code Here

    super.tearDown();
  }

  public void testQueryByNoCriteria() {
    UserQuery query = identityService.createUserQuery();
    verifyQueryResults(query, 3);
  }
View Full Code Here

    UserQuery query = identityService.createUserQuery();
    verifyQueryResults(query, 3);
  }

  public void testQueryById() {
    UserQuery query = identityService.createUserQuery().userId("kermit");
    verifyQueryResults(query, 1);
  }
View Full Code Here

    UserQuery query = identityService.createUserQuery().userId("kermit");
    verifyQueryResults(query, 1);
  }

  public void testQueryByInvalidId() {
    UserQuery query = identityService.createUserQuery().userId("invalid");
    verifyQueryResults(query, 0);

    try {
      identityService.createUserQuery().userId(null).singleResult();
      fail();
View Full Code Here

      fail();
    } catch (ProcessEngineException e) { }
  }

  public void testQueryByFirstName() {
    UserQuery query = identityService.createUserQuery().userFirstName("Gonzo");
    verifyQueryResults(query, 1);

    User result = query.singleResult();
    assertEquals("gonzo", result.getId());
  }
View Full Code Here

    User result = query.singleResult();
    assertEquals("gonzo", result.getId());
  }

  public void testQueryByInvalidFirstName() {
    UserQuery query = identityService.createUserQuery().userFirstName("invalid");
    verifyQueryResults(query, 0);

    try {
      identityService.createUserQuery().userFirstName(null).singleResult();
      fail();
View Full Code Here

      fail();
    } catch (ProcessEngineException e) { }
  }

  public void testQueryByFirstNameLike() {
    UserQuery query = identityService.createUserQuery().userFirstNameLike("%o%");
    verifyQueryResults(query, 2);

    query = identityService.createUserQuery().userFirstNameLike("Ker%");
    verifyQueryResults(query, 1);
  }
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.identity.UserQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.