Skip to content

Commit

Permalink
feat: add support for zeebe:LinkedResource
Browse files Browse the repository at this point in the history
marstamm authored Jan 15, 2025
1 parent e99173f commit 35b031f
Showing 7 changed files with 221 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@ All notable changes to [zeebe-bpmn-moddle](https://github.com/camunda/zeebe-bpmn

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

* `FEAT`: support `zeebe:LinkedResource` for `bpmn:ServiceTask`

## 1.7.0

* `FEAT`: support `zeebe:TaskListener` for `bpmn:UserTask` ([#67](https://github.com/camunda/zeebe-bpmn-moddle/pull/67))
49 changes: 48 additions & 1 deletion resources/zeebe.json
Original file line number Diff line number Diff line change
@@ -298,6 +298,52 @@
}
]
},
{
"name": "LinkedResource",
"superClass": [
"Element"
],
"meta": {
"allowedIn": [
"bpmn:ServiceTask"
]
},
"properties": [
{
"name": "resourceId",
"type": "String",
"isAttr": true
},
{
"name": "resourceType",
"type": "String",
"isAttr": true
},
{
"name": "linkName",
"type": "String",
"isAttr": true
}
]
},
{
"name": "LinkedResources",
"superClass": [
"Element"
],
"meta": {
"allowedIn": [
"bpmn:ServiceTask"
]
},
"properties": [
{
"name": "values",
"type": "LinkedResource",
"isMany": true
}
]
},
{
"name": "UserTask",
"superClass": [
@@ -618,7 +664,8 @@
"extends": [
"zeebe:CalledDecision",
"zeebe:CalledElement",
"zeebe:FormDefinition"
"zeebe:FormDefinition",
"zeebe:LinkedResource"
],
"properties": [
{
27 changes: 27 additions & 0 deletions test/fixtures/xml/zeebe-linkedResources.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
<bpmn:process id="Process_1" isExecutable="true">
<bpmn:serviceTask id="collect-money" name="Collect Money">
<bpmn:extensionElements>
<zeebe:linkedResources>
<zeebe:linkedResource
resourceId="=myScript"
resourceType="RPA"
/>
<zeebe:linkedResource
resourceId="=myScript"
resourceType="RPA"
bindingType="versionTag"
versionTag="v1"
/>
<zeebe:linkedResource
resourceId="=myScript"
resourceType="RPA"
linkName="myScript"
bindingType="deployment"
/>
</zeebe:linkedResources>
</bpmn:extensionElements>
</bpmn:serviceTask>
</bpmn:process>
</bpmn:definitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<bpmn:serviceTask
id="collect-money" name="Collect Money"
xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:zeebe="http://camunda.org/schema/zeebe/1.0"
>
<bpmn:extensionElements>
<zeebe:linkedResources>
<zeebe:linkedResource
resourceId="=myScript"
resourceType="RPA"
bindingType="latest"
></zeebe:linkedResource>
<zeebe:linkedResource
resourceId="=myScript"
resourceType="RPA"
bindingType="versionTag"
versionTag="v1"
></zeebe:linkedResource>
<zeebe:linkedResource
resourceId="=myScript"
resourceType="RPA"
bindingType="deployment"
linkName="myScript"
></zeebe:linkedResource>
</zeebe:linkedResources>
</bpmn:extensionElements>
</bpmn:serviceTask>
53 changes: 53 additions & 0 deletions test/spec/xml/read.js
Original file line number Diff line number Diff line change
@@ -317,6 +317,59 @@ describe('read', function() {
});


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

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

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

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

// then
expect(proc).to.jsonEqual({
$type: 'bpmn:ServiceTask',
id: 'collect-money',
name: 'Collect Money',
extensionElements: {
$type: 'bpmn:ExtensionElements',
values: [
{
$type: 'zeebe:LinkedResources',
values: [
{
$type: 'zeebe:LinkedResource',
resourceId:'=myScript',
resourceType:'RPA',
bindingType:'latest'
},
{
$type: 'zeebe:LinkedResource',
resourceId: '=myScript',
resourceType: 'RPA',
bindingType: 'versionTag',
versionTag: 'v1'
},
{
$type: 'zeebe:LinkedResource',
resourceId: '=myScript',
resourceType: 'RPA',
bindingType: 'deployment',
linkName: 'myScript'
}
]
}
]
}
});

});

});

describe('zeebe:ioMapping / zeebe:Input / zeebe:Output', function() {

it('on ServiceTask', async function() {
7 changes: 7 additions & 0 deletions test/spec/xml/roundtrip.js
Original file line number Diff line number Diff line change
@@ -89,4 +89,11 @@ describe('import -> export roundtrip', function() {

});


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

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

});

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


it('on zeebe:LinkedResource', async function() {

// given
const moddleElement = moddle.create('zeebe:LinkedResource', {
bindingType: 'versionTag',
versionTag: 'v1.0.0'
});

const expectedXML = '<zeebe:linkedResource ' +
'xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" ' +
'bindingType="versionTag" ' +
'versionTag="v1.0.0" />';

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

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

});

});
@@ -712,6 +733,42 @@ describe('write', function() {
expect(xml).to.eql(expectedXML);
});


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

// given
const moddleElement = moddle.create('zeebe:LinkedResource', {
resourceId:'=myScript',
resourceType:'RPA',
linkName:'myScript' });

const expectedXML = '<zeebe:linkedResource ' +
'xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" ' +
'resourceId="=myScript" ' +
'resourceType="RPA" ' +
'linkName="myScript" />';

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

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


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

// given
const moddleElement = moddle.create('zeebe:LinkedResources');

const expectedXML = '<zeebe:linkedResources xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" />';

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

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

});

0 comments on commit 35b031f

Please sign in to comment.