libis-services 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +36 -0
  6. data/Rakefile +6 -0
  7. data/lib/libis-services.rb +1 -0
  8. data/lib/libis/services.rb +21 -0
  9. data/lib/libis/services/aleph/search.rb +157 -0
  10. data/lib/libis/services/collective_access.rb +1 -0
  11. data/lib/libis/services/collective_access/cataloguing.rb +48 -0
  12. data/lib/libis/services/collective_access/connector.rb +151 -0
  13. data/lib/libis/services/collective_access/item_info.rb +36 -0
  14. data/lib/libis/services/collective_access/search.rb +26 -0
  15. data/lib/libis/services/collective_access/service.rb +80 -0
  16. data/lib/libis/services/digitool/digital_entity_manager.rb +223 -0
  17. data/lib/libis/services/digitool/digitool_connector.rb +46 -0
  18. data/lib/libis/services/digitool/meta_data_manager.rb +193 -0
  19. data/lib/libis/services/extend/http_fetch.rb +63 -0
  20. data/lib/libis/services/generic_search.rb +38 -0
  21. data/lib/libis/services/http_error.rb +21 -0
  22. data/lib/libis/services/oracle_client.rb +47 -0
  23. data/lib/libis/services/primo.rb +2 -0
  24. data/lib/libis/services/primo/limo.rb +33 -0
  25. data/lib/libis/services/primo/search.rb +46 -0
  26. data/lib/libis/services/rest_client.rb +66 -0
  27. data/lib/libis/services/rosetta.rb +1 -0
  28. data/lib/libis/services/rosetta/client.rb +107 -0
  29. data/lib/libis/services/rosetta/collection_handler.rb +45 -0
  30. data/lib/libis/services/rosetta/collection_info.rb +35 -0
  31. data/lib/libis/services/rosetta/deposit_activity.rb +48 -0
  32. data/lib/libis/services/rosetta/deposit_handler.rb +187 -0
  33. data/lib/libis/services/rosetta/ie.rb +19 -0
  34. data/lib/libis/services/rosetta/ie_handler.rb +29 -0
  35. data/lib/libis/services/rosetta/pds_handler.rb +60 -0
  36. data/lib/libis/services/rosetta/producer.rb +71 -0
  37. data/lib/libis/services/rosetta/producer_handler.rb +125 -0
  38. data/lib/libis/services/rosetta/service.rb +399 -0
  39. data/lib/libis/services/rosetta/sip.rb +26 -0
  40. data/lib/libis/services/rosetta/sip_handler.rb +30 -0
  41. data/lib/libis/services/rosetta/user.rb +70 -0
  42. data/lib/libis/services/rosetta/user_manager.rb +28 -0
  43. data/lib/libis/services/scope/search.rb +46 -0
  44. data/lib/libis/services/search_factory.rb +40 -0
  45. data/lib/libis/services/sharepoint/connector.rb +236 -0
  46. data/lib/libis/services/sharepoint/search.rb +19 -0
  47. data/lib/libis/services/soap_client.rb +57 -0
  48. data/lib/libis/services/soap_error.rb +22 -0
  49. data/lib/libis/services/version.rb +5 -0
  50. data/libis-services.gemspec +38 -0
  51. data/spec/primo_limo_spec.rb +394 -0
  52. data/spec/primo_search_spec.rb +39 -0
  53. data/spec/rosetta_collection_spec.rb +206 -0
  54. data/spec/rosetta_deposit_spec.rb +82 -0
  55. data/spec/rosetta_ie_spec.rb +345 -0
  56. data/spec/rosetta_pds_spec.rb +79 -0
  57. data/spec/rosetta_producer_spec.rb +270 -0
  58. data/spec/rosetta_sip_spec.rb +39 -0
  59. data/spec/spec_helper.rb +12 -0
  60. metadata +307 -0
