active-fedora 11.0.0.rc6 → 11.0.0.rc7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/active-fedora.gemspec +0 -3
  3. data/lib/active_fedora.rb +0 -10
  4. data/lib/active_fedora/associations/has_many_association.rb +1 -1
  5. data/lib/active_fedora/attributes.rb +1 -1
  6. data/lib/active_fedora/base.rb +3 -7
  7. data/lib/active_fedora/querying.rb +1 -1
  8. data/lib/active_fedora/rdf.rb +0 -1
  9. data/lib/active_fedora/version.rb +1 -1
  10. data/spec/integration/attached_files_spec.rb +14 -4
  11. data/spec/integration/file_spec.rb +22 -23
  12. data/spec/integration/versionable_spec.rb +0 -254
  13. data/spec/spec_helper.rb +0 -7
  14. data/spec/unit/attached_files_spec.rb +10 -7
  15. data/spec/unit/base_spec.rb +3 -1
  16. data/spec/unit/has_many_association_spec.rb +23 -8
  17. data/spec/unit/inheritance_spec.rb +11 -7
  18. data/spec/unit/model_classifier_spec.rb +1 -1
  19. data/spec/unit/rdf/indexing_service_spec.rb +9 -9
  20. data/spec/unit/solr_config_options_spec.rb +12 -15
  21. metadata +2 -67
  22. data/lib/active_fedora/datastreams.rb +0 -6
  23. data/lib/active_fedora/datastreams/nokogiri_datastreams.rb +0 -119
  24. data/lib/active_fedora/nom_datastream.rb +0 -73
  25. data/lib/active_fedora/om_datastream.rb +0 -118
  26. data/lib/active_fedora/qualified_dublin_core_datastream.rb +0 -158
  27. data/lib/active_fedora/rdf/datastream_indexing.rb +0 -49
  28. data/lib/active_fedora/rdf/ntriples_rdf_datastream.rb +0 -13
  29. data/lib/active_fedora/rdf/rdf_datastream.rb +0 -173
  30. data/lib/active_fedora/rdf/rdfxml_datastream.rb +0 -13
  31. data/spec/integration/complex_rdf_datastream_spec.rb +0 -227
  32. data/spec/integration/datastream_rdf_nested_attributes_spec.rb +0 -180
  33. data/spec/integration/ntriples_datastream_spec.rb +0 -215
  34. data/spec/integration/om_datastream_spec.rb +0 -78
  35. data/spec/samples/hydra-mods_article_datastream.rb +0 -515
  36. data/spec/samples/models/mods_article.rb +0 -9
  37. data/spec/samples/samples.rb +0 -2
  38. data/spec/unit/nom_datastream_spec.rb +0 -60
  39. data/spec/unit/ntriples_datastream_spec.rb +0 -167
  40. data/spec/unit/om_datastream_spec.rb +0 -294
  41. data/spec/unit/qualified_dublin_core_datastream_spec.rb +0 -119
  42. data/spec/unit/rdf_datastream_spec.rb +0 -84
  43. data/spec/unit/rdf_resource_datastream_spec.rb +0 -208
  44. data/spec/unit/rdfxml_datastream_spec.rb +0 -106
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26d41f24c20c93a9161b7930e013a3201ecab4e1
4
- data.tar.gz: d1fb36e1bf445e44e211cff333c65b6cc6357e19
3
+ metadata.gz: cc7a3946a47ca155b5b2e9fa9f62514e4be440c8
4
+ data.tar.gz: c64e65c2107219cc400cbd66f586388fd0a3e6cc
5
5
  SHA512:
6
- metadata.gz: accce0bdf13ec9932e10482464883b8fe25cfe3f1a129cd2646bccd1cdce952cad633ef07f6e38a5e2d2168ece295156dc44e6334225e7ee8fdeaf39a5c58fcb
7
- data.tar.gz: 88b3d9cb64352cd5e3ccaaf2c4c1eec3a43c59e437a9deaecfe653fdb248db00a5d5658ba05abe202c27dfb9f3ac03f8d4eed440a9dfc00406ac144c211b6cf5
6
+ metadata.gz: cd127fc65d51bcc2421d4be1693a5332ff4d14cdbea316fab935fb425b5527371fade8a5ee9c7d079119e613040dec9e35a71bfc29fdf7fac4a09287c1f49df3
7
+ data.tar.gz: 7781a22aa37f934c60bef92898d8c02cbd7cff702272e8f855b9f03b65179a602d2186ee43b4f58bc63fa3b750df40b5b6e6fb1bc781a941bc5b4029624e7330
@@ -16,12 +16,9 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.add_dependency 'rsolr', '~> 1.0', '>= 1.0.10'
18
18
  s.add_dependency 'solrizer', '~> 3.4'
