umlaut 3.0.0beta2 → 3.0.0beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/app/assets/javascripts/umlaut/{expand_contract_toggle.js → expand_contract_toggle.js.erb} +4 -4
  2. data/app/controllers/store_controller.rb +2 -6
  3. data/lib/service_adaptors/primo_service.rb +39 -14
  4. data/lib/service_adaptors/sfx.rb +23 -22
  5. data/lib/service_adaptors/worldcat_identities.rb +3 -3
  6. data/lib/umlaut/version.rb +1 -1
  7. data/test/integration/permalinks_test.rb +19 -0
  8. metadata +45 -132
  9. data/lib/exlibris/aleph/patron.rb +0 -64
  10. data/lib/exlibris/aleph/record.rb +0 -54
  11. data/lib/exlibris/aleph/rest_api.rb +0 -29
  12. data/lib/exlibris/primo/holding.rb +0 -186
  13. data/lib/exlibris/primo/related_link.rb +0 -17
  14. data/lib/exlibris/primo/rsrc.rb +0 -17
  15. data/lib/exlibris/primo/searcher.rb +0 -297
  16. data/lib/exlibris/primo/source/aleph.rb +0 -46
  17. data/lib/exlibris/primo/source/distribution/nyu_aleph.rb +0 -344
  18. data/lib/exlibris/primo/toc.rb +0 -17
  19. data/lib/exlibris/primo_ws.rb +0 -140
  20. data/test/dummy/tmp/cache/assets/C2A/410/sprockets%2Fd654b74912b4773a2534616863fb6565 +0 -0
  21. data/test/dummy/tmp/cache/assets/C45/A30/sprockets%2F39494895e462697b478d3d0c79298a26 +0 -0
  22. data/test/dummy/tmp/cache/assets/C5F/340/sprockets%2F99692920160b7a279b86a80415b79db7 +0 -0
  23. data/test/dummy/tmp/cache/assets/C70/4D0/sprockets%2F034ad2036e623081bd352800786dfe80 +0 -0
  24. data/test/dummy/tmp/cache/assets/C80/980/sprockets%2Fc94807409c1523d43e18d25f35d93c41 +0 -0
  25. data/test/dummy/tmp/cache/assets/CBD/730/sprockets%2F034c1086748b981c36672d5a56e7fed6 +0 -0
  26. data/test/dummy/tmp/cache/assets/CBF/B60/sprockets%2F08ca89671549936265dcb673bf02e36f +0 -0
  27. data/test/dummy/tmp/cache/assets/CC9/9F0/sprockets%2F306166316e2cafd13c15e62b51a2339d +0 -0
  28. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  29. data/test/dummy/tmp/cache/assets/CF7/2B0/sprockets%2F25a7c73655bd3598173b39d9f98bcd46 +0 -0
  30. data/test/dummy/tmp/cache/assets/CFE/080/sprockets%2F37fe9f4255baddbd549a659914929398 +0 -0
  31. data/test/dummy/tmp/cache/assets/D16/F90/sprockets%2F5fe3c021048c6f9a6086bed7736d87b1 +0 -0
  32. data/test/dummy/tmp/cache/assets/D24/360/sprockets%2F6987b047a96dc685ba3cf39b31477f6d +0 -0
  33. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  34. data/test/dummy/tmp/cache/assets/D33/FD0/sprockets%2F2ba0b4e6334a77b923e5f770381bb2bf +0 -0
  35. data/test/dummy/tmp/cache/assets/D37/2B0/sprockets%2F40834fb07d7318c1fddd5003bd9e04f6 +0 -0
  36. data/test/dummy/tmp/cache/assets/D43/0D0/sprockets%2F682843a8d0795a5fbcfeb2f0c81727d0 +0 -0
  37. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  38. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  39. data/test/dummy/tmp/cache/assets/D6C/7D0/sprockets%2F8a05d6981ec0d38c51739bef0b3a9c2b +0 -0
  40. data/test/dummy/tmp/cache/assets/D74/4C0/sprockets%2F64fdf30f75592d6e45fcfc45a48d20a2 +0 -0
  41. data/test/dummy/tmp/cache/assets/D94/FF0/sprockets%2F3b56a1aa77de0d570c38a4a9d5f4b1d6 +0 -0
  42. data/test/dummy/tmp/cache/assets/D97/6B0/sprockets%2Fb070e8c799d1a4ad5e62e0a1ae3b83e6 +0 -0
  43. data/test/dummy/tmp/cache/assets/DA6/A80/sprockets%2F92e26d8e58d5bcc8b8f6c25d1b05b9c1 +0 -0
  44. data/test/dummy/tmp/cache/assets/DC0/D20/sprockets%2F1ccf7405cd252dcec4bf23af82e2563a +0 -0
  45. data/test/dummy/tmp/cache/assets/DD2/D80/sprockets%2Fc66d103807d0f971fbbcf9aa8b8b27ee +0 -0
  46. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  47. data/test/dummy/tmp/cache/assets/DE8/790/sprockets%2Fd1333bde2b9aafcc712d11dd09ab35d8 +0 -0
  48. data/test/dummy/tmp/cache/assets/DF7/960/sprockets%2F99ac6db10b44a64fbba4ee847b35ba8b +0 -0
  49. data/test/dummy/tmp/cache/assets/DFC/040/sprockets%2F15ea81cf915c0cb1dfc9cc04c9fef364 +0 -0
  50. data/test/dummy/tmp/cache/assets/DFD/300/sprockets%2Fabac9489cf7f1db8ef00d72a1571ee1e +0 -0
  51. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  52. data/test/dummy/tmp/cache/assets/E38/FE0/sprockets%2Fe1fc875efa817cbb94a5d8de25ea4e6b +0 -0
  53. data/test/dummy/tmp/cache/assets/E5F/960/sprockets%2Fdc007b6cad5c7ef08e33ec28cfff0ef6 +0 -0
  54. data/test/unit/aleph_patron_test.rb +0 -44
  55. data/test/unit/aleph_record_benchmarks.rb +0 -32
  56. data/test/unit/aleph_record_test.rb +0 -35
  57. data/test/unit/primo_searcher_test.rb +0 -415
  58. data/test/unit/primo_ws_test.rb +0 -147
