Class: SeleniumGrid::Hub

Inherits:
Object
  • Object
show all
Includes:
Singleton, Utils
Defined in:
lib/selenium-grid/hub.rb

Constant Summary collapse

HUB_PORT =
4444

Instance Method Summary collapse

Instance Method Details

#listObject



29
30
31
# File 'lib/selenium-grid/hub.rb', line 29

def list
  running? ? { HUB_PORT.to_s => "hub" } : {} 
end

#running?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/selenium-grid/hub.rb', line 33

def running?
  Netstat.instance.running?(HUB_PORT)
end

#start(overrides = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/selenium-grid/hub.rb', line 10

def start(overrides = {})
  classpath = Java::Classpath.new(File.join(File.dirname(__FILE__), %w(.. ..)))
  classpath = classpath << "." << "lib/openqa/selenium-grid-hub-standalone-*.jar"

  requirements = {
    :classpath => classpath.definition,
    :log => ENV['LOG'] || overrides[:log] || File.join(".", "log", "hub.log")
  }
  options = {
    :background => ENV['BACKGROUND'] || false
  }.merge(overrides).merge(requirements)

  Java::VM.new.run "com.thoughtworks.selenium.grid.hub.HubServer", options
end

#stopObject



25
26
27
# File 'lib/selenium-grid/hub.rb', line 25

def stop
  Lsof.kill(HUB_PORT)
end