bpmn-moddle 0.14.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/.travis.yml +2 -5
  2. package/package.json +4 -4
  3. package/resources/bpmn/json/bpmn.json +1 -1
  4. package/resources/bpmn/json/bpmndi.json +1 -1
  5. package/resources/bpmn-io/json/bioc.json +1 -1
  6. package/.npmignore +0 -6
  7. package/test/expect.js +0 -7
  8. package/test/fixtures/bpmn/activity-children.bpmn +0 -23
  9. package/test/fixtures/bpmn/callActivity-calledElement.part.bpmn +0 -7
  10. package/test/fixtures/bpmn/catch-event-dataOutputAssociations.part.bpmn +0 -5
  11. package/test/fixtures/bpmn/category.bpmn +0 -28
  12. package/test/fixtures/bpmn/complex.bpmn +0 -3680
  13. package/test/fixtures/bpmn/conversation-children.bpmn +0 -23
  14. package/test/fixtures/bpmn/data-object-reference.bpmn +0 -17
  15. package/test/fixtures/bpmn/definitions-children.bpmn +0 -13
  16. package/test/fixtures/bpmn/di/bpmnDiagram-extension.part.bpmn +0 -17
  17. package/test/fixtures/bpmn/di/bpmnDiagram.part.bpmn +0 -12
  18. package/test/fixtures/bpmn/di/bpmnEdge-waypoint.part.bpmn +0 -4
  19. package/test/fixtures/bpmn/di/bpmnEdge.part.bpmn +0 -5
  20. package/test/fixtures/bpmn/di/bpmnShape.part.bpmn +0 -4
  21. package/test/fixtures/bpmn/di-extension.bpmn +0 -26
  22. package/test/fixtures/bpmn/documentation-extension-elements.bpmn +0 -15
  23. package/test/fixtures/bpmn/documentation.bpmn +0 -11
  24. package/test/fixtures/bpmn/empty-definitions-default-ns.bpmn +0 -4
  25. package/test/fixtures/bpmn/empty-definitions.bpmn +0 -5
  26. package/test/fixtures/bpmn/error/binary.png +0 -0
  27. package/test/fixtures/bpmn/error/categoryValue.bpmn +0 -27
  28. package/test/fixtures/bpmn/error/di-no-bpmn-element.bpmn +0 -13
  29. package/test/fixtures/bpmn/error/duplicate-ids.bpmn +0 -8
  30. package/test/fixtures/bpmn/error/extension-definition-missing.bpmn +0 -6
  31. package/test/fixtures/bpmn/error/no-xml.txt +0 -1
  32. package/test/fixtures/bpmn/error/undeclared-ns-child.bpmn +0 -6
  33. package/test/fixtures/bpmn/error/unrecognized-child.bpmn +0 -6
  34. package/test/fixtures/bpmn/escalation-error.bpmn +0 -6
  35. package/test/fixtures/bpmn/event-references.part.bpmn +0 -6
  36. package/test/fixtures/bpmn/example-colors.bpmn +0 -40
  37. package/test/fixtures/bpmn/expression-plain.bpmn +0 -40
  38. package/test/fixtures/bpmn/extension/camunda/inputOutput-list.part.bpmn +0 -9
  39. package/test/fixtures/bpmn/extension/camunda/inputOutput-map.part.bpmn +0 -12
  40. package/test/fixtures/bpmn/extension/camunda/inputOutput-mixed.part.bpmn +0 -13
  41. package/test/fixtures/bpmn/extension/camunda/inputOutput-plain.part.bpmn +0 -3
  42. package/test/fixtures/bpmn/extension/camunda/inputOutput-script.part.bpmn +0 -9
  43. package/test/fixtures/bpmn/extension/camunda/inputOutput.bpmn +0 -22
  44. package/test/fixtures/bpmn/extension/drools.part.bpmn +0 -9
  45. package/test/fixtures/bpmn/extension-attributes.bpmn +0 -20
  46. package/test/fixtures/bpmn/extension-elements.bpmn +0 -9
  47. package/test/fixtures/bpmn/inputOutputSpecification-children.bpmn +0 -19
  48. package/test/fixtures/bpmn/interface-implementationRef.part.bpmn +0 -2
  49. package/test/fixtures/bpmn/itemDefinition-structureRef.part.bpmn +0 -2
  50. package/test/fixtures/bpmn/lane-childLaneSets.part.bpmn +0 -8
  51. package/test/fixtures/bpmn/lane-children.bpmn +0 -46
  52. package/test/fixtures/bpmn/multiInstanceLoopCharacteristics-completionCondition.part.bpmn +0 -5
  53. package/test/fixtures/bpmn/multiInstanceLoopCharacteristics.bpmn +0 -181
  54. package/test/fixtures/bpmn/operation-implementationRef.part.bpmn +0 -2
  55. package/test/fixtures/bpmn/operation-messageRef.bpmn +0 -12
  56. package/test/fixtures/bpmn/participant-interfaceRef.bpmn +0 -20
  57. package/test/fixtures/bpmn/potentialOwner.bpmn +0 -11
  58. package/test/fixtures/bpmn/process-children.bpmn +0 -24
  59. package/test/fixtures/bpmn/scriptTask-script.part.bpmn +0 -4
  60. package/test/fixtures/bpmn/sequenceFlow-conditionExpression.part.bpmn +0 -5
  61. package/test/fixtures/bpmn/simple-default-ns.bpmn +0 -31
  62. package/test/fixtures/bpmn/simple.bpmn +0 -31
  63. package/test/fixtures/bpmn/sub-process-flow-nodes.part.bpmn +0 -8
  64. package/test/fixtures/bpmn/sub-process.part.bpmn +0 -10
  65. package/test/fixtures/bpmn/subprocess-flow-nodes-outgoing.part.bpmn +0 -16
  66. package/test/fixtures/bpmn/throw-event-dataInputAssociations.part.bpmn +0 -5
  67. package/test/fixtures/bpmn/timerEventDefinition.part.bpmn +0 -5
  68. package/test/fixtures/bpmn/vendor/signavio-complex-no-extensions.bpmn +0 -2151
  69. package/test/fixtures/bpmn/vendor/yaoqiang-event-definitions.bpmn +0 -396
  70. package/test/fixtures/bpmn/vendor.xsd +0 -14
  71. package/test/fixtures/bpmn/xsi-type.bpmn +0 -61
  72. package/test/fixtures/json/model/camunda.json +0 -224
  73. package/test/fixtures/json/model/drools.json +0 -24
  74. package/test/fixtures/xsd/BPMN20.xsd +0 -39
  75. package/test/fixtures/xsd/Vendor.xsd +0 -14
  76. package/test/helper.js +0 -23
  77. package/test/integration/camunda/read.js +0 -203
  78. package/test/integration/camunda/roundtrip.js +0 -48
  79. package/test/integration/camunda/write.js +0 -249
  80. package/test/integration/misc.js +0 -107
  81. package/test/matchers.js +0 -19
  82. package/test/spec/adapter/cmof/builder.js +0 -194
  83. package/test/spec/adapter/cmof/generate-simple.js +0 -560
  84. package/test/spec/bpmn-moddle.js +0 -208
  85. package/test/spec/xml/edit.js +0 -76
  86. package/test/spec/xml/read.js +0 -986
  87. package/test/spec/xml/roundtrip.js +0 -540
  88. package/test/spec/xml/write.js +0 -980
  89. package/test/xml-helper.js +0 -39
