use of org.activiti.api.process.model.events.BPMNSignalReceivedEvent in project Activiti by Activiti.
the class ProcessRuntimeBPMNSignalReceivedIT method shouldGetOneSignalReceivedEventPerWaitingSignalsForNonStartSignals.
@Test
public void shouldGetOneSignalReceivedEventPerWaitingSignalsForNonStartSignals() {
// given
securityUtil.logInAs("user");
ProcessInstance boundarySignalProcInst1 = processRuntime.start(ProcessPayloadBuilder.start().withProcessDefinitionKey(PROCESS_WITH_BOUNDARY_SIGNAL).build());
ProcessInstance boundarySignalProcInst2 = processRuntime.start(ProcessPayloadBuilder.start().withProcessDefinitionKey(PROCESS_WITH_BOUNDARY_SIGNAL).build());
// when
ProcessInstance process = processRuntime.start(ProcessPayloadBuilder.start().withProcessDefinitionKey("signalThrowEventProcess").build());
// then
assertThat(listener.getSignalReceivedEvents()).isNotEmpty().hasSize(2);
assertThat(listener.getSignalReceivedEvents()).extracting(BPMNSignalReceivedEvent::getEventType, BPMNSignalReceivedEvent::getProcessDefinitionId, BPMNSignalReceivedEvent::getProcessInstanceId, event -> event.getEntity().getSignalPayload().getName(), event -> event.getEntity().getElementId(), event -> event.getEntity().getProcessDefinitionId(), event -> event.getEntity().getProcessInstanceId()).contains(tuple(BPMNSignalEvent.SignalEvents.SIGNAL_RECEIVED, boundarySignalProcInst1.getProcessDefinitionId(), boundarySignalProcInst1.getId(), "go", "sid-6220E76D-719E-4C05-A664-BC186E50D477", boundarySignalProcInst1.getProcessDefinitionId(), boundarySignalProcInst1.getId()), tuple(BPMNSignalEvent.SignalEvents.SIGNAL_RECEIVED, boundarySignalProcInst2.getProcessDefinitionId(), boundarySignalProcInst2.getId(), "go", "sid-6220E76D-719E-4C05-A664-BC186E50D477", boundarySignalProcInst2.getProcessDefinitionId(), boundarySignalProcInst2.getId()));
assertThat(process.getStatus()).isEqualTo(ProcessInstanceStatus.COMPLETED);
}
use of org.activiti.api.process.model.events.BPMNSignalReceivedEvent 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