gi_cat_driver 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/gi_cat_driver.rb +5 -5
- data/lib/gi_cat_driver/version.rb +1 -1
- data/spec/gi_cat_driver_spec.rb +45 -45
- metadata +2 -2
data/lib/gi_cat_driver.rb
CHANGED
@@ -141,8 +141,8 @@ module GiCatDriver
|
|
141
141
|
end
|
142
142
|
|
143
143
|
# Harvest all resource in the active profile
|
144
|
-
# The default timeout is
|
145
|
-
def harvest_all_resources_for_active_configuration timeout=
|
144
|
+
# The default timeout is 3600 seconds (1 hour)
|
145
|
+
def harvest_all_resources_for_active_configuration timeout=3600
|
146
146
|
harvestersinfo_array = get_harvest_resources(get_active_profile_id)
|
147
147
|
harvestersinfo_array.each do |harvester_id, harvester_title|
|
148
148
|
harvest_resource_for_active_configuration(harvester_id.to_s, harvester_title)
|
@@ -311,7 +311,7 @@ module GiCatDriver
|
|
311
311
|
end
|
312
312
|
|
313
313
|
if response.status == 200
|
314
|
-
puts "#{Time.now}: Initiate harvesting GI-Cat resource #{harvestername}. Please wait
|
314
|
+
puts "#{Time.now}: Initiate harvesting GI-Cat resource #{harvestername}. Please wait..."
|
315
315
|
else
|
316
316
|
raise "Failed to initiate harvesting GI-Cat resource #{harvestername}."
|
317
317
|
response.return!(request, result, &block)
|
@@ -344,12 +344,12 @@ module GiCatDriver
|
|
344
344
|
# Run till harvest all the resources are completed or time out
|
345
345
|
def confirm_harvest_done(harvester_id, harvester_title, waitmax)
|
346
346
|
begin
|
347
|
-
puts "Info: Max wait time
|
347
|
+
puts "Info: Max wait time to harvest current profile is set to #{waitmax} seconds"
|
348
348
|
Timeout::timeout(waitmax.to_i) do
|
349
349
|
harvest_request_is_done(harvester_id.to_s, harvester_title)
|
350
350
|
end
|
351
351
|
rescue Timeout::Error
|
352
|
-
puts "Warning:
|
352
|
+
puts "Warning: Harvest timed out after #{waitmax} seconds, reusing the previous harvest results."
|
353
353
|
end
|
354
354
|
end
|
355
355
|
|
data/spec/gi_cat_driver_spec.rb
CHANGED
@@ -12,8 +12,8 @@ describe GiCatDriver do
|
|
12
12
|
it "can check that GI-Cat is running" do
|
13
13
|
stub_request(:get, @base_url)
|
14
14
|
.with(:headers => {
|
15
|
-
'Accept'=>'*/*',
|
16
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
15
|
+
'Accept'=>'*/*',
|
16
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
17
17
|
'User-Agent'=>'Faraday v0.8.7'
|
18
18
|
}).to_return(:status => 200, :body => "", :headers => {})
|
19
19
|
|
@@ -45,9 +45,9 @@ describe GiCatDriver do
|
|
45
45
|
request_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations"
|
46
46
|
stub_request(:get,request_url)
|
47
47
|
.with(:headers => {
|
48
|
-
'Accept'=>'application/xml',
|
49
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
50
|
-
'User-Agent'=>'Ruby',
|
48
|
+
'Accept'=>'application/xml',
|
49
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
50
|
+
'User-Agent'=>'Ruby',
|
51
51
|
'Content-Type'=>'*/*'
|
52
52
|
}, :query => {:nameRepository => "gicat"})
|
53
53
|
.to_return(:status => 200, :body => File.new("spec/fixtures/brokerConfigurations.xml"), :headers => {})
|
@@ -63,9 +63,9 @@ describe GiCatDriver do
|
|
63
63
|
request_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations"
|
64
64
|
stub_request(:get,request_url)
|
65
65
|
.with(:headers => {
|
66
|
-
'Accept'=>'application/xml',
|
67
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
68
|
-
'User-Agent'=>'Ruby',
|
66
|
+
'Accept'=>'application/xml',
|
67
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
68
|
+
'User-Agent'=>'Ruby',
|
69
69
|
'Content-Type'=>'*/*'
|
70
70
|
}, :query => {:nameRepository => "gicat"})
|
71
71
|
.to_return(:status => 200, :body => File.new("spec/fixtures/brokerConfigurations.xml"), :headers => {})
|
@@ -78,9 +78,9 @@ describe GiCatDriver do
|
|
78
78
|
enable_conf_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations/1"
|
79
79
|
stub_request(:get,enable_conf_url)
|
80
80
|
.with(:headers => {
|
81
|
-
'Accept'=>'application/xml',
|
82
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
83
|
-
'User-Agent'=>'Ruby',
|
81
|
+
'Accept'=>'application/xml',
|
82
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
83
|
+
'User-Agent'=>'Ruby',
|
84
84
|
'Content-Type'=>'*/*'
|
85
85
|
}, :query => {:opts => "active"})
|
86
86
|
.to_return(:status => 200, :body => "", :headers => {})
|
@@ -88,9 +88,9 @@ describe GiCatDriver do
|
|
88
88
|
active_conf_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations"
|
89
89
|
stub_request(:get,active_conf_url)
|
90
90
|
.with(:headers => {
|
91
|
-
'Accept'=>'application/xml',
|
92
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
93
|
-
'User-Agent'=>'Ruby',
|
91
|
+
'Accept'=>'application/xml',
|
92
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
93
|
+
'User-Agent'=>'Ruby',
|
94
94
|
'Content-Type'=>'*/*'
|
95
95
|
}, :query => {:nameRepository => "gicat"})
|
96
96
|
.to_return(:status => 200, :body => File.new("spec/fixtures/brokerConfigurations.xml"), :headers => {})
|
@@ -98,9 +98,9 @@ describe GiCatDriver do
|
|
98
98
|
conf_request_url = "http://www.somecompany.com/services/conf/giconf/configuration"
|
99
99
|
stub_request(:get,conf_request_url)
|
100
100
|
.with(:headers => {
|
101
|
-
'Accept'=>'*/*',
|
102
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
103
|
-
'User-Agent'=>'Ruby',
|
101
|
+
'Accept'=>'*/*',
|
102
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
103
|
+
'User-Agent'=>'Ruby',
|
104
104
|
'Content-Type'=>'application/xml'
|
105
105
|
}).to_return(:status => 200, :body => "1", :headers => {})
|
106
106
|
|
@@ -146,26 +146,26 @@ describe GiCatDriver do
|
|
146
146
|
enable_lucene_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations/1/luceneEnabled"
|
147
147
|
stub_request(:put,enable_lucene_url)
|
148
148
|
.with(:headers => {
|
149
|
-
'Accept'=>'application/xml',
|
150
|
-
'User-Agent'=>'Ruby',
|
149
|
+
'Accept'=>'application/xml',
|
150
|
+
'User-Agent'=>'Ruby',
|
151
151
|
'Content-Type'=>'*/*'
|
152
152
|
}, :body => "true").to_return(:status => 200, :body => "", :headers => {})
|
153
153
|
|
154
154
|
conf_request_url = "http://www.somecompany.com/services/conf/giconf/configuration"
|
155
155
|
stub_request(:get,conf_request_url)
|
156
156
|
.with(:headers => {
|
157
|
-
'Accept'=>'*/*',
|
158
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
159
|
-
'User-Agent'=>'Ruby',
|
157
|
+
'Accept'=>'*/*',
|
158
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
159
|
+
'User-Agent'=>'Ruby',
|
160
160
|
'Content-Type'=>'application/xml'
|
161
161
|
}).to_return(:status => 200, :body => "1", :headers => {})
|
162
162
|
|
163
163
|
enable_conf_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations/1"
|
164
164
|
stub_request(:get,enable_conf_url)
|
165
165
|
.with(:headers => {
|
166
|
-
'Accept'=>'application/xml',
|
167
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
168
|
-
'User-Agent'=>'Faraday v0.8.7',
|
166
|
+
'Accept'=>'application/xml',
|
167
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
168
|
+
'User-Agent'=>'Faraday v0.8.7',
|
169
169
|
'Content-Type'=>'*/*'
|
170
170
|
}, :query => {:opts => "active"})
|
171
171
|
.to_return(:status => 200, :body => "", :headers => {})
|
@@ -181,26 +181,26 @@ describe GiCatDriver do
|
|
181
181
|
disable_lucene_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations/1/luceneEnabled"
|
182
182
|
stub_request(:put,disable_lucene_url)
|
183
183
|
.with(:headers => {
|
184
|
-
'Accept'=>'application/xml',
|
185
|
-
'User-Agent'=>'Ruby',
|
184
|
+
'Accept'=>'application/xml',
|
185
|
+
'User-Agent'=>'Ruby',
|
186
186
|
'Content-Type'=>'*/*'
|
187
187
|
}, :body => "false").to_return(:status => 200, :body => "", :headers => {})
|
188
188
|
|
189
189
|
conf_request_url = "http://www.somecompany.com/services/conf/giconf/configuration"
|
190
190
|
stub_request(:get,conf_request_url)
|
191
191
|
.with(:headers => {
|
192
|
-
'Accept'=>'*/*',
|
193
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
194
|
-
'User-Agent'=>'Ruby',
|
192
|
+
'Accept'=>'*/*',
|
193
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
194
|
+
'User-Agent'=>'Ruby',
|
195
195
|
'Content-Type'=>'application/xml'
|
196
196
|
}).to_return(:status => 200, :body => "1", :headers => {})
|
197
197
|
|
198
198
|
enable_conf_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations/1"
|
199
199
|
stub_request(:get,enable_conf_url)
|
200
200
|
.with(:headers => {
|
201
|
-
'Accept'=>'application/xml',
|
202
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
203
|
-
'User-Agent'=>'Faraday v0.8.7',
|
201
|
+
'Accept'=>'application/xml',
|
202
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
203
|
+
'User-Agent'=>'Faraday v0.8.7',
|
204
204
|
'Content-Type'=>'*/*'
|
205
205
|
}, :query => {:opts => "active"})
|
206
206
|
.to_return(:status => 200, :body => "", :headers => {})
|
@@ -277,9 +277,9 @@ describe GiCatDriver do
|
|
277
277
|
active_conf_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations"
|
278
278
|
stub_request(:get,active_conf_url)
|
279
279
|
.with(:headers => {
|
280
|
-
'Accept'=>'application/xml',
|
281
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
282
|
-
'User-Agent'=>'Ruby',
|
280
|
+
'Accept'=>'application/xml',
|
281
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
282
|
+
'User-Agent'=>'Ruby',
|
283
283
|
'Content-Type'=>'*/*'
|
284
284
|
}, :query => {:nameRepository => "gicat"})
|
285
285
|
.to_return(:status => 200, :body => File.new("spec/fixtures/brokerConfigurations.xml"), :headers => {})
|
@@ -304,9 +304,9 @@ describe GiCatDriver do
|
|
304
304
|
active_conf_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations"
|
305
305
|
stub_request(:get,active_conf_url)
|
306
306
|
.with(:headers => {
|
307
|
-
'Accept'=>'application/xml',
|
308
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
309
|
-
'User-Agent'=>'Ruby',
|
307
|
+
'Accept'=>'application/xml',
|
308
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
309
|
+
'User-Agent'=>'Ruby',
|
310
310
|
'Content-Type'=>'*/*'
|
311
311
|
}, :query => {:nameRepository => "gicat"})
|
312
312
|
.to_return(:status => 200, :body => File.new("spec/fixtures/brokerConfigurations.xml"), :headers => {})
|
@@ -334,9 +334,9 @@ describe GiCatDriver do
|
|
334
334
|
enable_conf_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations/1"
|
335
335
|
stub_request(:get,enable_conf_url)
|
336
336
|
.with(:headers => {
|
337
|
-
'Accept'=>'application/xml',
|
338
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
339
|
-
'User-Agent'=>'Ruby',
|
337
|
+
'Accept'=>'application/xml',
|
338
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
339
|
+
'User-Agent'=>'Ruby',
|
340
340
|
'Content-Type'=>'*/*'
|
341
341
|
})
|
342
342
|
.to_return(:status => 200, :body => File.new("spec/fixtures/brokerConfigurations.xml"), :headers => {})
|
@@ -363,9 +363,9 @@ describe GiCatDriver do
|
|
363
363
|
enable_conf_url = "http://admin:pass@www.somecompany.com/services/conf/brokerConfigurations/1"
|
364
364
|
stub_request(:get,enable_conf_url)
|
365
365
|
.with(:headers => {
|
366
|
-
'Accept'=>'application/xml',
|
367
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
368
|
-
'User-Agent'=>'Ruby',
|
366
|
+
'Accept'=>'application/xml',
|
367
|
+
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
368
|
+
'User-Agent'=>'Ruby',
|
369
369
|
'Content-Type'=>'*/*'
|
370
370
|
}, :query => {:opts => "active"})
|
371
371
|
.to_return(:status => 200, :body => "", :headers => {})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gi_cat_driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2014-01-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|