diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2012-11-07 22:20:09 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2012-11-07 22:20:09 (GMT) |
commit | da08a1d3c3bca8070c9b029cfc1f8faf9e34dd25 (patch) | |
tree | b285148ab6ca415814d9370148f91736f83c852c /test/samples/uscxml | |
parent | 0ae6c27d9322208053033d9b19c0ffffed3d99eb (diff) | |
download | uscxml-da08a1d3c3bca8070c9b029cfc1f8faf9e34dd25.zip uscxml-da08a1d3c3bca8070c9b029cfc1f8faf9e34dd25.tar.gz uscxml-da08a1d3c3bca8070c9b029cfc1f8faf9e34dd25.tar.bz2 |
Committing local version again
Diffstat (limited to 'test/samples/uscxml')
-rw-r--r-- | test/samples/uscxml/audio/click.wav | bin | 0 -> 5058 bytes | |||
-rw-r--r-- | test/samples/uscxml/proto/Dependee.proto | 3 | ||||
-rw-r--r-- | test/samples/uscxml/proto/Depender.proto | 5 | ||||
-rw-r--r-- | test/samples/uscxml/proto/Test.proto | 37 | ||||
-rw-r--r-- | test/samples/uscxml/proto/TestServices.proto | 23 | ||||
-rw-r--r-- | test/samples/uscxml/scripts/GreatCircle.js | 46 | ||||
-rw-r--r-- | test/samples/uscxml/scxml-gui-test.scxml | 13 | ||||
-rw-r--r-- | test/samples/uscxml/test-communication.scxml | 53 | ||||
-rw-r--r-- | test/samples/uscxml/test-dom.scxml | 19 | ||||
-rw-r--r-- | test/samples/uscxml/test-donedata.scxml | 37 | ||||
-rw-r--r-- | test/samples/uscxml/test-ecmascript.scxml | 112 | ||||
-rw-r--r-- | test/samples/uscxml/test-execution.scxml | 56 | ||||
-rw-r--r-- | test/samples/uscxml/test-invoked.scxml | 8 | ||||
-rw-r--r-- | test/samples/uscxml/test-predicates.scxml | 9 | ||||
-rw-r--r-- | test/samples/uscxml/test-spatial-audio.scxml | 70 | ||||
-rw-r--r-- | test/samples/uscxml/test-umundo-map-demo.scxml | 71 | ||||
-rw-r--r-- | test/samples/uscxml/test-umundo-rpc.scxml | 60 | ||||
-rw-r--r-- | test/samples/uscxml/test-umundo-s11n.scxml | 115 |
18 files changed, 737 insertions, 0 deletions
diff --git a/test/samples/uscxml/audio/click.wav b/test/samples/uscxml/audio/click.wav Binary files differnew file mode 100644 index 0000000..e11b0b7 --- /dev/null +++ b/test/samples/uscxml/audio/click.wav diff --git a/test/samples/uscxml/proto/Dependee.proto b/test/samples/uscxml/proto/Dependee.proto new file mode 100644 index 0000000..bbd19fd --- /dev/null +++ b/test/samples/uscxml/proto/Dependee.proto @@ -0,0 +1,3 @@ +message DependeeMsg { + required string stringType = 1; +}
\ No newline at end of file diff --git a/test/samples/uscxml/proto/Depender.proto b/test/samples/uscxml/proto/Depender.proto new file mode 100644 index 0000000..5fa9952 --- /dev/null +++ b/test/samples/uscxml/proto/Depender.proto @@ -0,0 +1,5 @@ +import "Dependee.proto"; + +message DependerMsg { + required DependeeMsg dependeeType = 1; +}
\ No newline at end of file diff --git a/test/samples/uscxml/proto/Test.proto b/test/samples/uscxml/proto/Test.proto new file mode 100644 index 0000000..4e7ab6a --- /dev/null +++ b/test/samples/uscxml/proto/Test.proto @@ -0,0 +1,37 @@ +message AllTypes { + required double doubleType = 1; + required float floatType = 2; + required int32 int32Type = 3; + required int64 int64Type = 4; + required uint32 uint32Type = 5; + required uint64 uint64Type = 6; + required sint32 sint32Type = 7; + required sint64 sint64Type = 8; + required fixed32 fixed32Type = 9; + required fixed64 fixed64Type = 10; + required sfixed32 sfixed32Type = 11; + required sfixed64 sfixed64Type = 12; + required bool boolType = 13; + required string stringType = 14; + required bytes bytesType = 15; + optional AllTypes allTypes = 16; +} + +message RepeatedTypes { + repeated double doubleType = 1; + repeated float floatType = 2; + repeated int32 int32Type = 3; + repeated int64 int64Type = 4; + repeated uint32 uint32Type = 5; + repeated uint64 uint64Type = 6; + repeated sint32 sint32Type = 7; + repeated sint64 sint64Type = 8; + repeated fixed32 fixed32Type = 9; + repeated fixed64 fixed64Type = 10; + repeated sfixed32 sfixed32Type = 11; + repeated sfixed64 sfixed64Type = 12; + repeated bool boolType = 13; + repeated string stringType = 14; + repeated bytes bytesType = 15; + repeated RepeatedTypes repeatedMessage = 16; +} diff --git a/test/samples/uscxml/proto/TestServices.proto b/test/samples/uscxml/proto/TestServices.proto new file mode 100644 index 0000000..c96c34f --- /dev/null +++ b/test/samples/uscxml/proto/TestServices.proto @@ -0,0 +1,23 @@ +option java_package = "org.umundo.protobuf.tests"; + +message EchoRequest { + required string name = 1; + optional bytes buffer = 2; +} +message EchoReply { + required string name = 1; + optional bytes buffer = 2; +} +service EchoService { + rpc echo (EchoRequest) returns (EchoReply); +} + +message PingRequest { + required string name = 1; +} +message PingReply { + required string name = 1; +} +service PingService { + rpc ping (PingRequest) returns (PingReply); +} diff --git a/test/samples/uscxml/scripts/GreatCircle.js b/test/samples/uscxml/scripts/GreatCircle.js new file mode 100644 index 0000000..7a866d9 --- /dev/null +++ b/test/samples/uscxml/scripts/GreatCircle.js @@ -0,0 +1,46 @@ +// taken from http://trac.osgeo.org/openlayers/wiki/GreatCircleAlgorithms +var EARTH_RADIUS = 3958.75; +var PI = 3.1415926535897932384626433832795; +var DEG2RAD = 0.01745329252; +var RAD2DEG = 57.29577951308; + +function WGS84Distance(x1, y1, x2, y2) { + x1 = x1 * DEG2RAD; + y1 = y1 * DEG2RAD; + x2 = x2 * DEG2RAD; + y2 = y2 * DEG2RAD; + + var a = sin(( y2-y1 ) / 2.0 )^2; + var b = sin(( x2-x1 ) / 2.0 )^2; + var c = sqrt( a + cos( y2 ) * cos( y1 ) * b ); + + return 2 * asin( c ) * EARTH_RADIUS; +} + +function WGS84Bearing(x1, y1, x2, y2) { + x1 = x1 * DEG2RAD; + y1 = y1 * DEG2RAD; + x2 = x2 * DEG2RAD; + y2 = y2 * DEG2RAD; + + var a = cos(y2) * sin(x2 - x1); + var b = cos(y1) * sin(y2) - sin(y1) * cos(y2) * cos(x2 - x1); + var adjust = 0; + + if((a == 0) && (b == 0)) { + bearing = 0; + } else if( b == 0) { + if( a < 0) + bearing = 3 * PI / 2; + else + bearing = PI / 2; + } else if( b < 0) + adjust = PI; + else { + if( a < 0) + adjust = 2 * PI; + else + adjust = 0; + } + return (atan(a/b) + adjust) * RAD2DEG; +} diff --git a/test/samples/uscxml/scxml-gui-test.scxml b/test/samples/uscxml/scxml-gui-test.scxml new file mode 100644 index 0000000..adf93b8 --- /dev/null +++ b/test/samples/uscxml/scxml-gui-test.scxml @@ -0,0 +1,13 @@ +<scxml initial="start" version="0.9" xmlns="http://www.w3.org/2005/07/scxml"><!-- node-size-and-position x=0.0 y=0.0 w=280.0 h=320.0 --> + <state id="start"><!-- node-size-and-position x=30.000000000000004 y=30.000000000000004 w=80.0 h=70.0 --> + <onentry> + <log expr="Starting"></log> + </onentry> + <transition target="final"></transition> + </state> + <final id="final"><!-- node-size-and-position x=160.0 y=30.000000000000004 w=100.0 h=100.0 --> + <onentry> + <log expr="final entered"></log> + </onentry> + </final> +</scxml>
\ No newline at end of file diff --git a/test/samples/uscxml/test-communication.scxml b/test/samples/uscxml/test-communication.scxml new file mode 100644 index 0000000..610f8cc --- /dev/null +++ b/test/samples/uscxml/test-communication.scxml @@ -0,0 +1,53 @@ +<scxml datamodel="ecmascript" initial="start" binding="late" name="foo"> + <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="'b' + 'ar'" /> + <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'" /> + </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="final" /> + </state> + <final id="final"> + <onentry> + <log expr="'Finished!'" /> + </onentry> + </final> +</scxml>
\ No newline at end of file diff --git a/test/samples/uscxml/test-dom.scxml b/test/samples/uscxml/test-dom.scxml new file mode 100644 index 0000000..73b449c --- /dev/null +++ b/test/samples/uscxml/test-dom.scxml @@ -0,0 +1,19 @@ +<scxml datamodel="ecmascript"> + <state id="start"> + <onentry> + <script> + var transition = document.createElement("transition"); + transition.setAttribute("target", "final"); + transition.setAttribute("event", "quit"); + var nodeSet = document.evaluate("//state[@id='start']").asNodeSet(); + nodeSet[0].appendChild(transition); + </script> + <raise event="quit" /> + </onentry> + </state> + <final id="final"> + <onentry> + <log expr="'Quitting!'" /> + </onentry> + </final> +</scxml>
\ No newline at end of file diff --git a/test/samples/uscxml/test-donedata.scxml b/test/samples/uscxml/test-donedata.scxml new file mode 100644 index 0000000..c48b6de --- /dev/null +++ b/test/samples/uscxml/test-donedata.scxml @@ -0,0 +1,37 @@ +<scxml datamodel="ecmascript" initial="start" binding="late" name="test-donedata"> + <parallel id="start"> + <onentry> + <raise event="e1" /> + <raise event="e2" /> + <raise event="e4" /> + <raise event="e1" /> + </onentry> + <transition event="done.state.start" target="final"/> + + <state id="S1" initial="S11"> + <state id="S11"> + <transition event="e4" target="S12"/> + </state> + <state id="S12"> + <transition event="e1" target="S1Final"/> + </state> + <final id="S1Final"/> + </state> + + <state id="S2" initial="S21"> + <state id="S21"> + <transition event="e1" target="S22"/> + </state> + <state id="S22"> + <transition event="e2" target="S2Final" /> + </state> + <final id="S2Final"/> + </state> + </parallel> + + <state id="final" final="true"> + <onentry> + <log expr="'Finished!'"/> + </onentry> + </state> +</scxml>
\ No newline at end of file diff --git a/test/samples/uscxml/test-ecmascript.scxml b/test/samples/uscxml/test-ecmascript.scxml new file mode 100644 index 0000000..aa88f17 --- /dev/null +++ b/test/samples/uscxml/test-ecmascript.scxml @@ -0,0 +1,112 @@ +<scxml datamodel="ecmascript" initial="comparison" binding="late"> + <datamodel> + <data id="year" expr="2008" /> + <data id="CEO" expr="'Mr Big'" /> + <data id="profitable" /> + <data id="json"> + { + "id": 1, + "name": "Foo", + "price": 123, + "tags": [ "Bar", "Eek" ], + "stock": { + "warehouse": 300, + "retail": 20, + } + } + </data> + </datamodel> + <script> + var x = 4; + var a = ["a", "b", "c"]; + var b = [10,20,30]; + </script> + <script> + var y; + if (x > 10) { + y = 'true'; + } else { + y = 'false'; + } + </script> + <state id="comparison"> + <onentry> + <log expr="'-- Testing comparisons'" /> + <log expr="'x is ' + x + ', y is ' + y" /> + </onentry> + <transition cond="x >= 2" target="builtin"> + <log expr="'x is greater or equal to 2'" /> + </transition> + <transition cond="x < 2" target="builtin"> + <log expr="'x is smaller than 2'" /> + </transition> + </state> + <state id="builtin"> + <onentry> + <log expr="'-- Testing built ins'" /> + <if cond="In('builtin')"> + <log expr="'We are in state builtin'" /> + <else> + <log expr="'We are not in state builtin'" /> + </else> + </if> + </onentry> + <transition target="conditionals" /> + </state> + <state id="conditionals"> + <onentry> + <log expr="'-- Testing conditionals'" /> + <if cond="y == true"> + <log expr="'x is great and y is'" /> + <elseif cond="x > 3"> + <log expr="'x is somewhat great and y is not'" /> + </elseif> + <else> + <log expr="'x is great and y is not'" /> + </else> + </if> + </onentry> + <transition target="foreach" /> + </state> + <state id="foreach"> + <onentry> + <log expr="'-- Testing loops'" /> + <foreach array="a" item="itemA" index="indexA"> + <foreach array="b" item="itemB" index="indexB"> + <log expr="indexA + '.' + indexB + ' = ' + itemA + '.' + itemB" /> + </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'" /> + </state> + <state id="datamodels"> + <datamodel> + <data id="bar" expr="'yeah, bar!'"/> + </datamodel> + <onentry> + <log expr="'-- DataModels'" /> + <log expr="'year = ' + year" /> + <log expr="'bar = ' + bar" /> + <log expr="'json.stock.warehouse = ' + json.stock.warehouse" /> + </onentry> + <transition target="syntaxerror" /> + </state> + <state id="syntaxerror"> + <onentry> + <log expr="'-- Syntax Error'" /> + <log expr="year = ' + year" /> + </onentry> + <transition event="error.execution" target="final" /> + </state> + <final id="final"> + <onentry> + <log expr="'Finished!'" /> + </onentry> + </final> +</scxml>
\ No newline at end of file diff --git a/test/samples/uscxml/test-execution.scxml b/test/samples/uscxml/test-execution.scxml new file mode 100644 index 0000000..ada1a17 --- /dev/null +++ b/test/samples/uscxml/test-execution.scxml @@ -0,0 +1,56 @@ +<scxml initial="step2"> + <state id="start"> + <onentry> + <log expr="'Entered State: start'" /> + </onentry> + <transition target="step1"> + <log expr="'Transition start -> step1'" /> + </transition> + <onexit> + <log expr="'Exited State: start'" /> + </onexit> + </state> + <state id="step1"> + <onentry> + <log expr="'Entered State: step1'" /> + </onentry> + <transition target="step2"> + <log expr="'Transition step1 -> step2'" /> + </transition> + <onexit> + <log expr="'Exited State: step1'" /> + </onexit> + </state> + <parallel id="step2"> + <state id="parallel1"> + <onentry> + <log expr="'Entered State: parallel1'" /> + </onentry> + <transition target="step3"> + <log expr="'Transition parallel1 -> step3'" /> + </transition> + <onexit> + <log expr="'Exited State: parallel1'" /> + </onexit> + </state> + <state id="parallel2"> + <onentry> + <log expr="'Entered State: parallel2'" /> + </onentry> + <transition target="step3"> + <log expr="'Transition parallel2 -> step3'" /> + </transition> + <onexit> + <log expr="'Exited State: parallel2'" /> + </onexit> + </state> + </parallel> + <final id="step3"> + <onentry> + <log expr="'Entered Final State: step3'" /> + </onentry> + <onexit> + <log expr="'Exited Final State: step3'" /> + </onexit> + </final> +</scxml>
\ No newline at end of file diff --git a/test/samples/uscxml/test-invoked.scxml b/test/samples/uscxml/test-invoked.scxml new file mode 100644 index 0000000..7cd0d72 --- /dev/null +++ b/test/samples/uscxml/test-invoked.scxml @@ -0,0 +1,8 @@ +<scxml datamodel="ecmascript"> + <state id="start"> + <onentry> + <log expr="'Message from the invoked scxml interpreter'" /> + <send target="_parent" event="transitionToNext" /> + </onentry> + </state> +</scxml>
\ No newline at end of file diff --git a/test/samples/uscxml/test-predicates.scxml b/test/samples/uscxml/test-predicates.scxml new file mode 100644 index 0000000..98848a2 --- /dev/null +++ b/test/samples/uscxml/test-predicates.scxml @@ -0,0 +1,9 @@ +<scxml> + <state id="atomic" /> + <state id="compound"> + <state id="compundChild1" /> + <state id="compundChild2" /> + </state> + <parallel id="parallel"> + </parallel> +</scxml>
\ No newline at end of file diff --git a/test/samples/uscxml/test-spatial-audio.scxml b/test/samples/uscxml/test-spatial-audio.scxml new file mode 100644 index 0000000..d960533 --- /dev/null +++ b/test/samples/uscxml/test-spatial-audio.scxml @@ -0,0 +1,70 @@ +<scxml datamodel="ecmascript" name="spatial.audio.test"> + <datamodel> + <!-- Alternative to the JSON notation + <data id="spatialAudio" expr="{}" /> + <data id="spatialAudio.id2" expr="{}" /> + <data id="spatialAudio.id2.degree" expr="90" /> + --> + <data id="spatialAudio"> + { + 'id2': { + 'degree': 90 + } + } + </data> + </datamodel> + <state id="click.continuously"> + <initial> + <transition target="ready" /> + </initial> + <invoke type="http://www.smartvortex.eu/mmi/spatial-audio/" src="audio/click.wav" id="spatial-audio.id1"> + <!-- + Explicitly set the start position of an audio source. + Keep in mind that the coordinate system is the same as in OpenGL: + y + | + |___x + / + z + --> + <param name="x" expr="-1.0" /> <!-- leftmost --> + <param name="y" expr="0" /> + <param name="z" expr="0" /> + </invoke> + <invoke type="http://www.smartvortex.eu/mmi/spatial-audio/" src="audio/click.wav" id="spatial-audio.id2"> + <!-- + Set position on a circle. + Unit for circle is "deg" in clockwise order with 0 being directly in front, + or "rad" in counter-clockwise with zero being the rightmost position. + "right", "height" and "front" are aliases for x, y and z respectively. + --> + <param name="circle" expr="spatialAudio.id2.degree + 'deg'" /> <!-- rightmost --> + <param name="height" expr="0.0" /> + </invoke> + <state id="ready"> + <onentry> + <!-- trigger transition in 1 second --> + <send event="spatial-audio.play" delay="1s" /> + <log expr="'Ready'" /> + </onentry> + <transition target="click" event="spatial-audio.play" /> + <transition target="final" event="quit" /> + </state> + <state id="click"> + <onentry> + <send target="#_spatial-audio.id1" event="play" delay="0ms" /> + <!-- + move position of audio 2 in a circle + --> + <send target="#_spatial-audio.id2" event="play" delay="200ms"> + <param name="circle" expr="spatialAudio.id2.degree + 'deg'" /> + </send> + <log expr="'Clicking'" /> + <script>spatialAudio.id2.degree += 10;</script> + </onentry> + <transition target="ready" /> + </state> + </state> + + <final id="final" /> +</scxml>
\ No newline at end of file diff --git a/test/samples/uscxml/test-umundo-map-demo.scxml b/test/samples/uscxml/test-umundo-map-demo.scxml new file mode 100644 index 0000000..8ee91f1 --- /dev/null +++ b/test/samples/uscxml/test-umundo-map-demo.scxml @@ -0,0 +1,71 @@ +<scxml datamodel="ecmascript"> + <script src="scripts/GreatCircle.js" /> + <data id="audioSources"> + { + } + </data> + <script> + function dump(thingy) { + if (typeof(thingy) == 'object') { + for (var key in thingy) { + print(key + ": ") + dump(thingy[key]); + } + } else { + print(thingy + "\n"); + } + }; + var listener = { x: 0, y: 0, z: 0 }; + </script> + <state id="start"> + <!-- start listening for drag events on umundo map channel --> + <invoke type="umundo" id="map.drag"> + <param name="channel" expr="'map/center'" /> + <!-- update position of listener for every audio source when map was dragged --> + <finalize> + <send event="move.listener" target="#_audioSources.id1"> + <param name="x" expr="_event.data.lon" /> + <param name="y" expr="40 - (_event.data.zoom * 2)" /> + <param name="z" expr="_event.data.lat" /> + </send> + </finalize> + </invoke> + + <!-- start two spatial audio invokers --> + <invoke type="spatial-audio" src="audio/click.wav" id="audioSources.id1"> + <param name="x" expr="18.08" /> + <param name="y" expr="0" /> + <param name="z" expr="59.32" /> + </invoke> + + <invoke type="umundo" id="map.fault"> + <param name="channel" expr="'map/tick'" /> + <finalize> + <send target="#_audioSources.id1" event="play"> + <param name="x" expr="_event.data.lon" /> + <param name="y" expr="0" /> + <param name="z" expr="_event.data.lat" /> + </send> + </finalize> + </invoke> + + <!-- this is the state where we wait for events --> + <state id="idle"> + <!-- onentry> + <log expr="'== Idleing ====='" /> + </onentry --> + <transition target="dump" event="*" /> + </state> + + <state id="dump"> + <!-- onentry> + <log expr="'== Dumping Event ====='" /> + <script> + dump(_event); + </script> + </onentry --> + <transition target="idle" /> + </state> + + </state> +</scxml>
\ No newline at end of file diff --git a/test/samples/uscxml/test-umundo-rpc.scxml b/test/samples/uscxml/test-umundo-rpc.scxml new file mode 100644 index 0000000..f6e0f70 --- /dev/null +++ b/test/samples/uscxml/test-umundo-rpc.scxml @@ -0,0 +1,60 @@ +<?xml version="1.0"?> +<scxml datamodel="ecmascript"> + <script> + function dump(thingy) { + if (typeof(thingy) == 'object') { + for (var key in thingy) { + print(key + ": ") + dump(thingy[key]); + } + } else { + print(thingy + "\n"); + } + }; + </script> + <state id="start"> + <!-- Invoke umundo with a service query --> + <invoke type="umundo" id="umundo.eventSvc"> + <param name="types" expr="'proto'"/> + <param name="service" expr="'EchoService'"/> + <finalize> + <log expr="'Calling finalize on returned event'"/> + </finalize> + </invoke> + <state id="idle"> + <transition target="service.added" event="umundo.eventSvc.added"/> + <transition target="service.removed" event="umundo.eventSvc.removed"/> + <transition target="service.reply" event="umundo.eventSvc.reply.echo"/> + </state> + <state id="service.reply"> + <onentry> + <log expr="'RPC Reply:'"/> + <script>dump(_event);</script> + </onentry> + <transition target="idle"/> + </state> + + <state id="service.added"> + <onentry> + <log expr="'Log Service found:'"/> + <script>dump(_event);</script> + <send target="#_umundo.eventSvc" event="echo"> + <param name="type" expr="'EchoRequest'"/> + <content> + ({ + "name": "This is foo!" + }) + </content> + </send> + </onentry> + <transition target="idle"/> + </state> + <state id="service.removed"> + <onentry> + <log expr="'Log Service lost:'"/> + <script>dump(_event);</script> + </onentry> + <transition target="idle"/> + </state> + </state> +</scxml> diff --git a/test/samples/uscxml/test-umundo-s11n.scxml b/test/samples/uscxml/test-umundo-s11n.scxml new file mode 100644 index 0000000..001d72e --- /dev/null +++ b/test/samples/uscxml/test-umundo-s11n.scxml @@ -0,0 +1,115 @@ +<scxml datamodel="ecmascript"> + <script> + <![CDATA[ + function dump(arr,level) { + if(!level) level = 0; + + var level_padding = ""; + for(var j=0;j < level+1;j++) level_padding += " "; + + if(typeof(arr) == 'object') { + for(var item in arr) { + var value = arr[item]; + + if(typeof(value) == 'object') { + print(level_padding + "'" + item + "' ...\n"); + print(dump(value,level+1)); + } else { + print(level_padding + "'" + item + "' => \"" + value + "\"\n"); + } + } + } else { + print("===> "+arr+" <===("+typeof(arr)+")"); + } + } + ]]> + </script> + <state id="start"> + <invoke type="umundo" id="scxml.umundo"> + <param name="types" expr="'proto/Test.proto'" /> + <param name="channel" expr="'types'" /> + <finalize> + <script> + dump(_event); + </script> + <send target="#_scxml.umundo" delay="0s" event="dump.event"> + <param name="type" expr="_event.data.type" /> + <content>_event.data</content> + </send> + </finalize> + </invoke> + <onentry-off> + <!-- The round brackets are needed to evaluate the JSON object as an expression! --> + <send target="#_scxml.umundo" delay="3s" event="dump.event"> + <param name="type" expr="'AllTypes'" /> + <content> + ({ + "doubleType": 1.0, + "floatType": 2.0, + "int32Type": -3, + "int64Type": -4, + "uint32Type": 5, + "uint64Type": 6, + "sint32Type": -7, + "sint64Type": -8, + "fixed32Type": 9, + "fixed64Type": 10, + "sfixed32Type": -11, + "sfixed64Type": -12, + "boolType": false, + "stringType": 'string', + "bytesType": 'bytes', + }) + </content> + </send> + <send target="#_scxml.umundo" delay="3s" event="dump.event"> + <param name="type" expr="'RepeatedTypes'" /> + <content> + ({ + "doubleType": [ 1.0, 2.0 ], + "floatType": [ 2.0, 3.0 ], + "int32Type": [ -3, -4 ], + "int64Type": [ -4, -5 ], + "uint32Type": [ 5, 6 ], + "uint64Type": [ 6, 7 ], + "sint32Type": [ -7, -8 ], + "sint64Type": [ -8, -9 ], + "fixed32Type": [ 9, 10 ], + "fixed64Type": [ 10, 11 ], + "sfixed32Type": [ -11, -12 ], + "sfixed64Type": [ -12, -13 ], + "boolType": [ false, true ], + "stringType": [ '1st string', '2nd string' ], + "bytesType": [ '1st bytes', '2nd bytes' ], + "repeatedMessage": [{ + "doubleType": [ 1.0, 2.0 ], + "floatType": [ 2.0, 3.0 ], + "int32Type": [ -3, -4 ], + "int64Type": [ -4, -5 ], + "uint32Type": [ 5, 6 ], + "uint64Type": [ 6, 7 ], + "sint32Type": [ -7, -8 ], + "sint64Type": [ -8, -9 ], + "fixed32Type": [ 9, 10 ], + "fixed64Type": [ 10, 11 ], + "sfixed32Type": [ -11, -12 ], + "sfixed64Type": [ -12, -13 ], + "boolType": [ false, true ], + "stringType": [ '1st string', '2nd string' ], + "bytesType": [ '1st bytes', '2nd bytes' ], + }], + }) + </content> + </send> + </onentry-off> + <transition target="dump" event="dump.event" /> + </state> + <state id="dump"> + <onentry> + <script> + dump(_event); + </script> + </onentry> + <transition target="dump" event="dump.event" /> + </state> +</scxml>
\ No newline at end of file |