watirgrid 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ begin
9
9
  gem.email = "tim.koops@gmail.com"
10
10
  gem.homepage = "http://github.com/90kts/watirgrid"
11
11
  gem.authors = ["Tim Koopmans"]
12
- gem.version = "1.0.0"
12
+ gem.version = "1.0.1"
13
13
  end
14
14
  rescue LoadError
15
15
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
data/lib/watirgrid.rb CHANGED
@@ -14,10 +14,10 @@ module Watir
14
14
  def initialize(params = {})
15
15
  @drb_server_host = params[:drb_server_host] || external_interface
16
16
  @drb_server_port = params[:drb_server_port] || 0
17
- @ring_server_host = params[:ring_server_host] || external_interface
17
+ @controller_uri = params[:controller_uri]
18
+ @ring_server_host = params[:ring_server_host] || external_interface unless @controller_uri
18
19
  @ring_server_port = params[:ring_server_port] || Rinda::Ring_PORT
19
- @renewer = params[:renewer] || Rinda::SimpleRenewer.new
20
-
20
+ @renewer = params[:renewer] || Rinda::SimpleRenewer.new
21
21
  logfile = params[:logfile] || STDOUT
22
22
  @log = Logger.new(logfile, 'daily')
23
23
  @log.level = params[:loglevel] || Logger::ERROR
@@ -31,7 +31,7 @@ module Watir
31
31
  # Start required services
32
32
  def start(params = {})
33
33
  start_drb_server
34
- find_ring_server
34
+ find_ring_server(params)
35
35
  get_tuples(params)
36
36
  end
37
37
 
@@ -53,7 +53,7 @@ module Watir
53
53
  # Get the external facing interface for this server
54
54
  def external_interface
55
55
  begin
56
- UDPSocket.open {|s| s.connect('watir.com', 1); s.addr.last }
56
+ UDPSocket.open {|s| s.connect('ping.watirgrid.com', 1); s.addr.last }
57
57
  rescue
58
58
  '127.0.0.1'
59
59
  end
@@ -70,11 +70,16 @@ module Watir
70
70
 
71
71
  ##
72
72
  # Locate the Rinda Ring Server via a UDP broadcast
73
- def find_ring_server
74
- @ring_server = Rinda::RingFinger.new(
75
- @ring_server_host, @ring_server_port)
76
- @ring_server = @ring_server.lookup_ring_any
77
- @log.info("Ring server found on : druby://#{@ring_server_host}:#{@ring_server_port}")
73
+ def find_ring_server(params = {})
74
+ if @controller_uri
75
+ @ring_server = DRbObject.new(nil, @controller_uri)
76
+ else
77
+ @ring_server = Rinda::RingFinger.new(
78
+ @ring_server_host, @ring_server_port)
79
+ @ring_server = @ring_server.lookup_ring_any
80
+ @controller_uri = "druby://#{@ring_server_host}:#{@ring_server_port}"
81
+ end
82
+ @log.info("Controller found on :#{@controller_uri}")
78
83
  end
79
84
 
80
85
  ##
data/spec/grid_spec.rb CHANGED
@@ -188,3 +188,32 @@ describe 'Using the Grid' do
188
188
  grid.size.should == 0
189
189
  end
190
190
  end
191
+
192
+ describe 'Using the Grid via direct Controller URI' do
193
+ before(:all) do
194
+ @controller = Controller.new(
195
+ :ring_server_port => 12366,
196
+ :ring_server_host => '127.0.0.1',
197
+ :drb_server_port => '8866',
198
+ :loglevel => Logger::ERROR)
199
+ @controller.start
200
+ 1.upto(5) do
201
+ provider = Provider.new(
202
+ :ring_server_port => 12366,
203
+ :ring_server_host => '127.0.0.1',
204
+ :loglevel => Logger::ERROR, :browser_type => 'safari')
205
+ provider.start
206
+ end
207
+ end
208
+
209
+ after(:all) do
210
+ @controller.stop
211
+ end
212
+
213
+ it 'should take all providers' do
214
+ grid = Watir::Grid.new(:controller_uri => 'druby://127.0.0.1:8866',
215
+ :drb_server_host => '127.0.0.1')
216
+ grid.start(:quantity => 5, :take_all => true, :browser_type => 'safari')
217
+ grid.size.should == 5
218
+ end
219
+ end
data/watirgrid.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{watirgrid}
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tim Koopmans"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watirgrid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Koopmans