active-fedora 4.0.0.rc16 → 4.0.0.rc17

Sign up to get free protection for your applications and to get access to all the features.
@@ -46,7 +46,7 @@ module ActiveFedora
46
46
  end
47
47
 
48
48
  def register_vocabularies(*vocabs)
49
- @vocabularies = {}
49
+ @vocabularies ||= {}
50
50
  vocabs.each do |v|
51
51
  if v.is_a?(RDF::Vocabulary) or (v.respond_to? :property and v.respond_to? :to_uri)
52
52
  @vocabularies[v.to_uri] = v
@@ -57,6 +57,7 @@ module ActiveFedora
57
57
  ActiveFedora::Predicates.vocabularies(@vocabularies)
58
58
  @vocabularies
59
59
  end
60
+
60
61
  def map_predicates(&block)
61
62
  yield self
62
63
  end
@@ -144,26 +145,20 @@ module ActiveFedora
144
145
  end
145
146
 
146
147
  include ModelMethods
147
- attr_accessor :loaded
148
-
149
- def ensure_loaded
150
- return if loaded
151
- self.loaded = true
152
- unless new?
153
- deserialize content
154
- end
155
- end
156
-
148
+
157
149
  def serialize! # :nodoc:
158
150
  if graph.dirty
159
- return unless loaded
160
151
  self.content = serialize
161
152
  end
162
153
  end
163
154
 
155
+ def content= *args
156
+ @graph = nil
157
+ super
158
+ end
159
+
164
160
  # returns a Hash, e.g.: {field => {:values => [], :type => :something, :behaviors => []}, ...}
165
161
  def fields
166
- ensure_loaded
167
162
  field_map = {}
168
163
  graph.relationships.each do |predicate, values|
169
164
  vocab_sym, name = predicate.qname
@@ -182,7 +177,6 @@ module ActiveFedora
182
177
  end
183
178
 
184
179
  def to_solr(solr_doc = Hash.new) # :nodoc:
185
- ensure_loaded
186
180
  fields.each do |field_key, field_info|
187
181
  values = field_info.fetch(:values, false)
188
182
  if values
@@ -206,12 +200,24 @@ module ActiveFedora
206
200
  end
207
201
 
208
202
  def graph
209
- @graph ||= RelationshipGraph.new
203
+ @graph ||= begin
204
+ graph = RelationshipGraph.new
205
+ unless new?
206
+ RDF::Reader.for(serialization_format).new(content) do |reader|
207
+ reader.each_statement do |statement|
208
+ next unless statement.subject == rdf_subject
209
+ literal = statement.object.kind_of?(RDF::Literal)
210
+ object = literal ? statement.object.value : statement.object.to_s
211
+ graph.add(statement.predicate, object, literal)
212
+ end
213
+ end
214
+ end
215
+ graph
216
+ end
210
217
  end
211
218
 
212
219
  # @param [Symbol, RDF::URI] predicate the predicate to insert into the graph
213
220
  def get_values(predicate)
214
- ensure_loaded
215
221
  predicate = find_predicate(predicate) unless predicate.kind_of? RDF::URI
216
222
  results = graph[predicate]
217
223
  return if results.nil?
@@ -225,7 +231,6 @@ module ActiveFedora
225
231
  # if there are any existing statements with this predicate, replace them
226
232
  # @param [Symbol, RDF::URI] predicate the predicate to insert into the graph
227
233
  def set_value(predicate, args)
228
- ensure_loaded
229
234
  predicate = find_predicate(predicate) unless predicate.kind_of? RDF::URI
230
235
  graph.delete(predicate)
231
236
  args = [args] unless args.respond_to? :each
@@ -239,7 +244,6 @@ module ActiveFedora
239
244
  # append a value
240
245
  # @param [Symbol, RDF::URI] predicate the predicate to insert into the graph
241
246
  def append(predicate, args)
242
- ensure_loaded
243
247
  predicate = find_predicate(predicate) unless predicate.kind_of? RDF::URI
244
248
  graph.add(predicate, args, true)
245
249
  graph.dirty = true
@@ -266,22 +270,7 @@ module ActiveFedora
266
270
  @subject ||= self.class.rdf_subject.call(self)
267
271
  end
268
272
 
