mrt-ingest 0.0.4 → 0.0.5

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.
@@ -12,17 +12,17 @@ module Mrt
12
12
  def initialize(data)
13
13
  @parsed = JSON.parse(data)['bat:batchState']
14
14
  end
15
-
15
+
16
16
  def batch_id
17
- return @parsed['bat:batchID']
17
+ @parsed['bat:batchID']
18
18
  end
19
-
19
+
20
20
  def user_agent
21
- return @parsed['bat:userAgent']
21
+ @parsed['bat:userAgent']
22
22
  end
23
-
23
+
24
24
  def submission_date
25
- return Time.parse(@parsed['bat:submissionDate'])
25
+ Time.parse(@parsed['bat:submissionDate'])
26
26
  end
27
27
  end
28
28
  end
@@ -0,0 +1,65 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+ <exclude-output />
5
+ <content url="file://$MODULE_DIR$">
6
+ <sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
7
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
8
+ </content>
9
+ <orderEntry type="jdk" jdkName="RVM: ruby-2.4.4" jdkType="RUBY_SDK" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v5.2.3, RVM: ruby-2.4.4) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="addressable (v2.6.0, RVM: ruby-2.4.4) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="ansi (v1.5.0, RVM: ruby-2.4.4) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.0, RVM: ruby-2.4.4) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.1, RVM: ruby-2.4.4) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="checkm (v0.0.6, RVM: ruby-2.4.4) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.5, RVM: ruby-2.4.4) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="crack (v0.4.3, RVM: ruby-2.4.4) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, RVM: ruby-2.4.4) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="docile (v1.3.1, RVM: ruby-2.4.4) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="domain_name (v0.5.20180417, RVM: ruby-2.4.4) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="hashdiff (v0.3.9, RVM: ruby-2.4.4) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="hirb (v0.7.3, RVM: ruby-2.4.4) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="http-cookie (v1.0.3, RVM: ruby-2.4.4) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v1.6.0, RVM: ruby-2.4.4) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="jaro_winkler (v1.5.2, RVM: ruby-2.4.4) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="json (v2.2.0, RVM: ruby-2.4.4) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="metaclass (v0.0.4, RVM: ruby-2.4.4) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="mime-types (v3.2.2, RVM: ruby-2.4.4) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2019.0331, RVM: ruby-2.4.4) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, RVM: ruby-2.4.4) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="mocha (v1.8.0, RVM: ruby-2.4.4) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="netrc (v0.11.0, RVM: ruby-2.4.4) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.17.0, RVM: ruby-2.4.4) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="parser (v2.6.3.0, RVM: ruby-2.4.4) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="public_suffix (v3.0.3, RVM: ruby-2.4.4) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.0.0, RVM: ruby-2.4.4) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="rake (v12.3.2, RVM: ruby-2.4.4) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="rest-client (v2.0.2, RVM: ruby-2.4.4) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.8.0, RVM: ruby-2.4.4) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.8.0, RVM: ruby-2.4.4) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.8.3, RVM: ruby-2.4.4) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.8.0, RVM: ruby-2.4.4) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.8.0, RVM: ruby-2.4.4) [gem]" level="application" />
45
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v0.69.0, RVM: ruby-2.4.4) [gem]" level="application" />
46
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.10.0, RVM: ruby-2.4.4) [gem]" level="application" />
47
+ <orderEntry type="library" scope="PROVIDED" name="safe_yaml (v1.0.5, RVM: ruby-2.4.4) [gem]" level="application" />
48
+ <orderEntry type="library" scope="PROVIDED" name="shoulda (v3.6.0, RVM: ruby-2.4.4) [gem]" level="application" />
49
+ <orderEntry type="library" scope="PROVIDED" name="shoulda-context (v1.2.2, RVM: ruby-2.4.4) [gem]" level="application" />
50
+ <orderEntry type="library" scope="PROVIDED" name="shoulda-matchers (v3.1.3, RVM: ruby-2.4.4) [gem]" level="application" />
51
+ <orderEntry type="library" scope="PROVIDED" name="simplecov (v0.16.1, RVM: ruby-2.4.4) [gem]" level="application" />
52
+ <orderEntry type="library" scope="PROVIDED" name="simplecov-console (v0.4.2, RVM: ruby-2.4.4) [gem]" level="application" />
53
+ <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.10.2, RVM: ruby-2.4.4) [gem]" level="application" />
54
+ <orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, RVM: ruby-2.4.4) [gem]" level="application" />
55
+ <orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.5, RVM: ruby-2.4.4) [gem]" level="application" />
56
+ <orderEntry type="library" scope="PROVIDED" name="unf (v0.1.4, RVM: ruby-2.4.4) [gem]" level="application" />
57
+ <orderEntry type="library" scope="PROVIDED" name="unf_ext (v0.0.7.6, RVM: ruby-2.4.4) [gem]" level="application" />
58
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v1.6.0, RVM: ruby-2.4.4) [gem]" level="application" />
59
+ <orderEntry type="library" scope="PROVIDED" name="webmock (v3.5.1, RVM: ruby-2.4.4) [gem]" level="application" />
60
+ </component>
61
+ <component name="RModuleSettingsStorage">
62
+ <LOAD_PATH number="2" string0="$MODULE_DIR$/lib" string1="$MODULE_DIR$/spec" />
63
+ <I18N_FOLDERS number="0" />
64
+ </component>
65
+ </module>
@@ -1,30 +1,32 @@
1
- $:.push File.expand_path("../lib", __FILE__)
1
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = "mrt-ingest"
5
- s.version = "0.0.4"
4
+ s.name = 'mrt-ingest'
5
+ s.version = '0.0.5'
6
6
  s.platform = Gem::Platform::RUBY
