libis-services 0.0.2 → 0.0.3

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.
@@ -11,7 +11,7 @@ describe 'Primo search service' do
11
11
  it 'default return result' do
12
12
  result = subject.query 'foo'
13
13
  expect(result.keys).to eq [:count, :from, :to, :step, :data]
14
- expect(result[:data].size).to eq [result[:count], result[:step]].min
14
+ expect(result[:data].size).to eq [result[:count], result[:step] - 1].min
15
15
  end
16
16
 
17
17
  end
@@ -89,8 +89,8 @@ describe 'Rosetta Collection Service' do
89
89
  },
90
90
  md_source: [],
91
91
  navigate: true,
92
- publish: false,
93
- external_id: '9999',
92
+ publish: true,
93
+ external_id: '5555',
94
94
  external_system: 'CollectiveAccess'
95
95
  } }
96
96
 
@@ -151,7 +151,7 @@ describe 'Rosetta Collection Service' do
151
151
 
152
152
 
153
153
  it 'create new collection' do
154
- new_collection_id = collection_service.create(collection_data)
154
+ new_collection_id = collection_service.create(collection_data)
155
155
  expect(new_collection_id).not_to be_nil
156
156
  expect(new_collection_id).to be_a String
157
157
  expect(new_collection_id).to eq new_collection.id
@@ -8,6 +8,7 @@ require 'libis/tools/config_file'
8
8
  require 'libis/services/rosetta/pds_handler'
9
9
  require 'libis/services/rosetta/ie_handler'
10
10
 
11
+ require_relative 'ie_data'
11
12
  describe 'Rosetta IE Service' do
12
13
 
13
14
  let(:credentials) { Libis::Tools::ConfigFile.new File.join(File.dirname(__FILE__), 'credentials-test.yml') }
@@ -36,310 +37,18 @@ describe 'Rosetta IE Service' do
36
37
  ie_handler.pds_handle = handle
37
38
  end
38
39
 
