示例#1
0
 @Override
 public void tearDown() throws Exception {
   try {
     taskAuditService.clear();
     taskAuditService.dispose();
     abortProcess(kieSession, processInstanceList);
   } finally {
     super.tearDown();
   }
 }
示例#2
0
  @Test
  @BZ("1188702")
  public void testDeleteLogsByDate() {
    kieSession = createKSession(HUMAN_TASK);

    processInstanceList = startProcess(kieSession, HUMAN_TASK_ID, 4);

    TaskService taskService = getRuntimeEngine().getTaskService();

    // Delete the last two task logs
    for (int i = processInstanceList.size() - 1; i > 0; i--) {
      List<Long> taskIdList =
          taskService.getTasksByProcessInstanceId(processInstanceList.get(i).getId());
      Assertions.assertThat(taskIdList).hasSize(1);

      Task task = taskService.getTaskById(taskIdList.get(0));
      Assertions.assertThat(task).isNotNull();

      int resultCount =
          taskAuditService
              .auditTaskDelete()
              .date(task.getTaskData().getCreatedOn())
              .build()
              .execute();
      Assertions.assertThat(resultCount).isEqualTo(1);
    }
  }
示例#3
0
 private int deleteAuditTaskInstanceLogs(Date startDate, Date endDate) {
   return taskAuditService
       .auditTaskDelete()
       .dateRangeStart(startDate)
       .dateRangeEnd(endDate)
       .build()
       .execute();
 }
示例#4
0
  @Test
  @BZ("1192912")
  public void testClearLogs() {
    kieSession = createKSession(HUMAN_TASK);
    processInstanceList = startProcess(kieSession, HUMAN_TASK_ID, 2);

    taskAuditService.clear();
    Assertions.assertThat(getAllAuditTaskLogs()).hasSize(0);
  }
示例#5
0
  @Test
  public void testDeleteLogsByProcessId() {
    kieSession = createKSession(HUMAN_TASK);

    processInstanceList = startProcess(kieSession, HUMAN_TASK_ID, 2);

    int deletedLogs = taskAuditService.auditTaskDelete().processId(HUMAN_TASK_ID).build().execute();
    Assertions.assertThat(deletedLogs).isEqualTo(2);
    Assertions.assertThat(getAllAuditTaskLogs()).hasSize(0);
  }
示例#6
0
  @Test
  public void testDeleteLogsByProcessName() {
    kieSession = createKSession(HUMAN_TASK);

    processInstanceList = startProcess(kieSession, HUMAN_TASK_ID, 3);

    int resultCount =
        taskAuditService
            .auditTaskDelete()
            .processInstanceId(
                processInstanceList.get(0).getId(), processInstanceList.get(1).getId())
            .build()
            .execute();
    Assertions.assertThat(resultCount).isEqualTo(2);

    TaskService taskService = getRuntimeEngine().getTaskService();
    List<Long> taskIdList =
        taskService.getTasksByProcessInstanceId(processInstanceList.get(2).getId());
    Assertions.assertThat(taskIdList).hasSize(1);
  }
示例#7
0
  @Test
  public void testDeleteTaskEventByDate() {
    kieSession = createKSession(HUMAN_TASK_MULTIACTORS);

    Date startDate = new Date();
    processInstanceList = startProcess(kieSession, HUMAN_TASK_MULTIACTORS_ID, 1);

    // Get the task
    TaskService taskService = getRuntimeEngine().getTaskService();
    Task task =
        taskService.getTaskById(
            taskService.getTasksByProcessInstanceId(processInstanceList.get(0).getId()).get(0));
    Assertions.assertThat(task).isNotNull();
    Assertions.assertThat(task.getTaskData().getStatus()).isEqualTo(Status.Ready);

    // Perform 2 operation on the task
    taskService.claim(task.getId(), "krisv");
    taskService.start(task.getId(), "krisv");
    taskService.complete(task.getId(), "krisv", null);

    // Remove the instance from the running list as it has ended already.
    processInstanceList.clear();

    // Delete all task operation between dates
    int resultCount =
        taskAuditService
            .taskEventInstanceLogDelete()
            .dateRangeStart(startDate)
            .dateRangeEnd(new Date())
            .build()
            .execute();
    // Changes are as follows (see
    // https://docs.jboss.org/jbpm/v6.1/userguide/jBPMTaskService.html#jBPMTaskLifecycle):
    // 1) Created -> Ready (automatic change because there are multiple actors)
    // 2) Ready -> Reserved (by claim)
    // 3) Reserved -> In Progress (by start)
    // 4) In Progress -> Completed (by complete)
    Assertions.assertThat(resultCount).isEqualTo(4);
  }
示例#8
0
 @Override
 public void setUp() throws Exception {
   super.setUp();
   taskAuditService = new TaskJPAAuditService(getEmf());
   taskAuditService.clear();
 }
示例#9
0
 private List<AuditTask> getAllAuditTaskLogs() {
   return taskAuditService.auditTaskQuery().build().getResultList();
 }