use of org.activiti.api.runtime.shared.query.Page in project Activiti by Activiti.
the class TaskRuntimeMultiInstanceIT method processWithParallelMultiInstancesOn_CallActivity_Boundary_Event.
@Test
public void processWithParallelMultiInstancesOn_CallActivity_Boundary_Event() {
ProcessInstance parentProcessInstance = processBaseRuntime.startProcessWithProcessDefinitionKey("miParallelCallActivityBoundaryEvent");
final Page<ProcessInstance> childrenProcessInstances = processBaseRuntime.getChildrenProcessInstances(parentProcessInstance.getId());
assertThat(childrenProcessInstances.getContent()).hasSize(2);
assertThat(localEventSource.getEvents(ProcessStartedEvent.class)).extracting(RuntimeEvent::getEventType, event -> event.getEntity().getId(), event -> event.getEntity().getParentId()).containsExactlyInAnyOrder(tuple(ProcessRuntimeEvent.ProcessEvents.PROCESS_STARTED, parentProcessInstance.getId(), null), tuple(ProcessRuntimeEvent.ProcessEvents.PROCESS_STARTED, childrenProcessInstances.getContent().get(0).getId(), parentProcessInstance.getId()), tuple(ProcessRuntimeEvent.ProcessEvents.PROCESS_STARTED, childrenProcessInstances.getContent().get(1).getId(), parentProcessInstance.getId()));
assertActivityEvents("miCallActivity", BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED, BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED);
assertThat(localEventSource.getTaskEvents()).extracting(RuntimeEvent::getEventType, event -> ((Task) event.getEntity()).getName(), event -> ((Task) event.getEntity()).getProcessInstanceId()).containsExactlyInAnyOrder(tuple(TaskRuntimeEvent.TaskEvents.TASK_CREATED, "User Task", childrenProcessInstances.getContent().get(0).getId()), tuple(TaskRuntimeEvent.TaskEvents.TASK_CREATED, "User Task", childrenProcessInstances.getContent().get(1).getId()), tuple(TaskRuntimeEvent.TaskEvents.TASK_ASSIGNED, "User Task", childrenProcessInstances.getContent().get(0).getId()), tuple(TaskRuntimeEvent.TaskEvents.TASK_ASSIGNED, "User Task", childrenProcessInstances.getContent().get(1).getId()));
assertThat(localEventSource.getEvents(ProcessCompletedEvent.class)).isEmpty();
// when
localEventSource.clearEvents();
processBaseRuntime.signal("goMiParallelCallActivityBoundaryEvent");
// then
assertThat(localEventSource.getTaskEvents()).extracting(RuntimeEvent::getEventType, event -> ((Task) event.getEntity()).getName(), event -> ((Task) event.getEntity()).getProcessInstanceId()).containsExactlyInAnyOrder(tuple(TaskRuntimeEvent.TaskEvents.TASK_CANCELLED, "User Task", childrenProcessInstances.getContent().get(0).getId()), tuple(TaskRuntimeEvent.TaskEvents.TASK_CANCELLED, "User Task", childrenProcessInstances.getContent().get(1).getId()), tuple(TaskRuntimeEvent.TaskEvents.TASK_CREATED, "Escalation Task", parentProcessInstance.getId()), tuple(TaskRuntimeEvent.TaskEvents.TASK_ASSIGNED, "Escalation Task", parentProcessInstance.getId()));
assertActivityEvents("miCallActivity", BPMNActivityEvent.ActivityEvents.ACTIVITY_CANCELLED, BPMNActivityEvent.ActivityEvents.ACTIVITY_CANCELLED);
assertThat(localEventSource.getProcessInstanceEvents()).extracting(RuntimeEvent::getEventType, event -> ((ProcessInstance) event.getEntity()).getId()).containsExactlyInAnyOrder(tuple(ProcessRuntimeEvent.ProcessEvents.PROCESS_CANCELLED, childrenProcessInstances.getContent().get(0).getId()), tuple(ProcessRuntimeEvent.ProcessEvents.PROCESS_CANCELLED, childrenProcessInstances.getContent().get(1).getId()));
List<Task> tasks = taskBaseRuntime.getTasks(parentProcessInstance);
assertThat(tasks.size()).isEqualTo(1);
assertThat(tasks).extracting(Task::getName).contains("Escalation Task");
localEventSource.clearEvents();
taskBaseRuntime.completeTask(tasks.get(0));
assertThat(taskBaseRuntime.getTasks(parentProcessInstance)).isEmpty();
assertThat(localEventSource.getProcessInstanceEvents()).extracting(RuntimeEvent::getEventType, RuntimeEvent::getProcessInstanceId).containsExactly(tuple(ProcessRuntimeEvent.ProcessEvents.PROCESS_COMPLETED, parentProcessInstance.getId()));
}
use of org.activiti.api.runtime.shared.query.Page in project Activiti by Activiti.
the class ProcessRuntimeIT method should_processDefinitionAlwaysHaveAppVersion.
@Test
public void should_processDefinitionAlwaysHaveAppVersion() {
Page<ProcessDefinition> processDefinitionPage = processRuntime.processDefinitions(PAGEABLE);
assertThat(processDefinitionPage.getContent()).isNotEmpty();
List<ProcessDefinition> processDefinitions = processDefinitionPage.getContent().stream().filter(c -> c.getKey().equals(SUPER_PROCESS)).collect(Collectors.toList());
assertThat(processDefinitions).hasSize(1);
ProcessDefinition result = processDefinitions.get(0);
assertThat(result.getAppVersion()).isEqualTo("1");
}
use of org.activiti.api.runtime.shared.query.Page in project Activiti by Activiti.
the class ProcessRuntimeBPMNSignalReceivedIT method shouldGetSignalReceivedEventsForProcessWithSignalStart.
@Test
public void shouldGetSignalReceivedEventsForProcessWithSignalStart() {
// In this test processWithSignalStart1 should be started
// given
securityUtil.logInAs("user");
Page<ProcessDefinition> processDefinitionPage = processRuntime.processDefinitions(Pageable.of(0, 10), ProcessPayloadBuilder.processDefinitions().withProcessDefinitionKey("processWithSignalStart1").build());
assertThat(processDefinitionPage.getContent()).hasSize(1);
// when
SignalPayload signalPayload = new SignalPayload("The Signal", null);
processRuntime.signal(signalPayload);
// then
String processDefinitionId = processDefinitionPage.getContent().get(0).getId();
assertThat(listener.getSignalReceivedEvents()).extracting(BPMNSignalReceivedEvent::getEventType, BPMNSignalReceivedEvent::getProcessDefinitionId, event -> event.getEntity().getSignalPayload().getName(), event -> event.getEntity().getElementId(), event -> event.getEntity().getProcessDefinitionId()).contains(Tuple.tuple(BPMNSignalEvent.SignalEvents.SIGNAL_RECEIVED, processDefinitionId, "The Signal", "theStart", processDefinitionId));
}
Aggregations