rsmp-validator 0.1.1 → 0.3.2

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.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/config/cross_rs4s.yaml +6 -0
  3. data/config/gem_supervisor.yaml +6 -0
  4. data/config/gem_tlc.yaml +6 -0
  5. data/config/kapsch_etx.yaml +13 -6
  6. data/config/lightmotion_satellite.yaml +8 -2
  7. data/config/semaforica_cartesio.yaml +8 -2
  8. data/config/sus.rb +1 -1
  9. data/config/swarco_itc3.yaml +8 -2
  10. data/config/tecsen_tmacs_supervisor.yaml +6 -0
  11. data/exe/rsmp-validator +2 -117
  12. data/lib/rsmp/validator/async_context.rb +4 -3
  13. data/lib/rsmp/validator/auto_node.rb +5 -15
  14. data/lib/rsmp/validator/cli/config_cli.rb +32 -0
  15. data/lib/rsmp/validator/cli/entrypoint.rb +40 -0
  16. data/lib/rsmp/validator/cli/run_options.rb +87 -0
  17. data/lib/rsmp/validator/cli/runner.rb +119 -0
  18. data/lib/rsmp/validator/cli/tee_io.rb +30 -0
  19. data/lib/rsmp/validator/cli/validator_overrides.rb +28 -0
  20. data/lib/rsmp/validator/compliance/config_metadata.rb +31 -0
  21. data/lib/rsmp/validator/compliance/config_sxls.rb +24 -0
  22. data/lib/rsmp/validator/compliance/report.rb +70 -0
  23. data/lib/rsmp/validator/compliance/report_failure.rb +45 -0
  24. data/lib/rsmp/validator/compliance/report_metadata.rb +101 -0
  25. data/lib/rsmp/validator/config_check.rb +72 -0
  26. data/lib/rsmp/validator/configuration/loader.rb +6 -0
  27. data/lib/rsmp/validator/configuration/sxls_override.rb +33 -0
  28. data/lib/rsmp/validator/configuration/validation.rb +1 -35
  29. data/lib/rsmp/validator/configuration/version_normalization.rb +56 -0
  30. data/lib/rsmp/validator/configuration.rb +25 -22
  31. data/lib/rsmp/validator/helpers/alarms.rb +1 -1
  32. data/lib/rsmp/validator/helpers/clock.rb +2 -2
  33. data/lib/rsmp/validator/helpers/connection.rb +18 -8
  34. data/lib/rsmp/validator/helpers/handshake.rb +5 -8
  35. data/lib/rsmp/validator/helpers/input.rb +3 -3
  36. data/lib/rsmp/validator/helpers/security.rb +1 -1
  37. data/lib/rsmp/validator/helpers/signal_plans.rb +5 -5
  38. data/lib/rsmp/validator/helpers/signal_priority.rb +8 -11
  39. data/lib/rsmp/validator/helpers/startup.rb +6 -20
  40. data/lib/rsmp/validator/helpers/status.rb +1 -1
  41. data/lib/rsmp/validator/lifecycle.rb +11 -4
  42. data/lib/rsmp/validator/options/site_test_options.rb +21 -1
  43. data/lib/rsmp/validator/options/supervisor_test_options.rb +50 -13
  44. data/lib/rsmp/validator/site_tester.rb +15 -6
  45. data/lib/rsmp/validator/supervisor_tester.rb +11 -5
  46. data/lib/rsmp/validator/tester.rb +25 -29
  47. data/lib/rsmp/validator/version.rb +1 -1
  48. data/lib/rsmp/validator/version_filter.rb +1 -1
  49. data/lib/rsmp/validator.rb +5 -1
  50. data/schemas/site_test.json +0 -6
  51. data/test/site/core/aggregated_status_spec.rb +5 -7
  52. data/test/site/core/connect_spec.rb +5 -5
  53. data/test/site/core/disconnect_spec.rb +10 -19
  54. data/test/site/core/message_buffer_spec.rb +114 -0
  55. data/test/site/tlc/alarm_spec.rb +7 -7
  56. data/test/site/tlc/clock_spec.rb +26 -26
  57. data/test/site/tlc/detector_logics_spec.rb +6 -6
  58. data/test/site/tlc/emergency_routes_spec.rb +16 -16
  59. data/test/site/tlc/input_spec.rb +10 -10
  60. data/test/site/tlc/invalid_command_spec.rb +24 -20
  61. data/test/site/tlc/invalid_status_spec.rb +25 -20
  62. data/test/site/tlc/modes_spec.rb +53 -37
  63. data/test/site/tlc/output_spec.rb +8 -8
  64. data/test/site/tlc/signal_groups_spec.rb +8 -8
  65. data/test/site/tlc/signal_plans_spec.rb +32 -34
  66. data/test/site/tlc/signal_priority_spec.rb +10 -12
  67. data/test/site/tlc/subscribe_spec.rb +9 -9
  68. data/test/site/tlc/system_spec.rb +12 -10
  69. data/test/site/tlc/traffic_data_spec.rb +27 -16
  70. data/test/site/tlc/traffic_situations_spec.rb +5 -5
  71. data/test/supervisor/connect_spec.rb +9 -12
  72. metadata +35 -6
