use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class ETaskOperationTest method testExecuteTaskOpStartAndComplete.
@Test()
public void testExecuteTaskOpStartAndComplete() {
ProcessInstance pi = startHumanTaskProcess(userId, userId + "'s task 1");
Long taskId = ejb.getTasksByProcessInstanceId(pi.getId()).get(0);
ejb.start(taskId, userId);
Task task = ejb.getTask(taskId);
Assertions.assertThat(task).isNotNull();
Assertions.assertThat(task.getTaskData().getStatus()).isEqualTo(Status.InProgress);
Map<String, Object> params = new HashMap<>();
params.put("userId", userId);
ejb.complete(taskId, userId, params);
ProcessInstanceDesc log = ejb.getProcessInstanceById(pi.getId());
Assertions.assertThat(log).isNotNull();
Assertions.assertThat(log.getState()).isEqualTo(ProcessInstance.STATE_COMPLETED);
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class ETaskOperationTest method testCompleteWorkItem.
/**
* This test must use another user because the task will remain in the database
* interfering with other tests. The task will not be deleted because the work item
* is accessed directly.
*/
@Test()
public void testCompleteWorkItem() {
ProcessInstance pi = startHumanTaskProcess("root", "Root's task 1");
Long taskId = ejb.getTasksByProcessInstanceId(pi.getId()).get(0);
Task task = ejb.getTask(taskId);
Assertions.assertThat(task).isNotNull();
ejb.completeWorkItem(task.getTaskData().getWorkItemId());
ProcessInstanceDesc log = ejb.getProcessInstanceById(pi.getId());
Assertions.assertThat(log).isNotNull();
Assertions.assertThat(log.getState()).isEqualTo(ProcessInstance.STATE_COMPLETED);
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class RemoteEjbTest method abortAllProcesses.
protected static void abortAllProcesses() {
List<Integer> stateList = new ArrayList<>();
stateList.add(ProcessInstance.STATE_ACTIVE);
QueryContext context = new QueryContext(0, Integer.MAX_VALUE, "log.status", true);
List<ProcessInstanceDesc> instanceDescList = ejb.getProcessInstances(stateList, null, context);
logger.info("Cleaning up ...");
logger.info("\tFound '" + instanceDescList.size() + "' active instances.");
for (ProcessInstanceDesc instanceDesc : instanceDescList) {
logger.info("\tAborting process instance with id '" + instanceDesc.getId() + "' of type '" + instanceDesc.getProcessId() + "'");
ejb.abortProcessInstance(instanceDesc.getId());
}
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class EProcessHistoryTest method testProcessInstanceLogsWithDefinitionId.
@Test
public void testProcessInstanceLogsWithDefinitionId() {
QueryContext queryContext = new QueryContext(0, Integer.MAX_VALUE);
int originalSize = ejb.getProcessInstancesByProcessDefinition(ProcessDefinitions.HUMAN_TASK, queryContext).size();
startProcess(ProcessDefinitions.SCRIPT_TASK, 3);
startProcess(ProcessDefinitions.HUMAN_TASK, 5);
Collection<ProcessInstanceDesc> logs = ejb.getProcessInstancesByProcessDefinition(ProcessDefinitions.HUMAN_TASK, queryContext);
Assertions.assertThat(logs).hasSize(originalSize + 5);
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class EProcessHistoryTest method testProcessInstanceLogWithInstanceId.
@Test
public void testProcessInstanceLogWithInstanceId() {
startProcess(ProcessDefinitions.HUMAN_TASK);
long pid2 = startProcess(ProcessDefinitions.SCRIPT_TASK);
ProcessInstanceDesc log = ejb.getProcessInstanceById(pid2);
Assertions.assertThat(log.getId()).isEqualTo(pid2);
Assertions.assertThat(log.getProcessId()).isEqualTo(ProcessDefinitions.SCRIPT_TASK);
}
Aggregations