umlaut 3.0.0alpha10 → 3.0.0alpha11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. data/app/models/collection.rb +7 -1
  2. data/app/models/referent.rb +11 -77
  3. data/app/models/request.rb +2 -2
  4. data/app/models/service_store.rb +4 -0
  5. data/app/models/service_wave.rb +1 -1
  6. data/lib/section_renderer.rb +9 -5
  7. data/lib/service.rb +0 -62
  8. data/lib/service_adaptors/isi.rb +1 -1
  9. data/lib/service_adaptors/jcr.rb +1 -1
  10. data/lib/umlaut/version.rb +1 -1
  11. data/lib/umlaut_configurable.rb +1 -0
  12. data/test/dummy/config/environments/profile.rb +24 -0
  13. data/test/dummy/config/primo.yml +271 -0
  14. data/test/dummy/config/umlaut_services-TEST.yml +37 -0
  15. data/test/dummy/profile/sfx_collection_prof.rb +22 -0
  16. data/test/dummy/tmp/cache/assets/C2A/410/sprockets%2Fd654b74912b4773a2534616863fb6565 +0 -0
  17. data/test/dummy/tmp/cache/assets/C45/A30/sprockets%2F39494895e462697b478d3d0c79298a26 +0 -0
  18. data/test/dummy/tmp/cache/assets/C5F/340/sprockets%2F99692920160b7a279b86a80415b79db7 +0 -0
  19. data/test/dummy/tmp/cache/assets/C70/4D0/sprockets%2F034ad2036e623081bd352800786dfe80 +0 -0
  20. data/test/dummy/tmp/cache/assets/C80/980/sprockets%2Fc94807409c1523d43e18d25f35d93c41 +0 -0
  21. data/test/dummy/tmp/cache/assets/{D0E/570/sprockets%2Fd4a16e3bdd7c7b9543c446b1b0174688 → CBD/730/sprockets%2F034c1086748b981c36672d5a56e7fed6} +0 -0
  22. data/test/dummy/tmp/cache/assets/CBF/B60/sprockets%2F08ca89671549936265dcb673bf02e36f +0 -0
  23. data/test/dummy/tmp/cache/assets/CC9/9F0/sprockets%2F306166316e2cafd13c15e62b51a2339d +0 -0
  24. data/test/dummy/tmp/cache/assets/CD6/300/sprockets%2F397ec39d3d883789effe506c38760368 +0 -0
  25. data/test/dummy/tmp/cache/assets/CD7/DD0/sprockets%2F4f1fe68aa2042a0970bde9b185530646 +0 -0
  26. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  27. data/test/dummy/tmp/cache/assets/CF7/2B0/sprockets%2F25a7c73655bd3598173b39d9f98bcd46 +0 -0
  28. data/test/dummy/tmp/cache/assets/CFE/080/sprockets%2F37fe9f4255baddbd549a659914929398 +0 -0
  29. data/test/dummy/tmp/cache/assets/{CE1/F50/sprockets%2F6e6b593b107866863500ba0fee5a9e24 → D16/F90/sprockets%2F5fe3c021048c6f9a6086bed7736d87b1} +0 -0
  30. data/test/dummy/tmp/cache/assets/{CDD/7D0/sprockets%2F60687bff4553a7f8c701bb9627a6200a → D24/360/sprockets%2F6987b047a96dc685ba3cf39b31477f6d} +0 -0
  31. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  32. data/test/dummy/tmp/cache/assets/D37/2B0/sprockets%2F40834fb07d7318c1fddd5003bd9e04f6 +0 -0
  33. data/test/dummy/tmp/cache/assets/D43/0D0/sprockets%2F682843a8d0795a5fbcfeb2f0c81727d0 +0 -0
  34. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  35. data/test/dummy/tmp/cache/assets/D50/A30/sprockets%2F7d8b294ac433db5d056538f8cf7c66b9 +0 -0
  36. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  37. data/test/dummy/tmp/cache/assets/D6C/7D0/sprockets%2F8a05d6981ec0d38c51739bef0b3a9c2b +0 -0
  38. data/test/dummy/tmp/cache/assets/D94/FF0/sprockets%2F3b56a1aa77de0d570c38a4a9d5f4b1d6 +0 -0
  39. data/test/dummy/tmp/cache/assets/D97/6B0/sprockets%2Fb070e8c799d1a4ad5e62e0a1ae3b83e6 +0 -0
  40. data/test/dummy/tmp/cache/assets/DA6/A80/sprockets%2F92e26d8e58d5bcc8b8f6c25d1b05b9c1 +0 -0
  41. data/test/dummy/tmp/cache/assets/{DB7/BD0/sprockets%2Ff2c59778ab79dcfd3792f46f2ce82f2a → DC0/D20/sprockets%2F1ccf7405cd252dcec4bf23af82e2563a} +0 -0
  42. data/test/dummy/tmp/cache/assets/{D5C/B00/sprockets%2F2b7ac06cc680d7480c06b917bac5a6b0 → DD2/D80/sprockets%2Fc66d103807d0f971fbbcf9aa8b8b27ee} +0 -0
  43. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  44. data/test/dummy/tmp/cache/assets/DE8/790/sprockets%2Fd1333bde2b9aafcc712d11dd09ab35d8 +0 -0
  45. data/test/dummy/tmp/cache/assets/DF5/5E0/sprockets%2F8e64a37c73cdc0b37a4ccfcb42ab45d8 +0 -0
  46. data/test/dummy/tmp/cache/assets/DF7/960/sprockets%2F99ac6db10b44a64fbba4ee847b35ba8b +0 -0
  47. data/test/dummy/tmp/cache/assets/{C84/A00/sprockets%2F3ba04c88513936081d59d8771f6804aa → DFC/040/sprockets%2F15ea81cf915c0cb1dfc9cc04c9fef364} +0 -0
  48. data/test/dummy/tmp/cache/assets/DFD/300/sprockets%2Fabac9489cf7f1db8ef00d72a1571ee1e +0 -0
  49. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  50. data/test/dummy/tmp/cache/assets/E38/FE0/sprockets%2Fe1fc875efa817cbb94a5d8de25ea4e6b +0 -0
  51. data/test/dummy/tmp/cache/assets/E5F/960/sprockets%2Fdc007b6cad5c7ef08e33ec28cfff0ef6 +0 -0
  52. data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_gc_runs.csv +2 -0
  53. data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_gc_time.csv +2 -0
  54. data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_memory.csv +2 -0
  55. data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_objects.csv +2 -0
  56. data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_wall_time.csv +2 -0
  57. data/test/dummy/tmp/performance/ProfilerTest#test_puts_foo_process_time_flat.txt +11 -0
  58. data/test/dummy/tmp/performance/ProfilerTest#test_puts_foo_process_time_graph.html +303 -0
  59. data/test/dummy/tmp/performance/ProfilerTest#test_puts_foo_process_time_stack.html +546 -0
  60. data/test/dummy/tmp/performance/ProfilerTest#test_puts_foo_process_time_tree.txt +38 -0
  61. data/test/dummy/tmp/performance/empty.png +0 -0
  62. data/test/dummy/tmp/performance/minus.png +0 -0
  63. data/test/dummy/tmp/performance/plus.png +0 -0
  64. data/test/test_helper.rb +36 -0
  65. data/test/unit/aleph_patron_test.rb +40 -35
  66. data/test/unit/aleph_record_benchmarks.rb +28 -24
  67. data/test/unit/aleph_record_test.rb +31 -26
  68. data/test/unit/collection_test.rb +17 -18
  69. data/test/unit/google_book_search_test.rb +18 -44
  70. data/test/unit/primo_searcher_test.rb +325 -321
  71. data/test/unit/primo_service_test.rb +924 -919
  72. data/test/unit/primo_ws_test.rb +141 -138
  73. data/test/unit/service_test.rb +2 -16
  74. metadata +93 -100
  75. data/test/dummy/tmp/cache/assets/C73/920/sprockets%2Fd371318f22900492fd180f17c5e2a504 +0 -0
  76. data/test/dummy/tmp/cache/assets/C8F/780/sprockets%2Fe47e28558116fb5f8038754e60d1961d +0 -0
  77. data/test/dummy/tmp/cache/assets/CAA/EB0/sprockets%2F1d179210e8b76f1ea63c802688a015e4 +0 -9271
  78. data/test/dummy/tmp/cache/assets/CB2/DA0/sprockets%2Fa1808990b72376256db2ae3818c0e9b5 +0 -0
  79. data/test/dummy/tmp/cache/assets/CBB/9C0/sprockets%2F706f28923fb754cad04b9107c89986a1 +0 -0
  80. data/test/dummy/tmp/cache/assets/CDC/680/sprockets%2F2b68ef632d12610f3c9563168bfa7c05 +0 -0
  81. data/test/dummy/tmp/cache/assets/CEA/2A0/sprockets%2F9c8607157b998108ce08f4aca39f810a +0 -0
  82. data/test/dummy/tmp/cache/assets/CF5/9B0/sprockets%2F7933bfe880731b396791f1682ce3f7fa +0 -0
  83. data/test/dummy/tmp/cache/assets/CFB/2F0/sprockets%2F62d51f0aa5cac4b1cf7091823772a604 +0 -0
  84. data/test/dummy/tmp/cache/assets/D22/060/sprockets%2F9aec77b768e91a802d284271c58e2f7e +0 -0
  85. data/test/dummy/tmp/cache/assets/D33/6D0/sprockets%2F500129c57f1146e556ec3aacd6cd38c1 +0 -0
  86. data/test/dummy/tmp/cache/assets/D33/FD0/sprockets%2F2ba0b4e6334a77b923e5f770381bb2bf +0 -0
  87. data/test/dummy/tmp/cache/assets/D4C/0A0/sprockets%2F7810d837eec3ac57ad78756af83a6a55 +0 -0
  88. data/test/dummy/tmp/cache/assets/D4C/E30/sprockets%2F631abf89746799b7a5b2b3b4f6294bcd +0 -0
  89. data/test/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -873
  90. data/test/dummy/tmp/cache/assets/D5D/AD0/sprockets%2Fbdb053d9a6a967788f09fbc555d69f58 +0 -0
  91. data/test/dummy/tmp/cache/assets/D66/890/sprockets%2F06287a78ed20d8214197eab03bfca5dd +0 -0
  92. data/test/dummy/tmp/cache/assets/D6B/2A0/sprockets%2F81f17ab0ed20f4a8d9355f7a1d872eb2 +0 -0
  93. data/test/dummy/tmp/cache/assets/D70/080/sprockets%2F24d3ce40ae5cc827a9183b1fb837e84e +0 -0
  94. data/test/dummy/tmp/cache/assets/D71/6B0/sprockets%2Fde558b71b494cf09b1bf055c8dff0353 +0 -0
  95. data/test/dummy/tmp/cache/assets/D72/610/sprockets%2Fa8c708eeb30ef93de34d755d4f45d023 +0 -0
  96. data/test/dummy/tmp/cache/assets/D74/4C0/sprockets%2F64fdf30f75592d6e45fcfc45a48d20a2 +0 -0
  97. data/test/dummy/tmp/cache/assets/D76/AD0/sprockets%2Fe2158cde93188cf5ab6457bc6d6602ec +0 -0
  98. data/test/dummy/tmp/cache/assets/D7A/E40/sprockets%2F9622ffcc499a57627cd1bb18fe31b8e4 +0 -11772
  99. data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
  100. data/test/dummy/tmp/cache/assets/D9B/770/sprockets%2F8aacf02eb7dbb0949704b28f27b87e0b +0 -0
  101. data/test/dummy/tmp/cache/assets/DF7/F30/sprockets%2F7bc16c4109b17fabe29f8ddbbf732d1c +0 -0
  102. data/test/dummy/tmp/cache/assets/E03/570/sprockets%2F493bdc0ac14cd4f57fdfe4253f992bde +0 -0
  103. data/test/dummy/tmp/cache/assets/E09/850/sprockets%2F4bf497a38ecfef660b2f0ebb852d5e9c +0 -0
  104. data/test/dummy/tmp/cache/assets/E0B/4B0/sprockets%2F7988df51a61c81ce6ede4a2d4c8cce4f +0 -377
  105. data/test/dummy/tmp/cache/assets/E6F/A00/sprockets%2Fd32bcea45ea04a6aaee95b3aa840cbab +0 -0
