summaryrefslogtreecommitdiffstats
path: root/test/samples/uscxml
diff options
context:
space:
mode:
Diffstat (limited to 'test/samples/uscxml')
-rw-r--r--test/samples/uscxml/test-custom-executable-content.scxml19
-rw-r--r--test/samples/uscxml/test-ecmascript.scxml8
-rw-r--r--test/samples/uscxml/test-http-servlet.scxml41
-rw-r--r--test/samples/uscxml/test-response-element.scxml14
4 files changed, 75 insertions, 7 deletions
diff --git a/test/samples/uscxml/test-custom-executable-content.scxml b/test/samples/uscxml/test-custom-executable-content.scxml
new file mode 100644
index 0000000..a40af93
--- /dev/null
+++ b/test/samples/uscxml/test-custom-executable-content.scxml
@@ -0,0 +1,19 @@
+<scxml datamodel="ecmascript">
+ <script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js" />
+ <state id="start">
+ <onentry>
+ <fetch
+ target="http://data.wien.gv.at/daten/wfs?service=WFS&amp;request=GetFeature&amp;version=1.1.0&amp;typeName=ogdwien:BAUMOGD&amp;srsName=EPSG:4326&amp;outputFormat=json&amp;maxfeatures=5"
+ callback="data.wien"
+ type="json" />
+ </onentry>
+ <state id="wait">
+ <transition event="data.wien" target="final">
+ <script>
+ dump(_event);
+ </script>
+ </transition>
+ </state>
+ </state>
+ <final id="final" />
+</scxml> \ No newline at end of file
diff --git a/test/samples/uscxml/test-ecmascript.scxml b/test/samples/uscxml/test-ecmascript.scxml
index aa88f17..7dfd94c 100644
--- a/test/samples/uscxml/test-ecmascript.scxml
+++ b/test/samples/uscxml/test-ecmascript.scxml
@@ -77,13 +77,7 @@
</foreach>
</foreach>
</onentry>
- <transition target="externalEvents" />
- </state>
- <state id="externalEvents">
- <onentry>
- <log expr="'-- External Events'" />
- </onentry>
- <transition target="datamodels" event="event1" cond="_event.name == 'event1'" />
+ <transition target="datamodels" />
</state>
<state id="datamodels">
<datamodel>
diff --git a/test/samples/uscxml/test-http-servlet.scxml b/test/samples/uscxml/test-http-servlet.scxml
new file mode 100644
index 0000000..8836b76
--- /dev/null
+++ b/test/samples/uscxml/test-http-servlet.scxml
@@ -0,0 +1,41 @@
+<scxml datamodel="ecmascript">
+ <script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js" />
+ <state id="start">
+ <!--
+ I went for explicit invokers instead of a response element in executable content
+ as it provides better control on the path where to serve data.
+ -->
+ <invoke type="httpserver" id="servlet.data">
+ <!-- server path where to listen -->
+ <param name="path" expr="'data'" />
+ <!-- the name of events originating from requests at this url -->
+ <param name="callback" expr="'http.data'" />
+ </invoke>
+ <invoke type="httpserver" id="servlet.exit">
+ <param name="path" expr="'exit'" />
+ <param name="callback" expr="'http.exit'" />
+ </invoke>
+ <state id="loop">
+ <transition event="http.data" target="loop">
+ <script>
+ dump(_event);
+ </script>
+ <!-- Sending a http reply is to send the invoker id a "reply.<requestId>" event -->
+ <send target="#_servlet.data" eventexpr="'reply.' + _event.data.reqId">
+ <!-- This will end up as a header field -->
+ <param name="Foo" expr="_ioprocessors" />
+ <!-- JSON string in the content -->
+ <content expr="_ioprocessors" />
+ </send>
+ </transition>
+ <transition event="http.exit" target="final">
+ <script>
+ dump(_event);
+ </script>
+ <!-- This will never get delivered as we terminate before -->
+ <send target="#_servlet.exit" eventexpr="'reply.' + _event.data.reqId" />
+ </transition>
+ </state>
+ </state>
+ <final id="final" />
+</scxml> \ No newline at end of file
diff --git a/test/samples/uscxml/test-response-element.scxml b/test/samples/uscxml/test-response-element.scxml
new file mode 100644
index 0000000..d3d3c53
--- /dev/null
+++ b/test/samples/uscxml/test-response-element.scxml
@@ -0,0 +1,14 @@
+<scxml datamodel="ecmascript" name="test">
+ <script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js" />
+ <state id="start">
+ <state id="loop">
+ <transition event="http" target="loop">
+ <!-- script>
+ dump(_event);
+ </script -->
+ <response status="200" requestexpr="_event.origin" />
+ </transition>
+ </state>
+ </state>
+ <final id="final" />
+</scxml> \ No newline at end of file