libis-tools 1.0.5-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +2 -0
  3. data/.gitignore +16 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +40 -0
  6. data/Gemfile +7 -0
  7. data/README.md +202 -0
  8. data/Rakefile +11 -0
  9. data/bin/libis_tool +5 -0
  10. data/lib/libis-tools.rb +1 -0
  11. data/lib/libis/tools.rb +25 -0
  12. data/lib/libis/tools/assert.rb +52 -0
  13. data/lib/libis/tools/checksum.rb +106 -0
  14. data/lib/libis/tools/cli/cli_helper.rb +189 -0
  15. data/lib/libis/tools/cli/reorg.rb +416 -0
  16. data/lib/libis/tools/command.rb +133 -0
  17. data/lib/libis/tools/command_line.rb +23 -0
  18. data/lib/libis/tools/config.rb +147 -0
  19. data/lib/libis/tools/config_file.rb +85 -0
  20. data/lib/libis/tools/csv.rb +38 -0
  21. data/lib/libis/tools/deep_struct.rb +71 -0
  22. data/lib/libis/tools/extend/array.rb +16 -0
  23. data/lib/libis/tools/extend/empty.rb +7 -0
  24. data/lib/libis/tools/extend/hash.rb +147 -0
  25. data/lib/libis/tools/extend/kernel.rb +25 -0
  26. data/lib/libis/tools/extend/ostruct.rb +3 -0
  27. data/lib/libis/tools/extend/roo.rb +91 -0
  28. data/lib/libis/tools/extend/string.rb +94 -0
  29. data/lib/libis/tools/extend/struct.rb +29 -0
  30. data/lib/libis/tools/extend/symbol.rb +8 -0
  31. data/lib/libis/tools/logger.rb +130 -0
  32. data/lib/libis/tools/mets_dnx.rb +61 -0
  33. data/lib/libis/tools/mets_file.rb +504 -0
  34. data/lib/libis/tools/mets_objects.rb +547 -0
  35. data/lib/libis/tools/parameter.rb +372 -0
  36. data/lib/libis/tools/spreadsheet.rb +196 -0
  37. data/lib/libis/tools/temp_file.rb +42 -0
  38. data/lib/libis/tools/thread_safe.rb +31 -0
  39. data/lib/libis/tools/version.rb +5 -0
  40. data/lib/libis/tools/xml_document.rb +583 -0
  41. data/libis-tools.gemspec +55 -0
  42. data/spec/assert_spec.rb +65 -0
  43. data/spec/checksum_spec.rb +68 -0
  44. data/spec/command_spec.rb +90 -0
  45. data/spec/config_file_spec.rb +83 -0
  46. data/spec/config_spec.rb +113 -0
  47. data/spec/csv_spec.rb +159 -0
  48. data/spec/data/test-headers.csv +2 -0
  49. data/spec/data/test-headers.tsv +2 -0
  50. data/spec/data/test-noheaders.csv +1 -0
  51. data/spec/data/test-noheaders.tsv +1 -0
  52. data/spec/data/test.data +9 -0
  53. data/spec/data/test.xlsx +0 -0
  54. data/spec/data/test.xml +8 -0
  55. data/spec/data/test.yml +2 -0
  56. data/spec/data/test_config.yml +15 -0
  57. data/spec/deep_struct_spec.rb +138 -0
  58. data/spec/logger_spec.rb +165 -0
  59. data/spec/mets_file_spec.rb +223 -0
  60. data/spec/parameter_container_spec.rb +152 -0
  61. data/spec/parameter_spec.rb +148 -0
  62. data/spec/spec_helper.rb +29 -0
  63. data/spec/spreadsheet_spec.rb +1820 -0
  64. data/spec/temp_file_spec.rb +76 -0
  65. data/spec/test.xsd +20 -0
  66. data/spec/thread_safe_spec.rb +64 -0
  67. data/spec/xmldocument_spec.rb +421 -0
  68. data/test/test_helper.rb +7 -0
  69. data/test/webservices/test_ca_item_info.rb +59 -0
  70. data/test/webservices/test_ca_search.rb +35 -0
  71. metadata +437 -0
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+
3
+ require 'test/unit'
4
+
5
+ $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
6
+
7
+ require 'libis/tools/webservices/collective_access'
@@ -0,0 +1,59 @@
1
+ # coding: utf-8
2
+ require_relative '../test_helper'
3
+
4
+ class TestCaItemInfo < Test::Unit::TestCase
5
+
6
+ # Called before every test method runs. Can be used
7
+ # to set up fixture information.
8
+ def setup
9
+
10
+ @ca_client = ::Libis::Tools::Webservices::CollectiveAccess.new
11
+ @ca_client.authenticate
12
+ @object_label = 'TEST.0001.0001'
13
+ @object = @ca_client.add_object @object_label
14
+ @attributes = {
15
+ digitoolUrl: %w(abcdefgh 172 DigitoolUrl),
16
+ objectHistoriek: %w(blablabla 84 Text),
17
+ objectBeschrijving: %w(zxcvbnm 91 Text)
18
+ }
19
+ @attributes.each { |k, v|
20
+ @ca_client.add_attribute @object, k, v[0]
21
+ }
22
+
23
+ @client ||= CaItemInfo.new()
24
+ @client.authenticate
25
+ end
26
+
27
+ # Called after every test method runs. Can be used to tear
28
+ # down fixture information.
29
+
30
+ def teardown
31
+ @ca_client.delete_object @object
32
+ end
33
+
34
+ def test_01_attributes
35
+ result = @client.get_attributes(@object)
36
+
37
+ assert_equal @attributes.size, result.size
38
+ @attributes.each_with_index { |(k, v), i|
39
+ check_attribute result, i, v[0], v[1], k.to_s, v[2]
40
+ }
41
+ end
42
+
43
+ def test_02_attribute
44
+ @attributes.each { |k, v|
45
+ result = @client.get_attribute @object, k.to_s
46
+ check_attribute [result], 0, v[0], v[1]
47
+ }
48
+ end
49
+
50
+ def check_attribute(result, nr, display_value, element_id, element_code = nil, datatype = nil)
51
+ r = result
52
+ (nr.is_a?(Array) ? nr : [nr]).each { |i| r = r[i] }
53
+ assert_equal display_value, r['display_value']
54
+ assert_equal element_code, r['element_code']
55
+ assert_equal element_id, r['element_id']
56
+ assert_equal datatype, r['datatype']
57
+ end
58
+
59
+ end
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ require_relative '../test_helper'
3
+
4
+ class TestCaSearch < Test::Unit::TestCase
5
+
6
+ # Called before every test method runs. Can be used
7
+ # to set up fixture information.
8
+ def setup
9
+ @ca = ::Libis::Tools::Webservices::CollectiveAccess.new
10
+ @ca.authenticate
11
+ @object_label = 'TEST.0001.0001'
12
+ @object_id = @ca.add_object @object_label
13
+
14
+ end
15
+
16
+ # Called after every test method runs. Can be used to tear
17
+ # down fixture information.
18
+ def teardown
19
+ @ca.delete_object @object_id
20
+ end
21
+
22
+ def test_01_search
23
+ result = @ca.search.query(@object_label)
24
+ #noinspection RubyStringKeysInHashInspection
25
+ expected = {
26
+ @object_id => {
27
+ 'display_label' => nil,
28
+ 'idno' => @object_label,
29
+ 'object_id' => @object_id
30
+ }
31
+ }
32
+ assert_equal expected, result
33
+ end
34
+
35
+ end
metadata ADDED
@@ -0,0 +1,437 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: libis-tools
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.5
5
+ platform: java
6
+ authors:
7
+ - Kris Dekeyser
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-11-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.6'
19
+ name: bundler
20
+ prerelease: false
21
+ type: :development
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '10.3'
33
+ name: rake
34
+ prerelease: false
35
+ type: :development
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.3'
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.1'
47
+ name: rspec
48
+ prerelease: false
49
+ type: :development
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ - !ruby/object:Gem::Dependency
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.6'
61
+ name: term-ansicolor
62
+ prerelease: false
63
+ type: :development
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.6'
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '0.5'
75
+ name: equivalent-xml
76
+ prerelease: false
77
+ type: :development
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.5'
83
+ - !ruby/object:Gem::Dependency
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.6'
89
+ name: awesome_print
90
+ prerelease: false
91
+ type: :development
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.6'
97
+ - !ruby/object:Gem::Dependency
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '3.6'
103
+ name: backports
104
+ prerelease: false
105
+ type: :runtime
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.6'
111
+ - !ruby/object:Gem::Dependency
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '1.6'
117
+ name: nokogiri
118
+ prerelease: false
119
+ type: :runtime
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.6'
125
+ - !ruby/object:Gem::Dependency
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '1.3'
131
+ name: gyoku
132
+ prerelease: false
133
+ type: :runtime
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '1.3'
139
+ - !ruby/object:Gem::Dependency
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '2.6'
145
+ name: nori
146
+ prerelease: false
147
+ type: :runtime
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '2.6'
153
+ - !ruby/object:Gem::Dependency
154
+ requirement: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '1.0'
159
+ name: recursive-open-struct
160
+ prerelease: false
161
+ type: :runtime
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '1.0'
167
+ - !ruby/object:Gem::Dependency
168
+ requirement: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - "~>"
171
+ - !ruby/object:Gem::Version
172
+ version: '1.7'
173
+ name: parslet
174
+ prerelease: false
175
+ type: :runtime
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '1.7'
181
+ - !ruby/object:Gem::Dependency
182
+ requirement: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - "~>"
185
+ - !ruby/object:Gem::Version
186
+ version: '1.0'
187
+ name: simple_xlsx_reader
188
+ prerelease: false
189
+ type: :runtime
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '1.0'
195
+ - !ruby/object:Gem::Dependency
196
+ requirement: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - "~>"
199
+ - !ruby/object:Gem::Version
200
+ version: '2.0'
201
+ name: logging
202
+ prerelease: false
203
+ type: :runtime
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '2.0'
209
+ - !ruby/object:Gem::Dependency
210
+ requirement: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - "~>"
213
+ - !ruby/object:Gem::Version
214
+ version: '1.0'
215
+ name: concurrent-ruby
216
+ prerelease: false
217
+ type: :runtime
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '1.0'
223
+ - !ruby/object:Gem::Dependency
224
+ requirement: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - "~>"
227
+ - !ruby/object:Gem::Version
228
+ version: 0.9.11
229
+ name: yard
230
+ prerelease: false
231
+ type: :runtime
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: 0.9.11
237
+ - !ruby/object:Gem::Dependency
238
+ requirement: !ruby/object:Gem::Requirement
239
+ requirements:
240
+ - - "~>"
241
+ - !ruby/object:Gem::Version
242
+ version: '2.5'
243
+ name: roo
244
+ prerelease: false
245
+ type: :runtime
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - "~>"
249
+ - !ruby/object:Gem::Version
250
+ version: '2.5'
251
+ - !ruby/object:Gem::Dependency
252
+ requirement: !ruby/object:Gem::Requirement
253
+ requirements:
254
+ - - "~>"
255
+ - !ruby/object:Gem::Version
256
+ version: '1.0'
257
+ name: roo-xls
258
+ prerelease: false
259
+ type: :runtime
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - "~>"
263
+ - !ruby/object:Gem::Version
264
+ version: '1.0'
265
+ - !ruby/object:Gem::Dependency
266
+ requirement: !ruby/object:Gem::Requirement
267
+ requirements:
268
+ - - ">="
269
+ - !ruby/object:Gem::Version
270
+ version: '0'
271
+ name: tty-prompt
272
+ prerelease: false
273
+ type: :runtime
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - ">="
277
+ - !ruby/object:Gem::Version
278
+ version: '0'
279
+ - !ruby/object:Gem::Dependency
280
+ requirement: !ruby/object:Gem::Requirement
281
+ requirements:
282
+ - - ">="
283
+ - !ruby/object:Gem::Version
284
+ version: '0'
285
+ name: tty-config
286
+ prerelease: false
287
+ type: :runtime
288
+ version_requirements: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - ">="
291
+ - !ruby/object:Gem::Version
292
+ version: '0'
293
+ - !ruby/object:Gem::Dependency
294
+ requirement: !ruby/object:Gem::Requirement
295
+ requirements:
296
+ - - ">="
297
+ - !ruby/object:Gem::Version
298
+ version: '0'
299
+ name: thor
300
+ prerelease: false
301
+ type: :runtime
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - ">="
305
+ - !ruby/object:Gem::Version
306
+ version: '0'
307
+ description: Some tool classes for other LIBIS gems.
308
+ email:
309
+ - kris.dekeyser@libis.be
310
+ executables:
311
+ - libis_tool
312
+ extensions: []
313
+ extra_rdoc_files: []
314
+ files:
315
+ - ".coveralls.yml"
316
+ - ".gitignore"
317
+ - ".rspec"
318
+ - ".travis.yml"
319
+ - Gemfile
320
+ - README.md
321
+ - Rakefile
322
+ - bin/libis_tool
323
+ - lib/libis-tools.rb
324
+ - lib/libis/tools.rb
325
+ - lib/libis/tools/assert.rb
326
+ - lib/libis/tools/checksum.rb
327
+ - lib/libis/tools/cli/cli_helper.rb
328
+ - lib/libis/tools/cli/reorg.rb
329
+ - lib/libis/tools/command.rb
330
+ - lib/libis/tools/command_line.rb
331
+ - lib/libis/tools/config.rb
332
+ - lib/libis/tools/config_file.rb
333
+ - lib/libis/tools/csv.rb
334
+ - lib/libis/tools/deep_struct.rb
335
+ - lib/libis/tools/extend/array.rb
336
+ - lib/libis/tools/extend/empty.rb
337
+ - lib/libis/tools/extend/hash.rb
338
+ - lib/libis/tools/extend/kernel.rb
339
+ - lib/libis/tools/extend/ostruct.rb
340
+ - lib/libis/tools/extend/roo.rb
341
+ - lib/libis/tools/extend/string.rb
342
+ - lib/libis/tools/extend/struct.rb
343
+ - lib/libis/tools/extend/symbol.rb
344
+ - lib/libis/tools/logger.rb
345
+ - lib/libis/tools/mets_dnx.rb
346
+ - lib/libis/tools/mets_file.rb
347
+ - lib/libis/tools/mets_objects.rb
348
+ - lib/libis/tools/parameter.rb
349
+ - lib/libis/tools/spreadsheet.rb
350
+ - lib/libis/tools/temp_file.rb
351
+ - lib/libis/tools/thread_safe.rb
352
+ - lib/libis/tools/version.rb
353
+ - lib/libis/tools/xml_document.rb
354
+ - libis-tools.gemspec
355
+ - spec/assert_spec.rb
356
+ - spec/checksum_spec.rb
357
+ - spec/command_spec.rb
358
+ - spec/config_file_spec.rb
359
+ - spec/config_spec.rb
360
+ - spec/csv_spec.rb
361
+ - spec/data/test-headers.csv
362
+ - spec/data/test-headers.tsv
363
+ - spec/data/test-noheaders.csv
364
+ - spec/data/test-noheaders.tsv
365
+ - spec/data/test.data
366
+ - spec/data/test.xlsx
367
+ - spec/data/test.xml
368
+ - spec/data/test.yml
369
+ - spec/data/test_config.yml
370
+ - spec/deep_struct_spec.rb
371
+ - spec/logger_spec.rb
372
+ - spec/mets_file_spec.rb
373
+ - spec/parameter_container_spec.rb
374
+ - spec/parameter_spec.rb
375
+ - spec/spec_helper.rb
376
+ - spec/spreadsheet_spec.rb
377
+ - spec/temp_file_spec.rb
378
+ - spec/test.xsd
379
+ - spec/thread_safe_spec.rb
380
+ - spec/xmldocument_spec.rb
381
+ - test/test_helper.rb
382
+ - test/webservices/test_ca_item_info.rb
383
+ - test/webservices/test_ca_search.rb
384
+ homepage: https://github.com/Kris-LIBIS/LIBIS_Tools
385
+ licenses:
386
+ - MIT
387
+ metadata: {}
388
+ post_install_message:
389
+ rdoc_options: []
390
+ require_paths:
391
+ - lib
392
+ required_ruby_version: !ruby/object:Gem::Requirement
393
+ requirements:
394
+ - - ">="
395
+ - !ruby/object:Gem::Version
396
+ version: '0'
397
+ required_rubygems_version: !ruby/object:Gem::Requirement
398
+ requirements:
399
+ - - ">="
400
+ - !ruby/object:Gem::Version
401
+ version: '0'
402
+ requirements: []
403
+ rubyforge_project:
404
+ rubygems_version: 2.6.14.1
405
+ signing_key:
406
+ specification_version: 4
407
+ summary: LIBIS toolbox.
408
+ test_files:
409
+ - spec/assert_spec.rb
410
+ - spec/checksum_spec.rb
411
+ - spec/command_spec.rb
412
+ - spec/config_file_spec.rb
413
+ - spec/config_spec.rb
414
+ - spec/csv_spec.rb
415
+ - spec/data/test-headers.csv
416
+ - spec/data/test-headers.tsv
417
+ - spec/data/test-noheaders.csv
418
+ - spec/data/test-noheaders.tsv
419
+ - spec/data/test.data
420
+ - spec/data/test.xlsx
421
+ - spec/data/test.xml
422
+ - spec/data/test.yml
423
+ - spec/data/test_config.yml
424
+ - spec/deep_struct_spec.rb
425
+ - spec/logger_spec.rb
426
+ - spec/mets_file_spec.rb
427
+ - spec/parameter_container_spec.rb
428
+ - spec/parameter_spec.rb
429
+ - spec/spec_helper.rb
430
+ - spec/spreadsheet_spec.rb
431
+ - spec/temp_file_spec.rb
432
+ - spec/test.xsd
433
+ - spec/thread_safe_spec.rb
434
+ - spec/xmldocument_spec.rb
435
+ - test/test_helper.rb
436
+ - test/webservices/test_ca_item_info.rb
437
+ - test/webservices/test_ca_search.rb