19
- s.add_dependency 'om', '~> 3.1'
20
- s.add_dependency 'nom-xml', '>= 0.5.1'
21
19
  s.add_dependency "activesupport", '>= 4.2.4', '< 6'
22
20
  s.add_dependency "activemodel", '>= 4.2', '< 6'
23
21
  s.add_dependency "active-triples", '~> 0.10.0'
24
- s.add_dependency "rdf-rdfxml"
25
22
  s.add_dependency "deprecation"
26
23
  s.add_dependency "ldp", '~> 0.6.0'
27
24
 
@@ -59,7 +59,6 @@ module ActiveFedora #:nodoc:
59
59
  autoload :DirectContainer
60
60
  autoload :IndirectContainer
61
61
  end
62
- autoload :Datastreams
63
62
  autoload :DelegatedAttribute
64
63
  autoload_under 'attributes' do
65
64
  autoload :ActiveTripleAttribute
@@ -89,23 +88,14 @@ module ActiveFedora #:nodoc:
89
88
  autoload :LoadableFromJson
90
89
  autoload :ModelClassifier
91
90
  autoload :NestedAttributes
92
- autoload :NomDatastream
93
91
  autoload :NullRelation
94
- autoload :OmDatastream
95
92
  autoload :Orders
96
93
  autoload :Pathing
97
94
  autoload :Persistence
98
95
  autoload :Property
99
- autoload :QualifiedDublinCoreDatastream
100
96
  autoload :Querying
101
97
  autoload :QueryResultBuilder
102
98
  autoload :RDF
103
- autoload_under 'rdf' do
104
- autoload :RDFDatastream
105
- autoload :RDFXMLDatastream
106
- autoload :NtriplesRDFDatastream
107
- autoload :FedoraRdfResource
108
- end
109
99
  autoload :Reflection
110
100
  autoload :Relation
111
101
 
@@ -83,7 +83,7 @@ module ActiveFedora
83
83
  protected
84
84
 
85
85
  def find_polymorphic_inverse(record)
86
- record.reflections.values.find { |r| !r.has_many? && r.options[:property] == reflection.options[:property] }
86
+ record.reflections.values.find { |r| !r.has_many? && r.predicate == reflection.predicate }
87
87
  end
88
88
 
89
89
  # Deletes the records according to the <tt>:dependent</tt> option.
@@ -144,7 +144,7 @@ module ActiveFedora
144
144
 
145
145
  # @param [Symbol] field the field to find or create
146
146
  # @param [Class] klass the class to use to delegate the attribute (e.g.
147
- # ActiveTripleAttribute, OmAttribute, or RdfDatastreamAttribute)
147
+ # ActiveTripleAttribute)
148
148
  # @param [Hash] args
149
149
  # @option args [String] :delegate_target the path to the delegate
150
150
  # @option args [Class] :klass the class to create
@@ -10,16 +10,12 @@ module ActiveFedora
10
10
  #
11
11
  # =The Basics
12
12
  # class Oralhistory < ActiveFedora::Base
13
- # has_metadata "properties", type: ActiveFedora::SimpleDatastream do |m|
14
- # m.field "narrator", :string
15
- # m.field "narrator", :text
16
- # end
13
+ # property :creator, predicate: RDF::Vocab::DC.creator
17
14
  # end
18
15
  #
19
- # The above example creates a Fedora object with a metadata datastream named "properties", which is composed of a
20
- # narrator and bio field.
16
+ # The above example creates a Fedora object with a property named "creator"
21
17
  #
22
- # Attached files defined with +contains+ are accessed via the +attached_files+ member hash.
18
+ # Attached files defined with +has_subresource+ and iis accessed via the +attached_files+ member hash.
23
19
  #
24
20
  class Base
25
21
  extend ActiveModel::Naming
@@ -1,7 +1,7 @@
1
1
  module ActiveFedora
2
2
  module Querying
3
3
  delegate :find, :first, :exists?, :where, :limit, :offset, :order, :delete_all,
4
- :destroy_all, :count, :last, :find_with_conditions, :find_in_batches, :search_with_conditions, :search_in_batches, :search_by_id, :find_each, to: :all
4
+ :destroy_all, :count, :last, :search_with_conditions, :search_in_batches, :search_by_id, :find_each, to: :all
5
5
 
