summaryrefslogtreecommitdiffstats
blob: a24a02a8bdf4ddfd7497da3171fff4b682585a5f (plain)
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
RoomModel ChoicePointTest {

	import room.basic.types.* from "Types.room"

	LogicalSystem System_ChoicePointTest {
		SubSystemRef SubSystem_CPTest: SubSystem_CPTest
	}

	SubSystemClass SubSystem_CPTest {
		ActorRef ChoicePointTest_Top: CPTest_Top
	}

	ActorClass CPTest_Top {
		Structure {
			ActorRef cp_tester: CPTester
			ActorRef cp_user: CPUser
			Binding cp_tester.TestPort1 and cp_user.TestPort1
		}
		Behavior { }
	}

	ActorClass CPUser {
		Interface {
			Port TestPort1: TestProtocol
		}
		Structure {
			external Port TestPort1
			Attribute counter: int32
			Attribute caseId: int32
			Attribute resultlist[29]: int16 = "{1,2,3,4,5,6,3,4,5,7,8,10,11,12,9,16,3,4,5,17,8,13,15,11,19,12,9,18,20}"
			
		}
		Behavior {
			Operation CPUser() {
				"caseId = etUnit_openAll(\"tmp\", \"ChoicePointTest\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTest\", \"ChoicePointTest_case\");"
			}
			Operation ~CPUser() {
				"etUnit_closeAll(caseId);"
			}
			StateMachine {
				Transition init: initial -> cp cp0 {
					action {
						"counter = 0;"
						"EXPECT_ORDER_START(caseId,resultlist,29);"
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);"
					}
				}
				Transition tr4: cp cp0 -> ENTRY3_EXIT4 {
					action {
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0);"
					}
				}
				Transition EXPECT2: cp cp0 -> ENTRY3_EXIT4 {
					cond {
						"counter == 0"
					}
					action {
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);"
					}
				}
				Transition EXPECT5: ENTRY3_EXIT4 -> cp cp1 {
					triggers {
						<msg1: TestPort1>
					}
					action {
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);"
					}
				}
				Transition EXPECT6: cp cp1 -> ENTRY3_EXIT4 {
					action {
						"counter=3;"
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);"
					}
				}
				Transition EXPECT17: cp cp1 -> tp0 of ENTRY8_EXIT9 {
					cond {
						"counter == 4"
					}
					action {
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);"
					}
				}
				Transition EXPECT7: cp cp1 -> ENTRY8_EXIT9 {
					cond {
						"counter == 3"
					}
					action {
						"counter = 1;"
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);"
					}
				}
				Transition EXPECT16: ENTRY8_EXIT9 -> ENTRY3_EXIT4 {
					triggers {
						<msg1: TestPort1 guard {
							"counter==1"
						}>
					}
					action {
						"counter=4;"
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 16);"
					}
				}
				Transition EXPEXT19: my tp0 -> my tp0 {
					triggers {
						<msg1: TestPort1>
					}
					action {
						"counter = 2;"
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);"
					}
				}
				Transition EXPECT18: ENTRY8_EXIT9 -> testOk {
					triggers {
						<msg1: TestPort1 guard {
							"counter==2"
						}>
					}
					action {
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);"
					}
				}
				ChoicePoint cp0
				ChoicePoint cp1
				handler TransitionPoint tp0
				State ENTRY3_EXIT4 {
					entry {
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);"
					}
					exit {
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);"
					}
				}
				State ENTRY8_EXIT9 {
					entry {
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);"
					}
					exit {
						"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);"
					}
					subgraph {
						Transition EXPECT13: my tp0 -> cp cp0 {
							action {
								"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);"
							}
						}
						Transition EXPECT14: cp cp0 -> ENTRY11_EXIT12 {
							action {
								"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);"
							}
						}
						Transition EXPECT15: cp cp0 -> ENTRY11_EXIT12 {
							cond {
								"counter == 4"
							}
							action {
								"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);"
							}
						}
						Transition init: initial -> ENTRY11_EXIT12 {
							action {
								"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);"
							}
						}
						ChoicePoint cp0
						EntryPoint tp0
						State ENTRY11_EXIT12 {
							entry {
								"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);"
							}
							exit {
								"EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);"
							}
						}
					}
				}
				State testOk {
					entry {
						"EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 20);"
						"etUnit_testFinished(caseId);"
					}
				}
			}
		}
	}

	ActorClass CPTester {
		Interface {
			conjugated Port TestPort1: TestProtocol
		}
		Structure {
			external Port TestPort1
		}
		Behavior {
			StateMachine {
				Transition init: initial -> state0 {
					action {
						"TestPort1.msg1();"
						"TestPort1.msg1();"
						"TestPort1.msg1();"
						"TestPort1.msg1();"
						"TestPort1.msg1();"
						"TestPort1.msg1();"
					}
				}
				State state0
			}
		}
	}

	ProtocolClass TestProtocol {
		incoming {
			Message msg1()
			Message msg2()
			Message msg3()
			Message msg4()
			Message msg5()
		}
	}

}