@@ -1,560 +0,0 @@
1
- 'use strict';
2
-
3
- var Builder = require('./builder');
4
-
5
-
6
- function makeStringRef(desc) {
7
- desc.type = 'String';
8
- delete desc.isReference;
9
- }
10
-
11
- describe('moddle BPMN 2.0 json', function() {
12
-
13
- describe('generate simple model', function() {
14
-
15
- it('transform BPMN20.cmof', function(done) {
16
-
17
- var builder = new Builder();
18
-
19
- builder.parse('resources/bpmn/cmof/BPMN20.cmof', function(pkg, cmof) {
20
-
21
- builder.cleanIDs();
22
- builder.cleanAssociations();
23
-
24
- // remove associations
25
- pkg.associations = [];
26
-
27
- pkg.xml = {
28
- tagAlias: 'lowerCase',
29
- typePrefix: 't'
30
- };
31
-
32
- builder.alter('BaseElement#id', {
33
- isId: true
34
- });
35
-
36
- // perform a translation from
37
- //
38
- // BaseElement
39
- // - extensionValues = [ ExtensionAttributeValue#value = ... ]
40
- //
41
- // to
42
- //
43
- // BaseElement
44
- // - extensionElements: ExtensionElements#values = [ ... ]
45
- //
46
- builder.alter('ExtensionAttributeValue#value', {
47
- name: 'values',
48
- isMany: true
49
- });
50
-
51
- builder.alter('BaseElement#extensionValues', function(p) {
52
- p.name = 'extensionElements';
53
-
54
- delete p.isMany;
55
- });
56
-
57
- builder.rename('extensionAttributeValue', 'extensionElements');
58
-
59
- builder.rename('extensionValues', 'extensionElements');
60
-
61
- builder.rename('ExtensionAttributeValue', 'ExtensionElements');
62
-
63
-
64
- // fix cryptic bpmn:Extension reference
65
- builder.alter('Extension#definition', {
66
- isAttr: true,
67
- isReference: true
68
- });
69
-
70
-
71
- // fix documentation being first element
72
-
73
- builder.alter('BaseElement', function(desc) {
74
- builder.reorderProperties(desc, [ 'id', 'documentation' ]);
75
- });
76
-
77
- // fix definitions children order
78
-
79
- builder.alter('Definitions', function(desc) {
80
- builder.reorderProperties(desc, [
81
- 'rootElements',
82
- 'diagrams',
83
- 'relationships'
84
- ]);
85
- });
86
-
87
- // fix ioSpec children order
88
-
89
- builder.alter('InputOutputSpecification', function(desc) {
90
- builder.reorderProperties(desc, [
91
- 'dataInputs',
92
- 'dataOutputs',
93
- 'inputSets',
94
- 'outputSets'
95
- ]);
96
- });
97
-
98
- builder.alter('Relationship#sources', function(desc) {
99
- desc.name = 'source';
100
- });
101
-
102
- builder.alter('Relationship#targets', function(desc) {
103
- desc.name = 'target';
104
- });
105
-
106
-
107
- // fix event dataInput/dataOutput associations
108
-
109
- builder.alter('CatchEvent#dataOutputAssociation', function(desc) {
110
- desc.name = 'dataOutputAssociations';
111
- });
112
-
113
- builder.alter('ThrowEvent#dataInputAssociation', function(desc) {
114
- desc.name = 'dataInputAssociations';
115
- });
116
-
117
- // fix catchEvent children order
118
-
119
- builder.alter('CatchEvent', function(desc) {
120
- builder.reorderProperties(desc, [
121
- 'dataOutputs',
122
- 'dataOutputAssociations',
123
- 'outputSet',
124
- 'eventDefinitions',
125
- 'eventDefinitionRefs',
126
- ]);
127
- });
128
-
129
- // fix throwEvent children order
130
-
131
- builder.alter('ThrowEvent', function(desc) {
132
- builder.reorderProperties(desc, [
133
- 'dataInputs',
134
- 'dataInputAssociations',
135
- 'inputSet',
136
- 'eventDefinitions',
137
- 'eventDefinitionRefs',
138
- ]);
139
- });
140
-
141
- // fix Collaboration child element order
142
- builder.alter('Collaboration', function(desc) {
143
-
144
- builder.reorderProperties(desc, [
145
- 'participants',
146
- 'messageFlows',
147
- 'artifacts',
148
- 'conversations',
149
- 'conversationAssociations',
150
- 'participantAssociations',
151
- 'messageFlowAssociations',
152
- 'correlationKeys',
153
- 'choreographyRef',
154
- 'conversationLinks'
155
- ]);
156
- });
157
-
158
- // fix PotentialOwner#resourceRef
159
-
160
- builder.alter('ResourceRole#resourceRef', function(desc) {
161
- delete desc.isAttr;
162
- });
163
-
164
- // fix missing ResourceAssignmentExpression parent
165
-
166
- builder.alter('ResourceAssignmentExpression', function(desc) {
167
- desc.superClass = [ 'BaseElement' ];
168
- });
169
-
170
-
171
- // fix positioning of elements
172
-
173
- builder.alter('FlowElementsContainer', function(desc) {
174
- builder.swapProperties(desc, 'laneSets', 'flowElements');
175
- });
176
-
177
- builder.alter('FlowNode', function(desc) {
178
- builder.swapProperties(desc, 'targetRef', 'sourceRef');
179
- builder.swapProperties(desc, 'incoming', 'outgoing');
180
- });
181
-
182
- builder.alter('DataAssociation', function(desc) {
183
- builder.reorderProperties(desc, [
184
- 'sourceRef',
185
- 'targetRef',
186
- 'transformation'
187
- ]);
188
- });
189
-
190
- builder.alter('DataAssociation#transformation', function(desc) {
191
- desc.xml = {
192
- 'serialize': 'property'
193
- };
194
- });
195
-
196
-
197
- // fix Activity order serialization
198
-
199
- builder.alter('Activity', function(desc) {
200
- builder.reorderProperties(desc, [
201
- 'ioSpecification',
202
- 'properties',
203
- 'dataInputAssociations',
204
- 'dataOutputAssociations',
205
- 'resources',
206
- 'loopCharacteristics'
207
- ]);
208
- });
209
-
210
-
211
- // fix *Refs -> Ref
212
-
213
- builder.alter('CallableElement#supportedInterfaceRefs', {
214
- name: 'supportedInterfaceRef'
215
- });
216
-
217
- builder.alter('Participant#interfaceRefs', {
218
- name: 'interfaceRef'
219
- });
220
-
221
- builder.alter('Operation#errorRefs', {
222
- name: 'errorRef'
223
- });
224
-
225
- builder.alter('ThrowEvent#eventDefinitionRefs', {
226
- name: 'eventDefinitionRef'
227
- });
228
-
229
- builder.alter('CatchEvent#eventDefinitionRefs', {
230
- name: 'eventDefinitionRef'
231
- });
232
-
233
- builder.alter('DataInput#inputSetRefs', {
234
- name: 'inputSetRef'
235
- });
236
-
237
- builder.alter('DataOutput#outputSetRefs', {
238
- name: 'outputSetRef'
239
- });
240
-
241
-
242
- builder.alter('Process', function(desc) {
243
-
244
- desc.properties.push({
245
- "name": "laneSets",
246
- "type": "LaneSet",
247
- "isMany": true,
248
- "replaces": "FlowElementsContainer#laneSets"
249
- });
250
-
251
- desc.properties.push({
252
- "name": "flowElements",
253
- "type": "FlowElement",
254
- "isMany": true,
255
- "replaces": "FlowElementsContainer#flowElements"
256
- });
257
-
258
- builder.reorderProperties(desc, [
259
- 'auditing',
260
- 'monitoring',
261
- 'properties',
262
- 'laneSets',
263
- 'flowElements',
264
- 'artifacts',
265
- 'resources',
266
- 'correlationSubscriptions',
267
- 'supports'
268
- ]);
269
- });
270
-
271
-
272
- builder.alter('SubProcess', function(desc) {
273
- desc.superClass.push('InteractionNode');
274
- });
275
-
276
- builder.alter('Documentation#text', function(prop) {
277
- prop.isBody = true;
278
- delete prop.isAttr;
279
- });
280
-
281
- builder.alter('ScriptTask#script', function(desc) {
282
- delete desc.isAttr;
283
- });
284
-
285
- builder.alter('TextAnnotation#text', function(desc) {
286
- delete desc.isAttr;
287
- });
288
-
289
- builder.alter('Expression', {
290
- isAbstract: true
291
- });
292
-
293
- // serialize Expression as xsi:type
294
- pkg.types.forEach(function(t) {
295
- (t.properties || []).forEach(function(p) {
296
- if (p.type === 'Expression') {
297
- p.xml = { serialize: 'xsi:type' };
298
- }
299
- });
300
- });
301
-
302
- // fix MultiMultiInstanceLoopCharacteristics
303
-
304
- builder.alter('MultiInstanceLoopCharacteristics#loopDataInputRef', function(desc) {
305
- delete desc.isAttr;
306
- });
307
-
308
- builder.alter('MultiInstanceLoopCharacteristics#loopDataOutputRef', function(desc) {
309
- delete desc.isAttr;
310
- });
311
-
312
- builder.alter('MultiInstanceLoopCharacteristics#inputDataItem', function(desc) {
313
- desc.xml = { serialize: 'property' };
314
- });
315
-
316
- builder.alter('MultiInstanceLoopCharacteristics#outputDataItem', function(desc) {
317
- desc.xml = { serialize: 'property' };
318
- });
319
-
320
- builder.alter('MultiInstanceLoopCharacteristics', function(desc) {
321
- builder.reorderProperties(desc, [
322
- 'outputDataItem',
323
- 'complexBehaviorDefinition',
324
- 'completionCondition'
325
- ]);
326
- });
327
-
328
-
329
- // make some references strings rather than references
330
- // (this way we are able to import it properly)
331
-
332
- builder.alter('Operation#implementationRef', function(desc) {
333
- desc.isAttr = true;
334
- makeStringRef(desc);
335
- });
336
-
337
- builder.alter('Interface#implementationRef', function(desc) {
338
- desc.isAttr = true;
339
- makeStringRef(desc);
340
- });
341
-
342
- builder.alter('ItemDefinition#structureRef', function(desc) {
343
- desc.isAttr = true;
344
- makeStringRef(desc);
345
- });
346
-
347
- builder.alter('CallActivity#calledElementRef', function(desc) {
348
- desc.name = 'calledElement';
349
- makeStringRef(desc);
350
- });
351
-
352
- builder.alter('Gateway#gatewayDirection', function(desc) {
353
- desc.default = 'Unspecified';
354
- });
355
-
356
- builder.alter('EventBasedGateway#eventGatewayType', function(desc) {
357
- desc.default = 'Exclusive';
358
- });
359
-
360
- builder.alter('CatchEvent#parallelMultiple', function(desc) {
361
- desc.default = false;
362
- });
363
-
364
- builder.alter('ParticipantMultiplicity#minimum', function(desc) {
365
- desc.default = 0;
366
- });
367
-
368
- builder.alter('ParticipantMultiplicity#maximum', function(desc) {
369
- desc.default = 1;
370
- });
371
-
372
- builder.alter('Activity#startQuantity', function(desc) {
373
- desc.default = 1;
374
- });
375
-
376
- builder.alter('Activity#completionQuantity', function(desc) {
377
- desc.default = 1;
378
- });
379
-
380
- builder.alter('DataAssociation#targetRef', function(desc) {
381
- delete desc.isAttr;
382
- });
383
-
384
- builder.alter('Lane#flowNodeRefs', {
385
- name: 'flowNodeRef'
386
- });
387
-
388
- builder.alter('Lane#childLaneSet', {
389
- xml: { serialize: 'xsi:type' }
390
- });
391
-
392
- builder.alter('Lane', function(desc) {
393
- builder.reorderProperties(desc, [
394
- 'partitionElement',
395
- 'flowNodeRef',
396
- 'childLaneSet'
397
- ]);
398
- });
399
-
400
- builder.alter('Escalation', {
401
- superClass: [ 'RootElement' ]
402
- });
403
-
404
- builder.alter('Expression', function(desc) {
405
- desc.isAbstract = false;
406
- desc.properties = [
407
- {
408
- name: 'body',
409
- type: 'String',
410
- isBody: true
411
- }
412
- ];
413
- });
414
-
415
- builder.alter('FormalExpression', function(desc) {
416
- desc.properties = desc.properties.filter(function(p) {
417
- return p.name !== 'body';
418
- });
419
- });
420
-
421
- builder.alter('CallableElement#ioSpecification', function(desc) {
422
- desc.xml = { serialize: 'property' };
423
- });
424
-
425
- builder.alter('CallableElement#ioBinding', function(desc) {
426
- desc.xml = { serialize: 'property' };
427
- });
428
-
429
- builder.alter('Activity#ioSpecification', function(desc) {
430
- desc.xml = { serialize: 'property' };
431
- });
432
-
433
- // fix Operation attributes issue
434
- builder.alter('Operation#inMessageRef', function(desc) {
435
- delete desc.isAttr;
436
- });
437
-
438
- builder.alter('Operation#outMessageRef', function(desc) {
439
- delete desc.isAttr;
440
- });
441
-
442
- builder.exportTo('resources/bpmn/json/bpmn.json');
443
- }, done);
444
-
445
- });
446
-
447
-
448
- it('transform BPMNDI.cmof', function(done) {
449
-
450
- var builder = new Builder();
451
-
452
- builder.parse('resources/bpmn/cmof/BPMNDI.cmof', function(pkg) {
453
-
454
- builder.cleanIDs();
455
- builder.cleanAssociations();
456
-
457
- // remove associations
458
- pkg.associations = [];
459
-
460
- builder.alter('BPMNEdge#messageVisibleKind', function(desc) {
461
- desc.default = 'initiating';
462
- });
463
-
464
- builder.exportTo('resources/bpmn/json/bpmndi.json');
465
- }, done);
466
-
467
- });
468
-
469
-
470
- it('transform DI.cmof', function(done) {
471
-
472
- var builder = new Builder();
473
-
474
- builder.parse('resources/bpmn/cmof/DI.cmof', function(pkg, cmof) {
475
-
476
- builder.cleanIDs();
477
- builder.cleanAssociations();
478
-
479
- pkg.xml = {
480
- tagAlias: 'lowerCase'
481
- };
482
-
483
- // remove associations
484
- pkg.associations = [];
485
-
486
- pkg.types.push({
487
- name: 'Extension',
488
- properties: [
489
- {
490
- name: 'values',
491
- type: 'Element',
492
- isMany: true
493
- }
494
- ]
495
- });
496
-
497
- builder.alter('DiagramElement', function(data) {
498
-
499
- data.properties.unshift({
500
- name: 'extension',
501
- type: 'Extension'
502
- });
503
-
504
- data.properties.unshift({
505
- name: 'id',
506
- type: 'String',
507
- isAttr: true,
508
- isId: true
509
- });
510
- });
511
-
512
- builder.alter('Diagram', function(data) {
513
- data.properties.unshift({
514
- name: 'id',
515
- type: 'String',
516
- isAttr: true,
517
- isId: true
518
- });
519
- });
520
-
521
-
522
- builder.alter('Style', function(data) {
523
- (data.properties = data.properties || []).unshift({
524
- name: 'id',
525
- type: 'String',
526
- isAttr: true,
527
- isId: true
528
- });
529
- });
530
-
531
- builder.alter('Edge#waypoint', {
532
- xml: { serialize: 'xsi:type' }
533
- });
534
-
535
- builder.exportTo('resources/bpmn/json/di.json');
536
- }, done);
537
-
538
- });
539
-
540
-
541
- it('transform DC.cmof', function(done) {
542
-
543
- var builder = new Builder();
544
-
545
- builder.parse('resources/bpmn/cmof/DC.cmof', function(pkg, cmof) {
546
-
547
- builder.cleanIDs();
548
- builder.cleanAssociations();
549
-
550
- // remove associations
551
- pkg.associations = [];
552
-
553
- builder.exportTo('resources/bpmn/json/dc.json');
554
- }, done);
555
-
556
- });
557
-
558
- });
559
-
560
- });