269
- # Populate a RDFDatastream object based on the "datastream" content
270
- # Assumes that the datastream contains RDF XML from a Fedora RELS-EXT datastream
271
- # @param [String] data the "rdf" node
272
- def deserialize(data)
273
- unless data.nil?
274
- RDF::Reader.for(serialization_format).new(data) do |reader|
275
- reader.each_statement do |statement|
276
- next unless statement.subject == rdf_subject
277
- literal = statement.object.kind_of?(RDF::Literal)
278
- object = literal ? statement.object.value : statement.object.to_s
279
- graph.add(statement.predicate, object, literal)
280
- end
281
- end
282
- end
283
- graph
284
- end
273
+
285
274
 
286
275
  # Creates a RDF datastream for insertion into a Fedora Object
287
276
  # Note: This method is implemented on SemanticNode instead of RelsExtDatastream because SemanticNode contains the relationships array
@@ -80,7 +80,6 @@ module ActiveFedora
80
80
  # ====Warning
81
81
  # Solr must be synchronized with RELS-EXT data in Fedora.
82
82
  def from_solr(solr_doc)
83
- profile_from_solr(solr_doc)
84
83
  #cycle through all possible predicates
85
84
  model.relationships_loaded = true
86
85
  Predicates.predicate_mappings.each_pair do |namespace,predicates|
@@ -2,26 +2,21 @@ module ActiveFedora
2
2
  class SolrDigitalObject
3
3
  attr_reader :pid, :label, :state, :ownerId, :profile, :datastreams, :solr_doc
4
4
 
5
- def initialize(solr_doc, klass=ActiveFedora::Base)
5
+ def initialize(solr_doc, profile_hash, klass=ActiveFedora::Base)
6
6
  @solr_doc = solr_doc
7
7
  @pid = solr_doc[SOLR_DOCUMENT_ID]
8
- profile_attrs = solr_doc.keys.select { |k| k =~ /^objProfile_/ }
9
8
  @profile = {}
10
- profile_attrs.each do |key|
11
- attr_name = key.split(/_/)[1..-2].join('_')
12
- @profile[attr_name] = Array(solr_doc[key]).first.to_s
13
- end
9
+ profile_hash.each_pair { |key,value| @profile[key] = value.to_s if key =~ /^obj/ }
14
10
  @profile['objCreateDate'] ||= Time.now.xmlschema
15
11
  @profile['objLastModDate'] ||= @profile['objCreateDate']
16
12
 
17
13
  @datastreams = {}
18
14
 
19
- dsids = @solr_doc.keys.collect { |k| k.scan(/^(.+)_dsProfile_/).flatten.first }.compact.uniq
15
+ dsids = profile_hash['datastreams'].keys
20
16
  missing = dsids - klass.ds_specs.keys
21
17
  missing.each do |dsid|
22
18
  #Initialize the datastreams that are in the solr document, but not found in the classes spec.
23
- mime_key = ActiveFedora::SolrService.solr_name("#{dsid}_dsProfile_dsMIME",:symbol)
24
- mime_type = Array(@solr_doc[mime_key]).first
19
+ mime_type = profile_hash['datastreams'][dsid]['dsMIME']
25
20
  ds_class = mime_type =~ /[\/\+]xml$/ ? NokogiriDatastream : Datastream
26
21
  @datastreams[dsid] = ds_class.new(self, dsid)
27
22
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "4.0.0.rc16"
2
+ VERSION = "4.0.0.rc17"
3
3
  end
@@ -47,7 +47,7 @@ namespace :repo do
47
47
  dir = File.join('spec', 'fixtures')
48
48
  end
49
49
  filename = ActiveFedora::FixtureExporter.export_to_path(pid, dir)
50
- puts "The object has been saved as #{filename}"
50
+ puts "The object has been saved as #{filename}" if filename
51
51
  end
52
52
  end
53
53
 
@@ -68,6 +68,7 @@ namespace :repo do
68
68
  else
69
69
  puts "You must specify the foxml path or provide its pid. Example: rake repo:load foxml=spec/fixtures/demo_12.foxml.xml"
70
70
  end
71
+ puts "Loaded '#{pid}' into #{ActiveFedora::Base.connection_for_pid(pid).client.url}" if pid
71
72
  end
72
73
 
73
74
 
@@ -30,6 +30,9 @@ 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
+ slr = @test_object2.to_solr
34
+ # puts "PID: #{@test_object2.pid}"
35
+ # puts "ID: #{slr[:id]} #{slr["active_fedora_model_s"]}"
33
36
  sleep(1)
