sufia 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.travis.yml +6 -0
- data/Gemfile +5 -2
- data/History.md +6 -0
- data/README.md +40 -0
- data/Rakefile +4 -0
- data/app/assets/javascripts/sufia.js +3 -115
- data/app/assets/javascripts/sufia/batch_select_all.js +179 -0
- data/app/assets/javascripts/sufia/edit_metadata.js +86 -0
- data/app/assets/javascripts/sufia/multiForm.js +57 -0
- data/app/assets/javascripts/terms_of_service.js +7 -0
- data/app/assets/stylesheets/audio-js.css +3 -0
- data/app/assets/stylesheets/dashboard.css.scss +51 -0
- data/app/assets/stylesheets/generic_files.css +36 -0
- data/app/assets/stylesheets/sufia.css.scss +2 -0
- data/app/controllers/batch_controller.rb +11 -0
- data/app/controllers/batch_edits_controller.rb +1 -77
- data/app/controllers/generic_files_controller.rb +1 -0
- data/app/controllers/mailbox_controller.rb +1 -1
- data/app/controllers/single_use_link_controller.rb +11 -7
- data/app/helpers/generic_file_helper.rb +11 -3
- data/app/helpers/sufia_helper.rb +13 -10
- data/app/models/batch.rb +1 -1
- data/app/models/datastreams/fits_datastream.rb +2 -2
- data/app/models/datastreams/generic_file_rdf_datastream.rb +22 -18
- data/app/models/datastreams/properties_datastream.rb +2 -2
- data/app/views/_user_util_links.html.erb +2 -2
- data/app/views/batch/_metadata.html.erb +82 -0
- data/app/views/batch/_more_metadata.html.erb +6 -0
- data/app/views/batch/edit.html.erb +1 -8
- data/app/views/batch_edits/_check_all.html.erb +0 -157
- data/app/views/batch_edits/edit.html.erb +0 -29
- data/app/views/catalog/_index_partials/_list_files.html.erb +8 -10
- data/app/views/catalog/_recent_document.html.erb +9 -18
- data/app/views/catalog/_results_pagination.html.erb +1 -1
- data/app/views/contact_form/new.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_default_group.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_list_files.html.erb +12 -14
- data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +9 -19
- data/app/views/dashboard/_results_pagination.html.erb +1 -1
- data/app/views/dashboard/index.html.erb +6 -82
- data/app/views/error/single_use_error.html.erb +35 -0
- data/app/views/generic_files/_descriptions.html.erb +2 -2
- data/app/views/generic_files/_extra_fields_modal.html.erb +1 -1
- data/app/views/generic_files/_field_form.html.erb +2 -5
- data/app/views/generic_files/_media_display.html.erb +8 -6
- data/app/views/generic_files/_permission.html.erb +2 -2
- data/app/views/generic_files/_rights_modal.html.erb +1 -1
- data/app/views/generic_files/_show_actions.html.erb +1 -1
- data/app/views/generic_files/_show_details.html.erb +11 -6
- data/app/views/generic_files/edit.html.erb +0 -8
- data/app/views/generic_files/edit_fields/_type.html.erb +1 -1
- data/app/views/generic_files/show.html.erb +5 -8
- data/app/views/generic_files/show_fields/_based_near.html.erb +4 -1
- data/app/views/generic_files/show_fields/_contributor.html.erb +4 -1
- data/app/views/generic_files/show_fields/_creator.html.erb +4 -1
- data/app/views/generic_files/show_fields/_date_created.html.erb +4 -1
- data/app/views/generic_files/show_fields/_description.html.erb +4 -1
- data/app/views/generic_files/show_fields/_language.html.erb +1 -1
- data/app/views/generic_files/show_fields/_publisher.html.erb +4 -1
- data/app/views/generic_files/show_fields/_related_url.html.erb +3 -1
- data/app/views/generic_files/show_fields/_resource_type.html.erb +1 -1
- data/app/views/generic_files/show_fields/_subject.html.erb +4 -1
- data/app/views/generic_files/show_fields/_tag.html.erb +1 -1
- data/app/views/generic_files/show_fields/_title.html.erb +4 -1
- data/app/views/layouts/error.html.erb +0 -4
- data/app/views/layouts/hydra-head.html.erb +2 -6
- data/app/views/single_use_link/show.html.erb +1 -1
- data/app/views/users/index.html.erb +1 -1
- data/app/views/users/show.html.erb +1 -1
- data/config/locales/sufia.en.yml +1 -0
- data/config/routes.rb +11 -4
- data/lib/generators/sufia/sufia_generator.rb +2 -1
- data/lib/generators/sufia/templates/catalog_controller.rb +143 -117
- data/lib/generators/sufia/templates/config/resque_admin.rb +10 -0
- data/lib/generators/sufia/templates/config/sufia.rb +8 -0
- data/lib/sufia.rb +4 -14
- data/lib/sufia/batch_edits_controller_behavior.rb +89 -0
- data/lib/sufia/controller.rb +7 -5
- data/lib/sufia/downloads_controller_behavior.rb +14 -19
- data/lib/sufia/file_content/extract_metadata.rb +11 -4
- data/lib/sufia/files_controller_behavior.rb +63 -44
- data/lib/sufia/generic_file.rb +29 -11
- data/lib/sufia/generic_file/audit.rb +1 -1
- data/lib/sufia/generic_file/thumbnail.rb +51 -26
- data/lib/sufia/id_service.rb +28 -11
- data/lib/sufia/jobs/batch_update_job.rb +2 -2
- data/lib/sufia/jobs/characterize_job.rb +11 -3
- data/lib/sufia/jobs/ffmpeg_transcode_job.rb +61 -0
- data/lib/sufia/jobs/resolrize_job.rb +1 -1
- data/lib/sufia/jobs/transcode_audio_job.rb +40 -0
- data/lib/sufia/jobs/transcode_video_job.rb +9 -49
- data/lib/sufia/queue/resque.rb +2 -2
- data/lib/sufia/single_use_error.rb +4 -0
- data/lib/sufia/solr_document_behavior.rb +108 -1
- data/lib/sufia/version.rb +1 -1
- data/solr_conf/conf/schema.xml +332 -652
- data/solr_conf/conf/solrconfig.xml +60 -196
- data/spec/controllers/batch_controller_spec.rb +4 -5
- data/spec/controllers/catalog_controller_spec.rb +13 -13
- data/spec/controllers/dashboard_controller_spec.rb +2 -2
- data/spec/controllers/downloads_controller_spec.rb +74 -62
- data/spec/controllers/generic_files_controller_spec.rb +10 -8
- data/spec/controllers/single_use_link_controller_spec.rb +12 -4
- data/spec/fixtures/Example.ogg +0 -0
- data/spec/fixtures/piano_note.wav +0 -0
- data/spec/fixtures/sufia_generic_stub.descMeta.txt +1 -1
- data/spec/helpers/sufia_helper_spec.rb +12 -0
- data/spec/models/characterize_job_spec.rb +89 -0
- data/spec/models/checksum_audit_log_spec.rb +1 -0
- data/spec/models/event_jobs_spec.rb +9 -9
- data/spec/models/file_content_datastream_spec.rb +16 -10
- data/spec/models/fits_datastream_spec.rb +2 -8
- data/spec/models/generic_file_spec.rb +131 -60
- data/spec/models/solr_document_spec.rb +21 -0
- data/spec/models/transcode_audio_job_spec.rb +81 -0
- data/spec/models/transcode_video_job_spec.rb +2 -2
- data/spec/models/unzip_job_spec.rb +3 -3
- data/spec/spec_helper.rb +21 -0
- data/spec/support/Gemfile +7 -3
- data/sufia.gemspec +8 -11
- data/tasks/cucumber.rake +1 -2
- data/tasks/sufia-dev.rake +13 -2
- data/tasks/sufia.rake +1 -1
- metadata +77 -118
- data/app/views/batch_edits/_metadata.html.erb +0 -180
- data/lib/generators/sufia/templates/config/hydra_config.rb +0 -32
- data/lib/kaminari/helpers/tag.rb +0 -11
@@ -1,57 +1,13 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
-
<!--
|
3
|
-
Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
-
contributor license agreements. See the NOTICE file distributed with
|
5
|
-
this work for additional information regarding copyright ownership.
|
6
|
-
The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
-
(the "License"); you may not use this file except in compliance with
|
8
|
-
the License. You may obtain a copy of the License at
|
9
|
-
|
10
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
|
12
|
-
Unless required by applicable law or agreed to in writing, software
|
13
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
See the License for the specific language governing permissions and
|
16
|
-
limitations under the License.
|
17
|
-
-->
|
18
|
-
|
19
|
-
<!--
|
20
|
-
For more details about configurations options that may appear in
|
21
|
-
this file, see http://wiki.apache.org/solr/SolrConfigXml.
|
22
|
-
-->
|
23
2
|
<config>
|
24
|
-
<!--
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
You may also specify a fully qualified Java classname if you
|
29
|
-
have your own custom plugins.
|
30
|
-
-->
|
31
|
-
|
32
|
-
<!-- Set this to 'false' if you want solr to continue working after
|
33
|
-
it has encountered an severe configuration error. In a
|
34
|
-
production environment, you may want solr to keep working even
|
35
|
-
if one handler is mis-configured.
|
36
|
-
|
37
|
-
You may also set this to false using by setting the system
|
38
|
-
property:
|
39
|
-
|
40
|
-
-Dsolr.abortOnConfigurationError=false
|
41
|
-
-->
|
3
|
+
<!-- NOTE: various comments and unused configuration possibilities have been purged
|
4
|
+
from this file. Please refer to http://wiki.apache.org/solr/SolrConfigXml,
|
5
|
+
as well as the default solrconfig file included with Solr -->
|
6
|
+
|
42
7
|
<abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
|
43
8
|
|
44
|
-
<!-- Controls what version of Lucene various components of Solr
|
45
|
-
adhere to. Generally, you want to use the latest version to
|
46
|
-
get all bug fixes and improvements. It is highly recommended
|
47
|
-
that you fully re-index after changing this setting as it can
|
48
|
-
affect both how text is indexed and queried.
|
49
|
-
-->
|
50
9
|
<luceneMatchVersion>LUCENE_40</luceneMatchVersion>
|
51
10
|
|
52
|
-
<!-- The DirectoryFactory to use for indexes.
|
53
|
-
solr.StandardDirectoryFactory, the default, is filesystem based.
|
54
|
-
solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication. -->
|
55
11
|
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
|
56
12
|
|
57
13
|
<!-- solr lib dirs -->
|
@@ -60,40 +16,18 @@
|
|
60
16
|
|
61
17
|
<dataDir>${solr.data.dir:}</dataDir>
|
62
18
|
|
63
|
-
<requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />
|
64
|
-
|
65
|
-
<requestDispatcher handleSelect="true" >
|
66
|
-
<requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048" />
|
67
|
-
</requestDispatcher>
|
68
|
-
|
69
|
-
<requestHandler name="/analysis/field" startup="lazy" class="solr.FieldAnalysisRequestHandler" />
|
70
|
-
<requestHandler name="/update" class="solr.UpdateRequestHandler" />
|
71
|
-
<requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
|
72
|
-
|
73
|
-
<requestHandler name="/admin/ping" class="solr.PingRequestHandler">
|
74
|
-
<lst name="invariants">
|
75
|
-
<str name="q">solrpingquery</str>
|
76
|
-
</lst>
|
77
|
-
<lst name="defaults">
|
78
|
-
<str name="echoParams">all</str>
|
79
|
-
</lst>
|
80
|
-
</requestHandler>
|
81
|
-
|
82
|
-
<!-- config for the admin interface -->
|
83
|
-
<admin>
|
84
|
-
<defaultQuery>search</defaultQuery>
|
85
|
-
</admin>
|
86
|
-
|
87
|
-
|
88
19
|
<requestHandler name="search" class="solr.SearchHandler" default="true">
|
89
20
|
<!-- default values for query parameters can be specified, these
|
90
21
|
will be overridden by parameters in the request
|
91
22
|
-->
|
92
23
|
<lst name="defaults">
|
93
|
-
<str name="defType">
|
24
|
+
<str name="defType">edismax</str>
|
94
25
|
<str name="echoParams">explicit</str>
|
95
26
|
<str name="q.alt">*:*</str>
|
96
27
|
<str name="mm">2<-1 5<-2 6<90%</str>
|
28
|
+
<int name="qs">1</int>
|
29
|
+
<int name="ps">2</int>
|
30
|
+
<float name="tie">0.01</float>
|
97
31
|
<!-- this qf and pf are used by default, if not otherwise specified by
|
98
32
|
client. The default blacklight_config will use these for the
|
99
33
|
"keywords" search. See the author_qf/author_pf, title_qf, etc
|
@@ -103,93 +37,37 @@
|
|
103
37
|
-->
|
104
38
|
<str name="qf">
|
105
39
|
id
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
object_type_facet
|
40
|
+
all_text_timv
|
41
|
+
active_fedora_model_ssi
|
42
|
+
object_type_si
|
110
43
|
</str>
|
111
44
|
<str name="pf">
|
112
|
-
|
113
|
-
title_t^250000
|
114
|
-
text^10
|
115
|
-
active_fedora_model_s
|
116
|
-
object_type_facet
|
45
|
+
all_text_timv^10
|
117
46
|
</str>
|
118
47
|
|
119
48
|
<str name="author_qf">
|
120
|
-
author_unstem_search^200
|
121
|
-
author_addl_unstem_search^50
|
122
|
-
author_t^20
|
123
|
-
author_addl_t
|
124
49
|
</str>
|
125
50
|
<str name="author_pf">
|
126
|
-
author_unstem_search^2000
|
127
|
-
author_addl_unstem_search^500
|
128
|
-
author_t^200
|
129
|
-
author_addl_t^10
|
130
51
|
</str>
|
131
52
|
<str name="title_qf">
|
132
|
-
title_unstem_search^50000
|
133
|
-
subtitle_unstem_search^25000
|
134
|
-
title_addl_unstem_search^10000
|
135
|
-
title_t^5000
|
136
|
-
subtitle_t^2500
|
137
|
-
title_addl_t^100
|
138
|
-
title_added_entry_unstem_search^50
|
139
|
-
title_added_entry_t^10
|
140
|
-
title_series_unstem_search^5
|
141
|
-
title_series_t
|
142
53
|
</str>
|
143
54
|
<str name="title_pf">
|
144
|
-
title_unstem_search^500000
|
145
|
-
subtitle_unstem_search^250000
|
146
|
-
title_addl_unstem_search^100000
|
147
|
-
title_t^50000
|
148
|
-
subtitle_t^25000
|
149
|
-
title_addl_t^1000
|
150
|
-
title_added_entry_unstem_search^500
|
151
|
-
title_added_entry_t^100
|
152
|
-
title_series_t^50
|
153
|
-
title_series_unstem_search^10
|
154
55
|
</str>
|
155
56
|
<str name="subject_qf">
|
156
|
-
subject_topic_unstem_search^200
|
157
|
-
subject_unstem_search^125
|
158
|
-
subject_topic_facet^100
|
159
|
-
subject_t^50
|
160
|
-
subject_addl_unstem_search^10
|
161
|
-
subject_addl_t
|
162
57
|
</str>
|
163
58
|
<str name="subject_pf">
|
164
|
-
subject_topic_unstem_search^2000
|
165
|
-
subject_unstem_search^1250
|
166
|
-
subject_t^1000
|
167
|
-
subject_topic_facet^500
|
168
|
-
subject_addl_unstem_search^100
|
169
|
-
subject_addl_t^10
|
170
59
|
</str>
|
171
60
|
|
172
|
-
<int name="ps">3</int>
|
173
|
-
<float name="tie">0.01</float>
|
174
|
-
|
175
|
-
<!-- NOT using marc_display because it is large and will slow things down for search results -->
|
176
61
|
<str name="fl">
|
177
62
|
*,
|
178
|
-
score
|
63
|
+
score
|
179
64
|
</str>
|
180
65
|
|
181
66
|
<str name="facet">true</str>
|
182
67
|
<str name="facet.mincount">1</str>
|
183
68
|
<str name="facet.limit">10</str>
|
184
|
-
<str name="facet.field">
|
185
|
-
<str name="facet.field">
|
186
|
-
<str name="facet.field">lc_alpha_facet</str>
|
187
|
-
<str name="facet.field">lc_b4cutter_facet</str>
|
188
|
-
<str name="facet.field">language_facet</str>
|
189
|
-
<str name="facet.field">pub_date</str>
|
190
|
-
<str name="facet.field">subject_era_facet</str>
|
191
|
-
<str name="facet.field">subject_geo_facet</str>
|
192
|
-
<str name="facet.field">subject_topic_facet</str>
|
69
|
+
<str name="facet.field">active_fedora_model_ssi</str>
|
70
|
+
<str name="facet.field">object_type_si</str>
|
193
71
|
|
194
72
|
<str name="spellcheck">true</str>
|
195
73
|
<str name="spellcheck.dictionary">default</str>
|
@@ -202,16 +80,6 @@
|
|
202
80
|
<arr name="last-components">
|
203
81
|
<str>spellcheck</str>
|
204
82
|
</arr>
|
205
|
-
|
206
|
-
</requestHandler>
|
207
|
-
|
208
|
-
|
209
|
-
<!-- Hydra Additions Start -->
|
210
|
-
|
211
|
-
<requestHandler name="standard" class="solr.SearchHandler">
|
212
|
-
<lst name="defaults">
|
213
|
-
<str name="echoParams">explicit</str>
|
214
|
-
</lst>
|
215
83
|
</requestHandler>
|
216
84
|
|
217
85
|
<requestHandler name="permissions" class="solr.SearchHandler" >
|
@@ -221,22 +89,28 @@
|
|
221
89
|
<str name="rows">1</str>
|
222
90
|
<str name="q">{!raw f=id v=$id}</str> <!-- use id=666 instead of q=id:666 -->
|
223
91
|
<str name="fl">
|
224
|
-
id,
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
92
|
+
id,
|
93
|
+
access_ssim,
|
94
|
+
discover_access_group_ssim,discover_access_person_ssim,
|
95
|
+
read_access_group_ssim,read_access_person_ssim,
|
96
|
+
edit_access_group_ssim,edit_access_person_ssim,
|
97
|
+
depositor_ti,
|
98
|
+
embargo_release_date_dtsi
|
99
|
+
inheritable_access_ssim,
|
100
|
+
inheritable_discover_access_group_ssim,inheritable_discover_access_person_ssim,
|
101
|
+
inheritable_read_access_group_ssim,inheritable_read_access_person_ssim,
|
102
|
+
inheritable_edit_access_group_ssim,inheritable_edit_access_person_ssim,
|
103
|
+
inheritable_embargo_release_date_dtsi
|
235
104
|
</str>
|
236
105
|
</lst>
|
237
106
|
</requestHandler>
|
238
|
-
|
239
|
-
|
107
|
+
|
108
|
+
<requestHandler name="standard" class="solr.SearchHandler">
|
109
|
+
<lst name="defaults">
|
110
|
+
<str name="echoParams">explicit</str>
|
111
|
+
<str name="defType">lucene</str>
|
112
|
+
</lst>
|
113
|
+
</requestHandler>
|
240
114
|
|
241
115
|
<!-- for requests to get a single document; use id=666 instead of q=id:666 -->
|
242
116
|
<requestHandler name="document" class="solr.SearchHandler" >
|
@@ -249,24 +123,10 @@
|
|
249
123
|
</requestHandler>
|
250
124
|
|
251
125
|
|
252
|
-
|
253
|
-
<!-- Spell Check
|
254
|
-
|
255
|
-
The spell check component can return a list of alternative spelling
|
256
|
-
suggestions.
|
257
|
-
|
258
|
-
http://wiki.apache.org/solr/SpellCheckComponent
|
259
|
-
-->
|
260
126
|
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
|
261
|
-
|
262
127
|
<str name="queryAnalyzerFieldType">textSpell</str>
|
263
|
-
|
264
|
-
|
265
|
-
component
|
266
|
-
-->
|
267
|
-
|
268
|
-
<!-- a spellchecker built from a field of the main index, and
|
269
|
-
written to disk
|
128
|
+
<!-- Multiple "Spell Checkers" can be declared and used by this component
|
129
|
+
(e.g. for title_spell field)
|
270
130
|
-->
|
271
131
|
<lst name="spellchecker">
|
272
132
|
<str name="name">default</str>
|
@@ -274,26 +134,30 @@
|
|
274
134
|
<str name="spellcheckIndexDir">./spell</str>
|
275
135
|
<str name="buildOnOptimize">true</str>
|
276
136
|
</lst>
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
137
|
+
</searchComponent>
|
138
|
+
|
139
|
+
<requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />
|
140
|
+
|
141
|
+
<requestDispatcher handleSelect="true" >
|
142
|
+
<requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048" />
|
143
|
+
</requestDispatcher>
|
144
|
+
|
145
|
+
<requestHandler name="/analysis/field" startup="lazy" class="solr.FieldAnalysisRequestHandler" />
|
146
|
+
<requestHandler name="/update" class="solr.UpdateRequestHandler" />
|
147
|
+
<requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
|
148
|
+
|
149
|
+
<requestHandler name="/admin/ping" class="solr.PingRequestHandler">
|
150
|
+
<lst name="invariants">
|
151
|
+
<str name="q">solrpingquery</str>
|
290
152
|
</lst>
|
291
|
-
<lst name="
|
292
|
-
<str name="
|
293
|
-
<str name="field">title_spell</str>
|
294
|
-
<str name="spellcheckIndexDir">./spell_title</str>
|
295
|
-
<str name="accuracy">0.7</str>
|
296
|
-
<str name="buildOnOptimize">true</str>
|
153
|
+
<lst name="defaults">
|
154
|
+
<str name="echoParams">all</str>
|
297
155
|
</lst>
|
298
|
-
</
|
156
|
+
</requestHandler>
|
157
|
+
|
158
|
+
<!-- config for the admin interface -->
|
159
|
+
<admin>
|
160
|
+
<defaultQuery>search</defaultQuery>
|
161
|
+
</admin>
|
162
|
+
|
299
163
|
</config>
|
@@ -46,7 +46,7 @@ describe BatchController do
|
|
46
46
|
ability.can?(:edit, @file).should be_true
|
47
47
|
ability.can?(:edit, @file2).should be_false
|
48
48
|
end
|
49
|
-
it "should
|
49
|
+
it "should enqueue a batch update job" do
|
50
50
|
params = {'generic_file' => {'read_groups_string' => '', 'read_users_string' => 'archivist1, archivist2', 'tag' => ['']}, 'id' => @batch.pid, 'controller' => 'batch', 'action' => 'update'}
|
51
51
|
s1 = stub('one')
|
52
52
|
BatchUpdateJob.should_receive(:new).with(@user.user_key, params).and_return(s1)
|
@@ -129,7 +129,6 @@ describe BatchController do
|
|
129
129
|
@file2 = GenericFile.new(:batch=>@b1, :label=>'f2')
|
130
130
|
@file2.apply_depositor_metadata(@user.user_key)
|
131
131
|
@file2.save
|
132
|
-
controller.stub(:params).and_return({id:@b1.id})
|
133
132
|
end
|
134
133
|
after do
|
135
134
|
@b1.delete
|
@@ -137,9 +136,9 @@ describe BatchController do
|
|
137
136
|
@file2.delete
|
138
137
|
end
|
139
138
|
it "should default creator" do
|
140
|
-
|
141
|
-
|
142
|
-
|
139
|
+
get :edit, id: @b1.id
|
140
|
+
assigns[:generic_file].creator[0].should == @user.display_name
|
141
|
+
assigns[:generic_file].title[0].should == 'f1'
|
143
142
|
end
|
144
143
|
end
|
145
144
|
end
|
@@ -46,15 +46,16 @@ describe CatalogController do
|
|
46
46
|
it "should find pdf files" do
|
47
47
|
response.should be_success
|
48
48
|
response.should render_template('catalog/index')
|
49
|
-
assigns(:document_list).map(&:id) == [@gf1.id]
|
49
|
+
assigns(:document_list).map(&:id).should == [@gf1.id]
|
50
50
|
|
51
51
|
assigns(:document_list).count.should eql(1)
|
52
|
-
assigns(:document_list)
|
52
|
+
assigns(:document_list).first['desc_metadata__title_tesim'].should == ['Test Document PDF']
|
53
53
|
end
|
54
54
|
end
|
55
55
|
describe "facet search" do
|
56
56
|
before do
|
57
|
-
|
57
|
+
# TODO: this is not how a facet query is done.
|
58
|
+
xhr :get, :index, :q=>"{f=desc_metadata__contributor_tesim}Contrib1"
|
58
59
|
end
|
59
60
|
it "should find facet files" do
|
60
61
|
response.should be_success
|
@@ -97,16 +98,15 @@ describe CatalogController do
|
|
97
98
|
assigns(:recent_documents).count.should eql(4)
|
98
99
|
# the order is reversed since the first in should be the last out in descending time order
|
99
100
|
#assigns(:recent_documents).each {|doc| logger.info doc.fetch(:desc_metadata__title_t)[0]}
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
lgf4
|
105
|
-
|
106
|
-
|
107
|
-
lgf1
|
108
|
-
lgf1
|
109
|
-
lgf1.fetch(:desc_metadata__resource_type_t)[0].should eql(@gf1.resource_type[0])
|
101
|
+
lgf1 = assigns(:recent_documents)[0]
|
102
|
+
lgf4 = assigns(:recent_documents)[3]
|
103
|
+
lgf4['desc_metadata__title_tesim'].should == ['Generic File 4']
|
104
|
+
lgf4['desc_metadata__contributor_tesim'].should == ['contributor 4']
|
105
|
+
lgf4['desc_metadata__resource_type_tesim'].should == ['type 4']
|
106
|
+
|
107
|
+
lgf1['desc_metadata__title_tesim'].should == ['Generic File 1']
|
108
|
+
lgf1['desc_metadata__contributor_tesim'].should == ['contributor 1']
|
109
|
+
lgf1['desc_metadata__resource_type_tesim'].should == ['type 1']
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
@@ -69,8 +69,8 @@ describe DashboardController do
|
|
69
69
|
response.should render_template('dashboard/index')
|
70
70
|
end
|
71
71
|
it "should return an array of documents I can edit" do
|
72
|
-
|
73
|
-
assigns(:document_list).count.should eql(
|
72
|
+
user_results = Blacklight.solr.get "select", :params=>{:fq=>["edit_access_group_ssim:public OR edit_access_person_ssim:#{@user.user_key}"]}
|
73
|
+
assigns(:document_list).count.should eql(user_results["response"]["numFound"])
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
@@ -16,83 +16,95 @@ require 'spec_helper'
|
|
16
16
|
|
17
17
|
describe DownloadsController do
|
18
18
|
|
19
|
-
before(:all) do
|
20
|
-
GenericFile.any_instance.stub(:terms_of_service).and_return('1')
|
21
|
-
f = GenericFile.new(:pid => 'sufia:test1')
|
22
|
-
f.apply_depositor_metadata('archivist1@example.com')
|
23
|
-
f.set_title_and_label('world.png')
|
24
|
-
f.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content', :mimeType => 'image/png')
|
25
|
-
f.should_receive(:characterize_if_changed).and_yield
|
26
|
-
f.save
|
27
|
-
end
|
28
|
-
|
29
|
-
after(:all) do
|
30
|
-
GenericFile.find('sufia:test1').delete
|
31
|
-
end
|
32
|
-
|
33
19
|
describe "routing" do
|
34
20
|
it "should route" do
|
35
21
|
assert_recognizes( {:controller=>"downloads", :action=>"show", "id"=>"test1"}, "/downloads/test1?filename=my%20dog.jpg" )
|
36
22
|
end
|
37
23
|
end
|
38
24
|
|
39
|
-
describe "
|
25
|
+
describe "default_datastream?" do
|
26
|
+
it "should be true when no datastram_id is passed" do
|
27
|
+
controller.should be_default_datastream
|
28
|
+
end
|
29
|
+
it "should be false when a datastream_id is passed" do
|
30
|
+
controller.params[:datastream_id] = 'descMetadata'
|
31
|
+
controller.should_not be_default_datastream
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
describe "with a file" do
|
40
37
|
before do
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
@f = GenericFile.new(:pid => 'sufia:test1')
|
39
|
+
@f.apply_depositor_metadata('archivist1@example.com')
|
40
|
+
@f.set_title_and_label('world.png')
|
41
|
+
@f.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content', :mimeType => 'image/png')
|
42
|
+
@f.should_receive(:characterize_if_changed).and_yield
|
43
|
+
@f.save!
|
44
44
|
end
|
45
|
+
|
45
46
|
after do
|
46
|
-
|
47
|
-
arch.delete if arch
|
47
|
+
@f.delete
|
48
48
|
end
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
controller.
|
55
|
-
get "show", :id => "test1"
|
56
|
-
response.should be_success
|
57
|
-
end
|
58
|
-
it "should return requested datastreams" do
|
59
|
-
controller.stub(:render)
|
60
|
-
expected_content = ActiveFedora::Base.find("sufia:test1").descMetadata.content
|
61
|
-
controller.should_receive(:send_data).with(expected_content, {:filename => 'descMetadata', :disposition => 'inline', :type => "text/plain"})
|
62
|
-
get "show", :id => "test1", :datastream_id => "descMetadata"
|
63
|
-
response.should be_success
|
49
|
+
|
50
|
+
describe "when logged in as reader" do
|
51
|
+
before do
|
52
|
+
sign_in FactoryGirl.find_or_create(:archivist)
|
53
|
+
User.any_instance.stub(:groups).and_return([])
|
54
|
+
controller.stub(:clear_session_user) ## Don't clear out the authenticated session
|
64
55
|
end
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
controller.should_receive(:send_data).with(expected_content, {:filename => 'world.png', :type => 'image/png', :disposition => "inline"})
|
69
|
-
get "show", :id => "test1", :disposition => "inline"
|
70
|
-
response.should be_success
|
56
|
+
after do
|
57
|
+
arch = FactoryGirl.find(:archivist) rescue
|
58
|
+
arch.delete if arch
|
71
59
|
end
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
60
|
+
describe "show" do
|
61
|
+
it "should default to returning configured default download" do
|
62
|
+
DownloadsController.default_content_dsid.should == "content"
|
63
|
+
controller.stub(:render) # send_data calls render internally
|
64
|
+
expected_content = ActiveFedora::Base.find("sufia:test1").content.content
|
65
|
+
controller.should_receive(:send_data).with(expected_content, {:filename => 'world.png', :disposition => 'inline', :type => 'image/png' })
|
66
|
+
get "show", :id => "test1"
|
67
|
+
response.should be_success
|
68
|
+
end
|
69
|
+
it "should return requested datastreams" do
|
70
|
+
controller.stub(:render) # send_data calls render internally
|
71
|
+
expected_content = ActiveFedora::Base.find("sufia:test1").descMetadata.content
|
72
|
+
controller.should_receive(:send_data).with(expected_content, {:filename=>"descMetadata", :disposition=>"inline", :type=>"text/plain"})
|
73
|
+
get "show", :id => "test1", :datastream_id => "descMetadata"
|
74
|
+
response.should be_success
|
75
|
+
end
|
76
|
+
it "should support setting disposition to inline" do
|
77
|
+
controller.stub(:render) # send_data calls render internally
|
78
|
+
expected_content = ActiveFedora::Base.find("sufia:test1").content.content
|
79
|
+
controller.should_receive(:send_data).with(expected_content, {:filename => 'world.png', :type => 'image/png', :disposition => "inline"})
|
80
|
+
get "show", :id => "test1", :disposition => "inline"
|
81
|
+
response.should be_success
|
82
|
+
end
|
83
|
+
it "should allow you to specify filename for download" do
|
84
|
+
controller.stub(:render) # send_data calls render internally
|
85
|
+
expected_content = ActiveFedora::Base.find("sufia:test1").content.content
|
86
|
+
controller.should_receive(:send_data).with(expected_content, {:filename => "my%20dog.png", :disposition => 'inline', :type => 'image/png'})
|
87
|
+
get "show", :id => "test1", "filename" => "my%20dog.png"
|
88
|
+
end
|
77
89
|
end
|
78
90
|
end
|
79
|
-
end
|
80
91
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
92
|
+
describe "when not logged in as reader" do
|
93
|
+
before do
|
94
|
+
sign_in FactoryGirl.find_or_create(:user)
|
95
|
+
User.any_instance.stub(:groups).and_return([])
|
96
|
+
controller.stub(:clear_session_user) ## Don't clear out the authenticated session
|
97
|
+
end
|
98
|
+
after do
|
99
|
+
user = FactoryGirl.find(:user) rescue
|
100
|
+
user.delete if user
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "show" do
|
104
|
+
it "should deny access" do
|
105
|
+
get "show", :id => "test1"
|
106
|
+
response.should redirect_to("/assets/NoAccess.png")
|
107
|
+
end
|
96
108
|
end
|
97
109
|
end
|
98
110
|
end
|