Skip to content

Instantly share code, notes, and snippets.

@nathanl
Created October 23, 2014 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanl/b28abccd7fb243b9cafd to your computer and use it in GitHub Desktop.
Save nathanl/b28abccd7fb243b9cafd to your computer and use it in GitHub Desktop.
Test pathfinding
# This can be run from the voltron directory while the NetSkycanner has a couple of `rake pathfinder` processes running
require 'bundler/setup'
Bundler.require :default, :pathfinder
require 'json'
require 'thump'
require 'mr_sulu_messages'
test = "searching"
t = Thump::Tunnel.new
case test
when "searching"
puts "going to send a search"
t.listen('mr_sulu.search.events', 'bh.paths.recorder') do |_, __, payload|
puts "search came back with payload:"
puts JSON.parse(payload).inspect
end
search = MrSuluMessages::Search.new( from: [28.9453, -13.605],
from_name: "Arrecife Flughafen (ACE)",
from_type: :station,
to: [5.6, -0.166667],
to_name: "Accra (ACC)",
to_type: :station )
t.send("mr_sulu.vehicles.plane", search.to_hash)
puts "sent a search"
when "reloading"
puts "going to say to reload"
t.send("mr_sulu.bots.reload.NetSkyscanner", 1)
puts "said to reload"
end
sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment