Skip to content

Commit

Permalink
feat: support zeebe:bindingType
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Jul 19, 2024
1 parent 5626566 commit 3202090
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 3 deletions.
21 changes: 18 additions & 3 deletions resources/zeebe.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
{
"name": "CalledElement",
"superClass": [
"Element"
"BindingTypeSupported"
],
"meta": {
"allowedIn": [
Expand Down Expand Up @@ -275,7 +275,7 @@
{
"name": "FormDefinition",
"superClass": [
"Element"
"BindingTypeSupported"
],
"meta": {
"allowedIn": [
Expand Down Expand Up @@ -315,7 +315,7 @@
{
"name": "CalledDecision",
"superClass": [
"Element"
"BindingTypeSupported"
],
"meta": {
"allowedIn": [
Expand Down Expand Up @@ -549,6 +549,21 @@
"isAttr": true
}
]
},
{
"name": "BindingTypeSupported",
"isAbstract": true,
"superClass": [
"Element"
],
"properties": [
{
"name": "bindingType",
"isAttr": true,
"type": "String",
"default": "latest"
}
]
}
]
}
8 changes: 8 additions & 0 deletions test/fixtures/xml/calledDecision-bindingType.part.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<bpmn:businessRuleTask
xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:zeebe="http://camunda.org/schema/zeebe/1.0"
id="BusinessRuleTask_1">
<bpmn:extensionElements>
<zeebe:calledDecision bindingType="deployment" />
</bpmn:extensionElements>
</bpmn:businessRuleTask>
8 changes: 8 additions & 0 deletions test/fixtures/xml/calledElement-bindingType.part.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<bpmn:callActivity
xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:zeebe="http://camunda.org/schema/zeebe/1.0"
id="CallActivity_1">
<bpmn:extensionElements>
<zeebe:calledElement bindingType="deployment" />
</bpmn:extensionElements>
</bpmn:callActivity>
8 changes: 8 additions & 0 deletions test/fixtures/xml/formDefinition-bindingType.part.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<bpmn:userTask
xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:zeebe="http://camunda.org/schema/zeebe/1.0"
id="UserTask_1">
<bpmn:extensionElements>
<zeebe:formDefinition bindingType="deployment" />
</bpmn:extensionElements>
</bpmn:userTask>
33 changes: 33 additions & 0 deletions test/fixtures/xml/zeebe-bindingType.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.23.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.5.0">
<bpmn:process id="Process_1" isExecutable="true">
<bpmn:userTask id="UserTask_1">
<bpmn:extensionElements>
<zeebe:formDefinition bindingType="deployment" formId="foo" />
</bpmn:extensionElements>
</bpmn:userTask>
<bpmn:callActivity id="CallActivity_1">
<bpmn:extensionElements>
<zeebe:calledElement bindingType="deployment" processId="foo" propagateAllChildVariables="false" />
</bpmn:extensionElements>
</bpmn:callActivity>
<bpmn:businessRuleTask id="BusinessRuleTask_1">
<bpmn:extensionElements>
<zeebe:calledDecision bindingType="deployment" decisionId="foo" resultVariable="bar" />
</bpmn:extensionElements>
</bpmn:businessRuleTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="UserTask_1_di" bpmnElement="UserTask_1">
<dc:Bounds x="160" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_1_di" bpmnElement="CallActivity_1">
<dc:Bounds x="320" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BusinessRuleTask_1_di" bpmnElement="BusinessRuleTask_1">
<dc:Bounds x="480" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
89 changes: 89 additions & 0 deletions test/spec/xml/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,95 @@ describe('read', function() {

});


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

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

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

// given
var xml = readFile('test/fixtures/xml/calledDecision-bindingType.part.bpmn');

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

// then
expect(businessRuleTask).to.jsonEqual({
$type: 'bpmn:BusinessRuleTask',
id: 'BusinessRuleTask_1',
extensionElements: {
$type: 'bpmn:ExtensionElements',
values: [
{
$type: 'zeebe:CalledDecision',
bindingType: 'deployment'
}
]
}
});
});


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

// given
var xml = readFile('test/fixtures/xml/calledElement-bindingType.part.bpmn');

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

// then
expect(callActivity).to.jsonEqual({
$type: 'bpmn:CallActivity',
id: 'CallActivity_1',
extensionElements: {
$type: 'bpmn:ExtensionElements',
values: [
{
$type: 'zeebe:CalledElement',
bindingType: 'deployment'
}
]
}
});
});


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

// given
var xml = readFile('test/fixtures/xml/formDefinition-bindingType.part.bpmn');

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

// then
expect(userTask).to.jsonEqual({
$type: 'bpmn:UserTask',
id: 'UserTask_1',
extensionElements: {
$type: 'bpmn:ExtensionElements',
values: [
{
$type: 'zeebe:FormDefinition',
bindingType: 'deployment'
}
]
}
});
});

});

});

});

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

});


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

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

});

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


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

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

// given
const moddleElement = moddle.create('zeebe:CalledDecision', {
bindingType: 'deployment'
});

const expectedXML = '<zeebe:calledDecision ' +
'xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" ' +
'bindingType="deployment" />';

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

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


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

// given
const moddleElement = moddle.create('zeebe:CalledElement', {
bindingType: 'deployment'
});

const expectedXML = '<zeebe:calledElement ' +
'xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" ' +
'bindingType="deployment" />';

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

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


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

// given
const moddleElement = moddle.create('zeebe:FormDefinition', {
bindingType: 'deployment'
});

const expectedXML = '<zeebe:formDefinition ' +
'xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" ' +
'bindingType="deployment" />';

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

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

});

});

});

0 comments on commit 3202090

Please sign in to comment.