-
Notifications
You must be signed in to change notification settings - Fork 0
test: validate dual use of read and written variable #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| <?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:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1kvhh4n" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.44.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.7.0"> | ||
| <bpmn:process id="Process_1" name="Write: approved" isExecutable="true"> | ||
| <bpmn:serviceTask id="ValidateApprovedTask" name="Validate Approved"> | ||
| <bpmn:extensionElements> | ||
| <zeebe:ioMapping> | ||
| <zeebe:input source="=approved" target="localApproved" /> | ||
| <zeebe:output source="=localApproved" target="approved" /> | ||
| </zeebe:ioMapping> | ||
| </bpmn:extensionElements> | ||
| </bpmn:serviceTask> | ||
| <bpmn:textAnnotation id="TextAnnotation_12joy1t"> | ||
| <bpmn:text>Write: approved</bpmn:text> | ||
| </bpmn:textAnnotation> | ||
| <bpmn:association id="Association_1x9i5o6" associationDirection="None" sourceRef="ValidateApprovedTask" targetRef="TextAnnotation_12joy1t" /> | ||
| <bpmn:textAnnotation id="TextAnnotation_0cyrq9q"> | ||
| <bpmn:text>Read: approved</bpmn:text> | ||
| </bpmn:textAnnotation> | ||
| <bpmn:association id="Association_1qg1o3f" associationDirection="None" sourceRef="TextAnnotation_0cyrq9q" targetRef="ValidateApprovedTask" /> | ||
| </bpmn:process> | ||
| <bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
| <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
| <bpmndi:BPMNShape id="Activity_13wsimk_di" bpmnElement="ValidateApprovedTask"> | ||
| <dc:Bounds x="240" y="170" width="100" height="80" /> | ||
| <bpmndi:BPMNLabel /> | ||
| </bpmndi:BPMNShape> | ||
| <bpmndi:BPMNEdge id="Association_1x9i5o6_di" bpmnElement="Association_1x9i5o6"> | ||
| <di:waypoint x="328" y="170" /> | ||
| <di:waypoint x="386" y="110" /> | ||
| </bpmndi:BPMNEdge> | ||
| <bpmndi:BPMNEdge id="Association_1qg1o3f_di" bpmnElement="Association_1qg1o3f"> | ||
| <di:waypoint x="201" y="110" /> | ||
| <di:waypoint x="244" y="172" /> | ||
| </bpmndi:BPMNEdge> | ||
| <bpmndi:BPMNShape id="TextAnnotation_12joy1t_di" bpmnElement="TextAnnotation_12joy1t"> | ||
| <dc:Bounds x="350" y="80" width="120" height="30" /> | ||
| <bpmndi:BPMNLabel /> | ||
| </bpmndi:BPMNShape> | ||
| <bpmndi:BPMNShape id="BPMNShape_1n8m9kv" bpmnElement="TextAnnotation_0cyrq9q"> | ||
| <dc:Bounds x="160" y="80" width="130" height="30" /> | ||
| <bpmndi:BPMNLabel /> | ||
| </bpmndi:BPMNShape> | ||
| </bpmndi:BPMNPlane> | ||
| </bpmndi:BPMNDiagram> | ||
| </bpmn:definitions> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| <?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:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1kvhh4n" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.44.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.7.0"> | ||
| <bpmn:process id="Process_1" isExecutable="true"> | ||
| <bpmn:serviceTask id="ValidateApprovedTask" name="Validate Approved"> | ||
| <bpmn:extensionElements> | ||
| <zeebe:ioMapping> | ||
| <zeebe:input source="=application.approved" target="localApproved" /> | ||
| <zeebe:output source="=localApproved" target="application.approved" /> | ||
| </zeebe:ioMapping> | ||
| </bpmn:extensionElements> | ||
| </bpmn:serviceTask> | ||
| <bpmn:textAnnotation id="TextAnnotation_12joy1t"> | ||
| <bpmn:text>Write: application.approved</bpmn:text> | ||
| </bpmn:textAnnotation> | ||
| <bpmn:association id="Association_1x9i5o6" associationDirection="None" sourceRef="ValidateApprovedTask" targetRef="TextAnnotation_12joy1t" /> | ||
| <bpmn:textAnnotation id="TextAnnotation_0cyrq9q"> | ||
| <bpmn:text>Read: application.approved</bpmn:text> | ||
| </bpmn:textAnnotation> | ||
| <bpmn:association id="Association_1qg1o3f" associationDirection="None" sourceRef="TextAnnotation_0cyrq9q" targetRef="ValidateApprovedTask" /> | ||
| </bpmn:process> | ||
| <bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
| <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> | ||
| <bpmndi:BPMNShape id="Activity_13wsimk_di" bpmnElement="ValidateApprovedTask"> | ||
| <dc:Bounds x="290" y="170" width="100" height="80" /> | ||
| <bpmndi:BPMNLabel /> | ||
| </bpmndi:BPMNShape> | ||
| <bpmndi:BPMNEdge id="Association_1qg1o3f_di" bpmnElement="Association_1qg1o3f"> | ||
| <di:waypoint x="249" y="106" /> | ||
| <di:waypoint x="294" y="172" /> | ||
| </bpmndi:BPMNEdge> | ||
| <bpmndi:BPMNEdge id="Association_1x9i5o6_di" bpmnElement="Association_1x9i5o6"> | ||
| <di:waypoint x="378" y="170" /> | ||
| <di:waypoint x="436" y="110" /> | ||
| </bpmndi:BPMNEdge> | ||
| <bpmndi:BPMNShape id="TextAnnotation_12joy1t_di" bpmnElement="TextAnnotation_12joy1t"> | ||
| <dc:Bounds x="400" y="80" width="170" height="30" /> | ||
| <bpmndi:BPMNLabel /> | ||
| </bpmndi:BPMNShape> | ||
| <bpmndi:BPMNShape id="BPMNShape_1n8m9kv" bpmnElement="TextAnnotation_0cyrq9q"> | ||
| <dc:Bounds x="160" y="80" width="170" height="25.999998092651367" /> | ||
| <bpmndi:BPMNLabel /> | ||
| </bpmndi:BPMNShape> | ||
| </bpmndi:BPMNPlane> | ||
| </bpmndi:BPMNDiagram> | ||
| </bpmn:definitions> |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -31,6 +31,8 @@ import subprocessNoOutputMappingXML from 'test/fixtures/zeebe/sub-process.no-out | |||||
| import longBrokenExpressionXML from 'test/fixtures/zeebe/long-broken-expression.bpmn'; | ||||||
| import immediatelyBrokenExpressionXML from 'test/fixtures/zeebe/immediately-broken-expression.bpmn'; | ||||||
| import typeResolutionXML from 'test/fixtures/zeebe/type-resolution.bpmn'; | ||||||
| import readWriteXML from 'test/fixtures/zeebe/read-write.bpmn'; | ||||||
| import readWriteHierarchicalXML from 'test/fixtures/zeebe/read-write.hierarchical.bpmn'; | ||||||
|
|
||||||
| import VariableProvider from 'lib/VariableProvider'; | ||||||
| import { getInputOutput } from '../../../lib/base/util/ExtensionElementsUtil'; | ||||||
|
|
@@ -2602,6 +2604,64 @@ describe('ZeebeVariableResolver', function() { | |||||
|
|
||||||
| }); | ||||||
|
|
||||||
|
|
||||||
| describe('used variables - read and written', function() { | ||||||
|
|
||||||
| beforeEach(bootstrapModeler(readWriteXML, { | ||||||
| additionalModules: [ | ||||||
| ZeebeVariableResolverModule | ||||||
| ], | ||||||
| moddleExtensions: { | ||||||
| zeebe: ZeebeModdle | ||||||
| } | ||||||
| })); | ||||||
|
|
||||||
|
|
||||||
| it('should indicate dual use', inject(async function(elementRegistry, variableResolver) { | ||||||
|
|
||||||
| // given | ||||||
| const task = elementRegistry.get('ValidateApprovedTask'); | ||||||
|
|
||||||
| // when | ||||||
| const variables = await variableResolver.getVariablesForElement(task); | ||||||
|
|
||||||
| // then | ||||||
| expect(variables).to.variableEqual([ | ||||||
| { name: 'approved', scope: 'Process_1', origin: [ 'ValidateApprovedTask' ], usedBy: [ 'ValidateApprovedTask' ] } | ||||||
| ]); | ||||||
| })); | ||||||
|
|
||||||
| }); | ||||||
|
|
||||||
|
|
||||||
| describe('used variables - read and written / hierarchical', function() { | ||||||
|
|
||||||
| beforeEach(bootstrapModeler(readWriteHierarchicalXML, { | ||||||
| additionalModules: [ | ||||||
| ZeebeVariableResolverModule | ||||||
| ], | ||||||
| moddleExtensions: { | ||||||
| zeebe: ZeebeModdle | ||||||
| } | ||||||
| })); | ||||||
|
|
||||||
|
|
||||||
| it('should indicate dual use', inject(async function(elementRegistry, variableResolver) { | ||||||
|
|
||||||
| // given | ||||||
| const task = elementRegistry.get('ValidateApprovedTask'); | ||||||
|
|
||||||
| // when | ||||||
| const variables = await variableResolver.getVariablesForElement(task); | ||||||
|
|
||||||
| // then | ||||||
| expect(variables).to.variableEqual([ | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if the inputs are feel and not string they would also appear here
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to asset all variables available to this task. For that |
||||||
| { name: 'application', scope: 'Process_1', origin: [ 'ValidateApprovedTask' ], usedBy: [ 'ValidateApprovedTask' ] } | ||||||
| ]); | ||||||
| })); | ||||||
|
|
||||||
| }); | ||||||
|
|
||||||
| }); | ||||||
|
|
||||||
| // helpers ////////////////////// | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the inputs are feel and not string they would also appear here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cf. #91 (comment)