39
- let(:expected_mets) {
40
- {
41
- amd: {
42
- tech: {
43
- 'internalIdentifier' => [
44
- {'internalIdentifierType' => 'SIPID', 'internalIdentifierValue' => '55010'},
45
- {'internalIdentifierType' => 'PID', 'internalIdentifierValue' => 'IE403595'},
46
- {'internalIdentifierType' => 'DepositSetID', 'internalIdentifierValue' => '55662'}],
47
- 'objectCharacteristics' => [
48
- {'objectType' => 'INTELLECTUAL_ENTITY',
49
- 'creationDate' => '2015-10-13 14:41:56',
50
- 'createdBy' => 'testadmin',
51
- 'modificationDate' => '2015-10-13 14:46:23',
52
- 'modifiedBy' => 'testadmin',
53
- 'owner' => 'CRS00.TESTINS.TESTDEP'}],
54
- 'generalIECharacteristics' => [{'status' => 'ACTIVE'}],
55
- 'retentionPolicy' => [
56
- {'policyId' => 'NO_RETENTION',
57
- 'policyDescription' => 'No Retention Policy'}]
58
- },
59
- rights: {
60
- 'accessRightsPolicy' => [
61
- {'policyId' => '50740',
62
- 'policyParameters' => '',
63
- 'policyDescription' => 'AR_IP_RANGE_KUL'}]
64
- },
65
- source: {
66
- 'metaData' => [
67
- {'MID' => 'DNX_IE403595',
68
- 'UUID' => '23107258',
69
- 'creationDate' => '2015-10-13 14:41:56',
70
- 'createdBy' => 'testadmin',
71
- 'modificationDate' => '2015-10-13 14:46:23',
72
- 'modifiedBy' => 'testadmin',
73
- 'metadataType' => '21',
74
- 'description' => '',
75
- 'externalSystem' => '',
76
- 'externalRecordId' => '',
77
- 'application' => 'Test Metadata Profile'}]
78
- },
79
- digiprov: {
80
- 'producer' => [
81
- {'userName' => '',
82
- 'address1' => 'Willem de Croylaan 54',
83
- 'address2' => '',
84
- 'address3' => 'Heverlee',
85
- 'address4' => 'Belgium',
86
- 'address5' => '',
87
- 'defaultLanguage' => 'en',
88
- 'emailAddress' => 'lias.test.user@gmail.com',
89
- 'firstName' => 'Test',
90
- 'jobTitle' => '',
91
- 'lastName' => 'Deposit',
92
- 'middleName' => '',
93
- 'telephone1' => '0032 16 32 22 66',
94
- 'telephone2' => '',
95
- 'authorativeName' => 'test_producer_group',
96
- 'producerId' => '23106349',
97
- 'userIdAppId' => '23106348',
98
- 'webSiteUrl' => '',
99
- 'zip' => '3001'}],
100
- 'producerAgent' => [
101
- {'firstName' => 'Test', 'lastName' => 'Administrator', 'middleName' => ''}],
102
- 'event' => [
103
- {'eventDateTime' => '2015-10-13 14:46:23',
104
- 'eventType' => 'PROCESSING',
105
- 'eventIdentifierType' => 'DPS',
106
- 'eventIdentifierValue' => '130',
107
- 'eventOutcome1' => 'SUCCESS',
108
- 'eventDescription' => "Object's Metadata Record Modified",
109
- 'linkingAgentIdentifierType1' => 'USER',
110
- 'linkingAgentIdentifierValue1' => 'testadmin'}]
111
- }
112
- },
113
- dmd: {
114
- 'text' => "\n ",
115
- 'title' => 'Nachtzicht strand Ærøskøbing'
116
- },
117
- 'Preservation Master' => {
118
- id: 'REP403596',
119
- amd: {
120
- tech: {
121
- 'generalRepCharacteristics' => [
122
- {'preservationType' => 'PRESERVATION_MASTER',
123
- 'usageType' => 'VIEW',
124
- 'RevisionNumber' => '1',
125
- 'DigitalOriginal' => 'false'}],
126
- 'internalIdentifier' => [
127
- {'internalIdentifierType' => 'SIPID', 'internalIdentifierValue' => '55010'},
128
- {'internalIdentifierType' => 'PID', 'internalIdentifierValue' => 'REP403596'},
129
- {'internalIdentifierType' => 'DepositSetID', 'internalIdentifierValue' => '55662'}],
130
- 'objectCharacteristics' => [
131
- {'objectType' => 'REPRESENTATION',
132
- 'creationDate' => '2015-10-13 14:41:56',
133
- 'createdBy' => 'testadmin',
134
- 'modificationDate' => '2015-10-13 14:41:56',
135
- 'modifiedBy' => 'testadmin',
136
- 'owner' => 'CRS00.TESTINS.TESTDEP'}]
137
- },
138
- rights: {},
139
- source: {'metaData' =>
140
- [
141
- {'MID' => 'DNX_REP403596',
142
- 'UUID' => '23107254',
143
- 'creationDate' => '2015-10-13 14:41:56',
144
- 'createdBy' => 'testadmin',
145
- 'modificationDate' => '2015-10-13 14:41:56',
146
- 'modifiedBy' => '',
147
- 'metadataType' => '21',
148
- 'description' => '',
149
- 'externalSystem' => '',
150
- 'externalRecordId' => ''},
151
- {'MID' => 'REP403596-1',
152
- 'UUID' => '23107257',
153
- 'creationDate' => '2015-10-13 14:41:56',
154
- 'createdBy' => 'testadmin',
155
- 'modificationDate' => '2015-10-13 14:41:56',
156
- 'modifiedBy' => '',
157
- 'metadataType' => '32',
158
- 'description' => '',
159
- 'externalSystem' => '',
160
- 'externalRecordId' => ''} ]
161
- },
162
- digiprov: {}
163
- },
164
- nil => {},
165
- 'Table of Contents' =>
166
- {nil => {},
167
- 'Nachtzicht strand Ærøskøbing' => {
168
- id: 'FL403597',
169
- amd: {
170
- tech: {
171
- 'fileFixity' => [
172
- {'fixityType' => 'MD5',
173
- 'fixityValue' => '22d8897eeb3adfa70794fcfac04e8602'}],
174
- 'objectCharacteristics' => [
175
- {'groupID' => '',
176
- 'objectType' => 'FILE',
177
- 'creationDate' => '2015-10-13 14:41:56',
178
- 'createdBy' => 'testadmin',
179
- 'modificationDate' => '2015-10-13 14:41:56',
180
- 'modifiedBy' => 'testadmin',
181
- 'owner' => 'CRS00.TESTINS.TESTDEP'}],
182
- 'internalIdentifier' => [
183
- {'internalIdentifierType' => 'SIPID',
184
- 'internalIdentifierValue' => '55010'},
185
- {'internalIdentifierType' => 'PID',
186
- 'internalIdentifierValue' => 'FL403597'},
187
- {'internalIdentifierType' => 'DepositSetID',
188
- 'internalIdentifierValue' => '55662'}],
189
- 'vsOutcome' => [
190
- {'checkDate' => 'Tue Oct 13 14:42:02 CEST 2015',
191
- 'type' => 'FILE_FORMAT',
192
- 'vsAgent' =>
193
- 'REG_SA_DROID , Version 6.01 , Signature version Binary SF v.52/ Container SF v.1',
194
- 'result' => 'PASSED',
195
- 'resultDetails' => '',
196
- 'vsEvaluation' => 'PASSED',
197
- 'vsEvaluationDetails' => ''}],
198
- 'fileFormat' => [
199
- {'agent' => 'REG_SA_DROID',
200
- 'formatRegistry' => 'PRONOM',
201
- 'formatRegistryId' => 'fmt/43',
202
- 'formatRegistryRole' => '',
203
- 'formatName' => 'fmt/43',
204
- 'formatVersion' => '1.01',
205
- 'formatDescription' => 'JPEG File Interchange Format',
206
- 'formatNote' => '',
207
- 'exactFormatIdentification' => 'true',
208
- 'mimeType' => 'image/jpeg',
209
- 'agentVersion' => '6.01',
210
- 'agentSignatureVersion' => 'Binary SF v.52/ Container SF v.1',
211
- 'formatLibraryVersion' => '3.007'}],
212
- 'generalFileCharacteristics' => [
213
- {'label' => 'Nachtzicht strand Ærøskøbing',
214
- 'note' => '',
215
- 'fileCreationDate' => '',
216
- 'fileModificationDate' => '',
217
- 'FileEntityType' => '',
218
- 'compositionLevel' => '',
219
- 'fileLocationType' => 'FILE',
220
- 'fileLocation' => '',
221
- 'fileOriginalName' => 'DSC03176.jpg',
222
- 'fileOriginalPath' => 'DSC03176.jpg',
223
- 'fileOriginalID' => '/deposit_storage/55001-56000/dep_55662/deposit/content/streams/DSC03176.jpg',
224
- 'fileExtension' => 'jpg',
225
- 'fileMIMEType' => 'image/jpeg',
226
- 'fileSizeBytes' => '7694075',
227
- 'formatLibraryId' => 'fmt/43',
228
- 'riskLibraryIdentifiers' => ''}]
229
- },
230
- rights: {},
231
- source: {
232
- 'metaData' => [
233
- {'MID' => 'DNX_FL403597',
234
- 'UUID' => '23107256',
235
- 'creationDate' => '2015-10-13 14:41:56',
236
- 'createdBy' => 'testadmin',
237
- 'modificationDate' => '2015-10-13 14:41:56',
238
- 'modifiedBy' => '',
239
- 'metadataType' => '21',
240
- 'description' => '',
241
- 'externalSystem' => '',
242
- 'externalRecordId' => ''}]
243
- },
244
- digiprov: {
245
- 'event' => [
246
- {'eventDateTime' => '2015-10-13 14:42:01',
247
- 'eventType' => 'VALIDATION',
248
- 'eventIdentifierType' => 'DPS',
249
- 'eventIdentifierValue' => '25',
250
- 'eventOutcome1' => 'SUCCESS',
251
- 'eventOutcomeDetail1' => 'PROCESS_ID=;PID=FL403597;FILE_EXTENSION=jpg;SIP_ID=55010;DEPOSIT_ACTIVITY_ID=55662;MF_ID=23106594;TASK_ID=48;IDENTIFICATION_METHOD=SIGNATURE;PRODUCER_ID=23106349;FORMAT_ID=fmt/43;',
252
- 'eventDescription' => 'Format Identification performed on file',
253
- 'linkingAgentIdentifierType1' => 'SOFTWARE',
254
- 'linkingAgentIdentifierValue1' => 'REG_SA_DROID , Version 6.01 , Signature version Binary SF v.52/ Container SF v.1'}]
255
- }
256
- }
257
- }
258
- }
259
- }
260
- }
261
- }
262
-
263
- let(:expected_ies) {
264
- {amd: {
265
- tech: {'internalIdentifier' =>
266
- [{'internalIdentifierType' => 'SIPID', 'internalIdentifierValue' => '55010'},
267
- {'internalIdentifierType' => 'PID',
268
- 'internalIdentifierValue' => 'IE403595'},
269
- {'internalIdentifierType' => 'DepositSetID',
270
- 'internalIdentifierValue' => '55662'}],
271
- 'objectCharacteristics' =>
272
- [{'objectType' => 'INTELLECTUAL_ENTITY',
273
- 'creationDate' => '2015-10-13 14:41:56',
274
- 'createdBy' => 'testadmin',
275
- 'modificationDate' => '2015-10-13 14:46:23',
276
- 'modifiedBy' => 'testadmin',
277
- 'owner' => 'CRS00.TESTINS.TESTDEP'}],
278
- 'generalIECharacteristics' => [{'status' => 'ACTIVE'}],
279
- 'retentionPolicy' =>
280
- [{'policyId' => 'NO_RETENTION',
281
- 'policyDescription' => 'No Retention Policy'}]},
282
- rights: {'accessRightsPolicy' =>
283
- [{'policyId' => '50740',
284
- 'policyParameters' => '',
285
- 'policyDescription' => 'AR_IP_RANGE_KUL'}]},
286
- source: {'metaData' =>
287
- [{'MID' => 'DNX_IE403595',
288
- 'UUID' => '23107258',
289
- 'creationDate' => '2015-10-13 14:41:56',
290
- 'createdBy' => 'testadmin',
291
- 'modificationDate' => '2015-10-13 14:46:23',
292
- 'modifiedBy' => 'testadmin',
293
- 'metadataType' => '21',
294
- 'description' => '',
295
- 'externalSystem' => '',
296
- 'externalRecordId' => '',
297
- 'application' => 'Test Metadata Profile'}]},
298
- digiprov: {'producer' =>
299
- [{'userName' => '',
300
- 'address1' => 'Willem de Croylaan 54',
301
- 'address2' => '',
302
- 'address3' => 'Heverlee',
303
- 'address4' => 'Belgium',
304
- 'address5' => '',
305
- 'defaultLanguage' => 'en',
306
- 'emailAddress' => 'lias.test.user@gmail.com',
307
- 'firstName' => 'Test',
308
- 'jobTitle' => '',
309
- 'lastName' => 'Deposit',
310
- 'middleName' => '',
311
- 'telephone1' => '0032 16 32 22 66',
312
- 'telephone2' => '',
313
- 'authorativeName' => 'test_producer_group',
314
- 'producerId' => '23106349',
315
- 'userIdAppId' => '23106348',
316
- 'webSiteUrl' => '',
317
- 'zip' => '3001'}],
318
- 'producerAgent' =>
319
- [{'firstName' => 'Test', 'lastName' => 'Administrator', 'middleName' => ''}],
320
- 'event' =>
321
- [{'eventDateTime' => '2015-10-13 14:46:23',
322
- 'eventType' => 'PROCESSING',
323
- 'eventIdentifierType' => 'DPS',
324
- 'eventIdentifierValue' => '130',
325
- 'eventOutcome1' => 'SUCCESS',
326
- 'eventDescription' => "Object's Metadata Record Modified",
327
- 'linkingAgentIdentifierType1' => 'USER',
328
- 'linkingAgentIdentifierValue1' => 'testadmin'}]}},
329
- dmd: {'text' => "\n ", 'title' => 'Nachtzicht strand Ærøskøbing'}} }
330
-
331
40
  it 'should get IE info' do
