diff options
Diffstat (limited to 'test/samples/uscxml/test-expect.scxml')
-rw-r--r-- | test/samples/uscxml/test-expect.scxml | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/test/samples/uscxml/test-expect.scxml b/test/samples/uscxml/test-expect.scxml new file mode 100644 index 0000000..abd2a58 --- /dev/null +++ b/test/samples/uscxml/test-expect.scxml @@ -0,0 +1,64 @@ +<scxml datamodel="ecmascript"> + <script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js" /> + <state id="start"> + <state id="spawn"> + <invoke type="expect" id="telnet"> + <param name="debug" expr="false" /> + <param name="timeout" expr="3" /> + <param name="loguser" expr="false" /> + <param name="spawn" expr="'/usr/bin/telnet'" /> + <param name="argument" expr="_ioprocessors.basichttp.host" /> + <param name="argument" expr="_ioprocessors.basichttp.port" /> + <!-- <param name="argument" expr="80" /> --> + <finalize><script>//print('------------'); dump(_event);</script></finalize> + </invoke> + + <state id="idle"> + <onentry><log expr="'Waiting'"/></onentry> + <transition event="spawn.success" target="spawned" /> + <transition event="spawn.failed" target="exit"> + <script>print('FAIL: '); dump(_event);</script> + </transition> + </state> + + <state id="spawned"> + <onentry> + <log expr="'Spawned'"/> + <send target="#_telnet" event="expect.match"> + <param name="exact:refused" expr="'Connection refused'" /> + <!-- last line of a telnet connect --> + <param name="exact:connected" expr="'Escape character is \'^]\'.'" /> + </send> + </onentry> + <transition event="expect.match.connected" target="established" /> + </state> + + <state id="established"> + <onentry> + <log expr="'Established'"/> + <send target="#_telnet" event="expect.send"> + <content>GET /${_name} HTTP/1.1\n\n</content> + </send> + <send target="#_telnet" event="expect.match"> + <param name="exact:answered" expr="'Some arbitrary content'" /> + </send> + </onentry> + + <!-- Answer the telnet request --> + <transition event="http.get" type="internal"> + <respond to="_event.origin"> + <header name="Content-Type" value="text/plain" /> + <content>Some arbitrary content</content> + </respond> + </transition> + + <transition event="expect.match.answered" target="start" type="external" /> + + </state> + + </state> + </state> + + + <final id="exit" /> +</scxml>
\ No newline at end of file |