Skip to content

Commit 05764f6

Browse files
sombreknikku
authored andcommitted
fix: continue beyond empty subprocesses
Closes #135
1 parent d766b16 commit 05764f6

File tree

4 files changed

+189
-0
lines changed

4 files changed

+189
-0
lines changed

lib/simulator/behaviors/SubProcessBehavior.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ SubProcessBehavior.prototype._start = function(context) {
121121
});
122122
}
123123
}
124+
125+
if (!startNodes.length) {
126+
this._simulator.exit(context);
127+
}
124128
};
125129

126130
SubProcessBehavior.prototype._findStarts = function(element, startEvent) {
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_18b3zn3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.31.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.6.0">
3+
<bpmn:process id="Process_186nk6c" isExecutable="true">
4+
<bpmn:startEvent id="StartEvent_1">
5+
<bpmn:outgoing>Flow_1</bpmn:outgoing>
6+
</bpmn:startEvent>
7+
<bpmn:sequenceFlow id="Flow_6" sourceRef="TransactionExpanded" targetRef="AdHocExpanded" />
8+
<bpmn:transaction id="TransactionExpanded">
9+
<bpmn:incoming>Flow_5</bpmn:incoming>
10+
<bpmn:outgoing>Flow_6</bpmn:outgoing>
11+
</bpmn:transaction>
12+
<bpmn:adHocSubProcess id="AdHocExpanded">
13+
<bpmn:incoming>Flow_6</bpmn:incoming>
14+
<bpmn:outgoing>Flow_7</bpmn:outgoing>
15+
</bpmn:adHocSubProcess>
16+
<bpmn:endEvent id="EndEvent_1">
17+
<bpmn:incoming>Flow_7</bpmn:incoming>
18+
</bpmn:endEvent>
19+
<bpmn:sequenceFlow id="Flow_7" sourceRef="AdHocExpanded" targetRef="EndEvent_1" />
20+
<bpmn:subProcess id="EmbeddedExpanded">
21+
<bpmn:incoming>Flow_4</bpmn:incoming>
22+
<bpmn:outgoing>Flow_5</bpmn:outgoing>
23+
</bpmn:subProcess>
24+
<bpmn:sequenceFlow id="Flow_5" sourceRef="EmbeddedExpanded" targetRef="TransactionExpanded" />
25+
<bpmn:adHocSubProcess id="AdHocCollapsed">
26+
<bpmn:incoming>Flow_3</bpmn:incoming>
27+
<bpmn:outgoing>Flow_4</bpmn:outgoing>
28+
</bpmn:adHocSubProcess>
29+
<bpmn:transaction id="TransactionCollapsed">
30+
<bpmn:incoming>Flow_2</bpmn:incoming>
31+
<bpmn:outgoing>Flow_3</bpmn:outgoing>
32+
</bpmn:transaction>
33+
<bpmn:subProcess id="EmbeddedCollapsed">
34+
<bpmn:incoming>Flow_1</bpmn:incoming>
35+
<bpmn:outgoing>Flow_2</bpmn:outgoing>
36+
</bpmn:subProcess>
37+
<bpmn:sequenceFlow id="Flow_1" sourceRef="StartEvent_1" targetRef="EmbeddedCollapsed" />
38+
<bpmn:sequenceFlow id="Flow_4" sourceRef="AdHocCollapsed" targetRef="EmbeddedExpanded" />
39+
<bpmn:sequenceFlow id="Flow_3" sourceRef="TransactionCollapsed" targetRef="AdHocCollapsed" />
40+
<bpmn:sequenceFlow id="Flow_2" sourceRef="EmbeddedCollapsed" targetRef="TransactionCollapsed" />
41+
</bpmn:process>
42+
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
43+
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_186nk6c">
44+
<bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
45+
<dc:Bounds x="182" y="122" width="36" height="36" />
46+
</bpmndi:BPMNShape>
47+
<bpmndi:BPMNShape id="Activity_1wwmphf_di" bpmnElement="TransactionExpanded" isExpanded="true">
48+
<dc:Bounds x="1035" y="80" width="210" height="120" />
49+
</bpmndi:BPMNShape>
50+
<bpmndi:BPMNShape id="Activity_0xiyzrh_di" bpmnElement="AdHocExpanded" isExpanded="true">
51+
<dc:Bounds x="1315" y="80" width="210" height="120" />
52+
</bpmndi:BPMNShape>
53+
<bpmndi:BPMNShape id="Event_0b2kj71_di" bpmnElement="EndEvent_1">
54+
<dc:Bounds x="1602" y="122" width="36" height="36" />
55+
</bpmndi:BPMNShape>
56+
<bpmndi:BPMNShape id="Activity_0cfson9_di" bpmnElement="EmbeddedExpanded" isExpanded="true">
57+
<dc:Bounds x="755" y="80" width="210" height="120" />
58+
</bpmndi:BPMNShape>
59+
<bpmndi:BPMNShape id="Activity_05c7g2z_di" bpmnElement="AdHocCollapsed">
60+
<dc:Bounds x="590" y="100" width="100" height="80" />
61+
</bpmndi:BPMNShape>
62+
<bpmndi:BPMNShape id="Activity_1luh2vj_di" bpmnElement="TransactionCollapsed">
63+
<dc:Bounds x="430" y="100" width="100" height="80" />
64+
</bpmndi:BPMNShape>
65+
<bpmndi:BPMNShape id="Activity_128e41e_di" bpmnElement="EmbeddedCollapsed">
66+
<dc:Bounds x="270" y="100" width="100" height="80" />
67+
</bpmndi:BPMNShape>
68+
<bpmndi:BPMNEdge id="Flow_16gcolc_di" bpmnElement="Flow_6">
69+
<di:waypoint x="1245" y="140" />
70+
<di:waypoint x="1315" y="140" />
71+
</bpmndi:BPMNEdge>
72+
<bpmndi:BPMNEdge id="Flow_0lnm1jn_di" bpmnElement="Flow_7">
73+
<di:waypoint x="1525" y="140" />
74+
<di:waypoint x="1602" y="140" />
75+
</bpmndi:BPMNEdge>
76+
<bpmndi:BPMNEdge id="Flow_0al35a1_di" bpmnElement="Flow_5">
77+
<di:waypoint x="965" y="140" />
78+
<di:waypoint x="1035" y="140" />
79+
</bpmndi:BPMNEdge>
80+
<bpmndi:BPMNEdge id="Flow_0cam5k2_di" bpmnElement="Flow_1">
81+
<di:waypoint x="218" y="140" />
82+
<di:waypoint x="270" y="140" />
83+
</bpmndi:BPMNEdge>
84+
<bpmndi:BPMNEdge id="Flow_0uqme02_di" bpmnElement="Flow_4">
85+
<di:waypoint x="690" y="140" />
86+
<di:waypoint x="755" y="140" />
87+
</bpmndi:BPMNEdge>
88+
<bpmndi:BPMNEdge id="Flow_17e700o_di" bpmnElement="Flow_3">
89+
<di:waypoint x="530" y="140" />
90+
<di:waypoint x="590" y="140" />
91+
</bpmndi:BPMNEdge>
92+
<bpmndi:BPMNEdge id="Flow_0dwgr2t_di" bpmnElement="Flow_2">
93+
<di:waypoint x="370" y="140" />
94+
<di:waypoint x="430" y="140" />
95+
</bpmndi:BPMNEdge>
96+
</bpmndi:BPMNPlane>
97+
</bpmndi:BPMNDiagram>
98+
<bpmndi:BPMNDiagram id="BPMNDiagram_17dzbkj">
99+
<bpmndi:BPMNPlane id="BPMNPlane_0981uw6" bpmnElement="AdHocCollapsed" />
100+
</bpmndi:BPMNDiagram>
101+
<bpmndi:BPMNDiagram id="BPMNDiagram_1nx4oqz">
102+
<bpmndi:BPMNPlane id="BPMNPlane_1ykqzyh" bpmnElement="TransactionCollapsed" />
103+
</bpmndi:BPMNDiagram>
104+
<bpmndi:BPMNDiagram id="BPMNDiagram_1cngnkb">
105+
<bpmndi:BPMNPlane id="BPMNPlane_0y4chy5" bpmnElement="EmbeddedCollapsed" />
106+
</bpmndi:BPMNDiagram>
107+
</bpmn:definitions>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
[
2+
"createScope:Process_186nk6c:null",
3+
"signal:Process_186nk6c:B",
4+
"createScope:StartEvent_1:B",
5+
"signal:StartEvent_1:C",
6+
"exit:StartEvent_1:C",
7+
"createScope:Flow_1:B",
8+
"destroyScope:StartEvent_1:C",
9+
"enter:Flow_1:B",
10+
"exit:Flow_1:D",
11+
"createScope:EmbeddedCollapsed:B",
12+
"destroyScope:Flow_1:D",
13+
"enter:EmbeddedCollapsed:B",
14+
"exit:EmbeddedCollapsed:E",
15+
"createScope:Flow_2:B",
16+
"destroyScope:EmbeddedCollapsed:E",
17+
"enter:Flow_2:B",
18+
"exit:Flow_2:F",
19+
"createScope:TransactionCollapsed:B",
20+
"destroyScope:Flow_2:F",
21+
"enter:TransactionCollapsed:B",
22+
"exit:TransactionCollapsed:G",
23+
"createScope:Flow_3:B",
24+
"destroyScope:TransactionCollapsed:G",
25+
"enter:Flow_3:B",
26+
"exit:Flow_3:H",
27+
"createScope:AdHocCollapsed:B",
28+
"destroyScope:Flow_3:H",
29+
"enter:AdHocCollapsed:B",
30+
"exit:AdHocCollapsed:I",
31+
"createScope:Flow_4:B",
32+
"destroyScope:AdHocCollapsed:I",
33+
"enter:Flow_4:B",
34+
"exit:Flow_4:J",
35+
"createScope:EmbeddedExpanded:B",
36+
"destroyScope:Flow_4:J",
37+
"enter:EmbeddedExpanded:B",
38+
"exit:EmbeddedExpanded:K",
39+
"createScope:Flow_5:B",
40+
"destroyScope:EmbeddedExpanded:K",
41+
"enter:Flow_5:B",
42+
"exit:Flow_5:L",
43+
"createScope:TransactionExpanded:B",
44+
"destroyScope:Flow_5:L",
45+
"enter:TransactionExpanded:B",
46+
"exit:TransactionExpanded:M",
47+
"createScope:Flow_6:B",
48+
"destroyScope:TransactionExpanded:M",
49+
"enter:Flow_6:B",
50+
"exit:Flow_6:N",
51+
"createScope:AdHocExpanded:B",
52+
"destroyScope:Flow_6:N",
53+
"enter:AdHocExpanded:B",
54+
"exit:AdHocExpanded:O",
55+
"createScope:Flow_7:B",
56+
"destroyScope:AdHocExpanded:O",
57+
"enter:Flow_7:B",
58+
"exit:Flow_7:P",
59+
"createScope:EndEvent_1:B",
60+
"destroyScope:Flow_7:P",
61+
"enter:EndEvent_1:B",
62+
"exit:EndEvent_1:Q",
63+
"destroyScope:EndEvent_1:Q",
64+
"exit:Process_186nk6c:B",
65+
"destroyScope:Process_186nk6c:B"
66+
]

test/spec/simulator/SimulatorSpec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,18 @@ describe('simulator', function() {
15571557
expectTrace(fixture());
15581558
});
15591559

1560+
1561+
verify('sub-process-empty-continuation', (fixture) => {
1562+
1563+
// when
1564+
trigger({
1565+
element: element('StartEvent_1')
1566+
});
1567+
1568+
// then
1569+
expectTrace(fixture());
1570+
});
1571+
15601572
});
15611573

15621574

0 commit comments

Comments
 (0)