active-fedora 5.7.1 → 6.0.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +1 -1
- data/Gemfile +2 -1
- data/History.txt +0 -14
- data/Rakefile +1 -2
- data/active-fedora.gemspec +2 -2
- data/lib/active_fedora.rb +1 -16
- data/lib/active_fedora/associations.rb +8 -11
- data/lib/active_fedora/associations/association_collection.rb +2 -4
- data/lib/active_fedora/associations/has_and_belongs_to_many_association.rb +3 -12
- data/lib/active_fedora/associations/has_many_association.rb +0 -4
- data/lib/active_fedora/base.rb +6 -6
- data/lib/active_fedora/config.rb +0 -7
- data/lib/active_fedora/datastream.rb +0 -37
- data/lib/active_fedora/datastream_collections.rb +0 -10
- data/lib/active_fedora/datastreams.rb +0 -17
- data/lib/active_fedora/digital_object.rb +1 -1
- data/lib/active_fedora/file_configurator.rb +0 -22
- data/lib/active_fedora/fixture_loader.rb +1 -1
- data/lib/active_fedora/nokogiri_datastream.rb +9 -51
- data/lib/active_fedora/qualified_dublin_core_datastream.rb +1 -1
- data/lib/active_fedora/querying.rb +8 -4
- data/lib/active_fedora/rdf_datastream.rb +10 -9
- data/lib/active_fedora/rdf_node.rb +1 -1
- data/lib/active_fedora/rdf_node/term_proxy.rb +9 -5
- data/lib/active_fedora/relation.rb +1 -1
- data/lib/active_fedora/rels_ext_datastream.rb +1 -8
- data/lib/active_fedora/semantic_node.rb +0 -35
- data/lib/active_fedora/simple_datastream.rb +1 -1
- data/lib/active_fedora/solr_service.rb +6 -8
- data/lib/active_fedora/version.rb +1 -1
- data/lib/tasks/active_fedora_dev.rake +11 -3
- data/solr/conf/schema.xml +10 -1
- data/spec/integration/base_spec.rb +2 -347
- data/spec/integration/complex_rdf_datastream_spec.rb +1 -1
- data/spec/integration/full_featured_model_spec.rb +1 -9
- data/spec/integration/ntriples_datastream_spec.rb +4 -4
- data/spec/integration/om_datastream_spec.rb +2 -1
- data/spec/integration/rels_ext_datastream_spec.rb +1 -89
- data/spec/integration/scoped_query_spec.rb +4 -4
- data/spec/samples/hydra-mods_article_datastream.rb +2 -2
- data/spec/spec_helper.rb +3 -0
- data/spec/unit/base_spec.rb +7 -81
- data/spec/unit/datastream_spec.rb +0 -25
- data/spec/unit/has_many_collection_spec.rb +2 -27
- data/spec/unit/ntriples_datastream_spec.rb +28 -39
- data/spec/unit/om_datastream_spec.rb +13 -13
- data/spec/unit/qualified_dublin_core_datastream_spec.rb +1 -1
- data/spec/unit/query_spec.rb +1 -24
- data/spec/unit/semantic_node_spec.rb +0 -2
- data/spec/unit/simple_datastream_spec.rb +2 -2
- data/spec/unit/solr_config_options_spec.rb +1 -1
- metadata +76 -57
- checksums.yaml +0 -7
- data/.travis.yml +0 -8
- data/lib/active_fedora/file_management.rb +0 -81
- data/lib/active_fedora/metadata_datastream_helper.rb +0 -43
- data/lib/active_fedora/named_relationships.rb +0 -99
- data/lib/active_fedora/relationships.rb +0 -663
- data/spec/integration/base_file_management_spec.rb +0 -24
- data/spec/integration/has_many_associations_spec.rb +0 -64
- data/spec/integration/metadata_datastream_helper_spec.rb +0 -100
- data/spec/integration/semantic_node_spec.rb +0 -457
- data/spec/unit/base_file_management_spec.rb +0 -95
- data/spec/unit/has_and_belongs_to_many_collection_spec.rb +0 -59
- data/spec/unit/relationships_spec.rb +0 -871
data/solr/conf/schema.xml
CHANGED
@@ -168,13 +168,20 @@
|
|
168
168
|
enablePositionIncrements=true ensures that a 'gap' is left to
|
169
169
|
allow for accurate phrase queries.
|
170
170
|
-->
|
171
|
+
<filter class="solr.StopFilterFactory"
|
172
|
+
ignoreCase="true"
|
173
|
+
words="stopwords.txt"
|
174
|
+
enablePositionIncrements="true"
|
175
|
+
/>
|
171
176
|
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
|
172
177
|
<filter class="solr.LowerCaseFilterFactory"/>
|
173
178
|
<filter class="solr.SnowballPorterFilterFactory" language="English"/>
|
174
179
|
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
|
175
180
|
</analyzer>
|
176
181
|
<analyzer type="query">
|
177
|
-
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
182
|
+
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
183
|
+
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
|
184
|
+
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
|
178
185
|
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
|
179
186
|
<filter class="solr.LowerCaseFilterFactory"/>
|
180
187
|
<filter class="solr.SnowballPorterFilterFactory" language="English"/>
|
@@ -188,6 +195,8 @@
|
|
188
195
|
<fieldType name="textTight" class="solr.TextField" positionIncrementGap="100" >
|
189
196
|
<analyzer>
|
190
197
|
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
198
|
+
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
|
199
|
+
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
|
191
200
|
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
|
192
201
|
<filter class="solr.LowerCaseFilterFactory"/>
|
193
202
|
<filter class="solr.SnowballPorterFilterFactory" language="English"/>
|
@@ -20,7 +20,7 @@ describe "A base object with metadata" do
|
|
20
20
|
obj = ActiveFedora::Base.find(@obj.pid, :cast=>true)
|
21
21
|
obj.foo.should_not be_new
|
22
22
|
obj.foo.person.should == ['bob']
|
23
|
-
person_field = ActiveFedora::SolrService.solr_name('person', :
|
23
|
+
person_field = ActiveFedora::SolrService.solr_name('person', :searchable, type: :string)
|
24
24
|
ActiveFedora::SolrService.query("id:#{@obj.pid.gsub(":", "\\:")}", :fl=>"id #{person_field}").first.should == {"id"=>@obj.pid, person_field =>['bob']}
|
25
25
|
end
|
26
26
|
end
|
@@ -40,7 +40,7 @@ describe "A base object with metadata" do
|
|
40
40
|
end
|
41
41
|
it "should save the datastream." do
|
42
42
|
MockAFBaseRelationship.find(@release.pid).foo.person.should == ['frank']
|
43
|
-
person_field = ActiveFedora::SolrService.solr_name('person', :
|
43
|
+
person_field = ActiveFedora::SolrService.solr_name('person', :searchable, type: :string)
|
44
44
|
ActiveFedora::SolrService.query("id:#{@release.pid.gsub(":", "\\:")}", :fl=>"id #{person_field}").first.should == {"id"=>@release.pid, person_field =>['frank']}
|
45
45
|
end
|
46
46
|
end
|
@@ -146,38 +146,11 @@ end
|
|
146
146
|
|
147
147
|
|
148
148
|
describe ActiveFedora::Base do
|
149
|
-
before(:all) do
|
150
|
-
@behavior = ActiveFedora::Relationships.deprecation_behavior
|
151
|
-
@c_behavior = ActiveFedora::Relationships::ClassMethods.deprecation_behavior
|
152
|
-
ActiveFedora::Relationships.deprecation_behavior = :silence
|
153
|
-
ActiveFedora::Relationships::ClassMethods.deprecation_behavior = :silence
|
154
|
-
end
|
155
|
-
|
156
|
-
after :all do
|
157
|
-
ActiveFedora::Relationships.deprecation_behavior = @behavior
|
158
|
-
ActiveFedora::Relationships::ClassMethods.deprecation_behavior = @c_behavior
|
159
|
-
end
|
160
|
-
|
161
149
|
before :all do
|
162
150
|
class MockAFBaseRelationship < ActiveFedora::Base
|
163
|
-
include ActiveFedora::FileManagement
|
164
|
-
has_relationship "testing", :has_part, :type=>MockAFBaseRelationship
|
165
|
-
has_relationship "testing2", :has_member, :type=>MockAFBaseRelationship
|
166
|
-
has_relationship "testing_inbound", :has_part, :type=>MockAFBaseRelationship, :inbound=>true
|
167
|
-
has_relationship "testing_inbound2", :has_member, :type=>MockAFBaseRelationship, :inbound=>true
|
168
|
-
has_bidirectional_relationship "testing_bidirectional", :has_collection_member, :is_member_of_collection
|
169
|
-
#next 2 used to test objects on opposite end of bidirectional relationship
|
170
|
-
has_relationship "testing_inbound3", :has_collection_member, :inbound=>true
|
171
|
-
has_relationship "testing3", :is_member_of_collection
|
172
151
|
end
|
173
152
|
|
174
153
|
class MockAFBaseFromSolr < ActiveFedora::Base
|
175
|
-
include ActiveFedora::Relationships
|
176
|
-
has_relationship "testing", :has_part, :type=>MockAFBaseFromSolr
|
177
|
-
has_relationship "testing2", :has_member, :type=>MockAFBaseFromSolr
|
178
|
-
has_relationship "testing_inbound", :has_part, :type=>MockAFBaseFromSolr, :inbound=>true
|
179
|
-
has_relationship "testing_inbound2", :has_member, :type=>MockAFBaseFromSolr, :inbound=>true
|
180
|
-
|
181
154
|
has_metadata :name => "properties", :type => ActiveFedora::SimpleDatastream do |m|
|
182
155
|
m.field "holding_id", :string
|
183
156
|
end
|
@@ -387,16 +360,12 @@ describe ActiveFedora::Base do
|
|
387
360
|
|
388
361
|
it "should be able to add datastreams" do
|
389
362
|
ds = ActiveFedora::Datastream.new(@test_object.inner_object, 'DS1')
|
390
|
-
# ds = ActiveFedora::Datastream.new(:dsID => 'DS1', :dsLabel => 'hello', :altIDs => '3333',
|
391
|
-
# :controlGroup => 'M', :blob => fixture('dino.jpg'))
|
392
363
|
@test_object.add_datastream(ds).should be_true
|
393
364
|
end
|
394
365
|
|
395
366
|
it "adding and saving should add the datastream to the datastreams array" do
|
396
367
|
ds = ActiveFedora::Datastream.new(@test_object.inner_object, 'DS1')
|
397
368
|
ds.content = fixture('dino.jpg').read
|
398
|
-
# ds = ActiveFedora::Datastream.new(:dsid => 'DS1', :dsLabel => 'hello', :altIDs => '3333',
|
399
|
-
# :controlGroup => 'M', :blob => fixture('dino.jpg'))
|
400
369
|
@test_object.datastreams.should_not have_key("DS1")
|
401
370
|
@test_object.add_datastream(ds)
|
402
371
|
ds.save
|
@@ -434,47 +403,6 @@ describe ActiveFedora::Base do
|
|
434
403
|
@test_object.delete
|
435
404
|
ActiveFedora::Base.find_with_conditions(:id=>pid).should be_empty
|
436
405
|
end
|
437
|
-
|
438
|
-
describe '#delete' do
|
439
|
-
before do
|
440
|
-
@test_object2 = MockAFBaseRelationship.create
|
441
|
-
@test_object3 = MockAFBaseRelationship.create
|
442
|
-
@test_object4 = MockAFBaseRelationship.create
|
443
|
-
@test_object5 = MockAFBaseRelationship.create
|
444
|
-
Deprecation.stub(:warn)
|
445
|
-
#append to relationship by 'testing'
|
446
|
-
@test_object2.add_relationship_by_name("testing",@test_object3)
|
447
|
-
@test_object2.add_relationship_by_name("testing2",@test_object4)
|
448
|
-
@test_object5.add_relationship_by_name("testing",@test_object2)
|
449
|
-
#@test_object5.add_relationship_by_name("testing2",@test_object3)
|
450
|
-
@test_object2.save
|
451
|
-
@test_object5.save
|
452
|
-
#check that the inbound relationships on test_object3 and test_object4 were eliminated
|
453
|
-
#testing goes to :has_part and testing2 goes to :has_member
|
454
|
-
@test_object2.relationships_by_name(false)[:inbound]["testing_inbound"].should == [@test_object5.internal_uri]
|
455
|
-
@test_object2.relationships_by_name(false)[:self]["parts_outbound"].should == [@test_object3.internal_uri]
|
456
|
-
@test_object2.relationships_by_name(false)[:self]["testing"].should == [@test_object3.internal_uri]
|
457
|
-
|
458
|
-
@test_object3.relationships_by_name(false)[:inbound]["testing_inbound"].should == [@test_object2.internal_uri]
|
459
|
-
@test_object4.relationships_by_name(false)[:inbound]["testing_inbound2"].should == [@test_object2.internal_uri]
|
460
|
-
|
461
|
-
@test_object5.relationships_by_name(false)[:self]["testing"].should == [@test_object2.internal_uri]
|
462
|
-
end
|
463
|
-
|
464
|
-
it 'if inbound relationships exist should remove relationships from those inbound targets as well when deleting this object' do
|
465
|
-
|
466
|
-
@test_object2.delete
|
467
|
-
#need to reload since removed from rels_ext in memory
|
468
|
-
@test_object5 = MockAFBaseRelationship.find(@test_object5.pid)
|
469
|
-
|
470
|
-
#check any test_object2 inbound rels gone from source
|
471
|
-
@test_object3.relationships_by_name(false)[:inbound]["testing_inbound"].should == []
|
472
|
-
|
473
|
-
@test_object4.relationships_by_name(false)[:inbound]["testing_inbound2"].should == []
|
474
|
-
@test_object5.relationships_by_name(false)[:self]["testing"].should == []
|
475
|
-
end
|
476
|
-
end
|
477
|
-
|
478
406
|
end
|
479
407
|
|
480
408
|
describe '#remove_relationship' do
|
@@ -498,280 +426,7 @@ describe ActiveFedora::Base do
|
|
498
426
|
end
|
499
427
|
end
|
500
428
|
|
501
|
-
describe '#relationships' do
|
502
|
-
it 'should return internal relationships with no parameters and include inbound if false passed in' do
|
503
|
-
@test_object2 = MockAFBaseRelationship.new
|
504
|
-
@test_object2.save
|
505
|
-
@test_object3 = MockAFBaseRelationship.new
|
506
|
-
@test_object3.save
|
507
|
-
@test_object4 = MockAFBaseRelationship.new
|
508
|
-
@test_object4.save
|
509
|
-
@test_object5 = MockAFBaseRelationship.new
|
510
|
-
@test_object5.save
|
511
|
-
#append to named relationship 'testing'
|
512
|
-
@test_object2.testing_append(@test_object3)
|
513
|
-
@test_object2.testing2_append(@test_object4)
|
514
|
-
@test_object2.testing3_append(@test_object5)
|
515
|
-
@test_object5.testing_append(@test_object2)
|
516
|
-
@test_object5.testing2_append(@test_object3)
|
517
|
-
@test_object5.testing_bidirectional_append(@test_object4)
|
518
|
-
@test_object2.save
|
519
|
-
@test_object5.save
|
520
|
-
model_rel = MockAFBaseRelationship.to_class_uri
|
521
|
-
#check inbound correct, testing goes to :has_part and testing2 goes to :has_member
|
522
|
-
@test_object2.object_relations[:has_model].should include model_rel
|
523
|
-
@test_object2.object_relations[:has_part].should include @test_object3
|
524
|
-
|
525
|
-
@test_object2.object_relations[:has_member].should include @test_object4
|
526
|
-
@test_object2.object_relations[:is_member_of_collection].should include @test_object5
|
527
|
-
@test_object2.inbound_relationships.should == {:has_part=>[@test_object5.internal_uri]}
|
528
|
-
|
529
|
-
@test_object3.object_relations[:has_model].should include model_rel
|
530
|
-
@test_object3.inbound_relationships.should == {:has_part=>[@test_object2.internal_uri],
|
531
|
-
:has_member=>[@test_object5.internal_uri]}
|
532
|
-
@test_object4.object_relations[:has_model].should include model_rel
|
533
|
-
@test_object4.inbound_relationships.should == {:has_member=>[@test_object2.internal_uri],:has_collection_member=>[@test_object5.internal_uri]}
|
534
|
-
|
535
|
-
@test_object5.object_relations[:has_model].should include model_rel
|
536
|
-
@test_object5.object_relations[:has_part].should include @test_object2
|
537
|
-
@test_object5.object_relations[:has_member].should include @test_object3
|
538
|
-
@test_object5.object_relations[:has_collection_member].should include @test_object4
|
539
|
-
@test_object5.inbound_relationships.should == {:is_member_of_collection=>[@test_object2.internal_uri]}
|
540
|
-
end
|
541
|
-
end
|
542
|
-
|
543
|
-
describe '#inbound_relationships' do
|
544
|
-
it 'should return a hash of inbound relationships' do
|
545
|
-
@test_object2 = MockAFBaseRelationship.new
|
546
|
-
@test_object2.save
|
547
|
-
@test_object3 = MockAFBaseRelationship.new
|
548
|
-
@test_object3.save
|
549
|
-
@test_object4 = MockAFBaseRelationship.new
|
550
|
-
@test_object4.save
|
551
|
-
@test_object5 = MockAFBaseRelationship.new
|
552
|
-
@test_object5.save
|
553
|
-
#append to named relationship 'testing'
|
554
|
-
@test_object2.testing_append(@test_object3)
|
555
|
-
@test_object2.testing2_append(@test_object4)
|
556
|
-
@test_object5.testing_append(@test_object2)
|
557
|
-
@test_object5.testing2_append(@test_object3)
|
558
|
-
#@test_object5.testing_bidirectional_append(@test_object4)
|
559
|
-
@test_object2.save
|
560
|
-
@test_object5.save
|
561
|
-
#check inbound correct, testing goes to :has_part and testing2 goes to :has_member
|
562
|
-
@test_object2.inbound_relationships.should == {:has_part=>[@test_object5.internal_uri]}
|
563
|
-
@test_object3.inbound_relationships.should == {:has_part=>[@test_object2.internal_uri],:has_member=>[@test_object5.internal_uri]}
|
564
|
-
@test_object4.inbound_relationships.should == {:has_member=>[@test_object2.internal_uri]}
|
565
|
-
@test_object5.inbound_relationships.should == {}
|
566
|
-
end
|
567
|
-
end
|
568
429
|
|
569
|
-
describe '#inbound_relationships_by_name' do
|
570
|
-
it 'should return a hash of inbound relationship names to array of objects' do
|
571
|
-
@test_object2 = MockAFBaseRelationship.new
|
572
|
-
@test_object2.save
|
573
|
-
@test_object3 = MockAFBaseRelationship.new
|
574
|
-
@test_object3.save
|
575
|
-
@test_object4 = MockAFBaseRelationship.new
|
576
|
-
@test_object4.save
|
577
|
-
@test_object5 = MockAFBaseRelationship.new
|
578
|
-
@test_object5.save
|
579
|
-
#append to named relationship 'testing'
|
580
|
-
@test_object2.testing_append(@test_object3)
|
581
|
-
@test_object2.testing2_append(@test_object4)
|
582
|
-
@test_object5.testing_append(@test_object2)
|
583
|
-
@test_object5.testing2_append(@test_object3)
|
584
|
-
@test_object2.save
|
585
|
-
@test_object5.save
|
586
|
-
#check inbound correct, testing goes to :has_part and testing2 goes to :has_member
|
587
|
-
@test_object2.inbound_relationships_by_name.should == {"testing_inbound"=>[@test_object5.internal_uri],"testing_inbound2"=>[],
|
588
|
-
"testing_bidirectional_inbound"=>[],"testing_inbound3"=>[], "parts_inbound" => []}
|
589
|
-
@test_object3.inbound_relationships_by_name.should == {"testing_inbound"=>[@test_object2.internal_uri],"testing_inbound2"=>[@test_object5.internal_uri],
|
590
|
-
"testing_bidirectional_inbound"=>[],"testing_inbound3"=>[], "parts_inbound" => []}
|
591
|
-
@test_object4.inbound_relationships_by_name.should == {"testing_inbound"=>[],"testing_inbound2"=>[@test_object2.internal_uri],
|
592
|
-
"testing_bidirectional_inbound"=>[],"testing_inbound3"=>[], "parts_inbound" => []}
|
593
|
-
@test_object5.inbound_relationships_by_name.should == {"testing_inbound"=>[],"testing_inbound2"=>[],
|
594
|
-
"testing_bidirectional_inbound"=>[],"testing_inbound3"=>[], "parts_inbound" => []}
|
595
|
-
end
|
596
|
-
end
|
597
|
-
|
598
|
-
describe '#relationships_by_name' do
|
599
|
-
it '' do
|
600
|
-
@test_object2 = MockAFBaseRelationship.new
|
601
|
-
@test_object2.save
|
602
|
-
@test_object3 = MockAFBaseRelationship.new
|
603
|
-
@test_object3.save
|
604
|
-
@test_object4 = MockAFBaseRelationship.new
|
605
|
-
@test_object4.save
|
606
|
-
@test_object5 = MockAFBaseRelationship.new
|
607
|
-
@test_object5.save
|
608
|
-
#append to named relationship 'testing'
|
609
|
-
@test_object2.testing_append(@test_object3)
|
610
|
-
@test_object2.testing2_append(@test_object4)
|
611
|
-
@test_object5.testing_append(@test_object2)
|
612
|
-
@test_object5.testing2_append(@test_object3)
|
613
|
-
@test_object2.save
|
614
|
-
@test_object5.save
|
615
|
-
#check inbound correct, testing goes to :has_part and testing2 goes to :has_member
|
616
|
-
@test_object2.relationships_by_name(false)[:self]["testing"].should == [@test_object3.internal_uri]
|
617
|
-
@test_object2.relationships_by_name(false)[:self]["testing2"].should == [@test_object4.internal_uri]
|
618
|
-
@test_object2.relationships_by_name(false)[:self]["parts_outbound"].should == [@test_object3.internal_uri]
|
619
|
-
@test_object2.relationships_by_name(false)[:inbound]["testing_inbound"].should == [@test_object5.internal_uri]
|
620
|
-
|
621
|
-
@test_object3.relationships_by_name(false)[:inbound]["testing_inbound"].should == [@test_object2.internal_uri]
|
622
|
-
@test_object3.relationships_by_name(false)[:inbound]["testing_inbound2"].should == [@test_object5.internal_uri]
|
623
|
-
|
624
|
-
@test_object4.relationships_by_name(false)[:inbound]["testing_inbound2"].should == [@test_object2.internal_uri]
|
625
|
-
|
626
|
-
@test_object5.relationships_by_name(false)[:self]["testing"].should == [@test_object2.internal_uri]
|
627
|
-
@test_object5.relationships_by_name(false)[:self]["testing2"].should == [@test_object3.internal_uri]
|
628
|
-
@test_object5.relationships_by_name(false)[:self]["parts_outbound"].should == [@test_object2.internal_uri]
|
629
|
-
|
630
|
-
#all inbound should now be empty if no parameter supplied to relationships
|
631
|
-
@test_object2.relationships_by_name[:self]["testing"].should == [@test_object3.internal_uri]
|
632
|
-
@test_object2.relationships_by_name[:self]["testing2"].should == [@test_object4.internal_uri]
|
633
|
-
@test_object2.relationships_by_name[:self]["parts_outbound"].should == [@test_object3.internal_uri]
|
634
|
-
@test_object2.relationships_by_name.should_not have_key :inbound
|
635
|
-
|
636
|
-
@test_object3.relationships_by_name.should_not have_key :inbound
|
637
|
-
@test_object4.relationships_by_name.should_not have_key :inbound
|
638
|
-
|
639
|
-
|
640
|
-
@test_object5.relationships_by_name[:self]["testing"].should == [@test_object2.internal_uri]
|
641
|
-
@test_object5.relationships_by_name[:self]["testing2"].should == [@test_object3.internal_uri]
|
642
|
-
@test_object5.relationships_by_name[:self]["parts_outbound"].should == [@test_object2.internal_uri]
|
643
|
-
@test_object5.relationships_by_name.should_not have_key :inbound
|
644
|
-
# @test_object2.relationships_by_name.should == {:self=>{"testing2"=>[@test_object4.internal_uri], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[@test_object3.internal_uri], "parts_outbound"=>[@test_object3.internal_uri], "testing_bidirectional_outbound"=>[]}}
|
645
|
-
# @test_object3.relationships_by_name.should == {:self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
|
646
|
-
# @test_object4.relationships_by_name.should == {:self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
|
647
|
-
# @test_object5.relationships_by_name.should == {:self=>{"testing2"=>[@test_object3.internal_uri], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[@test_object2.internal_uri], "parts_outbound"=>[@test_object2.internal_uri], "testing_bidirectional_outbound"=>[]}}
|
648
|
-
end
|
649
|
-
end
|
650
|
-
|
651
|
-
describe '#add_relationship_by_name' do
|
652
|
-
it 'should add a named relationship to an object' do
|
653
|
-
@test_object2 = MockAFBaseRelationship.new
|
654
|
-
#@test_object2.new_object = true
|
655
|
-
@test_object2.save
|
656
|
-
@test_object3 = MockAFBaseRelationship.new
|
657
|
-
#@test_object3.new_object = true
|
658
|
-
@test_object3.save
|
659
|
-
@test_object4 = MockAFBaseRelationship.new
|
660
|
-
#@test_object4.new_object = true
|
661
|
-
@test_object4.save
|
662
|
-
@test_object5 = MockAFBaseRelationship.new
|
663
|
-
#@test_object5.new_object = true
|
664
|
-
@test_object5.save
|
665
|
-
#append to named relationship 'testing'
|
666
|
-
@test_object2.add_relationship_by_name("testing",@test_object3)
|
667
|
-
@test_object2.add_relationship_by_name("testing2",@test_object4)
|
668
|
-
@test_object5.add_relationship_by_name("testing",@test_object2)
|
669
|
-
@test_object5.add_relationship_by_name("testing2",@test_object3)
|
670
|
-
@test_object2.save
|
671
|
-
@test_object5.save
|
672
|
-
#check inbound correct, testing goes to :has_part and testing2 goes to :has_member
|
673
|
-
@test_object2.relationships_by_name(false)[:self]["testing"].should == [@test_object3.internal_uri]
|
674
|
-
@test_object2.relationships_by_name(false)[:self]["testing2"].should == [@test_object4.internal_uri]
|
675
|
-
@test_object2.relationships_by_name(false)[:self]["parts_outbound"].should == [@test_object3.internal_uri]
|
676
|
-
@test_object2.relationships_by_name(false)[:inbound]["testing_inbound"].should == [@test_object5.internal_uri]
|
677
|
-
|
678
|
-
@test_object3.relationships_by_name(false)[:inbound]["testing_inbound"].should == [@test_object2.internal_uri]
|
679
|
-
@test_object3.relationships_by_name(false)[:inbound]["testing_inbound2"].should == [@test_object5.internal_uri]
|
680
|
-
|
681
|
-
@test_object4.relationships_by_name(false)[:inbound]["testing_inbound2"].should == [@test_object2.internal_uri]
|
682
|
-
|
683
|
-
@test_object5.relationships_by_name(false)[:self]["testing"].should == [@test_object2.internal_uri]
|
684
|
-
@test_object5.relationships_by_name(false)[:self]["testing2"].should == [@test_object3.internal_uri]
|
685
|
-
@test_object5.relationships_by_name(false)[:self]["parts_outbound"].should == [@test_object2.internal_uri]
|
686
|
-
end
|
687
|
-
end
|
688
|
-
|
689
|
-
describe '#remove_named_relationship' do
|
690
|
-
it 'should remove an existing relationship from an object' do
|
691
|
-
@test_object2 = MockAFBaseRelationship.new
|
692
|
-
#@test_object2.new_object = true
|
693
|
-
@test_object2.save
|
694
|
-
@test_object3 = MockAFBaseRelationship.new
|
695
|
-
#@test_object3.new_object = true
|
696
|
-
@test_object3.save
|
697
|
-
@test_object4 = MockAFBaseRelationship.new
|
698
|
-
#@test_object4.new_object = true
|
699
|
-
@test_object4.save
|
700
|
-
@test_object5 = MockAFBaseRelationship.new
|
701
|
-
#@test_object5.new_object = true
|
702
|
-
@test_object5.save
|
703
|
-
#append to named relationship 'testing'
|
704
|
-
@test_object2.add_relationship_by_name("testing",@test_object3)
|
705
|
-
@test_object2.add_relationship_by_name("testing2",@test_object4)
|
706
|
-
@test_object5.add_relationship_by_name("testing",@test_object2)
|
707
|
-
@test_object5.add_relationship_by_name("testing2",@test_object3)
|
708
|
-
@test_object2.save
|
709
|
-
@test_object5.save
|
710
|
-
#check inbound correct, testing goes to :has_part and testing2 goes to :has_member
|
711
|
-
@test_object2.relationships_by_name(false)[:self]["testing"].should == [@test_object3.internal_uri]
|
712
|
-
@test_object2.relationships_by_name(false)[:self]["testing2"].should == [@test_object4.internal_uri]
|
713
|
-
@test_object2.relationships_by_name(false)[:self]["parts_outbound"].should == [@test_object3.internal_uri]
|
714
|
-
@test_object2.relationships_by_name(false)[:inbound]["testing_inbound"].should == [@test_object5.internal_uri]
|
715
|
-
|
716
|
-
@test_object3.relationships_by_name(false)[:inbound]["testing_inbound"].should == [@test_object2.internal_uri]
|
717
|
-
@test_object3.relationships_by_name(false)[:inbound]["testing_inbound2"].should == [@test_object5.internal_uri]
|
718
|
-
|
719
|
-
@test_object4.relationships_by_name(false)[:inbound]["testing_inbound2"].should == [@test_object2.internal_uri]
|
720
|
-
|
721
|
-
@test_object5.relationships_by_name(false)[:self]["testing"].should == [@test_object2.internal_uri]
|
722
|
-
@test_object5.relationships_by_name(false)[:self]["testing2"].should == [@test_object3.internal_uri]
|
723
|
-
@test_object5.relationships_by_name(false)[:self]["parts_outbound"].should == [@test_object2.internal_uri]
|
724
|
-
|
725
|
-
@test_object2.remove_relationship_by_name("testing",@test_object3.internal_uri)
|
726
|
-
@test_object2.save
|
727
|
-
#check now removed for both outbound and inbound
|
728
|
-
@test_object2.relationships_by_name(false)[:self]["testing"].should == []
|
729
|
-
@test_object2.relationships_by_name(false)[:self]["testing2"].should == [@test_object4.internal_uri]
|
730
|
-
@test_object2.relationships_by_name(false)[:self]["parts_outbound"].should == []
|
731
|
-
@test_object2.relationships_by_name(false)[:inbound]["testing_inbound"].should == [@test_object5.internal_uri]
|
732
|
-
|
733
|
-
@test_object3.relationships_by_name(false)[:inbound]["testing_inbound"].should == []
|
734
|
-
@test_object3.relationships_by_name(false)[:inbound]["testing_inbound2"].should == [@test_object5.internal_uri]
|
735
|
-
end
|
736
|
-
end
|
737
|
-
|
738
|
-
describe '#find_relationship_by_name' do
|
739
|
-
it 'should find relationships based on name passed in for inbound or outbound' do
|
740
|
-
@test_object2 = MockAFBaseRelationship.new
|
741
|
-
@test_object2.save
|
742
|
-
@test_object3 = MockAFBaseRelationship.new
|
743
|
-
@test_object3.save
|
744
|
-
@test_object4 = MockAFBaseRelationship.new
|
745
|
-
@test_object4.save
|
746
|
-
@test_object5 = MockAFBaseRelationship.new
|
747
|
-
@test_object5.save
|
748
|
-
#append to named relationship 'testing'
|
749
|
-
@test_object2.add_relationship_by_name("testing",@test_object3)
|
750
|
-
@test_object2.add_relationship_by_name("testing2",@test_object4)
|
751
|
-
@test_object5.add_relationship_by_name("testing",@test_object2)
|
752
|
-
@test_object5.add_relationship_by_name("testing2",@test_object3)
|
753
|
-
@test_object2.save
|
754
|
-
@test_object5.save
|
755
|
-
@test_object2.find_relationship_by_name("testing").should == [@test_object3.internal_uri]
|
756
|
-
@test_object2.find_relationship_by_name("testing2").should == [@test_object4.internal_uri]
|
757
|
-
@test_object2.find_relationship_by_name("testing_inbound").should == [@test_object5.internal_uri]
|
758
|
-
@test_object2.find_relationship_by_name("testing_inbound2").should == []
|
759
|
-
@test_object3.find_relationship_by_name("testing").should == []
|
760
|
-
@test_object3.find_relationship_by_name("testing2").should == []
|
761
|
-
@test_object3.find_relationship_by_name("testing_inbound").should == [@test_object2.internal_uri]
|
762
|
-
@test_object3.find_relationship_by_name("testing_inbound2").should == [@test_object5.internal_uri]
|
763
|
-
@test_object4.find_relationship_by_name("testing").should == []
|
764
|
-
@test_object4.find_relationship_by_name("testing2").should == []
|
765
|
-
@test_object4.find_relationship_by_name("testing_inbound").should == []
|
766
|
-
@test_object4.find_relationship_by_name("testing_inbound2").should == [@test_object2.internal_uri]
|
767
|
-
@test_object5.find_relationship_by_name("testing").should == [@test_object2.internal_uri]
|
768
|
-
@test_object5.find_relationship_by_name("testing2").should == [@test_object3.internal_uri]
|
769
|
-
@test_object5.find_relationship_by_name("testing_inbound").should == []
|
770
|
-
@test_object5.find_relationship_by_name("testing_inbound2").should == []
|
771
|
-
|
772
|
-
end
|
773
|
-
end
|
774
|
-
|
775
430
|
describe "#exists?" do
|
776
431
|
it "should return true for objects that exist" do
|
777
432
|
ActiveFedora::Base.exists?('hydrangea:fixture_mods_article1').should be_true
|
@@ -7,11 +7,6 @@ describe ActiveFedora::Base do
|
|
7
7
|
|
8
8
|
before(:all) do
|
9
9
|
class OralHistory < ActiveFedora::Base
|
10
|
-
include ActiveFedora::Relationships
|
11
|
-
|
12
|
-
Deprecation.silence(ActiveFedora::Relationships::ClassMethods) do
|
13
|
-
has_relationship "parts", :is_part_of, :inbound => true
|
14
|
-
end
|
15
10
|
# These are all the properties that don't quite fit into Qualified DC
|
16
11
|
# Put them on the object itself (in the properties datastream) for now.
|
17
12
|
has_metadata :name => "properties", :type => ActiveFedora::SimpleDatastream do |m|
|
@@ -28,9 +23,6 @@ describe ActiveFedora::Base do
|
|
28
23
|
m.field "location", :string
|
29
24
|
end
|
30
25
|
|
31
|
-
# has_metadata :name=>"arbitrary_xml", :type=> ActiveFedora::OmDatastream do |m|
|
32
|
-
# m.root_property :myxml, "my_xml", "http://www.example.gov/schema/v3"
|
33
|
-
# end
|
34
26
|
|
35
27
|
has_metadata :name=>"mods_article", :type=> Hydra::ModsArticleDatastream
|
36
28
|
|
@@ -151,7 +143,7 @@ describe ActiveFedora::Base do
|
|
151
143
|
@properties_sample_values.each_pair do |field, value|
|
152
144
|
next if field == :hard_copy_availability #FIXME HYDRA-824
|
153
145
|
next if field == :location #FIXME HYDRA-825
|
154
|
-
(@solr_result[ActiveFedora::SolrService.solr_name(field, :
|
146
|
+
(@solr_result[ActiveFedora::SolrService.solr_name(field, type: :string)] || @solr_result[ActiveFedora::SolrService.solr_name(field, type: :date)]).should == [::Solrizer::Extractor.format_node_value(value)]
|
155
147
|
end
|
156
148
|
|
157
149
|
@dublin_core_sample_values.each_pair do |field, value|
|