Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
45 changes: 45 additions & 0 deletions test/fixtures/zeebe/read-write.bpmn
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>
45 changes: 45 additions & 0 deletions test/fixtures/zeebe/read-write.hierarchical.bpmn
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>
60 changes: 60 additions & 0 deletions test/spec/zeebe/ZeebeVariableResolver.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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([
Copy link
Member

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

Suggested change
expect(variables).to.variableEqual([
expect(variables).to.variableIncludes([

Copy link
Member Author

Choose a reason for hiding this comment

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

{ 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([
Copy link
Member

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

Suggested change
expect(variables).to.variableEqual([
expect(variables).to.variableIncludes([

Copy link
Member Author

Choose a reason for hiding this comment

The 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 variablesEquals() seems to be appropriate.

{ name: 'application', scope: 'Process_1', origin: [ 'ValidateApprovedTask' ], usedBy: [ 'ValidateApprovedTask' ] }
]);
}));

});

});

// helpers //////////////////////
Expand Down
Loading