332
41
 
333
42
  mets = ie_handler.get_mets('IE403595')
334
43
  expect(mets).not_to be_nil
335
- expect(mets).to match expected_mets
44
+ check_container expected_mets, mets
336
45
  end
337
46
 
338
47
  it 'should get IE metadata' do
339
48
 
340
49
  metadata = ie_handler.get_metadata('IE403595')
341
50
  expect(metadata).not_to be_nil
342
- expect(metadata).to match expected_ies
51
+ check_container(expected_ies, metadata)
343
52
  end
344
53
 
345
54
  end
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+ require_relative 'spec_helper'
3
+
4
+ require 'libis/tools/config_file'
5
+ require 'libis/services/rosetta/oai_pmh'
6
+
7
+ describe 'Rosetta OAI-PMH Service' do
8
+
9
+ let(:credentials) { Libis::Tools::ConfigFile.new File.join(File.dirname(__FILE__), 'credentials-test.yml'), debug: true }
10
+
11
+ subject(:oai_handler) do
12
+ # noinspection RubyResolve
13
+ Libis::Services::Rosetta::OaiPmh.new credentials.rosetta_url
14
+ end
15
+
16
+ let(:expected_sets) {
17
+ {name:'TESTINS-collections', spec: 'TESTINS-collections'}
18
+ }
19
+
20
+ let(:expected_collections) {
21
+ [
22
+ 'My pictures',
23
+ 'Test Collection',
24
+ ]
25
+ }
26
+
27
+ let(:expected_records) {
28
+ [
29
+ {
30
+ id: 'oai:d4I1-pubam:IE403595',
31
+ }
32
+ ]
33
+ }
34
+
35
+ it 'should get set list' do
36
+ sets = oai_handler.sets
37
+ expect(sets).to include(expected_sets)
38
+ end
39
+
40
+ it 'should get list of collections' do
41
+ status = {}
42
+ collections = oai_handler.collections('TESTINS', status)
43
+ check_container expected_collections, collections
44
+ end
45
+
46
+ it 'should get list of records' do
47
+ status = {}
48
+ records = oai_handler.records('test_data', status)
49
+ check_container(expected_records, records)
50
+ end
51
+
52
+ end
@@ -20,7 +20,7 @@ describe 'Rosetta SIP Service' do
20
20
  { module: 'PER', stage: 'Finished', status: 'FINISHED' }
