Skip to content

Commit

Permalink
feat: support zeebe:script
Browse files Browse the repository at this point in the history
  • Loading branch information
barmac committed Dec 1, 2022
1 parent 6e6e09f commit 0d2f97d
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ All notable changes to [zeebe-bpmn-moddle](https://github.com/camunda/zeebe-bpmn

___Note:__ Yet to be released changes appear here._

## 0.17.0

`FEAT`: support `zeebe:script` ([#39](https://github.com/camunda/zeebe-bpmn-moddle/pull/39))

## 0.16.0

`FEAT`: support `zeebe:candidateUsers` ([#38](https://github.com/camunda/zeebe-bpmn-moddle/pull/38))
Expand Down
23 changes: 23 additions & 0 deletions resources/zeebe.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,29 @@
"type": "String"
}
]
},
{
"name": "Script",
"superClass": [
"Element"
],
"meta": {
"allowedIn": [
"bpmn:ScriptTask"
]
},
"properties": [
{
"name": "expression",
"type": "String",
"isAttr": true
},
{
"name": "resultVariable",
"type": "String",
"isAttr": true
}
]
}
]
}
9 changes: 9 additions & 0 deletions test/fixtures/xml/scriptTask-zeebe-script.part.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<bpmn:scriptTask
id="script-task-1"
xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:zeebe="http://camunda.org/schema/zeebe/1.0"
>
<bpmn:extensionElements>
<zeebe:script expression="=today()" resultVariable="result" />
</bpmn:extensionElements>
</bpmn:scriptTask>
32 changes: 32 additions & 0 deletions test/spec/xml/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,38 @@ describe('read', function() {

});


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

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

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

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

// then
expect(task).to.jsonEqual({
$type: 'bpmn:ScriptTask',
id: 'script-task-1',
extensionElements: {
$type: 'bpmn:ExtensionElements',
values: [
{
$type: 'zeebe:Script',
expression: '=today()',
resultVariable: 'result'
}
]
}
});
});

});

});

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


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

// given
const moddleElement = moddle.create('zeebe:Script', {
expression: '=today()',
resultVariable: 'result'
});

const expectedXML = '<zeebe:script ' +
'xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" ' +
'expression="=today()" resultVariable="result" />';

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

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

});

});

0 comments on commit 0d2f97d

Please sign in to comment.