diff --git a/resources/bpmn/json/bpmn.json b/resources/bpmn/json/bpmn.json
index 5d60d1e4..0a39bc26 100644
--- a/resources/bpmn/json/bpmn.json
+++ b/resources/bpmn/json/bpmn.json
@@ -403,16 +403,16 @@
"id": "A_extensionAttributeDefinitions_extensionDefinition"
},
{
- "name": "A_extensionValues_baseElement",
+ "name": "A_extensionElements_baseElement",
"visibility": "private",
- "memberEnd": "BaseElement-extensionValues A_extensionValues_baseElement-baseElement",
- "id": "A_extensionValues_baseElement",
+ "memberEnd": "BaseElement-extensionElements A_extensionElements_baseElement-baseElement",
+ "id": "A_extensionElements_baseElement",
"ownedEnd": {
"name": "baseElement",
"type": "BaseElement",
- "owningAssociation": "A_extensionValues_baseElement",
- "association": "A_extensionValues_baseElement",
- "id": "A_extensionValues_baseElement-baseElement"
+ "owningAssociation": "A_extensionElements_baseElement",
+ "association": "A_extensionElements_baseElement",
+ "id": "A_extensionElements_baseElement-baseElement"
}
},
{
@@ -3164,11 +3164,10 @@
"isReference": true
},
{
- "name": "extensionValues",
+ "name": "extensionElements",
"type": "ExtensionElements",
- "association": "A_extensionValues_baseElement",
- "id": "BaseElement-extensionValues",
- "isMany": true
+ "association": "A_extensionElements_baseElement",
+ "id": "BaseElement-extensionElements"
},
{
"name": "documentation",
@@ -3263,10 +3262,11 @@
"type": "Element"
},
{
- "name": "value",
+ "name": "values",
"association": "A_value_extensionElements",
"id": "ExtensionElements-value",
- "type": "Element"
+ "type": "Element",
+ "isMany": true
},
{
"name": "extensionAttributeDefinition",
diff --git a/test/fixtures/bpmn/error/extension-elements.bpmn b/test/fixtures/bpmn/error/extension-elements.bpmn
deleted file mode 100644
index 859e4fec..00000000
--- a/test/fixtures/bpmn/error/extension-elements.bpmn
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/test/spec/node/adapter/cmof/GenerateBpmnJsonSpec.js b/test/spec/node/adapter/cmof/GenerateBpmnJsonSpec.js
index 01dd3ba7..7c4a26f6 100644
--- a/test/spec/node/adapter/cmof/GenerateBpmnJsonSpec.js
+++ b/test/spec/node/adapter/cmof/GenerateBpmnJsonSpec.js
@@ -91,7 +91,7 @@ describe('generate JSON meta model', function() {
if (elementParts[1]) {
var property = _.find(element.properties, function(p) {
- return p.name == elementParts[1];
+ return p.name === elementParts[1];
});
if (!property) {
@@ -114,10 +114,36 @@ describe('generate JSON meta model', function() {
it('should transform BPMN20.cmof', parsed('resources/bpmn/cmof/BPMN20.cmof', function(results) {
+ // perform a translation from
+ //
+ // BaseElement
+ // - extensionValues = [ ExtensionAttributeValue#value = ... ]
+ //
+ // to
+ //
+ // BaseElement
+ // - extensionElements: ExtensionElements#values = [ ... ]
+ //
+ alter(results, 'ExtensionAttributeValue#value', {
+ name: 'values',
+ isMany: true
+ });
+
+ alter(results, 'BaseElement#extensionValues', function(p) {
+ p.name = 'extensionElements';
+
+ delete p.isMany;
+ });
+
rename(results, 'extensionAttributeValue', 'extensionElements');
+ rename(results, 'extensionValues', 'extensionElements');
+
rename(results, 'ExtensionAttributeValue', 'ExtensionElements');
+
+ // fix positioning of elements
+
alter(results, 'FlowElementsContainer', function(desc) {
swapProperties(desc, 'laneSets', 'flowElements');
});
@@ -154,8 +180,10 @@ describe('generate JSON meta model', function() {
exportAsJson(results, { alias: 'lowerCase' });
}));
+
it('should transform BPMNDI.cmof', parsed('resources/bpmn/cmof/BPMNDI.cmof', exportAsJson));
+
it('should transform DI.cmof', parsed('resources/bpmn/cmof/DI.cmof', function(results) {
alter(results, 'Edge#waypoint', {
@@ -165,5 +193,6 @@ describe('generate JSON meta model', function() {
exportAsJson(results);
}));
+
it('should transform DC.cmof', parsed('resources/bpmn/cmof/DC.cmof', exportAsJson));
});
\ No newline at end of file
diff --git a/test/spec/node/xml/ReadSpec.js b/test/spec/node/xml/ReadSpec.js
index 1da8fcd0..38d24567 100644
--- a/test/spec/node/xml/ReadSpec.js
+++ b/test/spec/node/xml/ReadSpec.js
@@ -23,14 +23,16 @@ describe('Model', function() {
beforeEach(Matchers.add);
+
describe('fromXML', function() {
- it('should read documentation', function(done) {
+ it('should import documentation', function(done) {
// given
// when
readFile('documentation.bpmn', 'bpmn:Definitions', function(err, result) {
+ // then
expect(result).toDeepEqual({
$type: 'bpmn:Definitions',
id: 'documentation',
@@ -60,7 +62,32 @@ describe('Model', function() {
});
});
- it('import simple Process', function(done) {
+
+ it('should import extensionElements', function(done) {
+ // given
+
+ // when
+ readFile('extension-elements.bpmn', 'bpmn:Definitions', function(err, result) {
+
+ expect(result).toDeepEqual({
+ $type: 'bpmn:Definitions',
+ id: 'test',
+ targetNamespace: 'http://bpmn.io/schema/bpmn',
+ extensionElements: {
+ $type : 'bpmn:ExtensionElements',
+ values : [
+ { $type: 'vendor:info', key: 'bgcolor', value: '#ffffff' },
+ { $type: 'vendor:info', key: 'role', value: '[]' }
+ ]
+ }
+ });
+
+ done(err);
+ });
+ });
+
+
+ it('should import simple Process', function(done) {
// given
@@ -74,7 +101,8 @@ describe('Model', function() {
});
});
- it('import edge waypoints', function(done) {
+
+ it('should import edge waypoints', function(done) {
// given
@@ -95,7 +123,8 @@ describe('Model', function() {
});
});
- it('import simple Process (default ns)', function(done) {
+
+ it('should import simple Process (default ns)', function(done) {
// given
@@ -108,6 +137,7 @@ describe('Model', function() {
});
});
+
describe('should import references', function() {
it('via attributes', function(done) {
@@ -135,6 +165,7 @@ describe('Model', function() {
});
});
+
it('via elements', function(done) {
// given
@@ -173,6 +204,7 @@ describe('Model', function() {
});
});
+
describe('should import element', function() {
it('empty Definitions', function(done) {
@@ -195,6 +227,7 @@ describe('Model', function() {
});
});
+
it('empty Definitions (default ns)', function(done) {
// given
@@ -215,6 +248,7 @@ describe('Model', function() {
});
});
+
it('SubProcess / flow nodes', function(done) {
// given
@@ -241,6 +275,7 @@ describe('Model', function() {
});
});
+
it('SubProcess / flow nodes / nested references', function(done) {
// given
@@ -267,6 +302,7 @@ describe('Model', function() {
});
});
+
it('SubProcess / incoming + flow nodes', function(done) {
// given
@@ -315,6 +351,7 @@ describe('Model', function() {
});
});
+
it('BPMNShape / nested bounds / non-ns-attributes', function(done) {
// given
@@ -337,6 +374,7 @@ describe('Model', function() {
});
});
+
it('BPMNEdge / nested waypoints / explicit xsi:type', function(done) {
// given
@@ -360,6 +398,7 @@ describe('Model', function() {
});
});
+
it('BPMNDiagram / nested elements', function(done) {
// given
@@ -402,6 +441,7 @@ describe('Model', function() {
});
+
describe('should handle errors', function() {
@@ -410,7 +450,7 @@ describe('Model', function() {
// when
readFile('error/no-xml.txt', 'bpmn:Definitions', function(err, result) {
- expect(err).toBeDefined();
+ expect(err).not.toEqual(null);
done();
});
@@ -421,30 +461,19 @@ describe('Model', function() {
// when
readFile('error/binary.png', 'bpmn:Definitions', function(err, result) {
- expect(err).toBeDefined();
+ expect(err).not.toEqual(null);
done();
});
});
- it('when importing extension elements', function(done) {
-
- // when
- readFile('error/extension-elements.bpmn', 'bpmn:Definitions', function(err, result) {
-
- expect(err).toBeDefined();
-
- done();
- });
- });
-
it('when importing invalid bpmn', function(done) {
// when
readFile('error/invalid-child.bpmn', 'bpmn:Definitions', function(err, result) {
- expect(err).toBeDefined();
+ expect(err).not.toEqual(null);
done();
});
diff --git a/test/spec/node/xml/RoundtripSpec.js b/test/spec/node/xml/RoundtripSpec.js
index d8271526..bcbc8faf 100644
--- a/test/spec/node/xml/RoundtripSpec.js
+++ b/test/spec/node/xml/RoundtripSpec.js
@@ -45,8 +45,10 @@ describe('Model - roundtrip', function() {
}
}
+
beforeEach(Matchers.add);
+
describe('Roundtrip', function() {
it('should serialize home-made bpmn model', function(done) {
@@ -72,22 +74,6 @@ describe('Model - roundtrip', function() {
});
});
- xit('should write complex process', function(done) {
-
- // given
- readBpmn('complex.bpmn', function(err, result) {
-
- if (err) {
- done(err);
- return;
- }
-
- // when
- writeBpmn(result, { format: true }, function(err, xml) {
- validate(err, xml, done);
- });
- });
- });
it('should write complex process', function(done) {
@@ -106,6 +92,25 @@ describe('Model - roundtrip', function() {
});
});
+
+ it('should write complex process / extensionElements', function(done) {
+
+ // given
+ readBpmn('complex.bpmn', function(err, result) {
+
+ if (err) {
+ done(err);
+ return;
+ }
+
+ // when
+ writeBpmn(result, { format: true }, function(err, xml) {
+ validate(err, xml, done);
+ });
+ });
+ });
+
+
it('should write simple process', function(done) {
// given
@@ -122,5 +127,6 @@ describe('Model - roundtrip', function() {
});
});
});
+
});
});
\ No newline at end of file
diff --git a/test/spec/node/xml/WriteSpec.js b/test/spec/node/xml/WriteSpec.js
index ca1f5d56..3f9ded0d 100644
--- a/test/spec/node/xml/WriteSpec.js
+++ b/test/spec/node/xml/WriteSpec.js
@@ -25,6 +25,7 @@ describe('Model', function() {
beforeEach(Matchers.add);
+
describe('toXML', function() {
it('export empty Definitions', function(done) {
@@ -45,6 +46,7 @@ describe('Model', function() {
});
});
+
it('export BPMNShape', function(done) {
// given
@@ -68,5 +70,40 @@ describe('Model', function() {
});
});
+
+ it('export extensionElements', function(done) {
+
+ // given
+ var extensionElements = bpmnModel.create('bpmn:ExtensionElements');
+
+ var foo = bpmnModel.createAny('vendor:foo', 'http://vendor', {
+ key: 'FOO',
+ value: 'BAR'
+ });
+
+ extensionElements.get('values').push(foo);
+
+ var definitions = bpmnModel.create('bpmn:Definitions', {
+ extensionElements: extensionElements
+ });
+
+ var expectedXML =
+ '' +
+ '' +
+ '' +
+ '' +
+ '';
+
+
+ // when
+ write(definitions, function(err, result) {
+
+ // then
+ expect(result).toEqual(expectedXML);
+
+ done(err);
+ });
+ });
});
});
\ No newline at end of file