Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 956d8313379a2f1daf9eb797ce33b7e60830deaa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
RoomModel HandlerTest {

	import room.basic.types.* from "Types.room"
	
	LogicalSystem System_HandlerTest {
		SubSystemRef SubSystem_HandlerTest: SubSystem_HandlerTest
	}

	SubSystemClass SubSystem_HandlerTest {
		ActorRef HandlerTest_Top: HandlerTest_Top
//		LogicalThread t1 prio=5 {HandlerTest_Top.tester}
//		LogicalThread t2 prio=5 {HandlerTest_Top.handlerUser}
	}

	ActorClass HandlerTest_Top {
		Structure {
			ActorRef tester: Tester
			ActorRef handlerUser: HandlerUser
			
			Binding tester.TestPort1 and handlerUser.TestPort1
		}
		Behavior { }
	}

	ActorClass HandlerUser {
		Interface {
			Port TestPort1: TestProtocol
		}
		Structure {	
			external Port TestPort1
			Attribute counter: int32
			Attribute caseId: int32
		}
		Behavior {
			Operation HandlerUser() {
				"caseId = etUnit_openAll(\"tmp\", \"HandlerTest\", \"org.eclipse.etrice.generator.common.tests.HandlerTest\", \"HandlerTest_case\");"
			}
			Operation ~HandlerUser() {
				"etUnit_closeAll(caseId);"
			}
			StateMachine {
				Transition tr0: my tp0 -> my tp0 {
					triggers {
						<msg1: TestPort1>
					}
					action {
						"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 11);"
					}
				}
				Transition tr1: my tp1 -> my tp1 {
					triggers {
						<msg1: TestPort1 guard {
							"p1==3"
						}>
					}
					action {
						"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 12);"
					}
				}
				Transition init: initial -> tp2 of state0 {
					action {
						"short list[] = {13,15,16,22,23,11,24,17,14,12,13,16,23,70,24,17,14,114,113,111,11,70,24,17,120,16,23,24,17,121,18,19,25,18,20,19,21,18,19,25,18,19,14,117};"
						"EXPECT_ORDER_START(caseId, list, 44);"
					}
				}
				Transition tr9: state0 -> cp cp1 {
					triggers {
						<msg1: TestPort1 guard {
							"p1==4"
						}>
					}
					action {
						"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 114);"
					}
				}
				Transition tr5: my tp1 -> my tp1 {
					triggers {
						<msg2: TestPort1 guard {
							"p1==4"
						}>
					}
					action {
						"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 50);"
					}
				}
				Transition tr7: my tp0 -> state0 {
					triggers {
						<msg1: TestPort1 guard {
							"p1==7"
						}>
					}
					action {
						"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 70);"
					}
				}
				Transition tr6: my tp0 -> my tp0 {
					triggers {
						<msg1: TestPort1 guard {
							"p1==12"
						}>
					}
					action {
						"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 110);"
					}
				}
				Transition tr8: cp cp1 -> state1 {
					action {
						"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 113);"
					}
				}
				Transition tr10: cp cp1 -> state0 {
					cond {
						"p1!=4"
					}
					action {
						"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 115);"
					}
				}
				Transition tr4: my tp1 -> testOk {
					triggers {
						<msg6: TestPort1>
					}
					action {
						"EXPECT_ORDER_END(caseId, \"<|MODEL_LOCATION|>\", 117);"
					}
				}
				ChoicePoint cp1
				handler TransitionPoint tp0
				TransitionPoint tp1
				State state0 {
					entry {
						"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 13);"
					}
					exit {
						"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 14);"
					}
					subgraph {
						Transition tr0: state1 -> state2 {
							triggers {
								<msg5: TestPort1>
							}
						}
						Transition tr1: my tp0 -> my tp0 {
							triggers {
								<msg3: TestPort1>
							}
							action {
								"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 20);"
							}
						}
						Transition tr2: my tp1 -> my tp1 {
							triggers {
								<msg4: TestPort1>
							}
							action {
								"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 21);"
							}
						}
						Transition tr3: state2 -> state2 {
							triggers {
								<msg1: TestPort1>
							}
							action {
								"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 25);"
							}
						}
						Transition tr4: my tp2 -> tp0 of state1 {
							action {
								"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 15);"
							}
						}
						Transition tr5: my tp0 -> my tp0 {
							triggers {
								<msg1: TestPort1 guard {
									"p1==5"
								}>
							}
							action {
								"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 52);"
							}
						}
						Transition init: initial -> state2 {
							action {
								"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 53);"
							}
						}
						Transition tr6: state1 -> state1 {
							triggers {
								<msg1: TestPort1 guard {
									"p1==8"
								}>
							}
							action {
								"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 54);"
							}
						}
						Transition tr7: my tp1 -> state1 {
							triggers {
								<msg2: TestPort1 guard {
									"p1==5"
								}>
							}
							action {
								"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 120);"
							}
						}
						Transition tr8: my tp1 -> state2 {
							triggers {
								<msg2: TestPort1 guard {
									"p1==6"
								}>
							}
							action {
								"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 121);"
							}
						}
						handler TransitionPoint tp0
						TransitionPoint tp1
						EntryPoint tp2
						State state1 {
							entry {
								"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 16);"
							}
							exit {
								"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 17);"
							}
							subgraph {
								Transition tr0: my tp0 -> state7 {
									action {
										"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 22);"
									}
								}
								Transition init: initial -> state7 {
									action {
										"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 121);"
									}
								}
								EntryPoint tp0
								State state7 {
									entry {
										"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 23);"
									}
									exit {
										"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 24);"
									}
								}
							}
						}
						State state2 {
							entry {
								"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 18);"
							}
							exit {
								"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 19);"
							}
						}
					}
				}
				State testOk {
					entry {
						"etUnit_testFinished(caseId);"
					}
				}
				State state1 {
					entry {
						"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 111);"
					}
					exit {
						"EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 112);"
					}
				}
			}
		}
	}

	ActorClass Tester {
		Interface {
			conjugated Port TestPort1: TestProtocol
		}
		Structure {
			external Port TestPort1
		}
		Behavior {
			StateMachine {
				Transition init: initial -> state0 {
					action {
						"TestPort1.msg1(2);"
						"TestPort1.msg1(3);"
						"TestPort1.msg1(7);"
						"TestPort1.msg1(4);"
						"TestPort1.msg1(5);"
						"TestPort1.msg1(7);"
						"TestPort1.msg2(5);"
						"TestPort1.msg2(6);"
						"TestPort1.msg1(5);"
						"TestPort1.msg3();"
						"TestPort1.msg4();"
						"TestPort1.msg1(8);"
						"TestPort1.msg6(12);"
					}
				}
				State state0
			}
		}
	}

	ProtocolClass TestProtocol {
		incoming {
			Message msg1(p1:int32)
			Message msg2(p1:int32)
			Message msg3()
			Message msg4()
			Message msg5(p1:int32)
			Message msg6(p1:int32)
		}
	}

}

Back to the top