bpmn-moddle 0.12.3 → 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 (88) hide show
  1. package/.travis.yml +2 -5
  2. package/lib/simple.js +3 -2
  3. package/package.json +5 -5
  4. package/resources/bpmn/json/bpmn.json +9 -7
  5. package/resources/bpmn/json/bpmndi.json +1 -1
  6. package/resources/bpmn-io/json/bioc.json +41 -0
  7. package/.npmignore +0 -6
  8. package/test/expect.js +0 -7
  9. package/test/fixtures/bpmn/activity-children.bpmn +0 -23
  10. package/test/fixtures/bpmn/callActivity-calledElement.part.bpmn +0 -7
  11. package/test/fixtures/bpmn/catch-event-dataOutputAssociations.part.bpmn +0 -5
  12. package/test/fixtures/bpmn/category.bpmn +0 -28
  13. package/test/fixtures/bpmn/complex.bpmn +0 -3680
  14. package/test/fixtures/bpmn/conversation-children.bpmn +0 -23
  15. package/test/fixtures/bpmn/data-object-reference.bpmn +0 -17
  16. package/test/fixtures/bpmn/definitions-children.bpmn +0 -13
  17. package/test/fixtures/bpmn/di/bpmnDiagram-extension.part.bpmn +0 -17
  18. package/test/fixtures/bpmn/di/bpmnDiagram.part.bpmn +0 -12
  19. package/test/fixtures/bpmn/di/bpmnEdge-waypoint.part.bpmn +0 -4
  20. package/test/fixtures/bpmn/di/bpmnEdge.part.bpmn +0 -5
  21. package/test/fixtures/bpmn/di/bpmnShape.part.bpmn +0 -4
  22. package/test/fixtures/bpmn/di-extension.bpmn +0 -26
  23. package/test/fixtures/bpmn/documentation-extension-elements.bpmn +0 -15
  24. package/test/fixtures/bpmn/documentation.bpmn +0 -11
  25. package/test/fixtures/bpmn/empty-definitions-default-ns.bpmn +0 -4
  26. package/test/fixtures/bpmn/empty-definitions.bpmn +0 -5
  27. package/test/fixtures/bpmn/error/binary.png +0 -0
  28. package/test/fixtures/bpmn/error/categoryValue.bpmn +0 -27
  29. package/test/fixtures/bpmn/error/di-no-bpmn-element.bpmn +0 -13
  30. package/test/fixtures/bpmn/error/duplicate-ids.bpmn +0 -8
  31. package/test/fixtures/bpmn/error/extension-definition-missing.bpmn +0 -6
  32. package/test/fixtures/bpmn/error/no-xml.txt +0 -1
  33. package/test/fixtures/bpmn/error/undeclared-ns-child.bpmn +0 -6
  34. package/test/fixtures/bpmn/error/unrecognized-child.bpmn +0 -6
  35. package/test/fixtures/bpmn/escalation-error.bpmn +0 -6
  36. package/test/fixtures/bpmn/event-references.part.bpmn +0 -6
  37. package/test/fixtures/bpmn/extension/camunda/inputOutput-list.part.bpmn +0 -9
  38. package/test/fixtures/bpmn/extension/camunda/inputOutput-map.part.bpmn +0 -12
  39. package/test/fixtures/bpmn/extension/camunda/inputOutput-mixed.part.bpmn +0 -13
  40. package/test/fixtures/bpmn/extension/camunda/inputOutput-plain.part.bpmn +0 -3
  41. package/test/fixtures/bpmn/extension/camunda/inputOutput-script.part.bpmn +0 -9
  42. package/test/fixtures/bpmn/extension/camunda/inputOutput.bpmn +0 -22
  43. package/test/fixtures/bpmn/extension/drools.part.bpmn +0 -9
  44. package/test/fixtures/bpmn/extension-attributes.bpmn +0 -20
  45. package/test/fixtures/bpmn/extension-elements.bpmn +0 -9
  46. package/test/fixtures/bpmn/inputOutputSpecification-children.bpmn +0 -19
  47. package/test/fixtures/bpmn/interface-implementationRef.part.bpmn +0 -2
  48. package/test/fixtures/bpmn/itemDefinition-structureRef.part.bpmn +0 -2
  49. package/test/fixtures/bpmn/lane-childLaneSets.part.bpmn +0 -8
  50. package/test/fixtures/bpmn/lane-children.bpmn +0 -46
  51. package/test/fixtures/bpmn/multiInstanceLoopCharacteristics-completionCondition.part.bpmn +0 -5
  52. package/test/fixtures/bpmn/multiInstanceLoopCharacteristics.bpmn +0 -181
  53. package/test/fixtures/bpmn/operation-implementationRef.part.bpmn +0 -2
  54. package/test/fixtures/bpmn/operation-messageRef.bpmn +0 -12
  55. package/test/fixtures/bpmn/participant-interfaceRef.bpmn +0 -20
  56. package/test/fixtures/bpmn/potentialOwner.bpmn +0 -11
  57. package/test/fixtures/bpmn/process-children.bpmn +0 -24
  58. package/test/fixtures/bpmn/scriptTask-script.part.bpmn +0 -4
  59. package/test/fixtures/bpmn/sequenceFlow-conditionExpression.part.bpmn +0 -5
  60. package/test/fixtures/bpmn/simple-default-ns.bpmn +0 -31
  61. package/test/fixtures/bpmn/simple.bpmn +0 -31
  62. package/test/fixtures/bpmn/sub-process-flow-nodes.part.bpmn +0 -8
  63. package/test/fixtures/bpmn/sub-process.part.bpmn +0 -10
  64. package/test/fixtures/bpmn/subprocess-flow-nodes-outgoing.part.bpmn +0 -16
  65. package/test/fixtures/bpmn/throw-event-dataInputAssociations.part.bpmn +0 -5
  66. package/test/fixtures/bpmn/timerEventDefinition.part.bpmn +0 -5
  67. package/test/fixtures/bpmn/vendor/signavio-complex-no-extensions.bpmn +0 -2151
  68. package/test/fixtures/bpmn/vendor/yaoqiang-event-definitions.bpmn +0 -396
  69. package/test/fixtures/bpmn/vendor.xsd +0 -14
  70. package/test/fixtures/bpmn/xsi-type.bpmn +0 -61
  71. package/test/fixtures/json/model/camunda.json +0 -224
  72. package/test/fixtures/json/model/drools.json +0 -24
  73. package/test/fixtures/xsd/BPMN20.xsd +0 -39
  74. package/test/fixtures/xsd/Vendor.xsd +0 -14
  75. package/test/helper.js +0 -23
  76. package/test/integration/camunda/read.js +0 -203
  77. package/test/integration/camunda/roundtrip.js +0 -48
  78. package/test/integration/camunda/write.js +0 -249
  79. package/test/integration/misc.js +0 -107
  80. package/test/matchers.js +0 -19
  81. package/test/spec/adapter/cmof/builder.js +0 -194
  82. package/test/spec/adapter/cmof/generate-simple.js +0 -548
  83. package/test/spec/bpmn-moddle.js +0 -208
  84. package/test/spec/xml/edit.js +0 -76
  85. package/test/spec/xml/read.js +0 -986
  86. package/test/spec/xml/roundtrip.js +0 -497
  87. package/test/spec/xml/write.js +0 -927
  88. package/test/xml-helper.js +0 -39
