use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class EGetTaskTest method testTaskQueryWithPageSize.
@Test()
public void testTaskQueryWithPageSize() {
startProcess(ProcessDefinitions.HUMAN_TASK, 5);
List<TaskSummary> ts = ejb.getTasksAssignedAsPotentialOwner(userId, new QueryFilter(0, 2));
Assertions.assertThat(ts.size()).isEqualTo(2);
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class ETransactionTest method startAndCompleteHumanTask.
private List<TaskSummary> startAndCompleteHumanTask(Long processInstanceId) {
List<TaskSummary> taskSummaries = runtimeDataService.getTasksAssignedAsPotentialOwner("john", new QueryFilter());
Assertions.assertThat(taskSummaries).isNotNull().hasSize(1);
long taskId = taskSummaries.get(0).getId();
userTaskService.start(taskId, "john");
userTaskService.complete(taskId, "john", new HashMap<String, Object>());
Assertions.assertThat(hasNodeLeft(processInstanceId, "User Task")).isTrue();
Assertions.assertThat(hasTaskCompleted(taskId));
return taskSummaries;
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class ETaskQueryFilterTest method testAscendingOrder.
@Test
public void testAscendingOrder() {
startHumanTaskProcess(3, "john's task", "john");
List<TaskSummary> taskList = ejb.getTasksAssignedAsPotentialOwner("john", null, null, new QueryFilter(0, 0, "t.name", true));
logger.info("### Potential owner task list: " + taskList);
Assertions.assertThat(taskList).hasSize(3);
for (int i = 0; i < taskList.size(); i++) {
logger.info("### Task Name: " + taskList.get(i).getName());
Assertions.assertThat(taskList.get(i).getName()).isEqualTo("john's task " + (i + 1));
}
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class ETaskQueryFilterTest method testMaxResults.
@Test
public void testMaxResults() {
startHumanTaskProcess(4, "john's task", "john");
List<TaskSummary> taskList = ejb.getTasksAssignedAsPotentialOwner("john", null, null, new QueryFilter(0, 2, "t.id", true));
logger.info("### Potential owner task list: " + taskList);
Assertions.assertThat(taskList).hasSize(2);
taskList = ejb.getTasksOwned("john", new QueryFilter(0, 1, null, "en-UK", null));
logger.info("### Owned task list: " + taskList);
Assertions.assertThat(taskList.size()).isEqualTo(1);
}
use of org.kie.internal.query.QueryFilter in project jbpm by kiegroup.
the class RuntimeDataServiceImplTest method testGetTasksByVariable.
@Test
public void testGetTasksByVariable() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("approval_document", "initial content");
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument", params);
assertNotNull(processInstanceId);
List<Status> statuses = new ArrayList<Status>();
statuses.add(Status.Ready);
statuses.add(Status.Reserved);
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwnerByStatus("salaboy", statuses, new QueryFilter());
assertNotNull(tasks);
assertEquals(1, tasks.size());
String userId = "salaboy";
String varName = "Comment";
List<TaskSummary> tasksByVariable = runtimeDataService.getTasksByVariable(userId, varName, statuses, new QueryContext());
assertNotNull(tasksByVariable);
assertEquals(1, tasksByVariable.size());
varName = "ReviewComment";
tasksByVariable = runtimeDataService.getTasksByVariable(userId, varName, statuses, new QueryContext());
assertNotNull(tasksByVariable);
assertEquals(0, tasksByVariable.size());
long taskId = tasks.get(0).getId();
Map<String, Object> output = new HashMap<String, Object>();
output.put("ReviewComment", "document reviewed");
userTaskService.saveContent(taskId, output);
tasksByVariable = runtimeDataService.getTasksByVariable(userId, varName, statuses, new QueryContext());
assertNotNull(tasksByVariable);
assertEquals(1, tasksByVariable.size());
processService.abortProcessInstance(processInstanceId);
processInstanceId = null;
}
Aggregations