Package org.activiti.engine.identity

Examples of org.activiti.engine.identity.User


                Group group = identityService.newGroup("user");
                group.setName("users");
                group.setType("security-role");
                identityService.saveGroup(group);

                User joram = identityService.newUser("jbarrez");
                joram.setFirstName("Joram");
                joram.setLastName("Barrez");
                joram.setPassword("password");
                identityService.saveUser(joram);

                User josh = identityService.newUser("jlong");
                josh.setFirstName("Josh");
                josh.setLastName("Long");
                josh.setPassword("password");
                identityService.saveUser(josh);

                identityService.createMembership("jbarrez", "user");
                identityService.createMembership("jlong", "user");
            }
View Full Code Here


  }
 
  public void testUnClaimTask() {
    Task task = taskService.newTask();
    taskService.saveTask(task);
    User user = identityService.newUser("user");
    identityService.saveUser(user);
   
    // Claim task the first time
    taskService.claim(task.getId(), user.getId());
    task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
    assertEquals(user.getId(), task.getAssignee());
   
    // Unclaim the task
    taskService.unclaim(task.getId());
   
    task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
    assertNull(task.getAssignee());
   
    taskService.deleteTask(task.getId(), true);
    identityService.deleteUser(user.getId());
  }
View Full Code Here

    taskService.createTaskQuery().singleResult();

  }
 
  public void testSetAssignee() {
    User user = identityService.newUser("user");
    identityService.saveUser(user);
   
    Task task = taskService.newTask();
    assertNull(task.getAssignee());
    taskService.saveTask(task);
   
    // Set assignee
    taskService.setAssignee(task.getId(), user.getId());
   
    // Fetch task again
    task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
    assertEquals(user.getId(), task.getAssignee());
   
    // Set assignee to null
    taskService.setAssignee(task.getId(), null);
   
    identityService.deleteUser(user.getId());
    taskService.deleteTask(task.getId(), true);
  }
View Full Code Here

      assertTextPresent("taskId is null", ae.getMessage());
    }
  }
 
  public void testSetAssigneeUnexistingTask() {
    User user = identityService.newUser("user");
    identityService.saveUser(user);
   
    try {
      taskService.setAssignee("unexistingTaskId", user.getId());
      fail("ActivitiException expected");
    } catch (ActivitiObjectNotFoundException ae) {
      assertTextPresent("Cannot find task with id unexistingTaskId", ae.getMessage());
      assertEquals(Task.class, ae.getObjectClass());
    }
   
    identityService.deleteUser(user.getId());
  }
View Full Code Here

    identityService.deleteUser(user.getId());
  }
 
  public void testAddCandidateUserDuplicate() {
    // Check behavior when adding the same user twice as candidate
    User user = identityService.newUser("user");
    identityService.saveUser(user);
   
    Task task = taskService.newTask();
    taskService.saveTask(task);
   
    taskService.addCandidateUser(task.getId(), user.getId());

    // Add as candidate the second time
    taskService.addCandidateUser(task.getId(), user.getId());
   
    identityService.deleteUser(user.getId());
    taskService.deleteTask(task.getId(), true);
  }
View Full Code Here

      assertTextPresent("userId and groupId cannot both be null", ae.getMessage());
    }
  }
 
  public void testAddCandidateUserUnexistingTask() {
    User user = identityService.newUser("user");
    identityService.saveUser(user);
   
    try {
      taskService.addCandidateUser("unexistingTaskId", user.getId());
      fail("ActivitiException expected");
    } catch (ActivitiObjectNotFoundException ae) {
      assertTextPresent("Cannot find task with id unexistingTaskId", ae.getMessage());
      assertEquals(Task.class, ae.getObjectClass());
    }
   
    identityService.deleteUser(user.getId());
  }
View Full Code Here

      assertTextPresent("userId and groupId cannot both be null", ae.getMessage());
    }
  }
 
  public void testAddGroupIdentityLinkUnexistingTask() {
    User user = identityService.newUser("user");
    identityService.saveUser(user);
   
    try {
      taskService.addGroupIdentityLink("unexistingTaskId", user.getId(), IdentityLinkType.CANDIDATE);
      fail("ActivitiException expected");
    } catch (ActivitiObjectNotFoundException ae) {
      assertTextPresent("Cannot find task with id unexistingTaskId", ae.getMessage());
      assertEquals(Task.class, ae.getObjectClass());
    }
   
    identityService.deleteUser(user.getId());
  }
View Full Code Here

      assertTextPresent("userId and groupId cannot both be null", ae.getMessage());
    }
  }
 
  public void testAddUserIdentityLinkUnexistingTask() {
    User user = identityService.newUser("user");
    identityService.saveUser(user);
   
    try {
      taskService.addUserIdentityLink("unexistingTaskId", user.getId(), IdentityLinkType.CANDIDATE);
      fail("ActivitiException expected");
    } catch (ActivitiObjectNotFoundException ae) {
      assertTextPresent("Cannot find task with id unexistingTaskId", ae.getMessage());
      assertEquals(Task.class, ae.getObjectClass());
    }
   
    identityService.deleteUser(user.getId());
  }
View Full Code Here

      Group testGroup = identityService.newGroup("testgroup");
      testGroup.setName("Test group");
      testGroup.setType("Test type");
      identityService.saveGroup(testGroup);
     
      User testUser = identityService.newUser("testuser");
      identityService.saveUser(testUser);
     
      ObjectNode requestNode = objectMapper.createObjectNode();
      requestNode.put("userId", "testuser");
     
      HttpPost httpPost = new HttpPost(SERVER_URL_PREFIX +
          RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP_MEMBERSHIP_COLLECTION, "testgroup"));
      httpPost.setEntity(new StringEntity(requestNode.toString()));
      CloseableHttpResponse response = executeRequest(httpPost, HttpStatus.SC_CREATED);
      JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent());
      closeResponse(response);
      assertNotNull(responseNode);
      assertEquals("testuser", responseNode.get("userId").textValue());
      assertEquals("testgroup", responseNode.get("groupId").textValue());
      assertTrue(responseNode.get("url").textValue().endsWith(RestUrls.createRelativeResourceUrl(
              RestUrls.URL_GROUP_MEMBERSHIP, testGroup.getId(), testUser.getId())));     
     
      Group createdGroup  = identityService.createGroupQuery().groupId("testgroup").singleResult();
      assertNotNull(createdGroup);
      assertEquals("Test group", createdGroup.getName());
      assertEquals("Test type", createdGroup.getType());
View Full Code Here

      Group testGroup = identityService.newGroup("testgroup");
      testGroup.setName("Test group");
      testGroup.setType("Test type");
      identityService.saveGroup(testGroup);
     
      User testUser = identityService.newUser("testuser");
      identityService.saveUser(testUser);
     
      identityService.createMembership("testuser", "testgroup");
     
      ObjectNode requestNode = objectMapper.createObjectNode();
View Full Code Here

TOP

Related Classes of org.activiti.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.