umlaut 3.0.0alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (293) hide show
  1. data/LICENSE +7 -0
  2. data/README.md +49 -0
  3. data/Rakefile +37 -0
  4. data/app/assets/images/error.gif +0 -0
  5. data/app/assets/images/export_bg_bot.gif +0 -0
  6. data/app/assets/images/export_bg_mid.gif +0 -0
  7. data/app/assets/images/export_bg_top.gif +0 -0
  8. data/app/assets/images/famfamfam/book_open.png +0 -0
  9. data/app/assets/images/famfamfam/cross.png +0 -0
  10. data/app/assets/images/famfamfam/page_sound.gif +0 -0
  11. data/app/assets/images/famfamfam/page_text.gif +0 -0
  12. data/app/assets/images/famfamfam/page_up.gif +0 -0
  13. data/app/assets/images/famfamfam/page_white.png +0 -0
  14. data/app/assets/images/famfamfam/readme.html +1495 -0
  15. data/app/assets/images/famfamfam/tiny_cross.png +0 -0
  16. data/app/assets/images/frame_remove.gif +0 -0
  17. data/app/assets/images/ico_go.gif +0 -0
  18. data/app/assets/images/jhu_findit.gif +0 -0
  19. data/app/assets/images/list_closed.png +0 -0
  20. data/app/assets/images/list_open.png +0 -0
  21. data/app/assets/images/more_info.gif +0 -0
  22. data/app/assets/images/rails.png +0 -0
  23. data/app/assets/images/request.gif +0 -0
  24. data/app/assets/images/spinner.gif +0 -0
  25. data/app/assets/javascripts/umlaut/ajax_windows.js +35 -0
  26. data/app/assets/javascripts/umlaut/ensure_window_size.js.erb +34 -0
  27. data/app/assets/javascripts/umlaut/expand_contract_toggle.js +25 -0
  28. data/app/assets/javascripts/umlaut/search_autocomplete.js +46 -0
  29. data/app/assets/javascripts/umlaut/simple_visible_toggle.js +8 -0
  30. data/app/assets/javascripts/umlaut/update_html.js +152 -0
  31. data/app/assets/javascripts/umlaut.js +17 -0
  32. data/app/assets/stylesheets/umlaut.css +857 -0
  33. data/app/controllers/application_controller.rb +14 -0
  34. data/app/controllers/export_email_controller.rb +123 -0
  35. data/app/controllers/js_helper_controller.rb +10 -0
  36. data/app/controllers/link_router_controller.rb +87 -0
  37. data/app/controllers/open_search_controller.rb +9 -0
  38. data/app/controllers/resolve_controller.rb +288 -0
  39. data/app/controllers/resource_controller.rb +83 -0
  40. data/app/controllers/search_controller.rb +328 -0
  41. data/app/controllers/search_methods/sfx3.rb +148 -0
  42. data/app/controllers/search_methods/sfx4.rb +257 -0
  43. data/app/controllers/search_methods/sfx_api.rb +47 -0
  44. data/app/controllers/store_controller.rb +64 -0
  45. data/app/controllers/umlaut/controller_behavior.rb +20 -0
  46. data/app/controllers/umlaut/controller_logic.rb +96 -0
  47. data/app/controllers/umlaut/error_handling.rb +48 -0
  48. data/app/controllers/umlaut_controller.rb +112 -0
  49. data/app/helpers/application_helper.rb +4 -0
  50. data/app/helpers/emailer_helper.rb +43 -0
  51. data/app/helpers/export_email_helper.rb +34 -0
  52. data/app/helpers/open_search_helper.rb +7 -0
  53. data/app/helpers/resolve_helper.rb +225 -0
  54. data/app/helpers/search_helper.rb +50 -0
  55. data/app/helpers/umlaut/footer_helper.rb +64 -0
  56. data/app/helpers/umlaut/helper.rb +62 -0
  57. data/app/helpers/umlaut/html_head_helper.rb +37 -0
  58. data/app/helpers/umlaut/url_generation.rb +77 -0
  59. data/app/mailers/emailer.rb +48 -0
  60. data/app/models/clickthrough.rb +2 -0
  61. data/app/models/collection.rb +259 -0
  62. data/app/models/crossref_lookup.rb +2 -0
  63. data/app/models/dispatched_service.rb +58 -0
  64. data/app/models/permalink.rb +29 -0
  65. data/app/models/referent.rb +473 -0
  66. data/app/models/referent_value.rb +14 -0
  67. data/app/models/request.rb +449 -0
  68. data/app/models/service_response.rb +179 -0
  69. data/app/models/service_store.rb +59 -0
  70. data/app/models/service_type_value.rb +58 -0
  71. data/app/models/service_wave.rb +150 -0
  72. data/app/models/sfx_db/az_additional_title.rb +11 -0
  73. data/app/models/sfx_db/az_letter_group.rb +11 -0
  74. data/app/models/sfx_db/az_title.rb +38 -0
  75. data/app/models/sfx_db/az_title_v2.rb +34 -0
  76. data/app/models/sfx_db/isbn.rb +12 -0
  77. data/app/models/sfx_db/issn.rb +12 -0
  78. data/app/models/sfx_db/object.rb +35 -0
  79. data/app/models/sfx_db/object_portfolio.rb +6 -0
  80. data/app/models/sfx_db/publisher.rb +10 -0
  81. data/app/models/sfx_db/sfx_db_base.rb +54 -0
  82. data/app/models/sfx_db/target.rb +9 -0
  83. data/app/models/sfx_db/target_service.rb +10 -0
  84. data/app/models/sfx_db/title.rb +10 -0
  85. data/app/models/sfx_db.rb +10 -0
  86. data/app/models/sfx_url.rb +35 -0
  87. data/app/views/emailer/citation.text.erb +28 -0
  88. data/app/views/emailer/short_citation.text.erb +8 -0
  89. data/app/views/export_email/_email.html.erb +25 -0
  90. data/app/views/export_email/_send_email.html.erb +3 -0
  91. data/app/views/export_email/_send_txt.html.erb +3 -0
  92. data/app/views/export_email/_txt.html.erb +62 -0
  93. data/app/views/export_email/email.html.erb +3 -0
  94. data/app/views/export_email/send_email.html.erb +1 -0
  95. data/app/views/export_email/send_txt.html.erb +1 -0
  96. data/app/views/export_email/txt.html.erb +3 -0
  97. data/app/views/js_helper/loader.erb.js +13 -0
  98. data/app/views/layouts/umlaut.html.erb +52 -0
  99. data/app/views/open_search/index.html.erb +9 -0
  100. data/app/views/resolve/_api_in_progress.xml.erb +21 -0
  101. data/app/views/resolve/_background_progress.html.erb +51 -0
  102. data/app/views/resolve/_background_updater.html.erb +38 -0
  103. data/app/views/resolve/_citation.html.erb +87 -0
  104. data/app/views/resolve/_coins.html.erb +1 -0
  105. data/app/views/resolve/_compact_citation.html.erb +33 -0
  106. data/app/views/resolve/_cover_image.html.erb +35 -0
  107. data/app/views/resolve/_fulltext.html.erb +55 -0
  108. data/app/views/resolve/_help.html.erb +17 -0
  109. data/app/views/resolve/_holding.html.erb +91 -0
  110. data/app/views/resolve/_related_items.html.erb +35 -0
  111. data/app/views/resolve/_search_inside.html.erb +62 -0
  112. data/app/views/resolve/_section_display.html.erb +49 -0
  113. data/app/views/resolve/_service_errors.html.erb +29 -0
  114. data/app/views/resolve/_standard_response_item.html.erb +89 -0
  115. data/app/views/resolve/api.xml.builder +72 -0
  116. data/app/views/resolve/background_status.html.erb +26 -0
  117. data/app/views/resolve/index.html.erb +73 -0
  118. data/app/views/resolve/partial_html_sections.xml.erb +30 -0
  119. data/app/views/search/_a_to_z.html.erb +6 -0
  120. data/app/views/search/_citation.html.erb +94 -0
  121. data/app/views/search/_pager.html.erb +60 -0
  122. data/app/views/search/books.html.erb +103 -0
  123. data/app/views/search/journal_search.html.erb +90 -0
  124. data/app/views/search/journals.html.erb +167 -0
  125. data/app/views/search/opensearch_description.rxml +10 -0
  126. data/app/views/testing/index.html.erb +1 -0
  127. data/app/views/umlaut/README +5 -0
  128. data/app/views/umlaut/error.html.erb +45 -0
  129. data/db/migrate/01_umlaut_init.rb +113 -0
  130. data/db/orig_fixed_data/service_type_values.yml +120 -0
  131. data/db/seeds.rb +7 -0
  132. data/lib/CronTab.rb +192 -0
  133. data/lib/aws_product_sign.rb +146 -0
  134. data/lib/exlibris/aleph/patron.rb +64 -0
  135. data/lib/exlibris/aleph/record.rb +54 -0
  136. data/lib/exlibris/aleph/rest_api.rb +29 -0
  137. data/lib/exlibris/primo/holding.rb +192 -0
  138. data/lib/exlibris/primo/rsrc.rb +17 -0
  139. data/lib/exlibris/primo/searcher.rb +276 -0
  140. data/lib/exlibris/primo/source/aleph.rb +46 -0
  141. data/lib/exlibris/primo/source/distribution/nyu_aleph.rb +323 -0
  142. data/lib/exlibris/primo/toc.rb +17 -0
  143. data/lib/exlibris/primo_ws.rb +140 -0
  144. data/lib/generators/templates/umlaut_services.yml +237 -0
  145. data/lib/generators/umlaut/asset_hooks_generator.rb +44 -0
  146. data/lib/generators/umlaut/install_generator.rb +110 -0
  147. data/lib/hip3/bib.rb +291 -0
  148. data/lib/hip3/bib_searcher.rb +302 -0
  149. data/lib/hip3/custom_field_lookup.rb +44 -0
  150. data/lib/hip3/holding.rb +50 -0
  151. data/lib/hip3/item.rb +65 -0
  152. data/lib/hip3/receipt.rb +7 -0
  153. data/lib/hip3/serial_copy.rb +82 -0
  154. data/lib/holding.rb +32 -0
  155. data/lib/marc_helper.rb +254 -0
  156. data/lib/metadata_helper.rb +312 -0
  157. data/lib/opensearch_feed.rb +398 -0
  158. data/lib/opensearch_query.rb +98 -0
  159. data/lib/referent_filter.rb +16 -0
  160. data/lib/referent_filters/dissertation_catch.rb +45 -0
  161. data/lib/section_renderer.rb +503 -0
  162. data/lib/service.rb +336 -0
  163. data/lib/service_adaptors/ajax_export.rb +37 -0
  164. data/lib/service_adaptors/amazon.rb +412 -0
  165. data/lib/service_adaptors/blacklight.rb +327 -0
  166. data/lib/service_adaptors/book_finder.rb +40 -0
  167. data/lib/service_adaptors/bx.rb +51 -0
  168. data/lib/service_adaptors/cover_thing.rb +73 -0
  169. data/lib/service_adaptors/elsevier_cover.rb +57 -0
  170. data/lib/service_adaptors/email_export.rb +10 -0
  171. data/lib/service_adaptors/ezproxy.rb +171 -0
  172. data/lib/service_adaptors/google_book_search.rb +442 -0
  173. data/lib/service_adaptors/gpo.rb +124 -0
  174. data/lib/service_adaptors/hathi_trust.rb +308 -0
  175. data/lib/service_adaptors/hip3_service.rb +150 -0
  176. data/lib/service_adaptors/hip_holding_search.rb +237 -0
  177. data/lib/service_adaptors/internet_archive.rb +488 -0
  178. data/lib/service_adaptors/isbn_db.rb +86 -0
  179. data/lib/service_adaptors/isi.rb +258 -0
  180. data/lib/service_adaptors/jcr.rb +146 -0
  181. data/lib/service_adaptors/opac.rb +351 -0
  182. data/lib/service_adaptors/open_library.rb +316 -0
  183. data/lib/service_adaptors/open_library_cover.rb +73 -0
  184. data/lib/service_adaptors/primo_service.rb +392 -0
  185. data/lib/service_adaptors/primo_source.rb +78 -0
  186. data/lib/service_adaptors/pubmed.rb +133 -0
  187. data/lib/service_adaptors/request_to_fixture.rb +68 -0
  188. data/lib/service_adaptors/scopus.rb +295 -0
  189. data/lib/service_adaptors/sfx-new.rb +557 -0
  190. data/lib/service_adaptors/sfx.rb +566 -0
  191. data/lib/service_adaptors/sfx_backchannel_record.rb +69 -0
  192. data/lib/service_adaptors/txt_holding_export.rb +32 -0
  193. data/lib/service_adaptors/ulrichs_cover.rb +57 -0
  194. data/lib/service_adaptors/ulrichs_link.rb +47 -0
  195. data/lib/service_adaptors/worldcat.rb +116 -0
  196. data/lib/service_adaptors/worldcat_identities.rb +591 -0
  197. data/lib/tasks/umlaut.rake +134 -0
  198. data/lib/umlaut/default_configuration.rb +5 -0
  199. data/lib/umlaut/routes.rb +136 -0
  200. data/lib/umlaut/version.rb +3 -0
  201. data/lib/umlaut.rb +37 -0
  202. data/lib/umlaut_configurable.rb +343 -0
  203. data/lib/umlaut_http.rb +100 -0
  204. data/lib/xml_schema_helper.rb +109 -0
  205. data/test/dummy/Rakefile +7 -0
  206. data/test/dummy/app/assets/javascripts/application.js +13 -0
  207. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  208. data/test/dummy/app/controllers/application_controller.rb +3 -0
  209. data/test/dummy/app/controllers/umlaut_controller.rb +112 -0
  210. data/test/dummy/app/helpers/application_helper.rb +2 -0
  211. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  212. data/test/dummy/config/application.rb +45 -0
  213. data/test/dummy/config/boot.rb +10 -0
  214. data/test/dummy/config/database-jhu.yml +44 -0
  215. data/test/dummy/config/database.yml +25 -0
  216. data/test/dummy/config/environment.rb +5 -0
  217. data/test/dummy/config/environments/development.rb +34 -0
  218. data/test/dummy/config/environments/production.rb +60 -0
  219. data/test/dummy/config/environments/test.rb +39 -0
  220. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  221. data/test/dummy/config/initializers/inflections.rb +10 -0
  222. data/test/dummy/config/initializers/mime_types.rb +5 -0
  223. data/test/dummy/config/initializers/secret_token.rb +7 -0
  224. data/test/dummy/config/initializers/session_store.rb +8 -0
  225. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  226. data/test/dummy/config/locales/en.yml +5 -0
  227. data/test/dummy/config/routes.rb +61 -0
  228. data/test/dummy/config/umlaut_services.yml +237 -0
  229. data/test/dummy/config.ru +4 -0
  230. data/test/dummy/db/migrate/20111228211210_umlaut_init.rb +113 -0
  231. data/test/dummy/db/schema.rb +124 -0
  232. data/test/dummy/log/development.log +12981 -0
  233. data/test/dummy/log/production.log +0 -0
  234. data/test/dummy/public/404.html +26 -0
  235. data/test/dummy/public/422.html +26 -0
  236. data/test/dummy/public/500.html +26 -0
  237. data/test/dummy/public/favicon.ico +0 -0
  238. data/test/dummy/script/rails +6 -0
  239. data/test/dummy/tmp/cache/assets/C5F/340/sprockets%2F99692920160b7a279b86a80415b79db7 +0 -0
  240. data/test/dummy/tmp/cache/assets/C70/4D0/sprockets%2F034ad2036e623081bd352800786dfe80 +0 -0
  241. data/test/dummy/tmp/cache/assets/C73/920/sprockets%2Fd371318f22900492fd180f17c5e2a504 +9268 -0
  242. data/test/dummy/tmp/cache/assets/C80/980/sprockets%2Fc94807409c1523d43e18d25f35d93c41 +0 -0
  243. data/test/dummy/tmp/cache/assets/C8F/780/sprockets%2Fe47e28558116fb5f8038754e60d1961d +11769 -0
  244. data/test/dummy/tmp/cache/assets/CAA/EB0/sprockets%2F1d179210e8b76f1ea63c802688a015e4 +9271 -0
  245. data/test/dummy/tmp/cache/assets/CBB/9C0/sprockets%2F706f28923fb754cad04b9107c89986a1 +0 -0
  246. data/test/dummy/tmp/cache/assets/CBF/B60/sprockets%2F08ca89671549936265dcb673bf02e36f +0 -0
  247. data/test/dummy/tmp/cache/assets/CC9/9F0/sprockets%2F306166316e2cafd13c15e62b51a2339d +0 -0
  248. data/test/dummy/tmp/cache/assets/CF6/F20/sprockets%2F5b2ffa1103079dfd555197838f87a99f +0 -0
  249. data/test/dummy/tmp/cache/assets/CF7/2B0/sprockets%2F25a7c73655bd3598173b39d9f98bcd46 +862 -0
  250. data/test/dummy/tmp/cache/assets/CFE/080/sprockets%2F37fe9f4255baddbd549a659914929398 +0 -0
  251. data/test/dummy/tmp/cache/assets/D22/060/sprockets%2F9aec77b768e91a802d284271c58e2f7e +21357 -0
  252. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  253. data/test/dummy/tmp/cache/assets/D33/6D0/sprockets%2F500129c57f1146e556ec3aacd6cd38c1 +0 -0
  254. data/test/dummy/tmp/cache/assets/D33/FD0/sprockets%2F2ba0b4e6334a77b923e5f770381bb2bf +0 -0
  255. data/test/dummy/tmp/cache/assets/D42/C20/sprockets%2Fbcf14e437b1582bf93b77670acf8e090 +21353 -0
  256. data/test/dummy/tmp/cache/assets/D50/A30/sprockets%2F7d8b294ac433db5d056538f8cf7c66b9 +0 -0
  257. data/test/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +872 -0
  258. data/test/dummy/tmp/cache/assets/D65/590/sprockets%2Fc1bb92fc3406a126b7dd302edc96d629 +0 -0
  259. data/test/dummy/tmp/cache/assets/D71/6B0/sprockets%2Fde558b71b494cf09b1bf055c8dff0353 +0 -0
  260. data/test/dummy/tmp/cache/assets/D72/610/sprockets%2Fa8c708eeb30ef93de34d755d4f45d023 +859 -0
  261. data/test/dummy/tmp/cache/assets/D76/AD0/sprockets%2Fe2158cde93188cf5ab6457bc6d6602ec +0 -0
  262. data/test/dummy/tmp/cache/assets/D7A/E40/sprockets%2F9622ffcc499a57627cd1bb18fe31b8e4 +11772 -0
  263. data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
  264. data/test/dummy/tmp/cache/assets/D9B/770/sprockets%2F8aacf02eb7dbb0949704b28f27b87e0b +0 -0
  265. data/test/dummy/tmp/cache/assets/DA6/A80/sprockets%2F92e26d8e58d5bcc8b8f6c25d1b05b9c1 +0 -0
  266. data/test/dummy/tmp/cache/assets/DE8/790/sprockets%2Fd1333bde2b9aafcc712d11dd09ab35d8 +0 -0
  267. data/test/dummy/tmp/cache/assets/DF7/F30/sprockets%2F7bc16c4109b17fabe29f8ddbbf732d1c +374 -0
  268. data/test/dummy/tmp/cache/assets/E03/570/sprockets%2F493bdc0ac14cd4f57fdfe4253f992bde +0 -0
  269. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  270. data/test/dummy/tmp/cache/assets/E0B/4B0/sprockets%2F7988df51a61c81ce6ede4a2d4c8cce4f +377 -0
  271. data/test/dummy/tmp/cache/assets/E5F/960/sprockets%2Fdc007b6cad5c7ef08e33ec28cfff0ef6 +0 -0
  272. data/test/fixtures/dispatched_services.yml +5 -0
  273. data/test/fixtures/permalinks.yml +5 -0
  274. data/test/fixtures/referent_values.yml +1734 -0
  275. data/test/fixtures/referents.yml +156 -0
  276. data/test/fixtures/requests.yml +284 -0
  277. data/test/fixtures/service_responses.yml +5 -0
  278. data/test/fixtures/sfx_urls.yml +4 -0
  279. data/test/performance/browsing_test.rb +9 -0
  280. data/test/test_helper.rb +10 -0
  281. data/test/umlaut_test.rb +7 -0
  282. data/test/unit/aleph_patron_test.rb +39 -0
  283. data/test/unit/aleph_record_benchmarks.rb +28 -0
  284. data/test/unit/aleph_record_test.rb +30 -0
  285. data/test/unit/aws_product_sign_test.rb +93 -0
  286. data/test/unit/collection_test.rb +76 -0
  287. data/test/unit/google_book_search_test.rb +101 -0
  288. data/test/unit/primo_searcher_test.rb +403 -0
  289. data/test/unit/primo_service_test.rb +939 -0
  290. data/test/unit/primo_ws_test.rb +131 -0
  291. data/test/unit/service_response_test.rb +9 -0
  292. data/test/unit/service_test.rb +33 -0
  293. metadata +580 -0
