-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for UML ExecutionSpecifications #157
base: master
Are you sure you want to change the base?
Changes from all commits
832a3cd
51d1e12
8169191
85e9c6b
5772d40
a1127b8
9cb04c7
f7199d9
d64d749
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,13 @@ function assertEmptyDocument(d) { | |
equal(d.signals.length, 0, "Zero signals"); | ||
} | ||
|
||
function testExecutions(execution, affectedActorName, startSignal, endSignal, level) { | ||
equal(execution.actor.name, affectedActorName, "Correct actor"); | ||
equal(execution.startSignal, startSignal, "Start signal of Execution"); | ||
equal(execution.endSignal, endSignal, "End signal of Execution"); | ||
equal(execution.level, level, "Nesting level of Execution"); | ||
} | ||
|
||
|
||
var LINETYPE = Diagram.LINETYPE; | ||
var ARROWTYPE = Diagram.ARROWTYPE; | ||
|
@@ -185,6 +192,45 @@ test( "Quoted names", function() { | |
assertSingleArrow(Diagram.parse("\"->:\"->B: M"), ARROWTYPE.FILLED, LINETYPE.SOLID, "->:", "B", "M"); | ||
assertSingleArrow(Diagram.parse("A->\"->:\": M"), ARROWTYPE.FILLED, LINETYPE.SOLID, "A", "->:", "M"); | ||
assertSingleActor(Diagram.parse("Participant \"->:\""), "->:"); | ||
assertSingleArrow(Diagram.parse("A->\"+B\": M"), ARROWTYPE.FILLED, LINETYPE.SOLID, "A", "+B", "M"); | ||
assertSingleArrow(Diagram.parse("\"+A\"->B: M"), ARROWTYPE.FILLED, LINETYPE.SOLID, "+A", "B", "M"); | ||
assertSingleArrow(Diagram.parse("\"+A\"->\"+B\": M"), ARROWTYPE.FILLED, LINETYPE.SOLID, "+A", "+B", "M"); | ||
}); | ||
|
||
test( "Executions", function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll have to check what happens, I know -- will throw an error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I imagine ++ will throw an error too. I've only allowed single changes to the execution level. |
||
assertSingleArrow(Diagram.parse("A->+B: M"), ARROWTYPE.FILLED, LINETYPE.SOLID, "A", "B", "M"); | ||
assertSingleArrow(Diagram.parse("+A->B: M"), ARROWTYPE.FILLED, LINETYPE.SOLID, "A", "B", "M"); | ||
assertSingleArrow(Diagram.parse("+A-->+B: M"), ARROWTYPE.FILLED, LINETYPE.DOTTED, "A", "B", "M"); | ||
assertSingleArrow(Diagram.parse("+\"+A\"-->+B: M"), ARROWTYPE.FILLED, LINETYPE.DOTTED, "+A", "B", "M"); | ||
|
||
var d = Diagram.parse("A->+B: M1\n+B-->-B: M2\n-B-->>+A: M3"); | ||
equal(d.actors.length, 2, "Correct actors count"); | ||
|
||
var a = d.actors[0]; | ||
var b = d.actors[1]; | ||
equal(a.name, "A", "Actors A name"); | ||
equal(b.name, "B", "Actors B name"); | ||
var execsA = a.executions; | ||
var execsB = b.executions; | ||
|
||
equal(d.signals.length, 3, "Correct signals count"); | ||
equal(execsA.length, 1, "Correct actor A Execution count"); | ||
equal(execsB.length, 2, "Correct actor B Execution count"); | ||
|
||
// More or less normal Execution | ||
testExecutions(execsB[0], "B", d.signals[0], d.signals[2], 0); | ||
// Self-signalled Execution | ||
testExecutions(execsB[1], "B", d.signals[1], d.signals[1], 1); | ||
// Endless Execution | ||
testExecutions(execsA[0], "A", d.signals[2], null, 0); | ||
|
||
// Make sure we haven't broken the different arrow types. | ||
equal(d.signals[0].arrowtype, ARROWTYPE.FILLED, "Signal 1 Arrow Type"); | ||
equal(d.signals[0].linetype, LINETYPE.SOLID, "Signal 1 Line Type"); | ||
equal(d.signals[1].arrowtype, ARROWTYPE.FILLED, "Signal 2 Arrow Type"); | ||
equal(d.signals[1].linetype, LINETYPE.DOTTED, "Signal 2 Line Type"); | ||
equal(d.signals[2].arrowtype, ARROWTYPE.OPEN, "Signal 3 Arrow Type"); | ||
equal(d.signals[2].linetype, LINETYPE.DOTTED, "Signal 3 Line Type"); | ||
}); | ||
|
||
test( "API", function() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is level allowed to be <0? Should that be stopped elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A level < 0 indicates that there are no executions (just the actor/lifeline) It is impossible to go lower than -1, the parser will throw an error.