diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-18 20:47:56 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-18 20:47:56 (GMT) |
commit | a6fe85c2e883bda2be9951fa1252fd04706f7b6a (patch) | |
tree | a6d7fc7b5e6295055ece3531fdb7aa3db0dc0494 /test/samples/w3c/ecma | |
parent | 98bb92660e542dc1b76b2a4de098c14856637429 (diff) | |
download | uscxml-a6fe85c2e883bda2be9951fa1252fd04706f7b6a.zip uscxml-a6fe85c2e883bda2be9951fa1252fd04706f7b6a.tar.gz uscxml-a6fe85c2e883bda2be9951fa1252fd04706f7b6a.tar.bz2 |
New XPath datamodel tests
Diffstat (limited to 'test/samples/w3c/ecma')
-rw-r--r-- | test/samples/w3c/ecma/test193.scxml | 19 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test344.scxml | 5 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test488.scxml | 2 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test509.scxml | 17 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test510.scxml | 24 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test518.scxml | 20 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test519.scxml | 19 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test520.scxml | 19 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test522.scxml | 22 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test531.scxml | 20 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test532.scxml | 20 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test534.scxml | 18 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test543.scxml | 18 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test567.scxml | 30 | ||||
-rw-r--r-- | test/samples/w3c/ecma/test568.scxml | 2 |
15 files changed, 252 insertions, 3 deletions
diff --git a/test/samples/w3c/ecma/test193.scxml b/test/samples/w3c/ecma/test193.scxml new file mode 100644 index 0000000..441a658 --- /dev/null +++ b/test/samples/w3c/ecma/test193.scxml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- we test that omitting target and targetexpr of <send> when using the +basichttp event i/o processor puts error.communication on the internal queue. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + + +<state id="s0"> + <onentry> + <!-- this should put an error in the internal queue --> + <send event="event1" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + <send event="fail"/> + </onentry> + + <transition event="error.communication" target="pass"/> + <transition event="*" target="fail"/> + </state> + +<final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> +<final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test344.scxml b/test/samples/w3c/ecma/test344.scxml index cd1c8a2..068581d 100644 --- a/test/samples/w3c/ecma/test344.scxml +++ b/test/samples/w3c/ecma/test344.scxml @@ -1,4 +1,7 @@ -<?xml version="1.0" encoding="UTF-8"?><!-- test that a non-boolean cond expression evaluates to false and causes error.execution to be raised --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="ecmascript" initial="s0"> +<?xml version="1.0" encoding="UTF-8"?><!-- test that a cond expression that cannot be evaluated as a +boolean cond expression evaluates to false and causes error.execution to be raised. +In some languages, any valid expression/object can be converted to a boolean, so conf:nonBoolean will +have to be mapped onto something that produces a syntax error or something similarly invalid --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="ecmascript" initial="s0"> <state id="s0"> <transition cond="return" target="fail"/> diff --git a/test/samples/w3c/ecma/test488.scxml b/test/samples/w3c/ecma/test488.scxml index 45e775c..8e007e3 100644 --- a/test/samples/w3c/ecma/test488.scxml +++ b/test/samples/w3c/ecma/test488.scxml @@ -24,7 +24,7 @@ event has empty event.data --> <state id="s1"> - <transition event="done.state.s0" cond="_event.data === ''" target="pass"/> + <transition event="done.state.s0" cond="_event.data == null" target="pass"/> <transition event="*" target="fail"/> </state> diff --git a/test/samples/w3c/ecma/test509.scxml b/test/samples/w3c/ecma/test509.scxml new file mode 100644 index 0000000..de55b5d --- /dev/null +++ b/test/samples/w3c/ecma/test509.scxml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that Basic HTTP Event I/O processor uses POST method and that it can receive messages +at the accessURI --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> + +<state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + </onentry> + <!-- if the event was send by http and we get it, we succeed --> + <transition event="test" cond="_event.raw.search('POST') !== -1" target="pass"/> + <transition event="*" target="fail"/> + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test510.scxml b/test/samples/w3c/ecma/test510.scxml new file mode 100644 index 0000000..45d3057 --- /dev/null +++ b/test/samples/w3c/ecma/test510.scxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that Basic HTTP messages go into external queue. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> + +<state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + <!-- this creates an internal event --> + <raise event="internal"/> + + </onentry> + <!-- we should get 'internal' first, then 'test' --> + <transition event="internal" target="s1"/> + <transition event="*" target="fail"/> + </state> + + <state id="s1"> + <transition event="test" target="pass"/> + <transition event="*" target="fail"/> + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test518.scxml b/test/samples/w3c/ecma/test518.scxml new file mode 100644 index 0000000..69f171c --- /dev/null +++ b/test/samples/w3c/ecma/test518.scxml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that that namelist values get encoded as POST parameters. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> +<datamodel> + <data id="Var1" expr="2"/> + </datamodel> + +<state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors['basichttp']['location']" namelist="Var1" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + </onentry> + + <transition event="test" cond="_event.raw.search(/Var1=2/) !== -1" target="pass"/> + <transition event="*" target="fail"/> + + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test519.scxml b/test/samples/w3c/ecma/test519.scxml new file mode 100644 index 0000000..6f559da --- /dev/null +++ b/test/samples/w3c/ecma/test519.scxml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that that <param> values get encoded as POST parameters. . --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> + + +<state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <param name="param1" expr="1"/> + </send> + </onentry> + + <!-- if other end sends us back this event, we succeed --> + <transition event="test" cond="_event.raw.search(/Varparam1=1/) !== -1" target="pass"/> + <transition event="*" target="fail"/> + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test520.scxml b/test/samples/w3c/ecma/test520.scxml new file mode 100644 index 0000000..daaf3a8 --- /dev/null +++ b/test/samples/w3c/ecma/test520.scxml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that that <content> gets sent as the body of the message. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> + + +<state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <content>this is some content</content> + </send> + </onentry> + + <!-- if other end sends us back this event, we succeed --> + <transition event="HTTP.POST" cond="_event.raw.search(/this is some content/) !== -1" target="pass"/> + <transition event="*" target="fail"/> + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test522.scxml b/test/samples/w3c/ecma/test522.scxml new file mode 100644 index 0000000..3f16dac --- /dev/null +++ b/test/samples/w3c/ecma/test522.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that location field the entry for Basic HTTP Event I/O processor can be used +to send a message to the processor --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> + +<state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor" targetexpr="_ioprocessors['basichttp']['location']"/> + + </onentry> + <!-- the event we receive should be called 'test', but that's not actually + required for this test. Only that the send deliver some event to us. So if + we get something other than timeout or error, we call it success --> + <transition event="timeout" target="fail"/> + <transition event="error" target="fail"/> + <transition event="*" target="pass"/> + + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test531.scxml b/test/samples/w3c/ecma/test531.scxml new file mode 100644 index 0000000..9eaa3f3 --- /dev/null +++ b/test/samples/w3c/ecma/test531.scxml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that that the value of the <param> _scxmleventname gets used as the name +of the raised event. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> + + +<state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + <send targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <content>_scxmleventname=test</content> + </send> + </onentry> + + <!-- if we get an event named 'test' we succeed. Otherwise fail --> + <transition event="test" target="pass"/> + <transition event="*" target="fail"/> + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test532.scxml b/test/samples/w3c/ecma/test532.scxml new file mode 100644 index 0000000..412310c --- /dev/null +++ b/test/samples/w3c/ecma/test532.scxml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that that if _scxmleventname is not present, the name of the HTTP method is used +as the name of the resulting event. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> + + +<state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + <send targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <!-- this content will be ignored, but it's here to make sure we have a message body --> + <content>some content</content> + </send> + </onentry> + + <transition event="HTTP.POST" target="pass"/> + <transition event="*" target="fail"/> + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test534.scxml b/test/samples/w3c/ecma/test534.scxml new file mode 100644 index 0000000..9495d9e --- /dev/null +++ b/test/samples/w3c/ecma/test534.scxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that that <send> 'event' value gets sent as the param _scxmleventname . --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> + + +<state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + </send> + </onentry> + + <!-- if other end sends us back this event, we succeed --> + <transition event="test" cond="_event.raw.search(/Var_scxmleventname=test/) !== -1" target="pass"/> + <transition event="*" target="fail"/> + </state> + + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test543.scxml b/test/samples/w3c/ecma/test543.scxml new file mode 100644 index 0000000..2c5c6de --- /dev/null +++ b/test/samples/w3c/ecma/test543.scxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that event fields are present as children of _event --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" name="scxmltest" initial="s0" version="1.0" datamodel="xpath"> + + +<state id="s0"> + <onentry> + <!-- event isn't bound until an event is raised --> + <raise event="someevent"/> + </onentry> + <!-- origintype sendid, invokeid and data will not be bound in this event. name, type, and origin + are guaranteed to be there. --> + <transition event="*" cond="$_event/name and $_event/origin and $_event/type" target="pass"/> + <transition event="*" target="fail"/> + </state> + +<final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> +<final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> + +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test567.scxml b/test/samples/w3c/ecma/test567.scxml new file mode 100644 index 0000000..465105b --- /dev/null +++ b/test/samples/w3c/ecma/test567.scxml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- test that that any content in the message other than _scxmleventname is used to populate +_event.data. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> +<datamodel> + <data id="Var1" expr="2"/> + </datamodel> + +<state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + <!-- in this case, 'test' will be placed in _scxmleventname. The <param> should + be used to populate _event.data --> + <send event="test" targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <param name="param1" expr="2"/> + </send> + </onentry> + + <!-- if we get this event, we succeed --> + <transition event="test" target="s1"> + <assign location="Var1" expr="_event.data.param1"/> + </transition> + <transition event="*" target="fail"/> + </state> + + <state id="s1"> + <transition cond="Var1==2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"><onentry><log label="Outcome" expr="'pass'"/></onentry></final> + <final id="fail"><onentry><log label="Outcome" expr="'fail'"/></onentry></final> +</scxml>
\ No newline at end of file diff --git a/test/samples/w3c/ecma/test568.scxml b/test/samples/w3c/ecma/test568.scxml index 03d32dd..e8b888f 100644 --- a/test/samples/w3c/ecma/test568.scxml +++ b/test/samples/w3c/ecma/test568.scxml @@ -4,7 +4,7 @@ send events. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http: <state id="s0"> - <transition cond="$_ioprocessors/processor[@name='scxml']/location/text()" target="pass"/> + <transition cond="$_ioprocessors/[@name='http://www.w3.org/TR/scxml/#SCXMLEventProcessor']/location/text()" target="pass"/> <transition target="fail"/> </state> |