rsmp-validator 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/secrets_example.yaml +2 -2
- data/config/simulator/supervisor.yaml +1 -1
- data/config/simulator/tlc.yaml +2 -1
- data/config/{cross_rs4s.yaml → sites/cross_rs4s.yaml} +5 -5
- data/config/sites/cross_rs5.yaml +62 -0
- data/config/{lightmotion_satellite.yaml → sites/lightmotion_satellite.yaml} +1 -1
- data/config/{swarco_itc3.yaml → sites/swarco_itc3.yaml} +3 -4
- data/config/validator.rb +1 -0
- data/config/validator_example.yaml +2 -2
- data/lib/rsmp/validator/buffer_replay_queue.rb +37 -0
- data/lib/rsmp/validator/cli/config_cli.rb +34 -9
- data/lib/rsmp/validator/config_check.rb +21 -2
- data/lib/rsmp/validator/config_normalizer.rb +3 -2
- data/lib/rsmp/validator/configuration/loader.rb +7 -13
- data/lib/rsmp/validator/configuration/secrets.rb +7 -3
- data/lib/rsmp/validator/configuration/sxls_override.rb +19 -4
- data/lib/rsmp/validator/configuration/test_requirements.rb +63 -0
- data/lib/rsmp/validator/configuration/version_normalization.rb +10 -5
- data/lib/rsmp/validator/configuration.rb +2 -9
- data/lib/rsmp/validator/helpers/alarms.rb +3 -3
- data/lib/rsmp/validator/helpers/connection.rb +14 -14
- data/lib/rsmp/validator/helpers/expectations.rb +35 -0
- data/lib/rsmp/validator/helpers/input.rb +3 -3
- data/lib/rsmp/validator/helpers/signal_plans.rb +11 -16
- data/lib/rsmp/validator/helpers/signal_priority.rb +23 -22
- data/lib/rsmp/validator/lifecycle.rb +2 -0
- data/lib/rsmp/validator/missing_configuration.rb +10 -0
- data/lib/rsmp/validator/options/site_test_options.rb +1 -1
- data/lib/rsmp/validator/options/supervisor_test_options.rb +1 -1
- data/lib/rsmp/validator/site_tester.rb +4 -19
- data/lib/rsmp/validator/version.rb +1 -1
- data/lib/rsmp/validator.rb +1 -0
- data/schemas/site_test.json +0 -4
- data/schemas/supervisor_test.json +0 -2
- data/schemas/test_config/common.json +21 -0
- data/schemas/test_config/core/3.1.4.json +14 -0
- data/schemas/test_config/core/3.1.5.json +14 -0
- data/schemas/test_config/core.json +33 -0
- data/schemas/test_config/tlc/1.0.15.json +13 -0
- data/schemas/test_config/tlc/1.0.7.json +67 -0
- data/schemas/test_config/tlc/1.0.8.json +13 -0
- data/schemas/test_config/tlc/1.1.0.json +13 -0
- data/schemas/test_config/versions.json +28 -0
- data/test/site/core/aggregated_status_spec.rb +28 -6
- data/test/site/core/message_buffer_spec.rb +90 -75
- data/test/site/tlc/alarm_spec.rb +9 -5
- data/test/site/tlc/clock_spec.rb +9 -9
- data/test/site/tlc/detector_logics_spec.rb +11 -9
- data/test/site/tlc/emergency_routes_spec.rb +4 -4
- data/test/site/tlc/invalid_command_spec.rb +9 -8
- data/test/site/tlc/invalid_status_spec.rb +8 -7
- data/test/site/tlc/modes_spec.rb +21 -21
- data/test/site/tlc/signal_groups_spec.rb +10 -10
- data/test/site/tlc/signal_plans_spec.rb +21 -21
- data/test/site/tlc/signal_priority_spec.rb +5 -5
- data/test/site/tlc/subscribe_spec.rb +31 -26
- data/test/site/tlc/system_spec.rb +11 -11
- data/test/site/tlc/traffic_data_spec.rb +12 -10
- data/test/site/tlc/traffic_situations_spec.rb +3 -3
- data/test/supervisor/aggregated_status_spec.rb +4 -0
- metadata +25 -11
- /data/config/{gem_tlc.yaml → sites/gem_tlc.yaml} +0 -0
- /data/config/{gem_tlc_secrets.yaml → sites/gem_tlc_secrets.yaml} +0 -0
- /data/config/{kapsch_etx.yaml → sites/kapsch_etx.yaml} +0 -0
- /data/config/{semaforica_cartesio.yaml → sites/semaforica_cartesio.yaml} +0 -0
- /data/config/{gem_supervisor.yaml → supervisors/gem_supervisor.yaml} +0 -0
- /data/config/{tecsen_tmacs_supervisor.yaml → supervisors/tecsen_tmacs_supervisor.yaml} +0 -0
data/test/site/tlc/modes_spec.rb
CHANGED
|
@@ -3,7 +3,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
3
3
|
|
|
4
4
|
# Verify status S0020 control mode
|
|
5
5
|
#
|
|
6
|
-
# 1. Given the
|
|
6
|
+
# 1. Given the site is connected
|
|
7
7
|
# 2. Request status
|
|
8
8
|
# 3. Expect status response before timeout
|
|
9
9
|
it 'control mode is read with S0020' do
|
|
@@ -15,7 +15,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
15
15
|
|
|
16
16
|
# Verify status S0005 traffic controller starting
|
|
17
17
|
#
|
|
18
|
-
# 1. Given the
|
|
18
|
+
# 1. Given the site is connected
|
|
19
19
|
# 2. Request status
|
|
20
20
|
# 3. Expect status response before timeout
|
|
21
21
|
it 'startup status is read with S0005' do
|
|
@@ -28,7 +28,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
28
28
|
# Verify status S0005 traffic controller starting by intersection
|
|
29
29
|
# statusByIntersection requires core >= 3.2.0, since it uses the array data type.
|
|
30
30
|
#
|
|
31
|
-
# 1. Given the
|
|
31
|
+
# 1. Given the site is connected
|
|
32
32
|
# 2. Request status
|
|
33
33
|
# 3. Expect status response before timeout
|
|
34
34
|
it 'startup status is read with S0005 by intersection' do
|
|
@@ -41,7 +41,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
41
41
|
|
|
42
42
|
# Verify status S0007 controller switched on (dark mode=off)
|
|
43
43
|
#
|
|
44
|
-
# 1. Given the
|
|
44
|
+
# 1. Given the site is connected
|
|
45
45
|
# 2. Request status
|
|
46
46
|
# 3. Expect status response before timeout
|
|
47
47
|
it 'switched on is read with S0007' do
|
|
@@ -53,7 +53,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
53
53
|
|
|
54
54
|
# Verify status S0007 controller switched on, source attribute
|
|
55
55
|
#
|
|
56
|
-
# 1. Given the
|
|
56
|
+
# 1. Given the site is connected
|
|
57
57
|
# 2. Request status
|
|
58
58
|
# 3. Expect status response before timeout
|
|
59
59
|
it 'switched on is read with S0007 with source' do
|
|
@@ -65,7 +65,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
65
65
|
|
|
66
66
|
# Verify status S0008 manual control
|
|
67
67
|
#
|
|
68
|
-
# 1. Given the
|
|
68
|
+
# 1. Given the site is connected
|
|
69
69
|
# 2. Request status
|
|
70
70
|
# 3. Expect status response before timeout
|
|
71
71
|
it 'manual control is read with S0008' do
|
|
@@ -82,7 +82,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
82
82
|
|
|
83
83
|
# Verify status S0009 fixed time control
|
|
84
84
|
#
|
|
85
|
-
# 1. Given the
|
|
85
|
+
# 1. Given the site is connected
|
|
86
86
|
# 2. Request status
|
|
87
87
|
# 3. Expect status response before timeout
|
|
88
88
|
it 'fixed time control is read with S0009' do
|
|
@@ -99,11 +99,11 @@ describe 'Site::Tlc::Modes' do
|
|
|
99
99
|
|
|
100
100
|
# Verify command M0007 fixed time control
|
|
101
101
|
#
|
|
102
|
-
# 1.
|
|
103
|
-
# 2.
|
|
104
|
-
# 3.
|
|
105
|
-
# 4.
|
|
106
|
-
# 5.
|
|
102
|
+
# 1. Given the site is connected
|
|
103
|
+
# 2. When we activate fixed time control with M0007
|
|
104
|
+
# 3. Then S0009 should show fixed time control is active
|
|
105
|
+
# 4. When we deactivate fixed time control with M0007
|
|
106
|
+
# 5. Then S0009 should show fixed time control is inactive
|
|
107
107
|
it 'fixed time control can be activated with M0007' do
|
|
108
108
|
with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
|
|
109
109
|
timeout = RSMP::Validator.get_config('timeouts', 'command')
|
|
@@ -117,7 +117,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
117
117
|
|
|
118
118
|
# Verify status S0010 isolated control
|
|
119
119
|
#
|
|
120
|
-
# 1. Given the
|
|
120
|
+
# 1. Given the site is connected
|
|
121
121
|
# 2. Request status
|
|
122
122
|
# 3. Expect status response before timeout
|
|
123
123
|
it 'isolated control is read with S0010' do
|
|
@@ -134,7 +134,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
134
134
|
|
|
135
135
|
# Verify status S0032 coordinated control
|
|
136
136
|
#
|
|
137
|
-
# 1. Given the
|
|
137
|
+
# 1. Given the site is connected
|
|
138
138
|
# 2. Request status
|
|
139
139
|
# 3. Expect status response before timeout
|
|
140
140
|
it 'coordinated control is read with S0032' do
|
|
@@ -146,7 +146,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
146
146
|
|
|
147
147
|
# Verify status S0011 yellow flash
|
|
148
148
|
#
|
|
149
|
-
# 1. Given the
|
|
149
|
+
# 1. Given the site is connected
|
|
150
150
|
# 2. Request status
|
|
151
151
|
# 3. Expect status response before timeout
|
|
152
152
|
it 'yellow flash can be read with S0011' do
|
|
@@ -163,7 +163,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
163
163
|
|
|
164
164
|
# Verify that we can activate yellow flash
|
|
165
165
|
#
|
|
166
|
-
# 1. Given the
|
|
166
|
+
# 1. Given the site is connected
|
|
167
167
|
# 2. Send the control command to switch to Yellow flash
|
|
168
168
|
# 3. Wait for status Yellow flash
|
|
169
169
|
# 4. Send command to switch to normal control
|
|
@@ -182,7 +182,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
182
182
|
|
|
183
183
|
# Verify that yellow flash causes all groups to go to state 'c'
|
|
184
184
|
#
|
|
185
|
-
# 1. Given the
|
|
185
|
+
# 1. Given the site is connected
|
|
186
186
|
# 2. Send the control command to switch to Yellow flash
|
|
187
187
|
# 3. Wait for all groups to go to group 'c'
|
|
188
188
|
# 4. Send command to switch to normal control
|
|
@@ -205,7 +205,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
205
205
|
|
|
206
206
|
# Verify status S0012 all red
|
|
207
207
|
#
|
|
208
|
-
# 1. Given the
|
|
208
|
+
# 1. Given the site is connected
|
|
209
209
|
# 2. Request status
|
|
210
210
|
# 3. Expect status response before timeout
|
|
211
211
|
it 'all red can be read with S0012' do
|
|
@@ -222,7 +222,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
222
222
|
|
|
223
223
|
# Verify status S0013 police key
|
|
224
224
|
#
|
|
225
|
-
# 1. Given the
|
|
225
|
+
# 1. Given the site is connected
|
|
226
226
|
# 2. Request status
|
|
227
227
|
# 3. Expect status response before timeout
|
|
228
228
|
it 'police key can be read with S0013' do
|
|
@@ -234,7 +234,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
234
234
|
|
|
235
235
|
# Verify that we can activate dark mode
|
|
236
236
|
#
|
|
237
|
-
# 1. Given the
|
|
237
|
+
# 1. Given the site is connected
|
|
238
238
|
# 2. Send the control command to switch todarkmode
|
|
239
239
|
# 3. Wait for status"Controller on" = false
|
|
240
240
|
# 4. Send command to switch to normal control
|
|
@@ -253,7 +253,7 @@ describe 'Site::Tlc::Modes' do
|
|
|
253
253
|
|
|
254
254
|
# Verify that we can activate yellow flash and after 1 minute goes back to NormalControl
|
|
255
255
|
#
|
|
256
|
-
# 1. Given the
|
|
256
|
+
# 1. Given the site is connected
|
|
257
257
|
# 2. Send the control command to switch to Normal Control, and wait for this
|
|
258
258
|
# 2. Send the control command to switch to Yellow flash
|
|
259
259
|
# 3. Wait for status Yellow flash
|
|
@@ -3,9 +3,9 @@ describe 'Site::Tlc::SignalGroups' do
|
|
|
3
3
|
|
|
4
4
|
# Validate that a signal group can be ordered to green using the M0010 command.
|
|
5
5
|
#
|
|
6
|
-
# 1.
|
|
7
|
-
# 2.
|
|
8
|
-
# 3.
|
|
6
|
+
# 1. Given the site is connected
|
|
7
|
+
# 2. When we order a signal group to green with M0010
|
|
8
|
+
# 3. Then we should receive a confirmation
|
|
9
9
|
it 'is ordered to green with M0010' do
|
|
10
10
|
with_site(:connected, sxl: '>=1.0.8') do |site_proxy|
|
|
11
11
|
component = RSMP::Validator.get_config('components', 'signal_group').keys[0]
|
|
@@ -14,9 +14,9 @@ describe 'Site::Tlc::SignalGroups' do
|
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
# 1.
|
|
18
|
-
# 2.
|
|
19
|
-
# 3.
|
|
17
|
+
# 1. Given the site is connected
|
|
18
|
+
# 2. When we order a signal group to red with M0011
|
|
19
|
+
# 3. Then we should receive a confirmation
|
|
20
20
|
it 'is ordered to red with M0011' do
|
|
21
21
|
with_site(:connected, sxl: '>=1.0.8') do |site_proxy|
|
|
22
22
|
component = RSMP::Validator.get_config('components', 'signal_group').keys[0]
|
|
@@ -27,7 +27,7 @@ describe 'Site::Tlc::SignalGroups' do
|
|
|
27
27
|
|
|
28
28
|
# Verify that signal group status can be read with S0001.
|
|
29
29
|
#
|
|
30
|
-
# 1. Given the
|
|
30
|
+
# 1. Given the site is connected
|
|
31
31
|
# 2. Request status
|
|
32
32
|
# 3. Expect status response before timeout
|
|
33
33
|
it 'state is read with S0001' do
|
|
@@ -41,7 +41,7 @@ describe 'Site::Tlc::SignalGroups' do
|
|
|
41
41
|
|
|
42
42
|
# Verify that time-of-green/time-of-red can be read with S0025.
|
|
43
43
|
#
|
|
44
|
-
# 1. Given the
|
|
44
|
+
# 1. Given the site is connected
|
|
45
45
|
# 2. Request status
|
|
46
46
|
# 3. Expect status response before timeout
|
|
47
47
|
it 'red/green predictions is read with S0025' do
|
|
@@ -65,7 +65,7 @@ describe 'Site::Tlc::SignalGroups' do
|
|
|
65
65
|
|
|
66
66
|
# Verify status S0017 number of signal groups
|
|
67
67
|
#
|
|
68
|
-
# 1. Given the
|
|
68
|
+
# 1. Given the site is connected
|
|
69
69
|
# 2. Request status
|
|
70
70
|
# 3. Expect status response before timeout
|
|
71
71
|
it 'list size is read with S0017' do
|
|
@@ -77,7 +77,7 @@ describe 'Site::Tlc::SignalGroups' do
|
|
|
77
77
|
|
|
78
78
|
# Verify that we can activate normal control after yellow flash mode is turned off
|
|
79
79
|
#
|
|
80
|
-
# 1. Given the
|
|
80
|
+
# 1. Given the site is connected and in yellow flash mode
|
|
81
81
|
# 2. When we activate normal control
|
|
82
82
|
# 3. All signal groups should go through e, f and g
|
|
83
83
|
it 'follow startup sequence after yellow flash' do
|
|
@@ -3,7 +3,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
3
3
|
|
|
4
4
|
# Verify status S0014 current time plan
|
|
5
5
|
#
|
|
6
|
-
# 1. Given the
|
|
6
|
+
# 1. Given the site is connected
|
|
7
7
|
# 2. When we request the status
|
|
8
8
|
# 3. We should receive a status response before timeout
|
|
9
9
|
it 'currently active is read with S0014' do
|
|
@@ -21,7 +21,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
21
21
|
# Verify that we change time plan (signal program)
|
|
22
22
|
# We try switching all programs configured
|
|
23
23
|
#
|
|
24
|
-
# 1. Given the
|
|
24
|
+
# 1. Given the site is connected
|
|
25
25
|
# 2. And there is a RSMP::Validator.get_config('validator') with a time plan
|
|
26
26
|
# 3. When we send the command
|
|
27
27
|
# 3. We should receive a confirmative command response before timeout
|
|
@@ -54,7 +54,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
54
54
|
# Verify status S0018 number of time plans
|
|
55
55
|
# Deprecated from 1.2.0, use S0022 instead.
|
|
56
56
|
#
|
|
57
|
-
# 1. Given the
|
|
57
|
+
# 1. Given the site is connected
|
|
58
58
|
# 2. When we request the status
|
|
59
59
|
# 3. We should receive a status response before timeout
|
|
60
60
|
it 'list size is read with S0018' do
|
|
@@ -66,7 +66,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
66
66
|
|
|
67
67
|
# Verify status S0022 list of time plans
|
|
68
68
|
#
|
|
69
|
-
# 1. Given the
|
|
69
|
+
# 1. Given the site is connected
|
|
70
70
|
# 2. When we request the status
|
|
71
71
|
# 3. We should receive a status response before timeout
|
|
72
72
|
it 'list is read with S0022' do
|
|
@@ -78,7 +78,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
78
78
|
|
|
79
79
|
# Verify status S0026 week time table
|
|
80
80
|
#
|
|
81
|
-
# 1. Given the
|
|
81
|
+
# 1. Given the site is connected
|
|
82
82
|
# 2. When we request the status
|
|
83
83
|
# 3. We should receive a status response before timeout
|
|
84
84
|
it 'week table is read with S0026' do
|
|
@@ -90,7 +90,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
90
90
|
|
|
91
91
|
# Verify that we can set week table with M0016
|
|
92
92
|
#
|
|
93
|
-
# 1. Given the
|
|
93
|
+
# 1. Given the site is connected
|
|
94
94
|
# 2. When we send the command
|
|
95
95
|
# 3. We should receive a confirmative command response before timeout
|
|
96
96
|
it 'week table is set with M0016' do
|
|
@@ -103,7 +103,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
103
103
|
|
|
104
104
|
# Verify status S0027 time tables
|
|
105
105
|
#
|
|
106
|
-
# 1. Given the
|
|
106
|
+
# 1. Given the site is connected
|
|
107
107
|
# 2. When we request the status
|
|
108
108
|
# 3. We should receive a status response before timeout
|
|
109
109
|
it 'day table is read with S0027' do
|
|
@@ -115,7 +115,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
115
115
|
|
|
116
116
|
# Verify that we can set day table with M0017
|
|
117
117
|
#
|
|
118
|
-
# 1. Given the
|
|
118
|
+
# 1. Given the site is connected
|
|
119
119
|
# 2. When we send the command
|
|
120
120
|
# 3. We should receive a confirmative command response before timeout
|
|
121
121
|
it 'day table is set with M0017' do
|
|
@@ -128,7 +128,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
128
128
|
|
|
129
129
|
# Verify status S0097 version of traffic program
|
|
130
130
|
#
|
|
131
|
-
# 1. Given the
|
|
131
|
+
# 1. Given the site is connected
|
|
132
132
|
# 2. When we request the status
|
|
133
133
|
# 3. We should receive a status response before timeout
|
|
134
134
|
it 'version is read with S0097' do
|
|
@@ -141,7 +141,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
141
141
|
#
|
|
142
142
|
# Verify status S0098 configuration of traffic parameters
|
|
143
143
|
#
|
|
144
|
-
# 1. Given the
|
|
144
|
+
# 1. Given the site is connected
|
|
145
145
|
# 2. When we request the status
|
|
146
146
|
# 3. We should receive a status response before timeout
|
|
147
147
|
it 'config is read with S0098' do
|
|
@@ -162,7 +162,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
162
162
|
|
|
163
163
|
# Verify status S0023 command table
|
|
164
164
|
#
|
|
165
|
-
# 1. Given the
|
|
165
|
+
# 1. Given the site is connected
|
|
166
166
|
# 2. When we request the status
|
|
167
167
|
# 3. We should receive a status response before timeout
|
|
168
168
|
it 'dynamic bands are read with S0023' do
|
|
@@ -174,7 +174,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
174
174
|
|
|
175
175
|
# Verify that dynamic bands can the set with M0014
|
|
176
176
|
#
|
|
177
|
-
# 1. Given the
|
|
177
|
+
# 1. Given the site is connected
|
|
178
178
|
# 2. When we send the command
|
|
179
179
|
# 3. We should receive a confirmative command response before timeout
|
|
180
180
|
it 'dynamic bands are set with M0014' do
|
|
@@ -188,7 +188,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
188
188
|
|
|
189
189
|
# Verify that dynamic bands can be read and changed
|
|
190
190
|
#
|
|
191
|
-
# 1. Given the
|
|
191
|
+
# 1. Given the site is connected
|
|
192
192
|
# 2. And we read dynamic band
|
|
193
193
|
# 3. When we set dynamic band to 2x previous value
|
|
194
194
|
# 4. Then reading dynamic bands should confirm the change
|
|
@@ -201,7 +201,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
201
201
|
band = 3
|
|
202
202
|
|
|
203
203
|
value = site_proxy.tlc.read_dynamic_band!(plan: plan, band: band) || 0
|
|
204
|
-
|
|
204
|
+
expect_or_stop(value).to be_a(Integer)
|
|
205
205
|
|
|
206
206
|
new_value = value + 1
|
|
207
207
|
|
|
@@ -216,7 +216,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
216
216
|
|
|
217
217
|
# Verify command M0023 timeout of dynamic bands
|
|
218
218
|
#
|
|
219
|
-
# 1. Given the
|
|
219
|
+
# 1. Given the site is connected
|
|
220
220
|
# 2. When we send command to set timeout
|
|
221
221
|
# 3. Then we should get a confirmation
|
|
222
222
|
# 2. When we send command to disable timeout
|
|
@@ -233,7 +233,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
233
233
|
|
|
234
234
|
# Verify status S0024 offset time
|
|
235
235
|
#
|
|
236
|
-
# 1. Given the
|
|
236
|
+
# 1. Given the site is connected
|
|
237
237
|
# 2. Request status
|
|
238
238
|
# 3. Expect status response before timeout
|
|
239
239
|
it 'offset is read with S0024' do
|
|
@@ -243,9 +243,9 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
243
243
|
end
|
|
244
244
|
end
|
|
245
245
|
|
|
246
|
-
# 1.
|
|
247
|
-
# 2.
|
|
248
|
-
# 3.
|
|
246
|
+
# 1. Given the site is connected
|
|
247
|
+
# 2. When we set the offset of a signal plan with M0015
|
|
248
|
+
# 3. Then we should receive a confirmation
|
|
249
249
|
it 'offset is set with M0015' do
|
|
250
250
|
with_site(:connected, sxl: '>=1.0.13') do |site_proxy|
|
|
251
251
|
plan = RSMP::Validator.get_config('items', 'plans').first
|
|
@@ -257,7 +257,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
257
257
|
|
|
258
258
|
# Verify status S0028 cycle time
|
|
259
259
|
#
|
|
260
|
-
# 1. Given the
|
|
260
|
+
# 1. Given the site is connected
|
|
261
261
|
# 2. When we request the status
|
|
262
262
|
# 3. We should receive a status response before timeout
|
|
263
263
|
it 'cycle time is read with S0028' do
|
|
@@ -269,7 +269,7 @@ describe 'Site::Tlc::SignalPlans' do
|
|
|
269
269
|
|
|
270
270
|
# Verify that cycle time can be changed with M0018
|
|
271
271
|
#
|
|
272
|
-
# 1. Given the
|
|
272
|
+
# 1. Given the site is connected
|
|
273
273
|
# 2. And we read cycle times
|
|
274
274
|
# 3. When we extend cycle time of curent plan with 5s
|
|
275
275
|
# 4. Then reading the cycle time should confirm the change
|
|
@@ -5,7 +5,7 @@ describe 'Site::Tlc::SignalPriority' do
|
|
|
5
5
|
|
|
6
6
|
# Validate that a signal priority can be requested.
|
|
7
7
|
#
|
|
8
|
-
# 1. Given the
|
|
8
|
+
# 1. Given the site is connected
|
|
9
9
|
# 2. When we send a signal priority request
|
|
10
10
|
# 3. Then we should receive an acknowledgement
|
|
11
11
|
it 'can be requested with M0022' do
|
|
@@ -26,7 +26,7 @@ describe 'Site::Tlc::SignalPriority' do
|
|
|
26
26
|
|
|
27
27
|
# Validate that signal priority status can be requested.
|
|
28
28
|
#
|
|
29
|
-
# 1. Given the
|
|
29
|
+
# 1. Given the site is connected
|
|
30
30
|
# 2. When we request signal priority status
|
|
31
31
|
# 3. Then we should receive a status update
|
|
32
32
|
it 'status can be fetched with S0033' do
|
|
@@ -38,7 +38,7 @@ describe 'Site::Tlc::SignalPriority' do
|
|
|
38
38
|
|
|
39
39
|
# Validate that we can subscribe signal priority status
|
|
40
40
|
#
|
|
41
|
-
# 1. Given the
|
|
41
|
+
# 1. Given the site is connected
|
|
42
42
|
# 2. And we subscribe to signal priority status updates
|
|
43
43
|
# 4. Then we should receive an acknowledgement
|
|
44
44
|
# 5. And we should reive a status updates
|
|
@@ -52,7 +52,7 @@ describe 'Site::Tlc::SignalPriority' do
|
|
|
52
52
|
|
|
53
53
|
# Validate that a signal priority completes when we cancel it.
|
|
54
54
|
#
|
|
55
|
-
# 1. Given the
|
|
55
|
+
# 1. Given the site is connected
|
|
56
56
|
# 2. And we subscribe to signal priority status
|
|
57
57
|
# 3. When we send a signal priority request
|
|
58
58
|
# 4. Then the request state should become 'received'
|
|
@@ -97,7 +97,7 @@ describe 'Site::Tlc::SignalPriority' do
|
|
|
97
97
|
|
|
98
98
|
# Validate that a signal priority times out if not cancelled.
|
|
99
99
|
#
|
|
100
|
-
# 1. Given the
|
|
100
|
+
# 1. Given the site is connected
|
|
101
101
|
# 2. And we subscribe to signal priority status
|
|
102
102
|
# 3. When we send a signal priority request
|
|
103
103
|
# 4. Then the request state should become 'received'
|
|
@@ -5,9 +5,10 @@ describe 'Site::Tlc::Subscribe' do
|
|
|
5
5
|
# is arbitrary as we simply want to check that
|
|
6
6
|
# the subscription mechanism works.
|
|
7
7
|
#
|
|
8
|
-
# 1.
|
|
9
|
-
#
|
|
10
|
-
#
|
|
8
|
+
# 1. Given the site is connected
|
|
9
|
+
# 2. When we subscribe to S0001
|
|
10
|
+
# 3. Then we should receive a status update
|
|
11
|
+
# 4. Finally we unsubscribe from S0001
|
|
11
12
|
|
|
12
13
|
it 'can be turned on and off for S0001' do
|
|
13
14
|
with_site(:connected) do |site_proxy|
|
|
@@ -30,39 +31,43 @@ describe 'Site::Tlc::Subscribe' do
|
|
|
30
31
|
# The test subscribes to S0001 'cyclecounter' attribute with an initial update rate of 60s,
|
|
31
32
|
# then changes the update rate to 1s and verifies the new rate is in effect.
|
|
32
33
|
#
|
|
33
|
-
# 1.
|
|
34
|
-
# 2.
|
|
35
|
-
# 3.
|
|
36
|
-
# 4.
|
|
34
|
+
# 1. Given the site is connected
|
|
35
|
+
# 2. When we subscribe to S0001 'cyclecounter' with update rate 60s
|
|
36
|
+
# 3. And we change the update rate to 1s
|
|
37
|
+
# 4. Then we should receive two immediate updates and one periodic update within 2s
|
|
38
|
+
# 5. Finally we unsubscribe from S0001
|
|
37
39
|
|
|
38
40
|
it 'can change interval during active subscription' do
|
|
39
41
|
with_site(:connected) do |site_proxy|
|
|
40
42
|
component = RSMP::Validator.get_config('main_component')
|
|
43
|
+
matcher = RSMP::StatusMatcher.new('sCI' => 'S0001', 'n' => 'cyclecounter')
|
|
41
44
|
|
|
42
|
-
#
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
# start collecting matching status updates
|
|
46
|
+
collector = RSMP::Collector.new(
|
|
47
|
+
site_proxy,
|
|
48
|
+
filter: RSMP::Filter.new(type: 'StatusUpdate', component: component, ingoing: true, outgoing: false),
|
|
49
|
+
num: 3,
|
|
50
|
+
timeout: 2
|
|
51
|
+
)
|
|
52
|
+
collector.start do |message|
|
|
53
|
+
:keep if message.attributes.fetch('sS', []).any? { |item| matcher.match(item) }
|
|
54
|
+
end
|
|
46
55
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
log 'Subscribe to S0001 cyclecounter with 60s update rate'
|
|
57
|
+
status_list = [{ 'sCI' => 'S0001', 'n' => 'cyclecounter', 'uRt' => '60' }]
|
|
58
|
+
status_list.each { |item| item['sOc'] = false } if site_proxy.tlc.use_soc?
|
|
59
|
+
site_proxy.subscribe_to_status! status_list, component: component
|
|
50
60
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
updated_status_list.map! { |item| item.merge!('sOc' => true) } if site_proxy.tlc.use_soc?
|
|
61
|
+
log 'Change update rate to 1s and wait for three updates within 2s'
|
|
62
|
+
status_list.first['uRt'] = '1'
|
|
63
|
+
site_proxy.subscribe_to_status! status_list, component: component
|
|
55
64
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
component: component,
|
|
59
|
-
within: 2).value!
|
|
65
|
+
success = collector.wait.success?
|
|
66
|
+
expect_or_stop(success).to be == true
|
|
60
67
|
|
|
61
|
-
|
|
62
|
-
assert(!exchange.messages.empty?,
|
|
63
|
-
'Expected to receive status update within 2s with new 1s update rate')
|
|
64
|
-
log 'Successfully received status update within 2s, confirming 1s update rate is active'
|
|
68
|
+
log 'Received three updates within 2s, confirming periodic updates at the new rate'
|
|
65
69
|
ensure
|
|
70
|
+
collector&.stop
|
|
66
71
|
# Clean up subscription
|
|
67
72
|
unsubscribe_list = [{ 'sCI' => 'S0001', 'n' => 'cyclecounter' }]
|
|
68
73
|
site_proxy.unsubscribe_to_status! unsubscribe_list, component: component
|
|
@@ -3,7 +3,7 @@ describe 'Site::Tlc::System' do
|
|
|
3
3
|
|
|
4
4
|
# Verify status S0091 operator logged in/out OP-panel
|
|
5
5
|
#
|
|
6
|
-
# 1. Given the
|
|
6
|
+
# 1. Given the site is connected
|
|
7
7
|
# 2. Request status
|
|
8
8
|
# 3. Expect status response before timeout
|
|
9
9
|
it 'operator logged in/out of OP-panel is read with S0091' do
|
|
@@ -20,7 +20,7 @@ describe 'Site::Tlc::System' do
|
|
|
20
20
|
|
|
21
21
|
# Verify status S0092 operator logged in/out web-interface
|
|
22
22
|
#
|
|
23
|
-
# 1. Given the
|
|
23
|
+
# 1. Given the site is connected
|
|
24
24
|
# 2. Request status
|
|
25
25
|
# 3. Expect status response before timeout
|
|
26
26
|
it 'operator logged in/out of web-interface is read with S0092' do
|
|
@@ -37,7 +37,7 @@ describe 'Site::Tlc::System' do
|
|
|
37
37
|
|
|
38
38
|
# Verify status S0095 version of traffic controller
|
|
39
39
|
#
|
|
40
|
-
# 1. Given the
|
|
40
|
+
# 1. Given the site is connected
|
|
41
41
|
# 2. Request status
|
|
42
42
|
# 3. Expect status response before timeout
|
|
43
43
|
it 'version is read with S0095' do
|
|
@@ -47,11 +47,11 @@ describe 'Site::Tlc::System' do
|
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
# 1.
|
|
51
|
-
# 2.
|
|
52
|
-
# 3.
|
|
53
|
-
# 4.
|
|
54
|
-
# 5.
|
|
50
|
+
# 1. Given the site is connected
|
|
51
|
+
# 2. When we set the Level1 security code to its current value with M0103
|
|
52
|
+
# 3. Then we should receive a confirmation
|
|
53
|
+
# 4. When we set the Level2 security code to its current value with M0103
|
|
54
|
+
# 5. Then we should receive a confirmation
|
|
55
55
|
it 'security code is set with M0103' do
|
|
56
56
|
with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
|
|
57
57
|
code1 = RSMP::Validator.get_config('secrets', 'security_codes', 1)
|
|
@@ -65,14 +65,14 @@ describe 'Site::Tlc::System' do
|
|
|
65
65
|
# Verify that the site_proxy responds with NotAck if we send incorrect security cdoes.
|
|
66
66
|
# This behaviour is defined in SXL >= 1.1.0. For earlier versions,
|
|
67
67
|
# The behaviour is undefined.
|
|
68
|
-
# 1. Given the
|
|
68
|
+
# 1. Given the site is connected
|
|
69
69
|
# 2. When we send a M0008 command with incorrect security codes
|
|
70
70
|
# 3. Then we should received a NotAck
|
|
71
71
|
it 'security code is rejected when incorrect' do
|
|
72
72
|
with_site(:connected, sxl: '>=1.1.0') do |site_proxy|
|
|
73
73
|
result = wrong_security_code(site_proxy)
|
|
74
|
-
|
|
75
|
-
expect(result.failure.code).to eq(:message_rejected)
|
|
74
|
+
expect_or_stop(result).to be_a(RSMP::Result::Failure)
|
|
75
|
+
expect(result.failure.code).to eq(:message_rejected)
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
end
|
|
@@ -3,7 +3,7 @@ describe 'Site::Tlc::TrafficData' do
|
|
|
3
3
|
|
|
4
4
|
# Verify status S0201 traffic counting: number of vehicles
|
|
5
5
|
#
|
|
6
|
-
# 1. Given the
|
|
6
|
+
# 1. Given the site is connected
|
|
7
7
|
# 2. Request status
|
|
8
8
|
# 3. Expect status response before timeout
|
|
9
9
|
it 'number of vehicles for a single detector is read with S0201' do
|
|
@@ -19,7 +19,7 @@ describe 'Site::Tlc::TrafficData' do
|
|
|
19
19
|
|
|
20
20
|
# Verify status S0205 traffic counting: number of vehicles
|
|
21
21
|
#
|
|
22
|
-
# 1. Given the
|
|
22
|
+
# 1. Given the site is connected
|
|
23
23
|
# 2. Request status
|
|
24
24
|
# 3. Expect status response before timeout
|
|
25
25
|
it 'number of vehicles for all detectors is read with S0205' do
|
|
@@ -31,7 +31,7 @@ describe 'Site::Tlc::TrafficData' do
|
|
|
31
31
|
|
|
32
32
|
# Verify status S0202 traffic counting: vehicle speed
|
|
33
33
|
#
|
|
34
|
-
# 1. Given the
|
|
34
|
+
# 1. Given the site is connected
|
|
35
35
|
# 2. Request status
|
|
36
36
|
# 3. Expect status response before timeout
|
|
37
37
|
it 'vehicle speed for a single detector is read with S0202' do
|
|
@@ -47,7 +47,7 @@ describe 'Site::Tlc::TrafficData' do
|
|
|
47
47
|
|
|
48
48
|
# Verify status S0206 traffic counting: vehicle speed
|
|
49
49
|
#
|
|
50
|
-
# 1. Given the
|
|
50
|
+
# 1. Given the site is connected
|
|
51
51
|
# 2. Request status
|
|
52
52
|
# 3. Expect status response before timeout
|
|
53
53
|
it 'vehicle speed for all detectors is read with S0206' do
|
|
@@ -59,7 +59,7 @@ describe 'Site::Tlc::TrafficData' do
|
|
|
59
59
|
|
|
60
60
|
# Verify status S0203 traffic counting: occupancy
|
|
61
61
|
#
|
|
62
|
-
# 1. Given the
|
|
62
|
+
# 1. Given the site is connected
|
|
63
63
|
# 2. Request status
|
|
64
64
|
# 3. Expect status response before timeout
|
|
65
65
|
it 'occupancy for a single detector is read with S0203' do
|
|
@@ -75,7 +75,7 @@ describe 'Site::Tlc::TrafficData' do
|
|
|
75
75
|
|
|
76
76
|
# Verify status S0207 traffic counting: occupancy
|
|
77
77
|
#
|
|
78
|
-
# 1. Given the
|
|
78
|
+
# 1. Given the site is connected
|
|
79
79
|
# 2. Request status
|
|
80
80
|
# 3. Expect status response before timeout
|
|
81
81
|
it 'occupancy for all detectors is read with S0207' do
|
|
@@ -91,13 +91,15 @@ describe 'Site::Tlc::TrafficData' do
|
|
|
91
91
|
expect(start).to be_a(String)
|
|
92
92
|
|
|
93
93
|
occupancy_values = if RSMP::Validator.sxl_matches?('<1.1.0')
|
|
94
|
-
|
|
94
|
+
expect_or_stop(occupancies).to be_a(String)
|
|
95
|
+
|
|
95
96
|
occupancies.split(',').map do |occupancy|
|
|
96
97
|
assert(occupancy.match?(/\A-?\d+\z/), "Occupancy must be an Integer, got #{occupancy}")
|
|
97
98
|
occupancy.to_i
|
|
98
99
|
end
|
|
99
100
|
else
|
|
100
|
-
|
|
101
|
+
expect_or_stop(occupancies).to be_a(Array)
|
|
102
|
+
|
|
101
103
|
occupancies
|
|
102
104
|
end
|
|
103
105
|
|
|
@@ -110,7 +112,7 @@ describe 'Site::Tlc::TrafficData' do
|
|
|
110
112
|
|
|
111
113
|
# Verify status S0204 traffic counting: classification
|
|
112
114
|
#
|
|
113
|
-
# 1. Given the
|
|
115
|
+
# 1. Given the site is connected
|
|
114
116
|
# 2. Request status
|
|
115
117
|
# 3. Expect status response before timeout
|
|
116
118
|
it 'classification for a single detector is read with S0204' do
|
|
@@ -137,7 +139,7 @@ describe 'Site::Tlc::TrafficData' do
|
|
|
137
139
|
|
|
138
140
|
# Verify status S0208 traffic counting: classification
|
|
139
141
|
#
|
|
140
|
-
# 1. Given the
|
|
142
|
+
# 1. Given the site is connected
|
|
141
143
|
# 2. Request status
|
|
142
144
|
# 3. Expect status response before timeout
|
|
143
145
|
it 'classification for all detectors is read with S0208' do
|