Skip to content

Instantly share code, notes, and snippets.

@mykecameron
Created December 7, 2011 20:48
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 mykecameron/1444578 to your computer and use it in GitHub Desktop.
Save mykecameron/1444578 to your computer and use it in GitHub Desktop.
sagamore agent test script
#!/usr/bin/env ruby
HOST = "http://192.168.2.139:8001"
require 'rubygems'
require 'json'
require 'uuidtools'
require 'typhoeus'
# ping_listen_request = Typhoeus::Request.new "#{HOST}/handlers/ping/messages",
# :method => "get",
# :params => {
# :_method => "get",
# :_callback => "pingListenCallback",
# :_1323298923115 => ""
# },
# :timeout => 60000
# body = {
# :type => "ping",
# :id => UUIDTools::UUID.timestamp_create,
# }
# ping_request = Typhoeus::Request.new "#{HOST}/handlers/ping/messages",
# :method => "get",
# :params => {
# :_body => JSON.dump(body),
# :_method => "post",
# :_callback => "jsonpCallback",
# :_1323298923114 => ""
# }
# body = {
# :type => "print",
# :id => UUIDTools::UUID.timestamp_create,
# :data => {
# :sales_transaction_id => '363644'
# }
# }
# print_request = Typhoeus::Request.new "#{HOST}/handlers/station_1.receipt_printer/messages",
# :method => "get",
# :params => {
# :_body => JSON.dump(body),
# :_method => "post",
# :_callback => "jsonpCallback",
# :_1323298923112 => ""
# }
# listen_request = Typhoeus::Request.new "#{HOST}/handlers/station_1.*/messages",
# :method => "get",
# :params => {
# :_method => "get",
# :_callback => "listenCallback",
# :_1323298923113 => ""
# },
# :timeout => 60000
# hydra = Typhoeus::Hydra.new
# Thread.new do
# hydra = Typhoeus::Hydra.new
# hydra.queue ping_listen_request
# hydra.queue ping_request
# hydra.run
# end
# sleep 1
# hydra = Typhoeus::Hydra.new
# hydra.queue print_request
# hydra.run
#----------------------------------------------------------------------------------------------------------------
# ping_listen_request = Typhoeus::Request.new "#{HOST}/handlers/ping/messages?_method=get&_callback=_jqjsp&_1323299460280=", :method => "get"
# ping_request = Typhoeus::Request.new "#{HOST}/handlers/ping/messages?_body=%7B%22type%22%3A%22ping%22%2C%22id%22%3A%2245a33c7e-f846-4277-8a4a-ceb8dfe61c2f%22%7D&_method=post&_callback=_jqjsp&_1323299460288=", :method => "get"
# hydra = Typhoeus::Hydra.new
# hydra.queue ping_listen_request
# hydra.queue ping_request
# hydra.run
#----------------------------------------------------------------------------------------------------------------
request = Typhoeus::Request.new "#{HOST}/handlers/station_1.*/messages?_method=get&_callback=_jqjsp&_1323300300336=", :method => "get"
hydra = Typhoeus::Hydra.new
hydra.queue request
hydra.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment