use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class EProcessHistoryTest method testAllProcessInstanceLogs.
@Test
public void testAllProcessInstanceLogs() {
QueryContext queryContext = new QueryContext(0, Integer.MAX_VALUE);
List<ProcessInstanceDesc> logs = ejb.getProcessInstances(queryContext);
int originalSize = logs.size();
startProcess(ProcessDefinitions.SCRIPT_TASK, 4);
startProcess(ProcessDefinitions.HUMAN_TASK, 3);
logs = ejb.getProcessInstances(queryContext);
Assertions.assertThat(logs).hasSize(originalSize + 4 + 3);
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class EEndProcessInstanceTest method testAbortProcessInstance.
@Test()
public void testAbortProcessInstance() {
long pid = ejb.startProcessSimple(ProcessDefinitions.SIGNAL);
ejb.abortProcessInstance(pid);
ProcessInstanceDesc log = ejb.getProcessInstanceById(pid);
Assertions.assertThat(log).isNotNull();
Assertions.assertThat(log.getState().intValue()).isEqualTo(ProcessInstance.STATE_ABORTED);
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class EGetProcessInstanceTest method getProcessInstancesByProcessName.
@Test()
public void getProcessInstancesByProcessName() {
startProcess("org.jboss.qa.bpms.HumanTask", new HashMap<>(), 3);
startProcess("org.jboss.qa.bpms.HumanTaskWithOwnType", new HashMap<>(), 5);
List<Integer> states = new ArrayList<>();
states.add(ProcessInstance.STATE_ACTIVE);
List<ProcessInstanceDesc> foundList = ejb.getProcessInstancesByProcessName(states, "HumanTask", null, new QueryContext());
Assertions.assertThat(foundList).hasSize(3);
for (ProcessInstanceDesc pid : foundList) {
Assertions.assertThat(pid.getProcessName()).isEqualTo("HumanTask");
Assertions.assertThat(pid.getProcessId()).isEqualTo("org.jboss.qa.bpms.HumanTask");
}
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class ESignalProcessInstanceTest method testSignalProcessInstance.
@Test()
public void testSignalProcessInstance() {
long processInstanceId1 = ejb.startProcessSimple(ProcessDefinitions.SIGNAL);
long processInstanceId2 = ejb.startProcessSimple(ProcessDefinitions.SIGNAL);
List<String> signals = ejb.getAvailableSignals(processInstanceId1);
Assertions.assertThat(signals).isNotNull();
Assertions.assertThat(signals.size()).isEqualTo(1);
Assertions.assertThat(signals.get(0)).isEqualTo("MySignal");
ejb.signalProcessInstance(processInstanceId1, "MySignal", "Hello World!!");
ProcessInstanceDesc log = ejb.getProcessInstanceById(processInstanceId1);
Assertions.assertThat(log).isNotNull();
Assertions.assertThat(log.getState().intValue()).isEqualTo(ProcessInstance.STATE_COMPLETED);
log = ejb.getProcessInstanceById(processInstanceId2);
Assertions.assertThat(log).isNotNull();
Assertions.assertThat(log.getState().intValue()).isEqualTo(ProcessInstance.STATE_ACTIVE);
ejb.signalProcessInstance(processInstanceId2, "MySignal", "Hello World!!");
log = ejb.getProcessInstanceById(processInstanceId2);
Assertions.assertThat(log).isNotNull();
Assertions.assertThat(log.getState().intValue()).isEqualTo(ProcessInstance.STATE_COMPLETED);
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class RuntimeDataServiceImplTest method testGetTasksAssignedAsPotentialOwnerSortedByAlias.
@Test
public void testGetTasksAssignedAsPotentialOwnerSortedByAlias() {
List<Long> processInstanceIds = new ArrayList<Long>();
for (int i = 0; i < 10; i++) {
processInstanceIds.add(processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument"));
}
List<Status> statuses = new ArrayList<Status>();
statuses.add(Status.Ready);
statuses.add(Status.Reserved);
QueryFilter ctx = new QueryFilter(0, 5, "Status", true);
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwnerByStatus("salaboy", statuses, ctx);
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());
}
}
Aggregations