active-fedora 3.0.7 → 3.1.0.pre1
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/.rvmrc +1 -1
- data/Gemfile.lock +39 -10
- data/History.txt +0 -4
- data/active-fedora.gemspec +4 -3
- data/lib/active_fedora.rb +9 -9
- data/lib/active_fedora/base.rb +92 -163
- data/lib/active_fedora/datastream.rb +59 -60
- data/lib/active_fedora/datastream_hash.rb +18 -0
- data/lib/active_fedora/metadata_datastream.rb +3 -2
- data/lib/active_fedora/metadata_datastream_helper.rb +3 -15
- data/lib/active_fedora/model.rb +3 -3
- data/lib/active_fedora/nokogiri_datastream.rb +305 -302
- data/lib/active_fedora/qualified_dublin_core_datastream.rb +24 -19
- data/lib/active_fedora/rels_ext_datastream.rb +39 -37
- data/lib/active_fedora/rubydora_connection.rb +40 -0
- data/lib/active_fedora/semantic_node.rb +1 -1
- data/lib/active_fedora/solr_service.rb +1 -1
- data/lib/active_fedora/version.rb +1 -1
- data/lib/ruby-fedora.rb +0 -8
- data/lib/tasks/active_fedora.rake +14 -9
- data/lib/tasks/active_fedora_dev.rake +23 -40
- data/spec/integration/base_loader_spec.rb +4 -21
- data/spec/integration/base_spec.rb +300 -310
- data/spec/integration/bug_spec.rb +9 -10
- data/spec/integration/datastream_spec.rb +12 -12
- data/spec/integration/metadata_datastream_helper_spec.rb +7 -10
- data/spec/integration/model_spec.rb +3 -2
- data/spec/integration/rels_ext_datastream_spec.rb +9 -15
- data/spec/spec_helper.rb +2 -29
- data/spec/unit/active_fedora_spec.rb +5 -5
- data/spec/unit/base_cma_spec.rb +0 -7
- data/spec/unit/base_datastream_management_spec.rb +8 -67
- data/spec/unit/base_delegate_spec.rb +26 -9
- data/spec/unit/base_extra_spec.rb +5 -3
- data/spec/unit/base_file_management_spec.rb +10 -17
- data/spec/unit/base_named_datastream_spec.rb +76 -199
- data/spec/unit/base_spec.rb +152 -69
- data/spec/unit/content_model_spec.rb +1 -1
- data/spec/unit/datastream_concurrency_spec.rb +5 -4
- data/spec/unit/datastream_spec.rb +28 -48
- data/spec/unit/has_many_collection_spec.rb +2 -0
- data/spec/unit/inheritance_spec.rb +6 -6
- data/spec/unit/metadata_datastream_spec.rb +12 -28
- data/spec/unit/model_spec.rb +10 -10
- data/spec/unit/nokogiri_datastream_spec.rb +31 -33
- data/spec/unit/qualified_dublin_core_datastream_spec.rb +15 -15
- data/spec/unit/rels_ext_datastream_spec.rb +35 -29
- data/spec/unit/rubydora_connection_spec.rb +26 -0
- data/spec/unit/semantic_node_spec.rb +12 -17
- data/spec/unit/solr_config_options_spec.rb +13 -14
- data/spec/unit/solr_service_spec.rb +14 -17
- metadata +59 -55
- data/lib/fedora/base.rb +0 -38
- data/lib/fedora/connection.rb +0 -218
- data/lib/fedora/datastream.rb +0 -67
- data/lib/fedora/fedora_object.rb +0 -161
- data/lib/fedora/formats.rb +0 -30
- data/lib/fedora/generic_search.rb +0 -71
- data/lib/fedora/repository.rb +0 -298
- data/spec/integration/datastreams_crud_spec.rb +0 -208
- data/spec/integration/fedora_object_spec.rb +0 -77
- data/spec/integration/repository_spec.rb +0 -301
- data/spec/integration/rf_fedora_object_spec.rb +0 -95
- data/spec/unit/connection_spec.rb +0 -25
- data/spec/unit/fedora_object_spec.rb +0 -74
- data/spec/unit/repository_spec.rb +0 -143
- data/spec/unit/rf_datastream_spec.rb +0 -63
@@ -15,37 +15,42 @@ module ActiveFedora
|
|
15
15
|
|
16
16
|
#Constructor. this class will call self.field for each DCTERM. In short, all DCTERMS fields will already exist
|
17
17
|
#when this method returns. Each term is marked as a multivalue string.
|
18
|
-
def initialize(
|
19
|
-
super
|
18
|
+
def initialize(digital_object, dsid, exists_in_fedora=false )
|
19
|
+
super(digital_object, dsid)
|
20
20
|
DCTERMS.each do |el|
|
21
21
|
field el, :string, :multiple=>true
|
22
22
|
end
|
23
|
+
###TODO this is loading eagerly, but we could make it lazy
|
24
|
+
self.class.from_xml(exists_in_fedora ? content : nil, self)
|
23
25
|
self
|
24
26
|
end
|
25
27
|
|
26
|
-
def set_blob_for_save # :nodoc:
|
27
|
-
self.blob = self.to_dc_xml
|
28
|
-
end
|
29
|
-
|
30
28
|
# Populate a QualifiedDublinCoreDatastream object based on the "datastream" node from a FOXML file
|
29
|
+
# @param [String] node the xml from the content. Assumes that the content of this datastream is that of an ActiveFedora QualifiedDublinCoreDatastream
|
31
30
|
# @param [ActiveFedora::Datastream] tmpl the Datastream object that you are building
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
31
|
+
def self.from_xml(xml, tmpl) # :nodoc:
|
32
|
+
return if xml.nil?
|
33
|
+
node = Nokogiri::XML::Document.parse(xml)
|
34
|
+
tmpl.fields.each do |z|
|
35
|
+
fname = z.first
|
36
|
+
fspec = z.last
|
37
|
+
node_name = "dcterms:#{fspec[:xml_node] ? fspec[:xml_node] : fname}"
|
38
|
+
attr_modifier= "[@xsi:type='#{fspec[:encoding]}']" if fspec[:encoding]
|
39
|
+
query = "/dc/#{node_name}#{attr_modifier}"
|
40
|
+
|
41
|
+
node.xpath(query).each do |f|
|
42
|
+
tmpl.send("#{fname}_append", f.text)
|
42
43
|
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
end
|
46
|
+
tmpl.instance_variable_set(:@dirty, false)
|
47
|
+
tmpl
|
47
48
|
end
|
48
49
|
|
50
|
+
def to_xml()
|
51
|
+
to_dc_xml()
|
52
|
+
end
|
53
|
+
|
49
54
|
#Render self as a Fedora DC xml document.
|
50
55
|
def to_dc_xml
|
51
56
|
#TODO: pull the modifiers up into MDDS
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'active_support/core_ext/class/inheritable_attributes'
|
1
2
|
require 'solrizer/field_name_mapper'
|
2
3
|
require 'uri'
|
3
4
|
|
@@ -8,50 +9,51 @@ module ActiveFedora
|
|
8
9
|
include Solrizer::FieldNameMapper
|
9
10
|
|
10
11
|
|
11
|
-
def initialize(
|
12
|
-
|
13
|
-
|
12
|
+
# def initialize(digital_object, dsid, exists_in_fedora=nil)
|
13
|
+
# super(digital_object, 'RELS-EXT')
|
14
|
+
# end
|
15
|
+
|
16
|
+
def changed?
|
17
|
+
relationships_are_dirty || super
|
18
|
+
end
|
19
|
+
|
20
|
+
def serialize!
|
21
|
+
self.content = to_rels_ext(self.pid) if relationships_are_dirty
|
22
|
+
relationships_are_dirty = false
|
14
23
|
end
|
15
24
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
super
|
25
|
+
|
26
|
+
def to_xml(fields_xml)
|
27
|
+
to_rels_ext(self.pid)
|
21
28
|
end
|
22
29
|
|
23
|
-
|
24
|
-
super
|
25
|
-
self.blob = <<-EOL
|
26
|
-
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
27
|
-
<rdf:Description rdf:about="info:fedora/#{pid}">
|
28
|
-
</rdf:Description>
|
29
|
-
</rdf:RDF>
|
30
|
-
EOL
|
31
|
-
end
|
32
|
-
|
33
|
-
# Populate a RelsExtDatastream object based on the "datastream" node from a FOXML file
|
30
|
+
# Populate a RelsExtDatastream object based on the "datastream" content
|
34
31
|
# Assumes that the datastream contains RDF XML from a Fedora RELS-EXT datastream
|
35
32
|
# @param [ActiveFedora::MetadataDatastream] tmpl the Datastream object that you are populating
|
36
|
-
# @param [
|
37
|
-
def self.from_xml(
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
33
|
+
# @param [String] the "rdf" node
|
34
|
+
def self.from_xml(xml, tmpl)
|
35
|
+
if (xml.nil?)
|
36
|
+
### maybe put the template here?
|
37
|
+
else
|
38
|
+
node = Nokogiri::XML::Document.parse(xml)
|
39
|
+
node.xpath("rdf:RDF/rdf:Description/*", {"rdf"=>"http://www.w3.org/1999/02/22-rdf-syntax-ns#"}).each do |f|
|
40
|
+
if f.namespace
|
41
|
+
ns_mapping = self.predicate_mappings[f.namespace.href]
|
42
|
+
predicate = ns_mapping ? ns_mapping.invert[f.name] : nil
|
43
|
+
predicate = "#{f.namespace.prefix}_#{f.name}" if predicate.nil?
|
44
|
+
else
|
45
|
+
logger.warn "You have a predicate without a namespace #{f.name}. Verify your rels-ext is correct."
|
46
|
+
predicate = "#{f.name}"
|
47
|
+
end
|
48
|
+
is_obj = f["resource"]
|
49
|
+
object = is_obj ? f["resource"] : f.inner_text
|
50
|
+
r = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>predicate, :object=>object, :is_literal=>!is_obj)
|
51
|
+
tmpl.add_relationship(r)
|
52
|
+
end
|
53
|
+
tmpl.relationships_are_dirty = false
|
54
|
+
#tmpl.send(:dirty=, false)
|
55
|
+
tmpl
|
52
56
|
end
|
53
|
-
tmpl.send(:dirty=, false)
|
54
|
-
tmpl
|
55
57
|
end
|
56
58
|
|
57
59
|
# Serialize the datastream's RDF relationships to solr
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
require 'rubydora'
|
3
|
+
|
4
|
+
module ActiveFedora
|
5
|
+
class RubydoraConnection
|
6
|
+
include Singleton
|
7
|
+
|
8
|
+
attr_reader :connection
|
9
|
+
attr_accessor :options
|
10
|
+
|
11
|
+
def self.connect(params={})
|
12
|
+
if params.kind_of? String
|
13
|
+
u = URI.parse params
|
14
|
+
params = {}
|
15
|
+
params[:user] = u.user
|
16
|
+
params[:password] = u.password
|
17
|
+
params[:url] = "#{u.scheme}://#{u.host}:#{u.port}#{u.path}"
|
18
|
+
end
|
19
|
+
instance = self.instance
|
20
|
+
instance.options = params
|
21
|
+
instance.connect
|
22
|
+
instance
|
23
|
+
end
|
24
|
+
|
25
|
+
def connect()
|
26
|
+
return unless @connection.nil?
|
27
|
+
@connection = Rubydora.connect :url => options[:url], :user => options[:user], :password => options[:password]
|
28
|
+
end
|
29
|
+
|
30
|
+
def nextid(attrs={})
|
31
|
+
d = REXML::Document.new(connection.next_pid(:namespace=>attrs[:namespace]))
|
32
|
+
d.elements['//pid'].text
|
33
|
+
end
|
34
|
+
|
35
|
+
def find_model(pid, klass)
|
36
|
+
klass.new(:pid=>pid)
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -16,11 +16,11 @@ module ActiveFedora
|
|
16
16
|
def add_relationship(relationship)
|
17
17
|
# Only accept ActiveFedora::Relationships as input arguments
|
18
18
|
assert_kind_of 'relationship', relationship, ActiveFedora::Relationship
|
19
|
-
self.relationships_are_dirty = true
|
20
19
|
register_triple(relationship.subject, relationship.predicate, relationship.object)
|
21
20
|
end
|
22
21
|
|
23
22
|
def register_triple(subject, predicate, object)
|
23
|
+
self.relationships_are_dirty = true
|
24
24
|
register_subject(subject)
|
25
25
|
register_predicate(subject, predicate)
|
26
26
|
relationships[subject][predicate] << object
|
@@ -36,7 +36,7 @@ module ActiveFedora
|
|
36
36
|
if opts[:load_from_solr]
|
37
37
|
results << classname.load_instance_from_solr(hit[SOLR_DOCUMENT_ID])
|
38
38
|
else
|
39
|
-
results <<
|
39
|
+
results << ActiveFedora::RubydoraConnection.instance.find_model(hit[SOLR_DOCUMENT_ID], classname)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
return results
|
data/lib/ruby-fedora.rb
CHANGED
@@ -10,11 +10,3 @@ class Hash
|
|
10
10
|
self.each {|k,v| self[k.to_sym]=v; self.delete(k) unless self[k.to_sym]}
|
11
11
|
end
|
12
12
|
end
|
13
|
-
require 'fedora/base'
|
14
|
-
require 'fedora/connection'
|
15
|
-
require 'fedora/datastream'
|
16
|
-
require 'fedora/fedora_object'
|
17
|
-
require 'fedora/formats'
|
18
|
-
require 'fedora/generic_search'
|
19
|
-
require 'fedora/repository'
|
20
|
-
#require 'util/class_level_inheritable_attributes'
|
@@ -19,17 +19,15 @@ namespace :af do
|
|
19
19
|
puts "You must specify a valid pid. Example: rake fedora:delete pid=demo:12"
|
20
20
|
else
|
21
21
|
pid = ENV["pid"]
|
22
|
-
puts "Deleting '#{pid}' from #{
|
22
|
+
puts "Deleting '#{pid}' from #{ActiveFedora::RubydoraConnection.instance.options[:url]}"
|
23
23
|
begin
|
24
24
|
ActiveFedora::Base.load_instance(pid).delete
|
25
25
|
rescue ActiveFedora::ObjectNotFoundError
|
26
26
|
puts "The object #{pid} has already been deleted (or was never created)."
|
27
27
|
rescue Errno::ECONNREFUSED => e
|
28
28
|
puts "Can't connect to Fedora! Are you sure jetty is running?"
|
29
|
-
rescue Fedora::ServerError => e
|
30
|
-
logger.error("Received a Fedora error while deleting #{pid}")
|
31
29
|
end
|
32
|
-
logger.info "Deleted '#{pid}' from #{
|
30
|
+
logger.info "Deleted '#{pid}' from #{ActiveFedora::RubydoraConnection.instance.options[:url]}"
|
33
31
|
end
|
34
32
|
end
|
35
33
|
|
@@ -53,7 +51,7 @@ namespace :af do
|
|
53
51
|
rescue ActiveFedora::ObjectNotFoundError
|
54
52
|
# The object has already been deleted (or was never created). Do nothing.
|
55
53
|
end
|
56
|
-
puts "Deleted '#{pid}' from #{
|
54
|
+
puts "Deleted '#{pid}' from #{ActiveFedora::RubydoraConnection.instance.options[:url]}"
|
57
55
|
i += 1
|
58
56
|
end
|
59
57
|
end
|
@@ -63,14 +61,18 @@ namespace :af do
|
|
63
61
|
|
64
62
|
# If a source url has been provided, attampt to export from the fedora repository there.
|
65
63
|
if ENV["source"]
|
66
|
-
|
64
|
+
#FIXME
|
65
|
+
raise "Not Implemented"
|
66
|
+
#Fedora::Repository.register(ENV["source"])
|
67
67
|
end
|
68
68
|
|
69
69
|
if ENV["pid"].nil?
|
70
70
|
puts "You must specify a valid pid. Example: rake fedora:harvest_fixture pid=demo:12"
|
71
71
|
else
|
72
72
|
pid = ENV["pid"]
|
73
|
-
puts "Exporting '#{pid}' from #{
|
73
|
+
puts "Exporting '#{pid}' from #{ActiveFedora::RubydoraConnection.instance.options[:url]}"
|
74
|
+
#FIXME
|
75
|
+
raise "Not Implemented"
|
74
76
|
foxml = Fedora::Repository.instance.export(pid)
|
75
77
|
filename = File.join("spec","fixtures","#{pid.gsub(":","_")}.foxml.xml")
|
76
78
|
file = File.new(filename,"w")
|
@@ -84,6 +86,8 @@ namespace :af do
|
|
84
86
|
|
85
87
|
# If a destination url has been provided, attampt to export from the fedora repository there.
|
86
88
|
if ENV["destination"]
|
89
|
+
#FIXME
|
90
|
+
raise "Not Implemented"
|
87
91
|
Fedora::Repository.register(ENV["destination"])
|
88
92
|
end
|
89
93
|
|
@@ -97,9 +101,10 @@ namespace :af do
|
|
97
101
|
end
|
98
102
|
|
99
103
|
if !filename.nil?
|
100
|
-
puts "Importing '#{filename}' to #{
|
104
|
+
puts "Importing '#{filename}' to #{ActiveFedora::RubydoraConnection.instance.options[:url]}"
|
101
105
|
file = File.new(filename, "r")
|
102
|
-
result = foxml =
|
106
|
+
result = foxml = ActiveFedora::RubydoraConnection.instance.connection.ingest(:file=>file.read)
|
107
|
+
# result = foxml = Fedora::Repository.instance.ingest(file.read)
|
103
108
|
if result
|
104
109
|
puts "The fixture has been ingested as #{result.body}"
|
105
110
|
if !pid.nil?
|
@@ -14,18 +14,21 @@ EOS
|
|
14
14
|
exit(0)
|
15
15
|
end
|
16
16
|
|
17
|
+
APP_ROOT = File.expand_path("#{File.dirname(__FILE__)}/../../")
|
18
|
+
require 'jettywrapper'
|
19
|
+
|
17
20
|
$: << 'lib'
|
18
|
-
def jetty_params
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
21
|
+
# def jetty_params
|
22
|
+
# project_root = File.expand_path("#{File.dirname(__FILE__)}/../../")
|
23
|
+
# {
|
24
|
+
# :quiet => false,
|
25
|
+
# :jetty_home => File.join(project_root,'jetty'),
|
26
|
+
# :jetty_port => 8983,
|
27
|
+
# :solr_home => File.expand_path(File.join(project_root,'jetty','solr')),
|
28
|
+
# :fedora_home => File.expand_path(File.join(project_root,'jetty','fedora','default')),
|
29
|
+
# :startup_wait=>30
|
30
|
+
# }
|
31
|
+
# end
|
29
32
|
|
30
33
|
desc "Run active-fedora rspec tests"
|
31
34
|
task :spec do
|
@@ -34,21 +37,17 @@ end
|
|
34
37
|
|
35
38
|
desc "Hudson build"
|
36
39
|
task :hudson do
|
37
|
-
require 'jettywrapper'
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
raise "test failures: #{error}" if error
|
48
|
-
else
|
49
|
-
system("rake hudson environment=test")
|
50
|
-
fail unless $?.success?
|
41
|
+
ENV['environment'] = "test"
|
42
|
+
Rake::Task["active_fedora:doc"].invoke
|
43
|
+
Rake::Task["active_fedora:configure_jetty"].invoke
|
44
|
+
jetty_params = Jettywrapper.load_config
|
45
|
+
error = Jettywrapper.wrap(jetty_params) do
|
46
|
+
ENV["FEDORA_HOME"]=File.expand_path(File.join(File.dirname(__FILE__),'..','..','jetty','fedora','default'))
|
47
|
+
Rake::Task["active_fedora:load_fixtures"].invoke
|
48
|
+
Rake::Task["active_fedora:rspec"].invoke
|
51
49
|
end
|
50
|
+
raise "test failures: #{error}" if error
|
52
51
|
end
|
53
52
|
|
54
53
|
namespace :active_fedora do
|
@@ -115,20 +114,6 @@ namespace :active_fedora do
|
|
115
114
|
cp("#{f}", 'jetty/solr/test-core/conf/', :verbose => true)
|
116
115
|
end
|
117
116
|
end
|
118
|
-
|
119
|
-
namespace :jetty do
|
120
|
-
desc "start jetty"
|
121
|
-
task :start do
|
122
|
-
require 'jettywrapper'
|
123
|
-
Jettywrapper.start(jetty_params)
|
124
|
-
end
|
125
|
-
desc "stop jetty"
|
126
|
-
task :stop do
|
127
|
-
require 'jettywrapper'
|
128
|
-
Jettywrapper.stop(jetty_params)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
117
|
end
|
133
118
|
|
134
119
|
# Provides an :environment task for use while working within a working copy of active-fedora
|
@@ -138,6 +123,4 @@ task :environment do
|
|
138
123
|
puts "Initializing ActiveFedora Rake environment. This should only be called when working within a workign copy of the active-fedora code."
|
139
124
|
require 'spec/samples/models/hydrangea_article'
|
140
125
|
require 'active_fedora/samples'
|
141
|
-
# $:.unshift(File.dirname(__FILE__) + '/../lib')
|
142
|
-
# Dir[File.join(File.dirname(__FILE__)+'/../lib/')+'**/*.rb'].each{|x| require x}
|
143
126
|
end
|
@@ -24,22 +24,6 @@ describe ActiveFedora::Base do
|
|
24
24
|
@test_object.delete
|
25
25
|
end
|
26
26
|
|
27
|
-
describe "deserialize" do
|
28
|
-
it "should return an object whose inner_object is not marked as new. The datastreams should only be marked new if the model expects a datastream that doesn't exist yet in fedora" do
|
29
|
-
#mocko = mock("object")
|
30
|
-
#ActiveFedora::Base.expects(:new).returns(mocko)
|
31
|
-
@test_object.datastreams["sensitive_passages"].delete
|
32
|
-
doc = Nokogiri::XML::Document.parse(@test_object.inner_object.object_xml)
|
33
|
-
result = OralHistorySampleModel.deserialize(doc)
|
34
|
-
result.new_object?.should be_false
|
35
|
-
result.datastreams_in_memory.should have_key("dublin_core")
|
36
|
-
result.datastreams_in_memory.should have_key("properties")
|
37
|
-
result.datastreams_in_memory.each do |name,ds|
|
38
|
-
ds.new_object?.should be_false unless name == "sensitive_passages"
|
39
|
-
end
|
40
|
-
result.datastreams_in_memory["sensitive_passages"].new_object?.should be_true
|
41
|
-
end
|
42
|
-
end
|
43
27
|
describe "load_instance" do
|
44
28
|
it "should retain all datastream attributes pulled from fedora" do
|
45
29
|
# raw_object = Fedora::Repository.instance.find_objects("pid=#{@test_object.pid}").first
|
@@ -48,12 +32,11 @@ describe ActiveFedora::Base do
|
|
48
32
|
raw_datastreams = raw_object.datastreams
|
49
33
|
loaded_datastreams = loaded.datastreams
|
50
34
|
raw_datastreams.each_pair do |k,v|
|
51
|
-
v.
|
52
|
-
|
53
|
-
|
54
|
-
end
|
35
|
+
v.dsid.should == loaded_datastreams[k].dsid
|
36
|
+
v.dsLabel.should == loaded_datastreams[k].dsLabel
|
37
|
+
v.mimeType.should == loaded_datastreams[k].mimeType
|
55
38
|
end
|
56
39
|
end
|
57
40
|
end
|
58
41
|
|
59
|
-
end
|
42
|
+
end
|
@@ -95,20 +95,19 @@ describe ActiveFedora::Base do
|
|
95
95
|
|
96
96
|
it "should set the CMA hasModel relationship in the Rels-EXT" do
|
97
97
|
@test_object2.save
|
98
|
-
rexml = REXML::Document.new(@
|
98
|
+
rexml = REXML::Document.new(@test_object2.datastreams["RELS-EXT"].content)
|
99
99
|
# Purpose: confirm that the isMemberOf entries exist and have real RDF in them
|
100
100
|
rexml.root.elements["rdf:Description/hasModel"].attributes["rdf:resource"].should == 'info:fedora/afmodel:ActiveFedora_Base'
|
101
101
|
end
|
102
102
|
it "should merge attributes from fedora into attributes hash" do
|
103
103
|
inner_object = @test_object2.inner_object
|
104
|
-
inner_object.
|
104
|
+
inner_object.pid.should == @test_object2.pid
|
105
105
|
@test_object2.save
|
106
|
-
inner_object.
|
107
|
-
inner_object.
|
108
|
-
inner_object.
|
109
|
-
inner_object.attributes.should have_key(:owner_id)
|
106
|
+
inner_object.should respond_to(:state)
|
107
|
+
inner_object.should respond_to(:lastModifiedDate)
|
108
|
+
inner_object.should respond_to(:ownerId)
|
110
109
|
inner_object.state.should == "A"
|
111
|
-
inner_object.
|
110
|
+
inner_object.ownerId.should == "fedoraAdmin"
|
112
111
|
end
|
113
112
|
end
|
114
113
|
|
@@ -119,19 +118,19 @@ describe ActiveFedora::Base do
|
|
119
118
|
end
|
120
119
|
end
|
121
120
|
|
122
|
-
describe ".
|
121
|
+
describe ".datastreams" do
|
123
122
|
it "should return a Hash of datastreams from fedora" do
|
124
|
-
datastreams = @test_object.
|
125
|
-
datastreams.should
|
123
|
+
datastreams = @test_object.datastreams
|
124
|
+
datastreams.should be_a_kind_of(Hash)
|
126
125
|
datastreams.each_value do |ds|
|
127
126
|
ds.should be_a_kind_of(ActiveFedora::Datastream)
|
128
127
|
end
|
129
|
-
@test_object.
|
128
|
+
@test_object.datastreams["DC"].should be_an_instance_of(ActiveFedora::Datastream)
|
130
129
|
datastreams["DC"].should_not be_nil
|
131
130
|
datastreams["DC"].should be_an_instance_of(ActiveFedora::Datastream)
|
132
131
|
end
|
133
132
|
it "should initialize the datastream pointers with @new_object=false" do
|
134
|
-
datastreams = @test_object.
|
133
|
+
datastreams = @test_object.datastreams
|
135
134
|
datastreams.each_value do |ds|
|
136
135
|
ds.new_object?.should be_false
|
137
136
|
end
|
@@ -140,9 +139,9 @@ describe ActiveFedora::Base do
|
|
140
139
|
|
141
140
|
describe ".metadata_streams" do
|
142
141
|
it "should return all of the datastreams from the object that are kinds of MetadataDatastreams " do
|
143
|
-
mds1 = ActiveFedora::MetadataDatastream.new(
|
144
|
-
mds2 = ActiveFedora::QualifiedDublinCoreDatastream.new(
|
145
|
-
fds = ActiveFedora::Datastream.new(
|
142
|
+
mds1 = ActiveFedora::MetadataDatastream.new(@test_object.inner_object, "md1")
|
143
|
+
mds2 = ActiveFedora::QualifiedDublinCoreDatastream.new(@test_object.inner_object, "qdc")
|
144
|
+
fds = ActiveFedora::Datastream.new(@test_object.inner_object, "fds")
|
146
145
|
@test_object.add_datastream(mds1)
|
147
146
|
@test_object.add_datastream(mds2)
|
148
147
|
@test_object.add_datastream(fds)
|
@@ -156,9 +155,9 @@ describe ActiveFedora::Base do
|
|
156
155
|
|
157
156
|
describe ".file_streams" do
|
158
157
|
it "should return all of the datastreams from the object that are kinds of MetadataDatastreams" do
|
159
|
-
fds1 = ActiveFedora::Datastream.new(
|
160
|
-
fds2 = ActiveFedora::Datastream.new(
|
161
|
-
mds = ActiveFedora::MetadataDatastream.new(
|
158
|
+
fds1 = ActiveFedora::Datastream.new(@test_object.inner_object, "fds1")
|
159
|
+
fds2 = ActiveFedora::Datastream.new(@test_object.inner_object, "fds2")
|
160
|
+
mds = ActiveFedora::MetadataDatastream.new(@test_object.inner_object, "mds")
|
162
161
|
@test_object.add_datastream(fds1)
|
163
162
|
@test_object.add_datastream(fds2)
|
164
163
|
@test_object.add_datastream(mds)
|
@@ -169,9 +168,9 @@ describe ActiveFedora::Base do
|
|
169
168
|
result.should include(fds2)
|
170
169
|
end
|
171
170
|
it "should skip DC and RELS-EXT datastreams" do
|
172
|
-
fds1 = ActiveFedora::Datastream.new(
|
173
|
-
dc = ActiveFedora::Datastream.new(
|
174
|
-
rels_ext = ActiveFedora::RelsExtDatastream.new
|
171
|
+
fds1 = ActiveFedora::Datastream.new(@test_object.inner_object,"fds1")
|
172
|
+
dc = ActiveFedora::Datastream.new(@test_object.inner_object, "DC")
|
173
|
+
rels_ext = ActiveFedora::RelsExtDatastream.new(@test_object.inner_object, 'RELS-EXT')
|
175
174
|
@test_object.add_datastream(fds1)
|
176
175
|
@test_object.add_datastream(dc)
|
177
176
|
@test_object.add_datastream(rels_ext)
|
@@ -198,10 +197,10 @@ describe ActiveFedora::Base do
|
|
198
197
|
|
199
198
|
it 'should create the RELS-EXT datastream if it doesnt exist' do
|
200
199
|
test_object = ActiveFedora::Base.new
|
201
|
-
test_object.datastreams["RELS-EXT"].should == nil
|
200
|
+
#test_object.datastreams["RELS-EXT"].should == nil
|
202
201
|
test_object.rels_ext
|
203
|
-
test_object.
|
204
|
-
test_object.
|
202
|
+
test_object.datastreams["RELS-EXT"].should_not == nil
|
203
|
+
test_object.datastreams["RELS-EXT"].class.should == ActiveFedora::RelsExtDatastream
|
205
204
|
end
|
206
205
|
end
|
207
206
|
|
@@ -214,7 +213,7 @@ describe ActiveFedora::Base do
|
|
214
213
|
@test_object.add_relationship(rel.predicate, rel.object)
|
215
214
|
end
|
216
215
|
@test_object.save
|
217
|
-
rexml = REXML::Document.new(@test_object.
|
216
|
+
rexml = REXML::Document.new(@test_object.datastreams["RELS-EXT"].content)
|
218
217
|
# Purpose: confirm that the isMemberOf entries exist and have real RDF in them
|
219
218
|
rexml.root.elements["rdf:Description/isMemberOf[@rdf:resource='info:fedora/demo:5']"].attributes["xmlns"].should == 'info:fedora/fedora-system:def/relations-external#'
|
220
219
|
rexml.root.elements["rdf:Description/isMemberOf[@rdf:resource='info:fedora/demo:10']"].attributes["xmlns"].should == 'info:fedora/fedora-system:def/relations-external#'
|
@@ -229,50 +228,56 @@ describe ActiveFedora::Base do
|
|
229
228
|
@test_object.save
|
230
229
|
test_obj = ActiveFedora::Base.load_instance(@test_object.pid)
|
231
230
|
#check case where nothing passed in does not have correct mime type
|
232
|
-
test_obj.datastreams["DS1"].
|
231
|
+
test_obj.datastreams["DS1"].mimeType.should == "application/octet-stream"
|
233
232
|
@test_object2 = ActiveFedora::Base.new
|
233
|
+
f = File.new(File.join( File.dirname(__FILE__), "../fixtures/dino_jpg_no_file_ext" ))
|
234
234
|
@test_object2.add_file_datastream(f,{:mimeType=>"image/jpeg"})
|
235
235
|
@test_object2.save
|
236
236
|
test_obj = ActiveFedora::Base.load_instance(@test_object2.pid)
|
237
|
-
test_obj.datastreams["DS1"].
|
237
|
+
test_obj.datastreams["DS1"].mimeType.should == "image/jpeg"
|
238
238
|
@test_object3 = ActiveFedora::Base.new
|
239
|
+
f = File.new(File.join( File.dirname(__FILE__), "../fixtures/dino_jpg_no_file_ext" ))
|
239
240
|
@test_object3.add_file_datastream(f,{:mime_type=>"image/jpeg"})
|
240
241
|
@test_object3.save
|
241
242
|
test_obj = ActiveFedora::Base.load_instance(@test_object3.pid)
|
242
|
-
test_obj.datastreams["DS1"].
|
243
|
+
test_obj.datastreams["DS1"].mimeType.should == "image/jpeg"
|
243
244
|
@test_object4 = ActiveFedora::Base.new
|
245
|
+
f = File.new(File.join( File.dirname(__FILE__), "../fixtures/dino_jpg_no_file_ext" ))
|
244
246
|
@test_object4.add_file_datastream(f,{:content_type=>"image/jpeg"})
|
245
247
|
@test_object4.save
|
246
248
|
test_obj = ActiveFedora::Base.load_instance(@test_object4.pid)
|
247
|
-
test_obj.datastreams["DS1"].
|
249
|
+
test_obj.datastreams["DS1"].mimeType.should == "image/jpeg"
|
248
250
|
end
|
249
251
|
end
|
250
252
|
|
251
253
|
describe '.add_datastream' do
|
252
254
|
|
253
255
|
it "should be able to add datastreams" do
|
254
|
-
ds = ActiveFedora::Datastream.new(
|
255
|
-
|
256
|
+
ds = ActiveFedora::Datastream.new(@test_object.inner_object, 'DS1')
|
257
|
+
# ds = ActiveFedora::Datastream.new(:dsID => 'DS1', :dsLabel => 'hello', :altIDs => '3333',
|
258
|
+
# :controlGroup => 'M', :blob => fixture('dino.jpg'))
|
256
259
|
@test_object.add_datastream(ds).should be_true
|
257
260
|
end
|
258
261
|
|
259
|
-
it "adding and saving should add the datastream to the
|
260
|
-
ds = ActiveFedora::Datastream.new(
|
261
|
-
|
262
|
+
it "adding and saving should add the datastream to the datastreams array" do
|
263
|
+
ds = ActiveFedora::Datastream.new(@test_object.inner_object, 'DS1')
|
264
|
+
ds.content = fixture('dino.jpg').read
|
265
|
+
# ds = ActiveFedora::Datastream.new(:dsid => 'DS1', :dsLabel => 'hello', :altIDs => '3333',
|
266
|
+
# :controlGroup => 'M', :blob => fixture('dino.jpg'))
|
262
267
|
@test_object.datastreams.should_not have_key("DS1")
|
263
268
|
@test_object.add_datastream(ds)
|
264
269
|
ds.save
|
265
|
-
@test_object.
|
270
|
+
@test_object.datastreams.should have_key("DS1")
|
266
271
|
end
|
267
272
|
|
268
273
|
end
|
269
274
|
|
270
275
|
it "should retrieve blobs that match the saved blobs" do
|
271
|
-
ds = ActiveFedora::Datastream.new(
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
@test_object.
|
276
|
+
ds = ActiveFedora::Datastream.new(@test_object.inner_object, 'DS1')
|
277
|
+
ds.content = "foo"
|
278
|
+
new_ds = ds.save
|
279
|
+
@test_object.add_datastream(new_ds)
|
280
|
+
@test_object.class.find(@test_object.pid).datastreams["DS1"].content.should == new_ds.content
|
276
281
|
end
|
277
282
|
|
278
283
|
describe ".create_date" do
|
@@ -298,16 +303,16 @@ describe ActiveFedora::Base do
|
|
298
303
|
describe '#delete' do
|
299
304
|
it 'if inbound relationships exist should remove relationships from those inbound targets as well when deleting this object' do
|
300
305
|
@test_object2 = MockAFBaseRelationship.new
|
301
|
-
@test_object2.new_object = true
|
306
|
+
# @test_object2.new_object = true
|
302
307
|
@test_object2.save
|
303
308
|
@test_object3 = MockAFBaseRelationship.new
|
304
|
-
@test_object3.new_object = true
|
309
|
+
# @test_object3.new_object = true
|
305
310
|
@test_object3.save
|
306
311
|
@test_object4 = MockAFBaseRelationship.new
|
307
|
-
@test_object4.new_object = true
|
312
|
+
# @test_object4.new_object = true
|
308
313
|
@test_object4.save
|
309
314
|
@test_object5 = MockAFBaseRelationship.new
|
310
|
-
@test_object5.new_object = true
|
315
|
+
# @test_object5.new_object = true
|
311
316
|
@test_object5.save
|
312
317
|
#append to relationship by 'testing'
|
313
318
|
@test_object2.add_relationship_by_name("testing",@test_object3)
|
@@ -366,16 +371,16 @@ describe ActiveFedora::Base do
|
|
366
371
|
describe '#relationships' do
|
367
372
|
it 'should return internal relationships with no parameters and include inbound if false passed in' do
|
368
373
|
@test_object2 = MockAFBaseRelationship.new
|
369
|
-
@test_object2.new_object = true
|
374
|
+
# @test_object2.new_object = true
|
370
375
|
@test_object2.save
|
371
376
|
@test_object3 = MockAFBaseRelationship.new
|
372
|
-
@test_object3.new_object = true
|
377
|
+
# @test_object3.new_object = true
|
373
378
|
@test_object3.save
|
374
379
|
@test_object4 = MockAFBaseRelationship.new
|
375
|
-
@test_object4.new_object = true
|
380
|
+
# @test_object4.new_object = true
|
376
381
|
@test_object4.save
|
377
382
|
@test_object5 = MockAFBaseRelationship.new
|
378
|
-
@test_object5.new_object = true
|
383
|
+
# @test_object5.new_object = true
|
379
384
|
@test_object5.save
|
380
385
|
#append to named relationship 'testing'
|
381
386
|
@test_object2.testing_append(@test_object3)
|
@@ -424,16 +429,16 @@ describe ActiveFedora::Base do
|
|
424
429
|
describe '#inbound_relationships' do
|
425
430
|
it 'should return a hash of inbound relationships' do
|
426
431
|
@test_object2 = MockAFBaseRelationship.new
|
427
|
-
|
432
|
+
#@test_object2.new_object = true
|
428
433
|
@test_object2.save
|
429
434
|
@test_object3 = MockAFBaseRelationship.new
|
430
|
-
|
435
|
+
#@test_object3.new_object = true
|
431
436
|
@test_object3.save
|
432
437
|
@test_object4 = MockAFBaseRelationship.new
|
433
|
-
|
438
|
+
#@test_object4.new_object = true
|
434
439
|
@test_object4.save
|
435
440
|
@test_object5 = MockAFBaseRelationship.new
|
436
|
-
|
441
|
+
#@test_object5.new_object = true
|
437
442
|
@test_object5.save
|
438
443
|
#append to named relationship 'testing'
|
439
444
|
@test_object2.testing_append(@test_object3)
|
@@ -459,16 +464,16 @@ describe ActiveFedora::Base do
|
|
459
464
|
describe '#inbound_relationships_by_name' do
|
460
465
|
it 'should return a hash of inbound relationship names to array of objects' do
|
461
466
|
@test_object2 = MockAFBaseRelationship.new
|
462
|
-
|
467
|
+
#@test_object2.new_object = true
|
463
468
|
@test_object2.save
|
464
469
|
@test_object3 = MockAFBaseRelationship.new
|
465
|
-
|
470
|
+
#@test_object3.new_object = true
|
466
471
|
@test_object3.save
|
467
472
|
@test_object4 = MockAFBaseRelationship.new
|
468
|
-
|
473
|
+
#@test_object4.new_object = true
|
469
474
|
@test_object4.save
|
470
475
|
@test_object5 = MockAFBaseRelationship.new
|
471
|
-
|
476
|
+
#@test_object5.new_object = true
|
472
477
|
@test_object5.save
|
473
478
|
#append to named relationship 'testing'
|
474
479
|
@test_object2.testing_append(@test_object3)
|
@@ -497,16 +502,16 @@ describe ActiveFedora::Base do
|
|
497
502
|
describe '#relationships_by_name' do
|
498
503
|
it '' do
|
499
504
|
@test_object2 = MockAFBaseRelationship.new
|
500
|
-
|
505
|
+
#@test_object2.new_object = true
|
501
506
|
@test_object2.save
|
502
507
|
@test_object3 = MockAFBaseRelationship.new
|
503
|
-
|
508
|
+
#@test_object3.new_object = true
|
504
509
|
@test_object3.save
|
505
510
|
@test_object4 = MockAFBaseRelationship.new
|
506
|
-
|
511
|
+
#@test_object4.new_object = true
|
507
512
|
@test_object4.save
|
508
513
|
@test_object5 = MockAFBaseRelationship.new
|
509
|
-
|
514
|
+
#@test_object5.new_object = true
|
510
515
|
@test_object5.save
|
511
516
|
#append to named relationship 'testing'
|
512
517
|
@test_object2.testing_append(@test_object3)
|
@@ -536,16 +541,16 @@ describe ActiveFedora::Base do
|
|
536
541
|
describe '#add_relationship_by_name' do
|
537
542
|
it 'should add a named relationship to an object' do
|
538
543
|
@test_object2 = MockAFBaseRelationship.new
|
539
|
-
|
544
|
+
#@test_object2.new_object = true
|
540
545
|
@test_object2.save
|
541
546
|
@test_object3 = MockAFBaseRelationship.new
|
542
|
-
|
547
|
+
#@test_object3.new_object = true
|
543
548
|
@test_object3.save
|
544
549
|
@test_object4 = MockAFBaseRelationship.new
|
545
|
-
|
550
|
+
#@test_object4.new_object = true
|
546
551
|
@test_object4.save
|
547
552
|
@test_object5 = MockAFBaseRelationship.new
|
548
|
-
|
553
|
+
#@test_object5.new_object = true
|
549
554
|
@test_object5.save
|
550
555
|
#append to named relationship 'testing'
|
551
556
|
@test_object2.add_relationship_by_name("testing",@test_object3)
|
@@ -570,16 +575,16 @@ describe ActiveFedora::Base do
|
|
570
575
|
describe '#remove_named_relationship' do
|
571
576
|
it 'should remove an existing relationship from an object' do
|
572
577
|
@test_object2 = MockAFBaseRelationship.new
|
573
|
-
|
578
|
+
#@test_object2.new_object = true
|
574
579
|
@test_object2.save
|
575
580
|
@test_object3 = MockAFBaseRelationship.new
|
576
|
-
|
581
|
+
#@test_object3.new_object = true
|
577
582
|
@test_object3.save
|
578
583
|
@test_object4 = MockAFBaseRelationship.new
|
579
|
-
|
584
|
+
#@test_object4.new_object = true
|
580
585
|
@test_object4.save
|
581
586
|
@test_object5 = MockAFBaseRelationship.new
|
582
|
-
|
587
|
+
#@test_object5.new_object = true
|
583
588
|
@test_object5.save
|
584
589
|
#append to named relationship 'testing'
|
585
590
|
@test_object2.add_relationship_by_name("testing",@test_object3)
|
@@ -616,16 +621,16 @@ describe ActiveFedora::Base do
|
|
616
621
|
describe '#find_relationship_by_name' do
|
617
622
|
it 'should find relationships based on name passed in for inbound or outbound' do
|
618
623
|
@test_object2 = MockAFBaseRelationship.new
|
619
|
-
@test_object2.new_object = true
|
624
|
+
# @test_object2.new_object = true
|
620
625
|
@test_object2.save
|
621
626
|
@test_object3 = MockAFBaseRelationship.new
|
622
|
-
@test_object3.new_object = true
|
627
|
+
# @test_object3.new_object = true
|
623
628
|
@test_object3.save
|
624
629
|
@test_object4 = MockAFBaseRelationship.new
|
625
|
-
@test_object4.new_object = true
|
630
|
+
# @test_object4.new_object = true
|
626
631
|
@test_object4.save
|
627
632
|
@test_object5 = MockAFBaseRelationship.new
|
628
|
-
@test_object5.new_object = true
|
633
|
+
# @test_object5.new_object = true
|
629
634
|
@test_object5.save
|
630
635
|
#append to named relationship 'testing'
|
631
636
|
@test_object2.add_relationship_by_name("testing",@test_object3)
|
@@ -665,7 +670,7 @@ describe ActiveFedora::Base do
|
|
665
670
|
describe '#add_named_datastream' do
|
666
671
|
it 'should add a datastream with the given name to the object in fedora' do
|
667
672
|
@test_object2 = MockAFBaseDatastream.new
|
668
|
-
@test_object2.new_object = true
|
673
|
+
# @test_object2.new_object = true
|
669
674
|
f = File.new(File.join( File.dirname(__FILE__), "../fixtures/minivan.jpg"))
|
670
675
|
f2 = File.new(File.join( File.dirname(__FILE__), "../fixtures/dino.jpg" ))
|
671
676
|
f2.stubs(:original_filename).returns("dino.jpg")
|
@@ -681,21 +686,25 @@ describe ActiveFedora::Base do
|
|
681
686
|
@test_object2.named_datastreams.keys.include?("high").should == true
|
682
687
|
@test_object2.named_datastreams["thumbnail"].size.should == 1
|
683
688
|
@test_object2.named_datastreams["high"].size.should == 1
|
684
|
-
@test_object2.named_datastreams["thumbnail"].first
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
689
|
+
t2_thumb1 = @test_object2.named_datastreams["thumbnail"].first
|
690
|
+
t2_thumb1.dsid.should == ds.dsid
|
691
|
+
t2_thumb1.mimeType.should == ds.mimeType
|
692
|
+
t2_thumb1.pid.should == ds.pid
|
693
|
+
t2_thumb1.dsLabel.should == ds.dsLabel
|
694
|
+
t2_thumb1.controlGroup.should == ds.controlGroup
|
695
|
+
t2_high1 = @test_object2.named_datastreams["high"].first
|
696
|
+
t2_high1.dsid.should == ds2.dsid
|
697
|
+
t2_high1.mimeType.should == ds2.mimeType
|
698
|
+
t2_high1.pid.should == ds2.pid
|
699
|
+
t2_high1.dsLabel.should == ds2.dsLabel
|
700
|
+
t2_high1.controlGroup.should == ds2.controlGroup
|
692
701
|
end
|
693
702
|
end
|
694
703
|
|
695
704
|
describe '#add_named_file_datastream' do
|
696
705
|
it 'should add a file datastream with the given name to the object in fedora' do
|
697
706
|
@test_object2 = MockAFBaseDatastream.new
|
698
|
-
@test_object2.new_object = true
|
707
|
+
# @test_object2.new_object = true
|
699
708
|
f = File.new(File.join( File.dirname(__FILE__), "../fixtures/minivan.jpg"))
|
700
709
|
f.stubs(:content_type).returns("image/jpeg")
|
701
710
|
@test_object2.add_named_file_datastream("thumbnail",f)
|
@@ -703,19 +712,30 @@ describe ActiveFedora::Base do
|
|
703
712
|
@test_object2.save
|
704
713
|
@test_object2 = MockAFBaseDatastream.load_instance(@test_object2.pid)
|
705
714
|
@test_object2.named_datastreams["thumbnail"].size.should == 1
|
706
|
-
@test_object2.named_datastreams["thumbnail"].first
|
707
|
-
|
708
|
-
|
709
|
-
|
715
|
+
t2_thumb1 = @test_object2.named_datastreams["thumbnail"].first
|
716
|
+
t2_thumb1.dsid.should == "THUMB1"
|
717
|
+
t2_thumb1.mimeType.should == "image/jpeg"
|
718
|
+
t2_thumb1.pid.should == @test_object2.pid
|
719
|
+
t2_thumb1.dsLabel.should == "minivan.jpg"
|
720
|
+
t2_thumb1.controlGroup.should == "M"
|
721
|
+
|
722
|
+
# .attributes.should == {"label"=>ds.label,"dsid"=>ds.dsid,
|
723
|
+
# "mimeType"=>ds.attributes[:mimeType],
|
724
|
+
# :controlGroup=>ds.attributes[:controlGroup],
|
725
|
+
# :pid=>ds.pid, :dsID=>ds.dsid, :dsLabel=>ds.attributes[:dsLabel]}
|
710
726
|
end
|
711
727
|
end
|
712
728
|
|
713
729
|
describe '#update_named_datastream' do
|
714
730
|
it 'should update a named datastream to have a new file' do
|
715
731
|
@test_object2 = MockAFBaseDatastream.new
|
716
|
-
@test_object2.new_object = true
|
732
|
+
# @test_object2.new_object = true
|
717
733
|
f = File.new(File.join( File.dirname(__FILE__), "../fixtures/minivan.jpg"))
|
734
|
+
minivan = f.read
|
735
|
+
f.rewind
|
718
736
|
f2 = File.new(File.join( File.dirname(__FILE__), "../fixtures/dino.jpg" ))
|
737
|
+
dino = f.read
|
738
|
+
f.rewind
|
719
739
|
f.stubs(:content_type).returns("image/jpeg")
|
720
740
|
f.stubs(:original_filename).returns("minivan.jpg")
|
721
741
|
f2.stubs(:content_type).returns("image/jpeg")
|
@@ -728,62 +748,32 @@ describe ActiveFedora::Base do
|
|
728
748
|
@test_object2.thumbnail.size.should == 1
|
729
749
|
@test_object2.thumbnail_ids == ["THUMB1"]
|
730
750
|
ds = @test_object2.thumbnail.first
|
731
|
-
ds.
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
}
|
739
|
-
raise "Datastream content mismatch on save of datastream" unless ds.content == expected_content
|
751
|
+
ds.dsid.should == "THUMB1"
|
752
|
+
ds.mimeType.should == "image/jpeg"
|
753
|
+
ds.pid.should == @test_object2.pid
|
754
|
+
ds.dsLabel.should == "minivan.jpg"
|
755
|
+
ds.controlGroup.should == "M"
|
756
|
+
|
757
|
+
ds.content.should == minivan
|
740
758
|
@test_object2.update_named_datastream("thumbnail",{:file=>f2,:dsid=>"THUMB1"})
|
741
759
|
@test_object2.save
|
742
760
|
@test_object2 = MockAFBaseDatastream.load_instance(@test_object2.pid)
|
743
761
|
@test_object2.thumbnail.size.should == 1
|
744
762
|
@test_object2.thumbnail_ids == ["THUMB1"]
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
expected_content << line
|
753
|
-
}
|
754
|
-
raise "Datastream content mismatch after update of datastream" unless ds.content == expected_content
|
755
|
-
end
|
756
|
-
end
|
757
|
-
|
758
|
-
describe '#named_datastreams_attributes' do
|
759
|
-
it 'should return a hash of name to hash of dsid to attribute hashes for each named datastream' do
|
760
|
-
@test_object2 = MockAFBaseDatastream.new
|
761
|
-
@test_object2.new_object = true
|
762
|
-
f = File.new(File.join( File.dirname(__FILE__), "../fixtures/minivan.jpg"))
|
763
|
-
f2 = File.new(File.join( File.dirname(__FILE__), "../fixtures/dino.jpg" ))
|
764
|
-
f2.stubs(:original_filename).returns("dino.jpg")
|
765
|
-
f.stubs(:content_type).returns("image/jpeg")
|
766
|
-
@test_object2.add_named_datastream("thumbnail",{:content_type=>"image/jpeg",:blob=>f, :label=>"testDS"})
|
767
|
-
@test_object2.add_named_datastream("high",{:content_type=>"image/jpeg",:blob=>f2})
|
768
|
-
ds = @test_object2.thumbnail.first
|
769
|
-
ds2 = @test_object2.high.first
|
770
|
-
@test_object2.save
|
771
|
-
@test_object2 = MockAFBaseDatastream.load_instance(@test_object2.pid)
|
772
|
-
@test_object2.named_datastreams_attributes.should == {"thumbnail"=>{"THUMB1"=>{"label"=>ds.label,"dsid"=>ds.dsid,
|
773
|
-
"mimeType"=>ds.attributes[:mimeType],
|
774
|
-
:controlGroup=>ds.attributes[:controlGroup],
|
775
|
-
:pid=>ds.pid, :dsID=>ds.dsid, :dsLabel=>ds.attributes[:dsLabel]}},
|
776
|
-
"high"=>{"HIGH1"=>{"label"=>ds2.label,"dsid"=>ds2.dsid,
|
777
|
-
"mimeType"=>ds2.attributes[:mimeType],
|
778
|
-
:controlGroup=>ds2.attributes[:controlGroup],
|
779
|
-
:pid=>ds2.pid, :dsID=>ds2.dsid, :dsLabel=>ds2.attributes[:dsLabel]}}}
|
763
|
+
ds2 = @test_object2.thumbnail.first
|
764
|
+
ds2.dsid.should == "THUMB1"
|
765
|
+
ds2.mimeType.should == "image/jpeg"
|
766
|
+
ds2.pid.should == @test_object2.pid
|
767
|
+
ds2.dsLabel.should == "dino.jpg"
|
768
|
+
ds2.controlGroup.should == "M"
|
769
|
+
(ds2.content == dino).should be_true
|
780
770
|
end
|
781
771
|
end
|
782
772
|
|
783
773
|
describe '#named_datastreams_ids' do
|
784
774
|
it 'should return a hash of datastream name to an array of dsids' do
|
785
775
|
@test_object2 = MockAFBaseDatastream.new
|
786
|
-
@test_object2.new_object = true
|
776
|
+
# @test_object2.new_object = true
|
787
777
|
f = File.new(File.join( File.dirname(__FILE__), "../fixtures/minivan.jpg"))
|
788
778
|
f2 = File.new(File.join( File.dirname(__FILE__), "../fixtures/dino.jpg" ))
|
789
779
|
f2.stubs(:original_filename).returns("dino.jpg")
|
@@ -796,183 +786,183 @@ describe ActiveFedora::Base do
|
|
796
786
|
end
|
797
787
|
end
|
798
788
|
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
@test_object2.new_object = true
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
@test_object3.new_object = true
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
@test_object4.new_object = true
|
828
|
-
|
829
|
-
|
830
|
-
@test_object5.new_object = true
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
# solr_result = mock("solr result")
|
927
|
-
# SpecNode.create_inbound_relationship_finders("constituents", :is_constituent_of, :inbound => true)
|
928
|
-
# local_node = SpecNode.new
|
929
|
-
# mock_repo = mock("repo")
|
930
|
-
# mock_repo.expects(:find_model).never
|
931
|
-
# SpecNode.expects(:load_instance_from_solr).times(1)
|
932
|
-
# local_node.expects(:internal_uri).returns("info:fedora/test:sample_pid")
|
933
|
-
# ActiveFedora::SolrService.instance.conn.expects(:query).with("is_constituent_of_s:info\\:fedora/test\\:sample_pid").returns(solr_result)
|
934
|
-
# local_node.constituents(:response_format => :solr).should equal(solr_result)
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
789
|
+
# describe '#load_instance_from_solr' do
|
790
|
+
# it 'should populate an instance of an ActiveFedora::Base object using solr instead of Fedora' do
|
791
|
+
#
|
792
|
+
# @test_object2 = MockAFBaseFromSolr.new
|
793
|
+
# # @test_object2.new_object = true
|
794
|
+
# attributes = {"holding_id"=>{0=>"Holding 1"},
|
795
|
+
# "language"=>{0=>"Italian"},
|
796
|
+
# "creator"=>{0=>"Linguist, A."},
|
797
|
+
# "geography"=>{0=>"Italy"},
|
798
|
+
# "title"=>{0=>"Italian and Spanish: A Comparison of Common Phrases"}}
|
799
|
+
# @test_object2.update_indexed_attributes(attributes)
|
800
|
+
# @test_object2.save
|
801
|
+
# @test_object3 = MockAFBaseFromSolr.new
|
802
|
+
# # @test_object3.new_object = true
|
803
|
+
# attributes = {"holding_id"=>{0=>"Holding 2"},
|
804
|
+
# "language"=>{0=>"Spanish;Latin"},
|
805
|
+
# "creator"=>{0=>"Linguist, A."},
|
806
|
+
# "geography"=>{0=>"Spain"},
|
807
|
+
# "title"=>{0=>"A study of the evolution of Spanish from Latin"}}
|
808
|
+
# @test_object3.update_indexed_attributes(attributes)
|
809
|
+
# @test_object3.save
|
810
|
+
# @test_object4 = MockAFBaseFromSolr.new
|
811
|
+
# attributes = {"holding_id"=>{0=>"Holding 3"},
|
812
|
+
# "language"=>{0=>"Spanish;Latin"},
|
813
|
+
# "creator"=>{0=>"Linguist, A."},
|
814
|
+
# "geography"=>{0=>"Spain"},
|
815
|
+
# "title"=>{0=>"An obscure look into early nomadic tribes of Spain"}}
|
816
|
+
# @test_object4.update_indexed_attributes(attributes)
|
817
|
+
# # @test_object4.new_object = true
|
818
|
+
# @test_object4.save
|
819
|
+
# @test_object5 = MockAFBaseFromSolr.new
|
820
|
+
# # @test_object5.new_object = true
|
821
|
+
# @test_object5.save
|
822
|
+
#
|
823
|
+
# #append to named relationship 'testing'
|
824
|
+
# @test_object2.testing_append(@test_object3)
|
825
|
+
# @test_object2.testing2_append(@test_object4)
|
826
|
+
# @test_object5.testing_append(@test_object2)
|
827
|
+
# @test_object5.testing2_append(@test_object3)
|
828
|
+
# @test_object2.save
|
829
|
+
# @test_object5.save
|
830
|
+
# r2 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object2)
|
831
|
+
# r3 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object3)
|
832
|
+
# r4 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object4)
|
833
|
+
# r5 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object5)
|
834
|
+
# model_rel = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>ActiveFedora::ContentModel.pid_from_ruby_class(MockAFBaseFromSolr))
|
835
|
+
# #check inbound correct, testing goes to :has_part and testing2 goes to :has_member
|
836
|
+
# test_from_solr_object2 = MockAFBaseFromSolr.load_instance_from_solr(@test_object2.pid)
|
837
|
+
# test_from_solr_object3 = MockAFBaseFromSolr.load_instance_from_solr(@test_object3.pid)
|
838
|
+
# test_from_solr_object4 = MockAFBaseFromSolr.load_instance_from_solr(@test_object4.pid)
|
839
|
+
# test_from_solr_object5 = MockAFBaseFromSolr.load_instance_from_solr(@test_object5.pid)
|
840
|
+
#
|
841
|
+
# # need to check pid, system create and system modify
|
842
|
+
# test_from_solr_object2.pid.should == @test_object2.pid
|
843
|
+
# test_from_solr_object3.pid.should == @test_object3.pid
|
844
|
+
# test_from_solr_object4.pid.should == @test_object4.pid
|
845
|
+
# test_from_solr_object5.pid.should == @test_object5.pid
|
846
|
+
#
|
847
|
+
# Time.parse(test_from_solr_object2.create_date).should == Time.parse(@test_object2.create_date)
|
848
|
+
# Time.parse(test_from_solr_object3.create_date).should == Time.parse(@test_object3.create_date)
|
849
|
+
# Time.parse(test_from_solr_object4.create_date).should == Time.parse(@test_object4.create_date)
|
850
|
+
# Time.parse(test_from_solr_object5.create_date).should == Time.parse(@test_object5.create_date)
|
851
|
+
#
|
852
|
+
# Time.parse(test_from_solr_object2.modified_date).should == Time.parse(@test_object2.modified_date)
|
853
|
+
# Time.parse(test_from_solr_object3.modified_date).should == Time.parse(@test_object3.modified_date)
|
854
|
+
# Time.parse(test_from_solr_object4.modified_date).should == Time.parse(@test_object4.modified_date)
|
855
|
+
# Time.parse(test_from_solr_object5.modified_date).should == Time.parse(@test_object5.modified_date)
|
856
|
+
#
|
857
|
+
# # need to test outbound and inbound relationships
|
858
|
+
# test_from_solr_object2.relationships(false).should == {:self=>{:has_model=>[model_rel.object],
|
859
|
+
# :has_part=>[r3.object],
|
860
|
+
# :has_member=>[r4.object]},
|
861
|
+
# :inbound=>{:has_part=>[r5.object]}}
|
862
|
+
# test_from_solr_object2.relationships_by_name(false).should == {:self=>{"testing"=>[r3.object],"testing2"=>[r4.object],
|
863
|
+
# "collection_members"=>[],"part_of"=>[],"parts_outbound"=>[r3.object]},
|
864
|
+
# :inbound=>{"testing_inbound"=>[r5.object],"testing_inbound2"=>[],"parts_inbound"=>[]}}
|
865
|
+
# test_from_solr_object3.relationships(false).should == {:self=>{:has_model=>[model_rel.object]},
|
866
|
+
# :inbound=>{:has_part=>[r2.object],
|
867
|
+
# :has_member=>[r5.object]}}
|
868
|
+
# test_from_solr_object3.relationships_by_name(false).should == {:self=>{"testing"=>[],"testing2"=>[], "collection_members"=>[],"part_of"=>[],"parts_outbound"=>[]},
|
869
|
+
# :inbound=>{"testing_inbound"=>[r2.object],"testing_inbound2"=>[r5.object], "parts_inbound"=>[]}}
|
870
|
+
# test_from_solr_object4.relationships(false).should == {:self=>{:has_model=>[model_rel.object]},
|
871
|
+
# :inbound=>{:has_member=>[r2.object]}}
|
872
|
+
# test_from_solr_object4.relationships_by_name(false).should == {:inbound=>{"parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[r2.object]}, :self=>{"testing2"=>[], "collection_members"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[]}}
|
873
|
+
# test_from_solr_object5.relationships(false).should == {:self=>{:has_model=>[model_rel.object],
|
874
|
+
# :has_part=>[r2.object],
|
875
|
+
# :has_member=>[r3.object]},
|
876
|
+
# :inbound=>{}}
|
877
|
+
# test_from_solr_object5.relationships_by_name(false).should == {:inbound=>{"parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[]}, :self=>{"testing2"=>[r3.object], "collection_members"=>[], "part_of"=>[], "testing"=>[r2.object], "parts_outbound"=>[r2.object]}}
|
878
|
+
# #all inbound should now be empty if no parameter supplied to relationships
|
879
|
+
# test_from_solr_object2.relationships.should == {:self=>{:has_part=>[r3.object],:has_member=>[r4.object],:has_model=>[model_rel.object]}}
|
880
|
+
# test_from_solr_object2.relationships_by_name.should == {:self=>{"testing2"=>[r4.object], "collection_members"=>[], "part_of"=>[], "testing"=>[r3.object], "parts_outbound"=>[r3.object]}}
|
881
|
+
# test_from_solr_object3.relationships.should == {:self=>{:has_model=>[model_rel.object]}}
|
882
|
+
# test_from_solr_object3.relationships_by_name.should == {:self=>{"testing2"=>[], "collection_members"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[]}}
|
883
|
+
# test_from_solr_object4.relationships.should == {:self=>{:has_model=>[model_rel.object]}}
|
884
|
+
# test_from_solr_object4.relationships_by_name.should == {:self=>{"testing2"=>[], "collection_members"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[]}}
|
885
|
+
# test_from_solr_object5.relationships.should == {:self=>{:has_model=>[model_rel.object],
|
886
|
+
# :has_part=>[r2.object],
|
887
|
+
# :has_member=>[r3.object]}}
|
888
|
+
# test_from_solr_object5.relationships_by_name.should == {:self=>{"testing2"=>[r3.object], "collection_members"=>[], "part_of"=>[], "testing"=>[r2.object], "parts_outbound"=>[r2.object]}}
|
889
|
+
# # need to check metadata
|
890
|
+
# test_from_solr_object2.fields[:language][:values].should == ["Italian"]
|
891
|
+
# test_from_solr_object2.fields[:creator][:values].should == ["Linguist, A."]
|
892
|
+
# test_from_solr_object2.fields[:geography][:values].should == ["Italy"]
|
893
|
+
# test_from_solr_object2.fields[:title][:values].should == ["Italian and Spanish: A Comparison of Common Phrases"]
|
894
|
+
# test_from_solr_object2.fields[:holding_id][:values].should == ["Holding 1"]
|
895
|
+
#
|
896
|
+
# test_from_solr_object3.fields[:language][:values].should == ["Spanish;Latin"]
|
897
|
+
# test_from_solr_object3.fields[:creator][:values].should == ["Linguist, A."]
|
898
|
+
# test_from_solr_object3.fields[:geography][:values].should == ["Spain"]
|
899
|
+
# test_from_solr_object3.fields[:title][:values].should == ["A study of the evolution of Spanish from Latin"]
|
900
|
+
# test_from_solr_object3.fields[:holding_id][:values].should == ["Holding 2"]
|
901
|
+
#
|
902
|
+
# test_from_solr_object4.fields[:language][:values].should == ["Spanish;Latin"]
|
903
|
+
# test_from_solr_object4.fields[:creator][:values].should == ["Linguist, A."]
|
904
|
+
# test_from_solr_object4.fields[:geography][:values].should == ["Spain"]
|
905
|
+
# test_from_solr_object4.fields[:title][:values].should == ["An obscure look into early nomadic tribes of Spain"]
|
906
|
+
# test_from_solr_object4.fields[:holding_id][:values].should == ["Holding 3"]
|
907
|
+
#
|
908
|
+
# #need to check system modified and system created values correct
|
909
|
+
# # need to implement for nokogiri datastream as well
|
910
|
+
# #false.should == true
|
911
|
+
# end
|
912
|
+
# end
|
913
|
+
#
|
914
|
+
# describe 'load_from_solr using relationship finders'
|
915
|
+
# it 'resulting finder should accept :load_from_solr as :response_format and return object instantiated using load_instance_from_solr' do
|
916
|
+
# # solr_result = mock("solr result")
|
917
|
+
# # SpecNode.create_inbound_relationship_finders("constituents", :is_constituent_of, :inbound => true)
|
918
|
+
# # local_node = SpecNode.new
|
919
|
+
# # mock_repo = mock("repo")
|
920
|
+
# # mock_repo.expects(:find_model).never
|
921
|
+
# # SpecNode.expects(:load_instance_from_solr).times(1)
|
922
|
+
# # local_node.expects(:internal_uri).returns("info:fedora/test:sample_pid")
|
923
|
+
# # ActiveFedora::SolrService.instance.conn.expects(:query).with("is_constituent_of_s:info\\:fedora/test\\:sample_pid").returns(solr_result)
|
924
|
+
# # local_node.constituents(:response_format => :solr).should equal(solr_result)
|
925
|
+
# end
|
926
|
+
#
|
927
|
+
# it 'when an object is loaded via solr instead of fedora it should automatically load objects from finders from solr as well' do
|
928
|
+
# @test_object2 = MockAFBaseFromSolr.new
|
929
|
+
# @test_object2.save
|
930
|
+
# @test_object3 = MockAFBaseFromSolr.new
|
931
|
+
# @test_object3.save
|
932
|
+
# @test_object2.testing_append(@test_object3)
|
933
|
+
# @test_object2.save
|
934
|
+
#
|
935
|
+
# test_object2_from_solr = MockAFBaseFromSolr.load_instance_from_solr(@test_object2.pid)
|
936
|
+
# test_object3_from_solr = MockAFBaseFromSolr.load_instance_from_solr(@test_object3.pid)
|
937
|
+
# MockAFBaseFromSolr.expects(:load_instance_from_solr).times(4)
|
938
|
+
# test_object2_from_solr.testing({:response_format=>:load_from_solr})
|
939
|
+
# test_object3_from_solr.testing_inbound({:response_format=>:load_from_solr})
|
940
|
+
# test_object2_from_solr.testing
|
941
|
+
# test_object3_from_solr.testing_inbound
|
942
|
+
# end
|
943
|
+
#
|
944
|
+
# it 'when a load_from_solr is not set it should not call load_instance_from_solr for finders unless passing option in' do
|
945
|
+
# @test_object2 = MockAFBaseFromSolr.new
|
946
|
+
# @test_object2.save
|
947
|
+
# @test_object3 = MockAFBaseFromSolr.new
|
948
|
+
# @test_object3.save
|
949
|
+
# @test_object2.testing_append(@test_object3)
|
950
|
+
# @test_object2.save
|
951
|
+
#
|
952
|
+
# MockAFBaseFromSolr.expects(:load_instance_from_solr).never()
|
953
|
+
# @test_object2.testing
|
954
|
+
# @test_object3.testing_inbound
|
955
|
+
#
|
956
|
+
# #now try calling with option
|
957
|
+
# MockAFBaseFromSolr.expects(:load_instance_from_solr).twice()
|
958
|
+
# @test_object2.testing({:response_format=>:load_from_solr})
|
959
|
+
# @test_object3.testing_inbound({:response_format=>:load_from_solr})
|
960
|
+
#
|
961
|
+
# #now call other finder method
|
962
|
+
# MockAFBaseFromSolr.expects(:load_instance_from_solr).twice()
|
963
|
+
# @test_object2.testing_from_solr
|
964
|
+
# @test_object3.testing_inbound_from_solr
|
965
|
+
#
|
966
|
+
# end
|
977
967
|
|
978
968
|
end
|