Skip to content

Commit

Permalink
feat: support zeebe:userTask
Browse files Browse the repository at this point in the history
  • Loading branch information
barmac committed Feb 15, 2024
1 parent d05132e commit 7c965b0
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 0 deletions.
17 changes: 17 additions & 0 deletions resources/zeebe.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,26 @@
"name": "formId",
"type": "String",
"isAttr": true
},
{
"name": "externalReference",
"type": "String",
"isAttr": true
}
]
},
{
"name": "UserTask",
"superClass": [
"Element"
],
"meta": {
"allowedIn": [
"bpmn:UserTask"
]
},
"properties": []
},
{
"name": "CalledDecision",
"superClass": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<bpmn:userTask
id="user-task-1"
xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:zeebe="http://camunda.org/schema/zeebe/1.0"
>
<bpmn:extensionElements>
<zeebe:formDefinition externalReference="form-1" />
</bpmn:extensionElements>
</bpmn:userTask>
26 changes: 26 additions & 0 deletions test/fixtures/xml/userTask-zeebe-formDefinition.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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" id="Definitions_1igmezy" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Zeebe Modeler" exporterVersion="0.9.1">
<bpmn:process id="Process_17v88t0" isExecutable="true">
<bpmn:userTask id="Activity_1naoqum" name="Job Worker User Task">
<bpmn:extensionElements>
<zeebe:formDefinition formId="form" />
</bpmn:extensionElements>
</bpmn:userTask>
<bpmn:userTask id="UserTask" name="Zeebe User Task">
<bpmn:extensionElements>
<zeebe:formDefinition externalReference="form-1" />
<zeebe:userTask />
</bpmn:extensionElements>
</bpmn:userTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_17v88t0">
<bpmndi:BPMNShape id="Activity_10g169d_di" bpmnElement="Activity_1naoqum">
<dc:Bounds x="270" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="UserTask_di" bpmnElement="UserTask">
<dc:Bounds x="270" y="180" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
9 changes: 9 additions & 0 deletions test/fixtures/xml/userTask-zeebe-userTask.part.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<bpmn:userTask
id="user-task-1"
xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:zeebe="http://camunda.org/schema/zeebe/1.0"
>
<bpmn:extensionElements>
<zeebe:userTask />
</bpmn:extensionElements>
</bpmn:userTask>
55 changes: 55 additions & 0 deletions test/spec/xml/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,66 @@ describe('read', function() {
});
});


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

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

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

// then
expect(proc).to.jsonEqual({
$type: 'bpmn:UserTask',
id: 'user-task-1',
extensionElements: {
$type: 'bpmn:ExtensionElements',
values: [
{
$type: 'zeebe:FormDefinition',
externalReference: 'form-1'
}
]
}
});
});
});

});


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

it('should read', async function() {

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

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

// then
expect(proc).to.jsonEqual({
$type: 'bpmn:UserTask',
id: 'user-task-1',
extensionElements: {
$type: 'bpmn:ExtensionElements',
values: [
{
$type: 'zeebe:UserTask'
}
]
}
});
});
});


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

it('on BusinessRuleTask', async function() {
Expand Down
6 changes: 6 additions & 0 deletions test/spec/xml/roundtrip.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,10 @@ describe('import -> export roundtrip', function() {


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


describe('userTask', function() {

it('should keep zeebe:formDefinition properties', validateExport('test/fixtures/xml/userTask-zeebe-formDefinition.bpmn'));
});
});
44 changes: 44 additions & 0 deletions test/spec/xml/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,50 @@ describe('write', function() {
expect(xml).to.eql(expectedXML);
});


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

// given
var proc = moddle.create('bpmn:UserTask', {
extensionElements: moddle.create('bpmn:ExtensionElements', {
values: [
moddle.create('zeebe:FormDefinition', {
externalReference: 'form-1'
})
]
})
});

var expectedXML =
'<bpmn:userTask xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" ' +
'xmlns:zeebe="http://camunda.org/schema/zeebe/1.0">' +
'<bpmn:extensionElements>' +
'<zeebe:formDefinition externalReference="form-1" />' +
'</bpmn:extensionElements>' +
'</bpmn:userTask>';

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

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


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

// given
var userTask = moddle.create('zeebe:UserTask', {});

var expectedXML = '<zeebe:userTask ' +
'xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" />';

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

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


Expand Down

0 comments on commit 7c965b0

Please sign in to comment.