Sha256: 94f024999c201d195b1ba48d26c2f3c24871d1cee3f34ba4f3701a1961d4a4ae

Contents?: true

Size: 781 Bytes

Versions: 5

Compression:

Stored size: 781 Bytes

Contents

module SGrid

  class Hub
    
    def initialize(options={})
      @host = options[:host] || "localhost"
      @port = (options[:port] || "4444").to_i
    end
    
    def start(options={})
      root = File.expand_path(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",
                        options.merge(:classpath => classpath.definition)
    end

    def wait_until_up_and_running
      TCPSocket.wait_for_service :host => @host, :port => @port
    end

    def shutdown
      http = Net::HTTP.new(@host, @port)
      http.post('/lifecycle-manager', "action=shutdown")
    end
    
  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
selenium-rspec-dsl-1.0.2 vendor/selenium-grid-1.0.4/lib/ruby/s_grid/hub.rb
statt-0.0.4 lib/selenium-grid/lib/ruby/s_grid/hub.rb
statt-0.0.3 lib/selenium-grid/lib/ruby/s_grid/hub.rb
statt-0.0.2 lib/selenium-grid/lib/ruby/s_grid/hub.rb
statt-0.0.1 lib/selenium-grid/lib/ruby/s_grid/hub.rb