use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class UserTaskAdminServiceImplTest method testReassignNotStartedAndCancel.
@Test(timeout = 10000)
public void testReassignNotStartedAndCancel() throws Exception {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
Assertions.assertThat(processInstanceId).isNotNull();
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
Assertions.assertThat(tasks).hasSize(1);
TaskSummary task = tasks.get(0);
Collection<TaskReassignment> reassignments = userTaskAdminService.getTaskReassignments(task.getId(), false);
Assertions.assertThat(reassignments).isNotNull();
Assertions.assertThat(reassignments).hasSize(0);
Long reassignmentId = userTaskAdminService.reassignWhenNotStarted(task.getId(), "2s", factory.newUser("john"));
reassignments = userTaskAdminService.getTaskReassignments(task.getId(), true);
Assertions.assertThat(reassignments).isNotNull();
Assertions.assertThat(reassignments).hasSize(1);
userTaskAdminService.cancelReassignment(task.getId(), reassignmentId);
reassignments = userTaskAdminService.getTaskReassignments(task.getId(), true);
Assertions.assertThat(reassignments).isNotNull();
Assertions.assertThat(reassignments).hasSize(0);
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class UserTaskAdminServiceImplTest method testReassignNotCompleted.
@Test(timeout = 10000)
public void testReassignNotCompleted() throws Exception {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
Assertions.assertThat(processInstanceId).isNotNull();
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
Assertions.assertThat(tasks).hasSize(1);
TaskSummary task = tasks.get(0);
userTaskService.start(task.getId(), "salaboy");
Collection<TaskReassignment> reassignments = userTaskAdminService.getTaskReassignments(task.getId(), false);
Assertions.assertThat(reassignments).isNotNull();
Assertions.assertThat(reassignments).hasSize(0);
userTaskAdminService.reassignWhenNotCompleted(task.getId(), "2s", factory.newUser("john"));
reassignments = userTaskAdminService.getTaskReassignments(task.getId(), true);
Assertions.assertThat(reassignments).isNotNull();
Assertions.assertThat(reassignments).hasSize(1);
CountDownListenerFactory.getExistingTask("userTaskAdminService").waitTillCompleted();
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
Assertions.assertThat(tasks).hasSize(0);
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("john", new QueryFilter());
Assertions.assertThat(tasks).hasSize(1);
reassignments = userTaskAdminService.getTaskReassignments(task.getId(), true);
Assertions.assertThat(reassignments).isNotNull();
Assertions.assertThat(reassignments).hasSize(0);
reassignments = userTaskAdminService.getTaskReassignments(task.getId(), false);
Assertions.assertThat(reassignments).isNotNull();
Assertions.assertThat(reassignments).hasSize(1);
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class UserTaskAdminServiceImplTest method testRemoveOutputData.
@Test
public void testRemoveOutputData() {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
Assertions.assertThat(processInstanceId).isNotNull();
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
Assertions.assertThat(tasks).hasSize(1);
TaskSummary task = tasks.get(0);
Map<String, Object> output = new HashMap<>();
output.put("added-output", "draft");
userTaskService.saveContent(task.getId(), output);
Map<String, Object> outputData = userTaskService.getTaskOutputContentByTaskId(task.getId());
Assertions.assertThat(outputData).containsKey("added-output");
Assertions.assertThat(outputData.get("added-output")).isEqualTo("draft");
userTaskAdminService.removeTaskOutputs(task.getId(), "added-output");
outputData = userTaskService.getTaskOutputContentByTaskId(task.getId());
Assertions.assertThat(outputData).doesNotContainKey("added-output");
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class UserTaskAdminServiceImplTest method testRemoveBusinessAdmin.
@Test
public void testRemoveBusinessAdmin() {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
Assertions.assertThat(processInstanceId).isNotNull();
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsBusinessAdministrator("Administrator", new QueryFilter());
Assertions.assertThat(tasks).hasSize(1);
TaskSummary task = tasks.get(0);
userTaskAdminService.removeBusinessAdmins(task.getId(), factory.newUser("Administrator"));
List<TaskEvent> events = runtimeDataService.getTaskEvents(task.getId(), new QueryFilter());
Assertions.assertThat(events).hasSize(2);
TaskEvent updatedEvent = events.get(1);
Assertions.assertThat(updatedEvent.getMessage()).isEqualTo("Business administrators [Administrator] have been removed");
List<Status> readyStatuses = Arrays.asList(new Status[] { org.kie.api.task.model.Status.Ready });
tasks = runtimeDataService.getTasksAssignedAsBusinessAdministratorByStatus("Administrator", readyStatuses, new QueryFilter());
Assertions.assertThat(tasks).hasSize(0);
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class UserTaskAdminServiceImplTest method testReassignNotStarted.
@Test(timeout = 10000)
public void testReassignNotStarted() throws Exception {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
Assertions.assertThat(processInstanceId).isNotNull();
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
Assertions.assertThat(tasks).hasSize(1);
TaskSummary task = tasks.get(0);
userTaskAdminService.reassignWhenNotStarted(task.getId(), "2s", factory.newUser("john"));
CountDownListenerFactory.getExistingTask("userTaskAdminService").waitTillCompleted();
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
Assertions.assertThat(tasks).hasSize(0);
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("john", new QueryFilter());
Assertions.assertThat(tasks).hasSize(1);
}
Aggregations