@@ -1,144 +1,147 @@
1
1
  require 'test_helper'
2
2
 
3
- class PrimoWSTest < 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
- def setup
8
- @primo_definition = YAML.load( %{
9
- type: PrimoService
10
- priority: 2 # After SFX, to get SFX metadata enhancement
11
- status: active
12
- base_url: http://bobcat.library.nyu.edu
13
- vid: NYU
14
- institution: NYU
15
- holding_search_institution: NYU
16
- holding_search_text: Search for this title in BobCat.
17
- suppress_holdings: [ !ruby/regexp '/\$\$LBWEB/', !ruby/regexp '/\$\$LNWEB/', !ruby/regexp '/\$\$LTWEB/', !ruby/regexp '/\$\$LWEB/', !ruby/regexp '/\$\$1Restricted Internet Resources/' ]
18
- ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.nyu\.edu\/login\?url=/'
19
- service_types:
20
- - primo_source
21
- - holding_search
22
- - fulltext
23
- - table_of_contents
24
- - referent_enhance
25
- - cover_image
26
- })
3
+ class PrimoWSTest < ActiveSupport::TestCase
4
+ nyu_only_tests(self.name) do
27
5
 
28
- @base_url = @primo_definition["base_url"]
29
- @bogus_404_url = "http://library.nyu.edu/bogus"
30
- @bogus_200_url = "http://library.nyu.edu"
31
- @primo_test_doc_id = "nyu_aleph000062856"
32
- @primo_invalid_doc_id = "thisIsNotAValidDocId"
33
- @primo_test_problem_doc_id = "nyu_aleph000509288"
34
- @isbn_search_params = {:isbn => "0143039008"}
35
- @issn_search_params = {:issn => "0090-5720"}
36
- @title_search_params = {:title => "Travels with My Aunt"}
37
- @author_search_params = {:author => "Graham Greene"}
38
- @title_author_genre_search_params = {:title => "Travels with My Aunt", :author => "Graham Greene", :genre => "Book"}
39
- end
40
-
41
- # def test_primo_ws_benchmarks
42
- # Benchmark.bmbm do |results|
43
- # results.report("PrimoWS::Get Record:") {
44
- # (1..10).each {
45
- # get_record = Exlibris::PrimoWS::GetRecord.new(@primo_test_doc_id, @base_url)
46
- # }
47
- # }
48
- # results.report("PrimoWS::SearchBrief by ISBN:") {
49
- # (1..10).each {
50
- # get_record = Exlibris::PrimoWS::SearchBrief.new(@isbn_search_params, @base_url)
51
- # }
52
- # }
53
- # results.report("PrimoWS::SearchBrief by title:") {
54
- # (1..10).each {
55
- # get_record = Exlibris::PrimoWS::SearchBrief.new(@title_search_params, @base_url)
56
- # }
57
- # }
58
- # end
59
- # end
60
-
61
- def test_bogus_response
62
- assert_raise(SOAP::HTTPStreamError) {
63
- ws = Exlibris::PrimoWS::GetRecord.new(@primo_test_doc_id, @bogus_404_url)
64
- }
65
- assert_raise(SOAP::HTTPStreamError) {
66
- ws = Exlibris::PrimoWS::GetRecord.new(@primo_test_doc_id, @bogus_200_url)
67
- }
68
- end
69
-
70
- # Test GetRecord for a single Primo document.
71
- def test_get_record
72
- ws = Exlibris::PrimoWS::GetRecord.new(@primo_test_doc_id, @base_url)
73
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
74
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
75
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
76
- assert_equal(@primo_test_doc_id, ws.response.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{ws.class} returned an unexpected record: #{ws.response.to_xml(:indent => 5, :encoding => 'UTF-8')}")
77
- end
78
-
79
- def test_count_get_record
80
- ws = Exlibris::PrimoWS::GetRecord.new(@primo_test_doc_id, @base_url)
81
- assert_equal("1", ws.response.at("//search:DOCSET", SEARCH_NS)["TOTALHITS"])
82
- end
83
-
84
- def test_count_search_brief
85
- ws = Exlibris::PrimoWS::SearchBrief.new(@isbn_search_params, @base_url)
86
- assert_equal("1", ws.response.at("//search:DOCSET", SEARCH_NS)["TOTALHITS"])
87
- end
88
-
89
- def test_get_genre_discrepancy
90
- ws = Exlibris::PrimoWS::GetRecord.new(@primo_test_problem_doc_id, @base_url)
91
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
92
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
93
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
94
- assert_equal(@primo_test_problem_doc_id, ws.response.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{ws.class} returned an unexpected record: #{ws.response.to_xml(:indent => 5, :encoding => 'UTF-8')}")
95
- assert_not_nil(ws.response.at("//pnx:display/pnx:availlibrary", PNX_NS).inner_text, "#{ws.class} returned an unexpected record: #{ws.response.to_xml(:indent => 5, :encoding => 'UTF-8')}")
96
- end
97
-
98
- # Test GetRecord with invalid Primo doc id.
99
- def test_get_bogus_record
100
- assert_raise(RuntimeError) {
101
- ws = Exlibris::PrimoWS::GetRecord.new(@primo_invalid_doc_id, @base_url)
102
- }
103
- end
104
-
105
- # Test SearchBrief by isbn.
106
- def test_isbn_search
107
- ws = Exlibris::PrimoWS::SearchBrief.new(@isbn_search_params, @base_url)
108
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
109
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
110
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
111
- end
112
-
113
- # Test SearchBrief by issn.
114
- def test_issn_search
115
- ws = Exlibris::PrimoWS::SearchBrief.new(@issn_search_params, @base_url)
116
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
117
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
118
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
119
- end
120
-
121
- # Test SearchBrief by title.
122
- def test_title_search
123
- ws = Exlibris::PrimoWS::SearchBrief.new(@title_search_params, @base_url)
124
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
125
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
126
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
127
- end
6
+ PNX_NS = {'pnx' => 'http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib'}
7
+ SEARCH_NS = {'search' => 'http://www.exlibrisgroup.com/xsd/jaguar/search'}
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
+ @bogus_404_url = "http://library.nyu.edu/bogus"
32
+ @bogus_200_url = "http://library.nyu.edu"
33
+ @primo_test_doc_id = "nyu_aleph000062856"
34
+ @primo_invalid_doc_id = "thisIsNotAValidDocId"
35
+ @primo_test_problem_doc_id = "nyu_aleph000509288"
36
+ @isbn_search_params = {:isbn => "0143039008"}
37
+ @issn_search_params = {:issn => "0090-5720"}
38
+ @title_search_params = {:title => "Travels with My Aunt"}
39
+ @author_search_params = {:author => "Graham Greene"}
40
+ @title_author_genre_search_params = {:title => "Travels with My Aunt", :author => "Graham Greene", :genre => "Book"}
41
+ end
42
+
43
+ # def test_primo_ws_benchmarks
44
+ # Benchmark.bmbm do |results|
45
+ # results.report("PrimoWS::Get Record:") {
46
+ # (1..10).each {
47
+ # get_record = Exlibris::PrimoWS::GetRecord.new(@primo_test_doc_id, @base_url)
48
+ # }
49
+ # }
50
+ # results.report("PrimoWS::SearchBrief by ISBN:") {
51
+ # (1..10).each {
52
+ # get_record = Exlibris::PrimoWS::SearchBrief.new(@isbn_search_params, @base_url)
53
+ # }
54
+ # }
55
+ # results.report("PrimoWS::SearchBrief by title:") {
56
+ # (1..10).each {
57
+ # get_record = Exlibris::PrimoWS::SearchBrief.new(@title_search_params, @base_url)
58
+ # }
59
+ # }
60
+ # end
61
+ # end
128
62
 
129
- # Test SearchBrief by author.
130
- def test_author_search
131
- ws = Exlibris::PrimoWS::SearchBrief.new(@author_search_params, @base_url)
132
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
133
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
134
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
63
+ def test_bogus_response
64
+ assert_raise(SOAP::HTTPStreamError) {
65
+ ws = Exlibris::PrimoWS::GetRecord.new(@primo_test_doc_id, @bogus_404_url)
66
+ }
67
+ assert_raise(SOAP::HTTPStreamError) {
68
+ ws = Exlibris::PrimoWS::GetRecord.new(@primo_test_doc_id, @bogus_200_url)
69
+ }
70
+ end
71
+
72
+ # Test GetRecord for a single Primo document.
73
+ def test_get_record
74
+ ws = Exlibris::PrimoWS::GetRecord.new(@primo_test_doc_id, @base_url)
75
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
76
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
77
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
78
+ assert_equal(@primo_test_doc_id, ws.response.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{ws.class} returned an unexpected record: #{ws.response.to_xml(:indent => 5, :encoding => 'UTF-8')}")
79
+ end
80
+
81
+ def test_count_get_record
82
+ ws = Exlibris::PrimoWS::GetRecord.new(@primo_test_doc_id, @base_url)
83
+ assert_equal("1", ws.response.at("//search:DOCSET", SEARCH_NS)["TOTALHITS"])
84
+ end
85
+
86
+ def test_count_search_brief
87
+ ws = Exlibris::PrimoWS::SearchBrief.new(@isbn_search_params, @base_url)
88
+ assert_equal("1", ws.response.at("//search:DOCSET", SEARCH_NS)["TOTALHITS"])
89
+ end
90
+
91
+ def test_get_genre_discrepancy
92
+ ws = Exlibris::PrimoWS::GetRecord.new(@primo_test_problem_doc_id, @base_url)
93
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
94
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
95
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
96
+ assert_equal(@primo_test_problem_doc_id, ws.response.at("//pnx:control/pnx:recordid", PNX_NS).inner_text, "#{ws.class} returned an unexpected record: #{ws.response.to_xml(:indent => 5, :encoding => 'UTF-8')}")
97
+ assert_not_nil(ws.response.at("//pnx:display/pnx:availlibrary", PNX_NS).inner_text, "#{ws.class} returned an unexpected record: #{ws.response.to_xml(:indent => 5, :encoding => 'UTF-8')}")
98
+ end
99
+
100
+ # Test GetRecord with invalid Primo doc id.
101
+ def test_get_bogus_record
102
+ assert_raise(RuntimeError) {
103
+ ws = Exlibris::PrimoWS::GetRecord.new(@primo_invalid_doc_id, @base_url)
104
+ }
105
+ end
106
+
107
+ # Test SearchBrief by isbn.
108
+ def test_isbn_search
109
+ ws = Exlibris::PrimoWS::SearchBrief.new(@isbn_search_params, @base_url)
110
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
111
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
112
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
113
+ end
114
+
115
+ # Test SearchBrief by issn.
116
+ def test_issn_search
117
+ ws = Exlibris::PrimoWS::SearchBrief.new(@issn_search_params, @base_url)
118
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
119
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
120
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
121
+ end
122
+
123
+ # Test SearchBrief by title.
124
+ def test_title_search
125
+ ws = Exlibris::PrimoWS::SearchBrief.new(@title_search_params, @base_url)
126
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
127
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
128
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
129
+ end
130
+
131
+ # Test SearchBrief by author.
132
+ def test_author_search
133
+ ws = Exlibris::PrimoWS::SearchBrief.new(@author_search_params, @base_url)
134
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
135
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
136
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
137
+ end
138
+
139
+ # Test SearchBrief by title/author/genre.
140
+ def test_title_author_genre_search
141
+ ws = Exlibris::PrimoWS::SearchBrief.new(@title_author_genre_search_params, @base_url)
142
+ assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
143
+ assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
144
+ assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
145
+ end
135
146
  end
136
-
137
- # Test SearchBrief by title/author/genre.
138
- def test_title_author_genre_search
139
- ws = Exlibris::PrimoWS::SearchBrief.new(@title_author_genre_search_params, @base_url)
140
- assert_not_nil(ws, "#{ws.class} returned nil when instantiated.")
141
- assert_instance_of( Nokogiri::XML::Document, ws.response, "#{ws.class} response is an unexpected object: #{ws.response.class}")
142
- assert_equal([], ws.error, "#{ws.class} encountered errors: #{ws.error}")
143
- end
144
147
  end
@@ -1,6 +1,7 @@
1
1
  require File.dirname(__FILE__) + '/../test_helper'
2
2
 
3
- class ServiceTest < Test::Unit::TestCase
3
+ class ServiceTest < ActiveSupport::TestCase
4
+ fixtures :requests
4
5
 
5
6
  # A service that does nothing!
6
7
  class DummyService < Service
@@ -14,20 +15,5 @@ class ServiceTest < Test::Unit::TestCase
14
15
  @umlaut_request = requests(:simple_request)
15
16
  end
16
17
 
17
- def test_write_to_session
18
-
19
-
20
- writer = DummyService.new( @dummy_config )
21
- writer.request = @umlaut_request
22
- writer.update_session( { :one => "first", :two => "second" })
23
-
24
- reader = DummyService.new( @dummy_config )
25
- reader.request = @umlaut_request
26
- session = reader.session()
27
-
28
- assert_equal "first", session[:one]
29
- assert_equal "second", session[:two]
30
-
31
- end
32
18
 
33
19
  end