@@ -0,0 +1,39 @@
1
+ require_relative 'spec_helper'
2
+
3
+ require 'libis/services/primo/search'
4
+ require 'libis-tools'
5
+
6
+ describe 'Primo search service' do
7
+ let(:subject) { Libis::Services::Primo::Search.new }
8
+
9
+ context 'query' do
10
+
11
+ it 'default return result' do
12
+ result = subject.query 'foo'
13
+ expect(result.keys).to eq [:count, :from, :to, :step, :data]
14
+ expect(result[:data].size).to eq [result[:count], result[:step]].min
15
+ end
16
+
17
+ end
18
+
19
+ context 'find' do
20
+
21
+ it 'default return result' do
22
+ result = subject.query 'foo'
23
+ count = result[:count]
24
+ result = subject.find 'foo'
25
+ expect(result).to be_a Array
26
+ expect(result.size).to eq count
27
+ end
28
+
29
+ it 'limit number of results' do
30
+ result = subject.query 'foo', step: 1
31
+ count = result[:count] / 2
32
+ result = subject.find 'foo', max_count: count
33
+ expect(result).to be_a Array
34
+ expect(result.size).to eq count
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,206 @@
1
+ # encoding: utf-8
2
+ require_relative 'spec_helper'
3
+
4
+ require 'libis/tools/config_file'
5
+ require 'libis/tools/extend/hash'
6
+
7
+ require 'libis/services/rosetta/pds_handler'
8
+ require 'libis/services/rosetta/collection_handler'
9
+
10
+ require 'rspec/matchers'
11
+ require 'equivalent-xml'
12
+
13
+ class String
14
+ def unindent
15
+ gsub(/^#{scan(/^\s*/).min_by { |l| l.length }}/, '')
16
+ end
17
+ end
18
+
19
+ RSpec::Matchers.define(:match_collection) do |target_collection|
20
+ match do |actual_collection|
21
+ actual_md = actual_collection.delete(:md_dc)
22
+ target_md = target_collection.delete(:md_dc)
23
+ expect(actual_collection).to include(target_collection)
24
+ actual_xml = actual_md.delete(:content)
25
+ target_xml = target_md.delete(:content)
26
+ expect(actual_md).to include(target_md)
27
+ match_xml(actual_xml, target_xml)
28
+ end
29
+
30
+ def match_xml(doc1, doc2)
31
+ doc1 = ::Nokogiri::XML(doc1) if doc1.is_a?(String)
32
+ doc2 = ::Nokogiri::XML(doc2) if doc2.is_a?(String)
33
+ expect(doc1.root).to be_equivalent_to(doc2.root)
34
+ end
35
+
36
+ end
37
+
38
+
39
+ describe 'Rosetta Collection Service' do
40
+
41
+ let(:credentials) { Libis::Tools::ConfigFile.new File.join(File.dirname(__FILE__), 'credentials-test.yml') }
42
+ let(:pds_handler) do
43
+ # noinspection RubyResolve
44
+ Libis::Services::Rosetta::PdsHandler.new(credentials.pds_url)
45
+ end
46
+
47
+ let(:handle) do
48
+ # noinspection RubyResolve
49
+ pds_handler.login(
50
+ credentials.admin.user,
51
+ credentials.admin.password,
52
+ credentials.admin.institute
53
+ )
54
+ end
55
+
56
+ let(:collection_info) { Libis::Services::Rosetta::CollectionInfo.new collection_data }
57
+
58
+ let(:parent_name) { 'Test Collection' }
59
+ let(:parent_id) { '23082369' }
60
+
61
+ # noinspection RubyResolve
62
+ subject(:collection_service) do
63
+ collection_service = Libis::Services::Rosetta::CollectionHandler.new credentials.rosetta_url,
64
+ log: credentials.debug,
65
+ log_level: credentials.debug_level
66
+ collection_service.pds_handle = handle
67
+ collection_service
68
+ end
69
+
70
+ context 'existing collections' do
71
+
72
+ let(:collection_data) { {
73
+ id: '23082442',
74
+ name: 'another collection',
75
+ parent_id: parent_id,
76
+ md_dc: {
77
+ mid: '212362',
78
+ type: 'descriptive',
79
+ sub_type: 'dc',
80
+ content: <<-STR.unindent.strip
81
+ <?xml version="1.0" encoding="UTF-8"?>
82
+ <dc:record xmlns:dc="http://purl.org/dc/elements/1.1/"
83
+ xmlns:dcterms="http://purl.org/dc/terms/"
84
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
85
+ <dc:title>My pictures</dc:title>
86
+ <dcterms:created>2014-01-01 10:10:10</dcterms:created>
87
+ </dc:record>
88
+ STR
89
+ },
90
+ md_source: [],
91
+ navigate: true,
92
+ publish: false,
93
+ external_id: '9999',
94
+ external_system: 'CollectiveAccess'
95
+ } }
96
+
97
+ it 'get collection by ID' do
98
+ coll_info = collection_service.get(collection_data[:id])
99
+ expect(coll_info.to_hash).to match_collection(collection_data)
100
+ end
101
+
102
+ it 'get collection by name' do
103
+ coll_info = collection_service.find(parent_name + '/' + collection_data[:name])
104
+ expect(coll_info.to_hash).to match_collection(collection_data)
105
+ end
106
+ end
107
+
108
+ context 'collections CRUD' do
109
+
110
+ let(:collection_data) { {
111
+ name: 'My new test collection',
112
+ parent_id: parent_id,
113
+ md_dc: {
114
+ type: 'descriptive',
115
+ sub_type: 'dc',
116
+ content: <<-STR.unindent.strip
117
+ <?xml version="1.0" encoding="UTF-8"?>
118
+ <dc:record xmlns:dc="http://purl.org/dc/elements/1.1/"
119
+ xmlns:dcterms="http://purl.org/dc/terms/"
120
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
121
+ <dc:title>Something new to test</dc:title>
122
+ <dcterms:created>2015-06-25 10:00</dcterms:created>
123
+ </dc:record>
124
+ STR
125
+ },
126
+ md_source: [],
127
+ navigate: true,
128
+ publish: false,
129
+ external_id: '12345',
130
+ external_system: 'Scope'
131
+ } }
132
+
133
+ let(:new_collection) { collection_service.find(parent_name + '/' + collection_data[:name]) }
134
+
135
+ let(:new_collection_data) {
136
+ new_collection_data = {id: new_collection.id}
137
+ new_collection_data.reverse_merge!(collection_data)
138
+ new_collection_data[:md_dc][:mid] = new_collection.md_dc.mid
139
+ new_collection_data
140
+ }
141
+
142
+ let(:updated_name) { 'Stupid text' }
143
+
144
+ let(:updated_collection) { collection_service.find(parent_name + '/' + updated_name) }
145
+
146
+ let(:updated_collection_data) {
147
+ updated_collection_data = new_collection_data.dup
148
+ updated_collection_data[:name] = updated_name
149
+ updated_collection_data
150
+ }
151
+
152
+
153
+ it 'create new collection' do
154
+ new_collection_id = collection_service.create(collection_data)
155
+ expect(new_collection_id).not_to be_nil
156
+ expect(new_collection_id).to be_a String
157
+ expect(new_collection_id).to eq new_collection.id
158
+ end
159
+
160
+ it 'retrieve new collection' do
161
+ expect(new_collection.to_hash).to match_collection(new_collection_data)
162
+ end
163
+
164
+ it 'update new collection' do
165
+ result = collection_service.update(updated_collection_data)
166
+ expect(result).to be {}
167
+ expect(updated_collection.to_hash).to match_collection(updated_collection_data)
168
+ end
169
+
170
+ it 'delete new collection' do
171
+ result = collection_service.delete(updated_collection.id)
172
+ expect(result).to be {}
173
+ end
174
+
175
+ end
176
+
177
+ context 'check errors' do
178
+
179
+ it 'not authorized' do
180
+ collection_service.pds_handle = 'foobar'
181
+ expect do
182
+ collection_service.create({name: 'foo'})
183
+ end.to raise_error(Libis::Services::SoapError, /user_authorize_exception.*Invalid PDS Handle Number:foobar/)
184
+ end
185
+
186
+ it 'invalid collection info' do
187
+ expect do
188
+ collection_service.create({name: 'foo', parent_id: 0})
189
+ end.to raise_error(Libis::Services::SoapError, /invalid_collection_info_exception.*Invalid Parent Id: 0/)
190
+ end
191
+
192
+ it 'not found by id' do
193
+ expect do
194
+ collection_service.get(0)
195
+ end.to raise_error(Libis::Services::SoapError, /no_collection_found_exception.*collection with id: 0 not found/)
196
+ end
197
+
198
+ it 'not found by name' do
199
+ expect do
200
+ collection_service.find('foo')
201
+ end.to raise_error(Libis::Services::SoapError, /no_collection_found_exception.*collection with name: foo not found/)
202
+ end
203
+
204
+ end
205
+
206
+ end
@@ -0,0 +1,82 @@
1
+ # encoding: utf-8
2
+ require_relative 'spec_helper'
3
+ require 'yaml'
4
+
5
+ require 'libis/tools/config_file'
6
+
7
+ require 'libis/services/rosetta/pds_handler'
8
+ require 'libis/services/rosetta/deposit_handler'
9
+
10
+ describe 'Rosetta Deposit Service' do
11
+
12
+ let(:credentials) { Libis::Tools::ConfigFile.new File.join(File.dirname(__FILE__), 'credentials-test.yml') }
13
+ let(:pds_handler) do
14
+ # noinspection RubyResolve
15
+ Libis::Services::Rosetta::PdsHandler.new(credentials.pds_url)
16
+ end
17
+
18
+ let(:handle) do
19
+ # noinspection RubyResolve
20
+ pds_handler.login(
21
+ credentials.admin.user,
22
+ credentials.admin.password,
23
+ credentials.admin.institute
24
+ )
25
+ end
26
+
27
+ subject(:deposit_handler) do
28
+ # noinspection RubyResolve
29
+ Libis::Services::Rosetta::DepositHandler.new credentials.rosetta_url,
30
+ log: credentials.debug,
31
+ log_level: credentials.debug_level
32
+ end
33
+
34
+ before :each do
35
+ deposit_handler.pds_handle = handle
36
+ end
37
+
38
+ it 'should get list of deposits by date' do
39
+
40
+ deposits = deposit_handler.get_by_submit_date('13/10/2015', '13/10/2015', status: 'All')
41
+
42
+ # noinspection RubyResolve
43
+ expect(deposits.to_hash[:records]).to eq [
44
+ {
45
+ deposit_activity_id: 55662,
46
+ creation_date: '13/10/2015',
47
+ status: 'Approved',
48
+ title: 'test ingest - 1',
49
+ producer_agent_id: credentials.admin.user_id.to_i,
50
+ submit_date: '13/10/2015',
51
+ update_date: '13/10/2015',
52
+ sip_id: 55010,
53
+ producer_id: 23106349,
54
+ sip_reason: 'Files Rejected'
55
+ }
56
+ ]
57
+ end
58
+
59
+ it 'should get list of deposits by date and material flow' do
60
+
61
+ # noinspection RubyResolve
62
+ deposits = deposit_handler.get_by_submit_flow('13/10/2015', '13/10/2015', credentials.material_flow.manual.id, status: 'All')
63
+
64
+ # noinspection RubyResolve
65
+ expect(deposits.to_hash[:records]).to eq [
66
+ {
67
+ deposit_activity_id: 55662,
68
+ creation_date: '13/10/2015',
69
+ status: 'Approved',
70
+ title: 'test ingest - 1',
71
+ producer_agent_id: credentials.admin.user_id.to_i,
72
+ submit_date: '13/10/2015',
73
+ update_date: '13/10/2015',
74
+ sip_id: 55010,
75
+ producer_id: 23106349,
76
+ sip_reason: 'Files Rejected'
77
+ }
78
+ ]
79
+ end
80
+
81
+
82
+ end
@@ -0,0 +1,345 @@
1
+ # encoding: utf-8
2
+ require_relative 'spec_helper'
3
+ require 'yaml'
4
+ require 'awesome_print'
5
+ require 'pp'
6
+
7
+ require 'libis/tools/config_file'
8
+ require 'libis/services/rosetta/pds_handler'
9
+ require 'libis/services/rosetta/ie_handler'
10
+
11
+ describe 'Rosetta IE Service' do
12
+
13
+ let(:credentials) { Libis::Tools::ConfigFile.new File.join(File.dirname(__FILE__), 'credentials-test.yml') }
14
+ let(:pds_handler) do
15
+ # noinspection RubyResolve
16
+ Libis::Services::Rosetta::PdsHandler.new(credentials.pds_url)
17
+ end
18
+
19
+ let(:handle) do
20
+ # noinspection RubyResolve
21
+ pds_handler.login(
22
+ credentials.admin.user,
23
+ credentials.admin.password,
24
+ credentials.admin.institute
25
+ )
26
+ end
27
+
28
+ subject(:ie_handler) do
29
+ # noinspection RubyResolve
30
+ Libis::Services::Rosetta::IeHandler.new credentials.rosetta_url,
31
+ log: credentials.debug,
32
+ log_level: credentials.debug_level
33
+ end
34
+
35
+ before :each do
36
+ ie_handler.pds_handle = handle
37
+ end
38
+
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
+ it 'should get IE info' do
332
+
333
+ mets = ie_handler.get_mets('IE403595')
334
+ expect(mets).not_to be_nil
335
+ expect(mets).to match expected_mets
336
+ end
337
+
338
+ it 'should get IE metadata' do
339
+
340
+ metadata = ie_handler.get_metadata('IE403595')
341
+ expect(metadata).not_to be_nil
342
+ expect(metadata).to match expected_ies
343
+ end
344
+
345
+ end