mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-02-23 14:18:10 +00:00
parent
47d82e1790
commit
e631de2b2f
@ -403,16 +403,16 @@
|
|||||||
"id": "A_extensionAttributeDefinitions_extensionDefinition"
|
"id": "A_extensionAttributeDefinitions_extensionDefinition"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "A_extensionValues_baseElement",
|
"name": "A_extensionElements_baseElement",
|
||||||
"visibility": "private",
|
"visibility": "private",
|
||||||
"memberEnd": "BaseElement-extensionValues A_extensionValues_baseElement-baseElement",
|
"memberEnd": "BaseElement-extensionElements A_extensionElements_baseElement-baseElement",
|
||||||
"id": "A_extensionValues_baseElement",
|
"id": "A_extensionElements_baseElement",
|
||||||
"ownedEnd": {
|
"ownedEnd": {
|
||||||
"name": "baseElement",
|
"name": "baseElement",
|
||||||
"type": "BaseElement",
|
"type": "BaseElement",
|
||||||
"owningAssociation": "A_extensionValues_baseElement",
|
"owningAssociation": "A_extensionElements_baseElement",
|
||||||
"association": "A_extensionValues_baseElement",
|
"association": "A_extensionElements_baseElement",
|
||||||
"id": "A_extensionValues_baseElement-baseElement"
|
"id": "A_extensionElements_baseElement-baseElement"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -3164,11 +3164,10 @@
|
|||||||
"isReference": true
|
"isReference": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "extensionValues",
|
"name": "extensionElements",
|
||||||
"type": "ExtensionElements",
|
"type": "ExtensionElements",
|
||||||
"association": "A_extensionValues_baseElement",
|
"association": "A_extensionElements_baseElement",
|
||||||
"id": "BaseElement-extensionValues",
|
"id": "BaseElement-extensionElements"
|
||||||
"isMany": true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "documentation",
|
"name": "documentation",
|
||||||
@ -3263,10 +3262,11 @@
|
|||||||
"type": "Element"
|
"type": "Element"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "value",
|
"name": "values",
|
||||||
"association": "A_value_extensionElements",
|
"association": "A_value_extensionElements",
|
||||||
"id": "ExtensionElements-value",
|
"id": "ExtensionElements-value",
|
||||||
"type": "Element"
|
"type": "Element",
|
||||||
|
"isMany": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "extensionAttributeDefinition",
|
"name": "extensionAttributeDefinition",
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:vendor="http://vendor" id="test" targetNamespace="http://bpmn.io/schema/bpmn">
|
|
||||||
|
|
||||||
<bpmn2:extensionElements>
|
|
||||||
<vendor:info key="bgcolor" value="#ffffff"/>
|
|
||||||
<vendor:info key="rolle" value="[]"/>
|
|
||||||
</bpmn2:extensionElements>
|
|
||||||
|
|
||||||
</bpmn2:definitions>
|
|
@ -91,7 +91,7 @@ describe('generate JSON meta model', function() {
|
|||||||
|
|
||||||
if (elementParts[1]) {
|
if (elementParts[1]) {
|
||||||
var property = _.find(element.properties, function(p) {
|
var property = _.find(element.properties, function(p) {
|
||||||
return p.name == elementParts[1];
|
return p.name === elementParts[1];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!property) {
|
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) {
|
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, 'extensionAttributeValue', 'extensionElements');
|
||||||
|
|
||||||
|
rename(results, 'extensionValues', 'extensionElements');
|
||||||
|
|
||||||
rename(results, 'ExtensionAttributeValue', 'ExtensionElements');
|
rename(results, 'ExtensionAttributeValue', 'ExtensionElements');
|
||||||
|
|
||||||
|
|
||||||
|
// fix positioning of elements
|
||||||
|
|
||||||
alter(results, 'FlowElementsContainer', function(desc) {
|
alter(results, 'FlowElementsContainer', function(desc) {
|
||||||
swapProperties(desc, 'laneSets', 'flowElements');
|
swapProperties(desc, 'laneSets', 'flowElements');
|
||||||
});
|
});
|
||||||
@ -154,8 +180,10 @@ describe('generate JSON meta model', function() {
|
|||||||
exportAsJson(results, { alias: 'lowerCase' });
|
exportAsJson(results, { alias: 'lowerCase' });
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
it('should transform BPMNDI.cmof', parsed('resources/bpmn/cmof/BPMNDI.cmof', exportAsJson));
|
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) {
|
it('should transform DI.cmof', parsed('resources/bpmn/cmof/DI.cmof', function(results) {
|
||||||
|
|
||||||
alter(results, 'Edge#waypoint', {
|
alter(results, 'Edge#waypoint', {
|
||||||
@ -165,5 +193,6 @@ describe('generate JSON meta model', function() {
|
|||||||
exportAsJson(results);
|
exportAsJson(results);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
it('should transform DC.cmof', parsed('resources/bpmn/cmof/DC.cmof', exportAsJson));
|
it('should transform DC.cmof', parsed('resources/bpmn/cmof/DC.cmof', exportAsJson));
|
||||||
});
|
});
|
@ -23,14 +23,16 @@ describe('Model', function() {
|
|||||||
|
|
||||||
beforeEach(Matchers.add);
|
beforeEach(Matchers.add);
|
||||||
|
|
||||||
|
|
||||||
describe('fromXML', function() {
|
describe('fromXML', function() {
|
||||||
|
|
||||||
it('should read documentation', function(done) {
|
it('should import documentation', function(done) {
|
||||||
// given
|
// given
|
||||||
|
|
||||||
// when
|
// when
|
||||||
readFile('documentation.bpmn', 'bpmn:Definitions', function(err, result) {
|
readFile('documentation.bpmn', 'bpmn:Definitions', function(err, result) {
|
||||||
|
|
||||||
|
// then
|
||||||
expect(result).toDeepEqual({
|
expect(result).toDeepEqual({
|
||||||
$type: 'bpmn:Definitions',
|
$type: 'bpmn:Definitions',
|
||||||
id: 'documentation',
|
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
|
// given
|
||||||
|
|
||||||
@ -74,7 +101,8 @@ describe('Model', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('import edge waypoints', function(done) {
|
|
||||||
|
it('should import edge waypoints', function(done) {
|
||||||
|
|
||||||
// given
|
// 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
|
// given
|
||||||
|
|
||||||
@ -108,6 +137,7 @@ describe('Model', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('should import references', function() {
|
describe('should import references', function() {
|
||||||
|
|
||||||
it('via attributes', function(done) {
|
it('via attributes', function(done) {
|
||||||
@ -135,6 +165,7 @@ describe('Model', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('via elements', function(done) {
|
it('via elements', function(done) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
@ -173,6 +204,7 @@ describe('Model', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('should import element', function() {
|
describe('should import element', function() {
|
||||||
|
|
||||||
it('empty Definitions', function(done) {
|
it('empty Definitions', function(done) {
|
||||||
@ -195,6 +227,7 @@ describe('Model', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('empty Definitions (default ns)', function(done) {
|
it('empty Definitions (default ns)', function(done) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
@ -215,6 +248,7 @@ describe('Model', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('SubProcess / flow nodes', function(done) {
|
it('SubProcess / flow nodes', function(done) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
@ -241,6 +275,7 @@ describe('Model', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('SubProcess / flow nodes / nested references', function(done) {
|
it('SubProcess / flow nodes / nested references', function(done) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
@ -267,6 +302,7 @@ describe('Model', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('SubProcess / incoming + flow nodes', function(done) {
|
it('SubProcess / incoming + flow nodes', function(done) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
@ -315,6 +351,7 @@ describe('Model', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('BPMNShape / nested bounds / non-ns-attributes', function(done) {
|
it('BPMNShape / nested bounds / non-ns-attributes', function(done) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
@ -337,6 +374,7 @@ describe('Model', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('BPMNEdge / nested waypoints / explicit xsi:type', function(done) {
|
it('BPMNEdge / nested waypoints / explicit xsi:type', function(done) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
@ -360,6 +398,7 @@ describe('Model', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('BPMNDiagram / nested elements', function(done) {
|
it('BPMNDiagram / nested elements', function(done) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
@ -402,6 +441,7 @@ describe('Model', function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('should handle errors', function() {
|
describe('should handle errors', function() {
|
||||||
|
|
||||||
|
|
||||||
@ -410,7 +450,7 @@ describe('Model', function() {
|
|||||||
// when
|
// when
|
||||||
readFile('error/no-xml.txt', 'bpmn:Definitions', function(err, result) {
|
readFile('error/no-xml.txt', 'bpmn:Definitions', function(err, result) {
|
||||||
|
|
||||||
expect(err).toBeDefined();
|
expect(err).not.toEqual(null);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -421,30 +461,19 @@ describe('Model', function() {
|
|||||||
// when
|
// when
|
||||||
readFile('error/binary.png', 'bpmn:Definitions', function(err, result) {
|
readFile('error/binary.png', 'bpmn:Definitions', function(err, result) {
|
||||||
|
|
||||||
expect(err).toBeDefined();
|
expect(err).not.toEqual(null);
|
||||||
|
|
||||||
done();
|
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) {
|
it('when importing invalid bpmn', function(done) {
|
||||||
|
|
||||||
// when
|
// when
|
||||||
readFile('error/invalid-child.bpmn', 'bpmn:Definitions', function(err, result) {
|
readFile('error/invalid-child.bpmn', 'bpmn:Definitions', function(err, result) {
|
||||||
|
|
||||||
expect(err).toBeDefined();
|
expect(err).not.toEqual(null);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -45,8 +45,10 @@ describe('Model - roundtrip', function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
beforeEach(Matchers.add);
|
beforeEach(Matchers.add);
|
||||||
|
|
||||||
|
|
||||||
describe('Roundtrip', function() {
|
describe('Roundtrip', function() {
|
||||||
|
|
||||||
it('should serialize home-made bpmn model', function(done) {
|
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) {
|
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) {
|
it('should write simple process', function(done) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
@ -122,5 +127,6 @@ describe('Model - roundtrip', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
@ -25,6 +25,7 @@ describe('Model', function() {
|
|||||||
|
|
||||||
beforeEach(Matchers.add);
|
beforeEach(Matchers.add);
|
||||||
|
|
||||||
|
|
||||||
describe('toXML', function() {
|
describe('toXML', function() {
|
||||||
|
|
||||||
it('export empty Definitions', function(done) {
|
it('export empty Definitions', function(done) {
|
||||||
@ -45,6 +46,7 @@ describe('Model', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('export BPMNShape', function(done) {
|
it('export BPMNShape', function(done) {
|
||||||
|
|
||||||
// given
|
// 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 =
|
||||||
|
'<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" ' +
|
||||||
|
'xmlns:vendor="http://vendor">' +
|
||||||
|
'<bpmn:extensionElements>' +
|
||||||
|
'<vendor:foo key="FOO" value="BAR" />' +
|
||||||
|
'</bpmn:extensionElements>' +
|
||||||
|
'</bpmn:definitions>';
|
||||||
|
|
||||||
|
|
||||||
|
// when
|
||||||
|
write(definitions, function(err, result) {
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(result).toEqual(expectedXML);
|
||||||
|
|
||||||
|
done(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user