@@ -1,497 +0,0 @@
1
- 'use strict';
2
-
3
- var Helper = require('../../helper'),
4
- XMLHelper = require('../../xml-helper');
5
-
6
- var toXML = XMLHelper.toXML,
7
- validate = XMLHelper.validate;
8
-
9
-
10
- describe('bpmn-moddle - roundtrip', function() {
11
-
12
- var moddle = Helper.createModdle();
13
-
14
- function fromFile(file, done) {
15
- XMLHelper.fromFile(moddle, file, done);
16
- }
17
-
18
-
19
- describe('should serialize valid BPMN 2.0 xml after read', function() {
20
-
21
- this.timeout(15000);
22
-
23
-
24
- it('home-made bpmn model', function(done) {
25
-
26
- var definitions = moddle.create('bpmn:Definitions', { targetNamespace: 'http://foo' });
27
-
28
- var processElement = moddle.create('bpmn:Process');
29
- var serviceTask = moddle.create('bpmn:ServiceTask', { name: 'MyService Task' });
30
-
31
- processElement.get('flowElements').push(serviceTask);
32
- definitions.get('rootElements').push(processElement);
33
-
34
- // when
35
- toXML(definitions, { format: true }, function(err, xml) {
36
-
37
- // then
38
- validate(err, xml, done);
39
- });
40
- });
41
-
42
-
43
- it('obscure ids model', function(done) {
44
-
45
- var definitions = moddle.create('bpmn:Definitions', {
46
- 'xmlns:foo': 'http://foo-ns',
47
- targetNamespace: 'http://foo',
48
- rootElements: [
49
- moddle.create('bpmn:Message', { id: 'foo_bar' }),
50
- moddle.create('bpmn:Message', { id: 'foo-bar' }),
51
- moddle.create('bpmn:Message', { id: 'foo1bar' }),
52
- moddle.create('bpmn:Message', { id: 'Foo1bar' }),
53
- moddle.create('bpmn:Message', { id: '_foo_bar' }),
54
- moddle.create('bpmn:Message', { id: '_foo-bar' }),
55
- moddle.create('bpmn:Message', { id: '_11' })
56
- // invalid
57
- // moddle.create('bpmn:Message', { id: '-foo-bar' }),
58
- // moddle.create('bpmn:Message', { id: 'foo:_foo_bar' }),
59
- // moddle.create('bpmn:Message', { id: '1foo_bar' })
60
- ]
61
- });
62
-
63
- // when
64
- toXML(definitions, { format: true }, function(err, xml) {
65
-
66
- // then
67
- validate(err, xml, done);
68
- });
69
- });
70
-
71
-
72
- it('ioSpecification', function(done) {
73
-
74
- // given
75
- var definitions = moddle.create('bpmn:Definitions', { targetNamespace: 'http://foo' });
76
-
77
- var processElement = moddle.create('bpmn:Process');
78
-
79
- var dataInput = moddle.create('bpmn:DataInput', { id: 'DataInput_FOO' });
80
-
81
- var inputSet = moddle.create('bpmn:InputSet', {
82
- dataInputRefs: [ dataInput ]
83
- });
84
-
85
- var outputSet = moddle.create('bpmn:OutputSet');
86
-
87
- var ioSpecification = moddle.create('bpmn:InputOutputSpecification', {
88
- inputSets: [ inputSet ],
89
- outputSets: [ outputSet ],
90
- dataInputs: [ dataInput ]
91
- });
92
-
93
- var serviceTask = moddle.create('bpmn:ServiceTask', {
94
- name: 'MyService Task',
95
- ioSpecification: ioSpecification
96
- });
97
-
98
- processElement.get('flowElements').push(serviceTask);
99
- definitions.get('rootElements').push(processElement);
100
-
101
- // when
102
- toXML(definitions, { format: true }, function(err, xml) {
103
-
104
- // then
105
- validate(err, xml, done);
106
- });
107
- });
108
-
109
-
110
- it('properties', function(done) {
111
-
112
- // given
113
- var definitions = moddle.create('bpmn:Definitions', { targetNamespace: 'http://foo' });
114
-
115
- var processElement = moddle.create('bpmn:Process');
116
-
117
- var property = moddle.create('bpmn:Property', {
118
- id: 'Property_112',
119
- name: '__targetRef_placeholder'
120
- });
121
-
122
- var serviceTask = moddle.create('bpmn:ServiceTask', {
123
- name: 'MyService Task',
124
- properties: [ property ]
125
- });
126
-
127
- processElement.get('flowElements').push(serviceTask);
128
- definitions.get('rootElements').push(processElement);
129
-
130
- // when
131
- toXML(definitions, { format: true }, function(err, xml) {
132
-
133
- // then
134
- validate(err, xml, done);
135
- });
136
- });
137
-
138
-
139
- it('extension attributes', function(done) {
140
-
141
- // given
142
- fromFile('test/fixtures/bpmn/extension-attributes.bpmn', function(err, result) {
143
-
144
- if (err) {
145
- return done(err);
146
- }
147
-
148
- // when
149
- toXML(result, { format: true }, function(err, xml) {
150
- validate(err, xml, done);
151
- });
152
- });
153
- });
154
-
155
-
156
- it('multi instance loop characteristics', function(done) {
157
-
158
- // given
159
- fromFile('test/fixtures/bpmn/multiInstanceLoopCharacteristics.bpmn', function(err, result) {
160
-
161
- if (err) {
162
- return done(err);
163
- }
164
-
165
- // when
166
- toXML(result, { format: true }, function(err, xml) {
167
- validate(err, xml, done);
168
- });
169
- });
170
- });
171
-
172
-
173
- it('documentation / extensionElements order', function(done) {
174
-
175
- // given
176
- fromFile('test/fixtures/bpmn/documentation-extension-elements.bpmn', function(err, result) {
177
-
178
- if (err) {
179
- return done(err);
180
- }
181
-
182
- // when
183
- toXML(result, { format: true }, function(err, xml) {
184
- validate(err, xml, done);
185
- });
186
- });
187
- });
188
-
189
-
190
- it('activity children order', function(done) {
191
-
192
- // given
193
- fromFile('test/fixtures/bpmn/activity-children.bpmn', function(err, result) {
194
-
195
- if (err) {
196
- return done(err);
197
- }
198
-
199
- // when
200
- toXML(result, { format: true }, function(err, xml) {
201
- validate(err, xml, done);
202
- });
203
- });
204
- });
205
-
206
-
207
- it('lane children order', function(done) {
208
-
209
- // given
210
- fromFile('test/fixtures/bpmn/lane-children.bpmn', function(err, result) {
211
-
212
- if (err) {
213
- return done(err);
214
- }
215
-
216
- // when
217
- toXML(result, { format: true }, function(err, xml) {
218
- validate(err, xml, done);
219
- });
220
- });
221
- });
222
-
223
-
224
- it('conversation children order', function(done) {
225
-
226
- // given
227
- fromFile('test/fixtures/bpmn/conversation-children.bpmn', function(err, result) {
228
-
229
- if (err) {
230
- return done(err);
231
- }
232
-
233
- // when
234
- toXML(result, { format: true }, function(err, xml) {
235
- validate(err, xml, done);
236
- });
237
- });
238
- });
239
-
240
-
241
- it('process children order', function(done) {
242
-
243
- // given
244
- fromFile('test/fixtures/bpmn/process-children.bpmn', function(err, result) {
245
-
246
- if (err) {
247
- return done(err);
248
- }
249
-
250
- // when
251
- toXML(result, { format: true }, function(err, xml) {
252
- validate(err, xml, done);
253
- });
254
- });
255
- });
256
-
257
-
258
- it('definitions children order', function(done) {
259
-
260
- // given
261
- fromFile('test/fixtures/bpmn/definitions-children.bpmn', function(err, result) {
262
-
263
- if (err) {
264
- return done(err);
265
- }
266
-
267
- // when
268
- toXML(result, { format: true }, function(err, xml) {
269
- validate(err, xml, done);
270
- });
271
- });
272
- });
273
-
274
-
275
- it('ioSpecification children order', function(done) {
276
-
277
- // given
278
- fromFile('test/fixtures/bpmn/inputOutputSpecification-children.bpmn', function(err, result) {
279
-
280
- if (err) {
281
- return done(err);
282
- }
283
-
284
- // when
285
- toXML(result, { format: true }, function(err, xml) {
286
- validate(err, xml, done);
287
- });
288
- });
289
- });
290
-
291
-
292
- it('Participant#interfaceRef', function(done) {
293
-
294
- // given
295
- fromFile('test/fixtures/bpmn/participant-interfaceRef.bpmn', function(err, result) {
296
-
297
- if (err) {
298
- return done(err);
299
- }
300
-
301
- // when
302
- toXML(result, { format: true }, function(err, xml) {
303
- validate(err, xml, done);
304
- });
305
- });
306
- });
307
-
308
-
309
- it('ResourceRole#resourceRef', function(done) {
310
-
311
- // given
312
- fromFile('test/fixtures/bpmn/potentialOwner.bpmn', function(err, result) {
313
-
314
- if (err) {
315
- return done(err);
316
- }
317
-
318
- // when
319
- toXML(result, { format: true }, function(err, xml) {
320
- validate(err, xml, done);
321
- });
322
- });
323
- });
324
-
325
-
326
- it('Operation#messageRef', function(done) {
327
-
328
- // given
329
- fromFile('test/fixtures/bpmn/operation-messageRef.bpmn', function(err, result) {
330
-
331
- if (err) {
332
- return done(err);
333
- }
334
-
335
- // when
336
- toXML(result, { format: true }, function(err, xml) {
337
-
338
- // then
339
- expect(xml).to.contain('<bpmn:inMessageRef>fooInMessage</bpmn:inMessageRef>');
340
-
341
- validate(err, xml, done);
342
- });
343
- });
344
- });
345
-
346
-
347
- it('di extensions', function(done) {
348
-
349
- // given
350
- fromFile('test/fixtures/bpmn/di-extension.bpmn', function(err, result) {
351
-
352
- if (err) {
353
- return done(err);
354
- }
355
-
356
- // when
357
- toXML(result, { format: true }, function(err, xml) {
358
-
359
- expect(xml).to.contain('<vendor:baz baz="BAZ" />');
360
- expect(xml).to.contain('<vendor:bar>BAR</vendor:bar>');
361
- expect(xml).to.contain('<di:extension />');
362
-
363
- validate(err, xml, done);
364
- });
365
- });
366
- });
367
-
368
-
369
- it('complex processElement / extensionElements', function(done) {
370
-
371
- // given
372
- fromFile('test/fixtures/bpmn/complex.bpmn', function(err, result) {
373
-
374
- if (err) {
375
- return done(err);
376
- }
377
-
378
- // when
379
- toXML(result, { format: true }, function(err, xml) {
380
- validate(err, xml, done);
381
- });
382
- });
383
- });
384
-
385
-
386
- it('category', function(done) {
387
-
388
- // given
389
- fromFile('test/fixtures/bpmn/category.bpmn', function(err, result) {
390
-
391
- if (err) {
392
- return done(err);
393
- }
394
-
395
- // when
396
- toXML(result, { format: true }, function(err, xml) {
397
-
398
- expect(xml).to.contain('sid-afd7e63e-916e-4bd0-a9f0-98cbff749193');
399
- expect(xml).to.contain('group with label');
400
-
401
- validate(err, xml, done);
402
- });
403
- });
404
-
405
- });
406
-
407
-
408
- it('simple processElement', function(done) {
409
-
410
- // given
411
- fromFile('test/fixtures/bpmn/simple.bpmn', function(err, result) {
412
-
413
- if (err) {
414
- return done(err);
415
- }
416
-
417
- // when
418
- toXML(result, { format: true }, function(err, xml) {
419
- validate(err, xml, done);
420
- });
421
- });
422
- });
423
-
424
-
425
- it('xsi:type', function(done) {
426
-
427
- // given
428
- fromFile('test/fixtures/bpmn/xsi-type.bpmn', function(err, result) {
429
-
430
- if (err) {
431
- return done(err);
432
- }
433
-
434
- // when
435
- toXML(result, { format: true }, function(err, xml) {
436
- validate(err, xml, done);
437
- });
438
- });
439
- });
440
-
441
- });
442
-
443
-
444
- describe('vendor', function() {
445
-
446
- describe('signavio', function() {
447
-
448
- it('complex processElement', function(done) {
449
-
450
- // given
451
- fromFile('test/fixtures/bpmn/vendor/signavio-complex-no-extensions.bpmn', function(err, result) {
452
-
453
- if (err) {
454
- return done(err);
455
- }
456
-
457
- // when
458
- toXML(result, { format: true }, function(err, xml) {
459
- validate(err, xml, done);
460
- });
461
- });
462
- });
463
-
464
- });
465
-
466
-
467
- describe('yaoqiang', function() {
468
-
469
- it('event definitions', function(done) {
470
-
471
- // given
472
- fromFile('test/fixtures/bpmn/vendor/yaoqiang-event-definitions.bpmn', function(err, result, context) {
473
-
474
- if (err) {
475
- return done(err);
476
- }
477
-
478
- var warningsStr = context.warnings.map(function(w) {
479
- return '\n\t- ' + w.message;
480
- }).join('');
481
-
482
- if (warningsStr) {
483
- return done(new Error('import warnings: ' + warningsStr));
484
- }
485
-
486
- // when
487
- toXML(result, { format: true }, function(err, xml) {
488
- validate(err, xml, done);
489
- });
490
- });
491
- });
492
-
493
- });
494
-
495
- });
496
-
497
- });