@@ -8,13 +8,13 @@ describe 'Site::Tlc::SignalPlans' do
8
8
  # 3. We should receive a status response before timeout
9
9
  it 'currently active is read with S0014' do
10
10
  with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
11
- status_list = if RSMP::Proxy.version_meets_requirement?(site_proxy.sxl_version, '>=1.1')
11
+ status_list = if RSMP::Proxy.version_meets_requirement?(site_proxy.sxl_version, '>=1.1.0')
12
12
  { S0014: %i[status source] }
13
13
  else
14
14
  { S0014: [:status] }
15
15
  end
16
16
  site_proxy.request_status_and_collect(status_list,
17
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
17
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
18
18
  end
19
19
  end
20
20
 
@@ -34,34 +34,33 @@ describe 'Site::Tlc::SignalPlans' do
34
34
  plans.each do |plan|
35
35
  command_timeout = RSMP::Validator.get_config('timeouts', 'command')
36
36
  status_timeout = RSMP::Validator.get_config('timeouts', 'status_response')
37
- site_proxy.tlc.set_timeplan(plan, within: command_timeout)
37
+ site_proxy.tlc.set_timeplan!(plan, within: command_timeout)
38
38
 
39
- s0014_fields = if RSMP::Proxy.version_meets_requirement?(site_proxy.sxl_version, '>=1.1')
39
+ s0014_fields = if RSMP::Proxy.version_meets_requirement?(site_proxy.sxl_version, '>=1.1.0')
40
40
  { S0014: %i[status source] }
41
41
  else
42
42
  { S0014: [:status] }
43
43
  end
44
- collector = site_proxy.request_status_and_collect(
44
+ exchange = site_proxy.request_status_and_collect(
45
45
  s0014_fields,
46
46
  within: status_timeout
47
- )
48
- collector.ok!
49
- ss = collector.messages.last.attributes['sS']
47
+ ).value!
48
+ ss = exchange.messages.last.attributes['sS']
50
49
  expect(ss.find { |i| i['n'] == 'status' }&.fetch('s').to_i).to eq(plan)
51
50
  end
52
51
  end
53
52
  end
54
53
 
55
54
  # Verify status S0018 number of time plans
56
- # Deprecated from 1.2, use S0022 instead.
55
+ # Deprecated from 1.2.0, use S0022 instead.
57
56
  #
58
57
  # 1. Given the site_proxy is connected
59
58
  # 2. When we request the status
60
59
  # 3. We should receive a status response before timeout
61
60
  it 'list size is read with S0018' do
62
- with_site(:connected, sxl: ['>=1.0.7', '<1.2']) do |site_proxy|
61
+ with_site(:connected, sxl: ['>=1.0.7', '<1.2.0']) do |site_proxy|
63
62
  site_proxy.request_status_and_collect({ S0018: [:number] },
64
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
63
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
65
64
  end
66
65
  end
67
66
 
@@ -73,7 +72,7 @@ describe 'Site::Tlc::SignalPlans' do
73
72
  it 'list is read with S0022' do
74
73
  with_site(:connected, sxl: '>=1.0.13') do |site_proxy|
75
74
  site_proxy.request_status_and_collect({ S0022: [:status] },
76
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
75
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
77
76
  end
78
77
  end
79
78
 
@@ -85,7 +84,7 @@ describe 'Site::Tlc::SignalPlans' do
85
84
  it 'week table is read with S0026' do
86
85
  with_site(:connected, sxl: '>=1.0.13') do |site_proxy|
87
86
  site_proxy.request_status_and_collect({ S0026: [:status] },
88
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
87
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
89
88
  end
90
89
  end
91
90
 
@@ -98,7 +97,7 @@ describe 'Site::Tlc::SignalPlans' do
98
97
  with_site(:connected, sxl: '>=1.0.13') do |site_proxy|
99
98
  status = '0-1,6-2'
100
99
  timeout = RSMP::Validator.get_config('timeouts', 'command_response')
101
- site_proxy.tlc.set_week_table(status, within: timeout)
100
+ site_proxy.tlc.set_week_table!(status, within: timeout)
102
101
  end
103
102
  end
104
103
 
@@ -110,7 +109,7 @@ describe 'Site::Tlc::SignalPlans' do
110
109
  it 'day table is read with S0027' do
111
110
  with_site(:connected, sxl: '>=1.0.13') do |site_proxy|
112
111
  site_proxy.request_status_and_collect({ S0027: [:status] },
113
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
112
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
114
113
  end
115
114
  end
116
115
 
@@ -123,7 +122,7 @@ describe 'Site::Tlc::SignalPlans' do
123
122
  with_site(:connected, sxl: '>=1.0.13') do |site_proxy|
124
123
  status = '12-1-12-59,1-0-23-12'
125
124
  timeout = RSMP::Validator.get_config('timeouts', 'command_response')
126
- site_proxy.tlc.set_day_table(status, within: timeout)
125
+ site_proxy.tlc.set_day_table!(status, within: timeout)
127
126
  end
128
127
  end
129
128
 
@@ -135,7 +134,7 @@ describe 'Site::Tlc::SignalPlans' do
135
134
  it 'version is read with S0097' do
136
135
  with_site(:connected, sxl: '>=1.0.15') do |site_proxy|
137
136
  site_proxy.request_status_and_collect({ S0097: %i[timestamp checksum] },
138
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
137
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
139
138
  end
140
139
  end
141
140
 
@@ -148,12 +147,11 @@ describe 'Site::Tlc::SignalPlans' do
148
147
  it 'config is read with S0098' do
149
148
  with_site(:connected, sxl: '>=1.0.15') do |site_proxy|
150
149
  timeout = RSMP::Validator.get_config('timeouts', 'status_response')
151
- collector = site_proxy.request_status_and_collect(
150
+ exchange = site_proxy.request_status_and_collect(
152
151
  { S0098: %i[timestamp config version] },
153
152
  within: timeout
154
- )
155
- collector.ok!
156
- ss = collector.messages.last.attributes['sS']
153
+ ).value!
154
+ ss = exchange.messages.last.attributes['sS']
157
155
  values = ss.to_h { |i| [i['n'], i['s']] }
158
156
 
159
157
  assert(!values['timestamp'].empty?, 'expected timestamp to not be empty')
@@ -170,7 +168,7 @@ describe 'Site::Tlc::SignalPlans' do
170
168
  it 'dynamic bands are read with S0023' do
171
169
  with_site(:connected, sxl: '>=1.0.13') do |site_proxy|
172
170
  site_proxy.request_status_and_collect({ S0023: [:status] },
173
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
171
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
174
172
  end
175
173
  end
176
174
 
@@ -184,7 +182,7 @@ describe 'Site::Tlc::SignalPlans' do
184
182
  plan = RSMP::Validator.get_config('items', 'plans').first
185
183
  status = '1-12'
186
184
  timeout = RSMP::Validator.get_config('timeouts', 'command_response')
187
- site_proxy.tlc.set_dynamic_bands(plan: plan, status: status, within: timeout)
185
+ site_proxy.tlc.set_dynamic_bands!(plan: plan, status: status, within: timeout)
188
186
  end
189
187
  end
190
188
 
@@ -202,17 +200,17 @@ describe 'Site::Tlc::SignalPlans' do
202
200
  plan = RSMP::Validator.get_config('items', 'plans').first
203
201
  band = 3
204
202
 
205
- value = site_proxy.tlc.read_dynamic_band(plan: plan, band: band) || 0
203
+ value = site_proxy.tlc.read_dynamic_band!(plan: plan, band: band) || 0
206
204
  expect(value).to be_a(Integer)
207
205
 
208
206
  new_value = value + 1
209
207
 
210
208
  timeout = RSMP::Validator.get_config('timeouts', 'command_response')
211
- site_proxy.tlc.set_dynamic_bands(plan: plan, status: "#{band}-#{new_value}", within: timeout)
212
- expect(site_proxy.tlc.read_dynamic_band(plan: plan, band: band)).to eq(new_value)
209
+ site_proxy.tlc.set_dynamic_bands!(plan: plan, status: "#{band}-#{new_value}", within: timeout)
210
+ expect(site_proxy.tlc.read_dynamic_band!(plan: plan, band: band)).to eq(new_value)
213
211
 
214
- site_proxy.tlc.set_dynamic_bands(plan: plan, status: "#{band}-#{value}", within: timeout)
215
- expect(site_proxy.tlc.read_dynamic_band(plan: plan, band: band)).to eq(value)
212
+ site_proxy.tlc.set_dynamic_bands!(plan: plan, status: "#{band}-#{value}", within: timeout)
213
+ expect(site_proxy.tlc.read_dynamic_band!(plan: plan, band: band)).to eq(value)
216
214
  end
217
215
  end
218
216
 
@@ -224,12 +222,12 @@ describe 'Site::Tlc::SignalPlans' do
224
222
  # 2. When we send command to disable timeout
225
223
  # 3. Then we should get a confirmation
226
224
  it 'timeout for dynamic bands is set with M0023' do
227
- with_site(:connected, sxl: '>=1.1') do |site_proxy|
225
+ with_site(:connected, sxl: '>=1.1.0') do |site_proxy|
228
226
  timeout = RSMP::Validator.get_config('timeouts', 'command_response')
229
227
  status = 10
230
- site_proxy.tlc.set_dynamic_bands_timeout(status, within: timeout)
228
+ site_proxy.tlc.set_dynamic_bands_timeout!(status, within: timeout)
231
229
  status = 0
232
- site_proxy.tlc.set_dynamic_bands_timeout(status, within: timeout)
230
+ site_proxy.tlc.set_dynamic_bands_timeout!(status, within: timeout)
233
231
  end
234
232
  end
235
233
 
@@ -241,7 +239,7 @@ describe 'Site::Tlc::SignalPlans' do
241
239
  it 'offset is read with S0024' do
242
240
  with_site(:connected, sxl: '>=1.0.13') do |site_proxy|
243
241
  site_proxy.request_status_and_collect({ S0024: [:status] },
244
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
242
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
245
243
  end
246
244
  end
247
245
 
@@ -253,7 +251,7 @@ describe 'Site::Tlc::SignalPlans' do
253
251
  plan = RSMP::Validator.get_config('items', 'plans').first
254
252
  offset = 99
255
253
  timeout = RSMP::Validator.get_config('timeouts', 'command_response')
256
- site_proxy.tlc.set_offset(plan: plan, offset: offset, within: timeout)
254
+ site_proxy.tlc.set_offset!(plan: plan, offset: offset, within: timeout)
257
255
  end
258
256
  end
259
257
 
@@ -265,7 +263,7 @@ describe 'Site::Tlc::SignalPlans' do
265
263
  it 'cycle time is read with S0028' do
266
264
  with_site(:connected, sxl: '>=1.0.13') do |site_proxy|
267
265
  site_proxy.request_status_and_collect({ S0028: [:status] },
268
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
266
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
269
267
  end
270
268
  end
271
269
 
@@ -1,7 +1,7 @@
1
1
  describe 'Site::Tlc::SignalPriority' do
2
2
  include RSMP::Validator::Helpers::Status
3
3
 
4
- # Signal requests require core >= 3.2 because they uses the Array data type.
4
+ # Signal requests require core >= 3.2.0 because they use the Array data type.
5
5
 
6
6
  # Validate that a signal priority can be requested.
7
7
  #
@@ -9,7 +9,7 @@ describe 'Site::Tlc::SignalPriority' do
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
12
- with_site(:connected, core: '>=3.2', sxl: '>=1.1') do |site_proxy|
12
+ with_site(:connected, core: '>=3.2.0', sxl: '>=1.1.0') do |site_proxy|
13
13
  signal_group = RSMP::Validator.get_config('components', 'signal_group').keys.first
14
14
  command_list = RSMP::CommandList.new(:M0022, :requestPriority,
15
15
  requestId: SecureRandom.uuid[0..3],
@@ -20,7 +20,7 @@ describe 'Site::Tlc::SignalPriority' do
20
20
  vehicleType: 'car').to_a
21
21
  log "Request signal priority for signal group #{signal_group}"
22
22
  timeout = RSMP::Validator.get_config('timeouts', 'command_response')
23
- site_proxy.send_command_and_collect(command_list, within: timeout).ok!
23
+ site_proxy.send_command_and_collect(command_list, within: timeout).value!
24
24
  end
25
25
  end
26
26
 
@@ -30,9 +30,9 @@ describe 'Site::Tlc::SignalPriority' do
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
33
- with_site(:connected, core: '>=3.2', sxl: '>=1.1') do |site_proxy|
33
+ with_site(:connected, core: '>=3.2.0', sxl: '>=1.1.0') do |site_proxy|
34
34
  site_proxy.request_status_and_collect({ S0033: [:status] },
35
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
35
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
36
36
  end
37
37
  end
38
38
 
@@ -43,7 +43,7 @@ describe 'Site::Tlc::SignalPriority' do
43
43
  # 4. Then we should receive an acknowledgement
44
44
  # 5. And we should reive a status updates
45
45
  it 'status can be subscribed to with S0033' do
46
- with_site(:connected, core: '>=3.2', sxl: '>=1.1') do |site_proxy|
46
+ with_site(:connected, core: '>=3.2.0', sxl: '>=1.1.0') do |site_proxy|
47
47
  status_list = [{ 'sCI' => 'S0033', 'n' => 'status', 'uRt' => '0' }]
48
48
  status_list.map! { |item| item.merge!('sOc' => true) } if site_proxy.tlc.use_soc?
49
49
  wait_for_status(site_proxy, 'signal priority status', status_list)
@@ -61,7 +61,7 @@ describe 'Site::Tlc::SignalPriority' do
61
61
  # 7. Then the state should become 'completed'
62
62
 
63
63
  it 'becomes completed when cancelled' do
64
- with_site(:connected, core: '>=3.2', sxl: '>=1.1') do |site_proxy|
64
+ with_site(:connected, core: '>=3.2.0', sxl: '>=1.1.0') do |site_proxy|
65
65
  timeout = RSMP::Validator.get_config('timeouts', 'priority_completion')
66
66
  component = RSMP::Validator.get_config('main_component')
67
67
  signal_group_id = RSMP::Validator.get_config('components', 'signal_group').keys.first
@@ -69,8 +69,7 @@ describe 'Site::Tlc::SignalPriority' do
69
69
  site_proxy,
70
70
  component: component,
71
71
  signal_group_id: signal_group_id,
72
- timeout: timeout,
73
- task: Async::Task.current
72
+ timeout: timeout
74
73
  )
75
74
 
76
75
  prio.run do
@@ -107,7 +106,7 @@ describe 'Site::Tlc::SignalPriority' do
107
106
  # 7. Then the state should become 'stale'
108
107
 
109
108
  it 'becomes stale if not cancelled' do
110
- with_site(:connected, core: '>=3.2', sxl: '>=1.1') do |site_proxy|
109
+ with_site(:connected, core: '>=3.2.0', sxl: '>=1.1.0') do |site_proxy|
111
110
  timeout = RSMP::Validator.get_config('timeouts', 'priority_completion')
112
111
  component = RSMP::Validator.get_config('main_component')
113
112
  signal_group_id = RSMP::Validator.get_config('components', 'signal_group').keys.first
@@ -115,8 +114,7 @@ describe 'Site::Tlc::SignalPriority' do
115
114
  site_proxy,
116
115
  component: component,
117
116
  signal_group_id: signal_group_id,
118
- timeout: timeout,
119
- task: Async::Task.current
117
+ timeout: timeout
120
118
  )
121
119
 
122
120
  prio.run do
@@ -19,10 +19,10 @@ describe 'Site::Tlc::Subscribe' do
19
19
 
20
20
  site_proxy.subscribe_to_status_and_collect(status_list,
21
21
  component: component,
22
- within: RSMP::Validator.get_config('timeouts', 'status_update')).ok!
22
+ within: RSMP::Validator.get_config('timeouts', 'status_update')).value!
23
23
  ensure
24
24
  unsubscribe_list = status_list.map { |item| item.slice('sCI', 'n') }
25
- site_proxy.unsubscribe_to_status unsubscribe_list, component: component
25
+ site_proxy.unsubscribe_to_status! unsubscribe_list, component: component
26
26
  end
27
27
  end
28
28
 
@@ -45,7 +45,7 @@ describe 'Site::Tlc::Subscribe' do
45
45
  initial_status_list.map! { |item| item.merge!('sOc' => true) } if site_proxy.tlc.use_soc?
46
46
 
47
47
  # Subscribe but don't wait for updates (since 60s is too long)
48
- site_proxy.subscribe_to_status initial_status_list, component: component
48
+ site_proxy.subscribe_to_status! initial_status_list, component: component
49
49
  log 'Initial subscription with 60s update rate successful'
50
50
 
51
51
  # Step 3: Change update rate to 1s by re-subscribing and verify we get update within 2s
@@ -54,18 +54,18 @@ describe 'Site::Tlc::Subscribe' do
54
54
  updated_status_list.map! { |item| item.merge!('sOc' => true) } if site_proxy.tlc.use_soc?
55
55
 
56
56
  # This should collect at least one status update within 2s if the 1s rate is working
57
- collector = site_proxy.subscribe_to_status_and_collect(updated_status_list,
58
- component: component,
59
- within: 2).ok!
57
+ exchange = site_proxy.subscribe_to_status_and_collect(updated_status_list,
58
+ component: component,
59
+ within: 2).value!
60
60
 
61
- assert(!collector.nil?, 'Expected subscribe_to_status_and_collect to return a collector')
62
- assert(!collector.messages.empty?,
61
+ assert(!exchange.nil?, 'Expected subscribe_to_status_and_collect to return an exchange')
62
+ assert(!exchange.messages.empty?,
63
63
  'Expected to receive status update within 2s with new 1s update rate')
64
64
  log 'Successfully received status update within 2s, confirming 1s update rate is active'
65
65
  ensure
66
66
  # Clean up subscription
67
67
  unsubscribe_list = [{ 'sCI' => 'S0001', 'n' => 'cyclecounter' }]
68
- site_proxy.unsubscribe_to_status unsubscribe_list, component: component
68
+ site_proxy.unsubscribe_to_status! unsubscribe_list, component: component
69
69
  end
70
70
  end
71
71
  end
@@ -8,13 +8,13 @@ describe 'Site::Tlc::System' do
8
8
  # 3. Expect status response before timeout
9
9
  it 'operator logged in/out of OP-panel is read with S0091' do
10
10
  with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
11
- status_list = if RSMP::Proxy.version_meets_requirement?(site_proxy.sxl_version, '>=1.1')
11
+ status_list = if RSMP::Proxy.version_meets_requirement?(site_proxy.sxl_version, '>=1.1.0')
12
12
  { S0091: [:user] }
13
13
  else
14
14
  { S0091: %i[user status] }
15
15
  end
16
16
  site_proxy.request_status_and_collect(status_list,
17
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
17
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
18
18
  end
19
19
  end
20
20
 
@@ -25,13 +25,13 @@ describe 'Site::Tlc::System' do
25
25
  # 3. Expect status response before timeout
26
26
  it 'operator logged in/out of web-interface is read with S0092' do
27
27
  with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
28
- status_list = if RSMP::Proxy.version_meets_requirement?(site_proxy.sxl_version, '>=1.1')
28
+ status_list = if RSMP::Proxy.version_meets_requirement?(site_proxy.sxl_version, '>=1.1.0')
29
29
  { S0092: [:user] }
30
30
  else
31
31
  { S0092: %i[user status] }
32
32
  end
33
33
  site_proxy.request_status_and_collect(status_list,
34
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
34
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
35
35
  end
36
36
  end
37
37
 
@@ -43,7 +43,7 @@ describe 'Site::Tlc::System' do
43
43
  it 'version is read with S0095' do
44
44
  with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
45
45
  site_proxy.request_status_and_collect({ S0095: [:status] },
46
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
46
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
47
47
  end
48
48
  end
49
49
 
@@ -57,20 +57,22 @@ describe 'Site::Tlc::System' do
57
57
  code1 = RSMP::Validator.get_config('secrets', 'security_codes', 1)
58
58
  code2 = RSMP::Validator.get_config('secrets', 'security_codes', 2)
59
59
  timeout = RSMP::Validator.get_config('timeouts', 'command_response')
60
- site_proxy.tlc.set_security_code(level: 'Level1', old_code: code1, new_code: code1, within: timeout)
61
- site_proxy.tlc.set_security_code(level: 'Level2', old_code: code2, new_code: code2, within: timeout)
60
+ site_proxy.tlc.set_security_code!(level: 'Level1', old_code: code1, new_code: code1, within: timeout)
61
+ site_proxy.tlc.set_security_code!(level: 'Level2', old_code: code2, new_code: code2, within: timeout)
62
62
  end
63
63
  end
64
64
 
65
65
  # Verify that the site_proxy responds with NotAck if we send incorrect security cdoes.
66
- # RThis hehaviour is defined in SXL >= 1.1. For earlier versions,
66
+ # This behaviour is defined in SXL >= 1.1.0. For earlier versions,
67
67
  # The behaviour is undefined.
68
68
  # 1. Given the site_proxy 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
- with_site(:connected, sxl: '>=1.1') do |site_proxy|
73
- expect { wrong_security_code(site_proxy) }.to raise_exception(RSMP::MessageRejected)
72
+ with_site(:connected, sxl: '>=1.1.0') do |site_proxy|
73
+ result = wrong_security_code(site_proxy)
74
+ expect(result).to be_a(RSMP::Result::Failure)
75
+ expect(result.failure.code).to eq(:message_rejected) if result.failure?
74
76
  end
75
77
  end
76
78
  end
@@ -13,7 +13,7 @@ describe 'Site::Tlc::TrafficData' do
13
13
  { S0201: %i[starttime vehicles] },
14
14
  component: component,
15
15
  within: RSMP::Validator.get_config('timeouts', 'status_response')
16
- ).ok!
16
+ ).value!
17
17
  end
18
18
  end
19
19
 
@@ -25,7 +25,7 @@ describe 'Site::Tlc::TrafficData' do
25
25
  it 'number of vehicles for all detectors is read with S0205' do
26
26
  with_site(:connected, sxl: '>=1.0.14') do |site_proxy|
27
27
  site_proxy.request_status_and_collect({ S0205: %i[start vehicles] },
28
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
28
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
29
29
  end
30
30
  end
31
31
 
@@ -41,7 +41,7 @@ describe 'Site::Tlc::TrafficData' do
41
41
  { S0202: %i[starttime speed] },
42
42
  component: component,
43
43
  within: RSMP::Validator.get_config('timeouts', 'status_response')
44
- ).ok!
44
+ ).value!
45
45
  end
46
46
  end
47
47
 
@@ -53,7 +53,7 @@ describe 'Site::Tlc::TrafficData' do
53
53
  it 'vehicle speed for all detectors is read with S0206' do
54
54
  with_site(:connected, sxl: '>=1.0.14') do |site_proxy|
55
55
  site_proxy.request_status_and_collect({ S0206: %i[start speed] },
56
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
56
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
57
57
  end
58
58
  end
59
59
 
@@ -69,7 +69,7 @@ describe 'Site::Tlc::TrafficData' do
69
69
  { S0203: %i[starttime occupancy] },
70
70
  component: component,
71
71
  within: RSMP::Validator.get_config('timeouts', 'status_response')
72
- ).ok!
72
+ ).value!
73
73
  end
74
74
  end
75
75
 
@@ -80,19 +80,30 @@ describe 'Site::Tlc::TrafficData' do
80
80
  # 3. Expect status response before timeout
81
81
  it 'occupancy for all detectors is read with S0207' do
82
82
  with_site(:connected, sxl: '>=1.0.14') do |site_proxy|
83
- result = wait_for_status(site_proxy, 'traffic counting: occupancy',
84
- { S0207: %i[start occupancy] },
85
- update_rate: 60)
83
+ exchange = wait_for_status(site_proxy, 'traffic counting: occupancy',
84
+ { S0207: %i[start occupancy] },
85
+ update_rate: 60)
86
+ values = exchange.reached.to_h { |item| [item['n'], item['s']] }
86
87
 
87
- occupancies = result.matcher_got_hash.dig('S0207', 'occupancy')
88
- start = result.matcher_got_hash.dig('S0207', 'start')
88
+ occupancies = values['occupancy']
89
+ start = values['start']
89
90
 
90
- expect(occupancies).to be_a(String)
91
91
  expect(start).to be_a(String)
92
92
 
93
- occupancies.split(',').each do |occupancy|
94
- num = occupancy.to_i
95
- assert((-1..100).cover?(num), "Occupancy must be in the range -1..100, got #{num}")
93
+ occupancy_values = if RSMP::Validator.sxl_matches?('<1.1.0')
94
+ expect(occupancies).to be_a(String)
95
+ occupancies.split(',').map do |occupancy|
96
+ assert(occupancy.match?(/\A-?\d+\z/), "Occupancy must be an Integer, got #{occupancy}")
97
+ occupancy.to_i
98
+ end
99
+ else
100
+ expect(occupancies).to be_a(Array)
101
+ occupancies
102
+ end
103
+
104
+ occupancy_values.each do |occupancy|
105
+ assert(occupancy.is_a?(Integer), "Occupancy must be an Integer, got #{occupancy.class}")
106
+ assert((-1..100).cover?(occupancy), "Occupancy must be in the range -1..100, got #{occupancy}")
96
107
  end
97
108
  end
98
109
  end
@@ -120,7 +131,7 @@ describe 'Site::Tlc::TrafficData' do
120
131
  ] },
121
132
  component: component,
122
133
  within: RSMP::Validator.get_config('timeouts', 'status_response')
123
- ).ok!
134
+ ).value!
124
135
  end
125
136
  end
126
137
 
@@ -145,7 +156,7 @@ describe 'Site::Tlc::TrafficData' do
145
156
  F
146
157
  ] },
147
158
  within: RSMP::Validator.get_config('timeouts', 'status_response')
148
- ).ok!
159
+ ).value!
149
160
  end
