Specifications:

  • Traffic Light Controller Signal Priority can be requested with M0022

    Validate that a signal priority can be requested.

    1. Given the site is connected

    2. When we send a signal priority request

    3. Then we should receive an acknowledgement

    
    
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    # File 'spec/site/tlc/signal_priority_spec.rb', line 13
    
    Validator::Site.connected do |task,supervisor,site|
            signal_group = Validator.get_config('components','signal_group').keys.first
            command_list = build_command_list :M0022, :requestPriority, {
              requestId: SecureRandom.uuid()[0..3],
              signalGroupId: signal_group,
              type: 'new',
              level: 7,
              eta: 10,
              vehicleType: 'car'
            }
            prepare task, site
            send_command_and_confirm @task, command_list,
              "Request signal priority for signal group #{signal_group}"
          end
  • Traffic Light Controller Signal Priority status can be fetched with S0033

    Validate that signal priority status can be requested.

    1. Given the site is connected

    2. When we request signal priority status

    3. Then we should receive a status update

    
    
    35
    36
    37
    38
    # File 'spec/site/tlc/signal_priority_spec.rb', line 35
    
    Validator::Site.connected do |task,supervisor,site|
            request_status_and_confirm site, "signal group status",
              { S0033: [:status] }
          end
  • Traffic Light Controller Signal Priority status can be subscribed to with S0033

    Validate that we can subscribe signal priority status

    1. Given the site is connected

    2. And we subscribe to signal priority status updates

    3. Then we should receive an acknowledgement

    4. And we should reive a status updates

    
    
    48
    49
    50
    51
    52
    53
    # File 'spec/site/tlc/signal_priority_spec.rb', line 48
    
    Validator::Site.connected do |task,supervisor,site|
            prepare task, site
            status_list = [{'sCI'=>'S0033','n'=>'status','uRt'=>'0'}]
            status_list.map! { |item| item.merge!('sOc' => true) } if use_sOc?(site)
            wait_for_status task, 'signal priority status', status_list
          end
  • Traffic Light Controller Signal Priority becomes completed when cancelled

    Validate that a signal priority completes when we cancel it.

    1. Given the site is connected

    2. And we subscribe to signal priority status

    3. When we send a signal priority request

    4. Then the request state should become ‘received’

    5. Then the request state should become ‘activated’

    6. When we cancel the request

    7. Then the state should become ‘completed’

    
    
    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
    # File 'spec/site/tlc/signal_priority_spec.rb', line 67
    
    Validator::Site.connected do |task,supervisor,site|
            timeout = Validator.get_config('timeouts','priority_completion')
            component = Validator.get_config('main_component')
            signal_group_id = Validator.get_config('components','signal_group').keys.first
            prio = Validator::StatusHelpers::SignalPriorityRequestHelper.new(
              site,
              component: component,
              signal_group_id: signal_group_id,
              timeout: timeout,
              task: task
            )
    
            prio.run do
              log "Before: Send unrelated signal priority request."
              prio.request_unrelated
    
              log "Send signal priority request, wait for reception."
              prio.request
    
              log "After: Send unrelated signal priority request."
              prio.request_unrelated
    
              prio.expect :received
              log "Signal priority request was received, wait for activation."
    
              prio.expect :activated
              log "Signal priority request was activated, now cancel it and wait for completion."
    
    
              prio.cancel
              prio.expect :completed
              log "Signal priority request was completed."
            end
          end
  • Traffic Light Controller Signal Priority becomes stale if not cancelled

    Validate that a signal priority times out if not cancelled.

    1. Given the site is connected

    2. And we subscribe to signal priority status

    3. When we send a signal priority request

    4. Then the request state should become ‘received’

    5. Then the request state should become ‘activated’

    6. When we do not cancel the request

    7. Then the state should become ‘stale’

    
    
    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
    # File 'spec/site/tlc/signal_priority_spec.rb', line 114
    
    Validator::Site.connected do |task,supervisor,site|
            timeout = Validator.get_config('timeouts','priority_completion')
            component = Validator.get_config('main_component')
            signal_group_id = Validator.get_config('components','signal_group').keys.first
            prio = Validator::StatusHelpers::SignalPriorityRequestHelper.new(
              site,
              component: component,
              signal_group_id: signal_group_id,
              timeout: timeout,
              task: task
            )
    
            prio.run do
              log "Before: Send unrelated signal priority request."
              prio.request_unrelated
    
              log "Send signal priority request, wait for reception."
              prio.request
    
              log "After: Send unrelated signal priority request."
              prio.request_unrelated
    
              prio.expect :received
              log "Signal priority request was received, wait for activation."
    
              prio.expect :activated
              log "Signal priority request was activated, wait for it to become stale."
    
    
              # don't cancel request, it should then become stale by itself
              prio.expect :stale
              log "Signal priority request became stale."
            end
          end