34
37
 
35
38
  @test_object3 = MockAFBaseQuerySolr.new
@@ -45,16 +45,16 @@ describe ActiveFedora::Base do
45
45
  # my_oral_history.subjects OR my_oral_history.titles OR EVEN my_oral_history.title whenever possible
46
46
 
47
47
  # Setting new Types for dates and text content
48
- m.field "creation_date", :date, :xml_node => "date"
49
- m.field "abstract", :text, :xml_node => "abstract"
50
- m.field "rights", :text, :xml_node => "rights"
48
+ #m.field "creation_date", :date, :xml_node => "date"
49
+ #m.field "abstract", :text, :xml_node => "abstract"
50
+ #m.field "rights", :text, :xml_node => "rights"
51
51
 
52
52
  # Setting up special named fields
53
- m.field "subject_heading", :string, :xml_node => "subject", :encoding => "LCSH"
54
- m.field "spatial_coverage", :string, :xml_node => "spatial", :encoding => "TGN"
55
- m.field "temporal_coverage", :string, :xml_node => "temporal", :encoding => "Period"
56
- m.field "type", :string, :xml_node => "type", :encoding => "DCMITYPE"
57
- m.field "alt_title", :string, :xml_node => "alternative"
53
+ #m.field "subject_heading", :string, :xml_node => "subject", :encoding => "LCSH"
54
+ #m.field "spatial_coverage", :string, :xml_node => "spatial", :encoding => "TGN"
55
+ #m.field "temporal_coverage", :string, :xml_node => "temporal", :encoding => "Period"
56
+ #m.field "type", :string, :xml_node => "type", :encoding => "DCMITYPE"
57
+ #m.field "alt_title", :string, :xml_node => "alternative"
58
58
  end
59
59
 
60
60
  has_metadata :name => "significant_passages", :type => ActiveFedora::MetadataDatastream do |m|
@@ -87,10 +87,17 @@ describe ActiveFedora::Base do
87
87
  :notes => sample_notes, :hard_copy_availability => sample_hard_copy_availability, :hard_copy_location => "Archives", :other_contributor => sample_other_contributor,
88
88
  :restrictions => "None", :series => "My Series", :location => sample_location]
89
89
 
