hydra-pbcore 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Rakefile +6 -0
- data/lib/hydra-pbcore.rb +60 -1
- data/lib/hydra-pbcore/behaviors.rb +4 -2
- data/lib/hydra-pbcore/conversions.rb +88 -0
- data/lib/hydra-pbcore/datastream/{digital_document.rb → deprecated/digital_document.rb} +3 -2
- data/lib/hydra-pbcore/datastream/deprecated/document.rb +310 -0
- data/lib/hydra-pbcore/datastream/deprecated/instantiation.rb +261 -0
- data/lib/hydra-pbcore/datastream/document.rb +37 -139
- data/lib/hydra-pbcore/datastream/instantiation.rb +184 -223
- data/lib/hydra-pbcore/methods.rb +23 -2
- data/lib/hydra-pbcore/templates.rb +116 -0
- data/lib/hydra-pbcore/version.rb +1 -1
- data/spec/{digital_document_spec.rb → deprecated/digital_document_spec.rb} +6 -26
- data/spec/deprecated/document_spec.rb +282 -0
- data/spec/deprecated/instantiation_spec.rb +214 -0
- data/spec/document_spec.rb +71 -194
- data/spec/fixtures/converted_digital_document_rrhof_1904.xml +53 -0
- data/spec/fixtures/converted_digital_document_rrhof_2405.xml +46 -0
- data/spec/fixtures/converted_document_rrhof_2439.xml +19 -0
- data/spec/fixtures/converted_document_rrhof_524.xml +45 -0
- data/spec/fixtures/converted_instantiation_rrhof_1184.xml +39 -0
- data/spec/fixtures/converted_rrhof_524.xml +45 -0
- data/spec/fixtures/converted_rrhof_524_instantiation.xml +18 -0
- data/spec/fixtures/{pbcore_digital_document_template.xml → deprecated/pbcore_digital_document_template.xml} +0 -0
- data/spec/fixtures/{pbcore_document_template.xml → deprecated/pbcore_document_template.xml} +0 -0
- data/spec/fixtures/{pbcore_instantiation_template.xml → deprecated/pbcore_instantiation_template.xml} +0 -0
- data/spec/fixtures/{pbcore_solr_digital_document_template.xml → deprecated/pbcore_solr_digital_document_template.xml} +0 -0
- data/spec/fixtures/{pbcore_solr_document_template.xml → deprecated/pbcore_solr_document_template.xml} +0 -0
- data/spec/fixtures/{pbcore_solr_instantiation_template.xml → deprecated/pbcore_solr_instantiation_template.xml} +0 -0
- data/spec/fixtures/digital_instantiation.xml +56 -0
- data/spec/fixtures/digital_instantiation_solr.xml +1913 -0
- data/spec/fixtures/digital_instantiation_template.xml +33 -0
- data/spec/fixtures/document.xml +72 -0
- data/spec/fixtures/document_solr.xml +582 -0
- data/spec/fixtures/document_template.xml +30 -0
- data/spec/fixtures/integration/digital_document_rrhof_1904.xml +63 -0
- data/spec/fixtures/integration/digital_document_rrhof_2405.xml +62 -0
- data/spec/fixtures/integration/document_rrhof_2439.xml +54 -0
- data/spec/fixtures/integration/document_rrhof_524.xml +80 -0
- data/spec/fixtures/integration/instantiation_rrhof_1184.xml +44 -0
- data/spec/fixtures/physical_instantiation.xml +20 -0
- data/spec/fixtures/physical_instantiation_solr.xml +441 -0
- data/spec/fixtures/physical_instantiation_template.xml +18 -0
- data/spec/instantiation_spec.rb +180 -132
- data/spec/integration/conversions_spec.rb +73 -0
- data/spec/spec_helper.rb +37 -9
- data/spec/templates_spec.rb +31 -0
- metadata +68 -17
@@ -0,0 +1,214 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe HydraPbcore::Datastream::Deprecated::Instantiation do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@object_ds = HydraPbcore::Datastream::Deprecated::Instantiation.new(nil, nil)
|
7
|
+
end
|
8
|
+
|
9
|
+
describe ".update_indexed_attributes" do
|
10
|
+
it "should update all of the fields in #xml_template and fields not requiring additional inserted nodes" do
|
11
|
+
[
|
12
|
+
[:name],
|
13
|
+
[:location],
|
14
|
+
[:date],
|
15
|
+
[:generation],
|
16
|
+
[:media_type],
|
17
|
+
[:file_format],
|
18
|
+
[:size],
|
19
|
+
[:size_units],
|
20
|
+
[:colors],
|
21
|
+
[:duration],
|
22
|
+
[:rights_summary],
|
23
|
+
[:note],
|
24
|
+
[:checksum_type],
|
25
|
+
[:checksum_value],
|
26
|
+
[:device],
|
27
|
+
[:capture_soft],
|
28
|
+
[:trans_soft],
|
29
|
+
[:operator],
|
30
|
+
[:trans_note],
|
31
|
+
[:vendor],
|
32
|
+
[:condition],
|
33
|
+
[:cleaning],
|
34
|
+
[:color_space],
|
35
|
+
[:chroma],
|
36
|
+
[:video_standard],
|
37
|
+
[:video_encoding],
|
38
|
+
[:video_bit_rate],
|
39
|
+
[:video_bit_rate_units],
|
40
|
+
[:frame_rate],
|
41
|
+
[:frame_size],
|
42
|
+
[:video_bit_depth],
|
43
|
+
[:aspect_ratio],
|
44
|
+
[:audio_standard],
|
45
|
+
[:audio_encoding],
|
46
|
+
[:audio_bit_rate],
|
47
|
+
[:audio_bit_rate_units],
|
48
|
+
[:audio_sample_rate],
|
49
|
+
[:audio_sample_rate_units],
|
50
|
+
[:audio_bit_depth],
|
51
|
+
[:audio_channels],
|
52
|
+
].each do |pointer|
|
53
|
+
test_val = "#{pointer.last.to_s} value"
|
54
|
+
@object_ds.update_indexed_attributes( {pointer=>{"0"=>test_val}} )
|
55
|
+
@object_ds.get_values(pointer).first.should == test_val
|
56
|
+
@object_ds.get_values(pointer).length.should == 1
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "default fields" do
|
62
|
+
|
63
|
+
it "like media type should be 'Moving image'" do
|
64
|
+
@object_ds.get_values([:media_type]).first.should == "Moving image"
|
65
|
+
end
|
66
|
+
|
67
|
+
it "like colors should be 'Color'" do
|
68
|
+
@object_ds.get_values([:colors]).first.should == "Color"
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "#xml_template" do
|
74
|
+
it "should return an empty xml document matching an exmplar" do
|
75
|
+
|
76
|
+
# insert optional fields
|
77
|
+
@object_ds.update_indexed_attributes({ [:checksum_type] => { 0 => "inserted" }} )
|
78
|
+
@object_ds.update_indexed_attributes({ [:note] => { 0 => "inserted" }} )
|
79
|
+
@object_ds.update_indexed_attributes({ [:checksum_value] => { 0 => "inserted" }} )
|
80
|
+
@object_ds.update_indexed_attributes({ [:device] => { 0 => "inserted" }} )
|
81
|
+
@object_ds.update_indexed_attributes({ [:capture_soft] => { 0 => "inserted" }} )
|
82
|
+
@object_ds.update_indexed_attributes({ [:trans_soft] => { 0 => "inserted" }} )
|
83
|
+
@object_ds.update_indexed_attributes({ [:operator] => { 0 => "inserted" }} )
|
84
|
+
@object_ds.update_indexed_attributes({ [:trans_note] => { 0 => "inserted" }} )
|
85
|
+
@object_ds.update_indexed_attributes({ [:vendor] => { 0 => "inserted" }} )
|
86
|
+
@object_ds.update_indexed_attributes({ [:condition] => { 0 => "inserted" }} )
|
87
|
+
@object_ds.update_indexed_attributes({ [:cleaning] => { 0 => "inserted" }} )
|
88
|
+
@object_ds.update_indexed_attributes({ [:color_space] => { 0 => "inserted" }} )
|
89
|
+
@object_ds.update_indexed_attributes({ [:chroma] => { 0 => "inserted" }} )
|
90
|
+
@object_ds.update_indexed_attributes({ [:standard] => { 0 => "inserted" }} )
|
91
|
+
@object_ds.update_indexed_attributes({ [:language] => { 0 => "inserted" }} )
|
92
|
+
|
93
|
+
# insert optional nodes using sample values
|
94
|
+
@object_ds.insert_next("inserted")
|
95
|
+
@object_ds.insert_previous("inserted")
|
96
|
+
|
97
|
+
# Load example deprecated_fixture
|
98
|
+
f = deprecated_fixture "pbcore_instantiation_template.xml"
|
99
|
+
ref_node = Nokogiri::XML(f)
|
100
|
+
f.close
|
101
|
+
|
102
|
+
# Nokogiri-fy our sample document and add in namespace
|
103
|
+
sample_node = Nokogiri::XML(@object_ds.to_xml)
|
104
|
+
with_namespace = HydraPbcore::Behaviors.insert_pbcore_namespace(sample_node)
|
105
|
+
|
106
|
+
# Save this for later...
|
107
|
+
out = File.new("tmp/pbcore_instantiation_sample.xml", "w")
|
108
|
+
out.write(with_namespace.to_s)
|
109
|
+
out.close
|
110
|
+
|
111
|
+
EquivalentXml.equivalent?(ref_node, with_namespace, opts = { :element_order => false, :normalize_whitespace => true }).should be_true
|
112
|
+
|
113
|
+
# TODO: reorder nodes on the instantiaion
|
114
|
+
#Rockhall::Pbcore.validate(with_namespace).should be_empty
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
describe "essence fields" do
|
119
|
+
|
120
|
+
it "shoud have different essenceTrackStandard nodes" do
|
121
|
+
|
122
|
+
# Standard
|
123
|
+
@object_ds.update_indexed_attributes({ [:video_standard] => { 0 => "video standard" }} )
|
124
|
+
@object_ds.update_indexed_attributes({ [:audio_standard] => { 0 => "audio standard" }} )
|
125
|
+
@object_ds.get_values([{:pbcoreInstantiation=>0}, {:instantiationEssenceTrack=>0}, :essenceTrackStandard]).first.should == "video standard"
|
126
|
+
@object_ds.get_values([{:pbcoreInstantiation=>0}, {:instantiationEssenceTrack=>1}, :essenceTrackStandard]).first.should == "audio standard"
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
describe ".to_solr" do
|
133
|
+
|
134
|
+
before(:each) do
|
135
|
+
[
|
136
|
+
"name",
|
137
|
+
"location",
|
138
|
+
"generation",
|
139
|
+
"media_type",
|
140
|
+
"file_format",
|
141
|
+
"size",
|
142
|
+
"size_units",
|
143
|
+
"colors",
|
144
|
+
"duration",
|
145
|
+
"rights_summary",
|
146
|
+
"note",
|
147
|
+
"checksum_type",
|
148
|
+
"checksum_value",
|
149
|
+
"device",
|
150
|
+
"capture_soft",
|
151
|
+
"trans_soft",
|
152
|
+
"operator",
|
153
|
+
"trans_note",
|
154
|
+
"vendor",
|
155
|
+
"condition",
|
156
|
+
"cleaning",
|
157
|
+
"color_space",
|
158
|
+
"chroma",
|
159
|
+
"video_standard",
|
160
|
+
"video_encoding",
|
161
|
+
"video_bit_rate",
|
162
|
+
"video_bit_rate_units",
|
163
|
+
"frame_rate",
|
164
|
+
"frame_size",
|
165
|
+
"video_bit_depth",
|
166
|
+
"aspect_ratio",
|
167
|
+
"audio_standard",
|
168
|
+
"audio_encoding",
|
169
|
+
"audio_bit_rate",
|
170
|
+
"audio_bit_rate_units",
|
171
|
+
"audio_sample_rate",
|
172
|
+
"audio_sample_rate_units",
|
173
|
+
"audio_bit_depth",
|
174
|
+
"audio_channels"
|
175
|
+
].each do |field|
|
176
|
+
@object_ds.send("#{field}=".to_sym, field)
|
177
|
+
end
|
178
|
+
|
179
|
+
# Use a real date
|
180
|
+
@object_ds.date = "2012-11"
|
181
|
+
end
|
182
|
+
|
183
|
+
it "should match an exmplar" do
|
184
|
+
# Load example deprecated_fixture
|
185
|
+
f = deprecated_fixture "pbcore_solr_instantiation_template.xml"
|
186
|
+
ref_node = Nokogiri::XML(f)
|
187
|
+
f.close
|
188
|
+
|
189
|
+
# Nokogiri-fy our sample document
|
190
|
+
sample_node = Nokogiri::XML(@object_ds.to_solr.to_xml)
|
191
|
+
|
192
|
+
# Save this for later...
|
193
|
+
out = File.new("tmp/pbcore_solr_instantation_sample.xml", "w")
|
194
|
+
out.write(sample_node.to_s)
|
195
|
+
out.close
|
196
|
+
|
197
|
+
EquivalentXml.equivalent?(ref_node, sample_node, opts = { :element_order => false, :normalize_whitespace => true }).should be_true
|
198
|
+
end
|
199
|
+
|
200
|
+
it "should display dates as they were entered" do
|
201
|
+
@object_ds.to_solr["date_display"].should == ["2012-11"]
|
202
|
+
end
|
203
|
+
|
204
|
+
it "should have dates converted to ISO 8601" do
|
205
|
+
@object_ds.to_solr["date_dt"].should == ["2012-11-01T00:00:00Z"]
|
206
|
+
end
|
207
|
+
|
208
|
+
it "should not index dates as text" do
|
209
|
+
@object_ds.to_solr["date_t"].should be_nil
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
data/spec/document_spec.rb
CHANGED
@@ -6,8 +6,15 @@ describe HydraPbcore::Datastream::Document do
|
|
6
6
|
@object_ds = HydraPbcore::Datastream::Document.new(nil, nil)
|
7
7
|
end
|
8
8
|
|
9
|
-
describe "
|
10
|
-
it "should
|
9
|
+
describe "::xml_template" do
|
10
|
+
it "should match an exmplar" do
|
11
|
+
save_template @object_ds.to_xml, "document_template.xml"
|
12
|
+
equivalent_xml_files("document_template.xml").should be_true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#update_indexed_attributes" do
|
17
|
+
it "should update the intitial fields" do
|
11
18
|
[
|
12
19
|
[:pbc_id],
|
13
20
|
[:main_title],
|
@@ -28,36 +35,25 @@ describe HydraPbcore::Datastream::Document do
|
|
28
35
|
[:lc_genre],
|
29
36
|
[:lc_subject_genre],
|
30
37
|
[:event_series],
|
31
|
-
[:event_place],
|
32
38
|
[:contributor_name],
|
33
39
|
[:contributor_role],
|
34
40
|
[:publisher_name],
|
35
41
|
[:publisher_role],
|
36
42
|
[:note],
|
37
|
-
[:
|
38
|
-
[:repository],
|
39
|
-
[:format],
|
40
|
-
[:standard],
|
41
|
-
[:media_type],
|
42
|
-
[:generation],
|
43
|
-
[:language],
|
44
|
-
[:colors],
|
43
|
+
[:rights_summary],
|
45
44
|
[:archival_collection],
|
46
45
|
[:archival_series],
|
47
46
|
[:collection_number],
|
48
47
|
[:accession_number],
|
49
|
-
[:usage],
|
50
|
-
[:condition_note],
|
51
|
-
[:cleaning_note]
|
52
48
|
].each do |pointer|
|
53
|
-
test_val =
|
49
|
+
test_val = random_string
|
54
50
|
@object_ds.update_values( {pointer=>{"0"=>test_val}} )
|
55
51
|
@object_ds.get_values(pointer).first.should == test_val
|
56
52
|
@object_ds.get_values(pointer).length.should == 1
|
57
53
|
end
|
58
54
|
end
|
59
55
|
|
60
|
-
it "should
|
56
|
+
it "should update fields requiring inserted nodes" do
|
61
57
|
@object_ds.insert_publisher
|
62
58
|
@object_ds.insert_contributor
|
63
59
|
[
|
@@ -86,74 +82,9 @@ describe HydraPbcore::Datastream::Document do
|
|
86
82
|
@object_ds.get_values(:contributor_role)[0].should == "first contributor role"
|
87
83
|
@object_ds.get_values(:contributor_role)[1].should == "second contributor role"
|
88
84
|
end
|
89
|
-
|
90
|
-
end
|
91
|
-
|
92
|
-
describe "#xml_template" do
|
93
|
-
it "should return an empty xml document matching a valid exmplar" do
|
94
|
-
# insert additional nodes
|
95
|
-
@object_ds.insert_publisher("inserted", "inserted")
|
96
|
-
@object_ds.insert_contributor("inserted", "inserted")
|
97
|
-
@object_ds.insert_publisher("inserted")
|
98
|
-
@object_ds.insert_contributor("inserted")
|
99
|
-
@object_ds.insert_contributor
|
100
|
-
|
101
|
-
# update additional nodes that OM will insert automatically
|
102
|
-
@object_ds.update_indexed_attributes({ [:alternative_title] => { 0 => "inserted" }} )
|
103
|
-
@object_ds.update_indexed_attributes({ [:chapter] => { 0 => "inserted" }} )
|
104
|
-
@object_ds.update_indexed_attributes({ [:episode] => { 0 => "inserted" }} )
|
105
|
-
@object_ds.update_indexed_attributes({ [:label] => { 0 => "inserted" }} )
|
106
|
-
@object_ds.update_indexed_attributes({ [:segment] => { 0 => "inserted" }} )
|
107
|
-
@object_ds.update_indexed_attributes({ [:subtitle] => { 0 => "inserted" }} )
|
108
|
-
@object_ds.update_indexed_attributes({ [:track] => { 0 => "inserted" }} )
|
109
|
-
@object_ds.update_indexed_attributes({ [:translation] => { 0 => "inserted" }} )
|
110
|
-
@object_ds.update_indexed_attributes({ [:lc_subject] => { 0 => "inserted" }} )
|
111
|
-
@object_ds.update_indexed_attributes({ [:lc_name] => { 0 => "inserted" }} )
|
112
|
-
@object_ds.update_indexed_attributes({ [:rh_subject] => { 0 => "inserted" }} )
|
113
|
-
@object_ds.update_indexed_attributes({ [:getty_genre] => { 0 => "inserted" }} )
|
114
|
-
@object_ds.update_indexed_attributes({ [:lc_genre] => { 0 => "inserted" }} )
|
115
|
-
@object_ds.update_indexed_attributes({ [:lc_subject_genre] => { 0 => "inserted" }} )
|
116
|
-
@object_ds.update_indexed_attributes({ [:subject] => { 0 => "inserted" }} )
|
117
|
-
@object_ds.update_indexed_attributes({ [:genre] => { 0 => "inserted" }} )
|
118
|
-
@object_ds.update_indexed_attributes({ [:condition_note] => { 0 => "inserted" }} )
|
119
|
-
@object_ds.update_indexed_attributes({ [:cleaning_note] => { 0 => "inserted" }} )
|
120
|
-
|
121
|
-
# Load example fixture
|
122
|
-
f = fixture "pbcore_document_template.xml"
|
123
|
-
ref_node = Nokogiri::XML(f)
|
124
|
-
f.close
|
125
|
-
|
126
|
-
# Nokogiri-fy our sample document and reorder nodes
|
127
|
-
sample_node = Nokogiri::XML(@object_ds.to_xml)
|
128
|
-
reordered = HydraPbcore::Behaviors.reorder_document(sample_node)
|
129
|
-
|
130
|
-
# Save this for later...
|
131
|
-
out = File.new("tmp/pbcore_document_sample.xml", "w")
|
132
|
-
out.write(reordered.to_s)
|
133
|
-
out.close
|
134
|
-
|
135
|
-
EquivalentXml.equivalent?(ref_node, reordered, opts = { :element_order => false, :normalize_whitespace => true }).should be_true
|
136
|
-
HydraPbcore::Behaviors.validate(reordered).should be_empty
|
137
|
-
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
describe ".insert_node" do
|
142
|
-
|
143
|
-
it "should return a node and index for a given template type" do
|
144
|
-
pending "Don't need?"
|
145
|
-
["publisher", "contributor"].each do |type|
|
146
|
-
node, index = @object_ds.insert_node(type.to_s)
|
147
|
-
index.should == 0
|
148
|
-
@object_ds.dirty?.should be_true
|
149
|
-
node, index = @object_ds.insert_node(type.to_s)
|
150
|
-
index.should == 1
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
85
|
end
|
155
86
|
|
156
|
-
describe "
|
87
|
+
describe "#remove_node" do
|
157
88
|
it "should remove a node a given type and index" do
|
158
89
|
["publisher", "contributor"].each do |type|
|
159
90
|
@object_ds.send("insert_"+type)
|
@@ -165,133 +96,79 @@ describe HydraPbcore::Datastream::Document do
|
|
165
96
|
@object_ds.find_by_terms(type.to_sym).count.should == 0
|
166
97
|
end
|
167
98
|
end
|
168
|
-
|
169
|
-
end
|
170
|
-
|
171
|
-
describe "default fields" do
|
172
|
-
|
173
|
-
it "such as media type should be 'Moving image'" do
|
174
|
-
@object_ds.get_values([:media_type]).first.should == "Moving image"
|
175
|
-
end
|
176
|
-
|
177
|
-
it "such as colors should be 'Color'" do
|
178
|
-
@object_ds.get_values([:colors]).first.should == "Color"
|
179
|
-
end
|
180
|
-
|
181
|
-
it "such as generation should be 'Original'" do
|
182
|
-
@object_ds.get_values([:generation]).first.should == "Original"
|
183
|
-
end
|
184
|
-
|
185
99
|
end
|
186
100
|
|
187
|
-
describe "
|
101
|
+
describe "sample" do
|
188
102
|
|
189
103
|
before(:each) do
|
190
104
|
# insert additional nodes
|
191
|
-
@object_ds.insert_publisher
|
105
|
+
@object_ds.insert_publisher("inserted", "inserted")
|
106
|
+
@object_ds.insert_contributor("inserted", "inserted")
|
107
|
+
@object_ds.insert_publisher("inserted")
|
108
|
+
@object_ds.insert_contributor("inserted")
|
192
109
|
@object_ds.insert_contributor
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
"generation",
|
226
|
-
"language",
|
227
|
-
"colors",
|
228
|
-
"archival_collection",
|
229
|
-
"archival_series",
|
230
|
-
"collection_number",
|
231
|
-
"accession_number",
|
232
|
-
"usage",
|
233
|
-
"condition_note",
|
234
|
-
"cleaning_note"
|
235
|
-
].each do |field|
|
236
|
-
@object_ds.send("#{field}=".to_sym, field)
|
237
|
-
end
|
238
|
-
# update additional nodes that OM will insert automatically
|
239
|
-
@object_ds.update_indexed_attributes({ [:alternative_title] => { 0 => "inserted" }} )
|
240
|
-
@object_ds.update_indexed_attributes({ [:chapter] => { 0 => "inserted" }} )
|
241
|
-
@object_ds.update_indexed_attributes({ [:episode] => { 0 => "inserted" }} )
|
242
|
-
@object_ds.update_indexed_attributes({ [:label] => { 0 => "inserted" }} )
|
243
|
-
@object_ds.update_indexed_attributes({ [:segment] => { 0 => "inserted" }} )
|
244
|
-
@object_ds.update_indexed_attributes({ [:subtitle] => { 0 => "inserted" }} )
|
245
|
-
@object_ds.update_indexed_attributes({ [:track] => { 0 => "inserted" }} )
|
246
|
-
@object_ds.update_indexed_attributes({ [:translation] => { 0 => "inserted" }} )
|
247
|
-
@object_ds.update_indexed_attributes({ [:lc_subject] => { 0 => "inserted" }} )
|
248
|
-
@object_ds.update_indexed_attributes({ [:lc_name] => { 0 => "inserted" }} )
|
249
|
-
@object_ds.update_indexed_attributes({ [:rh_subject] => { 0 => "inserted" }} )
|
250
|
-
@object_ds.update_indexed_attributes({ [:getty_genre] => { 0 => "inserted" }} )
|
251
|
-
@object_ds.update_indexed_attributes({ [:lc_genre] => { 0 => "inserted" }} )
|
252
|
-
@object_ds.update_indexed_attributes({ [:lc_subject_genre] => { 0 => "inserted" }} )
|
253
|
-
@object_ds.update_indexed_attributes({ [:subject] => { 0 => "inserted" }} )
|
254
|
-
@object_ds.update_indexed_attributes({ [:genre] => { 0 => "inserted" }} )
|
255
|
-
@object_ds.update_indexed_attributes({ [:condition_note] => { 0 => "inserted" }} )
|
256
|
-
@object_ds.update_indexed_attributes({ [:cleaning_note] => { 0 => "inserted" }} )
|
257
|
-
|
258
|
-
# Use ISO 8601 dates
|
259
|
-
@object_ds.event_date = "2012-11-11"
|
260
|
-
@object_ds.creation_date = "2012"
|
110
|
+
@object_ds.insert_place("inserted")
|
111
|
+
@object_ds.insert_date("2012-11-11")
|
112
|
+
|
113
|
+
@object_ds.pbc_id = "inserted"
|
114
|
+
@object_ds.main_title = "inserted"
|
115
|
+
@object_ds.alternative_title = "inserted"
|
116
|
+
@object_ds.chapter = "inserted"
|
117
|
+
@object_ds.episode = "inserted"
|
118
|
+
@object_ds.label = "inserted"
|
119
|
+
@object_ds.segment = "inserted"
|
120
|
+
@object_ds.subtitle = "inserted"
|
121
|
+
@object_ds.track = "inserted"
|
122
|
+
@object_ds.translation = "inserted"
|
123
|
+
@object_ds.summary = "inserted"
|
124
|
+
@object_ds.parts_list = "inserted"
|
125
|
+
@object_ds.lc_subject = "inserted"
|
126
|
+
@object_ds.lc_name = "inserted"
|
127
|
+
@object_ds.rh_subject = "inserted"
|
128
|
+
@object_ds.getty_genre = "inserted"
|
129
|
+
@object_ds.lc_genre = "inserted"
|
130
|
+
@object_ds.lc_subject_genre = "inserted"
|
131
|
+
@object_ds.event_series = "inserted"
|
132
|
+
@object_ds.contributor_name = "inserted"
|
133
|
+
@object_ds.contributor_role = "inserted"
|
134
|
+
@object_ds.publisher_name = "inserted"
|
135
|
+
@object_ds.publisher_role = "inserted"
|
136
|
+
@object_ds.note = "inserted"
|
137
|
+
@object_ds.rights_summary = "inserted"
|
138
|
+
@object_ds.archival_collection = "inserted"
|
139
|
+
@object_ds.archival_series = "inserted"
|
140
|
+
@object_ds.collection_number = "inserted"
|
141
|
+
@object_ds.accession_number = "inserted"
|
261
142
|
end
|
262
143
|
|
263
|
-
it "should match an exmplar" do
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
f.close
|
268
|
-
|
269
|
-
# Nokogiri-fy our sample document
|
270
|
-
sample_node = Nokogiri::XML(@object_ds.to_solr.to_xml)
|
144
|
+
it "solr document should match an exmplar" do
|
145
|
+
save_template @object_ds.to_solr.to_xml, "document_solr.xml"
|
146
|
+
equivalent_xml_files("document_solr.xml").should be_true
|
147
|
+
end
|
271
148
|
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
149
|
+
describe "solr dates" do
|
150
|
+
it "should be indexed for display" do
|
151
|
+
@object_ds.to_solr["event_date_display"].should == ["2012-11-11"]
|
152
|
+
end
|
276
153
|
|
277
|
-
|
278
|
-
|
154
|
+
it "should be converted to ISO 8601" do
|
155
|
+
@object_ds.to_solr["event_date_dt"].should == ["2012-11-11T00:00:00Z"]
|
156
|
+
end
|
279
157
|
|
280
|
-
|
281
|
-
|
282
|
-
|
158
|
+
it "should not be searchable as strings" do
|
159
|
+
@object_ds.to_solr["event_date_t"].should be_nil
|
160
|
+
end
|
283
161
|
end
|
284
162
|
|
285
|
-
it "
|
286
|
-
@object_ds.
|
287
|
-
|
163
|
+
it "xml document should match an exmplar" do
|
164
|
+
save_template @object_ds.to_xml, "document.xml"
|
165
|
+
equivalent_xml_files("document.xml").should be_true
|
288
166
|
end
|
289
167
|
|
290
|
-
it "should
|
291
|
-
@object_ds.
|
292
|
-
@object_ds.
|
168
|
+
it "xml document should validate against the PBCore schema" do
|
169
|
+
save_template @object_ds.to_pbcore_xml, "document_valid.xml"
|
170
|
+
@object_ds.valid?.should == []
|
293
171
|
end
|
294
|
-
|
295
|
-
end
|
172
|
+
end
|
296
173
|
|
297
174
|
end
|