6
6
  def self.extended(base)
7
7
  base.class_attribute :solr_query_handler
@@ -1,7 +1,6 @@
1
1
  module ActiveFedora
2
2
  module RDF
3
3
  extend ActiveSupport::Autoload
4
- autoload :DatastreamIndexing
5
4
  autoload :Fcrepo
6
5
  autoload :IndexingService
7
6
  autoload :Persistence
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "11.0.0.rc6".freeze
2
+ VERSION = "11.0.0.rc7".freeze
3
3
  end
@@ -79,16 +79,26 @@ describe ActiveFedora::AttachedFiles do
79
79
  end
80
80
 
81
81
  describe ".metadata_streams" do
82
- let(:mds1) { ActiveFedora::QualifiedDublinCoreDatastream.new }
83
- let(:mds2) { ActiveFedora::QualifiedDublinCoreDatastream.new }
84
- let(:fds) { ActiveFedora::File.new }
85
82
  before do
86
- fds = ActiveFedora::File.new
83
+ class Metadata < ActiveFedora::File
84
+ def metadata?
85
+ true
86
+ end
87
+ end
88
+
87
89
  obj.attach_file(mds1, 'md1')
88
90
  obj.attach_file(mds2, 'qdc')
89
91
  obj.attach_file(fds, 'fds')
90
92
  end
91
93
 
94
+ let(:mds1) { Metadata.new }
95
+ let(:mds2) { Metadata.new }
96
+ let(:fds) { ActiveFedora::File.new }
97
+
98
+ after do
99
+ Object.send(:remove_const, :Metadata)
100
+ end
101
+
92
102
  it "returns all of the datastreams from the object that are kinds of OmDatastream" do
93
103
  expect(obj.metadata_streams).to match_array [mds1, mds2]
94
104
  end
@@ -54,53 +54,52 @@ describe ActiveFedora::File do
54
54
  context "with a sub-resource that autocreates" do
55
55
  before do
56
56
  class MockAFBase < ActiveFedora::Base
57
- has_subresource "descMetadata", class_name: 'ActiveFedora::QualifiedDublinCoreDatastream', autocreate: true
57
+ has_subresource "descMetadata", class_name: 'SampleResource', autocreate: true
58
+ end
59
+
60
+ class SampleResource < ActiveFedora::File
61
+ def content
62
+ 'something to save'
63
+ end
58
64
  end
59
65
  end
60
66
 
61
67
  after do
68
+ Object.send(:remove_const, :SampleResource)
62
69
  Object.send(:remove_const, :MockAFBase)
63
70
  end
64
71
 
65
72
  let(:test_object) { MockAFBase.create }
66
73
  let(:descMetadata) { test_object.descMetadata }
67
74
 
68
- describe "#content" do
69
- subject { descMetadata.content }
70
- it { should_not be_nil }
71
- end
72
-
73
- describe "#described_by" do
74
- subject { descMetadata.described_by }
75
- it { should eq descMetadata.uri + '/fcr:metadata' }
75
+ describe "changed attributes are set" do
76
+ it "marks profile as changed" do
77
+ expect_any_instance_of(SampleResource).to receive(:attribute_will_change!).with(:profile)
78
+ test_object
79
+ end
76
80
  end
77
81
 
78
- context "an XML file" do
79
- let(:xml_content) { Nokogiri::XML::Document.parse(descMetadata.content) }
80
- let(:title) { Nokogiri::XML::Element.new "title", xml_content }
82
+ describe "content_changed? is called" do
81
83
  before do
82
- title.content = "Test Title"
83
- xml_content.root.add_child title
84
- allow(descMetadata).to receive(:before_save)
85
- descMetadata.content = xml_content.to_s
86
- descMetadata.save
84
+ allow_any_instance_of(SampleResource).to receive(:content_changed?).and_return(true)
87
85
  end
88
-
89
- let(:found) { Nokogiri::XML::Document.parse(test_object.reload.descMetadata.content) }
90
-
91
- subject { found.xpath('//dc/title/text()').first.inner_text }
92
- it { should eq title.content }
86
+ subject { descMetadata.described_by }
87
+ it { should eq descMetadata.uri + '/fcr:metadata' }
93
88
  end
94
89
  end
95
90
 
96
91
  context "with a sub-resource" do
97
92
  before do
98
93
  class MockAFBase < ActiveFedora::Base
