use of org.activiti.api.process.model.payloads.SignalPayload in project Activiti by Activiti.
the class ProcessRuntimeIT method signalAdmin.
@Test
public void signalAdmin() {
// when
SignalPayload signalPayload = new SignalPayload("The Signal", null);
processAdminRuntimeMock.signal(signalPayload);
verify(eventPublisher).publishEvent(signalPayload);
Page<ProcessInstance> processInstancePage = processAdminRuntimeMock.processInstances(PAGEABLE);
// then
assertThat(processInstancePage).isNotNull();
assertThat(processInstancePage.getContent()).hasSize(1);
assertThat(processInstancePage.getContent().get(0).getProcessDefinitionKey()).isEqualTo("processWithSignalStart1");
processAdminRuntimeMock.delete(ProcessPayloadBuilder.delete(processInstancePage.getContent().get(0).getId()));
}
use of org.activiti.api.process.model.payloads.SignalPayload in project Activiti by Activiti.
the class ToSignalConverter method from.
@SuppressWarnings("unchecked")
public BPMNSignal from(ActivitiSignalEvent internalEvent) {
BPMNSignalImpl signal = new BPMNSignalImpl(internalEvent.getActivityId());
signal.setProcessDefinitionId(internalEvent.getProcessDefinitionId());
signal.setProcessInstanceId(internalEvent.getProcessInstanceId());
SignalPayload signalPayload = ProcessPayloadBuilder.signal().withName(internalEvent.getSignalName()).build();
if (internalEvent.getSignalData() != null) {
Map<String, Object> sourceVariables = (Map<String, Object>) internalEvent.getSignalData();
signalPayload.setVariables(new HashMap<>(sourceVariables));
}
signal.setSignalPayload(signalPayload);
return signal;
}
use of org.activiti.api.process.model.payloads.SignalPayload 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