150
161
  end
151
162
  end
@@ -6,13 +6,13 @@ describe 'Site::Tlc::TrafficSituations' do
6
6
  # 3. Expect status response before timeout
7
7
  it 'is read with S0015' do
8
8
  with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
9
- status_list = if RSMP::Proxy.version_meets_requirement?(site_proxy.sxl_version, '>=1.1')
9
+ status_list = if RSMP::Proxy.version_meets_requirement?(site_proxy.sxl_version, '>=1.1.0')
10
10
  { S0015: %i[status source] }
11
11
  else
12
12
  { S0015: [:status] }
13
13
  end
14
14
  site_proxy.request_status_and_collect(status_list,
15
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
15
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
16
16
  end
17
17
  end
18
18
 
@@ -29,10 +29,10 @@ describe 'Site::Tlc::TrafficSituations' do
29
29
  timeout = RSMP::Validator.get_config('timeouts', 'command')
30
30
  with_site(:connected) do |site_proxy|
31
31
  situations.each do |traffic_situation|
32
- assert site_proxy.tlc.set_traffic_situation(traffic_situation.to_s, within: timeout)
32
+ assert site_proxy.tlc.set_traffic_situation!(traffic_situation.to_s, within: timeout)
33
33
  end
34
34
  ensure
35
- site_proxy.tlc.unset_traffic_situation(within: timeout)
35
+ site_proxy.tlc.unset_traffic_situation!(within: timeout)
36
36
  end
37
37
  end
38
38
 
@@ -44,7 +44,7 @@ describe 'Site::Tlc::TrafficSituations' do
44
44
  it 'list size is read with S0019' do
45
45
  with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
46
46
  site_proxy.request_status_and_collect({ S0019: [:number] },
47
- within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
47
+ within: RSMP::Validator.get_config('timeouts', 'status_response')).value!
48
48
  end
49
49
  end
50
50
  end
@@ -10,9 +10,7 @@ describe 'Supervisor' do
10
10
  end
11
11
 
12
12
  def prepare_and_wait_for_collector(supervisor_proxy)
13
- collector = supervisor_proxy.collector
14
- collector.use_task Async::Task.current
15
- collector.wait!
13
+ supervisor_proxy.collector.wait!
16
14
  end
17
15
 
18
16
  def direction_and_type_pairs(messages)
@@ -23,13 +21,12 @@ describe 'Supervisor' do
23
21
  timeout = RSMP::Validator.get_config('timeouts', 'ready')
24
22
  got_messages = nil
25
23
  with_supervisor(:isolated,
26
- 'rsmp_versions' => [core_version],
24
+ 'core_version' => core_version,
27
25
  'collect' => {
28
26
  **connection_collect_options(timeout, length)
29
27
  }) do |supervisor_proxy|
30
- prepare_and_wait_for_collector(supervisor_proxy)
28
+ got_messages = prepare_and_wait_for_collector(supervisor_proxy)
31
29
  assert(supervisor_proxy.ready?, 'expected site proxy to be ready')
32
- got_messages = supervisor_proxy.collector.messages
33
30
  end
34
31
  direction_and_type_pairs(got_messages)
35
32
  rescue Async::TimeoutError
@@ -108,7 +105,7 @@ describe 'Supervisor' do
108
105
  case version
109
106
  when '3.1.1', '3.1.2', '3.1.3'
110
107
  check_sequence_v311 version
111
- when '3.1.4', '3.1.5', '3.2', '3.2.1', '3.2.2'
108
+ when '3.1.4', '3.1.5', '3.2.0', '3.2.1', '3.2.2'
112
109
  check_sequence_v314 version
113
110
  when '3.3.0'
114
111
  check_sequence_v330 version
@@ -172,15 +169,15 @@ describe 'Supervisor' do
172
169
  check_sequence '3.1.5'
173
170
  end
174
171
 
175
- # Verify the connection sequence when using rsmp core 3.2
172
+ # Verify the connection sequence when using rsmp core 3.2.0
176
173
  #
177
- # 1. Given the site is connected and using core 3.2
174
+ # 1. Given the site is connected and using core 3.2.0
178
175
  # 2. Send and receive handshake messages
179
176
  # 3. Expect the handshake messages to be in the specified sequence corresponding to version 3.1.5
180
177
  # 4. Expect the connection sequence to be complete
181
- it 'exchanges correct connection sequence of rsmp version 3.2' do
182
- skip 'requires core == 3.2' unless RSMP::Validator.core_matches?('3.2')
183
- check_sequence '3.2'
178
+ it 'exchanges correct connection sequence of rsmp version 3.2.0' do
179
+ skip 'requires core == 3.2.0' unless RSMP::Validator.core_matches?('3.2.0')
180
+ check_sequence '3.2.0'
184
181
  end
185
182
 
186
183
  # Verify the connection sequence when using rsmp core 3.2.1