active-fedora 4.0.0.rc1 → 4.0.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +2 -11
- data/History.txt +4 -1
- data/active-fedora.gemspec +2 -2
- data/lib/active_fedora/associations/association_collection.rb +1 -1
- data/lib/active_fedora/associations/belongs_to_association.rb +1 -1
- data/lib/active_fedora/associations/has_and_belongs_to_many_association.rb +1 -1
- data/lib/active_fedora/base.rb +10 -6
- data/lib/active_fedora/file_management.rb +1 -1
- data/lib/active_fedora/fixture_loader.rb +1 -1
- data/lib/active_fedora/model.rb +39 -38
- data/lib/active_fedora/nokogiri_datastream.rb +1 -1
- data/lib/active_fedora/persistence.rb +9 -11
- data/lib/active_fedora/predicates.rb +2 -2
- data/lib/active_fedora/rdf_datastream.rb +49 -7
- data/lib/active_fedora/relationships.rb +6 -9
- data/lib/active_fedora/service_definitions.rb +1 -1
- data/lib/active_fedora/solr_service.rb +15 -8
- data/lib/active_fedora/version.rb +1 -1
- data/lib/tasks/active_fedora.rake +3 -5
- data/lib/tasks/active_fedora_dev.rake +2 -1
- data/spec/fixtures/solr_rdf_descMetadata.nt +7 -0
- data/spec/integration/base_file_management_spec.rb +1 -1
- data/spec/integration/base_find_by_fields_spec.rb +16 -14
- data/spec/integration/base_spec.rb +10 -9
- data/spec/integration/datastream_collections_spec.rb +5 -5
- data/spec/integration/datastream_spec.rb +1 -1
- data/spec/integration/full_featured_model_spec.rb +1 -1
- data/spec/integration/model_spec.rb +14 -11
- data/spec/integration/mods_article_integration_spec.rb +2 -2
- data/spec/integration/nokogiri_datastream_spec.rb +1 -1
- data/spec/integration/ntriples_datastream_spec.rb +1 -0
- data/spec/integration/rels_ext_datastream_spec.rb +5 -6
- data/spec/integration/semantic_node_spec.rb +0 -1
- data/spec/integration/solr_service_spec.rb +8 -8
- data/spec/unit/base_extra_spec.rb +47 -7
- data/spec/unit/base_file_management_spec.rb +1 -1
- data/spec/unit/base_spec.rb +44 -15
- data/spec/unit/model_spec.rb +16 -29
- data/spec/unit/ntriples_datastream_spec.rb +152 -1
- data/spec/unit/relationships_spec.rb +16 -18
- data/spec/unit/solr_config_options_spec.rb +1 -3
- data/spec/unit/solr_service_spec.rb +12 -24
- metadata +68 -86
- data/spec/integration/base_loader_spec.rb +0 -40
@@ -161,13 +161,14 @@ module ActiveFedora
|
|
161
161
|
opts = {:rows=>25}.merge(opts)
|
162
162
|
query = self.class.inbound_relationship_query(self.pid,"#{name}")
|
163
163
|
return [] if query.empty?
|
164
|
-
solr_result = SolrService.instance.conn.query(query, :rows=>opts[:rows])
|
165
164
|
if opts[:response_format] == :solr
|
165
|
+
solr_result = SolrService.query query, :raw=>true, :rows=>opts[:rows]
|
166
166
|
return solr_result
|
167
167
|
else
|
168
|
+
solr_result = SolrService.query(query, :rows=>opts[:rows])
|
168
169
|
if opts[:response_format] == :id_array
|
169
170
|
id_array = []
|
170
|
-
solr_result.
|
171
|
+
solr_result.each do |hit|
|
171
172
|
id_array << hit[SOLR_DOCUMENT_ID]
|
172
173
|
end
|
173
174
|
return id_array
|
@@ -187,7 +188,7 @@ module ActiveFedora
|
|
187
188
|
predicate = outbound_relationship_predicates["#{name}_outbound"]
|
188
189
|
outbound_id_array = ids_for_outbound(predicate)
|
189
190
|
query = self.class.bidirectional_relationship_query(self.pid,"#{name}",outbound_id_array)
|
190
|
-
solr_result = SolrService.
|
191
|
+
solr_result = SolrService.query(query, :rows=>opts[:rows])
|
191
192
|
|
192
193
|
if opts[:response_format] == :solr
|
193
194
|
return solr_result
|
@@ -208,15 +209,11 @@ module ActiveFedora
|
|
208
209
|
return id_array
|
209
210
|
else
|
210
211
|
query = self.class.outbound_relationship_query(name,id_array)
|
211
|
-
solr_result = SolrService.
|
212
|
+
solr_result = SolrService.query(query)
|
212
213
|
if opts[:response_format] == :solr
|
213
214
|
return solr_result
|
214
215
|
elsif opts[:response_format] == :id_array
|
215
|
-
|
216
|
-
solr_result.hits.each do |hit|
|
217
|
-
id_array << hit[SOLR_DOCUMENT_ID]
|
218
|
-
end
|
219
|
-
return id_array
|
216
|
+
return solr_result.map {|hit| hit[SOLR_DOCUMENT_ID] }
|
220
217
|
elsif opts[:response_format] == :load_from_solr || self.load_from_solr
|
221
218
|
return ActiveFedora::SolrService.reify_solr_results(solr_result,{:load_from_solr=>true})
|
222
219
|
else
|
@@ -7,7 +7,7 @@ module ServiceDefinitions
|
|
7
7
|
model_uri = mod.to_class_uri
|
8
8
|
# load ContentModel, pull Sdef pointers
|
9
9
|
begin
|
10
|
-
cmodel = ActiveFedora::ContentModel.
|
10
|
+
cmodel = ActiveFedora::ContentModel.find(mod.to_class_uri)
|
11
11
|
sdef_pids = cmodel.ids_for_outbound(:has_service).collect { |uri|
|
12
12
|
uri.split('/')[-1]
|
13
13
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require 'solr'
|
2
1
|
require "solrizer"
|
2
|
+
require 'rsolr'
|
3
3
|
|
4
4
|
module ActiveFedora
|
5
5
|
class SolrService
|
@@ -17,8 +17,10 @@ module ActiveFedora
|
|
17
17
|
end
|
18
18
|
def initialize(host, args)
|
19
19
|
host = 'http://localhost:8080/solr' unless host
|
20
|
-
|
21
|
-
|
20
|
+
args = args.dup
|
21
|
+
args.merge!(:url=>host)
|
22
|
+
@conn = RSolr.connect args
|
23
|
+
# @conn = Solr::Connection.new(host, opts)
|
22
24
|
end
|
23
25
|
|
24
26
|
def self.instance
|
@@ -33,11 +35,8 @@ module ActiveFedora
|
|
33
35
|
end
|
34
36
|
|
35
37
|
def self.reify_solr_results(solr_result,opts={})
|
36
|
-
unless solr_result.is_a?(Solr::Response::Standard)
|
37
|
-
raise ArgumentError.new("Only solr responses (Solr::Response::Standard) are allowed. You provided a #{solr_result.class}")
|
38
|
-
end
|
39
38
|
results = []
|
40
|
-
solr_result.
|
39
|
+
solr_result.each do |hit|
|
41
40
|
classname = class_from_solr_document(hit)
|
42
41
|
if opts[:load_from_solr]
|
43
42
|
results << classname.load_instance_from_solr(hit[SOLR_DOCUMENT_ID])
|
@@ -70,7 +69,15 @@ module ActiveFedora
|
|
70
69
|
def self.escape_uri_for_query(uri)
|
71
70
|
return uri.gsub(/(:)/, '\\:')
|
72
71
|
end
|
73
|
-
|
72
|
+
|
73
|
+
def self.query(query, args={})
|
74
|
+
raw = args.delete(:raw)
|
75
|
+
args = args.merge(:q=>query)
|
76
|
+
result = SolrService.instance.conn.get('select', :params=>args)
|
77
|
+
return result if raw
|
78
|
+
result['response']['docs']
|
79
|
+
end
|
80
|
+
|
74
81
|
|
75
82
|
end #SolrService
|
76
83
|
class SolrNotInitialized < StandardError;end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require "active-fedora"
|
2
|
-
require "solrizer-fedora"
|
3
2
|
require "active_support" # This is just to load ActiveSupport::CoreExtensions::String::Inflections
|
4
3
|
namespace :repo do
|
5
4
|
|
@@ -13,7 +12,7 @@ namespace :repo do
|
|
13
12
|
else
|
14
13
|
pid = ENV["pid"]
|
15
14
|
begin
|
16
|
-
ActiveFedora::Base.
|
15
|
+
ActiveFedora::Base.find(pid).delete
|
17
16
|
rescue ActiveFedora::ObjectNotFoundError
|
18
17
|
puts "The object #{pid} has already been deleted (or was never created)."
|
19
18
|
rescue Errno::ECONNREFUSED => e
|
@@ -36,7 +35,7 @@ namespace :repo do
|
|
36
35
|
while i <= stop_point do
|
37
36
|
pid = namespace + ":" + i.to_s
|
38
37
|
begin
|
39
|
-
ActiveFedora::Base.
|
38
|
+
ActiveFedora::Base.find(pid).delete
|
40
39
|
rescue ActiveFedora::ObjectNotFoundError
|
41
40
|
# The object has already been deleted (or was never created). Do nothing.
|
42
41
|
end
|
@@ -86,8 +85,7 @@ namespace :repo do
|
|
86
85
|
if pid.nil?
|
87
86
|
pid = result.body
|
88
87
|
end
|
89
|
-
|
90
|
-
solrizer.solrize(pid)
|
88
|
+
ActiveFedora::Base.find(pid).update_index
|
91
89
|
else
|
92
90
|
puts "Failed to load the object."
|
93
91
|
end
|
@@ -65,7 +65,6 @@ require 'rspec/core/rake_task'
|
|
65
65
|
desc "Hudson build"
|
66
66
|
task :hudson do
|
67
67
|
ENV['environment'] = "test"
|
68
|
-
Rake::Task["active_fedora:doc"].invoke
|
69
68
|
Rake::Task["active_fedora:configure_jetty"].invoke
|
70
69
|
jetty_params = Jettywrapper.load_config
|
71
70
|
jetty_params[:startup_wait]= 30
|
@@ -74,6 +73,8 @@ task :hudson do
|
|
74
73
|
Rake::Task["active_fedora:rspec"].invoke
|
75
74
|
end
|
76
75
|
raise "test failures: #{error}" if error
|
76
|
+
# Only create documentation if the tests have passed
|
77
|
+
Rake::Task["active_fedora:doc"].invoke
|
77
78
|
end
|
78
79
|
|
79
80
|
# Provides an :environment task for use while working within a working copy of active-fedora
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<info:fedora/test:1> <http://purl.org/dc/terms/created> "fake-date" .
|
2
|
+
<info:fedora/test:1> <http://purl.org/dc/terms/title> "fake-title" .
|
3
|
+
<info:fedora/test:1> <http://purl.org/dc/terms/publisher> "publisher1" .
|
4
|
+
<info:fedora/test:1> <http://xmlns.com/foaf/0.1/based_near> "coverage1" .
|
5
|
+
<info:fedora/test:1> <http://xmlns.com/foaf/0.1/based_near> "coverage2" .
|
6
|
+
<info:fedora/test:1> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://example.org/> .
|
7
|
+
|
@@ -17,7 +17,7 @@ describe ActiveFedora::Base do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should persist and re-load collection members" do
|
20
|
-
container_copy = FileMgmt.
|
20
|
+
container_copy = FileMgmt.find(@test_container.pid)
|
21
21
|
container_copy.collection_members(:response_format=>:id_array).should == ["foo:2"]
|
22
22
|
end
|
23
23
|
|
@@ -30,6 +30,7 @@ describe ActiveFedora::Base do
|
|
30
30
|
[:title]=>{0=>"Italian and Spanish: A Comparison of Common Phrases"}}
|
31
31
|
@test_object2.update_indexed_attributes(attributes)
|
32
32
|
@test_object2.save
|
33
|
+
sleep(1)
|
33
34
|
|
34
35
|
@test_object3 = MockAFBaseQuerySolr.new
|
35
36
|
attributes = {[:holding_id]=>{0=>"Holding 2"},
|
@@ -39,6 +40,7 @@ describe ActiveFedora::Base do
|
|
39
40
|
[:title]=>{0=>"A study of the evolution of Spanish from Latin"}}
|
40
41
|
@test_object3.update_indexed_attributes(attributes)
|
41
42
|
@test_object3.save
|
43
|
+
sleep(1)
|
42
44
|
|
43
45
|
@test_object4 = MockAFBaseQuerySolr.new
|
44
46
|
attributes = {[:holding_id]=>{0=>"Holding 3"},
|
@@ -75,7 +77,7 @@ describe ActiveFedora::Base do
|
|
75
77
|
#query based on just model
|
76
78
|
results = MockAFBaseQuerySolr.find_by_fields_by_solr({})
|
77
79
|
found_pids = []
|
78
|
-
results.
|
80
|
+
results.each do |hit|
|
79
81
|
found_pids.push(hit[SOLR_DOCUMENT_ID])
|
80
82
|
end
|
81
83
|
|
@@ -86,7 +88,7 @@ describe ActiveFedora::Base do
|
|
86
88
|
#query on certain fields
|
87
89
|
results = MockAFBaseQuerySolr.find_by_fields_by_solr({"language"=>"Latin"})
|
88
90
|
found_pids = []
|
89
|
-
results.
|
91
|
+
results.each do |hit|
|
90
92
|
found_pids.push(hit[SOLR_DOCUMENT_ID])
|
91
93
|
end
|
92
94
|
|
@@ -94,7 +96,7 @@ describe ActiveFedora::Base do
|
|
94
96
|
|
95
97
|
results = MockAFBaseQuerySolr.find_by_fields_by_solr({"language"=>"Italian"})
|
96
98
|
found_pids = []
|
97
|
-
results.
|
99
|
+
results.each do |hit|
|
98
100
|
found_pids.push(hit[SOLR_DOCUMENT_ID])
|
99
101
|
end
|
100
102
|
|
@@ -102,7 +104,7 @@ describe ActiveFedora::Base do
|
|
102
104
|
|
103
105
|
results = MockAFBaseQuerySolr.find_by_fields_by_solr({"language"=>"Spanish"})
|
104
106
|
found_pids = []
|
105
|
-
results.
|
107
|
+
results.each do |hit|
|
106
108
|
found_pids.push(hit[SOLR_DOCUMENT_ID])
|
107
109
|
end
|
108
110
|
|
@@ -114,7 +116,7 @@ describe ActiveFedora::Base do
|
|
114
116
|
|
115
117
|
results = MockAFBaseQuerySolr.find_by_fields_by_solr({"creator"=>"Linguist,A.","title"=>"latin"})
|
116
118
|
found_pids = []
|
117
|
-
results.
|
119
|
+
results.each do |hit|
|
118
120
|
found_pids.push(hit[SOLR_DOCUMENT_ID])
|
119
121
|
end
|
120
122
|
|
@@ -126,7 +128,7 @@ describe ActiveFedora::Base do
|
|
126
128
|
#query with value with embedded ':' (pid)
|
127
129
|
results = MockAFBaseQuerySolr.find_by_fields_by_solr({"id"=>@test_object3.pid})
|
128
130
|
found_pids = []
|
129
|
-
results.
|
131
|
+
results.each do |hit|
|
130
132
|
found_pids.push(hit[SOLR_DOCUMENT_ID])
|
131
133
|
end
|
132
134
|
|
@@ -137,7 +139,7 @@ describe ActiveFedora::Base do
|
|
137
139
|
it "should sort by default by system_create_date" do
|
138
140
|
results = MockAFBaseQuerySolr.find_by_fields_by_solr({"creator"=>"Linguist,A.","language"=>"Spanish"})
|
139
141
|
found_pids = []
|
140
|
-
results.
|
142
|
+
results.each do |hit|
|
141
143
|
found_pids.push(hit[SOLR_DOCUMENT_ID])
|
142
144
|
end
|
143
145
|
|
@@ -147,7 +149,7 @@ describe ActiveFedora::Base do
|
|
147
149
|
it "should be able to change the sort direction" do
|
148
150
|
results = MockAFBaseQuerySolr.find_by_fields_by_solr({"creator"=>"Linguist,A."},{:sort=>[{"system_create"=>"desc"}]})
|
149
151
|
found_pids = []
|
150
|
-
results.
|
152
|
+
results.each do |hit|
|
151
153
|
found_pids.push(hit[SOLR_DOCUMENT_ID])
|
152
154
|
end
|
153
155
|
|
@@ -157,7 +159,7 @@ describe ActiveFedora::Base do
|
|
157
159
|
it "should default the sort direction to ascending" do
|
158
160
|
results = MockAFBaseQuerySolr.find_by_fields_by_solr({"creator"=>"Linguist,A."},{:sort=>["system_create"]})
|
159
161
|
found_pids = []
|
160
|
-
results.
|
162
|
+
results.each do |hit|
|
161
163
|
found_pids.push(hit[SOLR_DOCUMENT_ID])
|
162
164
|
end
|
163
165
|
|
@@ -168,7 +170,7 @@ describe ActiveFedora::Base do
|
|
168
170
|
it "should sort by multiple fields" do
|
169
171
|
results = MockAFBaseQuerySolr.find_by_fields_by_solr({"creator"=>"Linguist,A."},{:sort=>["geography",{"system_create"=>"desc"}]})
|
170
172
|
found_pids = []
|
171
|
-
results.
|
173
|
+
results.each do |hit|
|
172
174
|
found_pids.push(hit[SOLR_DOCUMENT_ID])
|
173
175
|
end
|
174
176
|
|
@@ -179,7 +181,7 @@ describe ActiveFedora::Base do
|
|
179
181
|
#check appropriate logic for system_modified_date field name transformation
|
180
182
|
results = MockAFBaseQuerySolr.find_by_fields_by_solr({"creator"=>"Linguist,A."},{:sort=>["geography",{"system_mod"=>"desc"}]})
|
181
183
|
found_pids = []
|
182
|
-
results.
|
184
|
+
results.each do |hit|
|
183
185
|
found_pids.push(hit[SOLR_DOCUMENT_ID])
|
184
186
|
end
|
185
187
|
|
@@ -190,7 +192,7 @@ describe ActiveFedora::Base do
|
|
190
192
|
#check pass in rows values
|
191
193
|
results = MockAFBaseQuerySolr.find_by_fields_by_solr({"creator"=>"Linguist,A."},{:rows=>2})
|
192
194
|
found_pids = []
|
193
|
-
results.
|
195
|
+
results.each do |hit|
|
194
196
|
found_pids.push(hit[SOLR_DOCUMENT_ID])
|
195
197
|
end
|
196
198
|
|
@@ -201,7 +203,7 @@ describe ActiveFedora::Base do
|
|
201
203
|
#check query with field mapping to solr field and with solr field that is not a field in object
|
202
204
|
#should be able to query by either active fedora model field name or solr key name
|
203
205
|
results = MockAFBaseQuerySolr.find_by_fields_by_solr({"geography_t"=>"Italy"})
|
204
|
-
found_pids = results.
|
206
|
+
found_pids = results.map{|h| h[SOLR_DOCUMENT_ID]}
|
205
207
|
found_pids.should == [@test_object2.pid]
|
206
208
|
end
|
207
209
|
|
@@ -212,7 +214,7 @@ describe ActiveFedora::Base do
|
|
212
214
|
end
|
213
215
|
it "should query Nokogiri based datastreams if you use the solr field names (doesn't do mapping)" do
|
214
216
|
results = MockAFBaseQuerySolr.find_by_fields_by_solr({"journal_title_t" => "foo"})
|
215
|
-
found_pids = results.
|
217
|
+
found_pids = results.map{|h| h[SOLR_DOCUMENT_ID]}
|
216
218
|
found_pids.should == [@test_object2.pid]
|
217
219
|
end
|
218
220
|
end
|
@@ -147,6 +147,7 @@ describe ActiveFedora::Base do
|
|
147
147
|
|
148
148
|
describe "#load_instance" do
|
149
149
|
it "should return an object loaded from fedora" do
|
150
|
+
ActiveSupport::Deprecation.expects(:warn).with("load_instance is deprecated. Use find instead")
|
150
151
|
result = ActiveFedora::Base.load_instance(@test_object.pid)
|
151
152
|
result.should be_instance_of(ActiveFedora::Base)
|
152
153
|
end
|
@@ -258,26 +259,26 @@ describe ActiveFedora::Base do
|
|
258
259
|
f = File.new(File.join( File.dirname(__FILE__), "../fixtures/dino_jpg_no_file_ext" ))
|
259
260
|
@test_object.add_file_datastream(f)
|
260
261
|
@test_object.save
|
261
|
-
test_obj = ActiveFedora::Base.
|
262
|
+
test_obj = ActiveFedora::Base.find(@test_object.pid)
|
262
263
|
#check case where nothing passed in does not have correct mime type
|
263
264
|
test_obj.datastreams["DS1"].mimeType.should == "application/octet-stream"
|
264
265
|
@test_object2 = ActiveFedora::Base.new
|
265
266
|
f = File.new(File.join( File.dirname(__FILE__), "../fixtures/dino_jpg_no_file_ext" ))
|
266
267
|
@test_object2.add_file_datastream(f,{:mimeType=>"image/jpeg"})
|
267
268
|
@test_object2.save
|
268
|
-
test_obj = ActiveFedora::Base.
|
269
|
+
test_obj = ActiveFedora::Base.find(@test_object2.pid)
|
269
270
|
test_obj.datastreams["DS1"].mimeType.should == "image/jpeg"
|
270
271
|
@test_object3 = ActiveFedora::Base.new
|
271
272
|
f = File.new(File.join( File.dirname(__FILE__), "../fixtures/dino_jpg_no_file_ext" ))
|
272
273
|
@test_object3.add_file_datastream(f,{:mime_type=>"image/jpeg"})
|
273
274
|
@test_object3.save
|
274
|
-
test_obj = ActiveFedora::Base.
|
275
|
+
test_obj = ActiveFedora::Base.find(@test_object3.pid)
|
275
276
|
test_obj.datastreams["DS1"].mimeType.should == "image/jpeg"
|
276
277
|
@test_object4 = ActiveFedora::Base.new
|
277
278
|
f = File.new(File.join( File.dirname(__FILE__), "../fixtures/dino_jpg_no_file_ext" ))
|
278
279
|
@test_object4.add_file_datastream(f,{:content_type=>"image/jpeg"})
|
279
280
|
@test_object4.save
|
280
|
-
test_obj = ActiveFedora::Base.
|
281
|
+
test_obj = ActiveFedora::Base.find(@test_object4.pid)
|
281
282
|
test_obj.datastreams["DS1"].mimeType.should == "image/jpeg"
|
282
283
|
end
|
283
284
|
end
|
@@ -328,10 +329,10 @@ describe ActiveFedora::Base do
|
|
328
329
|
|
329
330
|
it "should delete the object from Fedora and Solr" do
|
330
331
|
@test_object.save
|
331
|
-
ActiveFedora::Base.find_by_solr(@test_object.pid).
|
332
|
+
ActiveFedora::Base.find_by_solr(@test_object.pid).first["id"].should == @test_object.pid
|
332
333
|
pid = @test_object.pid # store so we can access it after deletion
|
333
334
|
@test_object.delete
|
334
|
-
ActiveFedora::Base.find_by_solr(pid).
|
335
|
+
ActiveFedora::Base.find_by_solr(pid).should be_empty
|
335
336
|
end
|
336
337
|
|
337
338
|
describe '#delete' do
|
@@ -364,7 +365,7 @@ describe ActiveFedora::Base do
|
|
364
365
|
|
365
366
|
@test_object2.delete
|
366
367
|
#need to reload since removed from rels_ext in memory
|
367
|
-
@test_object5 = MockAFBaseRelationship.
|
368
|
+
@test_object5 = MockAFBaseRelationship.find(@test_object5.pid)
|
368
369
|
|
369
370
|
#check any test_object2 inbound rels gone from source
|
370
371
|
@test_object3.relationships_by_name(false)[:inbound]["testing_inbound"].should == []
|
@@ -384,7 +385,7 @@ describe ActiveFedora::Base do
|
|
384
385
|
@test_object.save
|
385
386
|
@pid = @test_object.pid
|
386
387
|
begin
|
387
|
-
@test_object = ActiveFedora::Base.
|
388
|
+
@test_object = ActiveFedora::Base.find(@pid)
|
388
389
|
rescue => e
|
389
390
|
puts "#{e.message}\n#{e.backtrace}"
|
390
391
|
raise e
|
@@ -392,7 +393,7 @@ describe ActiveFedora::Base do
|
|
392
393
|
@test_object.object_relations[:has_part].should include @test_object2.internal_uri
|
393
394
|
@test_object.remove_relationship(:has_part,@test_object2)
|
394
395
|
@test_object.save
|
395
|
-
@test_object = ActiveFedora::Base.
|
396
|
+
@test_object = ActiveFedora::Base.find(@pid)
|
396
397
|
@test_object.object_relations[:has_part].should be_empty
|
397
398
|
end
|
398
399
|
end
|
@@ -24,7 +24,7 @@ describe ActiveFedora::DatastreamCollections do
|
|
24
24
|
ds = @test_object2.thumbnail.first
|
25
25
|
ds2 = @test_object2.high.first
|
26
26
|
@test_object2.save
|
27
|
-
@test_object2 = MockAFBaseDatastream.
|
27
|
+
@test_object2 = MockAFBaseDatastream.find(@test_object2.pid)
|
28
28
|
@test_object2.named_datastreams.keys.size.should == 2
|
29
29
|
@test_object2.named_datastreams.keys.include?("thumbnail").should == true
|
30
30
|
@test_object2.named_datastreams.keys.include?("high").should == true
|
@@ -54,7 +54,7 @@ describe ActiveFedora::DatastreamCollections do
|
|
54
54
|
@test_object2.add_named_file_datastream("thumbnail",f)
|
55
55
|
ds = @test_object2.thumbnail.first
|
56
56
|
@test_object2.save
|
57
|
-
@test_object2 = MockAFBaseDatastream.
|
57
|
+
@test_object2 = MockAFBaseDatastream.find(@test_object2.pid)
|
58
58
|
@test_object2.named_datastreams["thumbnail"].size.should == 1
|
59
59
|
t2_thumb1 = @test_object2.named_datastreams["thumbnail"].first
|
60
60
|
t2_thumb1.dsid.should == "THUMB1"
|
@@ -86,7 +86,7 @@ describe ActiveFedora::DatastreamCollections do
|
|
86
86
|
#check raise exception if dsid not supplied
|
87
87
|
@test_object2.add_named_datastream("thumbnail",{:file=>f})
|
88
88
|
@test_object2.save
|
89
|
-
@test_object2 = MockAFBaseDatastream.
|
89
|
+
@test_object2 = MockAFBaseDatastream.find(@test_object2.pid)
|
90
90
|
|
91
91
|
@test_object2.thumbnail.size.should == 1
|
92
92
|
@test_object2.thumbnail_ids == ["THUMB1"]
|
@@ -100,7 +100,7 @@ describe ActiveFedora::DatastreamCollections do
|
|
100
100
|
ds.content.should == minivan
|
101
101
|
@test_object2.update_named_datastream("thumbnail",{:file=>f2,:dsid=>"THUMB1"})
|
102
102
|
@test_object2.save
|
103
|
-
@test_object2 = MockAFBaseDatastream.
|
103
|
+
@test_object2 = MockAFBaseDatastream.find(@test_object2.pid)
|
104
104
|
@test_object2.thumbnail.size.should == 1
|
105
105
|
@test_object2.thumbnail_ids == ["THUMB1"]
|
106
106
|
ds2 = @test_object2.thumbnail.first
|
@@ -124,7 +124,7 @@ describe ActiveFedora::DatastreamCollections do
|
|
124
124
|
@test_object2.add_named_datastream("thumbnail",{:content_type=>"image/jpeg",:blob=>f, :label=>"testDS"})
|
125
125
|
@test_object2.add_named_datastream("thumbnail",{:content_type=>"image/jpeg",:blob=>f2})
|
126
126
|
@test_object2.save
|
127
|
-
@test_object2 = MockAFBaseDatastream.
|
127
|
+
@test_object2 = MockAFBaseDatastream.find(@test_object2.pid)
|
128
128
|
@test_object2.named_datastreams_ids.should == {"high"=>[], "thumbnail"=>["THUMB1", "THUMB2"]}
|
129
129
|
end
|
130
130
|
end
|
@@ -48,7 +48,7 @@ describe ActiveFedora::Datastream do
|
|
48
48
|
ds.content = fixture('dino.jpg')
|
49
49
|
@test_object.add_datastream(ds).should be_true
|
50
50
|
@test_object.save
|
51
|
-
to = ActiveFedora::Base.
|
51
|
+
to = ActiveFedora::Base.find(@test_object.pid)
|
52
52
|
to.should_not be_nil
|
53
53
|
to.datastreams[dsid].should_not be_nil
|
54
54
|
to.datastreams[dsid].content.should == fixture('dino.jpg').read
|
@@ -139,7 +139,7 @@ describe ActiveFedora::Base do
|
|
139
139
|
|
140
140
|
@test_history.save
|
141
141
|
|
142
|
-
@solr_result = OralHistory.find_by_solr(@test_history.pid)
|
142
|
+
@solr_result = OralHistory.find_by_solr(@test_history.pid)[0]
|
143
143
|
@properties_sample_values.each_pair do |field, value|
|
144
144
|
(@solr_result["#{field.to_s}_t"] || @solr_result["#{field.to_s}_dt"]).should == [::Solrizer::Extractor.format_node_value(value)]
|
145
145
|
end
|