21
21
  }
22
22
 
23
- let(:expected_ies) { ['IE403595'] }
23
+ let(:expected_ies) { [{pid: 'IE403595'}] }
24
24
 
25
25
  it 'should get SIP info' do
26
26
 
@@ -33,7 +33,7 @@ describe 'Rosetta SIP Service' do
33
33
 
34
34
  ies = sip_handler.get_ies(55010)
35
35
  expect(ies).not_to be_nil
36
- expect(ies).to match_array expected_ies
36
+ expect(ies.map(&:to_h)).to match_array expected_ies
37
37
  end
38
38
 
39
39
  end
data/spec/spec_helper.rb CHANGED
@@ -10,3 +10,19 @@ Bundler.setup
10
10
  require 'rspec'
11
11
  require 'libis-services'
12
12
 
13
+ def check_container(expected, result)
14
+ case expected
15
+ when Array
16
+ expect(result).to be_a Array
17
+ expected.each_with_index { |value, i| check_container(value, result[i]) }
18
+ when Hash
19
+ expect(result).to be_a Hash
20
+ expected.each_key do |key|
21
+ expect(result[key]).not_to be_nil
22
+ check_container(expected[key], result[key])
23
+ end
24
+ else
25
+ expect(result).to eq expected
26
+ end
27
+ end
28
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-services
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-21 00:00:00.000000000 Z
11
+ date: 2015-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '1.8'
167
+ - !ruby/object:Gem::Dependency
168
+ name: oai
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.4'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.4'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: virtus
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -221,6 +235,7 @@ files:
221
235
  - lib/libis-services.rb
