Package org.camunda.bpm.engine.identity

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


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


    List<User> result = identityService.createUserQuery().list();
    assertEquals(8, result.size());
  }

  public void testFilterByUserId() {
    User user = identityService.createUserQuery().userId("oscar").singleResult();
    assertNotNull(user);

    // validate user
    assertEquals("oscar", user.getId());
    assertEquals("Oscar", user.getFirstName());
    assertEquals("The Crouch", user.getLastName());
    assertEquals("oscar@camunda.org", user.getEmail());


    user = identityService.createUserQuery().userId("non-existing").singleResult();
    assertNull(user);
  }
View Full Code Here

    assertNotNull(users);
    assertEquals(3, users.size());
  }

  public void testFilterByFirstname() {
    User user = identityService.createUserQuery().userFirstName("Oscar").singleResult();
    assertNotNull(user);

    user = identityService.createUserQuery().userFirstName("non-existing").singleResult();
    assertNull(user);
  }
View Full Code Here

    user = identityService.createUserQuery().userFirstName("non-existing").singleResult();
    assertNull(user);
  }

  public void testFilterByFirstnameLike() {
    User user = identityService.createUserQuery().userFirstNameLike("Osc*").singleResult();
    assertNotNull(user);

    user = identityService.createUserQuery().userFirstNameLike("non-exist*").singleResult();
    assertNull(user);
  }
View Full Code Here

    user = identityService.createUserQuery().userFirstNameLike("non-exist*").singleResult();
    assertNull(user);
  }

  public void testFilterByLastname() {
    User user = identityService.createUserQuery().userLastName("The Crouch").singleResult();
    assertNotNull(user);

    user = identityService.createUserQuery().userFirstNameLike("non-existing").singleResult();
    assertNull(user);
  }
View Full Code Here

    user = identityService.createUserQuery().userFirstNameLike("non-existing").singleResult();
    assertNull(user);
  }

  public void testFilterByLastnameLike() {
    User user = identityService.createUserQuery().userLastNameLike("The Cro*").singleResult();
    assertNotNull(user);
    user = identityService.createUserQuery().userLastNameLike("The*").singleResult();
    assertNotNull(user);

    user = identityService.createUserQuery().userLastNameLike("non-exist*").singleResult();
 
View Full Code Here

    user = identityService.createUserQuery().userLastNameLike("non-exist*").singleResult();
    assertNull(user);
  }

  public void testFilterByEmail() {
    User user = identityService.createUserQuery().userEmail("oscar@camunda.org").singleResult();
    assertNotNull(user);

    user = identityService.createUserQuery().userEmail("non-exist*").singleResult();
    assertNull(user);
  }
View Full Code Here

    user = identityService.createUserQuery().userEmail("non-exist*").singleResult();
    assertNull(user);
  }

  public void testFilterByEmailLike() {
    User user = identityService.createUserQuery().userEmailLike("oscar@*").singleResult();
    assertNotNull(user);

    user = identityService.createUserQuery().userEmailLike("non-exist*").singleResult();
    assertNull(user);
  }
View Full Code Here

    taskService.deleteTask(task.getId(), true);
  }

  public void testDefaultFilterAuthorization() {
    // create two other users beside testUser
    User ownerUser = createTestUser("ownerUser");
    User anotherUser = createTestUser("anotherUser");

    // grant testUser create permission
    grantCreateFilter();

    // create a new filter with ownerUser as owner
View Full Code Here

    assertFilterPermission(Permissions.DELETE, ownerUser, filter.getId(), true);
    assertFilterPermission(Permissions.DELETE, anotherUser, filter.getId(), false);
  }

  protected User createTestUser(String userId) {
    User user = identityService.newUser(userId);
    identityService.saveUser(user);

    // give user all permission to manipulate authorisations
    Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT);
    authorization.setUserId(user.getId());
    authorization.setResource(Resources.AUTHORIZATION);
    authorization.setResourceId(Authorization.ANY);
    authorization.addPermission(Permissions.ALL);
    authorizationService.saveAuthorization(authorization);

    // give user all permission to manipulate users
    authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT);
    authorization.setUserId(user.getId());
    authorization.setResource(Resources.USER);
    authorization.setResourceId(Authorization.ANY);
    authorization.addPermission(Permissions.ALL);
    authorizationService.saveAuthorization(authorization);
View Full Code Here

TOP

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

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.