active-fedora 5.2.0 → 5.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/active-fedora.gemspec +1 -1
- data/lib/active_fedora.rb +2 -0
- data/lib/active_fedora/nokogiri_datastream.rb +1 -1
- data/lib/active_fedora/nom_datastream.rb +88 -0
- data/lib/active_fedora/om_datastream.rb +7 -0
- data/lib/active_fedora/qualified_dublin_core_datastream.rb +1 -1
- data/lib/active_fedora/rdf_datastream.rb +1 -2
- data/lib/active_fedora/simple_datastream.rb +1 -1
- data/lib/active_fedora/solr_digital_object.rb +1 -1
- data/lib/active_fedora/version.rb +1 -1
- data/spec/integration/base_spec.rb +1 -1
- data/spec/integration/datastreams_spec.rb +2 -2
- data/spec/integration/full_featured_model_spec.rb +1 -1
- data/spec/integration/ntriples_datastream_spec.rb +12 -0
- data/spec/integration/{nokogiri_datastream_spec.rb → om_datastream_spec.rb} +1 -1
- data/spec/samples/hydra-mods_article_datastream.rb +2 -2
- data/spec/samples/hydra-rights_metadata_datastream.rb +2 -2
- data/spec/samples/marpa-dc_datastream.rb +2 -2
- data/spec/unit/base_active_model_spec.rb +1 -1
- data/spec/unit/base_delegate_spec.rb +1 -1
- data/spec/unit/base_delegate_to_spec.rb +1 -1
- data/spec/unit/base_spec.rb +4 -4
- data/spec/unit/nom_datastream_spec.rb +26 -0
- data/spec/unit/{nokogiri_datastream_spec.rb → om_datastream_spec.rb} +16 -16
- data/spec/unit/solr_digital_object_spec.rb +2 -2
- metadata +13 -9
data/Gemfile
CHANGED
data/active-fedora.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.required_ruby_version = '>= 1.9.3'
|
17
17
|
|
18
18
|
s.add_dependency('rsolr')
|
19
|
-
s.add_dependency('om', '~> 1.8.0
|
19
|
+
s.add_dependency('om', '~> 1.8.0')
|
20
20
|
s.add_dependency('solrizer', '~>2.0.0')
|
21
21
|
s.add_dependency("activeresource", '>= 3.0.0')
|
22
22
|
s.add_dependency("activesupport", '>= 3.0.0')
|
data/lib/active_fedora.rb
CHANGED
@@ -44,7 +44,9 @@ module ActiveFedora #:nodoc:
|
|
44
44
|
autoload :Model
|
45
45
|
autoload :MetadataDatastreamHelper
|
46
46
|
autoload :NokogiriDatastream
|
47
|
+
autoload :NomDatastream
|
47
48
|
autoload :NtriplesRDFDatastream
|
49
|
+
autoload :OmDatastream
|
48
50
|
autoload :Property
|
49
51
|
autoload :Persistence
|
50
52
|
autoload :QualifiedDublinCoreDatastream
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require "nom"
|
2
|
+
|
3
|
+
module ActiveFedora
|
4
|
+
class NomDatastream < Datastream
|
5
|
+
def self.set_terminology &block
|
6
|
+
@terminology = block
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.terminology
|
10
|
+
@terminology
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.default_attributes
|
14
|
+
super.merge(:controlGroup => 'X', :mimeType => 'text/xml')
|
15
|
+
end
|
16
|
+
|
17
|
+
# Create an instance of this class based on xml content
|
18
|
+
# @param [String, File, Nokogiri::XML::Node] xml the xml content to build from
|
19
|
+
# @param [ActiveFedora::MetadataDatastream] tmpl the Datastream object that you are building @default a new instance of this class
|
20
|
+
# Careful! If you call this from a constructor, be sure to provide something 'ie. self' as the @tmpl. Otherwise, you will get an infinite loop!
|
21
|
+
def self.from_xml(xml, tmpl=nil)
|
22
|
+
ds = self.new nil, nil
|
23
|
+
ds.content = xml.to_s
|
24
|
+
ds
|
25
|
+
end
|
26
|
+
|
27
|
+
def ng_xml
|
28
|
+
@ng_xml ||= begin
|
29
|
+
xml = Nokogiri::XML content
|
30
|
+
xml.set_terminology &self.class.terminology
|
31
|
+
xml.nom!
|
32
|
+
xml
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def ng_xml= ng_xml
|
37
|
+
@ng_xml = ng_xml
|
38
|
+
@ng_xml.set_terminology &self.class.terminology
|
39
|
+
content_will_change!
|
40
|
+
@ng_xml
|
41
|
+
end
|
42
|
+
|
43
|
+
def serialize!
|
44
|
+
self.content = @ng_xml.to_s if @ng_xml
|
45
|
+
end
|
46
|
+
|
47
|
+
def content
|
48
|
+
@content || super
|
49
|
+
end
|
50
|
+
|
51
|
+
def content=(content)
|
52
|
+
super
|
53
|
+
@ng_xml = nil
|
54
|
+
end
|
55
|
+
|
56
|
+
def to_solr
|
57
|
+
solr_doc = {}
|
58
|
+
|
59
|
+
ng_xml.terminology.flatten.select { |x| x.options[:index] }.each do |term|
|
60
|
+
term.values.each do |v|
|
61
|
+
Array(term.options[:index]).each do |index_as|
|
62
|
+
solr_doc[index_as] ||= []
|
63
|
+
if v.is_a? Nokogiri::XML::Node
|
64
|
+
solr_doc[index_as] << v.text
|
65
|
+
else
|
66
|
+
solr_doc[index_as] << v
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
solr_doc
|
73
|
+
end
|
74
|
+
|
75
|
+
def method_missing method, *args, &block
|
76
|
+
if ng_xml.respond_to? method
|
77
|
+
ng_xml.send(method, *args, &block)
|
78
|
+
else
|
79
|
+
super
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def respond_to? *args
|
84
|
+
super || self.class.terminology.respond_to?(*args)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
@@ -5,7 +5,7 @@ module ActiveFedora
|
|
5
5
|
#Fedora Dublin Core XML datastreams structure.
|
6
6
|
#
|
7
7
|
#Fields can still be overridden if more specificity is desired (see ActiveFedora::Datastream#fields method).
|
8
|
-
class QualifiedDublinCoreDatastream <
|
8
|
+
class QualifiedDublinCoreDatastream < OmDatastream
|
9
9
|
|
10
10
|
class_attribute :class_fields
|
11
11
|
self.class_fields = []
|
@@ -19,7 +19,7 @@ module ActiveFedora
|
|
19
19
|
missing.each do |dsid|
|
20
20
|
#Initialize the datastreams that are in the solr document, but not found in the classes spec.
|
21
21
|
mime_type = profile_hash['datastreams'][dsid]['dsMIME']
|
22
|
-
ds_class = mime_type =~ /[\/\+]xml$/ ?
|
22
|
+
ds_class = mime_type =~ /[\/\+]xml$/ ? OmDatastream : Datastream
|
23
23
|
@datastreams[dsid] = ds_class.new(self, dsid)
|
24
24
|
end
|
25
25
|
|
@@ -298,7 +298,7 @@ describe ActiveFedora::Base do
|
|
298
298
|
end
|
299
299
|
|
300
300
|
describe ".metadata_streams" do
|
301
|
-
it "should return all of the datastreams from the object that are kinds of
|
301
|
+
it "should return all of the datastreams from the object that are kinds of OmDatastream " do
|
302
302
|
mds1 = ActiveFedora::SimpleDatastream.new(@test_object.inner_object, "md1")
|
303
303
|
mds2 = ActiveFedora::QualifiedDublinCoreDatastream.new(@test_object.inner_object, "qdc")
|
304
304
|
fds = ActiveFedora::Datastream.new(@test_object.inner_object, "fds")
|
@@ -7,8 +7,8 @@ describe ActiveFedora::Datastreams do
|
|
7
7
|
describe "serializing datastreams" do
|
8
8
|
before :all do
|
9
9
|
class TestingMetadataSerializing < ActiveFedora::Base
|
10
|
-
has_metadata :name => "nokogiri_autocreate_on", :autocreate => true, :type => ActiveFedora::
|
11
|
-
has_metadata :name => "nokogiri_autocreate_off", :autocreate => false, :type => ActiveFedora::
|
10
|
+
has_metadata :name => "nokogiri_autocreate_on", :autocreate => true, :type => ActiveFedora::OmDatastream
|
11
|
+
has_metadata :name => "nokogiri_autocreate_off", :autocreate => false, :type => ActiveFedora::OmDatastream
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -28,7 +28,7 @@ describe ActiveFedora::Base do
|
|
28
28
|
m.field "location", :string
|
29
29
|
end
|
30
30
|
|
31
|
-
# has_metadata :name=>"arbitrary_xml", :type=> ActiveFedora::
|
31
|
+
# has_metadata :name=>"arbitrary_xml", :type=> ActiveFedora::OmDatastream do |m|
|
32
32
|
# m.root_property :myxml, "my_xml", "http://www.example.gov/schema/v3"
|
33
33
|
# end
|
34
34
|
|
@@ -26,6 +26,18 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
26
26
|
Object.send(:remove_const, :MyDatastream)
|
27
27
|
end
|
28
28
|
|
29
|
+
it "should set and recall" do
|
30
|
+
@subject.title = "John Doe"
|
31
|
+
@subject.save
|
32
|
+
f = RdfTest.find(@subject.pid)
|
33
|
+
f.title.should == "John Doe"
|
34
|
+
f.title = "Jane Doe"
|
35
|
+
f.save
|
36
|
+
new_object = RdfTest.find(@subject.pid)
|
37
|
+
new_object.title.should == "Jane Doe"
|
38
|
+
|
39
|
+
end
|
40
|
+
|
29
41
|
it "should set and recall values" do
|
30
42
|
@subject.title = 'War and Peace'
|
31
43
|
@subject.based_near = "Moscow, Russia"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "active-fedora"
|
2
2
|
module Hydra
|
3
3
|
|
4
|
-
# This is an example of a
|
4
|
+
# This is an example of a OmDatastream that defines an OM terminology for MODS xml
|
5
5
|
# It focuses on the aspects of MODS that deal with descriptive metadata for published articles
|
6
6
|
# This is not the hydra-head plugin version of this OM Terminology; See https://github.com/projecthydra/hydra-head/blob/master/lib/hydra/mods_article.rb
|
7
7
|
#
|
@@ -18,7 +18,7 @@ module Hydra
|
|
18
18
|
# * Defines a series of templates, person_template, organization_template, etc. for generating a whole set of xml nodes to insert into the document (note: the new OM::TemplateRegistry provides an even better way to do this)
|
19
19
|
# * Defines a custom method, insert_contributor, that uses the Terminology to manipulate xml documents in specialized ways
|
20
20
|
# * Defines a series of relator_term Hashes that can then be used when generating views, etc. In this case, the Hashes are hard-coded into the Class. Ideally, they might be read from a configuration file or mixed into the class using a module
|
21
|
-
class ModsArticleDatastream < ActiveFedora::
|
21
|
+
class ModsArticleDatastream < ActiveFedora::OmDatastream
|
22
22
|
|
23
23
|
set_terminology do |t|
|
24
24
|
t.root(:path=>"mods", :xmlns=>"http://www.loc.gov/mods/v3", :schema=>"http://www.loc.gov/standards/mods/v3/mods-3-2.xsd")
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Hydra
|
2
|
-
# This is an example of a
|
2
|
+
# This is an example of a OmDatastream that defines a terminology for Hydra rightsMetadata xml
|
3
3
|
# The documentation for Hydra rightsMetadata is on the Hydra wiki at https://wiki.duraspace.org/display/hydra/Hydra+rights+metadata
|
4
4
|
# The real version of this Terminology is part of the hydra-head plugin. See https://github.com/projecthydra/hydra-head/blob/master/lib/hydra/rights_metadata.rb
|
5
5
|
#
|
@@ -12,7 +12,7 @@ module Hydra
|
|
12
12
|
#
|
13
13
|
# Another interesting thing in this Class: it extends to_solr, first calling "super" (the default to_solr behavior) and then inserting an additional embargo_release_date_dt field
|
14
14
|
# It uses Solrizer::Extractor.insert_solr_field_value to do this. That method handles inserting new values into a Hash while ensuring that you don't destroy or overwrite any existing values in the hash.
|
15
|
-
class RightsMetadataDatastream < ActiveFedora::
|
15
|
+
class RightsMetadataDatastream < ActiveFedora::OmDatastream
|
16
16
|
|
17
17
|
set_terminology do |t|
|
18
18
|
t.root(:path=>"rightsMetadata", :xmlns=>"http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1", :schema=>"http://github.com/projecthydra/schemas/tree/v1/rightsMetadata.xsd")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "active-fedora"
|
2
2
|
module Marpa
|
3
3
|
|
4
|
-
# This is an example of a
|
4
|
+
# This is an example of a OmDatastream that defines a terminology for Dublin Core xml
|
5
5
|
#
|
6
6
|
# Some things to observe about this Class:
|
7
7
|
# * Defines a couple of custom terms, tibetan_title and english_title, that map to dc:title with varying @language attributes
|
@@ -10,7 +10,7 @@ module Marpa
|
|
10
10
|
# * Sets the namespace using :xmlns argument on the root term
|
11
11
|
# * Does not override or extend to_solr, so the default solrization approach will be used (Solrizer::XML::TerminologyBasedSolrizer)
|
12
12
|
#
|
13
|
-
class DcDatastream < ActiveFedora::
|
13
|
+
class DcDatastream < ActiveFedora::OmDatastream
|
14
14
|
|
15
15
|
set_terminology do |t|
|
16
16
|
t.root(:path=>"dc", :xmlns=>'http://purl.org/dc/terms/')
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe ActiveFedora::Base do
|
4
4
|
|
5
5
|
describe "active model methods" do
|
6
|
-
class BarStream < ActiveFedora::
|
6
|
+
class BarStream < ActiveFedora::OmDatastream
|
7
7
|
set_terminology do |t|
|
8
8
|
t.root(:path=>"first", :xmlns=>"urn:foobar")
|
9
9
|
t.duck()
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe ActiveFedora::Base do
|
4
4
|
|
5
5
|
describe "first level delegation" do
|
6
|
-
class BarStream2 < ActiveFedora::
|
6
|
+
class BarStream2 < ActiveFedora::OmDatastream
|
7
7
|
set_terminology do |t|
|
8
8
|
t.root(:path=>"animals", :xmlns=>"urn:zoobar")
|
9
9
|
t.waterfowl do
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe ActiveFedora::Base do
|
4
4
|
|
5
5
|
describe "deletgating multiple terms to one datastream" do
|
6
|
-
class BarnyardDocument < ActiveFedora::
|
6
|
+
class BarnyardDocument < ActiveFedora::OmDatastream
|
7
7
|
set_terminology do |t|
|
8
8
|
t.root(:path=>"animals", :xmlns=>"urn:zoobar")
|
9
9
|
t.waterfowl do
|
data/spec/unit/base_spec.rb
CHANGED
@@ -92,7 +92,7 @@ describe ActiveFedora::Base do
|
|
92
92
|
delegate :swank, :to=>'someData'
|
93
93
|
end
|
94
94
|
class FooAdaptation < ActiveFedora::Base
|
95
|
-
has_metadata :type=>ActiveFedora::
|
95
|
+
has_metadata :type=>ActiveFedora::OmDatastream, :name=>'someData'
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -145,7 +145,7 @@ describe ActiveFedora::Base do
|
|
145
145
|
|
146
146
|
describe ".datastream_class_for_name" do
|
147
147
|
it "should return the specifed class" do
|
148
|
-
FooAdaptation.datastream_class_for_name('someData').should == ActiveFedora::
|
148
|
+
FooAdaptation.datastream_class_for_name('someData').should == ActiveFedora::OmDatastream
|
149
149
|
end
|
150
150
|
it "should return the specifed class" do
|
151
151
|
FooAdaptation.datastream_class_for_name('content').should == ActiveFedora::Datastream
|
@@ -367,7 +367,7 @@ describe ActiveFedora::Base do
|
|
367
367
|
@test_object = FooHistory.new()
|
368
368
|
adapted = @test_object.adapt_to(FooAdaptation)
|
369
369
|
adapted.datastreams.keys.should include 'someData'
|
370
|
-
adapted.datastreams['someData'].class.should == ActiveFedora::
|
370
|
+
adapted.datastreams['someData'].class.should == ActiveFedora::OmDatastream
|
371
371
|
end
|
372
372
|
end
|
373
373
|
|
@@ -441,7 +441,7 @@ describe ActiveFedora::Base do
|
|
441
441
|
solr_doc["active_fedora_model_field"].should eql(@test_object.class.inspect)
|
442
442
|
end
|
443
443
|
|
444
|
-
it "should call .to_solr on all SimpleDatastreams and
|
444
|
+
it "should call .to_solr on all SimpleDatastreams and OmDatastreams, passing the resulting document to solr" do
|
445
445
|
mock1 = mock("ds1", :to_solr => {})
|
446
446
|
mock2 = mock("ds2", :to_solr => {})
|
447
447
|
ngds = mock("ngds", :to_solr => {})
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ActiveFedora::NomDatastream do
|
4
|
+
describe "test" do
|
5
|
+
subject {
|
6
|
+
class MyNomDatastream < ActiveFedora::NomDatastream
|
7
|
+
|
8
|
+
set_terminology do |t|
|
9
|
+
t.a :path => '//a', :accessor => lambda { |x| x.text }, :index => 'a_s'
|
10
|
+
t.b :path => '//b', :index => 'b_s'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
MyNomDatastream.from_xml '<root><a>123</a><b><c>asdf</c></b></root>'
|
15
|
+
}
|
16
|
+
|
17
|
+
it "should work" do
|
18
|
+
subject.a.should include("123")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should to_solr" do
|
22
|
+
subject.to_solr['a_s'].should include('123')
|
23
|
+
subject.to_solr['b_s'].should include('asdf')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
describe ActiveFedora::
|
2
|
+
describe ActiveFedora::OmDatastream do
|
3
3
|
|
4
4
|
before(:all) do
|
5
5
|
@sample_fields = {:publisher => {:values => ["publisher1"], :type => :string},
|
@@ -19,7 +19,7 @@ describe ActiveFedora::NokogiriDatastream do
|
|
19
19
|
@mock_inner.stub(:repository).and_return(@mock_repo)
|
20
20
|
@mock_inner.stub(:pid)
|
21
21
|
@mock_inner.stub(:new? => false)
|
22
|
-
@test_ds = ActiveFedora::
|
22
|
+
@test_ds = ActiveFedora::OmDatastream.new(@mock_inner, "descMetadata")
|
23
23
|
@test_ds.stub(:new? => false, :profile => {}, :datastream_content => '<test_xml/>')
|
24
24
|
@test_ds.content="<test_xml/>"
|
25
25
|
end
|
@@ -30,34 +30,34 @@ describe ActiveFedora::NokogiriDatastream do
|
|
30
30
|
its(:metadata?) { should be_true}
|
31
31
|
|
32
32
|
it "should include the Solrizer::XML::TerminologyBasedSolrizer for .to_solr support" do
|
33
|
-
ActiveFedora::
|
33
|
+
ActiveFedora::OmDatastream.included_modules.should include(Solrizer::XML::TerminologyBasedSolrizer)
|
34
34
|
end
|
35
35
|
|
36
36
|
describe '#new' do
|
37
37
|
it 'should provide #new' do
|
38
|
-
ActiveFedora::
|
38
|
+
ActiveFedora::OmDatastream.should respond_to(:new)
|
39
39
|
@test_ds.ng_xml.should be_instance_of(Nokogiri::XML::Document)
|
40
40
|
end
|
41
41
|
it 'should load xml from blob if provided' do
|
42
|
-
test_ds1 = ActiveFedora::
|
42
|
+
test_ds1 = ActiveFedora::OmDatastream.new(nil, 'ds1')
|
43
43
|
test_ds1.content="<xml><foo/></xml>"
|
44
44
|
test_ds1.ng_xml.to_xml.should == "<?xml version=\"1.0\"?>\n<xml>\n <foo/>\n</xml>\n"
|
45
45
|
end
|
46
46
|
it "should initialize from #xml_template if no xml is provided" do
|
47
|
-
ActiveFedora::
|
48
|
-
n = ActiveFedora::
|
47
|
+
ActiveFedora::OmDatastream.should_receive(:xml_template).and_return("<fake template/>")
|
48
|
+
n = ActiveFedora::OmDatastream.new
|
49
49
|
n.ng_xml.should be_equivalent_to("<fake template/>")
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
describe '#xml_template' do
|
54
54
|
it "should return an empty xml document" do
|
55
|
-
ActiveFedora::
|
55
|
+
ActiveFedora::OmDatastream.xml_template.to_xml.should == "<?xml version=\"1.0\"?>\n<xml/>\n"
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
describe "an instance" do
|
60
|
-
subject { ActiveFedora::
|
60
|
+
subject { ActiveFedora::OmDatastream.new }
|
61
61
|
it{ should.respond_to? :to_solr }
|
62
62
|
its(:to_solr) {should == { }}
|
63
63
|
end
|
@@ -153,7 +153,7 @@ describe ActiveFedora::NokogiriDatastream do
|
|
153
153
|
@mods_ds.get_values("--my xpath--").should == ["value1", "value2"]
|
154
154
|
end
|
155
155
|
it "should assume that field_names that are strings are xpath queries" do
|
156
|
-
ActiveFedora::
|
156
|
+
ActiveFedora::OmDatastream.should_receive(:accessor_xpath).never
|
157
157
|
@mods_ds.should_receive(:term_values).with("--my xpath--").and_return(["abstract1", "abstract2"])
|
158
158
|
@mods_ds.get_values("--my xpath--").should == ["abstract1", "abstract2"]
|
159
159
|
end
|
@@ -188,7 +188,7 @@ describe ActiveFedora::NokogiriDatastream do
|
|
188
188
|
end
|
189
189
|
|
190
190
|
describe '.content=' do
|
191
|
-
subject { ActiveFedora::
|
191
|
+
subject { ActiveFedora::OmDatastream.new(@mock_inner, "descMetadata") }
|
192
192
|
it "should update the content" do
|
193
193
|
subject.stub(:new? => false )
|
194
194
|
subject.content = "<a />"
|
@@ -211,7 +211,7 @@ describe ActiveFedora::NokogiriDatastream do
|
|
211
211
|
|
212
212
|
describe 'ng_xml=' do
|
213
213
|
before do
|
214
|
-
@test_ds2 = ActiveFedora::
|
214
|
+
@test_ds2 = ActiveFedora::OmDatastream.new(@mock_inner, "descMetadata")
|
215
215
|
end
|
216
216
|
it "should parse raw xml for you" do
|
217
217
|
@test_ds2.ng_xml = @sample_raw_xml
|
@@ -275,7 +275,7 @@ describe ActiveFedora::NokogiriDatastream do
|
|
275
275
|
|
276
276
|
describe '.get_values_from_solr' do
|
277
277
|
before(:each) do
|
278
|
-
@mods_ds = ActiveFedora::
|
278
|
+
@mods_ds = ActiveFedora::OmDatastream.new
|
279
279
|
@mods_ds.content=fixture(File.join("mods_articles","hydrangea_article1.xml")).read
|
280
280
|
end
|
281
281
|
|
@@ -288,7 +288,7 @@ describe ActiveFedora::NokogiriDatastream do
|
|
288
288
|
mock_term.stub(:type).and_return(:text)
|
289
289
|
mock_terminology = mock("OM::XML::Terminology")
|
290
290
|
mock_terminology.stub(:retrieve_term).and_return(mock_term)
|
291
|
-
ActiveFedora::
|
291
|
+
ActiveFedora::OmDatastream.stub(:terminology).and_return(mock_terminology)
|
292
292
|
@mods_ds.from_solr(@solr_doc)
|
293
293
|
term_pointer = [:name,:role,:roleTerm]
|
294
294
|
@mods_ds.get_values_from_solr(:name,:role,:roleTerm).should == ["creator","submitter","teacher"]
|
@@ -331,7 +331,7 @@ describe ActiveFedora::NokogiriDatastream do
|
|
331
331
|
|
332
332
|
describe '.update_values' do
|
333
333
|
before(:each) do
|
334
|
-
@mods_ds = ActiveFedora::
|
334
|
+
@mods_ds = ActiveFedora::OmDatastream.new
|
335
335
|
@mods_ds.content= fixture(File.join("mods_articles","hydrangea_article1.xml")).read
|
336
336
|
end
|
337
337
|
|
@@ -363,7 +363,7 @@ describe ActiveFedora::NokogiriDatastream do
|
|
363
363
|
describe '.term_values' do
|
364
364
|
|
365
365
|
before(:each) do
|
366
|
-
@mods_ds = ActiveFedora::
|
366
|
+
@mods_ds = ActiveFedora::OmDatastream.new
|
367
367
|
@mods_ds.content=fixture(File.join("mods_articles","hydrangea_article1.xml")).read
|
368
368
|
end
|
369
369
|
|
@@ -30,14 +30,14 @@ describe ActiveFedora::SolrDigitalObject do
|
|
30
30
|
end
|
31
31
|
subject { ActiveFedora::SolrDigitalObject.new({}, {'datastreams'=>{'properties'=>{'dsMIME'=>'text/xml'}}},WithoutMetadataDs) }
|
32
32
|
it "should create an xml datastream" do
|
33
|
-
subject.datastreams['properties'].should be_kind_of ActiveFedora::
|
33
|
+
subject.datastreams['properties'].should be_kind_of ActiveFedora::OmDatastream
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
describe "with a ds spec that's not part of the solrized object" do
|
38
38
|
before do
|
39
39
|
class MissingMetadataDs < ActiveFedora::Base
|
40
|
-
has_metadata :name => "foo", :type => ActiveFedora::
|
40
|
+
has_metadata :name => "foo", :type => ActiveFedora::OmDatastream, :label => 'Foo Data'
|
41
41
|
end
|
42
42
|
after do
|
43
43
|
Object.send(:remove_const, MissingMetadataDs)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-fedora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.2.
|
4
|
+
version: 5.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-12-
|
14
|
+
date: 2012-12-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rsolr
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ~>
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 1.8.0
|
39
|
+
version: 1.8.0
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.8.0
|
47
|
+
version: 1.8.0
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: solrizer
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -350,7 +350,9 @@ files:
|
|
350
350
|
- lib/active_fedora/named_relationships.rb
|
351
351
|
- lib/active_fedora/nested_attributes.rb
|
352
352
|
- lib/active_fedora/nokogiri_datastream.rb
|
353
|
+
- lib/active_fedora/nom_datastream.rb
|
353
354
|
- lib/active_fedora/ntriples_rdf_datastream.rb
|
355
|
+
- lib/active_fedora/om_datastream.rb
|
354
356
|
- lib/active_fedora/persistence.rb
|
355
357
|
- lib/active_fedora/predicates.rb
|
356
358
|
- lib/active_fedora/property.rb
|
@@ -428,8 +430,8 @@ files:
|
|
428
430
|
- spec/integration/model_spec.rb
|
429
431
|
- spec/integration/mods_article_integration_spec.rb
|
430
432
|
- spec/integration/nested_attribute_spec.rb
|
431
|
-
- spec/integration/nokogiri_datastream_spec.rb
|
432
433
|
- spec/integration/ntriples_datastream_spec.rb
|
434
|
+
- spec/integration/om_datastream_spec.rb
|
433
435
|
- spec/integration/persistence_spec.rb
|
434
436
|
- spec/integration/rels_ext_datastream_spec.rb
|
435
437
|
- spec/integration/semantic_node_spec.rb
|
@@ -502,8 +504,9 @@ files:
|
|
502
504
|
- spec/unit/has_many_collection_spec.rb
|
503
505
|
- spec/unit/inheritance_spec.rb
|
504
506
|
- spec/unit/model_spec.rb
|
505
|
-
- spec/unit/
|
507
|
+
- spec/unit/nom_datastream_spec.rb
|
506
508
|
- spec/unit/ntriples_datastream_spec.rb
|
509
|
+
- spec/unit/om_datastream_spec.rb
|
507
510
|
- spec/unit/persistence_spec.rb
|
508
511
|
- spec/unit/predicates_spec.rb
|
509
512
|
- spec/unit/property_spec.rb
|
@@ -544,7 +547,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
544
547
|
version: '0'
|
545
548
|
segments:
|
546
549
|
- 0
|
547
|
-
hash:
|
550
|
+
hash: -1381095155313457398
|
548
551
|
requirements: []
|
549
552
|
rubyforge_project: rubyfedora
|
550
553
|
rubygems_version: 1.8.23
|
@@ -585,8 +588,8 @@ test_files:
|
|
585
588
|
- spec/integration/model_spec.rb
|
586
589
|
- spec/integration/mods_article_integration_spec.rb
|
587
590
|
- spec/integration/nested_attribute_spec.rb
|
588
|
-
- spec/integration/nokogiri_datastream_spec.rb
|
589
591
|
- spec/integration/ntriples_datastream_spec.rb
|
592
|
+
- spec/integration/om_datastream_spec.rb
|
590
593
|
- spec/integration/persistence_spec.rb
|
591
594
|
- spec/integration/rels_ext_datastream_spec.rb
|
592
595
|
- spec/integration/semantic_node_spec.rb
|
@@ -659,8 +662,9 @@ test_files:
|
|
659
662
|
- spec/unit/has_many_collection_spec.rb
|
660
663
|
- spec/unit/inheritance_spec.rb
|
661
664
|
- spec/unit/model_spec.rb
|
662
|
-
- spec/unit/
|
665
|
+
- spec/unit/nom_datastream_spec.rb
|
663
666
|
- spec/unit/ntriples_datastream_spec.rb
|
667
|
+
- spec/unit/om_datastream_spec.rb
|
664
668
|
- spec/unit/persistence_spec.rb
|
665
669
|
- spec/unit/predicates_spec.rb
|
666
670
|
- spec/unit/property_spec.rb
|