Skip to content

Commit

Permalink
feat: support zeebe:TaskListener
Browse files Browse the repository at this point in the history
  • Loading branch information
misiekhardcore committed Nov 6, 2024
1 parent 0453da9 commit 55dba1d
Show file tree
Hide file tree
Showing 6 changed files with 172 additions and 0 deletions.
46 changes: 46 additions & 0 deletions resources/zeebe.json
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,52 @@
}
]
},
{
"name": "TaskListeners",
"superClass": [
"Element"
],
"meta": {
"allowedIn": [
"bpmn:UserTask"
]
},
"properties": [
{
"name": "listeners",
"type": "TaskListener",
"isMany": true
}
]
},
{
"name": "TaskListener",
"superClass": [
"Element"
],
"meta": {
"allowedIn": [
"zeebe:TaskListeners"
]
},
"properties": [
{
"name": "eventType",
"type": "String",
"isAttr": true
},
{
"name": "retries",
"type": "String",
"isAttr": true
},
{
"name": "type",
"type": "String",
"isAttr": true
}
]
},
{
"name": "VersionTag",
"superClass": [
Expand Down
11 changes: 11 additions & 0 deletions test/fixtures/xml/userTask-zeebe-taskListener.part.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<bpmn:task
id="task-1"
xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:zeebe="http://camunda.org/schema/zeebe/1.0"
>
<bpmn:extensionElements>
<zeebe:taskListeners>
<zeebe:taskListener eventType="complete" retries="3" type="complete_listener"/>
</zeebe:taskListeners>
</bpmn:extensionElements>
</bpmn:task>
44 changes: 44 additions & 0 deletions test/fixtures/xml/zeebe-taskListeners.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?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:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0qh9wc7" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.23.0" modeler:userTaskPlatform="Camunda Cloud" modeler:userTaskPlatformVersion="8.0.0">
<bpmn:process id="ZeebePropertiesTest" name="Zeebe Properties Test" isExecutable="true">
<bpmn:extensionElements>
<zeebe:taskListeners>
<zeebe:taskListener eventType="complete" retries="1" type="complete_listener" />
</zeebe:taskListeners>
</bpmn:extensionElements>
<bpmn:userTask id="Activity_0ls77qd">
<bpmn:extensionElements>
<zeebe:taskListeners>
<zeebe:taskListener eventType="assign" retries="2" type="assign_listener" />
</zeebe:taskListeners>
</bpmn:extensionElements>
</bpmn:userTask>
<bpmn:subProcess id="Activity_1yf35jc">
<bpmn:extensionElements>
<zeebe:taskListeners>
<zeebe:taskListener eventType="complete" retries="3" type="complete_listener" />
</zeebe:taskListeners>
</bpmn:extensionElements>
<bpmn:userTask id="Event_06ifkc6">
<bpmn:extensionElements>
<zeebe:taskListeners>
<zeebe:taskListener eventType="assign" retries="4" type="assign_listener" />
</zeebe:taskListeners>
</bpmn:extensionElements>
</bpmn:userTask>
</bpmn:subProcess>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ZeebePropertiesTest">
<bpmndi:BPMNShape id="Activity_0ls77qd_di" bpmnElement="Activity_0ls77qd">
<dc:Bounds x="160" y="400" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1yf35jc_di" bpmnElement="Activity_1yf35jc" isExpanded="true">
<dc:Bounds x="160" y="510" width="350" height="200" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_06ifkc6_di" bpmnElement="Event_06ifkc6">
<dc:Bounds x="200" y="592" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
38 changes: 38 additions & 0 deletions test/spec/xml/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,44 @@ describe('read', function() {

});


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

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

// given
var xml = readFile('test/fixtures/xml/userTask-zeebe-taskListener.part.bpmn');

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

// then
expect(task).to.jsonEqual({
$type: 'bpmn:UserTask',
id: 'task-1',
extensionElements: {
$type: 'bpmn:ExtensionElements',
values: [
{
$type: 'zeebe:TaskListeners',
listeners: [
{
$type: 'zeebe:TaskListener',
eventType: 'complete',
retries: '3',
type: 'complete_listener'
}
]
}
]
}
});
});

});

});

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

});


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

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

});

});
26 changes: 26 additions & 0 deletions test/spec/xml/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,32 @@ describe('write', function() {

});


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

// given
const moddleElement = moddle.create('zeebe:TaskListeners', {
listeners: [
moddle.create('zeebe:TaskListener', {
eventType: 'complete',
retries: '1',
type: 'complete_listener'
})
]
});

const expectedXML = '<zeebe:taskListeners ' +
'xmlns:zeebe="http://camunda.org/schema/zeebe/1.0">' +
'<zeebe:taskListener eventType="complete" retries="1" type="complete_listener" />' +
'</zeebe:taskListeners>';

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

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

});

});

0 comments on commit 55dba1d

Please sign in to comment.