diff options
Diffstat (limited to 'test/w3c/namespace/test207.scxml')
-rw-r--r-- | test/w3c/namespace/test207.scxml | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/w3c/namespace/test207.scxml b/test/w3c/namespace/test207.scxml new file mode 100644 index 0000000..510e201 --- /dev/null +++ b/test/w3c/namespace/test207.scxml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that that we can't cancel an event in another session. We invoke a child process. It notifies +us when it has generated a delayed event with sendid foo. We try to cancel foo. The child process sends us event + event success if the event is not cancelled, event fail otherwise. This doesn't test that there is absolutely no way to cancel an event +raised in another session, but the spec doesn't define any way to refer to an event in another process --> +<scxml:scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" xmlns:scxml="http://www.w3.org/2005/07/scxml" initial="s0" version="1.0" datamodel="ecmascript"> + <scxml:state id="s0" initial="s01"> + <scxml:onentry> + <scxml:send event="timeout" delayexpr="'2s'"/> + </scxml:onentry> + <scxml:invoke type="scxml"> + <scxml:content> + <!-- when invoked, we raise a delayed event1 with sendid 'foo' and notify our parent. Then we wait. + If event1 occurs, the parent hasn't succeeded in canceling it and we return pass. If event2 occurs + it means event1 was canceled (because event2 is delayed longer than event1) and we return 'fail'. --> + <scxml:scxml initial="sub0" version="1.0" datamodel="ecmascript"> + <scxml:state id="sub0"> + <scxml:onentry> + <scxml:send event="event1" id="foo" delayexpr="'1s'"/> + <scxml:send event="event2" delayexpr="'1.5s'"/> + <scxml:send target="#_parent" event="childToParent"/> + </scxml:onentry> + <scxml:transition event="event1" target="subFinal"> + <scxml:send target="#_parent" event="pass"/> + </scxml:transition> + <scxml:transition event="*" target="subFinal"> + <scxml:send target="#_parent" event="fail"/> + </scxml:transition> + </scxml:state> + <scxml:final id="subFinal"/> + </scxml:scxml> + </scxml:content> + </scxml:invoke> + <scxml:state id="s01"> + <scxml:transition event="childToParent" target="s02"> + <scxml:cancel sendid="foo"/> + </scxml:transition> + </scxml:state> + <scxml:state id="s02"> + <scxml:transition event="pass" target="pass"/> + <scxml:transition event="fail" target="fail"/> + <scxml:transition event="timeout" target="fail"/> + </scxml:state> + </scxml:state> + <scxml:final id="pass"> + <scxml:onentry> + <scxml:log label="Outcome" expr="'pass'"/> + </scxml:onentry> + </scxml:final> + <scxml:final id="fail"> + <scxml:onentry> + <scxml:log label="Outcome" expr="'fail'"/> + </scxml:onentry> + </scxml:final> +</scxml:scxml> |