Skip to content

Commit

Permalink
feat: support zeebe:AdHoc
Browse files Browse the repository at this point in the history
  • Loading branch information
jarekdanielak authored Jan 21, 2025
1 parent c1bac2a commit 6ce5be5
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 0 deletions.
18 changes: 18 additions & 0 deletions resources/zeebe.json
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,24 @@
"type": "String"
}
]
},
{
"name": "AdHoc",
"superClass": [
"Element"
],
"meta": {
"allowedIn": [
"bpmn:AdHocSubProcess"
]
},
"properties": [
{
"name": "activeElementsCollection",
"isAttr": true,
"type": "String"
}
]
}
]
}
8 changes: 8 additions & 0 deletions test/fixtures/xml/adhoc-sub-process-zeebe-adHoc.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<bpmn:adHocSubProcess
id="AdHocSubProcess_1"
xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:zeebe="http://camunda.org/schema/zeebe/1.0">
<bpmn:extensionElements>
<zeebe:adHoc activeElementsCollection="=activeElements" />
</bpmn:extensionElements>
</bpmn:adHocSubProcess>
25 changes: 25 additions & 0 deletions test/fixtures/xml/zeebe-adHoc.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
<bpmn:process id="ZeebeAdHocTest" name="Zeebe AdHoc Test" isExecutable="true">
<bpmn:adHocSubProcess id="AdHocSubProcess_1">
<bpmn:extensionElements>
<zeebe:adHoc activeElementsCollection="=activeElements" />
</bpmn:extensionElements>
<bpmn:task id="Activity_0dggw2z" />
<bpmn:task id="Activity_1e1z8gb" />
</bpmn:adHocSubProcess>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ZeebeAdHocTest">
<bpmndi:BPMNShape id="Activity_09e2hj1_di" bpmnElement="AdHocSubProcess_1" isExpanded="true">
<dc:Bounds x="160" y="80" width="350" height="200" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0dggw2z_di" bpmnElement="Activity_0dggw2z">
<dc:Bounds x="190" y="130" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1e1z8gb_di" bpmnElement="Activity_1e1z8gb">
<dc:Bounds x="360" y="130" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
31 changes: 31 additions & 0 deletions test/spec/xml/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,37 @@ describe('read', function() {

});


describe('zeebe:AdHoc', function() {

it('on AdHocSubProcess', async function() {

// given
var xml = readFile('test/fixtures/xml/adhoc-sub-process-zeebe-adHoc.bpmn');

// when
const {
rootElement: subprocess
} = await moddle.fromXML(xml, 'bpmn:AdHocSubProcess');

// then
expect(subprocess).to.jsonEqual({
$type: 'bpmn:AdHocSubProcess',
id: 'AdHocSubProcess_1',
extensionElements: {
$type: 'bpmn:ExtensionElements',
values: [
{
$type: 'zeebe:AdHoc',
activeElementsCollection: '=activeElements'
}
]
}
});
});

});

});

});
7 changes: 7 additions & 0 deletions test/spec/xml/roundtrip.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,11 @@ describe('import -> export roundtrip', function() {

});


describe('zeebe:AdHoc', function() {

it('should keep zeebe:adHoc', validateExport('test/fixtures/xml/zeebe-adHoc.bpmn'));

});

});
15 changes: 15 additions & 0 deletions test/spec/xml/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,21 @@ describe('write', function() {
// then
expect(xml).to.eql(expectedXML);
});

it('zeebe:AdHoc', async function() {

// given
const moddleElement = moddle.create('zeebe:AdHoc', { activeElementsCollection: '= some collection' });

const expectedXML = '<zeebe:adHoc xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" activeElementsCollection="= some collection" />';

// when
const xml = await write(moddleElement);

// then
expect(xml).to.eql(expectedXML);
});

});

});

0 comments on commit 6ce5be5

Please sign in to comment.