222
236
  - lib/libis/services.rb
223
237
  - lib/libis/services/aleph/search.rb
238
+ - lib/libis/services/alma/web_service.rb
224
239
  - lib/libis/services/collective_access.rb
225
240
  - lib/libis/services/collective_access/cataloguing.rb
226
241
  - lib/libis/services/collective_access/connector.rb
@@ -246,6 +261,8 @@ files:
246
261
  - lib/libis/services/rosetta/deposit_handler.rb
247
262
  - lib/libis/services/rosetta/ie.rb
248
263
  - lib/libis/services/rosetta/ie_handler.rb
264
+ - lib/libis/services/rosetta/oai_pmh.rb
265
+ - lib/libis/services/rosetta/oai_set.rb
249
266
  - lib/libis/services/rosetta/pds_handler.rb
250
267
  - lib/libis/services/rosetta/producer.rb
251
268
  - lib/libis/services/rosetta/producer_handler.rb
@@ -256,17 +273,21 @@ files:
256
273
  - lib/libis/services/rosetta/user_manager.rb
257
274
  - lib/libis/services/scope/search.rb
258
275
  - lib/libis/services/search_factory.rb
276
+ - lib/libis/services/service_error.rb
259
277
  - lib/libis/services/sharepoint/connector.rb
260
278
  - lib/libis/services/sharepoint/search.rb
