コード例 #1
0
  @Test
  public void testTaskMultipleActors() throws Exception {
    TestWorkItemManager manager = new TestWorkItemManager();
    ksession.setWorkItemManager(manager);
    WorkItemImpl workItem = new WorkItemImpl();
    workItem.setName("Human Task");
    workItem.setParameter("TaskName", "TaskName");
    workItem.setParameter("Comment", "Comment");
    workItem.setParameter("Priority", "10");
    workItem.setParameter("ActorId", "Darth Vader, Dalai Lama");
    getHandler().executeWorkItem(workItem, manager);

    List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK");
    assertEquals(1, tasks.size());
    TaskSummary task = tasks.get(0);
    assertEquals("TaskName", task.getName());
    assertEquals(10, task.getPriority());
    assertEquals("Comment", task.getDescription());
    assertEquals(Status.Ready, task.getStatus());

    taskService.claim(task.getId(), "Darth Vader");

    taskService.start(task.getId(), "Darth Vader");

    taskService.complete(task.getId(), "Darth Vader", null);

    assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME));
  }
コード例 #2
0
  @Ignore
  @Test // FIX UserGROUP CALLBACK
  public void testTaskGroupActors() throws Exception {

    TestWorkItemManager manager = new TestWorkItemManager();
    ksession.setWorkItemManager(manager);
    WorkItemImpl workItem = new WorkItemImpl();
    workItem.setName("Human Task");
    workItem.setParameter("TaskName", "TaskName");
    workItem.setParameter("Comment", "Comment");
    workItem.setParameter("Priority", "10");
    workItem.setParameter("GroupId", "Crusaders");
    getHandler().executeWorkItem(workItem, manager);

    List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Luke", "en-UK");
    assertEquals(1, tasks.size());
    TaskSummary taskSummary = tasks.get(0);
    assertEquals("TaskName", taskSummary.getName());
    assertEquals(10, taskSummary.getPriority());
    assertEquals("Comment", taskSummary.getDescription());
    assertEquals(Status.Ready, taskSummary.getStatus());

    PermissionDeniedException denied = null;
    try {
      taskService.claim(taskSummary.getId(), "Darth Vader");
    } catch (PermissionDeniedException e) {
      denied = e;
    }

    assertNotNull("Should get permissed denied exception", denied);

    // Check if the parent task is InProgress

    Task task = taskService.getTaskById(taskSummary.getId());
    assertEquals(Status.Ready, task.getTaskData().getStatus());
  }