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 +1 -1
- data/lib/watirgrid.rb +15 -10
- data/spec/grid_spec.rb +29 -0
- data/watirgrid.gemspec +1 -1
- metadata +3 -3
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.
|
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
|
-
@
|
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
|
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('
|
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
|
-
@
|
75
|
-
@
|
76
|
-
|
77
|
-
|
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
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:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tim Koopmans
|