Examples of UserQuery


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

    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());
  }
View Full Code Here

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

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

  public void testQueryByMemberOf() {
    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());
  }
View Full Code Here

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

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

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

    try {
      identityService.createUserQuery().memberOfGroup(null).list();
      fail();
View Full Code Here

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

  public void setUpRuntimeData() {
    createMockIdentityQueries();
  }
 
  private void createMockIdentityQueries() {
    UserQuery sampleUserQuery = mock(UserQuery.class);
   
    List<User> mockUsers = new ArrayList<User>();
   
    mockUser = MockProvider.createMockUser();
    mockUsers.add(mockUser);
 
    when(sampleUserQuery.list()).thenReturn(mockUsers);
    when(sampleUserQuery.memberOfGroup(anyString())).thenReturn(sampleUserQuery);
    when(sampleUserQuery.count()).thenReturn((long) mockUsers.size());
 
    GroupQuery sampleGroupQuery = mock(GroupQuery.class);
   
    List<Group> mockGroups = MockProvider.createMockGroups();
    when(sampleGroupQuery.list()).thenReturn(mockGroups);
View Full Code Here

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

  }

  @Test
  public void testGetSingleUserProfile() {
    User sampleUser = MockProvider.createMockUser();
    UserQuery sampleUserQuery = mock(UserQuery.class);
    when(identityServiceMock.createUserQuery()).thenReturn(sampleUserQuery);
    when(sampleUserQuery.userId(MockProvider.EXAMPLE_USER_ID)).thenReturn(sampleUserQuery);
    when(sampleUserQuery.singleResult()).thenReturn(sampleUser);

    given()
        .pathParam("id", MockProvider.EXAMPLE_USER_ID)
    .then()
        .statusCode(Status.OK.getStatusCode())
View Full Code Here

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

  @Test
  public void testUserResourceOptionsUnauthenticated() {
    String fullUserUrl = "http://localhost:" + PORT + TEST_RESOURCE_ROOT_PATH + "/user/" + MockProvider.EXAMPLE_USER_ID;

    User sampleUser = MockProvider.createMockUser();
    UserQuery sampleUserQuery = mock(UserQuery.class);
    when(identityServiceMock.createUserQuery()).thenReturn(sampleUserQuery);
    when(sampleUserQuery.userId(MockProvider.EXAMPLE_USER_ID)).thenReturn(sampleUserQuery);
    when(sampleUserQuery.singleResult()).thenReturn(sampleUser);
    when(identityServiceMock.getCurrentAuthentication()).thenReturn(null);

    given()
        .pathParam("id", MockProvider.EXAMPLE_USER_ID)
    .then()
View Full Code Here

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

  @Test
  public void testUserResourceOptionsUnauthorized() {
    String fullUserUrl = "http://localhost:" + PORT + TEST_RESOURCE_ROOT_PATH + "/user/" + MockProvider.EXAMPLE_USER_ID;

    User sampleUser = MockProvider.createMockUser();
    UserQuery sampleUserQuery = mock(UserQuery.class);
    when(identityServiceMock.createUserQuery()).thenReturn(sampleUserQuery);
    when(sampleUserQuery.userId(MockProvider.EXAMPLE_USER_ID)).thenReturn(sampleUserQuery);
    when(sampleUserQuery.singleResult()).thenReturn(sampleUser);

    Authentication authentication = new Authentication(MockProvider.EXAMPLE_USER_ID, null);
    when(identityServiceMock.getCurrentAuthentication()).thenReturn(authentication);
    when(authorizationServiceMock.isUserAuthorized(MockProvider.EXAMPLE_USER_ID, null, DELETE, USER, MockProvider.EXAMPLE_USER_ID)).thenReturn(false);
    when(authorizationServiceMock.isUserAuthorized(MockProvider.EXAMPLE_USER_ID, null, UPDATE, USER, MockProvider.EXAMPLE_USER_ID)).thenReturn(false);
View Full Code Here

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

  @Test
  public void testUserResourceOptionsDeleteAuthorized() {
    String fullUserUrl = "http://localhost:" + PORT + TEST_RESOURCE_ROOT_PATH + "/user/" + MockProvider.EXAMPLE_USER_ID;

    User sampleUser = MockProvider.createMockUser();
    UserQuery sampleUserQuery = mock(UserQuery.class);
    when(identityServiceMock.createUserQuery()).thenReturn(sampleUserQuery);
    when(sampleUserQuery.userId(MockProvider.EXAMPLE_USER_ID)).thenReturn(sampleUserQuery);
    when(sampleUserQuery.singleResult()).thenReturn(sampleUser);

    Authentication authentication = new Authentication(MockProvider.EXAMPLE_USER_ID, null);
    when(identityServiceMock.getCurrentAuthentication()).thenReturn(authentication);
    when(authorizationServiceMock.isUserAuthorized(MockProvider.EXAMPLE_USER_ID, null, DELETE, USER, MockProvider.EXAMPLE_USER_ID)).thenReturn(true);
    when(authorizationServiceMock.isUserAuthorized(MockProvider.EXAMPLE_USER_ID, null, UPDATE, USER, MockProvider.EXAMPLE_USER_ID)).thenReturn(false);
View Full Code Here

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

  }


  @Test
  public void testGetNonExistingUserProfile() {
    UserQuery sampleUserQuery = mock(UserQuery.class);
    when(identityServiceMock.createUserQuery()).thenReturn(sampleUserQuery);
    when(sampleUserQuery.userId(anyString())).thenReturn(sampleUserQuery);
    when(sampleUserQuery.singleResult()).thenReturn(null);

    given()
        .pathParam("id", "aNonExistingUser")
    .then()
        .statusCode(Status.NOT_FOUND.getStatusCode()).contentType(ContentType.JSON)
View Full Code Here

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

  }

  @Test
  public void testPutCredentials() {
    User initialUser = MockProvider.createMockUser();
    UserQuery sampleUserQuery = mock(UserQuery.class);
    when(identityServiceMock.createUserQuery()).thenReturn(sampleUserQuery);
    when(sampleUserQuery.userId(MockProvider.EXAMPLE_USER_ID)).thenReturn(sampleUserQuery);
    when(sampleUserQuery.singleResult()).thenReturn(initialUser);

    UserCredentialsDto dto = new UserCredentialsDto();
    dto.setPassword("new-password");

    given()
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.