Class: SGrid::Hub
- Inherits:
-
Object
- Object
- SGrid::Hub
- Defined in:
- lib/selenium-grid/lib/ruby/s_grid/hub.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Hub
constructor
A new instance of Hub.
- #shutdown ⇒ Object
- #start(options = {}) ⇒ Object
- #wait_until_up_and_running ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Hub
Returns a new instance of Hub.
5 6 7 8 |
# File 'lib/selenium-grid/lib/ruby/s_grid/hub.rb', line 5 def initialize(={}) @host = [:host] || "localhost" @port = ([:port] || "4444").to_i end |
Instance Method Details
#shutdown ⇒ Object
22 23 24 25 |
# File 'lib/selenium-grid/lib/ruby/s_grid/hub.rb', line 22 def shutdown http = Net::HTTP.new(@host, @port) http.post('/lifecycle-manager', "action=shutdown") end |
#start(options = {}) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/selenium-grid/lib/ruby/s_grid/hub.rb', line 10 def start(={}) root = File.(File.dirname(__FILE__) + "/../../..") classpath = Java::Classpath.new(root) classpath = classpath << "." << "lib/selenium-grid-hub-standalone-*.jar" Java::VM.new.run "com.thoughtworks.selenium.grid.hub.HubServer", .merge(:classpath => classpath.definition) end |
#wait_until_up_and_running ⇒ Object
18 19 20 |
# File 'lib/selenium-grid/lib/ruby/s_grid/hub.rb', line 18 def wait_until_up_and_running TCPSocket.wait_for_service :host => @host, :port => @port end |