99
- has_subresource "descMetadata", class_name: 'ActiveFedora::QualifiedDublinCoreDatastream'
94
+ has_subresource "descMetadata", class_name: 'SampleResource'
95
+ end
96
+
97
+ class SampleResource < ActiveFedora::File
100
98
  end
101
99
  end
102
100
 
103
101
  after do
102
+ Object.send(:remove_const, :SampleResource)
104
103
  Object.send(:remove_const, :MockAFBase)
105
104
  end
106
105
 
@@ -126,260 +126,6 @@ describe ActiveFedora::Versionable do
126
126
  end
127
127
  end
128
128
 
129
- describe ActiveFedora::NtriplesRDFDatastream do
130
- before(:all) do
131
- class VersionableDatastream < ActiveFedora::NtriplesRDFDatastream
132
- property :title, predicate: ::RDF::Vocab::DC.title
133
- end
134
-
135
- class MockAFBase < ActiveFedora::Base
136
- has_subresource "descMetadata", class_name: 'VersionableDatastream', autocreate: true
137
- end
138
- end
139
-
140
- after(:all) do
141
- Object.send(:remove_const, :MockAFBase)
142
- Object.send(:remove_const, :VersionableDatastream)
143
- end
144
-
145
- it "creates the object" do
146
- MockAFBase.create
147
- end
148
-
149
- subject(:desc_metadata) { test_object.descMetadata }
150
-
151
- let(:current_year) { DateTime.now.year.to_s }
152
-
153
- context "that exists in the repository" do
154
- let(:test_object) { MockAFBase.create }
155
-
156
- context "before creating the file" do
157
- it "does not have versions" do
158
- expect(desc_metadata.versions).to be_empty
159
- end
160
- it "does not have a title" do
161
- expect(desc_metadata.title).to be_empty
162
- end
163
- end
164
-
165
- context "after creating the file" do
166
- before do
167
- desc_metadata.title = "Greetings Earthlings"
168
- desc_metadata.save
169
- desc_metadata.create_version
170
- @original_size = desc_metadata.size
171
- end
172
-
173
- it "links to versions endpoint" do
174
- expect(desc_metadata.metadata.ldp_source.graph.query(predicate: ::RDF::Vocab::Fcrepo4.hasVersions).objects).to_not be_empty
175
- end
176
-
177
- it "has one version" do
178
- expect(desc_metadata.versions.first.label).to eql "version1"
179
- end
180
-
181
- it "has a title" do
182
- expect(desc_metadata.title).to eq(["Greetings Earthlings"])
183
- end
184
-
185
- it "has a size" do
186
- expect(desc_metadata.size).to_not be_nil
187
- end
188
-
189
- context "two times" do
190
- before do
191
- desc_metadata.title = "Surrender and prepare to be boarded"
192
- desc_metadata.save
193
- desc_metadata.create_version
194
- end
195
-
196
- it "has two versions" do
197
- expect(desc_metadata.versions.all.size).to eq 2
198
- desc_metadata.versions.all.each_index do |index|
199
- expect(desc_metadata.versions.all[index].label).to end_with "version" + (index + 1).to_s
200
- expect(desc_metadata.versions.all[index].created).to start_with current_year
201
- end
202
- end
203
-
204
- it "has the new title" do
205
- expect(desc_metadata.title).to eq(["Surrender and prepare to be boarded"])
206
- end
207
-
208
- it "has a new size" do
209
- expect(desc_metadata.size).to_not be_nil
210
- expect(desc_metadata.size).to_not eq(@original_size)
211
- end
212
-
213
- context "then restoring" do
214
- let(:first_version) { "version1" }
215
- before do
216
- desc_metadata.restore_version(first_version)
217
- end
218
-
219
- it "has two unique versions" do
220
- expect(desc_metadata.versions.all.size).to eq 2
221
- end
222
-
223
- it "loads the restored file's content" do
224
- expect(desc_metadata.title).to eq(["Greetings Earthlings"])
225
- end
226
-
227
- it "is the same size as the original file" do
228
- expect(desc_metadata.size).to eq @original_size
229
- end
230
-
231
- context "and creating additional versions" do
232
- before do
233
- desc_metadata.title = "Now, surrender and prepare to be boarded"
234
- desc_metadata.save
235
- desc_metadata.create_version
236
- end
237
-
238
- it "has three unique versions" do
239
- expect(desc_metadata.versions.all.size).to eq 3
240
- end
241
-
242
- it "has a new title" do
243
- expect(desc_metadata.title).to eq(["Now, surrender and prepare to be boarded"])
244
- end
245
-
246
- it "has a new size" do
247
- expect(desc_metadata.size).to_not eq @original_size
248
- end
249
- end
250
- end
251
- end
252
- end
253
- end
254
- end
255
-
256
- describe ActiveFedora::OmDatastream do
257
- before(:all) do
258
- class VersionableDatastream < ActiveFedora::OmDatastream
259
- set_terminology do |t|
260
- t.root(path: "foo")
261
- t.title
262
- end
263
- end
264
-
265
- class MockAFBase < ActiveFedora::Base
266
- has_subresource "descMetadata", class_name: 'VersionableDatastream', autocreate: true
267
- end
268
- end
269
-
270
- after(:all) do
271
- Object.send(:remove_const, :MockAFBase)
272
- Object.send(:remove_const, :VersionableDatastream)
273
- end
274
-
275
- subject(:desc_metadata) { test_object.descMetadata }
276
-
277
- let(:current_year) { DateTime.now.year.to_s }
278
-
279
- context "that exists in the repository" do
280
- let(:test_object) { MockAFBase.create }
281
-
282
- context "before creating the file" do
283
- it "does not have versions" do
284
- expect(desc_metadata.versions).to be_empty
285
- end
286
- it "does not have a title" do
287
- expect(desc_metadata.title).to be_empty
288
- end
289
- end
290
-
291
- context "after creating the file" do
292
- before do
293
- desc_metadata.title = "Greetings Earthlings"
294
- desc_metadata.save
295
- desc_metadata.create_version
296
- @original_size = desc_metadata.size
297
- end
298
-
299
- it "links to versions endpoint" do
300
- expect(desc_metadata.metadata.ldp_source.graph.query(predicate: ::RDF::Vocab::Fcrepo4.hasVersions).objects).to_not be_empty
301
- end
302
-
303
- it "has one version" do
304
- expect(desc_metadata.versions.first.label).to eql "version1"
305
- expect(desc_metadata.versions.first.created).to start_with current_year
306
- end
307
-
308
- it "has a title" do
309
- expect(desc_metadata.title).to eql(["Greetings Earthlings"])
310
- end
311
-
312
- it "has a size" do
313
- expect(desc_metadata.size).to_not be_nil
314
- end
315
-
316
- context "two times" do
317
- before do
318
- desc_metadata.title = "Surrender and prepare to be boarded"
319
- desc_metadata.save
320
- desc_metadata.create_version
321
- end
322
-
323
- it "has two unique versions" do
324
- expect(desc_metadata.versions.all.size).to eq 2
325
- desc_metadata.versions.all.each_index do |index|
326
- expect(desc_metadata.versions.all[index].label).to end_with "version" + (index + 1).to_s
327
- expect(desc_metadata.versions.all[index].created).to start_with current_year
328
- end
329
- end
330
-
331
- it "has the new title" do
332
- expect(desc_metadata.title).to eql(["Surrender and prepare to be boarded"])
333
- end
334
-
335
- it "has a new size" do
336
- expect(desc_metadata.size).to_not be_nil
337
- expect(desc_metadata.size).to_not eq(@original_size)
338
- end
339
-
340
- context "then restoring" do
341
- let(:first_version) { "version1" }
342
- before do
343
- desc_metadata.restore_version(first_version)
344
- end
345
-
346
- it "stills have two unique versions" do
347
- expect(desc_metadata.versions.all.size).to eq 2
348
- end
349
-
350
- it "loads the restored file's content" do
351
- expect(desc_metadata.title).to eql(["Greetings Earthlings"])
352
- end
353
-
354
- it "is the same size as the original file" do
355
- expect(desc_metadata.size).to eq @original_size
356
- end
357
-
358
- context "and creating additional versions" do
359
- before do
360
- desc_metadata.title = "Now, surrender and prepare to be boarded"
361
- desc_metadata.save
362
- desc_metadata.create_version
363
- end
364
-
365
- it "has three unique versions" do
366
- expect(desc_metadata.versions.all.size).to eq 3
367
- end
368
-
369
- it "has a new title" do
370
- expect(desc_metadata.title).to eql(["Now, surrender and prepare to be boarded"])
371
- end
372
-
373
- it "has a new size" do
374
- expect(desc_metadata.size).to_not eq @original_size
375
- end
376
- end
377
- end
378
- end
379
- end
380
- end
381
- end
382
-
383
129
  describe ActiveFedora::File do
384
130
  before(:all) do
385
131
  class BinaryDatastream < ActiveFedora::File