use of org.kie.internal.query.QueryContext in project jbpm by kiegroup.
the class EGetProcessInstanceTest method getProcessInstancesByProcessDefinition.
@Test()
public void getProcessInstancesByProcessDefinition() {
startProcess("org.jboss.qa.bpms.HumanTask", new HashMap<>(), 3);
startProcess("org.jboss.qa.bpms.HumanTaskWithOwnType", new HashMap<>(), 5);
// Please note that this list contains all instances (RUNNING/COMPLETED/ABORTED) of the
// org.jboss.qa.bpms.HumanTask process definition. To make it contains all our instances
// we must filter through it first. See enhancement request BZ-1179004 for more detail.
QueryContext queryContext = new QueryContext(0, Integer.MAX_VALUE, "log.status", true);
List<ProcessInstanceDesc> allList = ejb.getProcessInstancesByProcessDefinition("org.jboss.qa.bpms.HumanTask", queryContext);
// Let's find our instances. We expect to find exactly 3 active instances. The exact number
// is ensured by the RemoteEjbClient.abortAllProcesses() method.
List<ProcessInstanceDesc> foundList = new ArrayList<>();
for (ProcessInstanceDesc processInstanceDesc : allList) {
if (processInstanceDesc.getState() == ProcessInstance.STATE_ACTIVE) {
foundList.add(processInstanceDesc);
}
}
Assertions.assertThat(foundList).hasSize(3);
for (ProcessInstanceDesc pid : foundList) {
Assertions.assertThat(pid.getProcessName()).isIn("HumanTask");
}
}
Aggregations