Skip to content

Commit

Permalink
feat: support bpmn:AdHocSubProcess
Browse files Browse the repository at this point in the history
  • Loading branch information
jarekdanielak committed Jan 22, 2025
1 parent 428db77 commit 0669af3
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rules/camunda-cloud/element-type/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@ module.exports = {
'bpmn:SubProcess': '1.0',
'bpmn:Task': '8.2',
'bpmn:TextAnnotation': '1.0',
'bpmn:UserTask': '1.0'
'bpmn:UserTask': '1.0',
'bpmn:AdHocSubProcess': '8.7',
};
2 changes: 2 additions & 0 deletions test/camunda-cloud/camunda-cloud-8-3-element-type.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ const valid = [
}
];

module.exports.valid = valid;

const invalid = [
{
name: 'boundary event (no event definition)',
Expand Down
43 changes: 43 additions & 0 deletions test/camunda-cloud/camunda-cloud-8-6-element-type.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const RuleTester = require('bpmnlint/lib/testers/rule-tester');

const rule = require('../../rules/camunda-cloud/element-type');

const {
withConfig,
createModdle,
createProcess
} = require('../helper');

const { ERROR_TYPES } = require('../../rules/utils/element');

const valid = [
...require('./camunda-cloud-8-3-element-type.spec').valid
];

module.exports.valid = valid;

const invalid = [
{
name: 'ad-hoc subprocess',
moddleElement: createModdle(createProcess(`
<bpmn:adHocSubProcess id="Subprocess_1">
</bpmn:adHocSubProcess>
`)),
report: {
id: 'Subprocess_1',
message: 'Element of type <bpmn:AdHocSubProcess> only allowed by Camunda 8.7 or newer',
path: null,
data: {
type: ERROR_TYPES.ELEMENT_TYPE_NOT_ALLOWED,
node: 'Subprocess_1',
parentNode: null,
allowedVersion: '8.7'
}
}
}
];

RuleTester.verify('camunda-cloud-8-6-element-type', rule, {
valid: withConfig(valid, { version: '8.6' }),
invalid: withConfig(invalid, { version: '8.6' }),
});
29 changes: 29 additions & 0 deletions test/camunda-cloud/camunda-cloud-8-7-element-type.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const RuleTester = require('bpmnlint/lib/testers/rule-tester');

const rule = require('../../rules/camunda-cloud/element-type');

const {
withConfig,
createModdle,
createProcess
} = require('../helper');

const valid = [
...require('./camunda-cloud-8-6-element-type.spec').valid,
{
name: 'ad-hoc subprocess',
moddleElement: createModdle(createProcess(`
<bpmn:adHocSubProcess id="Subprocess_1">
<bpmn:extensionElements>
<zeebe:adHoc activeElementsCollection="=items" />
</bpmn:extensionElements>
<bpmn:task id="Activity_167ttdt" />
</bpmn:adHocSubProcess>
`))
}
];

RuleTester.verify('camunda-cloud-8-7-element-type', rule, {
valid: withConfig(valid, { version: '8.7' }),
invalid: []
});

0 comments on commit 0669af3

Please sign in to comment.