use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class TaskAuditBaseTest method testAdminTasks.
@Test
public void testAdminTasks() {
Task task = new TaskFluent().setName("This is my task name").setAdminUser("salaboy").getTask();
taskService.addTask(task, new HashMap<String, Object>());
List<TaskSummary> allAdminTasks = taskService.getTasksAssignedAsBusinessAdministrator("salaboy", null);
assertEquals(1, allAdminTasks.size());
List<AuditTask> allAdminAuditTasksByUser = taskAuditService.getAllAdminAuditTasksByUser("salaboy", new QueryFilter(0, 0));
assertEquals(1, allAdminAuditTasksByUser.size());
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class TaskAuditBaseTest method testLifeCycleWithBAMEndWithExited.
@Test
public void testLifeCycleWithBAMEndWithExited() {
Task task = new TaskFluent().setName("This is my task name").addPotentialGroup("Knights Templer").setAdminUser("Administrator").getTask();
taskService.addTask(task, new HashMap<String, Object>());
long taskId = task.getId();
List<AuditTask> allGroupAuditTasks = taskAuditService.getAllGroupAuditTasksByUser("Knights Templer", new QueryFilter());
assertEquals(1, allGroupAuditTasks.size());
assertTrue(allGroupAuditTasks.get(0).getStatus().equals("Ready"));
assertBAMTask(taskId, "Ready");
taskService.claim(taskId, "Darth Vader");
allGroupAuditTasks = taskAuditService.getAllAuditTasksByUser("Darth Vader", new QueryFilter());
assertEquals(1, allGroupAuditTasks.size());
assertEquals("Reserved", allGroupAuditTasks.get(0).getStatus());
assertBAMTask(taskId, "Reserved");
taskService.release(taskId, "Darth Vader");
allGroupAuditTasks = taskAuditService.getAllGroupAuditTasksByUser("Knights Templer", new QueryFilter());
assertEquals(1, allGroupAuditTasks.size());
assertTrue(allGroupAuditTasks.get(0).getStatus().equals("Ready"));
assertBAMTask(taskId, "Ready");
taskService.claim(taskId, "Darth Vader");
allGroupAuditTasks = taskAuditService.getAllAuditTasksByUser("Darth Vader", new QueryFilter());
;
assertEquals(1, allGroupAuditTasks.size());
assertEquals("Reserved", allGroupAuditTasks.get(0).getStatus());
assertBAMTask(taskId, "Reserved");
// Go straight from Ready to Inprogress
taskService.start(taskId, "Darth Vader");
allGroupAuditTasks = taskAuditService.getAllAuditTasksByUser("Darth Vader", new QueryFilter());
;
assertEquals(1, allGroupAuditTasks.size());
assertEquals("InProgress", allGroupAuditTasks.get(0).getStatus());
assertBAMTask(taskId, "InProgress");
taskService.exit(taskId, "Administrator");
allGroupAuditTasks = taskAuditService.getAllAuditTasks(new QueryFilter());
;
assertEquals(1, allGroupAuditTasks.size());
assertEquals("Exited", allGroupAuditTasks.get(0).getStatus());
assertBAMTask(taskId, "Exited");
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class TaskAuditBaseTest method testLifeCycleWithBAMEndWithObsolete.
@Test
public void testLifeCycleWithBAMEndWithObsolete() {
Task task = new TaskFluent().setName("This is my task name").addPotentialGroup("Knights Templer").setAdminUser("Administrator").getTask();
((InternalTaskData) task.getTaskData()).setSkipable(true);
taskService.addTask(task, new HashMap<String, Object>());
long taskId = task.getId();
List<AuditTask> allGroupAuditTasks = taskAuditService.getAllGroupAuditTasksByUser("Knights Templer", new QueryFilter());
assertEquals(1, allGroupAuditTasks.size());
assertTrue(allGroupAuditTasks.get(0).getStatus().equals("Ready"));
assertBAMTask(taskId, "Ready");
taskService.claim(taskId, "Darth Vader");
allGroupAuditTasks = taskAuditService.getAllAuditTasksByUser("Darth Vader", new QueryFilter());
assertEquals(1, allGroupAuditTasks.size());
assertEquals("Reserved", allGroupAuditTasks.get(0).getStatus());
assertBAMTask(taskId, "Reserved");
taskService.release(taskId, "Darth Vader");
allGroupAuditTasks = taskAuditService.getAllGroupAuditTasksByUser("Knights Templer", new QueryFilter());
assertEquals(1, allGroupAuditTasks.size());
assertTrue(allGroupAuditTasks.get(0).getStatus().equals("Ready"));
assertBAMTask(taskId, "Ready");
taskService.claim(taskId, "Darth Vader");
allGroupAuditTasks = taskAuditService.getAllAuditTasksByUser("Darth Vader", new QueryFilter());
;
assertEquals(1, allGroupAuditTasks.size());
assertEquals("Reserved", allGroupAuditTasks.get(0).getStatus());
assertBAMTask(taskId, "Reserved");
// Go straight from Ready to Inprogress
taskService.start(taskId, "Darth Vader");
allGroupAuditTasks = taskAuditService.getAllAuditTasksByUser("Darth Vader", new QueryFilter());
;
assertEquals(1, allGroupAuditTasks.size());
assertEquals("InProgress", allGroupAuditTasks.get(0).getStatus());
assertBAMTask(taskId, "InProgress");
taskService.skip(taskId, "Darth Vader");
allGroupAuditTasks = taskAuditService.getAllAuditTasksByUser("Darth Vader", new QueryFilter());
;
assertEquals(1, allGroupAuditTasks.size());
assertEquals("Obsolete", allGroupAuditTasks.get(0).getStatus());
assertBAMTask(taskId, "Obsolete");
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class TaskAuditBaseTest method testUpdateTaskContentEvents.
@Test
public void testUpdateTaskContentEvents() {
Task task = new TaskFluent().setName("This is my task name").addPotentialGroup("Knights Templer").setAdminUser("Administrator").getTask();
taskService.addTask(task, new HashMap<String, Object>());
long taskId = task.getId();
assertAuditTaskInfoGroup("Knights Templer", "Ready", taskId);
taskService.claim(taskId, "Darth Vader");
assertAuditTaskInfo("Darth Vader", "Reserved", taskId);
// Go straight from Ready to Inprogress
taskService.start(taskId, "Darth Vader");
assertAuditTaskInfo("Darth Vader", "InProgress", taskId);
Map<String, Object> params = new HashMap<>();
params.put("test", "value");
taskService.addOutputContentFromUser(taskId, "Darth Vader", params);
// Check is Complete
params.clear();
params.put("test", "updated");
taskService.complete(taskId, "Darth Vader", params);
assertAuditTaskInfo("Darth Vader", "Completed", taskId);
List<TaskEvent> taskEvents = taskAuditService.getAllTaskEvents(taskId, new QueryFilter());
Assertions.assertThat(taskEvents).hasSize(6);
Assertions.assertThat(taskEvents.get(0).getType()).isEqualTo(TaskEventType.ADDED);
Assertions.assertThat(taskEvents.get(0).getUserId()).isNull();
Assertions.assertThat(taskEvents.get(1).getType()).isEqualTo(TaskEventType.CLAIMED);
Assertions.assertThat(taskEvents.get(1).getUserId()).isEqualTo("Darth Vader");
Assertions.assertThat(taskEvents.get(2).getType()).isEqualTo(TaskEventType.STARTED);
Assertions.assertThat(taskEvents.get(2).getUserId()).isEqualTo("Darth Vader");
// first update of data explicitly
Assertions.assertThat(taskEvents.get(3).getType()).isEqualTo(TaskEventType.UPDATED);
Assertions.assertThat(taskEvents.get(3).getUserId()).isEqualTo("Darth Vader");
// next update of data through complete
Assertions.assertThat(taskEvents.get(4).getType()).isEqualTo(TaskEventType.UPDATED);
Assertions.assertThat(taskEvents.get(4).getUserId()).isEqualTo("Darth Vader");
Assertions.assertThat(taskEvents.get(5).getType()).isEqualTo(TaskEventType.COMPLETED);
Assertions.assertThat(taskEvents.get(5).getUserId()).isEqualTo("Darth Vader");
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class TaskAuditBaseTest method assertAuditTaskInfo.
protected void assertAuditTaskInfo(String user, String status, Long taskId) {
List<AuditTask> allGroupAuditTasks = taskAuditService.getAllAuditTasksByUser(user, new QueryFilter());
assertEquals(1, allGroupAuditTasks.size());
assertTrue(allGroupAuditTasks.get(0).getStatus().equals(status));
assertBAMTask(taskId, status);
}
Aggregations