Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support zeebe:script #39

Merged
merged 1 commit into from
Dec 1, 2022
Merged
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
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);
});

});

});