Пример #1
0
  @Test
  public void testHumanTaskFlow_shouldWorkWithGivenProcessBag() throws Exception {
    authenticateAsAdmin();
    addWorkflow("TaskDemoWorkflow");

    ProcessBag processBag = new ProcessBag();
    processBag.addProperty("test", "test");
    Map<String, Object> parameterMap = new HashMap<String, Object>();
    parameterMap.put("processBag", processBag);

    assertThat(taskboxService.getOpenTasks().size(), is(0));

    workflowService.startFlow("TaskDemoWorkflow", parameterMap);
    System.out.println("workflow started, getting processId");
    assertNotNull(processBag.getProcessId());
    System.out.println("got processId");
    assertThat(taskboxService.getOpenTasks().size(), is(1));
    System.out.println("opentasks is 1");

    Task task = taskboxService.getOpenTasks().get(0);
    System.out.println("got task");
    assertEquals(task.getProcessId(), processBag.getProcessId());
    assertEquals(task.getProperty("test"), "test");
    assertEquals(task.getTaskType(), "demo");
    assertNotNull(task.getTaskId());
    System.out.println("task correct, finishing");
    taskboxService.finishTask(task);
    assertTrue(taskboxService.getOpenTasks().size() == 0);
  }
Пример #2
0
  @Test
  public void testCompleteWorkflow_humanInteractionShouldReplaceValues() throws Exception {
    addWorkflow("HIDemoWorkflow");
    authenticateAsAdmin();
    workflowService.startFlow("HIDemoWorkflow");
    Task task = taskboxService.getOpenTasks().get(0);
    Date date = new Date();
    task.addOrReplaceProperty("test", date);
    assertEquals("step1", task.getTaskType());

    task.setName("test");
    taskboxService.updateTask(task);
    task = taskboxService.getOpenTasks().get(0);
    assertEquals("test", task.getName());

    taskboxService.finishTask(task);

    task = taskboxService.getOpenTasks().get(0);
    assertEquals(date, task.getProperty("test"));
    assertEquals("step2", task.getTaskType());

    taskboxService.finishTask(task);
    assertThat(taskboxService.getOpenTasks().size(), is(0));
  }