├── .github ├── ISSUE_TEMPLATE │ ├── BUG_REPORT.md │ ├── FEATURE_REQUEST.md │ ├── TASK.md │ └── config.yml ├── dependabot.yml ├── merge-me.yml └── workflows │ └── CI.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── eslint.config.mjs ├── package-lock.json ├── package.json ├── renovate.json ├── resources └── camunda.json └── test ├── .eslintrc ├── expect.js ├── fixtures ├── xml │ ├── businessRuleTask.part.bpmn │ ├── callActivity.part.bpmn │ ├── camunda-connector.part.bpmn │ ├── camunda-errorMessage.part.bpmn │ ├── camunda-executionListener-fields.part.bpmn │ ├── camunda-executionListener-script.part.bpmn │ ├── camunda-executionListener.part.bpmn │ ├── camunda-field-attributes.part.bpmn │ ├── camunda-field-children.part.bpmn │ ├── camunda-formData.part.bpmn │ ├── camunda-formField-ids.bpmn │ ├── camunda-formProperty-attributes.part.bpmn │ ├── camunda-formProperty-children.part.bpmn │ ├── camunda-formProperty.part.bpmn │ ├── camunda-in.part.bpmn │ ├── camunda-inputParameter-body.part.bpmn │ ├── camunda-inputParameter-list.part.bpmn │ ├── camunda-inputParameter-map.part.bpmn │ ├── camunda-inputParameter-script.part.bpmn │ ├── camunda-multiInstance.part.bpmn │ ├── camunda-out.part.bpmn │ ├── camunda-outputParameter-mixed.part.bpmn │ ├── camunda-potentialStarter.part.bpmn │ ├── camunda-properties.part.bpmn │ ├── camunda-script.part.bpmn │ ├── camunda-taskListener.part.bpmn │ ├── camunda-timeout-taskListener.part.bpmn │ ├── collaboration-camunda-modelerTemplate.part.bpmn │ ├── collaboration-camunda-modelerTemplateVersion.part.bpmn │ ├── conditionalEventDefinition-camunda-variableEvents.part.bpmn │ ├── conditionalEventDefinition-camunda-variableName.part.bpmn │ ├── definitions-diagramRelationId.part.bpmn │ ├── errorEventDefinition-camunda-errorCodeVariable.part.bpmn │ ├── errorEventDefinition-camunda-errorMessageVariable.part.bpmn │ ├── escalationEventDefinition-camunda-escalationCodeVariable.part.bpmn │ ├── event-camunda-jobPriority.part.bpmn │ ├── formalExpression-resource.part.bpmn │ ├── gateway-camunda-jobPriority.part.bpmn │ ├── inputOutput-nestedList.bpmn │ ├── process-camunda-historyTimeToLive.part.bpmn │ ├── process-camunda-isStartableInTasklist.part.bpmn │ ├── process-camunda-jobPriority.part.bpmn │ ├── process-camunda-modelerTemplate.part.bpmn │ ├── process-camunda-modelerTemplateVersion.part.bpmn │ ├── process-camunda-taskPriority.part.bpmn │ ├── process.part.bpmn │ ├── scriptTask.part.bpmn │ ├── serviceTask-camunda-async.part.bpmn │ ├── serviceTask-camunda-errorEventDefinition.part.bpmn │ ├── serviceTask-camunda-jobPriority.part.bpmn │ ├── serviceTask-camunda-taskPriority.part.bpmn │ ├── signalEventDefinition-camunda-async.part.bpmn │ ├── startEvent-camunda-formHandlerClass.part.bpmn │ ├── startEvent-camunda-formKey.part.bpmn │ ├── startEvent-camunda-formRef-latest.part.bpmn │ ├── startEvent-camunda-formRef-version.part.bpmn │ ├── startEvent-camunda-initiator.part.bpmn │ ├── startEvent-camunda-modelerTemplate.part.bpmn │ ├── startEvent-camunda-modelerTemplateVersion.part.bpmn │ ├── task-camunda-modelerTemplate.part.bpmn │ ├── task-camunda-modelerTemplateVersion.part.bpmn │ ├── userTask-camunda-formData.bpmn │ ├── userTask-camunda-formHandlerClass.part.bpmn │ ├── userTask-camunda-formKey.part.bpmn │ ├── userTask-camunda-formRef-latest.part.bpmn │ ├── userTask-camunda-formRef-version.part.bpmn │ └── userTask-camunda-priority.part.bpmn └── xsd │ └── BPMN20.xsd ├── helper.js ├── integration └── camunda-models.js ├── matchers.js ├── spec ├── ModdleSpec.js └── xml │ ├── read.js │ ├── roundtrip.js │ └── write.js └── xml-helper.js /.github/ISSUE_TEMPLATE/BUG_REPORT.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report a problem and help us fix it. 4 | labels: "bug" 5 | --- 6 | 7 | 8 | __Describe the Bug__ 9 | 10 | A clear and concise description of what the bug is. 11 | 12 | 13 | __Steps to Reproduce__ 14 | 15 | Steps to reproduce the behavior: 16 | 17 | 1. do this 18 | 2. do that 19 | 3. now this happens 20 | 21 | 22 | __Expected Behavior__ 23 | 24 | A clear and concise description of what you expected to happen. 25 | 26 | 27 | __Environment__ 28 | 29 | Please complete the following information: 30 | 31 | - Browser: [e.g. IE 11, Chrome 69] 32 | - OS: [e.g. Windows 7] 33 | - Library version: [e.g. 5.0.0] -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea or general improvement. 4 | labels: "enhancement" 5 | --- 6 | 7 | 8 | __Is your feature request related to a problem? Please describe.__ 9 | 10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 11 | 12 | 13 | __Describe the solution you'd like__ 14 | 15 | A clear and concise description of what you want to happen. 16 | 17 | 18 | __Describe alternatives you've considered__ 19 | 20 | A clear and concise description of any alternative solutions or features you've considered. 21 | 22 | 23 | __Additional context__ 24 | 25 | Add any other context or screenshots about the feature request here. 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/TASK.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Task 3 | about: Describe a generic activity we should carry out. 4 | --- 5 | 6 | 7 | __What should we do?__ 8 | 9 | 10 | 11 | 12 | __Why should we do it?__ 13 | 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Ask a question 4 | url: https://forum.camunda.org/c/modeler 5 | about: Head over to our community forum to ask questions and get answers. -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "npm" 9 | directory: "/" 10 | schedule: 11 | interval: "daily" 12 | reviewers: # Automatically assign reviewer 13 | - "bpmn-io/modeling-dev" 14 | allow: 15 | - dependency-name: "bpmn-moddle" 16 | dependency-type: "all" 17 | commit-message: 18 | prefix: "deps:" 19 | versioning-strategy: "increase" 20 | -------------------------------------------------------------------------------- /.github/merge-me.yml: -------------------------------------------------------------------------------- 1 | reviewTeams: 2 | - modeling-dev 3 | - modeling-design 4 | -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: [ push, pull_request ] 3 | jobs: 4 | Build: 5 | runs-on: ubuntu-latest 6 | 7 | steps: 8 | - name: Checkout 9 | uses: actions/checkout@v4 10 | - name: Use Node.js 11 | uses: actions/setup-node@v4 12 | with: 13 | node-version: 20 14 | cache: 'npm' 15 | - name: Install dependencies 16 | run: npm ci 17 | - name: Build 18 | run: npm run all 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to [camunda-bpmn-moddle](https://github.com/camunda/camunda-bpmn-moddle) are documented here. We use [semantic versioning](http://semver.org/) for releases. 4 | 5 | ## Unreleased 6 | 7 | ___Note:__ Yet to be released changes appear here._ 8 | 9 | ## 7.0.1 10 | 11 | * `DEPS`: update to `bpmn-moddle@7.1.3` 12 | 13 | ## 7.0.0 14 | 15 | * `CHORE`: remove behaviors ([#112](https://github.com/camunda/camunda-bpmn-moddle/pull/112)) 16 | 17 | ### Breaking Changes 18 | 19 | * Behaviors moved to [`camunda-bpmn-js-behaviors`](https://github.com/camunda/camunda-bpmn-js-behaviors) 20 | 21 | ## 6.1.2 22 | 23 | * `DEPS`: deps: mark `bpmn-js@9` and `diagram-js@8` as peer dependency 24 | 25 | ## 6.1.1 26 | 27 | * `FIX`: remove invalid `camunda:formRefBinding` default value ([#87](https://github.com/camunda/camunda-bpmn-moddle/pull/87)) 28 | 29 | ## 6.1.0 30 | 31 | * `FEAT`: remove `variableEvents` for `startEvent` outside of `EventSubProcess` ([#77](https://github.com/camunda/camunda-bpmn-moddle/pull/77)) 32 | * `FIX`: remove `initiator` property for `shape.create` ([#78](https://github.com/camunda/camunda-bpmn-moddle/pull/78)) 33 | 34 | ## 6.0.0 35 | 36 | * `FEAT`: support `camunda:formRef`, `camunda:formRefBinding` and `camunda:formRefVersion` elements ([#76](https://github.com/camunda/camunda-bpmn-moddle/pull/76)) 37 | * `FIX`: remove `initiator` property for `startEvent` when moved to a subProcess ([#74](https://github.com/camunda/camunda-bpmn-moddle/issues/74)) 38 | 39 | ## 5.1.2 40 | 41 | * `FIX`: ensure root element is referenced on correct position ([#70](https://github.com/camunda/camunda-bpmn-moddle/pull/70)) 42 | 43 | ## 5.1.1 44 | 45 | * `FIX`: do not copy non existing root elements ([#69](https://github.com/camunda/camunda-bpmn-moddle/pull/69)) 46 | 47 | ## 5.1.0 48 | 49 | * `FEAT`: add behavior to copy and paste `bpmn:Error` elements referenced via `camunda:ErrorEventDefinition` elements ([#68](https://github.com/camunda/camunda-bpmn-moddle/pull/68)) 50 | * `FIX`: support `camunda:modelerTemplate` and `camunda:modelerTemplateVersion` for `bpmn:Collaboration` elements ([#67](https://github.com/camunda/camunda-bpmn-moddle/pull/67)) 51 | 52 | ## 5.0.0 53 | 54 | * `CHORE`: rename `*EventDefinition` to `*EventDefinitionExtension` 55 | * `FEAT`: support `camunda:ErrorEventDefinition` for external service tasks 56 | 57 | ### Breaking Changes 58 | 59 | * `*EventDefinition` elements were re-named by appending `Extension`. Adjust the name of these elements, if you extended or superclassed them. 60 | 61 | ## 4.5.0 62 | 63 | * `FIX`: add `modelerTemplateVersion` property ([#60](https://github.com/camunda/camunda-bpmn-moddle/pull/60)) 64 | 65 | ## 4.4.1 66 | 67 | * `FIX`: rename `variableEvent` to `variableEvents` ([`cd4a417`](https://github.com/camunda/camunda-bpmn-moddle/commit/cd4a417c1ee7831646f896d2360854aee7ee1ad3)) 68 | 69 | ## 4.4.0 70 | 71 | * `FEAT`: copy [`camunda:in`](https://docs.camunda.org/manual/7.12/reference/bpmn20/custom-extensions/extension-elements/#in) on signal throw events ([#54](https://github.com/camunda/camunda-bpmn-moddle/pull/54)) 72 | 73 | ## 4.3.0 74 | 75 | * `FEAT`: add `id` and `eventDefinitions` to task listener schema ([`9668525f`](https://github.com/camunda/camunda-bpmn-moddle/commit/9668525f217df6938312e84bde0f022115ea5935)) 76 | 77 | ## 4.2.0 78 | 79 | * `FEAT`: add `camunda:diagramRelationId` to schema ([#49](https://github.com/camunda/camunda-bpmn-moddle/issues/49)) 80 | 81 | ## 4.1.2 82 | 83 | * `FIX`: do not copy `camunda:InputOutput` on gateways 84 | * `FIX`: copy `camunda:FailedJobRetryTimeCycle` consistently for all `camunda:AsyncCapable` elements 85 | 86 | ## 4.1.1 87 | 88 | * `FIX`: allow [`camunda:failedJobRetryTimeCycle`](https://docs.camunda.org/manual/7.11/reference/bpmn20/custom-extensions/extension-elements/#failedjobretrytimecycle) in `bpmn:SubProcess` 89 | * `FIX`: allow [`camunda:executionListener`](https://docs.camunda.org/manual/7.11/reference/bpmn20/custom-extensions/extension-elements/#executionlistener) in `bpmn:Process` 90 | 91 | ## 4.1.0 92 | 93 | * `FEAT`: add `camunda:errorMessage` to schema ([`d47da`](https://github.com/camunda/camunda-bpmn-moddle/commit/d47da3a8e90b90994fd397c3ddb6572ce6dcbc1c)) 94 | 95 | ## 4.0.1 96 | 97 | * `DOCS`: update bpmn-js integration docs 98 | 99 | ## 4.0.0 100 | 101 | * `CHORE`: update moddle copy mechanism for compatibility with `bpmn-js@5` 102 | * `CHORE`: use Camunda logical types in `allowedIn` mappings 103 | * `FIX`: make extension work 104 | 105 | ### Breaking Changes 106 | 107 | * Requires `bpmn-js@5+` for proper copying of moddle attributes 108 | 109 | ## 3.2.0 110 | 111 | * `FEAT`: add `camunda:calledElementVersionTag` to schema ([#43](https://github.com/camunda/camunda-bpmn-moddle/issues/43)) 112 | 113 | ## 3.1.1 114 | 115 | * `FIX`: correct `camunda:isStartableInTasklist` default value ([#41](https://github.com/camunda/camunda-bpmn-moddle/issues/41)) 116 | 117 | ## 3.1.0 118 | 119 | * `FEAT`: support `camunda:isStartableInTasklist` 120 | 121 | ## ... 122 | 123 | Check `git log` for earlier history. 124 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2017 camunda Services GmbH 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # camunda-bpmn-moddle 2 | 3 | [![CI](https://github.com/camunda/camunda-bpmn-moddle/workflows/CI/badge.svg)](https://github.com/camunda/camunda-bpmn-moddle/actions?query=workflow%3ACI) 4 | 5 | This project defines the [Camunda](https://camunda.org) namespace extensions for BPMN 2.0 as a [moddle](https://github.com/bpmn-io/moddle) descriptor. 6 | 7 | 8 | ## Usage 9 | 10 | Use it together with [bpmn-moddle](https://github.com/bpmn-io/bpmn-moddle) to validate Camunda BPMN 2.0 extensions. 11 | 12 | ```javascript 13 | import BpmnModdle from 'bpmn-moddle'; 14 | 15 | import camundaModdle from 'camunda-bpmn-moddle/resources/camunda.json'; 16 | 17 | const moddle = new BpmnModdle({ camunda: camundaModdle }); 18 | 19 | const serviceTask = moddle.create('bpmn:ServiceTask', { 20 | 'javaDelegate': 'my.company.SomeDelegate' 21 | }); 22 | ``` 23 | 24 | 25 | ## Building the Project 26 | 27 | To run the test suite that includes XSD schema validation you must have a Java JDK installed and properly exposed through the `JAVA_HOME` variable. 28 | 29 | Execute the test via 30 | 31 | ``` 32 | npm test 33 | ``` 34 | 35 | Perform a complete build of the application via 36 | 37 | ``` 38 | npm run all 39 | ``` 40 | 41 | ## Behaviors 42 | 43 | Inside a [bpmn-js editor](https://github.com/bpmn-io/bpmn-js) pair this extension with [camunda-bpmn-js-behaviors](https://github.com/camunda/camunda-bpmn-js-behaviors#camunda-platform-7) to ensure Camunda properties are created, updated and deleted as expected. 44 | 45 | 46 | ## License 47 | 48 | Use under the terms of the [MIT license](http://opensource.org/licenses/MIT). 49 | -------------------------------------------------------------------------------- /eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import bpmnIoPlugin from 'eslint-plugin-bpmn-io'; 2 | 3 | export default [ 4 | ...bpmnIoPlugin.configs.node, 5 | ...bpmnIoPlugin.configs.mocha.map(config => { 6 | 7 | return { 8 | ...config, 9 | files: [ 10 | 'test/**/*.js', 11 | 'test/**/*.cjs' 12 | ] 13 | }; 14 | }) 15 | ]; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "camunda-bpmn-moddle", 3 | "version": "7.0.1", 4 | "description": "Camunda moddle extensions for BPMN 2.0", 5 | "scripts": { 6 | "all": "run-s lint test", 7 | "lint": "eslint .", 8 | "dev": "npm run test -- --auto-watch --no-single-run", 9 | "test": "mocha -r ./test/expect --reporter=spec \"test/**/*.js\"" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/camunda/camunda-bpmn-moddle" 14 | }, 15 | "keywords": [ 16 | "bpmn", 17 | "moddle", 18 | "bpmn20", 19 | "camunda", 20 | "meta-model" 21 | ], 22 | "author": { 23 | "name": "Nico Rehwaldt", 24 | "url": "https://github.com/nikku" 25 | }, 26 | "contributors": [ 27 | { 28 | "name": "bpmn.io contributors", 29 | "url": "https://github.com/bpmn-io" 30 | } 31 | ], 32 | "license": "MIT", 33 | "devDependencies": { 34 | "bpmn-moddle": "^9.0.1", 35 | "chai": "^4.3.0", 36 | "eslint": "^9.12.0", 37 | "eslint-plugin-bpmn-io": "^2.0.2", 38 | "esm": "^3.2.25", 39 | "glob": "^11.0.0", 40 | "mocha": "^10.0.0", 41 | "npm-run-all2": "^8.0.0", 42 | "p-series": "^2.1.0", 43 | "xsd-schema-validator": "^0.7.0" 44 | }, 45 | "files": [ 46 | "resources" 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "github>bpmn-io/renovate-config:recommended" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /resources/camunda.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Camunda", 3 | "uri": "http://camunda.org/schema/1.0/bpmn", 4 | "prefix": "camunda", 5 | "xml": { 6 | "tagAlias": "lowerCase" 7 | }, 8 | "associations": [], 9 | "types": [ 10 | { 11 | "name": "Definitions", 12 | "isAbstract": true, 13 | "extends": [ 14 | "bpmn:Definitions" 15 | ], 16 | "properties": [ 17 | { 18 | "name": "diagramRelationId", 19 | "isAttr": true, 20 | "type": "String" 21 | } 22 | ] 23 | }, 24 | { 25 | "name": "InOutBinding", 26 | "superClass": [ 27 | "Element" 28 | ], 29 | "isAbstract": true, 30 | "properties": [ 31 | { 32 | "name": "source", 33 | "isAttr": true, 34 | "type": "String" 35 | }, 36 | { 37 | "name": "sourceExpression", 38 | "isAttr": true, 39 | "type": "String" 40 | }, 41 | { 42 | "name": "target", 43 | "isAttr": true, 44 | "type": "String" 45 | }, 46 | { 47 | "name": "businessKey", 48 | "isAttr": true, 49 | "type": "String" 50 | }, 51 | { 52 | "name": "local", 53 | "isAttr": true, 54 | "type": "Boolean", 55 | "default": false 56 | }, 57 | { 58 | "name": "variables", 59 | "isAttr": true, 60 | "type": "String" 61 | } 62 | ] 63 | }, 64 | { 65 | "name": "In", 66 | "superClass": [ 67 | "InOutBinding" 68 | ], 69 | "meta": { 70 | "allowedIn": [ 71 | "bpmn:CallActivity", 72 | "bpmn:SignalEventDefinition" 73 | ] 74 | } 75 | }, 76 | { 77 | "name": "Out", 78 | "superClass": [ 79 | "InOutBinding" 80 | ], 81 | "meta": { 82 | "allowedIn": [ 83 | "bpmn:CallActivity" 84 | ] 85 | } 86 | }, 87 | { 88 | "name": "AsyncCapable", 89 | "isAbstract": true, 90 | "extends": [ 91 | "bpmn:Activity", 92 | "bpmn:Gateway", 93 | "bpmn:Event" 94 | ], 95 | "properties": [ 96 | { 97 | "name": "async", 98 | "isAttr": true, 99 | "type": "Boolean", 100 | "default": false 101 | }, 102 | { 103 | "name": "asyncBefore", 104 | "isAttr": true, 105 | "type": "Boolean", 106 | "default": false 107 | }, 108 | { 109 | "name": "asyncAfter", 110 | "isAttr": true, 111 | "type": "Boolean", 112 | "default": false 113 | }, 114 | { 115 | "name": "exclusive", 116 | "isAttr": true, 117 | "type": "Boolean", 118 | "default": true 119 | } 120 | ] 121 | }, 122 | { 123 | "name": "JobPriorized", 124 | "isAbstract": true, 125 | "extends": [ 126 | "bpmn:Process", 127 | "camunda:AsyncCapable" 128 | ], 129 | "properties": [ 130 | { 131 | "name": "jobPriority", 132 | "isAttr": true, 133 | "type": "String" 134 | } 135 | ] 136 | }, 137 | { 138 | "name": "SignalEventDefinitionExtension", 139 | "isAbstract": true, 140 | "extends": [ 141 | "bpmn:SignalEventDefinition" 142 | ], 143 | "properties": [ 144 | { 145 | "name": "async", 146 | "isAttr": true, 147 | "type": "Boolean", 148 | "default": false 149 | } 150 | ] 151 | }, 152 | { 153 | "name": "ErrorEventDefinitionExtension", 154 | "isAbstract": true, 155 | "extends": [ 156 | "bpmn:ErrorEventDefinition" 157 | ], 158 | "properties": [ 159 | { 160 | "name": "errorCodeVariable", 161 | "isAttr": true, 162 | "type": "String" 163 | }, 164 | { 165 | "name": "errorMessageVariable", 166 | "isAttr": true, 167 | "type": "String" 168 | } 169 | ] 170 | }, 171 | { 172 | "name": "ErrorEventDefinition", 173 | "superClass": [ 174 | "bpmn:ErrorEventDefinition", 175 | "Element" 176 | ], 177 | "properties": [ 178 | { 179 | "name": "expression", 180 | "isAttr": true, 181 | "type": "String" 182 | } 183 | ], 184 | "meta": { 185 | "allowedIn": [ "bpmn:ServiceTask" ] 186 | } 187 | }, 188 | { 189 | "name": "Error", 190 | "isAbstract": true, 191 | "extends": [ 192 | "bpmn:Error" 193 | ], 194 | "properties": [ 195 | { 196 | "name": "camunda:errorMessage", 197 | "isAttr": true, 198 | "type": "String" 199 | } 200 | ] 201 | }, 202 | { 203 | "name": "PotentialStarter", 204 | "superClass": [ 205 | "Element" 206 | ], 207 | "properties": [ 208 | { 209 | "name": "resourceAssignmentExpression", 210 | "type": "bpmn:ResourceAssignmentExpression" 211 | } 212 | ] 213 | }, 214 | { 215 | "name": "FormSupported", 216 | "isAbstract": true, 217 | "extends": [ 218 | "bpmn:StartEvent", 219 | "bpmn:UserTask" 220 | ], 221 | "properties": [ 222 | { 223 | "name": "formHandlerClass", 224 | "isAttr": true, 225 | "type": "String" 226 | }, 227 | { 228 | "name": "formKey", 229 | "isAttr": true, 230 | "type": "String" 231 | }, 232 | { 233 | "name": "formRef", 234 | "isAttr": true, 235 | "type": "String" 236 | }, 237 | { 238 | "name": "formRefBinding", 239 | "isAttr": true, 240 | "type": "String" 241 | }, 242 | { 243 | "name": "formRefVersion", 244 | "isAttr": true, 245 | "type": "String" 246 | } 247 | ] 248 | }, 249 | { 250 | "name": "TemplateSupported", 251 | "isAbstract": true, 252 | "extends": [ 253 | "bpmn:Collaboration", 254 | "bpmn:Process", 255 | "bpmn:FlowElement" 256 | ], 257 | "properties": [ 258 | { 259 | "name": "modelerTemplate", 260 | "isAttr": true, 261 | "type": "String" 262 | }, 263 | { 264 | "name": "modelerTemplateVersion", 265 | "isAttr": true, 266 | "type": "Integer" 267 | } 268 | ] 269 | }, 270 | { 271 | "name": "Initiator", 272 | "isAbstract": true, 273 | "extends": [ "bpmn:StartEvent" ], 274 | "properties": [ 275 | { 276 | "name": "initiator", 277 | "isAttr": true, 278 | "type": "String" 279 | } 280 | ] 281 | }, 282 | { 283 | "name": "ScriptTask", 284 | "isAbstract": true, 285 | "extends": [ 286 | "bpmn:ScriptTask" 287 | ], 288 | "properties": [ 289 | { 290 | "name": "resultVariable", 291 | "isAttr": true, 292 | "type": "String" 293 | }, 294 | { 295 | "name": "resource", 296 | "isAttr": true, 297 | "type": "String" 298 | } 299 | ] 300 | }, 301 | { 302 | "name": "Process", 303 | "isAbstract": true, 304 | "extends": [ 305 | "bpmn:Process" 306 | ], 307 | "properties": [ 308 | { 309 | "name": "candidateStarterGroups", 310 | "isAttr": true, 311 | "type": "String" 312 | }, 313 | { 314 | "name": "candidateStarterUsers", 315 | "isAttr": true, 316 | "type": "String" 317 | }, 318 | { 319 | "name": "versionTag", 320 | "isAttr": true, 321 | "type": "String" 322 | }, 323 | { 324 | "name": "historyTimeToLive", 325 | "isAttr": true, 326 | "type": "String" 327 | }, 328 | { 329 | "name": "isStartableInTasklist", 330 | "isAttr": true, 331 | "type": "Boolean", 332 | "default": true 333 | } 334 | ] 335 | }, 336 | { 337 | "name": "EscalationEventDefinitionExtension", 338 | "isAbstract": true, 339 | "extends": [ 340 | "bpmn:EscalationEventDefinition" 341 | ], 342 | "properties": [ 343 | { 344 | "name": "escalationCodeVariable", 345 | "isAttr": true, 346 | "type": "String" 347 | } 348 | ] 349 | }, 350 | { 351 | "name": "FormalExpression", 352 | "isAbstract": true, 353 | "extends": [ 354 | "bpmn:FormalExpression" 355 | ], 356 | "properties": [ 357 | { 358 | "name": "resource", 359 | "isAttr": true, 360 | "type": "String" 361 | } 362 | ] 363 | }, 364 | { 365 | "name": "Assignable", 366 | "extends": [ "bpmn:UserTask" ], 367 | "properties": [ 368 | { 369 | "name": "assignee", 370 | "isAttr": true, 371 | "type": "String" 372 | }, 373 | { 374 | "name": "candidateUsers", 375 | "isAttr": true, 376 | "type": "String" 377 | }, 378 | { 379 | "name": "candidateGroups", 380 | "isAttr": true, 381 | "type": "String" 382 | }, 383 | { 384 | "name": "dueDate", 385 | "isAttr": true, 386 | "type": "String" 387 | }, 388 | { 389 | "name": "followUpDate", 390 | "isAttr": true, 391 | "type": "String" 392 | }, 393 | { 394 | "name": "priority", 395 | "isAttr": true, 396 | "type": "String" 397 | } 398 | ] 399 | }, 400 | { 401 | "name": "CallActivity", 402 | "extends": [ "bpmn:CallActivity" ], 403 | "properties": [ 404 | { 405 | "name": "calledElementBinding", 406 | "isAttr": true, 407 | "type": "String", 408 | "default": "latest" 409 | }, 410 | { 411 | "name": "calledElementVersion", 412 | "isAttr": true, 413 | "type": "String" 414 | }, 415 | { 416 | "name": "calledElementVersionTag", 417 | "isAttr": true, 418 | "type": "String" 419 | }, 420 | { 421 | "name": "calledElementTenantId", 422 | "isAttr": true, 423 | "type": "String" 424 | }, 425 | { 426 | "name": "caseRef", 427 | "isAttr": true, 428 | "type": "String" 429 | }, 430 | { 431 | "name": "caseBinding", 432 | "isAttr": true, 433 | "type": "String", 434 | "default": "latest" 435 | }, 436 | { 437 | "name": "caseVersion", 438 | "isAttr": true, 439 | "type": "String" 440 | }, 441 | { 442 | "name": "caseTenantId", 443 | "isAttr": true, 444 | "type": "String" 445 | }, 446 | { 447 | "name": "variableMappingClass", 448 | "isAttr": true, 449 | "type": "String" 450 | }, 451 | { 452 | "name": "variableMappingDelegateExpression", 453 | "isAttr": true, 454 | "type": "String" 455 | } 456 | ] 457 | }, 458 | { 459 | "name": "ServiceTaskLike", 460 | "extends": [ 461 | "bpmn:ServiceTask", 462 | "bpmn:BusinessRuleTask", 463 | "bpmn:SendTask", 464 | "bpmn:MessageEventDefinition" 465 | ], 466 | "properties": [ 467 | { 468 | "name": "expression", 469 | "isAttr": true, 470 | "type": "String" 471 | }, 472 | { 473 | "name": "class", 474 | "isAttr": true, 475 | "type": "String" 476 | }, 477 | { 478 | "name": "delegateExpression", 479 | "isAttr": true, 480 | "type": "String" 481 | }, 482 | { 483 | "name": "resultVariable", 484 | "isAttr": true, 485 | "type": "String" 486 | } 487 | ] 488 | }, 489 | { 490 | "name": "DmnCapable", 491 | "extends": [ 492 | "bpmn:BusinessRuleTask" 493 | ], 494 | "properties": [ 495 | { 496 | "name": "decisionRef", 497 | "isAttr": true, 498 | "type": "String" 499 | }, 500 | { 501 | "name": "decisionRefBinding", 502 | "isAttr": true, 503 | "type": "String", 504 | "default": "latest" 505 | }, 506 | { 507 | "name": "decisionRefVersion", 508 | "isAttr": true, 509 | "type": "String" 510 | }, 511 | { 512 | "name": "mapDecisionResult", 513 | "isAttr": true, 514 | "type": "String", 515 | "default": "resultList" 516 | }, 517 | { 518 | "name": "decisionRefTenantId", 519 | "isAttr": true, 520 | "type": "String" 521 | } 522 | ] 523 | }, 524 | { 525 | "name": "ExternalCapable", 526 | "extends": [ 527 | "camunda:ServiceTaskLike" 528 | ], 529 | "properties": [ 530 | { 531 | "name": "type", 532 | "isAttr": true, 533 | "type": "String" 534 | }, 535 | { 536 | "name": "topic", 537 | "isAttr": true, 538 | "type": "String" 539 | } 540 | ] 541 | }, 542 | { 543 | "name": "TaskPriorized", 544 | "extends": [ 545 | "bpmn:Process", 546 | "camunda:ExternalCapable" 547 | ], 548 | "properties": [ 549 | { 550 | "name": "taskPriority", 551 | "isAttr": true, 552 | "type": "String" 553 | } 554 | ] 555 | }, 556 | { 557 | "name": "Properties", 558 | "superClass": [ 559 | "Element" 560 | ], 561 | "meta": { 562 | "allowedIn": [ "*" ] 563 | }, 564 | "properties": [ 565 | { 566 | "name": "values", 567 | "type": "Property", 568 | "isMany": true 569 | } 570 | ] 571 | }, 572 | { 573 | "name": "Property", 574 | "superClass": [ 575 | "Element" 576 | ], 577 | "properties": [ 578 | { 579 | "name": "id", 580 | "type": "String", 581 | "isAttr": true 582 | }, 583 | { 584 | "name": "name", 585 | "type": "String", 586 | "isAttr": true 587 | }, 588 | { 589 | "name": "value", 590 | "type": "String", 591 | "isAttr": true 592 | } 593 | ] 594 | }, 595 | { 596 | "name": "Connector", 597 | "superClass": [ 598 | "Element" 599 | ], 600 | "meta": { 601 | "allowedIn": [ 602 | "camunda:ServiceTaskLike" 603 | ] 604 | }, 605 | "properties": [ 606 | { 607 | "name": "inputOutput", 608 | "type": "InputOutput" 609 | }, 610 | { 611 | "name": "connectorId", 612 | "type": "String" 613 | } 614 | ] 615 | }, 616 | { 617 | "name": "InputOutput", 618 | "superClass": [ 619 | "Element" 620 | ], 621 | "meta": { 622 | "allowedIn": [ 623 | "bpmn:FlowNode", 624 | "camunda:Connector" 625 | ] 626 | }, 627 | "properties": [ 628 | { 629 | "name": "inputOutput", 630 | "type": "InputOutput" 631 | }, 632 | { 633 | "name": "connectorId", 634 | "type": "String" 635 | }, 636 | { 637 | "name": "inputParameters", 638 | "isMany": true, 639 | "type": "InputParameter" 640 | }, 641 | { 642 | "name": "outputParameters", 643 | "isMany": true, 644 | "type": "OutputParameter" 645 | } 646 | ] 647 | }, 648 | { 649 | "name": "InputOutputParameter", 650 | "properties": [ 651 | { 652 | "name": "name", 653 | "isAttr": true, 654 | "type": "String" 655 | }, 656 | { 657 | "name": "value", 658 | "isBody": true, 659 | "type": "String" 660 | }, 661 | { 662 | "name": "definition", 663 | "type": "InputOutputParameterDefinition" 664 | } 665 | ] 666 | }, 667 | { 668 | "name": "InputOutputParameterDefinition", 669 | "isAbstract": true 670 | }, 671 | { 672 | "name": "List", 673 | "superClass": [ "InputOutputParameterDefinition" ], 674 | "properties": [ 675 | { 676 | "name": "items", 677 | "isMany": true, 678 | "type": "InputOutputParameterDefinition" 679 | } 680 | ] 681 | }, 682 | { 683 | "name": "Map", 684 | "superClass": [ "InputOutputParameterDefinition" ], 685 | "properties": [ 686 | { 687 | "name": "entries", 688 | "isMany": true, 689 | "type": "Entry" 690 | } 691 | ] 692 | }, 693 | { 694 | "name": "Entry", 695 | "properties": [ 696 | { 697 | "name": "key", 698 | "isAttr": true, 699 | "type": "String" 700 | }, 701 | { 702 | "name": "value", 703 | "isBody": true, 704 | "type": "String" 705 | }, 706 | { 707 | "name": "definition", 708 | "type": "InputOutputParameterDefinition" 709 | } 710 | ] 711 | }, 712 | { 713 | "name": "Value", 714 | "superClass": [ 715 | "InputOutputParameterDefinition" 716 | ], 717 | "properties": [ 718 | { 719 | "name": "id", 720 | "isAttr": true, 721 | "type": "String" 722 | }, 723 | { 724 | "name": "name", 725 | "isAttr": true, 726 | "type": "String" 727 | }, 728 | { 729 | "name": "value", 730 | "isBody": true, 731 | "type": "String" 732 | } 733 | ] 734 | }, 735 | { 736 | "name": "Script", 737 | "superClass": [ "InputOutputParameterDefinition" ], 738 | "properties": [ 739 | { 740 | "name": "scriptFormat", 741 | "isAttr": true, 742 | "type": "String" 743 | }, 744 | { 745 | "name": "resource", 746 | "isAttr": true, 747 | "type": "String" 748 | }, 749 | { 750 | "name": "value", 751 | "isBody": true, 752 | "type": "String" 753 | } 754 | ] 755 | }, 756 | { 757 | "name": "Field", 758 | "superClass": [ "Element" ], 759 | "meta": { 760 | "allowedIn": [ 761 | "camunda:ServiceTaskLike", 762 | "camunda:ExecutionListener", 763 | "camunda:TaskListener" 764 | ] 765 | }, 766 | "properties": [ 767 | { 768 | "name": "name", 769 | "isAttr": true, 770 | "type": "String" 771 | }, 772 | { 773 | "name": "expression", 774 | "type": "String" 775 | }, 776 | { 777 | "name": "stringValue", 778 | "isAttr": true, 779 | "type": "String" 780 | }, 781 | { 782 | "name": "string", 783 | "type": "String" 784 | } 785 | ] 786 | }, 787 | { 788 | "name": "InputParameter", 789 | "superClass": [ "InputOutputParameter" ] 790 | }, 791 | { 792 | "name": "OutputParameter", 793 | "superClass": [ "InputOutputParameter" ] 794 | }, 795 | { 796 | "name": "Collectable", 797 | "isAbstract": true, 798 | "extends": [ "bpmn:MultiInstanceLoopCharacteristics" ], 799 | "superClass": [ "camunda:AsyncCapable" ], 800 | "properties": [ 801 | { 802 | "name": "collection", 803 | "isAttr": true, 804 | "type": "String" 805 | }, 806 | { 807 | "name": "elementVariable", 808 | "isAttr": true, 809 | "type": "String" 810 | } 811 | ] 812 | }, 813 | { 814 | "name": "FailedJobRetryTimeCycle", 815 | "superClass": [ "Element" ], 816 | "meta": { 817 | "allowedIn": [ 818 | "camunda:AsyncCapable", 819 | "bpmn:MultiInstanceLoopCharacteristics" 820 | ] 821 | }, 822 | "properties": [ 823 | { 824 | "name": "body", 825 | "isBody": true, 826 | "type": "String" 827 | } 828 | ] 829 | }, 830 | { 831 | "name": "ExecutionListener", 832 | "superClass": [ "Element" ], 833 | "meta": { 834 | "allowedIn": [ 835 | "bpmn:Task", 836 | "bpmn:ServiceTask", 837 | "bpmn:UserTask", 838 | "bpmn:BusinessRuleTask", 839 | "bpmn:ScriptTask", 840 | "bpmn:ReceiveTask", 841 | "bpmn:ManualTask", 842 | "bpmn:ExclusiveGateway", 843 | "bpmn:SequenceFlow", 844 | "bpmn:ParallelGateway", 845 | "bpmn:InclusiveGateway", 846 | "bpmn:EventBasedGateway", 847 | "bpmn:StartEvent", 848 | "bpmn:IntermediateCatchEvent", 849 | "bpmn:IntermediateThrowEvent", 850 | "bpmn:EndEvent", 851 | "bpmn:BoundaryEvent", 852 | "bpmn:CallActivity", 853 | "bpmn:SubProcess", 854 | "bpmn:Process" 855 | ] 856 | }, 857 | "properties": [ 858 | { 859 | "name": "expression", 860 | "isAttr": true, 861 | "type": "String" 862 | }, 863 | { 864 | "name": "class", 865 | "isAttr": true, 866 | "type": "String" 867 | }, 868 | { 869 | "name": "delegateExpression", 870 | "isAttr": true, 871 | "type": "String" 872 | }, 873 | { 874 | "name": "event", 875 | "isAttr": true, 876 | "type": "String" 877 | }, 878 | { 879 | "name": "script", 880 | "type": "Script" 881 | }, 882 | { 883 | "name": "fields", 884 | "type": "Field", 885 | "isMany": true 886 | } 887 | ] 888 | }, 889 | { 890 | "name": "TaskListener", 891 | "superClass": [ "Element" ], 892 | "meta": { 893 | "allowedIn": [ 894 | "bpmn:UserTask" 895 | ] 896 | }, 897 | "properties": [ 898 | { 899 | "name": "expression", 900 | "isAttr": true, 901 | "type": "String" 902 | }, 903 | { 904 | "name": "class", 905 | "isAttr": true, 906 | "type": "String" 907 | }, 908 | { 909 | "name": "delegateExpression", 910 | "isAttr": true, 911 | "type": "String" 912 | }, 913 | { 914 | "name": "event", 915 | "isAttr": true, 916 | "type": "String" 917 | }, 918 | { 919 | "name": "script", 920 | "type": "Script" 921 | }, 922 | { 923 | "name": "fields", 924 | "type": "Field", 925 | "isMany": true 926 | }, 927 | { 928 | "name": "id", 929 | "type": "String", 930 | "isAttr": true 931 | }, 932 | { 933 | "name": "eventDefinitions", 934 | "type": "bpmn:TimerEventDefinition", 935 | "isMany": true 936 | } 937 | ] 938 | }, 939 | { 940 | "name": "FormProperty", 941 | "superClass": [ "Element" ], 942 | "meta": { 943 | "allowedIn": [ 944 | "bpmn:StartEvent", 945 | "bpmn:UserTask" 946 | ] 947 | }, 948 | "properties": [ 949 | { 950 | "name": "id", 951 | "type": "String", 952 | "isAttr": true 953 | }, 954 | { 955 | "name": "name", 956 | "type": "String", 957 | "isAttr": true 958 | }, 959 | { 960 | "name": "type", 961 | "type": "String", 962 | "isAttr": true 963 | }, 964 | { 965 | "name": "required", 966 | "type": "String", 967 | "isAttr": true 968 | }, 969 | { 970 | "name": "readable", 971 | "type": "String", 972 | "isAttr": true 973 | }, 974 | { 975 | "name": "writable", 976 | "type": "String", 977 | "isAttr": true 978 | }, 979 | { 980 | "name": "variable", 981 | "type": "String", 982 | "isAttr": true 983 | }, 984 | { 985 | "name": "expression", 986 | "type": "String", 987 | "isAttr": true 988 | }, 989 | { 990 | "name": "datePattern", 991 | "type": "String", 992 | "isAttr": true 993 | }, 994 | { 995 | "name": "default", 996 | "type": "String", 997 | "isAttr": true 998 | }, 999 | { 1000 | "name": "values", 1001 | "type": "Value", 1002 | "isMany": true 1003 | } 1004 | ] 1005 | }, 1006 | { 1007 | "name": "FormData", 1008 | "superClass": [ "Element" ], 1009 | "meta": { 1010 | "allowedIn": [ 1011 | "bpmn:StartEvent", 1012 | "bpmn:UserTask" 1013 | ] 1014 | }, 1015 | "properties": [ 1016 | { 1017 | "name": "fields", 1018 | "type": "FormField", 1019 | "isMany": true 1020 | }, 1021 | { 1022 | "name": "businessKey", 1023 | "type": "String", 1024 | "isAttr": true 1025 | } 1026 | ] 1027 | }, 1028 | { 1029 | "name": "FormField", 1030 | "superClass": [ "Element" ], 1031 | "properties": [ 1032 | { 1033 | "name": "id", 1034 | "type": "String", 1035 | "isAttr": true 1036 | }, 1037 | { 1038 | "name": "label", 1039 | "type": "String", 1040 | "isAttr": true 1041 | }, 1042 | { 1043 | "name": "type", 1044 | "type": "String", 1045 | "isAttr": true 1046 | }, 1047 | { 1048 | "name": "datePattern", 1049 | "type": "String", 1050 | "isAttr": true 1051 | }, 1052 | { 1053 | "name": "defaultValue", 1054 | "type": "String", 1055 | "isAttr": true 1056 | }, 1057 | { 1058 | "name": "properties", 1059 | "type": "Properties" 1060 | }, 1061 | { 1062 | "name": "validation", 1063 | "type": "Validation" 1064 | }, 1065 | { 1066 | "name": "values", 1067 | "type": "Value", 1068 | "isMany": true 1069 | } 1070 | ] 1071 | }, 1072 | { 1073 | "name": "Validation", 1074 | "superClass": [ "Element" ], 1075 | "properties": [ 1076 | { 1077 | "name": "constraints", 1078 | "type": "Constraint", 1079 | "isMany": true 1080 | } 1081 | ] 1082 | }, 1083 | { 1084 | "name": "Constraint", 1085 | "superClass": [ "Element" ], 1086 | "properties": [ 1087 | { 1088 | "name": "name", 1089 | "type": "String", 1090 | "isAttr": true 1091 | }, 1092 | { 1093 | "name": "config", 1094 | "type": "String", 1095 | "isAttr": true 1096 | } 1097 | ] 1098 | }, 1099 | { 1100 | "name": "ConditionalEventDefinitionExtension", 1101 | "isAbstract": true, 1102 | "extends": [ 1103 | "bpmn:ConditionalEventDefinition" 1104 | ], 1105 | "properties": [ 1106 | { 1107 | "name": "variableName", 1108 | "isAttr": true, 1109 | "type": "String" 1110 | }, 1111 | { 1112 | "name": "variableEvents", 1113 | "isAttr": true, 1114 | "type": "String" 1115 | } 1116 | ] 1117 | } 1118 | ], 1119 | "emumerations": [ ] 1120 | } 1121 | -------------------------------------------------------------------------------- /test/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "plugin:bpmn-io/mocha" 3 | } -------------------------------------------------------------------------------- /test/expect.js: -------------------------------------------------------------------------------- 1 | var chai = require('chai'); 2 | 3 | // add matchers 4 | chai.use(require('./matchers')); 5 | 6 | // expose expect as global 7 | global.expect = chai.expect; -------------------------------------------------------------------------------- /test/fixtures/xml/businessRuleTask.part.bpmn: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /test/fixtures/xml/callActivity.part.bpmn: -------------------------------------------------------------------------------- 1 | 13 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-connector.part.bpmn: -------------------------------------------------------------------------------- 1 | 2 | connector 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-errorMessage.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-executionListener-fields.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-executionListener-script.part.bpmn: -------------------------------------------------------------------------------- 1 | 3 | foo = bar; 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-executionListener.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-field-attributes.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-field-children.part.bpmn: -------------------------------------------------------------------------------- 1 | 2 | Hi!]]> 3 | 42 is the answer! 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-formData.part.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-formField-ids.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-formProperty-attributes.part.bpmn: -------------------------------------------------------------------------------- 1 | 13 | 14 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-formProperty-children.part.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-formProperty.part.bpmn: -------------------------------------------------------------------------------- 1 | 13 | 14 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-in.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-inputParameter-body.part.bpmn: -------------------------------------------------------------------------------- 1 | 3 | BAR 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-inputParameter-list.part.bpmn: -------------------------------------------------------------------------------- 1 | 3 | 4 | ${1+1} 5 | ${1+2} 6 | ${1+3} 7 | 8 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-inputParameter-map.part.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | ${1+1} 4 | ${1+2} 5 | ${1+3} 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-inputParameter-script.part.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-multiInstance.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-out.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-outputParameter-mixed.part.bpmn: -------------------------------------------------------------------------------- 1 | 3 | 4 | constantStringValue 5 | ${ 'elValue' } 6 | return "scriptValue"; 7 | 8 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-potentialStarter.part.bpmn: -------------------------------------------------------------------------------- 1 | 3 | 4 | group2, group(group3), user(user3) 5 | 6 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-properties.part.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-script.part.bpmn: -------------------------------------------------------------------------------- 1 | 3 | foo = bar; 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-taskListener.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/camunda-timeout-taskListener.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | 5 | PT1H 6 | 7 | -------------------------------------------------------------------------------- /test/fixtures/xml/collaboration-camunda-modelerTemplate.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/collaboration-camunda-modelerTemplateVersion.part.bpmn: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test/fixtures/xml/conditionalEventDefinition-camunda-variableEvents.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/conditionalEventDefinition-camunda-variableName.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/definitions-diagramRelationId.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/errorEventDefinition-camunda-errorCodeVariable.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/errorEventDefinition-camunda-errorMessageVariable.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/escalationEventDefinition-camunda-escalationCodeVariable.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/event-camunda-jobPriority.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/formalExpression-resource.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/gateway-camunda-jobPriority.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/inputOutput-nestedList.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | SequenceFlow_1 17 | 18 | 19 | 20 | 21 | 22 | 23 | constantStringValue 24 | ${ 'elValue' } 25 | return "scriptValue"; 26 | 27 | 28 | a 29 | b 30 | c 31 | 32 | d 33 | 34 | 35 | bar 36 | world 37 | 38 | 39 | 40 | 41 | 42 | SequenceFlow_1 43 | SequenceFlow_2 44 | 45 | 46 | 47 | SequenceFlow_2 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /test/fixtures/xml/process-camunda-historyTimeToLive.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/process-camunda-isStartableInTasklist.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/process-camunda-jobPriority.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/process-camunda-modelerTemplate.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/process-camunda-modelerTemplateVersion.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/process-camunda-taskPriority.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/process.part.bpmn: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /test/fixtures/xml/scriptTask.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/serviceTask-camunda-async.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/serviceTask-camunda-errorEventDefinition.part.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /test/fixtures/xml/serviceTask-camunda-jobPriority.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/serviceTask-camunda-taskPriority.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/signalEventDefinition-camunda-async.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xml/startEvent-camunda-formHandlerClass.part.bpmn: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test/fixtures/xml/startEvent-camunda-formKey.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/startEvent-camunda-formRef-latest.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/startEvent-camunda-formRef-version.part.bpmn: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test/fixtures/xml/startEvent-camunda-initiator.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/startEvent-camunda-modelerTemplate.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/startEvent-camunda-modelerTemplateVersion.part.bpmn: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test/fixtures/xml/task-camunda-modelerTemplate.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/task-camunda-modelerTemplateVersion.part.bpmn: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-camunda-formData.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-camunda-formHandlerClass.part.bpmn: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-camunda-formKey.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-camunda-formRef-latest.part.bpmn: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-camunda-formRef-version.part.bpmn: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /test/fixtures/xml/userTask-camunda-priority.part.bpmn: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/xsd/BPMN20.xsd: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /test/helper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var fs = require('fs'); 4 | 5 | 6 | function readFile(filename) { 7 | return fs.readFileSync(filename, { encoding: 'UTF-8' }); 8 | } 9 | 10 | module.exports.readFile = readFile; 11 | 12 | 13 | var BpmnModdle = require('bpmn-moddle'); 14 | 15 | var camundaDescriptor = require('../resources/camunda'); 16 | 17 | function createModdle() { 18 | return new BpmnModdle({ 19 | camunda: camundaDescriptor 20 | }); 21 | } 22 | 23 | module.exports.createModdle = createModdle; -------------------------------------------------------------------------------- /test/integration/camunda-models.js: -------------------------------------------------------------------------------- 1 | const globSync = require('glob').sync; 2 | const pSeries = require('p-series'); 3 | 4 | const { 5 | readFile, 6 | createModdle 7 | } = require('../helper'); 8 | 9 | const path = require('path'); 10 | 11 | const platformPath = '../../camunda-bpm/camunda-bpm-platform'; 12 | 13 | const diagramPath = path.resolve(platformPath, 'engine/src/test/resources'); 14 | 15 | 16 | describe.skip('camunda models', function() { 17 | 18 | // QA takes time (!) 19 | this.timeout(30000); 20 | 21 | 22 | it('should parse camunda extensions', async function() { 23 | 24 | const allFiles = [].concat( 25 | globSync('**/*.bpmn', { cwd: diagramPath, dot: true }), 26 | globSync('**/*.bpmn20.xml', { cwd: diagramPath, dot: true }) 27 | ); 28 | 29 | const results = { 30 | OK: 0, 31 | ERROR: 0, 32 | WARNINGS: 0 33 | }; 34 | 35 | await pSeries(allFiles.map( 36 | async function(localPath) { 37 | 38 | const fullPath = diagramPath + '/' + localPath; 39 | 40 | const xml = readFile(fullPath); 41 | 42 | const result = await parseDiagram(xml); 43 | 44 | const warnings = result.warnings.filter(function(w) { 45 | return w.message.indexOf('unresolved reference') === -1; 46 | }); 47 | 48 | const status = result.error ? 'ERROR' : (warnings.length ? 'WARNINGS' : 'OK'); 49 | 50 | console.log('%s - %s', status, localPath); 51 | if (warnings.length) { 52 | console.log('\twarnings: %s', JSON.stringify(warnings)); 53 | } 54 | 55 | if (result.error) { 56 | console.log('\terror: %s', result.error); 57 | } 58 | 59 | results[status]++; 60 | } 61 | )); 62 | 63 | console.log('results\n\tok: %s\n\terror: %s\n\twarnings: %s', 64 | results['OK'], 65 | results['ERROR'], 66 | results['WARNINGS'] 67 | ); 68 | }); 69 | 70 | }); 71 | 72 | 73 | // helpers //////////////// 74 | 75 | function parseDiagram(xml) { 76 | 77 | const moddle = createModdle(); 78 | 79 | return moddle.fromXML(xml, 'bpmn:Definitions').catch(error => { 80 | return { 81 | error: error, 82 | warnings: error.warnings 83 | }; 84 | }); 85 | } -------------------------------------------------------------------------------- /test/matchers.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(chai, utils) { 4 | 5 | utils.addMethod(chai.Assertion.prototype, 'jsonEqual', function(comparison) { 6 | 7 | var actual = JSON.stringify(this._obj); 8 | var expected = JSON.stringify(comparison); 9 | 10 | this.assert( 11 | actual == expected, 12 | 'expected #{this} to deep equal #{act}', 13 | 'expected #{this} not to deep equal #{act}', 14 | comparison, // expected 15 | this._obj, // actual 16 | true // show diff 17 | ); 18 | }); 19 | }; -------------------------------------------------------------------------------- /test/spec/ModdleSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var readFile = require('../helper').readFile, 4 | createModdle = require('../helper').createModdle; 5 | 6 | var BpmnModdle = require('bpmn-moddle'); 7 | 8 | var camundaDescriptor = require('../../resources/camunda'); 9 | 10 | 11 | describe('camunda-bpmn-moddle', function() { 12 | 13 | describe('schema', function() { 14 | 15 | it('should provide model', function() { 16 | 17 | // then 18 | expect(camundaDescriptor).to.exist; 19 | 20 | expect(camundaDescriptor.uri).to.eql('http://camunda.org/schema/1.0/bpmn'); 21 | expect(camundaDescriptor.prefix).to.eql('camunda'); 22 | }); 23 | 24 | }); 25 | 26 | 27 | describe('behavior', function() { 28 | 29 | it('should extend bpmn-moddle', function() { 30 | 31 | // given 32 | var moddle = new BpmnModdle({ 33 | camunda: camundaDescriptor 34 | }); 35 | 36 | // when 37 | var serviceTask = moddle.create('bpmn:ServiceTask'); 38 | 39 | // then 40 | expect(serviceTask.$instanceOf('camunda:ServiceTaskLike')).to.be.true; 41 | }); 42 | 43 | 44 | it('should ignore id property on camunda:FormField', async function() { 45 | 46 | var xml = readFile('test/fixtures/xml/camunda-formField-ids.bpmn'); 47 | 48 | var moddle = createModdle(); 49 | 50 | // when 51 | var { 52 | elementsById, 53 | warnings 54 | } = await moddle.fromXML(xml, 'bpmn:Definitions'); 55 | 56 | // then 57 | expect(warnings).to.be.empty; 58 | expect(elementsById).not.to.have.property('variableA'); 59 | }); 60 | 61 | }); 62 | 63 | }); -------------------------------------------------------------------------------- /test/spec/xml/read.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | 4 | var readFile = require('../../helper').readFile, 5 | createModdle = require('../../helper').createModdle; 6 | 7 | 8 | describe('read', function() { 9 | 10 | describe('should read extensions', function() { 11 | 12 | var moddle = createModdle(); 13 | 14 | function read(xml, root, opts) { 15 | return moddle.fromXML(xml, root, opts); 16 | } 17 | 18 | function fromFile(file, root, opts) { 19 | var contents = readFile('test/fixtures/xml/' + file); 20 | return read(contents, root, opts); 21 | } 22 | 23 | 24 | describe('camunda:historyTimeToLive', function() { 25 | 26 | it('on Process', async function() { 27 | 28 | // given 29 | var file = 'process-camunda-historyTimeToLive.part.bpmn'; 30 | 31 | // when 32 | var { rootElement: process } = await fromFile(file, 'bpmn:Process'); 33 | 34 | // then 35 | expect(process).to.jsonEqual({ 36 | $type : 'bpmn:Process', 37 | historyTimeToLive : 'foo' 38 | }); 39 | }); 40 | 41 | }); 42 | 43 | 44 | describe('camunda:isStartableInTasklist', function() { 45 | 46 | it('on Process', async function() { 47 | 48 | // given 49 | var file = 'process-camunda-isStartableInTasklist.part.bpmn'; 50 | 51 | // when 52 | var { rootElement: process } = await fromFile(file, 'bpmn:Process'); 53 | 54 | // then 55 | expect(process).to.jsonEqual({ 56 | $type : 'bpmn:Process', 57 | isStartableInTasklist : true 58 | }); 59 | }); 60 | 61 | 62 | it('default value', function() { 63 | 64 | // when 65 | var bo = moddle.create('bpmn:Process'); 66 | 67 | // then 68 | expect(bo.get('camunda:isStartableInTasklist')).to.be.true; 69 | }); 70 | 71 | }); 72 | 73 | 74 | describe('camunda:priority', function() { 75 | 76 | it('on UserTask', async function() { 77 | 78 | // given 79 | var file = 'userTask-camunda-priority.part.bpmn'; 80 | 81 | // when 82 | var { rootElement: userTask } = await fromFile(file, 'bpmn:UserTask'); 83 | 84 | // then 85 | expect(userTask).to.jsonEqual({ 86 | $type: 'bpmn:UserTask', 87 | priority: '${ priority }' 88 | }); 89 | }); 90 | 91 | }); 92 | 93 | 94 | describe('camunda:async', function() { 95 | 96 | it('on ServiceTask', async function() { 97 | 98 | // given 99 | var file = 'serviceTask-camunda-async.part.bpmn'; 100 | 101 | // when 102 | var { rootElement: serviceTask } = await fromFile(file, 'bpmn:ServiceTask'); 103 | 104 | // then 105 | expect(serviceTask).to.jsonEqual({ 106 | $type: 'bpmn:ServiceTask', 107 | async: true 108 | }); 109 | }); 110 | 111 | 112 | it('on SignalEventDefinition', async function() { 113 | 114 | // given 115 | var file = 'signalEventDefinition-camunda-async.part.bpmn'; 116 | 117 | // when 118 | var { rootElement: signalEventDefinition } = await fromFile(file, 'bpmn:SignalEventDefinition'); 119 | 120 | // then 121 | expect(signalEventDefinition).to.jsonEqual({ 122 | $type: 'bpmn:SignalEventDefinition', 123 | async: true 124 | }); 125 | }); 126 | 127 | }); 128 | 129 | 130 | describe('camunda:errorEventDefinition', function() { 131 | 132 | it('on ServiceTask', async function() { 133 | 134 | // given 135 | var file = 'serviceTask-camunda-errorEventDefinition.part.bpmn'; 136 | 137 | // when 138 | var { rootElement: serviceTask } = await fromFile(file, 'bpmn:ServiceTask'); 139 | 140 | // then 141 | expect(serviceTask).to.jsonEqual({ 142 | $type: 'bpmn:ServiceTask', 143 | extensionElements: { 144 | $type: 'bpmn:ExtensionElements', 145 | values: [ 146 | { 147 | $type: 'camunda:ErrorEventDefinition', 148 | id: 'Id_1', 149 | expression: '${true}' 150 | }, 151 | ], 152 | }, 153 | } 154 | ); 155 | }); 156 | 157 | }); 158 | 159 | 160 | describe('camunda:errorCodeVariable', function() { 161 | 162 | it('on ErrorEventDefinition', async function() { 163 | 164 | // given 165 | var file = 'errorEventDefinition-camunda-errorCodeVariable.part.bpmn'; 166 | 167 | // when 168 | var { rootElement: errorEventDefinition } = await fromFile(file, 'bpmn:ErrorEventDefinition'); 169 | 170 | // then 171 | expect(errorEventDefinition).to.jsonEqual({ 172 | $type: 'bpmn:ErrorEventDefinition', 173 | errorCodeVariable: 'errorCode' 174 | }); 175 | }); 176 | 177 | }); 178 | 179 | 180 | describe('camunda:escalationCodeVariable', function() { 181 | 182 | it('on EscalationEventDefinition', async function() { 183 | 184 | // given 185 | var file = 'escalationEventDefinition-camunda-escalationCodeVariable.part.bpmn'; 186 | 187 | // when 188 | var { rootElement: escalationEventDefinition } = await fromFile(file, 'bpmn:EscalationEventDefinition'); 189 | 190 | // then 191 | expect(escalationEventDefinition).to.jsonEqual({ 192 | $type: 'bpmn:EscalationEventDefinition', 193 | escalationCodeVariable: 'escalationCode' 194 | }); 195 | }); 196 | 197 | }); 198 | 199 | 200 | describe('camunda:errorMessage', function() { 201 | 202 | it('on Error', async function() { 203 | 204 | // given 205 | var file = 'camunda-errorMessage.part.bpmn'; 206 | 207 | // when 208 | var { rootElement: error } = await fromFile(file, 'bpmn:Error'); 209 | 210 | // then 211 | expect(error).to.jsonEqual({ 212 | $type: 'bpmn:Error', 213 | errorMessage: 'errorMessage' 214 | }); 215 | }); 216 | 217 | }); 218 | 219 | 220 | it('camunda:script', async function() { 221 | 222 | // given 223 | var file = 'camunda-script.part.bpmn'; 224 | 225 | // when 226 | var { rootElement: script } = await fromFile(file, 'camunda:Script'); 227 | 228 | // then 229 | expect(script).to.jsonEqual({ 230 | $type: 'camunda:Script', 231 | scriptFormat: 'groovy', 232 | resource: 'null', 233 | value: '\n foo = bar;\n' 234 | }); 235 | }); 236 | 237 | 238 | it('camunda:connector', async function() { 239 | 240 | // given 241 | var file = 'camunda-connector.part.bpmn'; 242 | 243 | // when 244 | var { rootElement: connector } = await fromFile(file, 'camunda:Connector'); 245 | 246 | // then 247 | expect(connector).to.jsonEqual({ 248 | $type: 'camunda:Connector', 249 | connectorId: 'connector', 250 | inputOutput: { 251 | $type: 'camunda:InputOutput', 252 | inputParameters: [ 253 | { 254 | $type: 'camunda:InputParameter', 255 | name: 'in' 256 | } 257 | ], 258 | outputParameters: [ 259 | { 260 | $type: 'camunda:OutputParameter', 261 | name: 'out' 262 | } 263 | ] 264 | } 265 | }); 266 | }); 267 | 268 | 269 | it('camunda:properties', async function() { 270 | 271 | // given 272 | var file = 'camunda-properties.part.bpmn'; 273 | 274 | // when 275 | var { rootElement: properties } = await fromFile(file, 'camunda:Properties'); 276 | 277 | // then 278 | expect(properties).to.jsonEqual({ 279 | $type: 'camunda:Properties', 280 | values: [ 281 | { 282 | $type: 'camunda:Property', 283 | id: 'p1', 284 | name: 'foo', 285 | value: 'property1' 286 | } 287 | ] 288 | }); 289 | }); 290 | 291 | 292 | describe('camunda:diagramRelationId', function() { 293 | 294 | it('on Definitions', async function() { 295 | 296 | // given 297 | var file = 'definitions-diagramRelationId.part.bpmn'; 298 | 299 | // when 300 | var { rootElement: definitions } = await fromFile(file, 'bpmn:Definitions'); 301 | 302 | // then 303 | expect(definitions).to.jsonEqual({ 304 | $type: 'bpmn:Definitions', 305 | diagramRelationId: 'foo' 306 | }); 307 | }); 308 | 309 | }); 310 | 311 | 312 | it('camunda:potentialStarter', async function() { 313 | 314 | // given 315 | var file = 'camunda-potentialStarter.part.bpmn'; 316 | 317 | // when 318 | var { rootElement: starter } = await fromFile(file, 'camunda:PotentialStarter'); 319 | 320 | // then 321 | expect(starter).to.jsonEqual({ 322 | $type: 'camunda:PotentialStarter', 323 | resourceAssignmentExpression: { 324 | $type: 'bpmn:ResourceAssignmentExpression', 325 | expression: { 326 | $type: 'bpmn:FormalExpression', 327 | body: 'group2, group(group3), user(user3)' 328 | } 329 | } 330 | }); 331 | }); 332 | 333 | 334 | describe('camunda:resource', function() { 335 | 336 | it('on FormalExpression', async function() { 337 | 338 | // given 339 | var file = 'formalExpression-resource.part.bpmn'; 340 | 341 | // when 342 | var { rootElement: expression } = await fromFile(file, 'bpmn:FormalExpression'); 343 | 344 | // then 345 | expect(expression).to.jsonEqual({ 346 | $type: 'bpmn:FormalExpression', 347 | resource: 'deployment://some-file' 348 | }); 349 | }); 350 | 351 | }); 352 | 353 | 354 | it('camunda:in', async function() { 355 | 356 | // given 357 | var file = 'camunda-in.part.bpmn'; 358 | 359 | // when 360 | var { rootElement: binding } = await fromFile(file, 'camunda:In'); 361 | 362 | // then 363 | expect(binding).to.jsonEqual({ 364 | $type: 'camunda:In', 365 | sourceExpression: 'fooExp', 366 | source: 'foo', 367 | target: 'bar', 368 | variables: 'all', 369 | local: true 370 | }); 371 | }); 372 | 373 | 374 | it('camunda:out', async function() { 375 | 376 | // given 377 | var file = 'camunda-out.part.bpmn'; 378 | 379 | // when 380 | var { rootElement: binding } = await fromFile(file, 'camunda:Out'); 381 | 382 | // then 383 | expect(binding).to.jsonEqual({ 384 | $type: 'camunda:Out', 385 | sourceExpression: 'fooExp', 386 | source: 'foo', 387 | target: 'bar', 388 | variables: 'all', 389 | local: true 390 | }); 391 | }); 392 | 393 | 394 | describe('camunda:inputParameter', function() { 395 | 396 | it('with body content', async function() { 397 | 398 | // given 399 | var file = 'camunda-inputParameter-body.part.bpmn'; 400 | 401 | // when 402 | var { rootElement: parameter } = await fromFile(file, 'camunda:InputParameter'); 403 | 404 | // then 405 | expect(parameter).to.jsonEqual({ 406 | $type: 'camunda:InputParameter', 407 | name: 'foo', 408 | value: '\n BAR\n' 409 | }); 410 | }); 411 | 412 | 413 | it('with nested script', async function() { 414 | 415 | // given 416 | var file = 'camunda-inputParameter-script.part.bpmn'; 417 | 418 | // when 419 | var { rootElement: parameter } = await fromFile(file, 'camunda:InputParameter'); 420 | 421 | // then 422 | expect(parameter).to.jsonEqual({ 423 | $type: 'camunda:InputParameter', 424 | definition: { 425 | $type: 'camunda:Script' 426 | } 427 | }); 428 | }); 429 | 430 | 431 | it('with nested list', async function() { 432 | 433 | // given 434 | var file = 'camunda-inputParameter-list.part.bpmn'; 435 | 436 | // when 437 | var { rootElement: parameter } = await fromFile(file, 'camunda:InputParameter'); 438 | 439 | // then 440 | expect(parameter).to.jsonEqual({ 441 | $type: 'camunda:InputParameter', 442 | name: 'var1', 443 | definition: { 444 | $type: 'camunda:List', 445 | items: [ 446 | { 447 | $type: 'camunda:Value', 448 | value: '${1+1}' 449 | }, 450 | { 451 | $type: 'camunda:Value', 452 | value: '${1+2}' 453 | }, 454 | { 455 | $type: 'camunda:Value', 456 | value: '${1+3}' 457 | } 458 | ] 459 | } 460 | }); 461 | }); 462 | 463 | 464 | it('with nested map', async function() { 465 | 466 | // given 467 | var file = 'camunda-inputParameter-map.part.bpmn'; 468 | 469 | // when 470 | var { rootElement: parameter } = await fromFile(file, 'camunda:InputParameter'); 471 | 472 | // then 473 | expect(parameter).to.jsonEqual({ 474 | $type: 'camunda:InputParameter', 475 | definition: { 476 | $type: 'camunda:Map', 477 | entries: [ 478 | { 479 | $type: 'camunda:Entry', 480 | key: 'a', 481 | value: '${1+1}' 482 | }, 483 | { 484 | $type: 'camunda:Entry', 485 | key: 'b', 486 | value: '${1+2}' 487 | }, 488 | { 489 | $type: 'camunda:Entry', 490 | key: 'c', 491 | value: '${1+3}' 492 | } 493 | ] 494 | } 495 | }); 496 | }); 497 | 498 | }); 499 | 500 | 501 | describe('camunda:outputParameter', function() { 502 | 503 | it('with mixed contents', async function() { 504 | 505 | // given 506 | var file = 'camunda-outputParameter-mixed.part.bpmn'; 507 | 508 | // when 509 | var { rootElement: parameter } = await fromFile(file, 'camunda:OutputParameter'); 510 | 511 | // then 512 | expect(parameter).to.jsonEqual({ 513 | $type: 'camunda:OutputParameter', 514 | name: 'var1', 515 | definition: { 516 | $type: 'camunda:List', 517 | items: [ 518 | { 519 | $type: 'camunda:Value', 520 | value: 'constantStringValue' 521 | }, 522 | { 523 | $type: 'camunda:Value', 524 | value: '${ \'elValue\' }' 525 | }, 526 | { 527 | $type: 'camunda:Script', 528 | scriptFormat: 'Groovy', 529 | value: 'return "scriptValue";' 530 | } 531 | ] 532 | } 533 | }); 534 | }); 535 | 536 | }); 537 | 538 | 539 | describe('camunda:TemplateSupported', function() { 540 | 541 | describe('camunda:modelerTemplate', function() { 542 | 543 | it('on Process', async function() { 544 | 545 | // given 546 | var file = 'process-camunda-modelerTemplate.part.bpmn'; 547 | 548 | // when 549 | var { rootElement: process } = await fromFile(file, 'bpmn:Process'); 550 | 551 | // then 552 | expect(process).to.jsonEqual({ 553 | $type: 'bpmn:Process', 554 | modelerTemplate: 'foo' 555 | }); 556 | }); 557 | 558 | 559 | it('on Collaboration', async function() { 560 | 561 | // given 562 | var file = 'collaboration-camunda-modelerTemplate.part.bpmn'; 563 | 564 | // when 565 | var { rootElement: collaboration } = await fromFile(file, 'bpmn:Collaboration'); 566 | 567 | // then 568 | expect(collaboration).to.jsonEqual({ 569 | $type: 'bpmn:Collaboration', 570 | modelerTemplate: 'foo' 571 | }); 572 | }); 573 | 574 | 575 | it('on Task', async function() { 576 | 577 | // given 578 | var file = 'task-camunda-modelerTemplate.part.bpmn'; 579 | 580 | // when 581 | var { rootElement: task } = await fromFile(file, 'bpmn:Task'); 582 | 583 | // then 584 | expect(task).to.jsonEqual({ 585 | $type: 'bpmn:Task', 586 | modelerTemplate: 'foo' 587 | }); 588 | }); 589 | 590 | 591 | it('on StartEvent', async function() { 592 | 593 | // given 594 | var file = 'startEvent-camunda-modelerTemplate.part.bpmn'; 595 | 596 | // when 597 | var { rootElement: startEvent } = await fromFile(file, 'bpmn:StartEvent'); 598 | 599 | // then 600 | expect(startEvent).to.jsonEqual({ 601 | $type: 'bpmn:StartEvent', 602 | modelerTemplate: 'bar' 603 | }); 604 | }); 605 | 606 | }); 607 | 608 | 609 | describe('camunda:modelerTemplateVersion', function() { 610 | 611 | it('on Process', async function() { 612 | 613 | // given 614 | var file = 'process-camunda-modelerTemplateVersion.part.bpmn'; 615 | 616 | // when 617 | var { rootElement: process } = await fromFile(file, 'bpmn:Process'); 618 | 619 | // then 620 | expect(process).to.jsonEqual({ 621 | $type: 'bpmn:Process', 622 | modelerTemplate: 'foo', 623 | modelerTemplateVersion: 1 624 | }); 625 | }); 626 | 627 | 628 | it('on Collaboration', async function() { 629 | 630 | // given 631 | var file = 'collaboration-camunda-modelerTemplateVersion.part.bpmn'; 632 | 633 | // when 634 | var { rootElement: collaboration } = await fromFile(file, 'bpmn:Collaboration'); 635 | 636 | // then 637 | expect(collaboration).to.jsonEqual({ 638 | $type: 'bpmn:Collaboration', 639 | modelerTemplate: 'foo', 640 | modelerTemplateVersion: 1 641 | }); 642 | }); 643 | 644 | 645 | it('on Task', async function() { 646 | 647 | // given 648 | var file = 'task-camunda-modelerTemplateVersion.part.bpmn'; 649 | 650 | // when 651 | var { rootElement: task } = await fromFile(file, 'bpmn:Task'); 652 | 653 | // then 654 | expect(task).to.jsonEqual({ 655 | $type: 'bpmn:Task', 656 | modelerTemplate: 'foo', 657 | modelerTemplateVersion: 1 658 | }); 659 | }); 660 | 661 | 662 | it('on StartEvent', async function() { 663 | 664 | // given 665 | var file = 'startEvent-camunda-modelerTemplateVersion.part.bpmn'; 666 | 667 | // when 668 | var { rootElement: startEvent } = await fromFile(file, 'bpmn:StartEvent'); 669 | 670 | // then 671 | expect(startEvent).to.jsonEqual({ 672 | $type: 'bpmn:StartEvent', 673 | modelerTemplate: 'bar', 674 | modelerTemplateVersion: 1 675 | }); 676 | }); 677 | 678 | }); 679 | 680 | }); 681 | 682 | 683 | describe('camunda:initiator', function() { 684 | 685 | it('on StartEvent', async function() { 686 | 687 | // given 688 | var file = 'startEvent-camunda-initiator.part.bpmn'; 689 | 690 | // when 691 | var { rootElement: startEvent } = await fromFile(file, 'bpmn:StartEvent'); 692 | 693 | // then 694 | expect(startEvent).to.jsonEqual({ 695 | $type: 'bpmn:StartEvent', 696 | initiator: 'kermit' 697 | }); 698 | }); 699 | 700 | }); 701 | 702 | 703 | it('bpmn:CallActivity', async function() { 704 | 705 | // given 706 | var file = 'callActivity.part.bpmn'; 707 | 708 | // when 709 | var { rootElement: callActivity } = await fromFile(file, 'bpmn:CallActivity'); 710 | 711 | // then 712 | expect(callActivity).to.jsonEqual({ 713 | $type: 'bpmn:CallActivity', 714 | calledElementBinding: 'version', 715 | calledElementVersion: '1', 716 | calledElementVersionTag: 'version1', 717 | calledElementTenantId: 'tenant1', 718 | caseRef: 'oneTaskCase', 719 | caseBinding: 'version', 720 | caseVersion: '2', 721 | caseTenantId: 'tenant1', 722 | variableMappingClass: 'org.camunda.bpm.test.Test', 723 | variableMappingDelegateExpression: '${test}' 724 | }); 725 | }); 726 | 727 | 728 | describe('camunda:taskPriority', function() { 729 | 730 | it('on Process', async function() { 731 | 732 | // given 733 | var file = 'process-camunda-taskPriority.part.bpmn'; 734 | 735 | // when 736 | var { rootElement: process } = await fromFile(file, 'bpmn:Process'); 737 | 738 | // then 739 | expect(process).to.jsonEqual({ 740 | $type : 'bpmn:Process', 741 | taskPriority : '100' 742 | }); 743 | }); 744 | 745 | 746 | it('on ServiceTaskLike Element', async function() { 747 | 748 | // given 749 | var file = 'serviceTask-camunda-taskPriority.part.bpmn'; 750 | 751 | // when 752 | var { rootElement: task } = await fromFile(file, 'bpmn:ServiceTask'); 753 | 754 | // then 755 | expect(task).to.jsonEqual({ 756 | $type : 'bpmn:ServiceTask', 757 | taskPriority : '100' 758 | }); 759 | }); 760 | 761 | }); 762 | 763 | 764 | describe('camunda:jobPriority', function() { 765 | 766 | it('on Process', async function() { 767 | 768 | // given 769 | var file = 'process-camunda-jobPriority.part.bpmn'; 770 | 771 | // when 772 | var { rootElement: process } = await fromFile(file, 'bpmn:Process'); 773 | 774 | // then 775 | expect(process).to.jsonEqual({ 776 | $type: 'bpmn:Process', 777 | jobPriority: '100' 778 | }); 779 | }); 780 | 781 | 782 | it('on ServiceTask', async function() { 783 | 784 | // given 785 | var file = 'serviceTask-camunda-jobPriority.part.bpmn'; 786 | 787 | // when 788 | var { rootElement: serviceTask } = await fromFile(file, 'bpmn:ServiceTask'); 789 | 790 | // then 791 | expect(serviceTask).to.jsonEqual({ 792 | $type: 'bpmn:ServiceTask', 793 | jobPriority: '100' 794 | }); 795 | }); 796 | 797 | 798 | it('on Gateway', async function() { 799 | 800 | // given 801 | var file = 'gateway-camunda-jobPriority.part.bpmn'; 802 | 803 | // when 804 | var { rootElement: gateway } = await fromFile(file, 'bpmn:ExclusiveGateway'); 805 | 806 | // then 807 | expect(gateway).to.jsonEqual({ 808 | $type: 'bpmn:ExclusiveGateway', 809 | jobPriority: '${ some - expression }' 810 | }); 811 | }); 812 | 813 | 814 | it('on Event', async function() { 815 | 816 | // given 817 | var file = 'event-camunda-jobPriority.part.bpmn'; 818 | 819 | // when 820 | var { rootElement: catchEvent } = await fromFile(file, 'bpmn:IntermediateCatchEvent'); 821 | 822 | // then 823 | expect(catchEvent).to.jsonEqual({ 824 | $type: 'bpmn:IntermediateCatchEvent', 825 | jobPriority: '100' 826 | }); 827 | }); 828 | 829 | }); 830 | 831 | 832 | describe('bpmn:Process', function() { 833 | 834 | it('extended with camunda:candidateStarterUsers, camunda:candidateStarterGroups, camunda:versionTag', async function() { 835 | 836 | // given 837 | var file = 'process.part.bpmn'; 838 | 839 | // when 840 | var { rootElement: process } = await fromFile(file, 'bpmn:Process'); 841 | 842 | // then 843 | expect(process).to.jsonEqual({ 844 | $type: 'bpmn:Process', 845 | candidateStarterUsers: 'userInGroup2', 846 | candidateStarterGroups: 'group1, group2, group3', 847 | versionTag: '1.0.0' 848 | }); 849 | }); 850 | 851 | }); 852 | 853 | 854 | describe('bpmn:ScriptTask', function() { 855 | 856 | it('extended with camunda:resource, camunda:resultVariable', async function() { 857 | 858 | // given 859 | var file = 'scriptTask.part.bpmn'; 860 | 861 | // when 862 | var { rootElement: scriptTask } = await fromFile(file, 'bpmn:ScriptTask'); 863 | 864 | // then 865 | expect(scriptTask).to.jsonEqual({ 866 | $type: 'bpmn:ScriptTask', 867 | scriptFormat: 'python', 868 | resource: 'some-file.py', 869 | resultVariable: 'result' 870 | }); 871 | }); 872 | 873 | }); 874 | 875 | 876 | describe('camunda:executionListener', function() { 877 | 878 | it('attributes', async function() { 879 | 880 | // given 881 | var file = 'camunda-executionListener.part.bpmn'; 882 | 883 | // when 884 | var { rootElement: executionListener } = await fromFile(file, 'camunda:ExecutionListener'); 885 | 886 | // then 887 | expect(executionListener).to.jsonEqual({ 888 | $type: 'camunda:ExecutionListener', 889 | event: 'start', 890 | 'class': 'my.company.Listener' 891 | }); 892 | }); 893 | 894 | 895 | it('script', async function() { 896 | 897 | // given 898 | var file = 'camunda-executionListener-script.part.bpmn'; 899 | 900 | // when 901 | var { rootElement: executionListener } = await fromFile(file, 'camunda:ExecutionListener'); 902 | 903 | // then 904 | expect(executionListener).to.jsonEqual({ 905 | $type: 'camunda:ExecutionListener', 906 | event: 'start', 907 | script: { 908 | $type: 'camunda:Script', 909 | scriptFormat: 'groovy', 910 | value: 'foo = bar;' 911 | } 912 | }); 913 | }); 914 | 915 | 916 | it('fields', async function() { 917 | 918 | // given 919 | var file = 'camunda-executionListener-fields.part.bpmn'; 920 | 921 | // when 922 | var { rootElement: executionListener } = await fromFile(file, 'camunda:ExecutionListener'); 923 | 924 | // then 925 | expect(executionListener).to.jsonEqual({ 926 | $type: 'camunda:ExecutionListener', 927 | event: 'start', 928 | 'class': 'my.company.Listener', 929 | fields : [ 930 | { 931 | $type: 'camunda:Field', 932 | name: 'fieldOne', 933 | stringValue: 'myString' 934 | }, 935 | { 936 | $type: 'camunda:Field', 937 | name: 'fieldTwo', 938 | expression: '${myExpression}' 939 | } 940 | ] 941 | }); 942 | }); 943 | 944 | }); 945 | 946 | 947 | describe('camunda:taskListener', function() { 948 | 949 | it('create event', async function() { 950 | 951 | // given 952 | var file = 'camunda-taskListener.part.bpmn'; 953 | 954 | // when 955 | var { rootElement: taskListener } = await fromFile(file, 'camunda:TaskListener'); 956 | 957 | // then 958 | expect(taskListener).to.jsonEqual({ 959 | $type: 'camunda:TaskListener', 960 | event: 'create', 961 | class: 'org.camunda.bpm.engine.test.bpmn.usertask.UserTaskTestCreateTaskListener', 962 | delegateExpression: '${myTaskListener}', 963 | expression: '${myTaskListener.notify(task, task.eventName)}' 964 | }); 965 | }); 966 | 967 | 968 | it('timeout event', async function() { 969 | 970 | // given 971 | var file = 'camunda-timeout-taskListener.part.bpmn'; 972 | 973 | // when 974 | var { rootElement: taskListener } = await fromFile(file, 'camunda:TaskListener'); 975 | 976 | // then 977 | expect(taskListener).to.jsonEqual({ 978 | $type: 'camunda:TaskListener', 979 | event: 'timeout', 980 | id: 'timeout-friendly', 981 | eventDefinitions: [ 982 | { 983 | $type: 'bpmn:TimerEventDefinition', 984 | timeDuration: { 985 | $type: 'bpmn:FormalExpression', 986 | body: 'PT1H' 987 | } 988 | } 989 | ] 990 | }); 991 | }); 992 | 993 | }); 994 | 995 | 996 | describe('camunda:field', function() { 997 | 998 | it('attributes', async function() { 999 | 1000 | // given 1001 | var file = 'camunda-field-attributes.part.bpmn'; 1002 | 1003 | // when 1004 | var { rootElement: field } = await fromFile(file, 'camunda:Field'); 1005 | 1006 | // then 1007 | expect(field).to.jsonEqual({ 1008 | $type: 'camunda:Field', 1009 | name: 'html', 1010 | expression: 'Hi!', 1011 | stringValue: '41 is not the answer!' 1012 | }); 1013 | }); 1014 | 1015 | 1016 | it('with nested expression and string', async function() { 1017 | 1018 | // given 1019 | var file = 'camunda-field-children.part.bpmn'; 1020 | 1021 | // when 1022 | var { rootElement: field } = await fromFile(file, 'camunda:Field'); 1023 | 1024 | // then 1025 | expect(field).to.jsonEqual({ 1026 | $type: 'camunda:Field', 1027 | name: 'html', 1028 | expression: 'Hi!', 1029 | string: '42 is the answer!' 1030 | }); 1031 | }); 1032 | 1033 | }); 1034 | 1035 | 1036 | describe('camunda:Collectable', function() { 1037 | 1038 | it('attributes', async function() { 1039 | 1040 | // given 1041 | var file = 'camunda-multiInstance.part.bpmn'; 1042 | 1043 | // when 1044 | var { rootElement: field } = await fromFile(file, 'bpmn:MultiInstanceLoopCharacteristics'); 1045 | 1046 | // then 1047 | expect(field).to.jsonEqual({ 1048 | $type: 'bpmn:MultiInstanceLoopCharacteristics', 1049 | isSequential: true, 1050 | collection: '5', 1051 | elementVariable: '5' 1052 | }); 1053 | }); 1054 | 1055 | }); 1056 | 1057 | 1058 | describe('camunda tenant id', function() { 1059 | 1060 | it('on BusinessRuleTask', async function() { 1061 | 1062 | // given 1063 | var file = 'businessRuleTask.part.bpmn'; 1064 | 1065 | // when 1066 | var { rootElement: businessRuleTask } = await fromFile(file, 'bpmn:BusinessRuleTask'); 1067 | 1068 | // then 1069 | expect(businessRuleTask).to.jsonEqual({ 1070 | $type: 'bpmn:BusinessRuleTask', 1071 | decisionRef: 'myDecision', 1072 | decisionRefBinding: 'version', 1073 | decisionRefVersion: '1', 1074 | decisionRefTenantId: 'tenant1' 1075 | }); 1076 | }); 1077 | 1078 | 1079 | it('on CallActivity', async function() { 1080 | 1081 | // given 1082 | var file = 'callActivity.part.bpmn'; 1083 | 1084 | // when 1085 | var { rootElement: callActivity } = await fromFile(file, 'bpmn:CallActivity'); 1086 | 1087 | // then 1088 | expect(callActivity).to.jsonEqual({ 1089 | $type: 'bpmn:CallActivity', 1090 | calledElementBinding: 'version', 1091 | calledElementVersion: '1', 1092 | calledElementVersionTag: 'version1', 1093 | calledElementTenantId: 'tenant1', 1094 | caseRef: 'oneTaskCase', 1095 | caseBinding: 'version', 1096 | caseVersion: '2', 1097 | caseTenantId: 'tenant1', 1098 | variableMappingClass: 'org.camunda.bpm.test.Test', 1099 | variableMappingDelegateExpression: '${test}' 1100 | }); 1101 | }); 1102 | 1103 | }); 1104 | 1105 | 1106 | describe('camunda:errorMessageVariable', function() { 1107 | 1108 | it('on ErrorEventDefinition', async function() { 1109 | 1110 | // given 1111 | var file = 'errorEventDefinition-camunda-errorMessageVariable.part.bpmn'; 1112 | 1113 | // when 1114 | var { rootElement: errorEventDefinition } = await fromFile(file, 'bpmn:ErrorEventDefinition'); 1115 | 1116 | // then 1117 | expect(errorEventDefinition).to.jsonEqual({ 1118 | $type: 'bpmn:ErrorEventDefinition', 1119 | errorMessageVariable: 'errorMessage' 1120 | }); 1121 | }); 1122 | 1123 | }); 1124 | 1125 | 1126 | describe('camunda:variableName', function() { 1127 | 1128 | it('on ConditionalEventDefinition', async function() { 1129 | 1130 | // given 1131 | var file = 'conditionalEventDefinition-camunda-variableName.part.bpmn'; 1132 | 1133 | // when 1134 | var { rootElement: conditionalEventDefinition } = await fromFile(file, 'bpmn:ConditionalEventDefinition'); 1135 | 1136 | // then 1137 | expect(conditionalEventDefinition).to.jsonEqual({ 1138 | $type: 'bpmn:ConditionalEventDefinition', 1139 | variableName: 'myConditionVar' 1140 | }); 1141 | }); 1142 | 1143 | }); 1144 | 1145 | 1146 | describe('camunda:variableEvents', function() { 1147 | 1148 | it('on ConditionalEventDefinition', async function() { 1149 | 1150 | // given 1151 | var file = 'conditionalEventDefinition-camunda-variableEvents.part.bpmn'; 1152 | 1153 | // when 1154 | var { rootElement: conditionalEventDefinition } = await fromFile(file, 'bpmn:ConditionalEventDefinition'); 1155 | 1156 | // then 1157 | expect(conditionalEventDefinition).to.jsonEqual({ 1158 | $type: 'bpmn:ConditionalEventDefinition', 1159 | variableEvents: 'create, update' 1160 | }); 1161 | }); 1162 | 1163 | }); 1164 | 1165 | 1166 | describe('forms', function() { 1167 | 1168 | describe('embedded/external/Camunda Forms (camunda:formKey)', function() { 1169 | 1170 | describe('camunda:formKey', function() { 1171 | 1172 | it('on UserTask', async function() { 1173 | 1174 | // given 1175 | var file = 'userTask-camunda-formKey.part.bpmn'; 1176 | 1177 | // when 1178 | var { rootElement: userTask } = await fromFile(file, 'bpmn:UserTask'); 1179 | 1180 | // then 1181 | expect(userTask).to.jsonEqual({ 1182 | $type: 'bpmn:UserTask', 1183 | formKey: 'form.html' 1184 | }); 1185 | }); 1186 | 1187 | 1188 | it('on StartEvent', async function() { 1189 | 1190 | // given 1191 | var file = 'startEvent-camunda-formKey.part.bpmn'; 1192 | 1193 | // when 1194 | var { rootElement: startEvent } = await fromFile(file, 'bpmn:StartEvent'); 1195 | 1196 | // then 1197 | expect(startEvent).to.jsonEqual({ 1198 | $type: 'bpmn:StartEvent', 1199 | formKey: 'form.html' 1200 | }); 1201 | }); 1202 | 1203 | }); 1204 | 1205 | describe('camunda:formKey and camunda:formHandlerClass', function() { 1206 | 1207 | it('on UserTask', async function() { 1208 | 1209 | // given 1210 | var file = 'userTask-camunda-formHandlerClass.part.bpmn'; 1211 | 1212 | // when 1213 | var { rootElement: userTask } = await fromFile(file, 'bpmn:UserTask'); 1214 | 1215 | // then 1216 | expect(userTask).to.jsonEqual({ 1217 | $type: 'bpmn:UserTask', 1218 | formHandlerClass: 'my.company.FormHandler', 1219 | formKey: 'form.html' 1220 | }); 1221 | }); 1222 | 1223 | 1224 | it('on StartEvent', async function() { 1225 | 1226 | // given 1227 | var file = 'startEvent-camunda-formHandlerClass.part.bpmn'; 1228 | 1229 | // when 1230 | var { rootElement: startEvent } = await fromFile(file, 'bpmn:StartEvent'); 1231 | 1232 | // then 1233 | expect(startEvent).to.jsonEqual({ 1234 | $type: 'bpmn:StartEvent', 1235 | formHandlerClass: 'my.company.FormHandler', 1236 | formKey: 'form.html' 1237 | }); 1238 | }); 1239 | 1240 | }); 1241 | 1242 | }); 1243 | 1244 | 1245 | describe('Camunda Forms (camunda:formRef)', function() { 1246 | 1247 | describe('camunda:formRefBinding = latest', function() { 1248 | 1249 | it('on UserTask', async function() { 1250 | 1251 | // given 1252 | var file = 'userTask-camunda-formRef-latest.part.bpmn'; 1253 | 1254 | // when 1255 | var { rootElement: userTask } = await fromFile(file, 'bpmn:UserTask'); 1256 | 1257 | // then 1258 | expect(userTask).to.jsonEqual({ 1259 | $type: 'bpmn:UserTask', 1260 | formRef: 'formId', 1261 | formRefBinding: 'latest' 1262 | }); 1263 | }); 1264 | 1265 | 1266 | it('on StartEvent', async function() { 1267 | 1268 | // given 1269 | var file = 'startEvent-camunda-formRef-latest.part.bpmn'; 1270 | 1271 | // when 1272 | var { rootElement: startEvent } = await fromFile(file, 'bpmn:StartEvent'); 1273 | 1274 | // then 1275 | expect(startEvent).to.jsonEqual({ 1276 | $type: 'bpmn:StartEvent', 1277 | formRef: 'formId', 1278 | formRefBinding: 'latest' 1279 | }); 1280 | }); 1281 | 1282 | }); 1283 | 1284 | 1285 | describe('camunda:formRefBinding = version', function() { 1286 | 1287 | it('on UserTask', async function() { 1288 | 1289 | // given 1290 | var file = 'userTask-camunda-formRef-version.part.bpmn'; 1291 | 1292 | // when 1293 | var { rootElement: userTask } = await fromFile(file, 'bpmn:UserTask'); 1294 | 1295 | // then 1296 | expect(userTask).to.jsonEqual({ 1297 | $type: 'bpmn:UserTask', 1298 | formRef: 'formId', 1299 | formRefBinding: 'version', 1300 | formRefVersion: '1' 1301 | }); 1302 | }); 1303 | 1304 | 1305 | it('on StartEvent', async function() { 1306 | 1307 | // given 1308 | var file = 'startEvent-camunda-formRef-version.part.bpmn'; 1309 | 1310 | // when 1311 | var { rootElement: startEvent } = await fromFile(file, 'bpmn:StartEvent'); 1312 | 1313 | // then 1314 | expect(startEvent).to.jsonEqual({ 1315 | $type: 'bpmn:StartEvent', 1316 | formRef: 'formId', 1317 | formRefBinding: 'version', 1318 | formRefVersion: '1' 1319 | }); 1320 | }); 1321 | 1322 | }); 1323 | 1324 | }); 1325 | 1326 | 1327 | describe('generated (camunda:formData)', function() { 1328 | 1329 | it('camunda:formData', async function() { 1330 | 1331 | // given 1332 | var file = 'camunda-formData.part.bpmn'; 1333 | 1334 | // when 1335 | var { rootElement: formData } = await fromFile(file, 'camunda:FormData'); 1336 | 1337 | // then 1338 | expect(formData).to.jsonEqual({ 1339 | $type: 'camunda:FormData', 1340 | fields: [ 1341 | { 1342 | $type: 'camunda:FormField', 1343 | id: 'stringField', 1344 | label: 'String Field', 1345 | type: 'string', 1346 | defaultValue: 'someString', 1347 | properties: { 1348 | $type: 'camunda:Properties', 1349 | values: [ 1350 | { 1351 | $type: 'camunda:Property', 1352 | id: 'p1', 1353 | value: 'property1' 1354 | }, 1355 | { 1356 | $type: 'camunda:Property', 1357 | id: 'p2', 1358 | value: 'property2' 1359 | } 1360 | ] 1361 | }, 1362 | validation: { 1363 | $type: 'camunda:Validation', 1364 | constraints: [ 1365 | { 1366 | $type: 'camunda:Constraint', 1367 | name: 'readonly' 1368 | }, 1369 | { 1370 | $type: 'camunda:Constraint', 1371 | name: 'minlength', 1372 | config: '5' 1373 | } 1374 | ] 1375 | }, 1376 | values: [ 1377 | { 1378 | $type: 'camunda:Value', 1379 | id: 'a', 1380 | name: 'A' 1381 | }, 1382 | { 1383 | $type: 'camunda:Value', 1384 | id: 'b', 1385 | name: 'B' 1386 | } 1387 | ] 1388 | } 1389 | ] 1390 | }); 1391 | }); 1392 | 1393 | 1394 | describe('camunda:formProperty', function() { 1395 | 1396 | it('attributes', async function() { 1397 | 1398 | // given 1399 | var file = 'camunda-formProperty-attributes.part.bpmn'; 1400 | 1401 | // when 1402 | var { rootElement: formProperty } = await fromFile(file, 'camunda:FormProperty'); 1403 | 1404 | // then 1405 | expect(formProperty).to.jsonEqual({ 1406 | $type: 'camunda:FormProperty', 1407 | id: 'longProperty', 1408 | name: 'Property', 1409 | type: 'long', 1410 | required: 'true', 1411 | readable: 'true', 1412 | writable: 'true', 1413 | variable: 'SpeakerName', 1414 | expression: '#{address.street}', 1415 | datePattern: 'dd-MM-yyyy hh:mm', 1416 | default: '42' 1417 | }); 1418 | }); 1419 | 1420 | 1421 | it('with nested value', async function() { 1422 | 1423 | // given 1424 | var file = 'camunda-formProperty-children.part.bpmn'; 1425 | 1426 | // when 1427 | var { rootElement: formProperty } = await fromFile(file, 'camunda:FormProperty'); 1428 | 1429 | // then 1430 | expect(formProperty).to.jsonEqual({ 1431 | $type: 'camunda:FormProperty', 1432 | values: [ 1433 | { 1434 | $type: 'camunda:Value', 1435 | id: 'false', 1436 | name: 'Yes' 1437 | }, 1438 | { 1439 | $type: 'camunda:Value', 1440 | id: 'true', 1441 | name: 'No' 1442 | } 1443 | ] 1444 | }); 1445 | }); 1446 | 1447 | }); 1448 | 1449 | }); 1450 | 1451 | }); 1452 | 1453 | }); 1454 | 1455 | }); 1456 | -------------------------------------------------------------------------------- /test/spec/xml/roundtrip.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var readFile = require('../../helper').readFile, 4 | createModdle = require('../../helper').createModdle; 5 | 6 | 7 | 8 | describe('import -> export roundtrip', function() { 9 | 10 | function stripSpaces(xml) { 11 | return xml.replace(/\n|\r/g, '') 12 | .replace(/\s{2,}/g, ' ') 13 | .replace(/\s\/>/g, '/>') 14 | .replace(/>\s+<'); 15 | } 16 | 17 | function validateExport(file) { 18 | 19 | return async function() { 20 | 21 | var xml = stripSpaces(readFile(file)); 22 | 23 | var moddle = createModdle(); 24 | 25 | var { rootElement: definitions } = await moddle.fromXML(xml, 'bpmn:Definitions'); 26 | 27 | var { xml: savedXML } = await moddle.toXML(definitions); 28 | 29 | savedXML = stripSpaces(savedXML); 30 | 31 | expect(savedXML).to.eql(xml); 32 | }; 33 | } 34 | 35 | 36 | describe('should keep camunda attributes', function() { 37 | 38 | it('camunda:FormData', validateExport('test/fixtures/xml/userTask-camunda-formData.bpmn')); 39 | 40 | it('camunda:InputOutput', validateExport('test/fixtures/xml/inputOutput-nestedList.bpmn')); 41 | 42 | }); 43 | 44 | }); 45 | -------------------------------------------------------------------------------- /test/spec/xml/write.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Helper = require('../../helper'); 4 | 5 | 6 | describe('write', function() { 7 | 8 | var moddle = Helper.createModdle(); 9 | 10 | 11 | async function write(element) { 12 | return await moddle.toXML(element, { preamble: false }); 13 | } 14 | 15 | 16 | describe('should export types', function() { 17 | 18 | it('Field#stringValue', async function() { 19 | 20 | // given 21 | var fieldElem = moddle.create('camunda:Field', { 22 | name: 'Field_1', 23 | stringValue: 'myFieldValue' 24 | }); 25 | 26 | var expectedXML = 27 | ''; 29 | 30 | // when 31 | var { xml } = await write(fieldElem); 32 | 33 | // then 34 | expect(xml).to.eql(expectedXML); 35 | }); 36 | 37 | 38 | it('Field#string', async function() { 39 | 40 | // given 41 | var fieldElem = moddle.create('camunda:Field', { 42 | name: 'Field_1', 43 | string: 'myStringValue' 44 | }); 45 | 46 | var expectedXML = 47 | '' + 48 | 'myStringValue' + 49 | ''; 50 | 51 | // when 52 | var { xml } = await write(fieldElem); 53 | 54 | // then 55 | expect(xml).to.eql(expectedXML); 56 | }); 57 | 58 | 59 | it('Field#expression', async function() { 60 | 61 | // given 62 | var fieldElem = moddle.create('camunda:Field', { 63 | name: 'Field_1', 64 | expression: '${myExpressionValue}' 65 | }); 66 | 67 | var expectedXML = 68 | '' + 69 | '${myExpressionValue}' + 70 | ''; 71 | 72 | // when 73 | var { xml } = await write(fieldElem); 74 | 75 | // then 76 | expect(xml).to.eql(expectedXML); 77 | }); 78 | 79 | 80 | it('UserTask#formRefBinding', async function() { 81 | 82 | // given 83 | var element = moddle.create('bpmn:UserTask', { 84 | 'camunda:formRefBinding': 'latest' 85 | }); 86 | 87 | var expectedXML = 88 | ''; 91 | 92 | // when 93 | var { xml } = await write(element); 94 | 95 | // then 96 | expect(xml).to.eql(expectedXML); 97 | }); 98 | 99 | }); 100 | 101 | }); 102 | -------------------------------------------------------------------------------- /test/xml-helper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var SchemaValidator = require('xsd-schema-validator'); 4 | 5 | var BPMN_XSD = 'test/fixtures/xsd/BPMN20.xsd'; 6 | 7 | var Helper = require('./helper'); 8 | 9 | 10 | module.exports.fromFile = function(moddle, file, done) { 11 | var fileContents = Helper.readFile(file); 12 | 13 | moddle.fromXML(fileContents, 'bpmn:Definitions', done); 14 | }; 15 | 16 | module.exports.toXML = function(element, opts, done) { 17 | element.$model.toXML(element, opts, done); 18 | }; 19 | 20 | module.exports.validate = function(err, xml, done) { 21 | 22 | if (err) { 23 | return done(err); 24 | } 25 | 26 | if (!xml) { 27 | return done(new Error('XML is not defined')); 28 | } 29 | 30 | SchemaValidator.validateXML(xml, BPMN_XSD, function(err, result) { 31 | 32 | if (err) { 33 | return done(err); 34 | } 35 | 36 | expect(result.valid).to.be.true; 37 | done(); 38 | }); 39 | }; --------------------------------------------------------------------------------