Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ protected void handleSignalEventSubscription(EventDefinition eventDefinition, St
BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(parentExecution.getProcessDefinitionId());
Signal signal = bpmnModel.getSignal(signalEventDefinition.getSignalRef());
if (signal != null) {
signalEventDefinition.setSignalRef(signal.getName());
signalEventDefinition.setSignalRef(signal.getId());
}

ExecutionEntity signalExecution = processEngineConfiguration.getExecutionEntityManager().createChildExecution(parentExecution);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
import static org.assertj.core.api.Assertions.tuple;
import static org.assertj.core.data.MapEntry.entry;

import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


import org.assertj.core.groups.Tuple;
import org.flowable.common.engine.api.FlowableException;
Expand All @@ -43,12 +39,48 @@
import org.flowable.validation.validator.Problems;
import org.junit.jupiter.api.Test;

import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.Arrays;
import java.util.Date;


/**
* @author Tijs Rademakers
* @author Joram Barrez
*/
public class SignalEventTest extends PluggableFlowableTestCase {


@Test
@Deployment(resources = {"org/flowable/engine/test/bpmn/event/signal/mainProcessV2.bpmn"})
public void testSignalScope_WhenSignalIdNotEqualSignalName_GivenMultipleProcessInstances() {

List<ProcessInstance> processInstances = new ArrayList<>();
processInstances.add(runtimeService.startProcessInstanceByKey("mainProcess"));
processInstances.add(runtimeService.startProcessInstanceByKey("mainProcess"));
processInstances.add(runtimeService.startProcessInstanceByKey("mainProcess"));

List<EventSubscription> currentSubscriptionList = runtimeService.createEventSubscriptionQuery().list();

assertThat(currentSubscriptionList).hasSize(processInstances.size());
assertThat(currentSubscriptionList).extracting(EventSubscription::getConfiguration).doesNotContainNull();
}

@Test
@Deployment(resources = {"org/flowable/engine/test/bpmn/event/signal/mainProcessV2.bpmn"})
public void testSignalScope_WhenSignalIdNotEqualSignalName_GivenSingleProcessInstance() {

ProcessInstance processInstances = runtimeService.startProcessInstanceByKey("mainProcess");

List<EventSubscription> currentSubscriptionList = runtimeService.createEventSubscriptionQuery().list();

assertThat(currentSubscriptionList).hasSize(1);
assertThat(currentSubscriptionList).extracting(EventSubscription::getConfiguration).doesNotContainNull();
}

@Test
@Deployment(resources = { "org/flowable/engine/test/bpmn/event/signal/SignalEventTests.catchAlertSignal.bpmn20.xml",
"org/flowable/engine/test/bpmn/event/signal/SignalEventTests.throwAlertSignal.bpmn20.xml" })
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:design="http://flowable.org/design" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://flowable.org/test" exporter="Flowable Design" design:palette="flowable-work-process-palette">
<signal id="mainProcessGlobalSignal" name="mainProcessGlobalSignalName" flowable:scope="global"></signal>
<process id="mainProcess" name="mainProcess" isExecutable="true" flowable:candidateStarterGroups="flowableUser">
<extensionElements>
<design:stencilid><![CDATA[BPMNDiagram]]></design:stencilid>
<design:creationdate><![CDATA[2025-08-12T09:27:27.224Z]]></design:creationdate>
<design:modificationdate><![CDATA[2025-08-12T09:33:31.923Z]]></design:modificationdate>
</extensionElements>
<subProcess id="EventSubprocess_7" name="Event-subprocess" triggeredByEvent="true">
<extensionElements>
<design:stencilid><![CDATA[EventSubprocess]]></design:stencilid>
</extensionElements>
<userTask id="FormTask_9" name="subProcessStarted" flowable:assignee="${initiator}" flowable:formFieldValidation="false">
<extensionElements>
<flowable:task-candidates-type><![CDATA[all]]></flowable:task-candidates-type>
<design:stencilid><![CDATA[FormTask]]></design:stencilid>
<design:stencilsuperid><![CDATA[Task]]></design:stencilsuperid>
</extensionElements>
</userTask>
<startEvent id="StartSignalEvent_8" isInterrupting="false">
<extensionElements>
<flowable:work-form-field-validation><![CDATA[false]]></flowable:work-form-field-validation>
<design:stencilid><![CDATA[StartSignalEvent]]></design:stencilid>
</extensionElements>
<signalEventDefinition signalRef="mainProcessGlobalSignal"></signalEventDefinition>
</startEvent>
<endEvent id="EndNoneEvent_11">
<extensionElements>
<design:stencilid><![CDATA[EndNoneEvent]]></design:stencilid>
</extensionElements>
</endEvent>
<sequenceFlow id="SequenceFlow_12" sourceRef="FormTask_9" targetRef="EndNoneEvent_11">
<extensionElements>
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid>
</extensionElements>
</sequenceFlow>
<sequenceFlow id="SequenceFlow_10" sourceRef="StartSignalEvent_8" targetRef="FormTask_9">
<extensionElements>
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid>
</extensionElements>
</sequenceFlow>
</subProcess>
<userTask id="FormTask_1" name="send signal" flowable:assignee="${initiator}" flowable:formFieldValidation="false">
<extensionElements>
<flowable:task-candidates-type><![CDATA[all]]></flowable:task-candidates-type>
<design:stencilid><![CDATA[FormTask]]></design:stencilid>
<design:stencilsuperid><![CDATA[Task]]></design:stencilsuperid>
</extensionElements>
</userTask>
<startEvent id="startnoneevent1" flowable:initiator="initiator" flowable:formFieldValidation="false">
<extensionElements>
<flowable:work-form-field-validation><![CDATA[false]]></flowable:work-form-field-validation>
<design:stencilid><![CDATA[StartNoneEvent]]></design:stencilid>
</extensionElements>
</startEvent>
<intermediateThrowEvent id="IntermediateSignalEventThrowing_3">
<extensionElements>
<design:stencilid><![CDATA[IntermediateSignalEventThrowing]]></design:stencilid>
</extensionElements>
<signalEventDefinition signalRef="mainProcessGlobalSignal"></signalEventDefinition>
</intermediateThrowEvent>
<endEvent id="EndNoneEvent_5">
<extensionElements>
<design:stencilid><![CDATA[EndNoneEvent]]></design:stencilid>
</extensionElements>
</endEvent>
<sequenceFlow id="SequenceFlow_4" sourceRef="FormTask_1" targetRef="IntermediateSignalEventThrowing_3">
<extensionElements>
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid>
</extensionElements>
</sequenceFlow>
<sequenceFlow id="SequenceFlow_2" sourceRef="startnoneevent1" targetRef="FormTask_1">
<extensionElements>
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid>
</extensionElements>
</sequenceFlow>
<sequenceFlow id="SequenceFlow_6" sourceRef="IntermediateSignalEventThrowing_3" targetRef="EndNoneEvent_5">
<extensionElements>
<design:stencilid><![CDATA[SequenceFlow]]></design:stencilid>
</extensionElements>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_mainProcess">
<bpmndi:BPMNPlane bpmnElement="mainProcess" id="BPMNPlane_mainProcess">
<bpmndi:BPMNShape bpmnElement="EventSubprocess_7" id="BPMNShape_EventSubprocess_7">
<omgdc:Bounds height="152.0" width="499.0" x="255.0" y="485.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="FormTask_9" id="BPMNShape_FormTask_9">
<omgdc:Bounds height="80.0" width="100.0" x="368.0" y="531.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="StartSignalEvent_8" id="BPMNShape_StartSignalEvent_8">
<omgdc:Bounds height="30.0" width="30.0" x="288.0" y="556.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="EndNoneEvent_11" id="BPMNShape_EndNoneEvent_11">
<omgdc:Bounds height="28.0" width="28.0" x="518.0" y="557.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="FormTask_1" id="BPMNShape_FormTask_1">
<omgdc:Bounds height="80.0" width="100.0" x="401.0" y="236.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="startnoneevent1" id="BPMNShape_startnoneevent1">
<omgdc:Bounds height="30.0" width="30.0" x="317.0" y="261.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="IntermediateSignalEventThrowing_3" id="BPMNShape_IntermediateSignalEventThrowing_3">
<omgdc:Bounds height="30.0" width="30.0" x="554.0" y="261.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="EndNoneEvent_5" id="BPMNShape_EndNoneEvent_5">
<omgdc:Bounds height="28.0" width="28.0" x="635.0" y="262.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_12" id="BPMNEdge_SequenceFlow_12" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">
<omgdi:waypoint x="468.0" y="571.0"></omgdi:waypoint>
<omgdi:waypoint x="518.0" y="571.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_6" id="BPMNEdge_SequenceFlow_6" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">
<omgdi:waypoint x="584.0" y="276.0"></omgdi:waypoint>
<omgdi:waypoint x="635.0" y="276.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_4" id="BPMNEdge_SequenceFlow_4" flowable:sourceDockerX="50.0" flowable:sourceDockerY="40.0" flowable:targetDockerX="15.0" flowable:targetDockerY="15.0">
<omgdi:waypoint x="501.0" y="276.0"></omgdi:waypoint>
<omgdi:waypoint x="554.0" y="276.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_10" id="BPMNEdge_SequenceFlow_10" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
<omgdi:waypoint x="318.0" y="571.0"></omgdi:waypoint>
<omgdi:waypoint x="368.0" y="571.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_2" id="BPMNEdge_SequenceFlow_2" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="50.0" flowable:targetDockerY="40.0">
<omgdi:waypoint x="347.0" y="276.0"></omgdi:waypoint>
<omgdi:waypoint x="401.0" y="276.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>