blob: 63cc15003cfdc2b08f543bae948f78b8727d4ed8 (
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
|
RoomModel ContractMonitorTest {
import room.basic.service.timing.PTimer
import room.basic.types.*
import room.basic.test.TestInstance
import ContractMonitor.*
import room.basic.service.timing.ATimingService
ActorClass ContractMonitor_Top {
@TestInstance
Structure {
ActorRef appl: Appl
ActorRef timing: ATimingService
LayerConnection ref appl satisfied_by timing.timer
}
}
ActorClass Appl {
Structure {
ActorRef client: Client
ActorRef provider: Provider
ActorRef monitor: ContractMonitor_monitors.LoginProtocolContract_GeneratedMonitor
Binding provider.fct and monitor.toUnconjugated
Binding monitor.toConjugated and client.loginPort
}
Behavior {
ctor '''
etUnit_open("log", "ContractMonitorTest");
etUnit_openTestSuite("org.eclipse.etrice.generator.common.tests.ContractMonitorTest");
'''
dtor '''
etUnit_closeTestSuite();
etUnit_close();
'''
}
}
ActorClass Client {
Interface {
conjugated Port loginPort: LoginProtocol
}
Structure {
external Port loginPort
SAP toTimer: PTimer
Attribute counter: int32 = "0"
}
Behavior {
StateMachine {
State connecting {
entry '''counter += 1;'''
}
Transition init0: initial -> connecting {
action '''
loginPort.hello();
'''
}
State request1Sent
State request2Sent
State testDone {
entry '''etUnit_testFinished(0);'''
}
Transition tr0: connecting -> request1Sent {
triggers {
<hello: loginPort>
}
action '''loginPort.login((short)0);'''
}
Transition tr1: request1Sent -> request2Sent {
triggers {
<wrong: loginPort>
}
action '''loginPort.login((short)1);'''
}
Transition tr2: request4Sent -> connecting {
triggers {
<ok: loginPort guard '''counter < 1'''>
}
action '''loginPort.hello();'''
}
Transition tr3: request4Sent -> testDone {
triggers {
<wrong: loginPort guard '''counter >= 1'''>
}
}
State request3Sent
State request4Sent
Transition tr4: request2Sent -> request3Sent {
triggers {
<wrong: loginPort>
}
action '''loginPort.login((short)5);'''
}
Transition tr5: request3Sent -> request4Sent {
triggers {
<wrong: loginPort>
}
action '''loginPort.login((short)7);'''
}
}
}
}
ActorClass Provider {
Interface {
Port fct: LoginProtocol
}
Structure {
external Port fct
SAP toTimer: PTimer
}
Behavior {
StateMachine {
State idle
State connected
Transition init0: initial -> idle
Transition tr0: idle -> connected {
triggers {
<hello: fct>
}
action '''fct.hello();'''
}
Transition tr1: connected -> idle {
triggers {
<login: fct guard '''transitionData == 1234'''>
}
action '''fct.ok();'''
}
Transition tr2: connected -> connected {
triggers {
<login: fct guard '''transitionData != 1234'''>
}
action '''fct.wrong();'''
}
Transition tr3: connected -> idle {
triggers {
<cancel: fct>
}
}
}
}
}
}
|