summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Jung2011-07-18 15:06:16 (EDT)
committerThomas Jung2011-07-18 15:06:16 (EDT)
commitb5ed0781f4a6fc86fc4a730d0ec6a38f853fdfdc (patch)
treeb8793153814b8ea833943ee656c2790aa4d9d484
parentb8bea276e4a9ed70e0b82d6845f4a7aa549d6509 (diff)
downloadorg.eclipse.etrice-b5ed0781f4a6fc86fc4a730d0ec6a38f853fdfdc.zip
org.eclipse.etrice-b5ed0781f4a6fc86fc4a730d0ec6a38f853fdfdc.tar.gz
org.eclipse.etrice-b5ed0781f4a6fc86fc4a730d0ec6a38f853fdfdc.tar.bz2
[integration.tests] Integration test sending data by value added
-rw-r--r--tests/org.eclipse.etrice.integration.tests/model/org.eclipse.etrice.integration.SendingDataByValueTest.room307
1 files changed, 307 insertions, 0 deletions
diff --git a/tests/org.eclipse.etrice.integration.tests/model/org.eclipse.etrice.integration.SendingDataByValueTest.room b/tests/org.eclipse.etrice.integration.tests/model/org.eclipse.etrice.integration.SendingDataByValueTest.room
new file mode 100644
index 0000000..11eb877
--- /dev/null
+++ b/tests/org.eclipse.etrice.integration.tests/model/org.eclipse.etrice.integration.SendingDataByValueTest.room
@@ -0,0 +1,307 @@
+RoomModel org.eclipse.etrice.integration.SendingDataByValueTest {
+
+ LogicalSystem LogSys_SendingData {
+ SubSystemRef application: SubSys_SendingData
+ }
+
+ SubSystemClass SubSys_SendingData {
+ ActorRef top: SendingDataTop
+ }
+
+ ActorClass SendingDataTop {
+ Structure {
+ ActorRef mrPing: MrPing
+ ActorRef mrPong: MrPong
+ Binding mrPing.PingPongPort and mrPong.PingPongPort
+ }
+ Behavior { }
+ }
+
+ ActorClass MrPong {
+ Interface {
+ Port PingPongPort: PingPongProtocol
+ }
+ Structure {
+ external Port PingPongPort
+ }
+ Behavior {
+ Operation printData(d: PingPongData): void {
+ "System.out.printf(\"\\n\");"
+ "System.out.printf(\"i8Val: %d \\n\",d.getI8Val());"
+ "System.out.printf(\"i16Val: %d \\n\",d.getI16Val());"
+ "System.out.printf(\"i32Val: %d \\n\",d.getI32Val());"
+ "System.out.printf(\"charVal: %c \\n\",d.getCharVal());"
+ "System.out.printf(\"f32Val: %f \\n\",d.getF32Val());"
+ "System.out.printf(\"f64Val: %f \\n\",d.getF64Val());"
+ "System.out.printf(\"stringVal: %s \\n\",d.getStringVal());"
+ "System.out.printf(\"i32Array: %d %d %d %d %d\\n\",d.getArrayFromInt32()[0],d.getArrayFromInt32()[1],d.getArrayFromInt32()[2],d.getArrayFromInt32()[3],d.getArrayFromInt32()[4] );"
+ "System.out.printf(\"\\n\");"
+ }
+ StateMachine {
+ Transition tr0: reply -> reply {
+ triggers {
+ <ping: PingPongPort>
+ }
+ action {
+ "p.setI8Val((byte)(p.getI8Val()+1));"
+ ""
+ ""
+ "PingPongPort.pong(p);"
+ }
+ }
+ Transition tr1: reply -> reply {
+ triggers {
+ <pingSimple: PingPongPort>
+ }
+ action {
+ "PingPongPort.pongSimple(++p);"
+ }
+ }
+ Transition init: initial -> reply { }
+ State reply
+ }
+ }
+ }
+
+ ActorClass MrPing {
+ Interface {
+ conjugated Port PingPongPort: PingPongProtocol
+ }
+ Structure {
+ usercode1{
+ "import org.eclipse.etrice.integration.tests.helpers.*;"
+ "import org.eclipse.etrice.runtime.java.messaging.RTServices;"
+ }
+ usercode2 {
+ "private CRC16Generator crcGen = new CRC16Generator();"
+ }
+ external Port PingPongPort
+ Attribute i32Array [ 10 ]: int32
+ Attribute data : PingPongData
+ }
+ Behavior {
+ Operation printData(d: PingPongData): void {
+ "System.out.printf(\"MrPing:\\n\");"
+ "System.out.printf(\"i8Val: %d \\n\",d.getI8Val());"
+ "System.out.printf(\"i16Val: %d \\n\",d.getI16Val());"
+ "System.out.printf(\"i32Val: %d \\n\",d.getI32Val());"
+ "System.out.printf(\"charVal: %c \\n\",d.getCharVal());"
+ "System.out.printf(\"f32Val: %f \\n\",d.getF32Val());"
+ "System.out.printf(\"f64Val: %f \\n\",d.getF64Val());"
+ "System.out.printf(\"stringVal: %s \\n\",d.getStringVal());"
+ "System.out.printf(\"i32Array: %d %d %d %d %d\\n\",d.getArrayFromInt32()[0],d.getArrayFromInt32()[1],d.getArrayFromInt32()[2],d.getArrayFromInt32()[3],d.getArrayFromInt32()[4] );"
+ "System.out.printf(\"\\n\");"
+ }
+ StateMachine {
+ Transition init: initial -> waitForPong {
+ action {
+ "int i;"
+ "int[] intArray;"
+ "this.data=new PingPongData();"
+ ""
+ "// send default data"
+ "PingPongData d = new PingPongData();"
+ "PingPongPort.ping(d);"
+ ""
+ "d.setI8Val((byte) 45);"
+ "d.setI16Val((short) 34);"
+ "d.setI32Val(2);"
+ "d.setF32Val((float)3.14);"
+ "d.setF64Val(7.12345);"
+ "d.setStringVal(\"Hase !\");"
+ ""
+ "d.getOwnType().setI8Val((byte)10);"
+ "d.getOwnType().setI16Val((short)17);"
+ "d.getOwnType().setI32Val(4711);"
+ "d.getOwnType().setF32Val((float)3.0815);"
+ "d.getOwnType().setF64Val(123.45678);"
+ "d.getOwnType().setStringVal(\"Deep Hase !\");"
+ "intArray = d.getOwnType().getArrayFromInt32();"
+ "for (i=0;i<intArray.length;i++) {intArray[i] = 10+i;}"
+ "d.getOwnType().setArrayFromInt32(intArray);"
+ ""
+ "PingPongPort.ping(d);"
+ ""
+ "d.setI8Val((byte) 55);"
+ "d.setI16Val((short) 44);"
+ "d.setI32Val(3);"
+ "d.setF32Val((float)24.4563458);"
+ "d.setF64Val(2347.2342312345);"
+ "d.setStringVal(\"Mein Hase !\");"
+ ""
+ "d.getOwnType().setI8Val((byte)15);"
+ "d.getOwnType().setI16Val((short)23);"
+ "d.getOwnType().setI32Val(4812);"
+ "d.getOwnType().setF32Val((float)2453.30815);"
+ "d.getOwnType().setF64Val(125332.42342);"
+ "d.getOwnType().setStringVal(\"Mein Deep Hase !\");"
+ "intArray = d.getOwnType().getArrayFromInt32();"
+ "for (i=0;i<intArray.length;i++) {intArray[i] = 30+i;}"
+ "d.getOwnType().setArrayFromInt32(intArray);"
+ ""
+ "PingPongPort.ping(d);"
+ "PingPongPort.ping(data);"
+ ""
+ "data.setI8Val((byte) 67);"
+ "data.setI16Val((short) 97);"
+ "data.setI32Val(70);"
+ "data.setF32Val((float)233.14);"
+ "data.setF64Val(723434.12345);"
+ "data.setStringVal(\"Falscher Hase !\");"
+ ""
+ "crcGen.update(10);"
+ }
+ }
+ Transition tr0: my tp0 -> my tp0 {
+ triggers {
+ <pong: PingPongPort>
+ }
+ action {
+ "System.out.printf(\"Top Level : \\n\");"
+ "printData(p);"
+ "crcGen.update(20);"
+ }
+ }
+ Transition tr1: my tp0 -> my tp0 {
+ triggers {
+ <pongSimple: PingPongPort>
+ }
+ action {
+ "System.out.printf(\"Top Level Simple: \\n\");"
+ "crcGen.update(35);"
+ }
+ }
+ Transition tr10: waitForPong -> cp cp0 {
+ triggers {
+ <pong: PingPongPort>
+ }
+ action {
+ "printData(p);"
+ "crcGen.update(11);"
+ }
+ }
+ Transition tr4: cp cp0 -> waitForPong {
+ action {
+ "crcGen.update(12);"
+ }
+ }
+ Transition tr3: cp cp0 -> state0 {
+ cond {
+ "(p.i32Val==2) && (p.i8Val==46)"
+ }
+ action {
+ "// send default values"
+ "PingPongPort.ping(data);"
+ ""
+ "data.setI8Val((byte) 45);"
+ "data.setI16Val((short) 34);"
+ "data.setI32Val(80);"
+ "data.setF32Val((float)3.14);"
+ "data.setF64Val(7.12345);"
+ "data.setStringVal(\"Hase !\");"
+ ""
+ "data.getOwnType().setI8Val((byte)10);"
+ "data.getOwnType().setI16Val((short)17);"
+ "data.getOwnType().setI32Val(4711);"
+ "data.getOwnType().setF32Val((float)3.0815);"
+ "data.getOwnType().setF64Val(123.45678);"
+ "data.getOwnType().setStringVal(\"Deep Hase !\");"
+ "int[] intArray = data.getOwnType().getArrayFromInt32();"
+ "for (int i=0;i<intArray.length;i++) {intArray[i] = 10+i;}"
+ "data.getOwnType().setArrayFromInt32(intArray);"
+ ""
+ "PingPongPort.ping(data);"
+ "crcGen.update(13);"
+ }
+ }
+ Transition tr5: state0 -> state1 {
+ triggers {
+ <pong: PingPongPort guard {
+ "p.getI32Val()==3"
+ }>
+ }
+ action {
+ "printData(p);"
+ "PingPongPort.pingSimple(12);"
+ "PingPongPort.pingSimple(27);"
+ "crcGen.update(14);"
+ }
+ }
+ Transition tr6: state1 -> state2 {
+ triggers {
+ <pongSimple: PingPongPort>
+ }
+ action {
+ "crcGen.update(15);"
+ }
+ }
+ Transition tr7: state2 -> cp cp1 {
+ triggers {
+ <pongSimple: PingPongPort>
+ }
+ action {
+ "crcGen.update(16);"
+ "System.out.printf(\"CRC: %d \\n\", crcGen.getCrc());"
+ }
+ }
+ Transition tr8: cp cp1 -> TestFalse {
+ action {
+ "RTServices.getInstance().getSubSystem().testFinished(1);"
+ }
+ }
+ Transition tr9: cp cp1 -> TestOk {
+ cond {
+ "(p==28) && (crcGen.getCrc()==1187)"
+ }
+ action {
+ "RTServices.getInstance().getSubSystem().testFinished(0);"
+ }
+ }
+ ChoicePoint cp0
+ ChoicePoint cp1
+ TransitionPoint tp0
+ State waitForPong
+ State state0
+ State state1
+ State state2
+ State TestFalse
+ State TestOk
+ }
+ }
+ }
+
+ ProtocolClass PingPongProtocol {
+ incoming {
+ Message ping(p: PingPongData)
+ Message pingSimple(p: int32)
+ }
+ outgoing {
+ Message pong(p: PingPongData)
+ Message pongSimple(p: int32)
+ }
+ }
+
+ DataClass PingPongData {
+ Attribute i8Val: int8 = "34"
+ Attribute i16Val: int16 = "24"
+ Attribute i32Val: int32 = "12"
+ Attribute charVal: char = "'c'"
+ Attribute f32Val: float32 = "4711.0815f"
+ Attribute f64Val: float64 = "47114711.08150815"
+ Attribute stringVal: string = "\"Du alter Depp !\""
+ Attribute arrayFromInt32 [ 5 ]: int32 = "{1,2,3,4,5}"
+ Attribute ownType: PingPongDataDeep
+ }
+
+ DataClass PingPongDataDeep {
+ Attribute i8Val: int8
+ Attribute i16Val: int16
+ Attribute i32Val: int32
+ Attribute charVal: char
+ Attribute f32Val: float32
+ Attribute f64Val: float64
+ Attribute stringVal: string
+ Attribute arrayFromInt32 [ 10 ]: int32
+ }
+
+} \ No newline at end of file