@@ -1,44 +0,0 @@
1
- require 'test_helper'
2
- class AlephPatronTest < Test::Unit::TestCase
3
-
4
- nyu_only_tests(self.name) do
5
-
6
- def setup
7
- @primo_config = YAML.load_file("#{Rails.root}/config/primo.yml")
8
- @nyu_aleph_config = @primo_config["sources"]["nyu_aleph"]
9
- @rest_url = @nyu_aleph_config["rest_url"]
10
- @aleph_doc_library = "NYU01"
11
- @aleph_doc_number = "000062856"
12
- @nyuidn = "N12162279"
13
- @aleph_adm_library = "NYU50"
14
- @aleph_item_id = "NYU50000062856000010"
15
- @aleph_renew_item_id = "NYU50000647049"
16
- @pickup_location = "BOBST"
17
- @bogus_url = "http://library.nyu.edu/bogus"
18
- end
19
-
20
- # Test exception handling for bogus response.
21
- def test_bogus_response
22
- patron = Exlibris::Aleph::Patron.new(@nyuidn, @bogus_url)
23
- assert_raise(MultiXml::ParseError) { patron.loans }
24
- assert_raise(MultiXml::ParseError) { patron.renew_loans() }
25
- assert_raise(MultiXml::ParseError) { patron.renew_loans(@aleph_renew_item_id) }
26
- assert_raise(RuntimeError) { patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {:pickup_location => @pickup_location}) }
27
- end
28
-
29
- # Test search for a single Primo document.
30
- def test_patron
31
- patron = Exlibris::Aleph::Patron.new(@nyuidn, @rest_url)
32
- loans = patron.loans
33
- assert_nil(patron.error, "Failure in #{patron.class} while getting loans: #{patron.error}")
34
- #renew_loans = patron.renew_loans()
35
- #assert_nil(patron.error, "Failure in #{patron.class} while renewing all loans: #{patron.error}")
36
- #renew_loans = patron.renew_loans(@aleph_renew_item_id)
37
- #assert_nil(patron.error, "Failure in #{patron.class} while renewing loan #{@aleph_renew_item_id}: #{patron.error}")
38
- assert_raise(RuntimeError) { patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {}) }
39
- place_hold = patron.place_hold(@aleph_adm_library, @aleph_doc_library, @aleph_doc_number, @aleph_item_id, {:pickup_location => @pickup_location})
40
- assert_nil(patron.error, "Failure in #{patron.class} while placing hold: #{patron.error}")
41
- end
42
-
43
- end
44
- end
@@ -1,32 +0,0 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
2
- class AlephRecordBenchMarks < Test::Unit::TestCase
3
- nyu_only_tests(self.name) do
4
-
5
- def setup
6
- @primo_config = YAML.load_file("#{Rails.root}/config/primo.yml")
7
- @nyu_aleph_config = @primo_config["sources"]["nyu_aleph"]
8
- @rest_url = @nyu_aleph_config["rest_url"]
9
- @aleph_doc_library = "NYU01"
10
- @aleph_doc_number = "000062856"
11
- @bogus_url = "http://library.nyu.edu/bogus"
12
- @TESTS = 10
13
- end
14
-
15
- # Get benchmarks for calls to the Aleph API.
16
- def test_benchmarks
17
- # Display performance benchmarks.
18
- time = Benchmark.bmbm do |results|
19
- results.report("Aleph items:") { @TESTS.times {
20
- aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @rest_url)
21
- items = aleph_record.items
22
- } }
23
- results.report("Aleph bib and holdings:") { @TESTS.times {
24
- aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @rest_url)
25
- items = aleph_record.bib
26
- items = aleph_record.holdings
27
- } }
28
- end
29
- end
30
-
31
- end
32
- end
@@ -1,35 +0,0 @@
1
- require 'test_helper'
2
- class AlephRecordTest < Test::Unit::TestCase
3
-
4
- nyu_only_tests(self.name) do
5
-
6
- def setup
7
- @primo_config = YAML.load_file("#{Rails.root}/config/primo.yml")
8
- @nyu_aleph_config = @primo_config["sources"]["nyu_aleph"]
9
- @rest_url = @nyu_aleph_config["rest_url"]
10
- @aleph_doc_library = "NYU01"
11
- @aleph_doc_number = "000062856"
12
- @bogus_url = "http://library.nyu.edu/bogus"
13
- end
14
-
15
-
16
- # Test exception handling for bogus response.
17
- def test_bogus_response
18
- aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @bogus_url)
19
- assert_raise(RuntimeError) { aleph_record.bib }
20
- assert_raise(RuntimeError) { aleph_record.holdings }
21
- assert_raise(MultiXml::ParseError) { aleph_record.items }
22
- end
23
-
24
- # Test search for a single Primo document.
25
- def test_record
26
- aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @rest_url)
27
- bib = aleph_record.bib
28
- assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling bib: #{aleph_record.error}")
29
- holdings = aleph_record.holdings
30
- assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling holdings: #{aleph_record.error}")
31
- items = aleph_record.items
32
- assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling items: #{aleph_record.error}")
33
- end
34
- end
35
- end
@@ -1,415 +0,0 @@
1
- require "benchmark"
2
- require 'test_helper'
3
- class PrimoSearcherTest < Test::Unit::TestCase
4
- PNX_NS = {'pnx' => 'http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib'}
5
- SEARCH_NS = {'search' => 'http://www.exlibrisgroup.com/xsd/jaguar/search'}
6
-
7
- nyu_only_tests(self.name) do
8
-
9
- def setup
10
- @primo_definition = YAML.load( %{
11
- type: PrimoService
12
- priority: 2 # After SFX, to get SFX metadata enhancement
13
- status: active
14
- base_url: http://bobcat.library.nyu.edu
15
- vid: NYU
16
- institution: NYU
17
- holding_search_institution: NYU
18
- holding_search_text: Search for this title in BobCat.
19
- suppress_holdings: [ !ruby/regexp '/\$\$LBWEB/', !ruby/regexp '/\$\$LNWEB/', !ruby/regexp '/\$\$LTWEB/', !ruby/regexp '/\$\$LWEB/', !ruby/regexp '/\$\$1Restricted Internet Resources/' ]
20
- ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.nyu\.edu\/login\?url=/'
21
- service_types:
22
- - primo_source
23
- - holding_search
24
- - fulltext
25
- - table_of_contents
26
- - referent_enhance
27
- - cover_image
28
- })
29
-
30
- @base_url = @primo_definition["base_url"]
31
- @vid = @primo_definition["vid"]
32
- @institution = @primo_definition["institution"]
33
- @primo_holdings_doc_id = "nyu_aleph000062856"
34
- @primo_rsrcs_doc_id = "nyu_aleph002895625"
35
- @primo_tocs_doc_id = "nyu_aleph003149772"
36
- @primo_dedupmrg_doc_id = "dedupmrg17343091"
37
- @primo_test_checked_out_doc_id = "nyu_aleph000089771"
38
- @primo_test_offsite_doc_id = "nyu_aleph002169696"
39
- @primo_test_ill_doc_id = "nyu_aleph001502625"
40
- @primo_test_diacritics1_doc_id = "nyu_aleph002975583"
41
- @primo_test_diacritics2_doc_id = "nyu_aleph003205339"
42
- @primo_test_diacritics3_doc_id = "nyu_aleph003365921"
43
- @primo_test_journals1_doc_id = "nyu_aleph002895625"
44
- @primo_invalid_doc_id = "thisIsNotAValidDocId"
45
- @primo_test_problem_doc_id = "nyu_aleph000509288"
46
- @primo_test_bug1361_id = "ebrroutebr10416506"
47
- @primo_test_isbn = "0143039008"
48
- @primo_test_title = "Travels with My Aunt"
49
- @primo_test_author = "Graham Greene"
50
- @primo_test_genre = "Book"
51
- @primo_config = YAML.load_file("#{Rails.root}/config/primo.yml")
52
- @searcher_setup = {
53
- :base_url => @base_url,
54
- :institution => @institution,
55
- :vid => @vid,
56
- :config => @primo_config
57
- }
58
-
59
- @searcher_setup_without_config = {
60
- :base_url => @base_url,
61
- :institution => @institution,
62
- :vid => @vid
63
- }
64
- end
65
-
66
- # def test_primo_searcher_benchmarks
67
- # Benchmark.bmbm do |results|
68
- # results.report("Primo Searcher:") {
69
- # (1..10).each {
70
- # searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_holdings_doc_id})
71
- # }
72
- # }
73
- # searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_holdings_doc_id})
74
- # results.report("Searcher#process_record") {
75
- # (1..10).each {
76
- # searcher.send(:process_record)
77
- # }
78
- # }
79
- # results.report("Searcher#process_search_results") {
80
- # (1..10).each {
81
- # searcher.send(:process_search_results)
82
- # }
83
- # }
84
- # end
85
- # end
86
-
87
- # Test search for a single Primo document.
88
- def test_search_by_doc_id
89
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_holdings_doc_id})
90
- assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
91
- search_results = searcher.response
92
- assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
93
- assert_equal(@primo_holdings_doc_id, search_results.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
94
- assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for doc id: #{@primo_holdings_doc_id}.")
95
- end
96
-
97
- # Test search for a Primo problem record
98
- def test_search_by_genre_discrepancy
99
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_test_problem_doc_id})
100
- assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
101
- search_results = searcher.response
102
- assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
103
- assert_equal(@primo_test_problem_doc_id, search_results.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
104
- assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for doc id: #{@primo_test_problem_doc_id}.")
105
- assert_equal(1, searcher.holdings.length, "#{searcher.class} returned unexpected holdings")
106
- end
107
-
108
- def test_search_by_bug1361
109
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_test_bug1361_id})
110
- assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
111
- search_results = searcher.response
112
- assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
113
- assert_equal(@primo_test_bug1361_id, search_results.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
114
- assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for doc id: #{@primo_test_bug1361_id}.")
115
- assert_equal(0, searcher.holdings.length, "#{searcher.class} returned unexpected holdings")
116
- assert_equal(4, searcher.rsrcs.length, "#{searcher.class} returned unexpected rsrcs")
117
- end
118
-
119
- # Test search for an invalid Primo document.
120
- def test_search_by_invalid_doc_id
121
- assert_raise(RuntimeError) {
122
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_invalid_doc_id})
123
- }
124
- end
125
-
126
- # Test invalid setup.
127
- def test_search_by_invalid_setup1
128
- assert_raise(RuntimeError) {
129
- searcher = Exlibris::Primo::Searcher.new({}, {:primo_id => @primo_invalid_doc_id})
130
- }
131
- end
132
-
133
- # Test invalid setup.
134
- def test_search_by_invalid_setup2
135
- assert_raise(RuntimeError) {
136
- searcher = Exlibris::Primo::Searcher.new({:base_url => @base_url, :config => nil}, {:primo_id => @primo_invalid_doc_id})
137
- }
138
- end
139
-
140
- # Test base setup search for a single Primo document.
141
- def test_search_base_setup_record_id
142
- searcher = Exlibris::Primo::Searcher.new({:base_url => @base_url, :institution => @institution}, {:primo_id => @primo_holdings_doc_id})
143
- holdings = searcher.holdings
144
- assert_instance_of(Array, holdings, "#{searcher.class} holdings is an unexpected object: #{holdings.class}")
145
- assert(holdings.count > 0, "#{searcher.class} returned 0 holdings for doc id: #{@primo_holdings_doc_id}.")
146
- first_holding = holdings.first
147
- assert_instance_of(Exlibris::Primo::Holding, first_holding, "#{searcher.class} first holding is an unexpected object: #{first_holding.class}")
148
- assert_equal("check_holdings", first_holding.status, "#{searcher.class} first holding has an unexpected status: #{first_holding.status}")
149
- assert_equal("NYU", first_holding.institution, "#{searcher.class} first holding has an unexpected institution: #{first_holding.institution}")
150
- assert_equal("BOBST", first_holding.library, "#{searcher.class} first holding has an unexpected library: #{first_holding.library}")
151
- assert_equal("Main Collection", first_holding.collection, "#{searcher.class} first holding has an unexpected collection: #{first_holding.collection}")
152
- assert_equal("(PR6013.R44 T7 2004 )", first_holding.call_number, "#{searcher.class} first holding has an unexpected call number: #{first_holding.call_number}")
153
- end
154
-
155
- # Test search by isbn.
156
- def test_search_by_isbn
157
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:isbn => @primo_test_isbn})
158
- assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
159
- search_results = searcher.response
160
- assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
161
- search_results.search("//search/isbn") do |isbn|
162
- assert_not_nil(isbn.inner_text.match(@primo_test_isbn), "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
163
- end
164
- assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for ISBN: #{@primo_test_isbn}.")
165
- end
166
-
167
- # Test search by isbn.
168
- def test_search_by_issn
169
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup_without_config, {:issn => "0002-8614"})
170
- assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
171
- search_results = searcher.response
172
- assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
173
- search_results.search("//search/issn") do |isbn|
174
- assert_not_nil(isbn.inner_text.match("0002-8614"), "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
175
- end
176
- assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for ISSN: 0002-8614.")
177
- end
178
-
179
- # Test search by title/author/genre.
180
- def test_search_by_title_author_genre
181
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:title => @primo_test_title, :author => @primo_test_author, :genre => @primo_test_genre})
182
- assert_not_nil(searcher, "#{searcher.class} returned nil when instantiated.")
183
- search_results = searcher.response
184
- assert_instance_of(Nokogiri::XML::Document, search_results, "#{searcher.class} search result is an unexpected object: #{search_results.class}")
185
- search_results.search("//search/title") do |title|
186
- assert_not_nil(title.inner_text.downcase.match(@primo_test_title.downcase), "#{searcher.class} returned an unexpected record: #{search_results.to_xml(:indent => 5, :encoding => 'UTF-8')}")
187
- end
188
- assert(searcher.count.to_i > 0, "#{searcher.class} returned 0 results for Title: #{@primo_test_title}.")
189
- end
190
-
191
- # Test search for a single Primo document w/ holdings.
192
- def test_holdings
193
- searcher = Exlibris::Primo::Searcher.new(@searcher_setup, {:primo_id => @primo_holdings_doc_id})
194
- holdings = searcher.holdings
195
- assert_instance_of(Array, holdings,
196
- "#{searcher.class} holdings is an unexpected object: #{holdings.class}")
197
- assert_equal(1, holdings.count,
198
- "#{searcher.class} returned 0 holdings for doc id: #{@primo_holdings_doc_id}.")
199
- first_holding = holdings.first
200
- assert_instance_of(
201
- Exlibris::Primo::Holding,
202
- first_holding,
203
- "#{searcher.class} first holding is an unexpected object: #{first_holding.class}")
204
- test_data = {
205
- :record_id => "nyu_aleph000062856",
206
- :source_id => "nyu_aleph",
207
- :original_source_id => "NYU01",
208
- :source_record_id => "000062856",
209
- :institution_code => "NYU",
210
- :institution => "NYU",
211
- :library_code => "BOBST",
212
- :library => "NYU Bobst",
213
- :status_code => "check_holdings",
214
- :status => "Check Availability",
215
- :id_one => "Main Collection",
216
- :id_two => "(PR6013.R44 T7 2004 )",
217
- :collection => "Main Collection",
218
- :call_number => "(PR6013.R44 T7 2004 )",
219
- :origin => nil,
220
- :display_type => "book",
221
- :coverage => [],
222
- :notes => "",
223
- :url => "#{@base_url}/primo_library/libweb/action/dlDisplay.do?docId=nyu_aleph000062856&institution=NYU&vid=#{@vid}",
224
- :request_url => nil,
225
- :match_reliability => ServiceResponse::MatchExact,
226
- :request_link_supports_ajax_call => false }
227
- test_data.each { |key, value|
228
- assert_equal(
229
- value,
230
- first_holding.send(key),
231
- "#{searcher.class} first holding has an unexpected #{key}: #{first_holding.send(key)}")
232
- }
233
- end
234
-
235
-
236
- # Test search for a single Primo document w/ rsrcs.
237
- def test_rsrcs
238
- searcher = Exlibris::Primo::Searcher.new(
239
- @searcher_setup,
240
- { :primo_id => @primo_rsrcs_doc_id })
241
- rsrcs = searcher.rsrcs
242
- assert_instance_of(Array, rsrcs,
243
- "#{searcher.class} rsrcs is an unexpected object: #{rsrcs.class}")
244
- assert_equal(2, rsrcs.count,
245
- "#{searcher.class} returned an unexpected amount of rsrcs (#{rsrcs.count}) for doc id: #{@primo_rsrcs_doc_id}.")
246
- first_rsrc = rsrcs.first
247
- assert_instance_of(
248
- Exlibris::Primo::Rsrc,
249
- first_rsrc,
250
- "#{searcher.class} first rsrc is an unexpected object: #{first_rsrc.class}")
251
- test_data = {
252
- :record_id => "nyu_aleph002895625",
253
- :v => nil,
254
- :url => "https://ezproxy.library.nyu.edu/login?url=http://mq.oxfordjournals.org/",
255
- :display => "Online Version",
256
- :institution_code => "NYU",
257
- :origin => nil,
258
- :notes => "" }
259
- test_data.each { |key, value|
260
- assert_equal(
261
- value,
262
- first_rsrc.send(key),
263
- "#{searcher.class} first rsrc has an unexpected #{key}: #{first_rsrc.send(key)}")
264
- }
265
- end
266
-
267
- # Test search for a single Primo document w/ tocs.
268
- def test_tocs
269
- searcher = Exlibris::Primo::Searcher.new(
270
- @searcher_setup,
271
- { :primo_id => @primo_tocs_doc_id })
272
- tocs = searcher.tocs
273
- assert_instance_of(Array, tocs,
274
- "#{searcher.class} tocs is an unexpected object: #{tocs.class}")
275
- assert_equal(1, tocs.count,
276
- "#{searcher.class} returned an unexpected amount of tocs (#{tocs.count}) for doc id: #{@primo_tocs_doc_id}.")
277
- first_toc = tocs.last
278
- assert_instance_of(
279
- Exlibris::Primo::Toc,
280
- first_toc,
281
- "#{searcher.class} first toc is an unexpected object: #{first_toc.class}")
282
- test_data = {
283
- :record_id => "nyu_aleph003149772",
284
- :url => "http://www.loc.gov/catdir/toc/onix07/2001024342.html",
285
- :display => "Table of Contents",
286
- :notes => "" }
287
- test_data.each { |key, value|
288
- assert_equal(
289
- value,
290
- first_toc.send(key),
291
- "#{searcher.class} first toc has an unexpected #{key}: #{first_toc.send(key)}")
292
- }
293
- end
294
-
295
- def test_dedupmrg
296
- searcher = Exlibris::Primo::Searcher.new(
297
- @searcher_setup,
298
- { :primo_id => @primo_dedupmrg_doc_id })
299
- holdings = searcher.holdings
300
- assert_instance_of(Array, holdings,
301
- "#{searcher.class} holdings is an unexpected object: #{holdings.class}")
302
- assert_equal(6, holdings.count,
303
- "#{searcher.class} returned 0 holdings for doc id: #{@primo_dedupmrg_doc_id}.")
304
- first_holding = holdings.first
305
- assert_instance_of(
306
- Exlibris::Primo::Holding,
307
- first_holding,
308
- "#{searcher.class} first holding is an unexpected object: #{first_holding.class}")
309
- test_data = {
310
- :record_id => "dedupmrg17343091",
311
- :source_id => "nyu_aleph",
312
- :original_source_id => "NYU01",
313
- :source_record_id => "000932393",
314
- :institution_code => "NYU",
315
- :institution => "NYU",
316
- :library_code => "BWEB",
317
- :library => "NYU Restricted Internet",
318
- :status_code => "check_holdings",
319
- :status => "Check Availability",
320
- :id_one => "Internet Resources",
321
- :id_two => "(Newspaper Electronic access )",
322
- :collection => "Internet Resources",
323
- :call_number => "(Newspaper Electronic access )",
324
- :origin => "nyu_aleph000932393",
325
- :display_type => "journal",
326
- :coverage => [],
327
- :notes => "",
328
- :url => "#{@base_url}/primo_library/libweb/action/dlDisplay.do?docId=dedupmrg17343091&institution=NYU&vid=#{@vid}",
329
- :request_url => nil,
330
- :match_reliability => ServiceResponse::MatchExact,
331
- :request_link_supports_ajax_call => false }
332
- test_data.each { |key, value|
333
- assert_equal(
334
- value,
335
- first_holding.send(key),
336
- "#{searcher.class} first holding has an unexpected #{key}: #{first_holding.send(key)}")
337
- }
338
- rsrcs = searcher.rsrcs
339
- assert_instance_of(Array, rsrcs,
340
- "#{searcher.class} rsrcs is an unexpected object: #{rsrcs.class}")
341
- assert_equal(8, rsrcs.count,
342
- "#{searcher.class} returned an unexpected amount of rsrcs (#{rsrcs.count}) for doc id: #{@primo_rsrcs_doc_id}.")
343
- first_rsrc = rsrcs.first
344
- assert_instance_of(
345
- Exlibris::Primo::Rsrc,
346
- first_rsrc,
347
- "#{searcher.class} first rsrc is an unexpected object: #{first_rsrc.class}")
348
- test_data = {
349
- :record_id => "dedupmrg17343091",
350
- :v => "",
351
- :url => "https://ezproxy.library.nyu.edu/login?url=http://proquest.umi.com/pqdweb?RQT=318&VName=PQD&clientid=9269&pmid=7818",
352
- :display => "1995 - Current Access via Proquest",
353
- :institution_code => "NYU",
354
- :origin => "nyu_aleph000932393",
355
- :notes => "" }
356
- test_data.each { |key, value|
357
- assert_equal(
358
- value,
359
- first_rsrc.send(key),
360
- "#{searcher.class} first rsrc has an unexpected #{key}: #{first_rsrc.send(key)}")
361
- }
362
- end
363
-
364
- # def test_holdings_diacritics1
365
- # searcher = Exlibris::Primo::Searcher.new(
366
- # @searcher_setup,
367
- # { :primo_id => @primo_test_diacritics1_doc_id })
368
- # assert_equal(
369
- # "Rubāʻīyāt-i Bābā Ṭāhir",
370
- # searcher.btitle,
371
- # "#{searcher.class} has an unexpected btitle: #{searcher.btitle}")
372
- # assert_equal(
373
- # "Bābā-Ṭāhir, 11th cent",
374
- # searcher.au,
375
- # "#{searcher.class} has an unexpected author: #{searcher.au}")
376
- # end
377
-
378
- # # This test fails but I don't know why!
379
- # def test_holdings_diacritics2
380
- # searcher = Exlibris::Primo::Searcher.new(
381
- # @searcher_setup,
382
- # { :primo_id => @primo_test_diacritics2_doc_id })
383
- # assert_equal(
384
- # "أقليم توات خلال القرنين الثامن عشر والتاسع عشر الميلاديين : دراسة لأوضاع الأقليم السياسية والأجتماعية والأقتصادية والثقافية، مع تحقيق كتاب القول البسيط في أخبار تمنطيط (لمحمد بن بابا حيده)",
385
- # searcher.btitle,
386
- # "#{searcher.class} has an unexpected btitle: #{searcher.btitle}")
387
- # puts ("\n")
388
- # puts searcher.au.bytes.collect.inspect
389
- # faraj = "Faraj, Faraj Maḥmūd"
390
- # puts ("\n»")
391
- # puts "»".bytes.collect.inspect
392
- # puts faraj.bytes.collect.inspect
393
- # assert_equal(
394
- # "Faraj, Faraj Maḥmūd",
395
- # searcher.au,
396
- # "#{searcher.class} has an unexpected author: #{searcher.au}")
397
- # assert_equal("(DT299.T88 F373 2007)", first_holding.call_number, "#{searcher.class} first holding has an unexpected call number: #{first_holding.call_number}")
398
- # end
399
- #
400
- # def test_holdings_diacritics3
401
- # searcher = Exlibris::Primo::Searcher.new(
402
- # @searcher_setup,
403
- # { :primo_id => @primo_test_diacritics3_doc_id })
404
- # assert_equal(
405
- # "Mul har ha-gaʻash : ḥoḳre toldot Yiśraʼel le-nokhaḥ ha-Shoʼah",
406
- # searcher.btitle,
407
- # "#{searcher.class} has an unexpected btitle: #{searcher.btitle}")
408
- # assert_equal(
409
- # "Engel, David",
410
- # searcher.au,
411
- # "#{searcher.class} has an unexpected author: #{searcher.au}")
412
- # end
413
-
414
- end
415
- end