use of org.activiti.api.runtime.model.impl.BPMNSignalImpl 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.runtime.model.impl.BPMNSignalImpl in project Activiti by Activiti.
the class ToSignalReceivedConverterTest method fromShouldReturnConvertedEventAndSetProcessInstanceIdAndProcessDefinitionId.
@Test
public void fromShouldReturnConvertedEventAndSetProcessInstanceIdAndProcessDefinitionId() {
// given
ActivitiSignalEventImpl internalEvent = new ActivitiSignalEventImpl(ActivitiEventType.ACTIVITY_SIGNALED);
internalEvent.setProcessDefinitionId("procDefId");
internalEvent.setProcessInstanceId("procInstId");
BPMNSignalImpl bpmnSignal = new BPMNSignalImpl();
given(toSignalConverter.from(internalEvent)).willReturn(bpmnSignal);
// when
BPMNSignalReceivedEvent bpmnSignalReceivedEvent = toSignalReceivedConverter.from(internalEvent).orElse(null);
// then
assertThat(bpmnSignalReceivedEvent).isNotNull();
assertThat(bpmnSignalReceivedEvent.getEntity()).isEqualTo(bpmnSignal);
assertThat(bpmnSignalReceivedEvent.getProcessDefinitionId()).isEqualTo("procDefId");
assertThat(bpmnSignalReceivedEvent.getProcessInstanceId()).isEqualTo("procInstId");
}
Aggregations