261
279
  - lib/libis/services/soap_client.rb
262
280
  - lib/libis/services/soap_error.rb
263
281
  - lib/libis/services/version.rb
264
282
  - libis-services.gemspec
283
+ - spec/alma_service_spec.rb
284
+ - spec/ie_data.rb
265
285
  - spec/primo_limo_spec.rb
266
286
  - spec/primo_search_spec.rb
267
287
  - spec/rosetta_collection_spec.rb
268
288
  - spec/rosetta_deposit_spec.rb
269
289
  - spec/rosetta_ie_spec.rb
290
+ - spec/rosetta_oai_spec.rb
270
291
  - spec/rosetta_pds_spec.rb
271
292
  - spec/rosetta_producer_spec.rb
272
293
  - spec/rosetta_sip_spec.rb
@@ -296,11 +317,14 @@ signing_key:
296
317
  specification_version: 4
297
318
  summary: LIBIS Services toolbox.
298
319
  test_files:
320
+ - spec/alma_service_spec.rb
321
+ - spec/ie_data.rb
299
322
  - spec/primo_limo_spec.rb
300
323
  - spec/primo_search_spec.rb
301
324
  - spec/rosetta_collection_spec.rb
302
325
  - spec/rosetta_deposit_spec.rb
303
326
  - spec/rosetta_ie_spec.rb
327
+ - spec/rosetta_oai_spec.rb
304
328
  - spec/rosetta_pds_spec.rb
305
329
  - spec/rosetta_producer_spec.rb
306
330
  - spec/rosetta_sip_spec.rb