Squashed 'SpiffWorkflow/' changes from 46d3de27f..ffb168675

ffb168675 Option to run tests in parallel (#271)
062eaf15d another hot match -- assure hit policy is correctly passed through.
c79ee8407 Quick patch the DMN hit policy to fix a dump mistake.
36dd1b23a Fix ResourceWarning: unclosed file BpmnParser.py:60 (#270)
bba7ddf54 Merge pull request #268 from sartography/feature/multiple-event-definition
8cf770985 remove unused import
9d31e035e make multiple throw events work with start events
890c4b921 add throw support for multiple events
c1fc55660 add support for catching parallel multiple event definitions
511830b67 add event based gateway
56bd858dc add event type for multiple events

git-subtree-dir: SpiffWorkflow
git-subtree-split: ffb1686757f944065580dd2db8def73d6c1f0134
This commit is contained in:
burnettk 2022-12-10 23:39:00 -05:00
parent a3e8bcbd65
commit 12b7fa2b70
11 changed files with 567 additions and 5 deletions

View File

@ -36,8 +36,16 @@ uninstall:
.PHONY : tests
tests:
cd tests/$(NAME)
PYTHONPATH=../.. python -m unittest discover -v . "*Test.py"
python -m unittest discover -vs tests/SpiffWorkflow -p \*Test.py -t .
.PHONY : tests-par
tests-par:
@if ! command -v unittest-parallel >/dev/null 2>&1; then \
echo "unittest-parallel not found. Please install it with:"; \
echo " pip install unittest-parallel"; \
exit 1; \
fi
unittest-parallel --module-fixtures -vs tests/SpiffWorkflow -p \*Test.py -t .
.PHONY : tests-cov
tests-cov:

View File

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1jaorpt" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.11.1" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
<bpmn:process id="Process_0pvx19v" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_0w4b5t2</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_0w4b5t2" sourceRef="StartEvent_1" targetRef="Gateway_1434v9l" />
<bpmn:eventBasedGateway id="Gateway_1434v9l">
<bpmn:incoming>Flow_0w4b5t2</bpmn:incoming>
<bpmn:outgoing>Flow_0gge7fn</bpmn:outgoing>
<bpmn:outgoing>Flow_0px7ksu</bpmn:outgoing>
<bpmn:outgoing>Flow_1rfbrlf</bpmn:outgoing>
</bpmn:eventBasedGateway>
<bpmn:intermediateCatchEvent id="message_1_event">
<bpmn:incoming>Flow_0gge7fn</bpmn:incoming>
<bpmn:outgoing>Flow_1g4g85l</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_158nhox" messageRef="Message_0lyfmat" />
</bpmn:intermediateCatchEvent>
<bpmn:sequenceFlow id="Flow_0gge7fn" sourceRef="Gateway_1434v9l" targetRef="message_1_event" />
<bpmn:intermediateCatchEvent id="message_2_event">
<bpmn:incoming>Flow_0px7ksu</bpmn:incoming>
<bpmn:outgoing>Flow_18v90rx</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_1w1pnze" messageRef="Message_1ntpwce" />
</bpmn:intermediateCatchEvent>
<bpmn:sequenceFlow id="Flow_0px7ksu" sourceRef="Gateway_1434v9l" targetRef="message_2_event" />
<bpmn:intermediateCatchEvent id="timer_event">
<bpmn:incoming>Flow_1rfbrlf</bpmn:incoming>
<bpmn:outgoing>Flow_0mppjk9</bpmn:outgoing>
<bpmn:timerEventDefinition id="TimerEventDefinition_0reo0gl">
<bpmn:timeDuration xsi:type="bpmn:tFormalExpression">timedelta(seconds=1)</bpmn:timeDuration>
</bpmn:timerEventDefinition>
</bpmn:intermediateCatchEvent>
<bpmn:sequenceFlow id="Flow_1rfbrlf" sourceRef="Gateway_1434v9l" targetRef="timer_event" />
<bpmn:endEvent id="timer">
<bpmn:incoming>Flow_0mppjk9</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_0mppjk9" sourceRef="timer_event" targetRef="timer" />
<bpmn:endEvent id="message_1_end">
<bpmn:incoming>Flow_1g4g85l</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_1g4g85l" sourceRef="message_1_event" targetRef="message_1_end" />
<bpmn:endEvent id="message_2_end">
<bpmn:incoming>Flow_18v90rx</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_18v90rx" sourceRef="message_2_event" targetRef="message_2_end" />
</bpmn:process>
<bpmn:message id="Message_0lyfmat" name="message_1" />
<bpmn:message id="Message_1ntpwce" name="message_2" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_0pvx19v">
<bpmndi:BPMNEdge id="Flow_18v90rx_di" bpmnElement="Flow_18v90rx">
<di:waypoint x="408" y="230" />
<di:waypoint x="472" y="230" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1g4g85l_di" bpmnElement="Flow_1g4g85l">
<di:waypoint x="408" y="117" />
<di:waypoint x="472" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0mppjk9_di" bpmnElement="Flow_0mppjk9">
<di:waypoint x="408" y="340" />
<di:waypoint x="472" y="340" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1rfbrlf_di" bpmnElement="Flow_1rfbrlf">
<di:waypoint x="290" y="142" />
<di:waypoint x="290" y="340" />
<di:waypoint x="372" y="340" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0px7ksu_di" bpmnElement="Flow_0px7ksu">
<di:waypoint x="290" y="142" />
<di:waypoint x="290" y="230" />
<di:waypoint x="372" y="230" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0gge7fn_di" bpmnElement="Flow_0gge7fn">
<di:waypoint x="315" y="117" />
<di:waypoint x="372" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0w4b5t2_di" bpmnElement="Flow_0w4b5t2">
<di:waypoint x="215" y="117" />
<di:waypoint x="265" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_0gplu2e_di" bpmnElement="Gateway_1434v9l">
<dc:Bounds x="265" y="92" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1og7irs_di" bpmnElement="message_1_event">
<dc:Bounds x="372" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0quxwe6_di" bpmnElement="message_2_event">
<dc:Bounds x="372" y="212" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1ea7gov_di" bpmnElement="timer_event">
<dc:Bounds x="372" y="322" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0emrepu_di" bpmnElement="timer">
<dc:Bounds x="472" y="322" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0x07cac_di" bpmnElement="message_1_end">
<dc:Bounds x="472" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1p7slpj_di" bpmnElement="message_2_end">
<dc:Bounds x="472" y="212" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_19o7vxg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.0.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
<bpmn:process id="main" name="Main" isExecutable="true">
<bpmn:startEvent id="StartEvent_1" parallelMultiple="true">
<bpmn:outgoing>Flow_1tr2mqr</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_158nhox" messageRef="Message_0lyfmat" />
<bpmn:messageEventDefinition id="MessageEventDefinition_1w1pnze" messageRef="Message_1ntpwce" />
</bpmn:startEvent>
<bpmn:task id="any_task" name="Any Task">
<bpmn:incoming>Flow_1tr2mqr</bpmn:incoming>
<bpmn:outgoing>Flow_1qjctmo</bpmn:outgoing>
</bpmn:task>
<bpmn:sequenceFlow id="Flow_1tr2mqr" sourceRef="StartEvent_1" targetRef="any_task" />
<bpmn:endEvent id="Event_0hamwsf">
<bpmn:incoming>Flow_1qjctmo</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_1qjctmo" sourceRef="any_task" targetRef="Event_0hamwsf" />
</bpmn:process>
<bpmn:message id="Message_0lyfmat" name="message_1" />
<bpmn:message id="Message_1ntpwce" name="message_2" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="main">
<bpmndi:BPMNShape id="Event_1mddj6x_di" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="169" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1bn6xph_di" bpmnElement="any_task">
<dc:Bounds x="270" y="147" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0hamwsf_di" bpmnElement="Event_0hamwsf">
<dc:Bounds x="432" y="169" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1tr2mqr_di" bpmnElement="Flow_1tr2mqr">
<di:waypoint x="215" y="187" />
<di:waypoint x="270" y="187" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1qjctmo_di" bpmnElement="Flow_1qjctmo">
<di:waypoint x="370" y="187" />
<di:waypoint x="432" y="187" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_19o7vxg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.0.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
<bpmn:process id="main" name="Main" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_1tr2mqr</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_158nhox" messageRef="Message_0lyfmat" />
<bpmn:messageEventDefinition id="MessageEventDefinition_1w1pnze" messageRef="Message_1ntpwce" />
</bpmn:startEvent>
<bpmn:task id="any_task" name="Any Task">
<bpmn:incoming>Flow_1tr2mqr</bpmn:incoming>
<bpmn:outgoing>Flow_1qjctmo</bpmn:outgoing>
</bpmn:task>
<bpmn:sequenceFlow id="Flow_1tr2mqr" sourceRef="StartEvent_1" targetRef="any_task" />
<bpmn:endEvent id="Event_0hamwsf">
<bpmn:incoming>Flow_1qjctmo</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_1qjctmo" sourceRef="any_task" targetRef="Event_0hamwsf" />
</bpmn:process>
<bpmn:message id="Message_0lyfmat" name="message_1" />
<bpmn:message id="Message_1ntpwce" name="message_2" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="main">
<bpmndi:BPMNShape id="Event_1mddj6x_di" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="169" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1bn6xph_di" bpmnElement="any_task">
<dc:Bounds x="270" y="147" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0hamwsf_di" bpmnElement="Event_0hamwsf">
<dc:Bounds x="432" y="169" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1tr2mqr_di" bpmnElement="Flow_1tr2mqr">
<di:waypoint x="215" y="187" />
<di:waypoint x="270" y="187" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1qjctmo_di" bpmnElement="Flow_1qjctmo">
<di:waypoint x="370" y="187" />
<di:waypoint x="432" y="187" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_19o7vxg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.0.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
<bpmn:message id="Message_0lyfmat" name="message_1" />
<bpmn:message id="Message_1ntpwce" name="message_2" />
<bpmn:collaboration id="top">
<bpmn:participant id="responder" name="Responder" processRef="respond" />
<bpmn:participant id="initiator" name="Initiator" processRef="initiate" />
</bpmn:collaboration>
<bpmn:process id="respond" name="Respond" isExecutable="true">
<bpmn:startEvent id="Event_07g2lnb" parallelMultiple="true">
<bpmn:outgoing>Flow_04uk4n8</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_158nhox" messageRef="Message_0lyfmat" />
<bpmn:messageEventDefinition id="MessageEventDefinition_1w1pnze" messageRef="Message_1ntpwce" />
</bpmn:startEvent>
<bpmn:endEvent id="Event_0hamwsf">
<bpmn:incoming>Flow_08al33k</bpmn:incoming>
</bpmn:endEvent>
<bpmn:task id="any_task" name="Any Task">
<bpmn:incoming>Flow_04uk4n8</bpmn:incoming>
<bpmn:outgoing>Flow_08al33k</bpmn:outgoing>
</bpmn:task>
<bpmn:sequenceFlow id="Flow_04uk4n8" sourceRef="Event_07g2lnb" targetRef="any_task" />
<bpmn:sequenceFlow id="Flow_08al33k" sourceRef="any_task" targetRef="Event_0hamwsf" />
</bpmn:process>
<bpmn:process id="initiate" name="Initiate" isExecutable="true">
<bpmn:startEvent id="Event_0jamixt">
<bpmn:outgoing>Flow_1wgdi4h</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_1wgdi4h" sourceRef="Event_0jamixt" targetRef="Event_0n8a7vh" />
<bpmn:sequenceFlow id="Flow_1wxjn4e" sourceRef="Event_0n8a7vh" targetRef="Event_0vork94" />
<bpmn:endEvent id="Event_0vork94">
<bpmn:incoming>Flow_1wxjn4e</bpmn:incoming>
</bpmn:endEvent>
<bpmn:intermediateThrowEvent id="Event_0n8a7vh">
<bpmn:incoming>Flow_1wgdi4h</bpmn:incoming>
<bpmn:outgoing>Flow_1wxjn4e</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_158nhox_throw" messageRef="Message_0lyfmat" />
<bpmn:messageEventDefinition id="MessageEventDefinition_1w1pnze_throw" messageRef="Message_1ntpwce" />
</bpmn:intermediateThrowEvent>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="top">
<bpmndi:BPMNShape id="Participant_0ctz0ow_di" bpmnElement="responder" isHorizontal="true">
<dc:Bounds x="120" y="62" width="430" height="250" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_07g2lnb_di" bpmnElement="Event_07g2lnb">
<dc:Bounds x="192" y="169" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0hamwsf_di" bpmnElement="Event_0hamwsf">
<dc:Bounds x="432" y="169" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1yaipjy_di" bpmnElement="any_task">
<dc:Bounds x="280" y="147" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_04uk4n8_di" bpmnElement="Flow_04uk4n8">
<di:waypoint x="228" y="187" />
<di:waypoint x="280" y="187" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_08al33k_di" bpmnElement="Flow_08al33k">
<di:waypoint x="380" y="187" />
<di:waypoint x="432" y="187" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Participant_0gyj8ha_di" bpmnElement="initiator" isHorizontal="true">
<dc:Bounds x="120" y="350" width="430" height="250" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0jamixt_di" bpmnElement="Event_0jamixt">
<dc:Bounds x="192" y="452" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0vork94_di" bpmnElement="Event_0vork94">
<dc:Bounds x="432" y="452" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0n8a7vh_di" bpmnElement="Event_0n8a7vh">
<dc:Bounds x="322" y="452" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1wgdi4h_di" bpmnElement="Flow_1wgdi4h">
<di:waypoint x="228" y="470" />
<di:waypoint x="322" y="470" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1wxjn4e_di" bpmnElement="Flow_1wxjn4e">
<di:waypoint x="358" y="470" />
<di:waypoint x="432" y="470" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_19o7vxg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.0.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
<bpmn:message id="Message_0lyfmat" name="message_1" />
<bpmn:message id="Message_1ntpwce" name="message_2" />
<bpmn:collaboration id="top">
<bpmn:participant id="responder" name="Responder" processRef="respond" />
<bpmn:participant id="initiator" name="Initiator" processRef="initiate" />
</bpmn:collaboration>
<bpmn:process id="respond" name="Respond" isExecutable="true">
<bpmn:endEvent id="Event_0hamwsf">
<bpmn:incoming>Flow_1tr2mqr</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_1tr2mqr" sourceRef="StartEvent_1" targetRef="Event_0hamwsf" />
<bpmn:intermediateCatchEvent id="StartEvent_1" parallelMultiple="true">
<bpmn:incoming>Flow_1wohnl8</bpmn:incoming>
<bpmn:outgoing>Flow_1tr2mqr</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_158nhox" messageRef="Message_0lyfmat" />
<bpmn:messageEventDefinition id="MessageEventDefinition_1w1pnze" messageRef="Message_1ntpwce" />
</bpmn:intermediateCatchEvent>
<bpmn:startEvent id="Event_07g2lnb">
<bpmn:outgoing>Flow_1wohnl8</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_1wohnl8" sourceRef="Event_07g2lnb" targetRef="StartEvent_1" />
</bpmn:process>
<bpmn:process id="initiate" name="Initiate" isExecutable="true">
<bpmn:startEvent id="Event_0jamixt">
<bpmn:outgoing>Flow_1wgdi4h</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_1wgdi4h" sourceRef="Event_0jamixt" targetRef="Event_0n8a7vh" />
<bpmn:sequenceFlow id="Flow_1wxjn4e" sourceRef="Event_0n8a7vh" targetRef="Event_0vork94" />
<bpmn:endEvent id="Event_0vork94">
<bpmn:incoming>Flow_1wxjn4e</bpmn:incoming>
</bpmn:endEvent>
<bpmn:intermediateThrowEvent id="Event_0n8a7vh">
<bpmn:incoming>Flow_1wgdi4h</bpmn:incoming>
<bpmn:outgoing>Flow_1wxjn4e</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_158nhox_throw" messageRef="Message_0lyfmat" />
<bpmn:messageEventDefinition id="MessageEventDefinition_1w1pnze_throw" messageRef="Message_1ntpwce" />
</bpmn:intermediateThrowEvent>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="top">
<bpmndi:BPMNShape id="Participant_0ctz0ow_di" bpmnElement="responder" isHorizontal="true">
<dc:Bounds x="120" y="62" width="430" height="250" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0hamwsf_di" bpmnElement="Event_0hamwsf">
<dc:Bounds x="432" y="169" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1mddj6x_di" bpmnElement="StartEvent_1">
<dc:Bounds x="312" y="169" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_07g2lnb_di" bpmnElement="Event_07g2lnb">
<dc:Bounds x="192" y="169" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1tr2mqr_di" bpmnElement="Flow_1tr2mqr">
<di:waypoint x="348" y="187" />
<di:waypoint x="432" y="187" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1wohnl8_di" bpmnElement="Flow_1wohnl8">
<di:waypoint x="228" y="187" />
<di:waypoint x="312" y="187" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Participant_0gyj8ha_di" bpmnElement="initiator" isHorizontal="true">
<dc:Bounds x="120" y="350" width="430" height="250" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0jamixt_di" bpmnElement="Event_0jamixt">
<dc:Bounds x="192" y="452" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0vork94_di" bpmnElement="Event_0vork94">
<dc:Bounds x="432" y="452" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0n8a7vh_di" bpmnElement="Event_0n8a7vh">
<dc:Bounds x="322" y="452" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1wgdi4h_di" bpmnElement="Flow_1wgdi4h">
<di:waypoint x="228" y="470" />
<di:waypoint x="322" y="470" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1wxjn4e_di" bpmnElement="Flow_1wxjn4e">
<di:waypoint x="358" y="470" />
<di:waypoint x="432" y="470" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

View File

@ -0,0 +1,46 @@
from datetime import timedelta
from SpiffWorkflow.bpmn.workflow import BpmnWorkflow
from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine
from SpiffWorkflow.bpmn.specs.events.event_definitions import MessageEventDefinition
from SpiffWorkflow.task import TaskState
from ..BpmnWorkflowTestCase import BpmnWorkflowTestCase
class EventBsedGatewayTest(BpmnWorkflowTestCase):
def setUp(self):
self.spec, self.subprocesses = self.load_workflow_spec('event-gateway.bpmn', 'Process_0pvx19v')
self.script_engine = PythonScriptEngine(default_globals={"timedelta": timedelta})
self.workflow = BpmnWorkflow(self.spec, script_engine=self.script_engine)
def testEventBasedGateway(self):
self.actual_test()
def testEventBasedGatewaySaveRestore(self):
self.actual_test(True)
def actual_test(self, save_restore=False):
self.workflow.do_engine_steps()
waiting_tasks = self.workflow.get_waiting_tasks()
if save_restore:
self.save_restore()
self.workflow.script_engine = self.script_engine
self.assertEqual(len(waiting_tasks), 1)
self.workflow.catch(MessageEventDefinition('message_1'))
self.workflow.refresh_waiting_tasks()
self.workflow.do_engine_steps()
self.assertEqual(self.workflow.is_completed(), True)
self.assertEqual(self.workflow.get_tasks_from_spec_name('message_1_event')[0].state, TaskState.COMPLETED)
self.assertEqual(self.workflow.get_tasks_from_spec_name('message_2_event')[0].state, TaskState.CANCELLED)
self.assertEqual(self.workflow.get_tasks_from_spec_name('timer_event')[0].state, TaskState.CANCELLED)
def testMultipleStart(self):
spec, subprocess = self.load_workflow_spec('multiple-start-parallel.bpmn', 'main')
workflow = BpmnWorkflow(spec)
workflow.do_engine_steps()
workflow.catch(MessageEventDefinition('message_1'))
workflow.catch(MessageEventDefinition('message_2'))
workflow.refresh_waiting_tasks()
workflow.do_engine_steps()

View File

@ -0,0 +1,81 @@
from SpiffWorkflow.bpmn.workflow import BpmnWorkflow
from SpiffWorkflow.bpmn.specs.events.event_definitions import MessageEventDefinition
from ..BpmnWorkflowTestCase import BpmnWorkflowTestCase
class MultipleStartEventTest(BpmnWorkflowTestCase):
def setUp(self):
self.spec, self.subprocesses = self.load_workflow_spec('multiple-start.bpmn', 'main')
self.workflow = BpmnWorkflow(self.spec)
def testMultipleStartEvent(self):
self.actual_test()
def testMultipleStartEventSaveRestore(self):
self.actual_test(True)
def actual_test(self, save_restore=False):
self.workflow.do_engine_steps()
waiting_tasks = self.workflow.get_waiting_tasks()
if save_restore:
self.save_restore()
# The start event should be waiting
self.assertEqual(len(waiting_tasks), 1)
self.assertEqual(waiting_tasks[0].task_spec.name, 'StartEvent_1')
self.workflow.catch(MessageEventDefinition('message_1'))
self.workflow.refresh_waiting_tasks()
self.workflow.do_engine_steps()
# Now the first task should be ready
ready_tasks = self.workflow.get_ready_user_tasks()
self.assertEqual(len(ready_tasks), 1)
self.assertEqual(ready_tasks[0].task_spec.name, 'any_task')
class ParallelStartEventTest(BpmnWorkflowTestCase):
def setUp(self):
self.spec, self.subprocesses = self.load_workflow_spec('multiple-start-parallel.bpmn', 'main')
self.workflow = BpmnWorkflow(self.spec)
def testParallelStartEvent(self):
self.actual_test()
def testParallelStartEventSaveRestore(self):
self.actual_test(True)
def actual_test(self, save_restore=False):
self.workflow.do_engine_steps()
waiting_tasks = self.workflow.get_waiting_tasks()
if save_restore:
self.save_restore()
# The start event should be waiting
self.assertEqual(len(waiting_tasks), 1)
self.assertEqual(waiting_tasks[0].task_spec.name, 'StartEvent_1')
self.workflow.catch(MessageEventDefinition('message_1'))
self.workflow.refresh_waiting_tasks()
self.workflow.do_engine_steps()
# It should still be waiting because it has to receive both messages
waiting_tasks = self.workflow.get_waiting_tasks()
self.assertEqual(len(waiting_tasks), 1)
self.assertEqual(waiting_tasks[0].task_spec.name, 'StartEvent_1')
self.workflow.catch(MessageEventDefinition('message_2'))
self.workflow.refresh_waiting_tasks()
self.workflow.do_engine_steps()
# Now the first task should be ready
ready_tasks = self.workflow.get_ready_user_tasks()
self.assertEqual(len(ready_tasks), 1)
self.assertEqual(ready_tasks[0].task_spec.name, 'any_task')

View File

@ -0,0 +1,47 @@
from SpiffWorkflow.bpmn.workflow import BpmnWorkflow
from ..BpmnWorkflowTestCase import BpmnWorkflowTestCase
class MultipleThrowEventIntermediateCatchTest(BpmnWorkflowTestCase):
def setUp(self):
self.spec, subprocesses = self.load_collaboration('multiple-throw.bpmn','top')
self.workflow = BpmnWorkflow(self.spec, subprocesses)
def testMultipleThrowEventIntermediateCatch(self):
self.actual_test()
def testMultipleThrowEventIntermediateCatchSaveRestore(self):
self.actual_test(True)
def actual_test(self, save_restore=False):
if save_restore:
self.save_restore()
self.workflow.do_engine_steps()
self.assertEqual(len(self.workflow.get_waiting_tasks()), 0)
self.assertEqual(self.workflow.is_completed(), True)
class MultipleThrowEventStartsEventTest(BpmnWorkflowTestCase):
def setUp(self):
specs = self.get_all_specs('multiple-throw-start.bpmn')
self.spec = specs.pop('initiate')
self.workflow = BpmnWorkflow(self.spec, specs)
def testMultipleThrowEventStartEvent(self):
self.actual_test()
def testMultipleThrowEventStartEventSaveRestore(self):
self.actual_test(True)
def actual_test(self, save_restore=False):
if save_restore:
self.save_restore()
self.workflow.do_engine_steps()
ready_tasks = self.workflow.get_ready_user_tasks()
self.assertEqual(len(ready_tasks), 1)
ready_tasks[0].complete()
self.workflow.do_engine_steps()
self.assertEqual(self.workflow.is_completed(), True)

View File

@ -3,6 +3,8 @@ import unittest
from SpiffWorkflow.dmn.engine.DMNEngine import DMNEngine
from SpiffWorkflow.dmn.parser.BpmnDmnParser import BpmnDmnParser
from SpiffWorkflow.dmn.serializer.task_spec_converters import \
BusinessRuleTaskConverter
from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase
from tests.SpiffWorkflow.dmn.DecisionRunner import DecisionRunner
from tests.SpiffWorkflow.dmn.python_engine.PythonDecisionRunner import \
@ -27,7 +29,18 @@ class HitPolicyTest(BpmnWorkflowTestCase):
self.assertEqual('COLLECT', decision_table.hit_policy)
res = runner.result({'type': 'stooge'})
self.assertEqual(4, len(res['name']))
res = runner.result({'type': 'farmer'})
self.assertEqual(1, len(res['name']))
self.assertEqual('Elmer Fudd', res['name'][0])
def testSerializeHitPolicy(self):
file_name = os.path.join(os.path.dirname(__file__), 'data', 'collect_hit.dmn')
runner = PythonDecisionRunner(file_name)
decision_table = runner.decision_table
self.assertEqual("COLLECT", decision_table.hit_policy)
dict = BusinessRuleTaskConverter().decision_table_to_dict(decision_table)
new_table = BusinessRuleTaskConverter().decision_table_from_dict(dict)
self.assertEqual("COLLECT", new_table.hit_policy)
def suite():
return unittest.TestLoader().loadTestsFromTestCase(HitPolicyTest)

View File

@ -3,9 +3,7 @@
import os
import sys
import unittest
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..'))
from tests.SpiffWorkflow.util import run_workflow
from .TaskSpecTest import TaskSpecTest
@ -25,7 +23,8 @@ class ExecuteTest(TaskSpecTest):
args=self.cmd_args)
def setUp(self):
self.cmd_args = ["python", "ExecuteProcessMock.py"]
script_path = os.path.join(os.path.dirname(__file__), '..', 'ExecuteProcessMock.py')
self.cmd_args = ["python", script_path]
TaskSpecTest.setUp(self)
def testConstructor(self):