90
- @dublin_core_sample_values = Hash[:creator => 'Matt && McClain', :publisher => 'Jewish Women\\\'s Archive', :description => "description", :identifier => "jwa:sample_pid",
91
- :title => "title", :alt_title => "alt_title", :subject => "subject", :subject_heading => "subject heading",
92
- :creation_date => "2008-07-02T05:09:42.015Z", :language => "language", :spatial_coverage => "spatial coverage",
93
- :temporal_coverage => "temporal coverage", :abstract => "abstract", :rights => "rights", :type => "type", :extent => "extent",
90
+ @dublin_core_sample_values = Hash[:creator => 'Matt && McClain', :publisher => "Jewish Womens's Archive", :description => "description", :identifier => "jwa:sample_pid",
91
+ :title => "title",
92
+ #:alt_title => "alt_title", :subject => "subject",
93
+ #:subject_heading => "subject heading",
94
+ #:creation_date => "2008-07-02T05:09:42.015Z",
95
+ :language => "language",
96
+ #:spatial_coverage => "spatial coverage",
97
+ #:temporal_coverage => "temporal coverage",
98
+ #:abstract => "abstract",
99
+ :rights => "rights", :type => "type",
100
+ #:extent => "extent",
94
101
  :format => "format", :medium => "medium"]
95
102
  @signigicant_passages_sample_values = {}
96
103
  @sensitive_passages_sample_values = {}
@@ -134,7 +141,7 @@ describe ActiveFedora::Base do
134
141
  end
135
142
 
136
143
  @dublin_core_sample_values.each_pair do |field, value|
137
- dublin_core_ds.send("#{field.to_s}_values=", [value])
144
+ dublin_core_ds.send("#{field.to_s}=", [value])
138
145
  end
139
146
 
140
147
  @test_history.save
@@ -145,20 +152,19 @@ describe ActiveFedora::Base do
145
152
  end
146
153
 
147
154
  @dublin_core_sample_values.each_pair do |field, value|
148
- dublin_core_ds.send("#{field.to_s}_values").should == [value]
155
+ next if [:format, :type].include?(field) #format and type are methods declared on Object
156
+ dublin_core_ds.send("#{field.to_s}").should == [value]
149
157
  end
150
158
  end
151
159
 
152
160
  it "should have Qualified Dublin core, with custom accessors" do
153
161
 
154
- #xml = REXML::Document.new(@test_history.to_xml.to_s)
155
162
  dublin_core_ds = @test_history.datastreams["dublin_core"]
156
163
 
157
- dublin_core_ds.subject_heading_values = "My Subject Heading"
158
- dc_xml = REXML::Document.new(dublin_core_ds.to_dc_xml)
164
+ dublin_core_ds.subject = "My Subject Heading"
165
+ dc_xml = REXML::Document.new(dublin_core_ds.to_xml)
159
166
 
160
167
  dc_xml.root.elements["dcterms:subject"].text.should == "My Subject Heading"
161
- dc_xml.root.elements["dcterms:subject"].attributes["xsi:type"].should == "LCSH"
162
168
 
163
169
  end
164
170
 
@@ -16,6 +16,7 @@ class MockMetaHelperSolr < ActiveFedora::Base
16
16
  m.field "geography", :string, :xml_node => "geography"
17
17
  m.field "title", :string, :xml_node => "title"
18
18
  end
19
+
19
20
  end
20
21
 
21
22
  describe ActiveFedora::MetadataDatastreamHelper do
@@ -44,7 +45,7 @@ describe ActiveFedora::MetadataDatastreamHelper do
44
45
  it 'should return an object with the appropriate metadata fields filled in' do
45
46
  @test_object = MockMetaHelperSolr.new
46
47
  attributes = {"holding_id"=>{0=>"Holding 1"},
47
- "language"=>{0=>"Italian"},
48
+ "language" =>{0=>"Italian"},
48
49
  "creator"=>{0=>"Linguist, A."},
49
50
  "geography"=>{0=>"Italy"},
50
51
  "title"=>{0=>"Italian and Spanish: A Comparison of Common Phrases"}}
@@ -74,23 +75,23 @@ describe ActiveFedora::MetadataDatastreamHelper do
74
75
  test_from_solr_object2 = MockMetaHelperSolr.load_instance_from_solr(@test_object2.pid)
75
76
  test_from_solr_object3 = MockMetaHelperSolr.load_instance_from_solr(@test_object3.pid)
76
77
 
77
- test_from_solr_object.fields[:language][:values].should == ["Italian"]
78
- test_from_solr_object.fields[:creator][:values].should == ["Linguist, A."]
79
- #test_from_solr_object.fields[:geography][:values].should == ["Italy"]
80
- test_from_solr_object.fields[:title][:values].should == ["Italian and Spanish: A Comparison of Common Phrases"]
78
+ test_from_solr_object.descMetadata.language.should == ["Italian"]
79
+ test_from_solr_object.descMetadata.creator.should == ["Linguist, A."]
80
+ test_from_solr_object.descMetadata.geography.should == ["Italy"]
81
+ test_from_solr_object.descMetadata.title.should == ["Italian and Spanish: A Comparison of Common Phrases"]
81
82
  #test_from_solr_object.fields[:holding_id][:values].should == ["Holding 1"]
82
83
 
83
- test_from_solr_object2.fields[:language][:values].should == ["Spanish;Latin"]
84
- test_from_solr_object2.fields[:creator][:values].should == ["Linguist, A."]
85
- #test_from_solr_object2.fields[:geography][:values].should == ["Spain"]
86
- test_from_solr_object2.fields[:title][:values].should == ["A study of the evolution of Spanish from Latin"]
84
+ test_from_solr_object2.descMetadata.language.should == ["Spanish;Latin"]
85
+ test_from_solr_object2.descMetadata.creator.should == ["Linguist, A."]
86
+ test_from_solr_object2.descMetadata.geography.should == ["Spain"]
87
+ test_from_solr_object2.descMetadata.title.should == ["A study of the evolution of Spanish from Latin"]
87
88
  #test_from_solr_object2.fields[:holding_id][:values].should == ["Holding 2"]
88
89
 
89
- test_from_solr_object3.fields[:language][:values].should == ["Spanish;Latin"]
90
- test_from_solr_object3.fields[:creator][:values].should == ["Linguist, A."]
91
- #test_from_solr_object3.fields[:geography][:values].should == ["Spain"]
92
- test_from_solr_object3.fields[:title][:values].should == ["An obscure look into early nomadic tribes of Spain"]
93
- #test_from_solr_object3.fields[:holding_id][:values].should == ["Holding 3"]
90
+ test_from_solr_object3.descMetadata.language.should == ["Spanish;Latin"]
91
+ test_from_solr_object3.descMetadata.creator.should == ["Linguist, A."]
92
+ test_from_solr_object3.descMetadata.geography.should == ["Spain"]
93
+ test_from_solr_object3.descMetadata.title.should == ["An obscure look into early nomadic tribes of Spain"]
94
+ #test_from_solr_object3.properties.holding_id.should == ["Holding 3"]
94
95
 
95
96
 
96
97
  end
@@ -1,12 +1,7 @@
1
1
  require 'spec_helper'
2
- #require 'spec/samples/models/hydrangea_article'
3
-
4
- include ActiveFedora::Model
5
- include Mocha::API
6
2
 
7
3
  describe ActiveFedora::Model do
8
4
 
9
-
10
5
  before(:each) do
11
6
  module ModelIntegrationSpec
12
7
 
@@ -13,14 +13,7 @@ describe ActiveFedora::SolrService do
13
13
  m.field "holding_id", :string
14
14
  end
15
15
 
16
- has_metadata :name => "descMetadata", :type => ActiveFedora::QualifiedDublinCoreDatastream do |m|
17
- m.field "created", :date, :xml_node => "created"
18
- m.field "language", :string, :xml_node => "language"
19
- m.field "creator", :string, :xml_node => "creator"
20
- # Created remaining fields
21
- m.field "geography", :string, :xml_node => "geography"
22
- m.field "title", :string, :xml_node => "title"
23
- end
16
+ has_metadata :name => "descMetadata", :type => ActiveFedora::QualifiedDublinCoreDatastream
24
17
  end
25
18
  @test_object = ActiveFedora::Base.new
26
19
  @test_object.label = 'test_object'
@@ -17,17 +17,8 @@ class OralHistorySampleModel < ActiveFedora::Base
17
17
  m.field "location", :string
18
18
  end
19
19
 
20
- has_metadata :name => "dublin_core", :type => ActiveFedora::QualifiedDublinCoreDatastream do |m|
21
- m.field "creation_date", :date, :xml_node => "date"
22
- m.field "abstract", :text, :xml_node => "abstract"
23
- m.field "rights", :text, :xml_node => "rights"
24
- m.field "subject_heading", :string, :xml_node => "subject", :encoding => "LCSH"
25
- m.field "spatial_coverage", :string, :xml_node => "spatial", :encoding => "TGN"
26
- m.field "temporal_coverage", :string, :xml_node => "temporal", :encoding => "Period"
27
- m.field "type", :string, :xml_node => "type", :encoding => "DCMITYPE"
28
- m.field "alt_title", :string, :xml_node => "alternative"
29
- end
30
-
20
+ has_metadata :name => "dublin_core", :type => ActiveFedora::QualifiedDublinCoreDatastream
21
+
31
22
  has_metadata :name => "significant_passages", :type => ActiveFedora::MetadataDatastream do |m|
32
23
  m.field "significant_passage", :text
33
24
  end
@@ -1,4 +1,4 @@
1
- require "spec/samples/marpa-dc_datastream.rb"
1
+ require "samples/marpa-dc_datastream.rb"
2
2
 
3
3
  # This is an example of an ActiveFedora Model
4
4
  #
@@ -88,16 +88,13 @@ describe ActiveFedora::Base do
88
88
  ds.stubs(:kind_of?).with(ActiveFedora::RDFDatastream).returns(false)
89
89
  ds.stubs(:kind_of?).with(ActiveFedora::NokogiriDatastream).returns(false)
90
90
  end
91
- mock1.expects(:solrize_profile)
92
- mock2.expects(:solrize_profile)
93
- mock3.expects(:solrize_profile)
91
+ mock1.expects(:solrize_profile).returns({})
92
+ mock2.expects(:solrize_profile).returns({})
93
+ mock3.expects(:solrize_profile).returns({})
94
94
  mock1.expects(:kind_of?).with(ActiveFedora::MetadataDatastream).returns(true)
95
95
  mock2.expects(:kind_of?).with(ActiveFedora::MetadataDatastream).returns(true)
96
96
  mock3.expects(:kind_of?).with(ActiveFedora::MetadataDatastream).returns(false)
97
- #mock3.expects(:kind_of?).with(ActiveFedora::RelsExtDatastream).returns(true)
98
-
99
- @test_object.expects(:datastreams).returns(mock_datastreams)
100
- @test_object.expects(:solrize_profile)
97
+ @test_object.expects(:datastreams).twice.returns(mock_datastreams)
101
98
  @test_object.expects(:solrize_relationships)
102
99
  @test_object.update_index
103
100
  end
@@ -113,16 +110,13 @@ describe ActiveFedora::Base do
113
110
  ds.stubs(:kind_of?).with(ActiveFedora::MetadataDatastream).returns(false)
114
111
  ds.stubs(:kind_of?).with(ActiveFedora::NokogiriDatastream).returns(false)
115
112
  end
116
- mock1.expects(:solrize_profile)
117
- mock2.expects(:solrize_profile)
118
- mock3.expects(:solrize_profile)
113
+ mock1.expects(:solrize_profile).returns({})
114
+ mock2.expects(:solrize_profile).returns({})
115
+ mock3.expects(:solrize_profile).returns({})
119
116
  mock1.expects(:kind_of?).with(ActiveFedora::RDFDatastream).returns(true)
120
117
  mock2.expects(:kind_of?).with(ActiveFedora::RDFDatastream).returns(true)
121
118
  mock3.expects(:kind_of?).with(ActiveFedora::RDFDatastream).returns(false)
122
- #mock3.expects(:kind_of?).with(ActiveFedora::RelsExtDatastream).returns(true)
123
-
124
- @test_object.expects(:datastreams).returns(mock_datastreams)
125
- @test_object.expects(:solrize_profile)
119
+ @test_object.expects(:datastreams).twice.returns(mock_datastreams)
126
120
  @test_object.expects(:solrize_relationships)
127
121
  @test_object.update_index
128
122
  end
@@ -211,10 +211,8 @@ describe ActiveFedora::Base do
211
211
  end
212
212
 
213
213
  it "should call .fields on all MetadataDatastreams and return the resulting document" do
214
- mock1 = mock("ds1", :fields => {})
215
- mock2 = mock("ds2", :fields => {})
216
- mock1.expects(:kind_of?).with(ActiveFedora::MetadataDatastream).returns(true)
217
- mock2.expects(:kind_of?).with(ActiveFedora::MetadataDatastream).returns(true)
214
+ mock1 = mock("ds1", :fields => {}, :class=>ActiveFedora::MetadataDatastream)
215
+ mock2 = mock("ds2", :fields => {}, :class=>ActiveFedora::MetadataDatastream)
218
216
 
219
217
  @test_object.expects(:datastreams).returns({:ds1 => mock1, :ds2 => mock2})
220
218
  @test_object.fields
@@ -615,8 +613,7 @@ describe ActiveFedora::Base do
615
613
  ngds.expects(:kind_of?).with(ActiveFedora::RDFDatastream).returns(false)
616
614
  ngds.expects(:kind_of?).with(ActiveFedora::NokogiriDatastream).returns(true)
617
615
 
618
- @test_object.expects(:datastreams).returns({:ds1 => mock1, :ds2 => mock2, :ngds => ngds})
619
- @test_object.expects(:solrize_profile)
616
+ @test_object.expects(:datastreams).twice.returns({:ds1 => mock1, :ds2 => mock2, :ngds => ngds})
620
617
  @test_object.expects(:solrize_relationships)
621
618
  @test_object.to_solr
622
619
  end
@@ -625,8 +622,7 @@ describe ActiveFedora::Base do
625
622
  mock.expects(:solrize_profile)
626
623
  mock.expects(:kind_of?).with(ActiveFedora::RDFDatastream).returns(true)
627
624
 
628
- @test_object.expects(:datastreams).returns({:ds1 => mock})
629
- @test_object.expects(:solrize_profile)
625
+ @test_object.expects(:datastreams).twice.returns({:ds1 => mock})
630
626
  @test_object.expects(:solrize_relationships)
631
627
  @test_object.to_solr
632
628
  end