bpmn-moddle
Advanced tools
Comparing version 0.1.0 to 0.2.0
{ | ||
"name": "bpmn-moddle", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "A moddle wrapper for BPMN 2.0", | ||
@@ -47,5 +47,5 @@ "scripts": { | ||
"sax": "~0.6.0", | ||
"moddle": "~0.1.0", | ||
"moddle-xml": "~0.1.0" | ||
"moddle": "~0.2.0", | ||
"moddle-xml": "~0.2.0" | ||
} | ||
} |
@@ -6,2 +6,7 @@ 'use strict'; | ||
function makeStringRef(desc) { | ||
desc.type = 'String'; | ||
delete desc.isReference; | ||
} | ||
describe('moddle BPMN 2.0 json', function() { | ||
@@ -85,2 +90,27 @@ | ||
// make some references strings rather than references | ||
// (this way we are able to import it properly) | ||
builder.alter('Operation#implementationRef', function(desc) { | ||
desc.isAttr = true; | ||
makeStringRef(desc); | ||
}); | ||
builder.alter('Interface#implementationRef', function(desc) { | ||
desc.isAttr = true; | ||
makeStringRef(desc); | ||
}); | ||
builder.alter('ItemDefinition#structureRef', function(desc) { | ||
desc.isAttr = true; | ||
makeStringRef(desc); | ||
}); | ||
builder.alter('CallActivity#calledElementRef', function(desc) { | ||
desc.name = 'calledElement'; | ||
makeStringRef(desc); | ||
}); | ||
builder.alter('DataAssociation#targetRef', function(desc) { | ||
@@ -87,0 +117,0 @@ delete desc.isAttr; |
@@ -37,4 +37,2 @@ 'use strict'; | ||
console.log(xml); | ||
done(err); | ||
@@ -41,0 +39,0 @@ }); |
@@ -188,2 +188,70 @@ var os = require('os'); | ||
it('should import CallActivity#calledElement', function(done) { | ||
// when | ||
readFile('callActivity-calledElement.part.bpmn', 'bpmn:CallActivity', function(err, result) { | ||
// then | ||
expect(result).toDeepEqual({ | ||
$type: 'bpmn:CallActivity', | ||
id: 'CallActivity_1', | ||
calledElement: 'otherProcess' | ||
}); | ||
done(err); | ||
}); | ||
}); | ||
it('should import ItemDefinition#structureRef', function(done) { | ||
// when | ||
readFile('itemDefinition-structureRef.part.bpmn', 'bpmn:ItemDefinition', function(err, result) { | ||
// then | ||
expect(result).toDeepEqual({ | ||
$type: 'bpmn:ItemDefinition', | ||
id: 'itemDefinition', | ||
structureRef: 'foo:Service' | ||
}); | ||
done(err); | ||
}); | ||
}); | ||
it('should import Operation#implementationRef', function(done) { | ||
// when | ||
readFile('operation-implementationRef.part.bpmn', 'bpmn:Operation', function(err, result) { | ||
// then | ||
expect(result).toDeepEqual({ | ||
$type: 'bpmn:Operation', | ||
id: 'operation', | ||
implementationRef: 'foo:operation' | ||
}); | ||
done(err); | ||
}); | ||
}); | ||
it('should import Interface#implementationRef', function(done) { | ||
// when | ||
readFile('interface-implementationRef.part.bpmn', 'bpmn:Interface', function(err, result) { | ||
// then | ||
expect(result).toDeepEqual({ | ||
$type: 'bpmn:Interface', | ||
id: 'interface', | ||
implementationRef: 'foo:interface' | ||
}); | ||
done(err); | ||
}); | ||
}); | ||
describe('should import references', function() { | ||
@@ -495,3 +563,2 @@ | ||
it('when importing non-xml text', function(done) { | ||
@@ -508,2 +575,3 @@ | ||
it('when importing binary', function(done) { | ||
@@ -521,2 +589,3 @@ | ||
it('when importing invalid bpmn', function(done) { | ||
@@ -523,0 +592,0 @@ |
@@ -102,2 +102,99 @@ var _ = require('lodash'); | ||
it('should export CallActivity#calledElement', function(done) { | ||
// given | ||
var callActivity = bpmnModel.create('bpmn:CallActivity', { | ||
id: 'CallActivity_1', | ||
calledElement: 'otherProcess' | ||
}); | ||
var expectedXML = | ||
'<bpmn:callActivity ' + | ||
'xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" ' + | ||
'id="CallActivity_1" calledElement="otherProcess" />'; | ||
// when | ||
write(callActivity, function(err, result) { | ||
// then | ||
expect(result).toEqual(expectedXML); | ||
done(err); | ||
}); | ||
}); | ||
it('should export ItemDefinition#structureRef', function(done) { | ||
// given | ||
var itemDefinition = bpmnModel.create('bpmn:ItemDefinition', { | ||
id: 'serviceInput', | ||
structureRef: 'service:CelsiusToFahrenheitSoapIn' | ||
}); | ||
var expectedXML = | ||
'<bpmn:itemDefinition xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" ' + | ||
'id="serviceInput" ' + | ||
'structureRef="service:CelsiusToFahrenheitSoapIn" />'; | ||
// when | ||
write(itemDefinition, function(err, result) { | ||
// then | ||
expect(result).toEqual(expectedXML); | ||
done(err); | ||
}); | ||
}); | ||
it('should export Operation#implementationRef', function(done) { | ||
// given | ||
var operation = bpmnModel.create('bpmn:Operation', { | ||
id: 'operation', | ||
implementationRef: 'foo:operation' | ||
}); | ||
var expectedXML = | ||
'<bpmn:operation xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" ' + | ||
'id="operation" ' + | ||
'implementationRef="foo:operation" />'; | ||
// when | ||
write(operation, function(err, result) { | ||
// then | ||
expect(result).toEqual(expectedXML); | ||
done(err); | ||
}); | ||
}); | ||
it('should export Interface#implementationRef', function(done) { | ||
// given | ||
var iface = bpmnModel.create('bpmn:Interface', { | ||
id: 'interface', | ||
implementationRef: 'foo:interface' | ||
}); | ||
var expectedXML = | ||
'<bpmn:interface xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" ' + | ||
'id="interface" ' + | ||
'implementationRef="foo:interface" />'; | ||
// when | ||
write(iface, function(err, result) { | ||
// then | ||
expect(result).toEqual(expectedXML); | ||
done(err); | ||
}); | ||
}); | ||
it('export extensionElements', function(done) { | ||
@@ -104,0 +201,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
874550
59
4862
+ Addedmoddle@0.2.0(transitive)
+ Addedmoddle-xml@0.2.0(transitive)
- Removedmoddle@0.1.0(transitive)
- Removedmoddle-xml@0.1.0(transitive)
Updatedmoddle@~0.2.0
Updatedmoddle-xml@~0.2.0