use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class HumanTaskQueryFilterTest method testDescendingOrder.
@Test
public void testDescendingOrder() {
startHumanTaskProcess(3, "john's task", "john");
List<TaskSummary> taskList = taskService.getTasksAssignedAsPotentialOwner("john", null, null, new QueryFilter(0, 0, "t.name", false));
logger.debug("### Potential owner task list: " + taskList);
Assertions.assertThat(taskList).hasSize(3);
for (int i = 0; i < taskList.size(); i++) {
logger.debug("### Task Name: " + taskList.get(i).getName());
Assertions.assertThat(taskList.get(i).getName()).isEqualTo("john's task " + (3 - i));
}
abortHumanTaskProcess(3);
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class HumanTaskQueryFilterTest method testSingleResult.
@Test
@BZ("1132145")
public void testSingleResult() {
startHumanTaskProcess(4, "john's task", "john");
List<TaskSummary> taskList = taskService.getTasksAssignedAsPotentialOwner("john", null, null, new QueryFilter(0, 0));
logger.debug("### Potential owner task list: " + taskList);
Assertions.assertThat(taskList).hasSize(1);
abortHumanTaskProcess(4);
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class RuntimeDataServiceEJBIntegrationTest method testGetTaskAssignedAsBusinessAdmin.
@Test
public void testGetTaskAssignedAsBusinessAdmin() {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
processService.getProcessInstance(processInstanceId);
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsBusinessAdministrator("Administrator", new QueryFilter(0, 5));
assertNotNull(tasks);
assertEquals(1, tasks.size());
TaskSummary userTask = tasks.get(0);
assertNotNull(userTask);
assertEquals(processInstanceId, userTask.getProcessInstanceId());
assertEquals("Write a Document", userTask.getName());
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class RuntimeDataServiceEJBIntegrationTest method testGetTasksAssignedAsPotentialOwnerByStatusPagingAndFiltering.
@Test
public void testGetTasksAssignedAsPotentialOwnerByStatusPagingAndFiltering() {
List<Long> processInstanceIds = new ArrayList<Long>();
for (int i = 0; i < 10; i++) {
processInstanceIds.add(processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument"));
}
Map<String, Object> params = new HashMap<String, Object>();
params.put("processInstanceId", processInstanceIds);
QueryFilter qf = new QueryFilter("t.taskData.processInstanceId in (:processInstanceId)", params, "t.id", false);
qf.setOffset(0);
qf.setCount(5);
List<Status> statuses = new ArrayList<Status>();
statuses.add(Status.Ready);
statuses.add(Status.Reserved);
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwnerByStatus("salaboy", statuses, qf);
assertNotNull(tasks);
assertEquals(5, tasks.size());
TaskSummary userTask = tasks.get(0);
assertNotNull(userTask);
assertEquals("Write a Document", userTask.getName());
Collection<ProcessInstanceDesc> activeProcesses = runtimeDataService.getProcessInstances(new QueryContext(0, 20));
for (ProcessInstanceDesc pi : activeProcesses) {
processService.abortProcessInstance(pi.getId());
}
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class ClientProcessServiceWithCustomDataEJBTest method testStartProcessWithCustomData.
@Test
public void testStartProcessWithCustomData() {
assertNotNull(deploymentService);
KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
Map<String, Object> parameters = new RemoteMap();
Object person = getInstance("org.jbpm.test.Person", new Object[] { "john", 25, true });
parameters.put("person", person);
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "custom-data-project.work-on-custom-data", parameters);
assertNotNull(processInstanceId);
List<TaskSummary> taskSummaries = runtimeDataService.getTasksAssignedAsPotentialOwner("john", new QueryFilter(0, 10));
assertNotNull(taskSummaries);
assertEquals(1, taskSummaries.size());
List<Long> tasks = runtimeDataService.getTasksByProcessInstanceId(processInstanceId);
assertNotNull(tasks);
assertEquals(1, tasks.size());
Long taskId = tasks.get(0);
userTaskService.start(taskId, "john");
Map<String, Object> data = userTaskService.getTaskInputContentByTaskId(taskId);
assertNotNull(data);
Object fromTaskPerson = data.get("_person");
assertNotNull(fromTaskPerson);
assertEquals("john", getFieldValue(fromTaskPerson, "name"));
setFieldValue(fromTaskPerson, "name", "John Doe");
RemoteMap outcome = new RemoteMap();
outcome.put("person_", fromTaskPerson);
userTaskService.complete(taskId, "john", outcome);
ProcessInstanceDesc desc = runtimeDataService.getProcessInstanceById(processInstanceId);
assertNotNull(desc);
assertEquals(2, (int) desc.getState());
processInstanceId = null;
}
Aggregations