@@ -0,0 +1,939 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+ class PrimoServiceTest < ActiveSupport::TestCase
3
+ fixtures :requests, :referents, :referent_values, :sfx_urls
4
+ def setup
5
+ @primo_definition = YAML.load( %{
6
+ type: PrimoService
7
+ priority: 2 # After SFX, to get SFX metadata enhancement
8
+ status: active
9
+ base_url: http://bobcatdev.library.nyu.edu
10
+ vid: NYU
11
+ institution: NYU
12
+ holding_search_institution: NYU
13
+ holding_search_text: Search for this title in BobCat.
14
+ suppress_holdings: [ !ruby/regexp '/\$\$LBWEB/', !ruby/regexp '/\$\$LNWEB/', !ruby/regexp '/\$\$LTWEB/', !ruby/regexp '/\$\$LWEB/', !ruby/regexp '/\$\$1Restricted Internet Resources/' ]
15
+ ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.nyu\.edu\/login\?url=/'
16
+ service_types:
17
+ - primo_source
18
+ - holding_search
19
+ - fulltext
20
+ - table_of_contents
21
+ - referent_enhance
22
+ - cover_image
23
+ })
24
+
25
+ @base_url = @primo_definition["base_url"]
26
+ @vid = @primo_definition["vid"]
27
+
28
+ @primo_default = ServiceStore.instantiate_service!(
29
+ YAML.load(%{
30
+ type: PrimoService
31
+ priority: 2 # After SFX, to get SFX metadata enhancement
32
+ status: active
33
+ base_url: http://bobcatdev.library.nyu.edu
34
+ vid: NYU
35
+ institution: NYU
36
+ holding_search_institution: NYU
37
+ holding_search_text: Search for this title in BobCat.
38
+ suppress_holdings: [ !ruby/regexp '/\$\$LBWEB/', !ruby/regexp '/\$\$LNWEB/', !ruby/regexp '/\$\$LTWEB/', !ruby/regexp '/\$\$LWEB/', !ruby/regexp '/\$\$1Restricted Internet Resources/' ]
39
+ ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.nyu\.edu\/login\?url=/'
40
+ service_types:
41
+ - primo_source
42
+ - holding_search
43
+ - fulltext
44
+ - table_of_contents
45
+ - referent_enhance
46
+ - cover_image
47
+ }), nil)
48
+
49
+ @primo_tns = ServiceStore.instantiate_service!(
50
+ YAML.load(%{
51
+ type: PrimoService
52
+ priority: 2 # After SFX, to get SFX metadata enhancement
53
+ status: active
54
+ base_url: http://bobcatdev.library.nyu.edu
55
+ vid: NS
56
+ holding_search_institution: NS
57
+ holding_search_text: Search for this title in BobCat.
58
+ suppress_holdings: [ !ruby/regexp '/\$\$LBWEB/', !ruby/regexp '/\$\$LNWEB/', !ruby/regexp '/\$\$LTWEB/', !ruby/regexp '/\$\$LWEB/', !ruby/regexp '/\$\$1Restricted Internet Resources/' ]
59
+ ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.nyu\.edu\/login\?url=/'
60
+ primo_config: tns_primo.yml
61
+ service_types:
62
+ - primo_source
63
+ - holding_search
64
+ - fulltext
65
+ - table_of_contents
66
+ - referent_enhance
67
+ - cover_image
68
+ }), nil)
69
+
70
+
71
+
72
+ @holding_search_institution =
73
+ @primo_minimum = PrimoService.new({
74
+ "priority"=>1, "service_id" => "NYU_Primo",
75
+ "base_url" => @base_url, "vid" => @vid,
76
+ "holding_search_institution" => @primo_definition["holding_search_institution"] })
77
+ @primo_old_minimum = PrimoService.new({
78
+ "priority"=>1, "service_id" => "NYU_Primo",
79
+ "base_path" => @base_url, "base_view_id" => @vid })
80
+ @primo_minimum_no_config = PrimoService.new({
81
+ "priority"=>1, "service_id" => "NYU_Primo",
82
+ "base_url" => @base_url, "vid" => @vid,
83
+ "holding_search_institution" => @primo_definition["holding_search_institution"],
84
+ "primo_config" => "missing_config.yml" })
85
+ end
86
+
87
+ def test_primo_service_benchmarks
88
+ request = requests(:primo_id_request)
89
+ Benchmark.bmbm do |results|
90
+ results.report("PrimoService Minimum Config:") {
91
+ (1..10).each {
92
+ @primo_minimum.handle(request)
93
+ }
94
+ }
95
+ results.report("PrimoService Default Config:") {
96
+ (1..10).each {
97
+ @primo_default.handle(request)
98
+ }
99
+ }
100
+ end
101
+ end
102
+
103
+ def test_to_primo_source_benchmarks
104
+ request = requests(:primo_id_request)
105
+ @primo_default.handle(request)
106
+ service_type = request.get_service_type('primo_source', {}).first
107
+ Benchmark.bmbm do |results|
108
+ results.report("PrimoService :to_primo_source via view data - NYUAleph:") {
109
+ (1..10).each {
110
+ service_type.view_data
111
+ }
112
+ }
113
+ service_response = service_type.service_response
114
+ results.report("PrimoService :to_primo_source - NYUAleph:") {
115
+ (1..10).each {
116
+ @primo_default.to_primo_source(service_response)
117
+ }
118
+ }
119
+ end
120
+ end
121
+
122
+ def test_primo_source_benchmarks
123
+ request = requests(:primo_id_request)
124
+ @primo_default.handle(request)
125
+ primo_source = ServiceList.instance.instantiate!("NYU_Primo_Source", nil)
126
+ Benchmark.bmbm do |results|
127
+ results.report("PrimoSource - NYUAleph:") {
128
+ (1..10).each {
129
+ primo_source.handle(request)
130
+ }
131
+ }
132
+ end
133
+ end
134
+
135
+ def test_source_expand_benchmarks
136
+ request = requests(:primo_id_request)
137
+ @primo_default.handle(request)
138
+ primo_source = request.get_service_type('primo_source', {}).first.view_data
139
+ Benchmark.bmbm do |results|
140
+ results.report("PrimoSource :expand - NYUAleph:") {
141
+ (1..10).each {
142
+ primo_source.expand
143
+ }
144
+ }
145
+ end
146
+ end
147
+
148
+ def test_primo_service_minimum
149
+ request = requests(:primo_id_request)
150
+ @primo_minimum.handle(request)
151
+ request.referent.referent_values.reset
152
+ request.dispatched_services.reset
153
+ request.service_types.reset
154
+ test_data = {
155
+ "aulast" => "Greene",
156
+ "aufirst" => "Graham,",
157
+ "au" => "Greene, Graham, 1904-1991",
158
+ "title" => "Travels with my aunt",
159
+ "btitle" => "Travels with my aunt",
160
+ "place" => "New York",
161
+ "pub" => "Penguin Books",
162
+ "oclcnum" => "56781200",
163
+ "lccn" => "2004559272"
164
+ }
165
+ test_data.each { |key, value|
166
+ assert_equal(
167
+ value,
168
+ request.referent.metadata[key],
169
+ "#{key} different than expected.")
170
+ }
171
+ holdings = request.get_service_type('holding')
172
+ assert_equal(
173
+ 1, holdings.length)
174
+ test_data = {
175
+ :record_id => "nyu_aleph000062856",
176
+ :source_id => "nyu_aleph",
177
+ :original_source_id => "NYU01",
178
+ :source_record_id => "000062856",
179
+ :institution_code => "NYU",
180
+ :institution => "NYU",
181
+ :library_code => "BOBST",
182
+ :library => "NYU Bobst",
183
+ :status_code => "check_holdings",
184
+ :status => "Check Availability",
185
+ :id_one => "Main Collection",
186
+ :id_two => "(PR6013.R44 T7 2004 )",
187
+ :collection => "Main Collection",
188
+ :call_number => "(PR6013.R44 T7 2004 )",
189
+ :origin => nil,
190
+ :display_type => "book",
191
+ :coverage => [],
192
+ :notes => "",
193
+ :url => "#{@base_url}/primo_library/libweb/action/dlDisplay.do?docId=nyu_aleph000062856&institution=NYU&vid=#{@vid}",
194
+ :request_url => nil,
195
+ :match_reliability => ServiceResponse::MatchExact,
196
+ :request_link_supports_ajax_call => false }
197
+ test_data.each { |key, value|
198
+ assert_equal(
199
+ value,
200
+ holdings.first.view_data[key],
201
+ "#{key} different than expected.")
202
+ }
203
+ end
204
+
205
+ def test_primo_service_minimum_no_config
206
+ request = requests(:primo_id_request)
207
+ @primo_minimum_no_config.handle(request)
208
+ request.referent.referent_values.reset
209
+ request.dispatched_services.reset
210
+ request.service_types.reset
211
+ test_data = {
212
+ "aulast" => "Greene",
213
+ "aufirst" => "Graham,",
214
+ "au" => "Greene, Graham, 1904-1991",
215
+ "title" => "Travels with my aunt",
216
+ "btitle" => "Travels with my aunt",
217
+ "place" => "New York",
218
+ "pub" => "Penguin Books",
219
+ "oclcnum" => "56781200",
220
+ "lccn" => "2004559272"
221
+ }
222
+ test_data.each { |key, value|
223
+ assert_equal(
224
+ value,
225
+ request.referent.metadata[key],
226
+ "#{key} different than expected.")
227
+ }
228
+ holdings = request.get_service_type('holding')
229
+ assert_equal(
230
+ 1, holdings.length)
231
+ test_data = {
232
+ :record_id => "nyu_aleph000062856",
233
+ :source_id => "nyu_aleph",
234
+ :original_source_id => "NYU01",
235
+ :source_record_id => "000062856",
236
+ :institution_code => "NYU",
237
+ :institution => "NYU",
238
+ :library_code => "BOBST",
239
+ :library => "BOBST",
240
+ :status_code => "check_holdings",
241
+ :status => "check_holdings",
242
+ :id_one => "Main Collection",
243
+ :id_two => "(PR6013.R44 T7 2004 )",
244
+ :collection => "Main Collection",
245
+ :call_number => "(PR6013.R44 T7 2004 )",
246
+ :origin => nil,
247
+ :display_type => "book",
248
+ :coverage => [],
249
+ :notes => "",
250
+ :url => "#{@base_url}/primo_library/libweb/action/dlDisplay.do?docId=nyu_aleph000062856&institution=NYU&vid=#{@vid}",
251
+ :request_url => nil,
252
+ :match_reliability => ServiceResponse::MatchExact,
253
+ :request_link_supports_ajax_call => false }
254
+ test_data.each { |key, value|
255
+ assert_equal(
256
+ value,
257
+ holdings.first.view_data[key],
258
+ "#{key} different than expected.")
259
+ }
260
+ end
261
+
262
+ def test_primo_service_legacy_settings_minimum
263
+ request = requests(:primo_id_request)
264
+ @primo_old_minimum.handle(request)
265
+ request.referent.referent_values.reset
266
+ request.dispatched_services.reset
267
+ request.service_types.reset
268
+ test_data = {
269
+ "aulast" => "Greene",
270
+ "aufirst" => "Graham,",
271
+ "au" => "Greene, Graham, 1904-1991",
272
+ "title" => "Travels with my aunt",
273
+ "btitle" => "Travels with my aunt",
274
+ "place" => "New York",
275
+ "pub" => "Penguin Books",
276
+ "oclcnum" => "56781200",
277
+ "lccn" => "2004559272"
278
+ }
279
+ test_data.each { |key, value|
280
+ assert_equal(
281
+ value,
282
+ request.referent.metadata[key],
283
+ "#{key} different than expected.")
284
+ }
285
+ holdings = request.get_service_type('holding')
286
+ assert_equal(
287
+ 1, holdings.length)
288
+ test_data = {
289
+ :record_id => "nyu_aleph000062856",
290
+ :source_id => "nyu_aleph",
291
+ :original_source_id => "NYU01",
292
+ :source_record_id => "000062856",
293
+ :institution_code => "NYU",
294
+ :institution => "NYU",
295
+ :library_code => "BOBST",
296
+ :library => "NYU Bobst",
297
+ :status_code => "check_holdings",
298
+ :status => "Check Availability",
299
+ :id_one => "Main Collection",
300
+ :id_two => "(PR6013.R44 T7 2004 )",
301
+ :collection => "Main Collection",
302
+ :call_number => "(PR6013.R44 T7 2004 )",
303
+ :origin => nil,
304
+ :display_type => "book",
305
+ :coverage => [],
306
+ :notes => "",
307
+ :url => "#{@base_url}/primo_library/libweb/action/dlDisplay.do?docId=nyu_aleph000062856&institution=NYU&vid=#{@vid}",
308
+ :request_url => nil,
309
+ :match_reliability => ServiceResponse::MatchExact,
310
+ :request_link_supports_ajax_call => false }
311
+ test_data.each { |key, value|
312
+ assert_equal(
313
+ value,
314
+ holdings.first.view_data[key],
315
+ "#{key} different than expected.")
316
+ }
317
+ end
318
+
319
+ def test_available_nyu_aleph
320
+ # Available
321
+ request = requests(:primo_id_request)
322
+ @primo_default.handle(request)
323
+ request.dispatched_services.reset
324
+ request.service_types.reset
325
+ primo_sources = request.get_service_type('primo_source')
326
+ assert_equal(
327
+ 1, primo_sources.length)
328
+ primo_source = ServiceList.instance.instantiate!("NYU_Primo_Source", nil)
329
+ primo_source.handle(request)
330
+ request.dispatched_services.reset
331
+ request.service_types.reset
332
+ holdings = request.get_service_type('holding')
333
+ assert_equal(
334
+ 1, holdings.length)
335
+ test_data = {
336
+ :record_id => "nyu_aleph000062856",
337
+ :source_id => "nyu_aleph",
338
+ :original_source_id => "NYU01",
339
+ :source_record_id => "000062856",
340
+ :institution_code => "NYU",
341
+ :institution => "NYU",
342
+ :library_code => "BOBST",
343
+ :library => "NYU Bobst",
344
+ :status_code => "available",
345
+ :status => "Available",
346
+ :id_one => "Main Collection",
347
+ :id_two => "(PR6013.R44 T7 2004)",
348
+ :collection => "Main Collection",
349
+ :call_number => "(PR6013.R44 T7 2004)",
350
+ :origin => nil,
351
+ :display_type => "book",
352
+ :coverage => [],
353
+ :notes => "",
354
+ :url => "http://alephstage.library.nyu.edu/F?func=item-global&doc_library=NYU01&local_base=PRIMOCOMMON&doc_number=000062856&sub_library=BOBST",
355
+ :request_url => "http://alephstage.library.nyu.edu/F?func=item-global&doc_library=NYU01&local_base=PRIMOCOMMON&doc_number=000062856&sub_library=BOBST",
356
+ :match_reliability => ServiceResponse::MatchExact,
357
+ :request_link_supports_ajax_call => true }
358
+ test_data.each { |key, value|
359
+ assert_equal(
360
+ value,
361
+ holdings.first.view_data[key],
362
+ "#{key} different than expected.")
363
+ }
364
+ source_data = {
365
+ :aleph_doc_library => "NYU01",
366
+ :aleph_sub_library => "NYU Bobst",
367
+ :aleph_sub_library_code => "BOBST",
368
+ :aleph_collection => "Main Collection",
369
+ :aleph_call_number => "(PR6013.R44 T7 2004)",
370
+ :aleph_doc_number => "000062856",
371
+ :aleph_url => "http://alephstage.library.nyu.edu",
372
+ :illiad_url => "http://illiaddev.library.nyu.edu",
373
+ :aleph_sub_library_code => "BOBST",
374
+ :aleph_item_id => "NYU50000062856000010",
375
+ :aleph_item_adm_library => "NYU50",
376
+ :aleph_item_sub_library_code => "BOBST",
377
+ :aleph_item_collection_code => "MAIN",
378
+ :aleph_item_doc_number => "000062856",
379
+ :aleph_item_sequence_number => "1.0",
380
+ :aleph_item_barcode => "31142041146104",
381
+ :aleph_item_status_code => "01",
382
+ :aleph_item_process_status_code => nil,
383
+ :aleph_item_circulation_status => "On Shelf",
384
+ :aleph_item_location => "PR6013.R44&nbsp;T7 2004",
385
+ :aleph_item_description => nil,
386
+ :aleph_item_hol_doc_number => "002992203"
387
+ }
388
+ source_data.each { |key, value|
389
+ assert_equal(
390
+ value,
391
+ holdings.first.view_data[:source_data][key],
392
+ "#{key} different than expected.")
393
+ }
394
+ end
395
+
396
+ def test_available_tns_aleph
397
+ # Available
398
+ request = requests(:primo_id_request)
399
+ @primo_tns.handle(request)
400
+ request.dispatched_services.reset
401
+ request.service_types.reset
402
+ primo_sources = request.get_service_type('primo_source')
403
+ assert_equal(
404
+ 1, primo_sources.length)
405
+ primo_source = ServiceList.instance.instantiate!("NYU_Primo_Source", nil)
406
+ primo_source.handle(request)
407
+ request.dispatched_services.reset
408
+ request.service_types.reset
409
+ holdings = request.get_service_type('holding')
410
+ assert_equal(
411
+ 1, holdings.length)
412
+ test_data = {
413
+ :record_id => "nyu_aleph000062856",
414
+ :source_id => "nyu_aleph",
415
+ :original_source_id => "NYU01",
416
+ :source_record_id => "000062856",
417
+ :institution_code => "NYU",
418
+ :institution => "NYU",
419
+ :library_code => "BOBST",
420
+ :library => "NYU Bobst",
421
+ :status_code => "available",
422
+ :status => "Available",
423
+ :id_one => "Main Collection",
424
+ :id_two => "(PR6013.R44 T7 2004)",
425
+ :collection => "Main Collection",
426
+ :call_number => "(PR6013.R44 T7 2004)",
427
+ :origin => nil,
428
+ :display_type => "book",
429
+ :coverage => [],
430
+ :notes => "",
431
+ :url => "http://alephstage.library.nyu.edu/F?func=item-global&doc_library=NYU01&local_base=PRIMOCOMMON&doc_number=000062856&sub_library=BOBST",
432
+ :request_url => nil,
433
+ :match_reliability => ServiceResponse::MatchExact,
434
+ :request_link_supports_ajax_call => true }
435
+ test_data.each { |key, value|
436
+ assert_equal(
437
+ value,
438
+ holdings.first.view_data[key],
439
+ "#{key} different than expected.")
440
+ }
441
+ source_data = {
442
+ :aleph_doc_library => "NYU01",
443
+ :aleph_sub_library => "NYU Bobst",
444
+ :aleph_sub_library_code => "BOBST",
445
+ :aleph_collection => "Main Collection",
446
+ :aleph_call_number => "(PR6013.R44 T7 2004)",
447
+ :aleph_doc_number => "000062856",
448
+ :aleph_url => "http://alephstage.library.nyu.edu",
449
+ :illiad_url => "http://illiaddev.library.nyu.edu",
450
+ :aleph_sub_library_code => "BOBST",
451
+ :aleph_item_id => "NYU50000062856000010",
452
+ :aleph_item_adm_library => "NYU50",
453
+ :aleph_item_sub_library_code => "BOBST",
454
+ :aleph_item_collection_code => "MAIN",
455
+ :aleph_item_doc_number => "000062856",
456
+ :aleph_item_sequence_number => "1.0",
457
+ :aleph_item_barcode => "31142041146104",
458
+ :aleph_item_status_code => "01",
459
+ :aleph_item_process_status_code => nil,
460
+ :aleph_item_circulation_status => "On Shelf",
461
+ :aleph_item_location => "PR6013.R44&nbsp;T7 2004",
462
+ :aleph_item_description => nil,
463
+ :aleph_item_hol_doc_number => "002992203"
464
+ }
465
+ source_data.each { |key, value|
466
+ assert_equal(
467
+ value,
468
+ holdings.first.view_data[:source_data][key],
469
+ "#{key} different than expected.")
470
+ }
471
+ end
472
+
473
+ def test_checked_out_nyu_aleph
474
+ request = requests(:primo_checked_out_request)
475
+ @primo_default.handle(request)
476
+ request.referent.referent_values.reset
477
+ request.dispatched_services.reset
478
+ request.service_types.reset
479
+ primo_sources = request.get_service_type('primo_source')
480
+ assert_equal(
481
+ 1, primo_sources.length)
482
+ primo_source = ServiceList.instance.instantiate!("NYU_Primo_Source", nil)
483
+ primo_source.handle(request)
484
+ request.dispatched_services.reset
485
+ request.service_types.reset
486
+ holdings = request.get_service_type('holding')
487
+ assert_equal(
488
+ 1, holdings.length)
489
+ test_data = {
490
+ :record_id => "nyu_aleph000742457",
491
+ :source_id => "nyu_aleph",
492
+ :original_source_id => "NYU01",
493
+ :source_record_id => "000742457",
494
+ :institution_code => "NYU",
495
+ :institution => "NYU",
496
+ :library_code => "BOBST",
497
+ :library => "NYU Bobst",
498
+ :status_code => "checked_out",
499
+ :status => "Due: 08/25/11",
500
+ :id_one => "Main Collection",
501
+ :id_two => "(DR557 .J86 2001)",
502
+ :collection => "Main Collection",
503
+ :call_number => "(DR557 .J86 2001)",
504
+ :origin => nil,
505
+ :display_type => "book",
506
+ :coverage => [],
507
+ :notes => "",
508
+ :url => "http://alephstage.library.nyu.edu/F?func=item-global&doc_library=NYU01&local_base=PRIMOCOMMON&doc_number=000742457&sub_library=BOBST",
509
+ :request_url => "http://alephstage.library.nyu.edu/F?func=item-global&doc_library=NYU01&local_base=PRIMOCOMMON&doc_number=000742457&sub_library=BOBST",
510
+ :match_reliability => ServiceResponse::MatchExact,
511
+ :request_link_supports_ajax_call => true }
512
+ test_data.each { |key, value|
513
+ assert_equal(
514
+ value,
515
+ holdings.first.view_data[key],
516
+ "#{key} different than expected.")
517
+ }
518
+ source_data = {
519
+ :aleph_doc_library => "NYU01",
520
+ :aleph_sub_library => "NYU Bobst",
521
+ :aleph_sub_library_code => "BOBST",
522
+ :aleph_collection => "Main Collection",
523
+ :aleph_call_number => "(DR557 .J86 2001)",
524
+ :aleph_doc_number => "000742457",
525
+ :aleph_url => "http://alephstage.library.nyu.edu",
526
+ :illiad_url => "http://illiaddev.library.nyu.edu",
527
+ :aleph_sub_library_code => "BOBST",
528
+ :aleph_item_id => "NYU50000742457000010",
529
+ :aleph_item_adm_library => "NYU50",
530
+ :aleph_item_sub_library_code => "BOBST",
531
+ :aleph_item_collection_code => "MAIN",
532
+ :aleph_item_doc_number => "000742457",
533
+ :aleph_item_sequence_number => "1.0",
534
+ :aleph_item_barcode => "31142031951646",
535
+ :aleph_item_status_code => "01",
536
+ :aleph_item_process_status_code => nil,
537
+ :aleph_item_circulation_status => "08/25/11",
538
+ :aleph_item_location => "DR557&nbsp;.J86 2001",
539
+ :aleph_item_description => nil,
540
+ :aleph_item_hol_doc_number => "002815266"
541
+ }
542
+ source_data.each { |key, value|
543
+ assert_equal(
544
+ value,
545
+ holdings.first.view_data[:source_data][key],
546
+ "#{key} different than expected.")
547
+ }
548
+ end
549
+
550
+ def test_in_process_nyu_aleph
551
+ request = requests(:primo_bobst_in_processing_request)
552
+ @primo_default.handle(request)
553
+ request.referent.referent_values.reset
554
+ request.dispatched_services.reset
555
+ request.service_types.reset
556
+ primo_sources = request.get_service_type('primo_source')
557
+ assert_equal(
558
+ 1, primo_sources.length)
559
+ primo_source = ServiceList.instance.instantiate!("NYU_Primo_Source", nil)
560
+ primo_source.handle(request)
561
+ request.dispatched_services.reset
562
+ request.service_types.reset
563
+ holdings = request.get_service_type('holding')
564
+ assert_equal(
565
+ 1, holdings.length)
566
+ test_data = {
567
+ :record_id => "nyu_aleph002723601",
568
+ :source_id => "nyu_aleph",
569
+ :original_source_id => "NYU01",
570
+ :source_record_id => "002723601",
571
+ :institution_code => "NYU",
572
+ :institution => "NYU",
573
+ :library_code => "BOBST",
574
+ :library => "NYU Bobst",
575
+ :status_code => "overridden_by_nyu_aleph",
576
+ :status => "In Processing",
577
+ :id_one => "Main Collection",
578
+ :id_two => "(PN691 .B78 1983)",
579
+ :collection => "Main Collection",
580
+ :call_number => "(PN691 .B78 1983)",
581
+ :origin => nil,
582
+ :display_type => "book",
583
+ :coverage => [],
584
+ :notes => "",
585
+ :url => "http://alephstage.library.nyu.edu/F?func=item-global&doc_library=NYU01&local_base=PRIMOCOMMON&doc_number=002723601&sub_library=BOBST",
586
+ :request_url => "http://alephstage.library.nyu.edu/F?func=item-global&doc_library=NYU01&local_base=PRIMOCOMMON&doc_number=002723601&sub_library=BOBST",
587
+ :match_reliability => ServiceResponse::MatchExact,
588
+ :request_link_supports_ajax_call => true }
589
+ test_data.each { |key, value|
590
+ assert_equal(
591
+ value,
592
+ holdings.first.view_data[key],
593
+ "#{key} different than expected.")
594
+ }
595
+ source_data = {
596
+ :aleph_doc_library => "NYU01",
597
+ :aleph_sub_library => "NYU Bobst",
598
+ :aleph_sub_library_code => "BOBST",
599
+ :aleph_collection => "Main Collection",
600
+ :aleph_call_number => "(PN691 .B78 1983)",
601
+ :aleph_doc_number => "002723601",
602
+ :aleph_url => "http://alephstage.library.nyu.edu",
603
+ :illiad_url => "http://illiaddev.library.nyu.edu",
604
+ :aleph_sub_library_code => "BOBST",
605
+ :aleph_item_id => "NYU50002723601000010",
606
+ :aleph_item_adm_library => "NYU50",
607
+ :aleph_item_sub_library_code => "BOBST",
608
+ :aleph_item_collection_code => "MAIN",
609
+ :aleph_item_doc_number => "002723601",
610
+ :aleph_item_sequence_number => "1.0",
611
+ :aleph_item_barcode => "31142011075952",
612
+ :aleph_item_status_code => "01",
613
+ :aleph_item_process_status_code => "BD",
614
+ :aleph_item_circulation_status => "At Bindery",
615
+ :aleph_item_location => "PN691&nbsp;.B78 1983",
616
+ :aleph_item_description => nil,
617
+ :aleph_item_hol_doc_number => "000631538"
618
+ }
619
+ source_data.each { |key, value|
620
+ assert_equal(
621
+ value,
622
+ holdings.first.view_data[:source_data][key],
623
+ "#{key} different than expected.")
624
+ }
625
+ end
626
+
627
+ def test_journal1_nyu_aleph
628
+ request = requests(:primo_journal1_request)
629
+ @primo_default.handle(request)
630
+ request.referent.referent_values.reset
631
+ request.dispatched_services.reset
632
+ request.service_types.reset
633
+ primo_sources = request.get_service_type('primo_source')
634
+ assert_equal(
635
+ 4, primo_sources.length)
636
+ primo_source = ServiceList.instance.instantiate!("NYU_Primo_Source", nil)
637
+ primo_source.handle(request)
638
+ request.dispatched_services.reset
639
+ request.service_types.reset
640
+ holdings = request.get_service_type('holding')
641
+ assert_equal(
642
+ 4, holdings.length)
643
+ test_data = {
644
+ :record_id => "nyu_aleph002895625",
645
+ :source_id => "nyu_aleph",
646
+ :original_source_id => "NYU01",
647
+ :source_record_id => "002895625",
648
+ :institution_code => "NYU",
649
+ :institution => "NYU",
650
+ :library_code => "BOBST",
651
+ :library => "NYU Bobst",
652
+ :status_code => "check_holdings",
653
+ :status => "Check Availability",
654
+ :id_one => "Main Collection",
655
+ :id_two => "(ML1 .M819 )",
656
+ :collection => "Main Collection",
657
+ :call_number => "(ML1 .M819 )",
658
+ :origin => nil,
659
+ :display_type => "journal",
660
+ :coverage => ["Available in Main Collection: VOLUMES: 1-89 (YEARS: 1915-2006)"],
661
+ :notes => "",
662
+ :url => "http://alephstage.library.nyu.edu/F?func=item-global&doc_library=NYU01&local_base=PRIMOCOMMON&doc_number=002895625&sub_library=BOBST",
663
+ :request_url => nil,
664
+ :match_reliability => ServiceResponse::MatchExact,
665
+ :request_link_supports_ajax_call => false }
666
+ test_data.each { |key, value|
667
+ assert_equal(
668
+ value,
669
+ holdings.first.view_data[key],
670
+ "#{key} different than expected.")
671
+ }
672
+ source_data = {
673
+ :aleph_doc_library => "NYU01",
674
+ :aleph_sub_library => "NYU Bobst",
675
+ :aleph_sub_library_code => "BOBST",
676
+ :aleph_collection => "Main Collection",
677
+ :aleph_call_number => "(ML1 .M819 )",
678
+ :aleph_doc_number => "002895625",
679
+ :aleph_sub_library_code => "BOBST"
680
+ }
681
+ source_data.each { |key, value|
682
+ assert_equal(
683
+ value,
684
+ holdings.first.view_data[:source_data][key],
685
+ "#{key} different than expected.")
686
+ }
687
+ end
688
+
689
+ def test_journal1_tns_aleph
690
+ request = requests(:primo_journal1_request)
691
+ @primo_tns.handle(request)
692
+ request.referent.referent_values.reset
693
+ request.dispatched_services.reset
694
+ request.service_types.reset
695
+ primo_sources = request.get_service_type('primo_source')
696
+ assert_equal(
697
+ 4, primo_sources.length)
698
+ primo_source = ServiceList.instance.instantiate!("NYU_Primo_Source", nil)
699
+ primo_source.handle(request)
700
+ request.dispatched_services.reset
701
+ request.service_types.reset
702
+ holdings = request.get_service_type('holding')
703
+ assert_equal(
704
+ 4, holdings.length)
705
+ test_data = {
706
+ :record_id => "nyu_aleph002895625",
707
+ :source_id => "nyu_aleph",
708
+ :original_source_id => "NYU01",
709
+ :source_record_id => "002895625",
710
+ :institution_code => "NYU",
711
+ :institution => "NYU",
712
+ :library_code => "BOBST",
713
+ :library => "NYU Bobst",
714
+ :status_code => "check_holdings",
715
+ :status => "Check Availability",
716
+ :id_one => "Main Collection",
717
+ :id_two => "(ML1 .M819 )",
718
+ :collection => "Main Collection",
719
+ :call_number => "(ML1 .M819 )",
720
+ :origin => nil,
721
+ :display_type => "journal",
722
+ :coverage => ["Available in Main Collection: VOLUMES: 1-89 (YEARS: 1915-2006)"],
723
+ :notes => "",
724
+ :url => "http://alephstage.library.nyu.edu/F?func=item-global&doc_library=NYU01&local_base=PRIMOCOMMON&doc_number=002895625&sub_library=BOBST",
725
+ :request_url => nil,
726
+ :match_reliability => ServiceResponse::MatchExact,
727
+ :request_link_supports_ajax_call => false }
728
+ test_data.each { |key, value|
729
+ assert_equal(
730
+ value,
731
+ holdings.first.view_data[key],
732
+ "#{key} different than expected.")
733
+ }
734
+ source_data = {
735
+ :aleph_doc_library => "NYU01",
736
+ :aleph_sub_library => "NYU Bobst",
737
+ :aleph_sub_library_code => "BOBST",
738
+ :aleph_collection => "Main Collection",
739
+ :aleph_call_number => "(ML1 .M819 )",
740
+ :aleph_doc_number => "002895625",
741
+ :aleph_sub_library_code => "BOBST"
742
+ }
743
+ source_data.each { |key, value|
744
+ assert_equal(
745
+ value,
746
+ holdings.first.view_data[:source_data][key],
747
+ "#{key} different than expected.")
748
+ }
749
+ end
750
+
751
+ def test_journal2_nyu_aleph
752
+ # Journal 2
753
+ request = requests(:primo_journal2_request)
754
+ @primo_default.handle(request)
755
+ request.referent.referent_values.reset
756
+ request.dispatched_services.reset
757
+ request.service_types.reset
758
+ # record_id = request.referent.metadata["primo"]
759
+ assert_equal("Macomb", request.referent.metadata["place"]);
760
+ assert_equal("Center for Business and Economic Research, Western Illinois University]", request.referent.metadata["pub"]);
761
+ primo_sources = request.get_service_type('primo_source')
762
+ assert(1 <= primo_sources.length)
763
+ primo_source = ServiceList.instance.instantiate!("NYU_Primo_Source", nil)
764
+ primo_source.handle(request)
765
+ request.dispatched_services.reset
766
+ request.service_types.reset
767
+ holdings = request.get_service_type('holding')
768
+ assert(1 <= holdings.length)
769
+ assert_equal(primo_sources.length, holdings.length)
770
+ assert_equal("NYU", holdings.first.view_data[:institution])
771
+ assert_equal("NYU Bobst", holdings.first.view_data[:library])
772
+ assert_equal("Main Collection", holdings.first.view_data[:id_one])
773
+ assert_equal("http://alephstage.library.nyu.edu/F?func=item-global&doc_library=NYU01&local_base=PRIMOCOMMON&doc_number=002736245&sub_library=BOBST", holdings.first.view_data[:url])
774
+ assert_equal("(HB1 .J55 )", holdings.first.view_data[:id_two])
775
+ assert_equal("Check Availability", holdings.first.view_data[:status])
776
+ end
777
+
778
+ def test_journal3_nyu_aleph
779
+ # Journal 3
780
+ request = requests(:primo_journal3_request)
781
+ @primo_default.handle(request)
782
+ request.referent.referent_values.reset
783
+ request.dispatched_services.reset
784
+ request.service_types.reset
785
+ # record_id = request.referent.metadata["primo"]
786
+ assert_equal("Sydney", request.referent.metadata["place"]);
787
+ assert_equal("Association for the Journal of Religious History]", request.referent.metadata["pub"]);
788
+ primo_sources = request.get_service_type('primo_source')
789
+ assert_equal(0, primo_sources.length)
790
+ primo_source = ServiceList.instance.instantiate!("NYU_Primo_Source", nil)
791
+ primo_source.handle(request)
792
+ request.dispatched_services.reset
793
+ request.service_types.reset
794
+ holdings = request.get_service_type('holding')
795
+ assert_equal(0, holdings.length)
796
+ assert_equal(primo_sources.length, holdings.length)
797
+ end
798
+
799
+ def test_journal4_nyu_aleph
800
+ # Journal 4
801
+ request = requests(:primo_journal4_request)
802
+ @primo_default.handle(request)
803
+ request.referent.referent_values.reset
804
+ request.dispatched_services.reset
805
+ request.service_types.reset
806
+ # record_id = request.referent.metadata["primo"]
807
+ assert_equal("Waltham, MA", request.referent.metadata["place"]);
808
+ assert_equal("Published for the Board by the Massachusetts Medical Society", request.referent.metadata["pub"]);
809
+ primo_sources = request.get_service_type('primo_source')
810
+ assert_equal(0, primo_sources.length)
811
+ primo_source = ServiceList.instance.instantiate!("NYU_Primo_Source", nil)
812
+ primo_source.handle(request)
813
+ request.dispatched_services.reset
814
+ request.service_types.reset
815
+ holdings = request.get_service_type('holding')
816
+ assert_equal(0, holdings.length)
817
+ assert_equal(primo_sources.length, holdings.length)
818
+ end
819
+
820
+ def test_journal5_nyu_aleph
821
+ request = requests(:primo_journal5_request)
822
+ @primo_default.handle(request)
823
+ request.referent.referent_values.reset
824
+ request.dispatched_services.reset
825
+ request.service_types.reset
826
+ # record_id = request.referent.metadata["primo"]
827
+ primo_sources = request.get_service_type('primo_source')
828
+ assert_equal(1, primo_sources.length)
829
+ primo_source = ServiceList.instance.instantiate!("NYU_Primo_Source", nil)
830
+ primo_source.handle(request)
831
+ request.dispatched_services.reset
832
+ request.service_types.reset
833
+ holdings = request.get_service_type('holding')
834
+ assert_equal(1, holdings.length)
835
+ assert_equal(primo_sources.length, holdings.length)
836
+ end
837
+
838
+ def test_bobst_genre_discrepancy
839
+ request = requests(:primo_bobst_problem1_request)
840
+ @primo_default.handle(request)
841
+ request.dispatched_services.reset
842
+ request.service_types.reset
843
+ primo_sources = request.get_service_type('primo_source')
844
+ assert_equal(
845
+ 1, primo_sources.length)
846
+ primo_source = ServiceList.instance.instantiate!("NYU_Primo_Source", nil)
847
+ primo_source.handle(request)
848
+ request.dispatched_services.reset
849
+ request.service_types.reset
850
+ holdings = request.get_service_type('holding')
851
+ assert_equal(
852
+ 1, holdings.length)
853
+ test_data = {
854
+ :record_id => "nyu_aleph000509288",
855
+ :source_id => "nyu_aleph",
856
+ :original_source_id => "NYU01",
857
+ :source_record_id => "000509288",
858
+ :institution_code => "NYU",
859
+ :institution => "NYU",
860
+ :library_code => "BOBST",
861
+ :library => "NYU Bobst",
862
+ :status_code => "available",
863
+ :status => "Available",
864
+ :id_one => "Main Collection",
865
+ :id_two => "(ML410.J33 M47 2005a)",
866
+ :collection => "Main Collection",
867
+ :call_number => "(ML410.J33 M47 2005a)",
868
+ :origin => nil,
869
+ :display_type => "book",
870
+ :coverage => [],
871
+ :notes => "",
872
+ :url => "http://alephstage.library.nyu.edu/F?func=item-global&doc_library=NYU01&local_base=PRIMOCOMMON&doc_number=000509288&sub_library=BOBST",
873
+ :request_url => "http://alephstage.library.nyu.edu/F?func=item-global&doc_library=NYU01&local_base=PRIMOCOMMON&doc_number=000509288&sub_library=BOBST",
874
+ :match_reliability => ServiceResponse::MatchExact,
875
+ :request_link_supports_ajax_call => true }
876
+ test_data.each { |key, value|
877
+ assert_equal(
878
+ value,
879
+ holdings.first.view_data[key],
880
+ "#{key} different than expected.")
881
+ }
882
+ source_data = {
883
+ :aleph_doc_library => "NYU01",
884
+ :aleph_sub_library => "NYU Bobst",
885
+ :aleph_sub_library_code => "BOBST",
886
+ :aleph_collection => "Main Collection",
887
+ :aleph_call_number => "(ML410.J33 M47 2005a)",
888
+ :aleph_doc_number => "000509288",
889
+ :aleph_url => "http://alephstage.library.nyu.edu",
890
+ :illiad_url => "http://illiaddev.library.nyu.edu",
891
+ :aleph_sub_library_code => "BOBST",
892
+ :aleph_item_id => "NYU50000509288000010",
893
+ :aleph_item_adm_library => "NYU50",
894
+ :aleph_item_sub_library_code => "BOBST",
895
+ :aleph_item_collection_code => "MAIN",
896
+ :aleph_item_doc_number => "000509288",
897
+ :aleph_item_sequence_number => "1.0",
898
+ :aleph_item_barcode => "31142045676163",
899
+ :aleph_item_status_code => "01",
900
+ :aleph_item_process_status_code => nil,
901
+ :aleph_item_circulation_status => "On Shelf",
902
+ :aleph_item_location => "ML410.J33&nbsp;M47 2005a",
903
+ :aleph_item_description => nil,
904
+ :aleph_item_hol_doc_number => "003227224"
905
+ }
906
+ source_data.each { |key, value|
907
+ assert_equal(
908
+ value,
909
+ holdings.first.view_data[:source_data][key],
910
+ "#{key} different than expected.")
911
+ }
912
+ end
913
+
914
+ def test_critical_inquiry_bug
915
+ request = requests(:critical_inquiry_request)
916
+ @primo_default.handle(request)
917
+ request.dispatched_services.reset
918
+ request.service_types.reset
919
+ primo_sources = request.get_service_type('primo_source')
920
+ assert_equal(
921
+ 4, primo_sources.length)
922
+ primo_source = ServiceList.instance.instantiate!("NYU_Primo_Source", nil)
923
+ primo_source.handle(request)
924
+ request.dispatched_services.reset
925
+ request.service_types.reset
926
+ holdings = request.get_service_type('holding')
927
+ assert_equal(
928
+ 4, holdings.length)
929
+ end
930
+
931
+ def test_sfx_owner_but_fulltext_empty
932
+ request = requests(:sfx_owner_but_fulltext_empty_request)
933
+ @primo_default.handle(request)
934
+ request.dispatched_services.reset
935
+ request.service_types.reset
936
+ fulltext = request.get_service_type('fulltext')
937
+ assert_equal(0, fulltext.length)
938
+ end
939
+ end