Skip to content

Commit

Permalink
feat: support zeebe:ExecutionListener
Browse files Browse the repository at this point in the history
  • Loading branch information
barmac committed May 8, 2024
1 parent 4eff2de commit ab63d4d
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 0 deletions.
47 changes: 47 additions & 0 deletions resources/zeebe.json
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,53 @@
"isAttr": true
}
]
},
{
"name": "ExecutionListeners",
"superClass": [
"Element"
],
"meta": {
"allowedIn": [
"bpmn:FlowNode",
"bpmn:Process"
]
},
"properties": [
{
"name": "listeners",
"type": "ExecutionListener",
"isMany": true
}
]
},
{
"name": "ExecutionListener",
"superClass": [
"Element"
],
"meta": {
"allowedIn": [
"zeebe:ExecutionListeners"
]
},
"properties": [
{
"name": "eventType",
"type": "String",
"isAttr": true
},
{
"name": "retries",
"type": "String",
"isAttr": true
},
{
"name": "type",
"type": "String",
"isAttr": true
}
]
}
]
}
11 changes: 11 additions & 0 deletions test/fixtures/xml/task-zeebe-executionListener.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:executionListeners>
<zeebe:executionListener eventType="start" retries="3" type="sysout"/>
</zeebe:executionListeners>
</bpmn:extensionElements>
</bpmn:task>
37 changes: 37 additions & 0 deletions test/spec/xml/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,43 @@ describe('read', function() {

});


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


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

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

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

// then
expect(task).to.jsonEqual({
$type: 'bpmn:Task',
id: 'task-1',
extensionElements: {
$type: 'bpmn:ExtensionElements',
values: [
{
$type: 'zeebe:ExecutionListeners',
listeners: [
{
$type: 'zeebe:ExecutionListener',
eventType: 'start',
retries: '3',
type: 'sysout'
}
]
}
]
}
});
});
});
});

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


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

// given
const moddleElement = moddle.create('zeebe:ExecutionListeners', {
listeners: [
moddle.create('zeebe:ExecutionListener', {
eventType: 'start',
retries: '3',
type: 'sysout'
})
]
});

const expectedXML = '<zeebe:executionListeners ' +
'xmlns:zeebe="http://camunda.org/schema/zeebe/1.0">' +
'<zeebe:executionListener eventType="start" retries="3" type="sysout" />' +
'</zeebe:executionListeners>';

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

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

});

});

0 comments on commit ab63d4d

Please sign in to comment.