7
- s.authors = ["Mark Reyes", "David Moles"]
8
- s.email = ["mark.reyes@ucop.edu", "david.moles@ucop.edu"]
9
- s.homepage = "https://github.com/CDLUC3/mrt-ingest-ruby"
10
- s.summary = %q{A client for Merritt ingest.}
11
- s.description = %q{A client for the Merritt ingest system. More details available from https://github.com/CDLUC3/mrt-doc/wiki}
12
- s.license = "BSD-3-Clause"
7
+ s.authors = ['Mark Reyes', 'David Moles']
8
+ s.email = ['mark.reyes@ucop.edu', 'david.moles@ucop.edu']
9
+ s.homepage = 'https://github.com/CDLUC3/mrt-ingest-ruby'
10
+ s.summary = 'A client for Merritt ingest.'
11
+ s.description = 'A client for the Merritt ingest system. More details available from https://github.com/CDLUC3/mrt-doc/wiki'
12
+ s.license = 'BSD-3-Clause'
13
13
 
14
- s.add_dependency "json", "~> 2.0"
15
- s.add_dependency "rest-client", "~> 2.0"
14
+ s.add_dependency 'json', '~> 2.0'
15
+ s.add_dependency 'rest-client', '~> 2.0'
16
16
 
17
- s.add_development_dependency "bundler", '~> 1.16'
18
- s.add_development_dependency "checkm", "0.0.6"
19
- # TODO: put this back in once there's a 2.4-compatible release
20
- # s.add_development_dependency "fakeweb"
21
- s.add_development_dependency "mocha", '~> 1.7'
22
- s.add_development_dependency "rake", '~> 12.0'
23
- s.add_development_dependency "shoulda", '~> 3.6'
24
- s.add_development_dependency "test-unit", '~> 3.2'
17
+ s.add_development_dependency 'bundler', '~> 1.16'
18
+ s.add_development_dependency 'checkm', '0.0.6'
19
+ s.add_development_dependency 'mocha', '~> 1.7'
20
+ s.add_development_dependency 'rake', '~> 12.0'
21
+ s.add_development_dependency 'rspec', '~> 3.8'
22
+ s.add_development_dependency 'rubocop', '~> 0.68'
23
+ s.add_development_dependency 'shoulda', '~> 3.6'
24
+ s.add_development_dependency 'simplecov', '~> 0.16'
25
+ s.add_development_dependency 'simplecov-console', '~> 0.4'
26
+ s.add_development_dependency 'webmock', '~> 3.5'
25
27
 
26
28
  s.files = `git ls-files -z`.split("\x0")
27
29
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
28
30
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
29
- s.require_paths = ["lib"]
31
+ s.require_paths = ['lib']
30
32
  end
@@ -0,0 +1,16 @@
1
+ inherit_from: ../.rubocop.yml
2
+
3
+ Security/Open:
4
+ Enabled: false
5
+
6
+ Style/ClassAndModuleChildren:
7
+ Enabled: false
8
+
9
+ Metrics/BlockLength:
10
+ Enabled: false
11
+
12
+ Metrics/ModuleLength:
13
+ Enabled: false
14
+
15
+ Metrics/MethodLength:
16
+ Enabled: false
@@ -0,0 +1,36 @@
1
+ # ------------------------------------------------------------
2
+ # SimpleCov setup
3
+
4
+ if ENV['COVERAGE']
5
+ require 'simplecov'
6
+ require 'simplecov-console'
7
+
8
+ SimpleCov.command_name 'spec:lib'
9
+
10
+ SimpleCov.minimum_coverage 100
11
+ SimpleCov.start do
12
+ add_filter '/spec/'
13
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
14
+ SimpleCov::Formatter::HTMLFormatter,
15
+ SimpleCov::Formatter::Console,
16
+ ]
17
+ end
18
+ end
19
+
20
+ # ------------------------------------------------------------
21
+ # Rspec configuration
22
+
23
+ require 'webmock/rspec'
24
+
25
+ RSpec.configure do |config|
26
+ config.raise_errors_for_deprecations!
27
+ config.mock_with :rspec
28
+ hostname_lower = Socket.gethostname.downcase # https://github.com/bblimke/webmock/issues/819
29
+ config.before(:each) { WebMock.disable_net_connect!(allow: hostname_lower) }
30
+ config.after(:each) { WebMock.allow_net_connect! }
31
+ end
32
+
33
+ # ------------------------------------------------------------
34
+ # Code under test
35
+
36
+ require 'mrt/ingest'
@@ -0,0 +1 @@
1
+ I am a file.
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ module Mrt::Ingest
4
+ describe Client do
5
+ describe :new do
6
+ it 'creates a client' do
7
+ client = Client.new('http://example.org/ingest')
8
+ expect(client).to be_a(Client)
9
+ end
10
+
11
+ it 'accepts credentials' do
12
+ client = Client.new('http://example.org/ingest', 'me', 'secret')
13
+ expect(client).to be_a(Client)
14
+ end
15
+ end
16
+
17
+ describe :mk_request do
18
+ before(:each) do
19
+ @client = Client.new('http://example.org/ingest', 'me', 'secret')
20
+ @iobject = IObject.new
21
+ @ingest_req = @iobject.mk_request('profile', 'submitter')
22
+ end
23
+
24
+ it 'creates a valid request' do
25
+ rest_req = @client.mk_rest_request(@ingest_req)
26
+ expect(rest_req.user).to eq('me')
27
+ expect(rest_req.password).to eq('secret')
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ module Mrt::Ingest
4
+ describe Component do
5
+ describe :from_erc do
6
+ it 'rejects string ERCs' do
7
+ server = instance_double(OneTimeServer)
8
+ expect { Component.from_erc(server, 'I am not an ERC') }.to raise_error(ArgumentError)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,248 @@
1
+ require 'spec_helper'
2
+ require 'checkm'
3
+ require 'English'
4
+
5
+ module Mrt::Ingest
6
+ describe IObject do
7
+
8
+ RESPONSE_JSON = <<~JSON.freeze
9
+ {
10
+ "bat:batchState": {
11
+ "bat:batchID":"bid-8c0fa0c2-f3d7-4deb-bd49-f953f6752b59",
12
+ "bat:updateFlag":false,
13
+ "bat:targetQueue":"example.org:2181",
14
+ "bat:batchStatus":"QUEUED",
15
+ "bat:userAgent":"egh/Erik Hetzner",
16
+ "bat:submissionDate":"2011-08-31T15:40:26-07:00",
17
+ "bat:targetQueueNode":"/ingest.example.1",
18
+ "bat:batchProfile": {
19
+ "bat:owner":"ark:/99999/fk4tt4wsh",
20
+ "bat:creationDate":"2010-01-19T13:28:14-08:00",
21
+ "bat:targetStorage": {
22
+ "bat:storageLink":"http://example.org:35121",
23
+ "bat:nodeID":10
24
+ },
25
+ "bat:objectType":"MRT-curatorial",
26
+ "bat:modificationDate":"2010-01-26T23:28:14-08:00",
27
+ "bat:aggregateType":"",
28
+ "bat:objectMinterURL":"https://example.org/ezid/shoulder/ark:/99999/fk4",
29
+ "bat:collection": {
30
+ },
31
+ "bat:profileID":"merritt_content",
32
+ "bat:profileDescription":"Merritt demo content",
33
+ "bat:fixityURL":"http://example.org:33143",
34
+ "bat:contactsEmail": {
35
+ "bat:notification": {
36
+ "bat:contactEmail":"erik.hetzner@example.org"
37
+ }
38
+ },
39
+ "bat:identifierScheme":"ARK",
40
+ "bat:identifierNamespace":"99999",
41
+ "bat:objectRole":"MRT-content"
42
+ }
43
+ }
44
+ }
45
+ JSON
46
+
47
+ def parse_object_manifest(iobject)
48
+ req = iobject.mk_request('profile', 'submitter')
49
+ args = req.mk_args
50
+ Checkm::Manifest.new(args['file'].read)
51
+ end
52
+
53
+ def write_to_tempfile(content)
54
+ tempfile = Tempfile.new('test_iobject')
55
+ tempfile << content
56
+ tempfile.open
57
+ tempfile
58
+ end
59
+
60
+ def get_uri_for_name(iobject, name)
61
+ manifest = parse_object_manifest(iobject)
62
+ manifest.entries.find do |entry|
63
+ entry.values[-2] == name
64
+ end
65
+ end
66
+
67
+ def parse_erc(erc)
68
+ arr = erc.lines.map do |line|
69
+ md = line.chomp.match(/^([^:]+):\s*(.*)$/)
70
+ [md[1], md[2]]
71
+ end.flatten
72
+ h = Hash[*arr]
73
+ h.delete('erc')
74
+ h
75
+ end
76
+
77
+ def parse_erc_entry(erc_entry)
78
+ parse_erc(open(erc_entry.values[0]).read)
79
+ end
80
+
81
+ def check_erc_content(iobject, asserted_erc)
82
+ erc_entry = get_uri_for_name(iobject, 'mrt-erc.txt')
83
+ expect(erc_entry).not_to be_nil
84
+ iobject.start_server
85
+ begin
86
+ expect(parse_erc_entry(erc_entry)).to eq(asserted_erc)
87
+ ensure
88
+ iobject.stop_server
89
+ end
90
+ end
91
+
92
+ describe 'with local ID' do
93
+ before(:each) do
94
+ @local_id = '10.1098/rstl.1665.0007'
95
+ @iobject = IObject.new(local_identifier: @local_id)
96
+ end
97
+
98
+ it 'includes the local ID in the request' do
99
+ request = @iobject.mk_request('profile', 'submitter')
100
+ expect(request.local_identifier).to eq(@local_id)
101
+ end
102
+ end
103
+
104
+ describe 'without local ID' do
105
+ before(:each) do
106
+ @iobject = IObject.new
107
+ end
108
+
109
+ it 'accepts a URI component' do
110
+ uri = URI.parse('http://example.org/file')
111
+ components = @iobject.add_component(uri)
112
+ expect(components.size).to eq(1)
113
+ expect(components[0].uri).to eq(uri)
114
+ end
115
+
116
+ it 'does not accept a string URI' do
117
+ expect { @iobject.add_component('http://example.org/file') }.to raise_error(ArgumentError)
118
+ end
119
+
120
+ it 'makes a request' do
121
+ req = @iobject.mk_request('profile', 'submitter')
122
+ expect(req.profile).to eq('profile')
123
+ expect(req.submitter).to eq('submitter')
124
+ end
125
+ end
126
+
127
+ describe 'the created request' do
128
+ before(:each) do
129
+ @iobject = IObject.new
130
+ @manifest = parse_object_manifest(@iobject)
131
+ @erc_entry = get_uri_for_name(@iobject, 'mrt-erc.txt')
132
+ end
133
+
134
+ it 'should generate a valid manifest file' do
135
+ expect(@manifest.entries).not_to be_empty
136
+ end
137
+
138
+ it 'should serve a valid mrt-erc.txt entry' do
139
+ expect(@erc_entry).not_to be_nil
140
+ @iobject.start_server
141
+ begin
142
+ open(@erc_entry.values[0]).read.lines.to_a
143
+ ensure
144
+ @iobject.stop_server
145
+ end
146
+ end
147
+
148
+ describe :erc do
149
+ ERC_CONTENT = <<~ERC.freeze
150
+ who: John Doe
151
+ what: Something
152
+ when: now
153
+ ERC
154
+
155
+ it 'should accept a file' do
156
+ erc_tempfile = write_to_tempfile(ERC_CONTENT)
157
+ iobject = IObject.new(erc: File.new(erc_tempfile.path))
158
+ check_erc_content(iobject, parse_erc(ERC_CONTENT))
159
+ end
160
+
161
+ it 'should accept a hash' do
162
+ erc = {
163
+ 'who' => 'John Doe',
164
+ 'what' => 'Something',
165
+ 'when' => 'now'
166
+ }
167
+ iobject = Mrt::Ingest::IObject.new(erc: erc)
168
+ check_erc_content(iobject, erc)
169
+ end
170
+ end
171
+
172
+ describe 'local files' do
173
+ FILE_CONTENT = <<~TXT.freeze
174
+ Hello, world!
175
+ TXT
176
+
177
+ FILE_CONTENT_MD5 = '746308829575e17c3331bbcb00c0898b'.freeze
178
+
179
+ it 'should support local files' do
180
+ iobject = IObject.new
181
+ tempfile = write_to_tempfile(FILE_CONTENT)
182
+ iobject.add_component(tempfile, { name: 'helloworld' })
183
+ uri_entry = get_uri_for_name(iobject, 'helloworld')
184
+ erc_entry = get_uri_for_name(iobject, 'mrt-erc.txt')
185
+ expect(erc_entry).not_to(be_nil)
186
+ manifest = parse_object_manifest(iobject)
187
+ expect(manifest).not_to(be_nil)
188
+ expect(uri_entry).not_to be_nil
189
+ iobject.start_server
190
+ begin
191
+ expect(open(uri_entry.values[0]).read).to eq(FILE_CONTENT)
192
+ ensure
193
+ iobject.stop_server
194
+ end
195
+ end
196
+ end
197
+ end
198
+
199
+ describe :start_ingest do
200
+ it 'submits the object' do
201
+ @ingest_url = 'http://merritt.example.edu:33121/poster/submit/'
202
+ @client = Client.new(@ingest_url)
203
+
204
+ @iobject = IObject.new
205
+ @iobject.add_component(URI.parse('http://example.org'), name: 'index.html')
206
+
207
+ stub_request(:post, 'http://merritt.example.edu:33121/poster/submit/').to_return(status: 200, body: RESPONSE_JSON, headers: {})
208
+ @iobject.start_ingest(@client, 'example_profile', 'Atom processor/Example collection')
209
+ end
210
+ end
211
+
212
+ describe :finish_ingest do
213
+ it 'joins the server' do
214
+ @ingest_url = 'http://merritt.example.edu:33121/poster/submit/'
215
+ @client = Client.new(@ingest_url)
216
+
217
+ @iobject = IObject.new
218
+ @iobject.add_component(URI.parse('http://example.org'), name: 'index.html')
219
+
220
+ stub_request(:post, 'http://merritt.example.edu:33121/poster/submit/').to_return(status: 200, body: RESPONSE_JSON, headers: {})
221
+ @iobject.start_ingest(@client, 'example_profile', 'Atom processor/Example collection')
222
+
223
+ # TODO: just mock the server
224
+ server = @iobject.server
225
+ files = Dir.entries(server.dir).reject { |e| %w[. ..].include?(e) }
226
+ urls = files.map { |f| "http://#{Socket.gethostname}:#{server.port}/#{f}" }
227
+
228
+ client_process_id = fork do
229
+ begin
230
+ urls.each do |url|
231
+ resp = Net::HTTP.get_response(URI.parse(url))
232
+ status = resp.code.to_i
233
+ exit(status) if status != 200
234
+ end
235
+ rescue StandardError => e
236
+ warn(e)
237
+ exit(1)
238
+ end
239
+ end
240
+ Process.wait(client_process_id)
241
+ expect($CHILD_STATUS.exitstatus).to eq(0) # just to be sure
242
+
243
+ @iobject.finish_ingest
244
+ end
245
+ end
246
+
247
+ end
248
+ end