summaryrefslogtreecommitdiffstats
path: root/test/uscxml/test-communication.scxml
diff options
context:
space:
mode:
Diffstat (limited to 'test/uscxml/test-communication.scxml')
-rw-r--r--test/uscxml/test-communication.scxml65
1 files changed, 65 insertions, 0 deletions
diff --git a/test/uscxml/test-communication.scxml b/test/uscxml/test-communication.scxml
new file mode 100644
index 0000000..2cba08e
--- /dev/null
+++ b/test/uscxml/test-communication.scxml
@@ -0,0 +1,65 @@
+<scxml datamodel="ecmascript" initial="start" binding="late" name="foo">
+ <script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js" />
+
+ <state id="start">
+ <!-- Setup datamodel, print environment and send ourself an event to transition to next state -->
+
+ <datamodel>
+ <!--data id="invokeconfig">
+ <invoker id="scxml" name="http://www.w3.org/TR/scxml/" location="_runtime" />
+ </data -->
+ <data id="foo" expr="'this is the foo data'" />
+ <data id="bar" expr="'this is the bar data'" />
+ </datamodel>
+ <onentry>
+ <log expr="'basichttp listening as ' + _ioprocessors['basichttp'].location" />
+ <log expr="'Entered step1'" />
+ <log expr="'Sending ourself an event with data via basichttp'" />
+ <send targetexpr="_ioprocessors['basichttp'].location" namelist="foo" type="basichttp" event="transitionToNext">
+ <param name="bar" expr="bar" />
+ <content>
+<![CDATA[
+This is some content you got there dude!
+]]>
+ </content>
+ </send>
+ </onentry>
+ <transition event="transitionToNext" target="step1" cond="_event.data.bar == 'this is the bar data'" />
+ <transition event="*" target="final">
+ <log label="FAIL!" expr="dump(_event)" />
+ </transition>
+ </state>
+ <state id="step1">
+ <onentry>
+ <log expr="'Entered step1'" />
+ <log expr="'Sending ourself a 2s delayed event'" />
+ <send delay="2s" targetexpr="_ioprocessors['basichttp'].location" type="basichttp" event="transitionToNext" />
+ </onentry>
+ <transition event="transitionToNext" target="step2" />
+ </state>
+ <state id="step2">
+ <onentry>
+ <log expr="'Entered step2'" />
+ <log expr="'Invoking scxml interpreter'" />
+ </onentry>
+ <invoke type="http://www.w3.org/TR/scxml/" src="test-invoked.scxml">
+ <finalize>
+ <log expr="'Calling finalize on returned event'" />
+ </finalize>
+ </invoke>
+ <transition event="transitionToNext" target="step3" />
+ </state>
+ <state id="step3">
+ <onentry>
+ <log expr="'Entered step3'" />
+ <log expr="'Sending an invalid request'" />
+ <send target="http://www.sgsdfgsdfgasdf.com" type="basichttp" event="transitionToNext" />
+ </onentry>
+ <transition event="error.communication" target="final" />
+ </state>
+ <final id="final">
+ <onentry>
+ <log expr="'Finished!'" />
+ </onentry>
+ </final>
+</scxml> \ No newline at end of file