active-fedora 3.1.6 → 3.2.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/.gitignore +1 -0
- data/Gemfile.lock +22 -22
- data/History.txt +9 -3
- data/active-fedora.gemspec +3 -3
- data/config/predicate_mappings.yml +1 -0
- data/config/service_mappings.yml +9 -0
- data/lib/active_fedora.rb +7 -1
- data/lib/active_fedora/base.rb +84 -30
- data/lib/active_fedora/datastream.rb +4 -1
- data/lib/active_fedora/datastream_collections.rb +304 -293
- data/lib/active_fedora/metadata_datastream.rb +2 -24
- data/lib/active_fedora/metadata_datastream_helper.rb +32 -5
- data/lib/active_fedora/named_relationships.rb +95 -0
- data/lib/active_fedora/nested_attributes.rb +1 -1
- data/lib/active_fedora/predicates.rb +76 -0
- data/lib/active_fedora/reflection.rb +9 -1
- data/lib/active_fedora/relationship.rb +1 -0
- data/lib/active_fedora/relationship_graph.rb +152 -0
- data/lib/active_fedora/relationships_helper.rb +32 -41
- data/lib/active_fedora/rels_ext_datastream.rb +3 -10
- data/lib/active_fedora/semantic_node.rb +47 -203
- data/lib/active_fedora/service_definitions.rb +89 -0
- data/lib/active_fedora/unsaved_digital_object.rb +40 -0
- data/lib/active_fedora/version.rb +1 -1
- data/spec/integration/base_spec.rb +106 -309
- data/spec/integration/datastream_collections_spec.rb +135 -0
- data/spec/integration/rels_ext_datastream_spec.rb +14 -35
- data/spec/integration/semantic_node_spec.rb +6 -10
- data/spec/unit/base_datastream_management_spec.rb +0 -3
- data/spec/unit/base_extra_spec.rb +5 -9
- data/spec/unit/base_spec.rb +103 -57
- data/spec/unit/{base_named_datastream_spec.rb → datastream_collections_spec.rb} +107 -150
- data/spec/unit/metadata_datastream_spec.rb +0 -1
- data/spec/unit/nokogiri_datastream_spec.rb +0 -1
- data/spec/unit/predicates_spec.rb +64 -0
- data/spec/unit/qualified_dublin_core_datastream_spec.rb +0 -7
- data/spec/unit/relationship_graph_spec.rb +95 -0
- data/spec/unit/relationship_spec.rb +4 -4
- data/spec/unit/relationships_helper_spec.rb +43 -104
- data/spec/unit/rels_ext_datastream_spec.rb +6 -6
- data/spec/unit/semantic_node_spec.rb +27 -116
- data/spec/unit/service_definitions_spec.rb +52 -0
- data/spec/unit/solr_config_options_spec.rb +1 -1
- metadata +35 -17
| @@ -0,0 +1,89 @@ | |
| 1 | 
            +
            module ActiveFedora
         | 
| 2 | 
            +
            module ServiceDefinitions
         | 
| 3 | 
            +
              def self.included(mod)
         | 
| 4 | 
            +
                # check that it's an AF base
         | 
| 5 | 
            +
                if mod.ancestors.include? ActiveFedora::Base
         | 
| 6 | 
            +
                  mod.extend(ClassMethods)
         | 
| 7 | 
            +
                  model_uri = mod.to_class_uri
         | 
| 8 | 
            +
                # load ContentModel, pull Sdef pointers
         | 
| 9 | 
            +
                  begin
         | 
| 10 | 
            +
                    cmodel = ActiveFedora::ContentModel.load_instance(mod.to_class_uri)
         | 
| 11 | 
            +
                    sdef_pids = cmodel.ids_for_outbound(:has_service).collect { |uri|
         | 
| 12 | 
            +
                      uri.split('/')[-1]
         | 
| 13 | 
            +
                    }
         | 
| 14 | 
            +
                  rescue
         | 
| 15 | 
            +
                    sdef_pids = []
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                  unless sdef_pids.include? "fedora-system:3"
         | 
| 18 | 
            +
                    sdef_pids << "fedora-system:3"
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
                  sdef_pids.each { |sdef_pid| mod.has_service_definition sdef_pid }
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
              def self.sdef_config
         | 
| 24 | 
            +
                @@methods ||= begin
         | 
| 25 | 
            +
                  if defined? Rails
         | 
| 26 | 
            +
                    config_path = Rails.root.join('config','service_mappings.yml')
         | 
| 27 | 
            +
                  else
         | 
| 28 | 
            +
                    config_path = 'config/service_mappings.yml'
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
                  YAML::load(File.open(config_path))[:service_mapping]
         | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
                @@methods
         | 
| 33 | 
            +
              end
         | 
| 34 | 
            +
              def self.lookup_method(sdef_uri, method_name)
         | 
| 35 | 
            +
                sdef_pid = sdef_uri.split('/')[-1]
         | 
| 36 | 
            +
                begin
         | 
| 37 | 
            +
                  sdef = sdef_config[sdef_pid]
         | 
| 38 | 
            +
                  return nil unless sdef
         | 
| 39 | 
            +
                  result = nil
         | 
| 40 | 
            +
                  sdef.each { |key, value| result = key if method_name == value }
         | 
| 41 | 
            +
                rescue
         | 
| 42 | 
            +
                  return nil
         | 
| 43 | 
            +
                end
         | 
| 44 | 
            +
                return result
         | 
| 45 | 
            +
              end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
              module ClassMethods
         | 
| 48 | 
            +
                def sdef_pids
         | 
| 49 | 
            +
                  @sdef_pids ||= []
         | 
| 50 | 
            +
                end
         | 
| 51 | 
            +
                def has_service_definition sdef_uri
         | 
| 52 | 
            +
                  sdef_pid = sdef_uri.split('/')[-1]
         | 
| 53 | 
            +
                  unless sdef_pids.include? sdef_pid
         | 
| 54 | 
            +
                    self.add_sdef_methods! sdef_pid
         | 
| 55 | 
            +
                    sdef_pids << sdef_pid
         | 
| 56 | 
            +
                  end
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
                # iterate over SDef pointers, identify symbols in yaml map
         | 
| 59 | 
            +
                # inject methods by symbol key
         | 
| 60 | 
            +
                def add_sdef_methods! sdef_pid
         | 
| 61 | 
            +
                  unless sdef_pid == "fedora-system:3"
         | 
| 62 | 
            +
                    content = ActiveFedora::RubydoraConnection.instance.connection.datastream_dissemination(:pid=>sdef_pid, :dsid=>"METHODMAP")
         | 
| 63 | 
            +
                    method_map = Nokogiri::XML.parse(content)
         | 
| 64 | 
            +
                    methods = method_map.xpath('//fmm:Method').collect { |method|
         | 
| 65 | 
            +
                      method["operationName"]
         | 
| 66 | 
            +
                    }
         | 
| 67 | 
            +
                  else
         | 
| 68 | 
            +
                    methods = ["viewObjectProfile","viewMethodIndex","viewItemIndex","viewDublinCore"]
         | 
| 69 | 
            +
                  end
         | 
| 70 | 
            +
                  methods.each { |method|
         | 
| 71 | 
            +
                    add_method!(sdef_pid, method)
         | 
| 72 | 
            +
                  }
         | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
                def add_method!(sdef_pid, method_name)
         | 
| 75 | 
            +
                  # find method_key
         | 
| 76 | 
            +
                  method_key = ServiceDefinitions.lookup_method(sdef_pid, method_name)
         | 
| 77 | 
            +
                  if method_key and not method_defined? method_key
         | 
| 78 | 
            +
                    define_method(method_key) { |*args, &block|
         | 
| 79 | 
            +
                        opts = args[0] || {}
         | 
| 80 | 
            +
                        opts = opts.merge({:pid => pid, :sdef => sdef_pid, :method => method_name })
         | 
| 81 | 
            +
                        repo = ActiveFedora::RubydoraConnection.instance.connection
         | 
| 82 | 
            +
                      # dispatch to the dissemination method on restAPI client
         | 
| 83 | 
            +
                        repo.dissemination opts, &block
         | 
| 84 | 
            +
                    }
         | 
| 85 | 
            +
                  end
         | 
| 86 | 
            +
                end
         | 
| 87 | 
            +
              end
         | 
| 88 | 
            +
            end
         | 
| 89 | 
            +
            end
         | 
| @@ -0,0 +1,40 @@ | |
| 1 | 
            +
            module ActiveFedora
         | 
| 2 | 
            +
              # Helps Rubydora create datastreams of the type defined by the ActiveFedora::Base#datastream_class_for_name
         | 
| 3 | 
            +
              class UnsavedDigitalObject 
         | 
| 4 | 
            +
                attr_accessor :original_class, :datastreams, :label, :namespace
         | 
| 5 | 
            +
                
         | 
| 6 | 
            +
                def initialize(original_class, namespace)
         | 
| 7 | 
            +
                  self.original_class = original_class
         | 
| 8 | 
            +
                  self.namespace = namespace
         | 
| 9 | 
            +
                  self.datastreams = {}
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                def pid
         | 
| 13 | 
            +
                  '__DO_NOT_USE__'
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                def new?
         | 
| 17 | 
            +
                  true
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                ### Change this into a real digital object
         | 
| 21 | 
            +
                def save
         | 
| 22 | 
            +
                  obj = DigitalObject.find(self.original_class, assign_pid)
         | 
| 23 | 
            +
                  self.datastreams.each do |k, v|
         | 
| 24 | 
            +
                    v.digital_object = obj
         | 
| 25 | 
            +
                    obj.datastreams[k] = v
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
                  obj
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                def assign_pid
         | 
| 31 | 
            +
                    args = {}
         | 
| 32 | 
            +
                    args[:namespace] = self.namespace if self.namespace
         | 
| 33 | 
            +
                    RubydoraConnection.instance.nextid args
         | 
| 34 | 
            +
                end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
             | 
| 37 | 
            +
             | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
            end
         | 
| 40 | 
            +
             | 
| @@ -11,11 +11,6 @@ class MockAFBaseRelationship < ActiveFedora::Base | |
| 11 11 | 
             
              has_relationship "testing3", :is_member_of_collection
         | 
| 12 12 | 
             
            end
         | 
| 13 13 |  | 
| 14 | 
            -
            class MockAFBaseDatastream < ActiveFedora::Base
         | 
| 15 | 
            -
              has_datastream :name=>"thumbnail",:prefix => "THUMB", :type=>ActiveFedora::Datastream, :mimeType=>"image/jpeg", :controlGroup=>'M'
         | 
| 16 | 
            -
              has_datastream :name=>"high", :type=>ActiveFedora::Datastream, :mimeType=>"image/jpeg", :controlGroup=>'M' 
         | 
| 17 | 
            -
            end
         | 
| 18 | 
            -
             | 
| 19 14 | 
             
            class MockAFBaseFromSolr < ActiveFedora::Base
         | 
| 20 15 | 
             
              has_relationship "testing", :has_part, :type=>MockAFBaseFromSolr
         | 
| 21 16 | 
             
              has_relationship "testing2", :has_member, :type=>MockAFBaseFromSolr
         | 
| @@ -39,7 +34,7 @@ end | |
| 39 34 | 
             
            describe "Datastreams synched together" do
         | 
| 40 35 | 
             
              before do
         | 
| 41 36 | 
             
                class DSTest < ActiveFedora::Base
         | 
| 42 | 
            -
                  def  | 
| 37 | 
            +
                  def load_datastreams
         | 
| 43 38 | 
             
                    super
         | 
| 44 39 | 
             
                    unless self.datastreams.keys.include? 'test_ds'
         | 
| 45 40 | 
             
                     add_file_datastream("XXX",:dsid=>'test_ds', :mimeType=>'text/html')
         | 
| @@ -101,12 +96,6 @@ describe ActiveFedora::Base do | |
| 101 96 | 
             
                  @test_object.pid.should_not be_nil
         | 
| 102 97 | 
             
                end
         | 
| 103 98 |  | 
| 104 | 
            -
                it "passing namespace to constructor with no pid should generate a pid with the supplied namespace" do
         | 
| 105 | 
            -
                  @test_object2 = ActiveFedora::Base.new({:namespace=>"randomNamespace"})
         | 
| 106 | 
            -
                  #@test_object2.pid.match('changeme:\d+').to_a.first.should == @test_object2.pid
         | 
| 107 | 
            -
                  # will be nil if match failed, otherwise will equal pid
         | 
| 108 | 
            -
                  @test_object2.pid.match('randomNamespace:\d+').to_a.first.should == @test_object2.pid
         | 
| 109 | 
            -
                end
         | 
| 110 99 | 
             
              end
         | 
| 111 100 |  | 
| 112 101 | 
             
              describe ".save" do
         | 
| @@ -118,6 +107,13 @@ describe ActiveFedora::Base do | |
| 118 107 | 
             
                  @test_object2.delete
         | 
| 119 108 | 
             
                end
         | 
| 120 109 |  | 
| 110 | 
            +
                it "passing namespace to constructor with no pid should generate a pid with the supplied namespace" do
         | 
| 111 | 
            +
                  @test_object2 = ActiveFedora::Base.new({:namespace=>"randomNamespace"})
         | 
| 112 | 
            +
                  # will be nil if match failed, otherwise will equal pid
         | 
| 113 | 
            +
                  @test_object2.save
         | 
| 114 | 
            +
                  @test_object2.pid.match('randomNamespace:\d+').to_a.first.should == @test_object2.pid
         | 
| 115 | 
            +
                end
         | 
| 116 | 
            +
             | 
| 121 117 | 
             
                it "should set the CMA hasModel relationship in the Rels-EXT" do 
         | 
| 122 118 | 
             
                  @test_object2.save
         | 
| 123 119 | 
             
                  rexml = REXML::Document.new(@test_object2.datastreams["RELS-EXT"].content)
         | 
| @@ -125,9 +121,9 @@ describe ActiveFedora::Base do | |
| 125 121 | 
             
                  rexml.root.elements["rdf:Description/ns0:hasModel"].attributes["rdf:resource"].should == 'info:fedora/afmodel:ActiveFedora_Base'
         | 
| 126 122 | 
             
                end
         | 
| 127 123 | 
             
                it "should merge attributes from fedora into attributes hash" do
         | 
| 124 | 
            +
                  @test_object2.save
         | 
| 128 125 | 
             
                  inner_object = @test_object2.inner_object
         | 
| 129 126 | 
             
                  inner_object.pid.should == @test_object2.pid
         | 
| 130 | 
            -
                  @test_object2.save
         | 
| 131 127 | 
             
                  inner_object.should respond_to(:state)
         | 
| 132 128 | 
             
                  inner_object.should respond_to(:lastModifiedDate)
         | 
| 133 129 | 
             
                  inner_object.should respond_to(:ownerId)
         | 
| @@ -231,12 +227,9 @@ describe ActiveFedora::Base do | |
| 231 227 |  | 
| 232 228 | 
             
              describe '.add_relationship' do
         | 
| 233 229 | 
             
                it "should update the RELS-EXT datastream and relationships should end up in Fedora when the object is saved" do
         | 
| 234 | 
            -
                   | 
| 235 | 
            -
             | 
| 236 | 
            -
             | 
| 237 | 
            -
                  test_relationships.each do |rel|
         | 
| 238 | 
            -
                    @test_object.add_relationship(rel.predicate, rel.object)
         | 
| 239 | 
            -
                  end
         | 
| 230 | 
            +
                  @test_object.add_relationship(:is_member_of, "info:fedora/demo:5")
         | 
| 231 | 
            +
                  @test_object.add_relationship(:is_member_of, "info:fedora/demo:10")
         | 
| 232 | 
            +
                  @test_object.add_relationship(:conforms_to, "info:fedora/afmodel:OralHistory")
         | 
| 240 233 | 
             
                  @test_object.save
         | 
| 241 234 | 
             
                  rexml = REXML::Document.new(@test_object.datastreams["RELS-EXT"].content)
         | 
| 242 235 | 
             
                  # Purpose: confirm that the isMemberOf entries exist and have real RDF in them
         | 
| @@ -321,9 +314,11 @@ describe ActiveFedora::Base do | |
| 321 314 | 
             
              describe "delete" do
         | 
| 322 315 |  | 
| 323 316 | 
             
                it "should delete the object from Fedora and Solr" do
         | 
| 317 | 
            +
                  @test_object.save
         | 
| 324 318 | 
             
                  ActiveFedora::Base.find_by_solr(@test_object.pid).hits.first["id"].should == @test_object.pid
         | 
| 319 | 
            +
                  pid = @test_object.pid # store so we can access it after deletion
         | 
| 325 320 | 
             
                  @test_object.delete
         | 
| 326 | 
            -
                  ActiveFedora::Base.find_by_solr( | 
| 321 | 
            +
                  ActiveFedora::Base.find_by_solr(pid).hits.should be_empty
         | 
| 327 322 | 
             
                end
         | 
| 328 323 |  | 
| 329 324 | 
             
                describe '#delete' do
         | 
| @@ -347,24 +342,19 @@ describe ActiveFedora::Base do | |
| 347 342 | 
             
                    @test_object5.add_relationship_by_name("testing2",@test_object3)
         | 
| 348 343 | 
             
                    @test_object2.save
         | 
| 349 344 | 
             
                    @test_object5.save
         | 
| 350 | 
            -
                    r2 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object2)
         | 
| 351 | 
            -
                    r3 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object3)
         | 
| 352 | 
            -
                    r4 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object4)
         | 
| 353 | 
            -
                    r5 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object5)
         | 
| 354 | 
            -
                    model_rel = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>ActiveFedora::ContentModel.pid_from_ruby_class(MockAFBaseRelationship))
         | 
| 355 345 | 
             
                    #check inbound correct, testing goes to :has_part and testing2 goes to :has_member
         | 
| 356 | 
            -
                    @test_object2.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[ | 
| 357 | 
            -
                    @test_object3.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[ | 
| 358 | 
            -
                    @test_object4.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[ | 
| 359 | 
            -
                    @test_object5.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[]}, :self=>{"testing2"=>[ | 
| 346 | 
            +
                    @test_object2.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[@test_object5.internal_uri], "testing_inbound2"=>[]}, :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"=>[]}}
         | 
| 347 | 
            +
                    @test_object3.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[@test_object2.internal_uri], "testing_inbound2"=>[@test_object5.internal_uri]}, :self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 348 | 
            +
                    @test_object4.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[@test_object2.internal_uri]}, :self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 349 | 
            +
                    @test_object5.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[]}, :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"=>[]}}
         | 
| 360 350 | 
             
                    @test_object2.delete
         | 
| 361 351 | 
             
                    #need to reload since removed from rels_ext in memory
         | 
| 362 352 | 
             
                    @test_object5 = MockAFBaseRelationship.load_instance(@test_object5.pid)
         | 
| 363 353 |  | 
| 364 354 | 
             
                    #check any test_object2 inbound rels gone from source
         | 
| 365 | 
            -
                    @test_object3.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[ | 
| 355 | 
            +
                    @test_object3.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[@test_object5.internal_uri]}, :self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 366 356 | 
             
                    @test_object4.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[]}, :self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 367 | 
            -
                    @test_object5.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[]}, :self=>{"testing2"=>[ | 
| 357 | 
            +
                    @test_object5.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[]}, :self=>{"testing2"=>[@test_object3.internal_uri], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 368 358 | 
             
                end
         | 
| 369 359 | 
             
              end
         | 
| 370 360 |  | 
| @@ -373,6 +363,7 @@ describe ActiveFedora::Base do | |
| 373 363 | 
             
              describe '#remove_relationship' do
         | 
| 374 364 | 
             
                it 'should remove a relationship from an object after a save' do
         | 
| 375 365 | 
             
                  @test_object2 = ActiveFedora::Base.new
         | 
| 366 | 
            +
                  @test_object2.save
         | 
| 376 367 | 
             
                  @test_object.add_relationship(:has_part,@test_object2)
         | 
| 377 368 | 
             
                  @test_object.save
         | 
| 378 369 | 
             
                  @pid = @test_object.pid
         | 
| @@ -382,16 +373,11 @@ describe ActiveFedora::Base do | |
| 382 373 | 
             
                    puts "#{e.message}\n#{e.backtrace}"
         | 
| 383 374 | 
             
                    raise e
         | 
| 384 375 | 
             
                  end
         | 
| 385 | 
            -
                   | 
| 386 | 
            -
                  r = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object2)
         | 
| 387 | 
            -
                  model_rel = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>ActiveFedora::ContentModel.pid_from_ruby_class(ActiveFedora::Base))
         | 
| 388 | 
            -
            #      @test_object.relationships.should == {:self=>{:has_model=>[model_rel.object], :has_part=>[r.object]}}
         | 
| 389 | 
            -
                  stmt = @test_object.build_statement(@test_object.internal_uri, :has_part, r.object)
         | 
| 390 | 
            -
                  @test_object.relationships.has_statement?(stmt).should be_true
         | 
| 376 | 
            +
                  @test_object.object_relations[:has_part].should include @test_object2.internal_uri
         | 
| 391 377 | 
             
                  @test_object.remove_relationship(:has_part,@test_object2)
         | 
| 392 378 | 
             
                  @test_object.save
         | 
| 393 379 | 
             
                  @test_object = ActiveFedora::Base.load_instance(@pid)
         | 
| 394 | 
            -
                  @test_object. | 
| 380 | 
            +
                  @test_object.object_relations[:has_part].should be_nil
         | 
| 395 381 | 
             
                end
         | 
| 396 382 | 
             
              end
         | 
| 397 383 |  | 
| @@ -414,64 +400,38 @@ describe ActiveFedora::Base do | |
| 414 400 | 
             
                  @test_object5.testing_bidirectional_append(@test_object4)
         | 
| 415 401 | 
             
                  @test_object2.save
         | 
| 416 402 | 
             
                  @test_object5.save
         | 
| 417 | 
            -
                   | 
| 418 | 
            -
                  r3 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object3)
         | 
| 419 | 
            -
                  r4 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object4)
         | 
| 420 | 
            -
                  r5 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object5)
         | 
| 421 | 
            -
                  model_rel = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>ActiveFedora::ContentModel.pid_from_ruby_class(MockAFBaseRelationship))
         | 
| 403 | 
            +
                  model_rel = ActiveFedora::ContentModel.pid_from_ruby_class(MockAFBaseRelationship)
         | 
| 422 404 | 
             
                  #check inbound correct, testing goes to :has_part and testing2 goes to :has_member
         | 
| 423 | 
            -
                   | 
| 424 | 
            -
                  @test_object2. | 
| 425 | 
            -
             | 
| 426 | 
            -
                  @test_object2. | 
| 427 | 
            -
                   | 
| 428 | 
            -
                  @test_object2. | 
| 429 | 
            -
             | 
| 430 | 
            -
                  @ | 
| 431 | 
            -
                  @ | 
| 432 | 
            -
             | 
| 433 | 
            -
                  @ | 
| 434 | 
            -
                  @ | 
| 435 | 
            -
                                                                           :has_member=>[r5.object]}
         | 
| 436 | 
            -
                  stmt = @test_object4.build_statement(@test_object4.internal_uri, :has_model, model_rel.object)
         | 
| 437 | 
            -
                  @test_object4.relationships.has_statement?(stmt).should be_true
         | 
| 438 | 
            -
                  @test_object4.inbound_relationships.should == {:has_member=>[r2.object],:has_collection_member=>[r5.object]}
         | 
| 405 | 
            +
                  @test_object2.object_relations[:has_model].should include model_rel
         | 
| 406 | 
            +
                  @test_object2.object_relations[:has_part].should include @test_object3
         | 
| 407 | 
            +
             | 
| 408 | 
            +
                  @test_object2.object_relations[:has_member].should include @test_object4 
         | 
| 409 | 
            +
                  @test_object2.object_relations[:is_member_of_collection].should include @test_object5
         | 
| 410 | 
            +
                  @test_object2.inbound_relationships.should == {:has_part=>[@test_object5.internal_uri]}
         | 
| 411 | 
            +
             | 
| 412 | 
            +
                  @test_object3.object_relations[:has_model].should include model_rel
         | 
| 413 | 
            +
                  @test_object3.inbound_relationships.should == {:has_part=>[@test_object2.internal_uri],
         | 
| 414 | 
            +
                                                                           :has_member=>[@test_object5.internal_uri]}
         | 
| 415 | 
            +
                  @test_object4.object_relations[:has_model].should include model_rel
         | 
| 416 | 
            +
                  @test_object4.inbound_relationships.should == {:has_member=>[@test_object2.internal_uri],:has_collection_member=>[@test_object5.internal_uri]}
         | 
| 439 417 |  | 
| 440 | 
            -
                   | 
| 441 | 
            -
                  @test_object5. | 
| 442 | 
            -
                   | 
| 443 | 
            -
                  @test_object5. | 
| 444 | 
            -
                   | 
| 445 | 
            -
                  @test_object5.relationships.has_statement?(stmt).should be_true
         | 
| 446 | 
            -
                  stmt = @test_object5.build_statement(@test_object5.internal_uri, :has_collection_member, r4.object)
         | 
| 447 | 
            -
                  @test_object5.relationships.has_statement?(stmt).should be_true
         | 
| 448 | 
            -
                  @test_object5.inbound_relationships.should == {:is_member_of_collection=>[r2.object]}
         | 
| 449 | 
            -
                  # @test_object2.outbound_relationships.should == {:has_model=>[model_rel.object],
         | 
| 450 | 
            -
                  #                                                       :has_part=>[r3.object],
         | 
| 451 | 
            -
                  #                                                       :has_member=>[r4.object],
         | 
| 452 | 
            -
                  #                                                       :is_member_of_collection=>[r5.object]}
         | 
| 453 | 
            -
                  # @test_object3.outbound_relationships.should == {:has_model=>[model_rel.object]}
         | 
| 454 | 
            -
                  # @test_object4.outbound_relationships.should == {:has_model=>[model_rel.object]}
         | 
| 455 | 
            -
                  # @test_object5.outbound_relationships.should == {:has_model=>[model_rel.object],
         | 
| 456 | 
            -
                  #                                                       :has_part=>[r2.object],
         | 
| 457 | 
            -
                  #                                                       :has_member=>[r3.object],
         | 
| 458 | 
            -
                  #                                                       :has_collection_member=>[r4.object]}
         | 
| 418 | 
            +
                  @test_object5.object_relations[:has_model].should include model_rel
         | 
| 419 | 
            +
                  @test_object5.object_relations[:has_part].should include @test_object2
         | 
| 420 | 
            +
                  @test_object5.object_relations[:has_member].should include @test_object3 
         | 
| 421 | 
            +
                  @test_object5.object_relations[:has_collection_member].should include @test_object4 
         | 
| 422 | 
            +
                  @test_object5.inbound_relationships.should == {:is_member_of_collection=>[@test_object2.internal_uri]}
         | 
| 459 423 | 
             
                end
         | 
| 460 424 | 
             
              end
         | 
| 461 425 |  | 
| 462 426 | 
             
              describe '#inbound_relationships' do
         | 
| 463 427 | 
             
                it 'should return a hash of inbound relationships' do
         | 
| 464 428 | 
             
                  @test_object2 = MockAFBaseRelationship.new
         | 
| 465 | 
            -
                  #@test_object2.new_object = true
         | 
| 466 429 | 
             
                  @test_object2.save
         | 
| 467 430 | 
             
                  @test_object3 = MockAFBaseRelationship.new
         | 
| 468 | 
            -
                  #@test_object3.new_object = true
         | 
| 469 431 | 
             
                  @test_object3.save
         | 
| 470 432 | 
             
                  @test_object4 = MockAFBaseRelationship.new
         | 
| 471 | 
            -
                  #@test_object4.new_object = true
         | 
| 472 433 | 
             
                  @test_object4.save
         | 
| 473 434 | 
             
                  @test_object5 = MockAFBaseRelationship.new
         | 
| 474 | 
            -
                  #@test_object5.new_object = true
         | 
| 475 435 | 
             
                  @test_object5.save
         | 
| 476 436 | 
             
                  #append to named relationship 'testing'
         | 
| 477 437 | 
             
                  @test_object2.testing_append(@test_object3)
         | 
| @@ -481,15 +441,10 @@ describe ActiveFedora::Base do | |
| 481 441 | 
             
                  #@test_object5.testing_bidirectional_append(@test_object4)
         | 
| 482 442 | 
             
                  @test_object2.save
         | 
| 483 443 | 
             
                  @test_object5.save
         | 
| 484 | 
            -
                  r2 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object2)
         | 
| 485 | 
            -
                  r3 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object3)
         | 
| 486 | 
            -
                  r4 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object4)
         | 
| 487 | 
            -
                  r5 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object5)
         | 
| 488 | 
            -
                  model_rel = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>ActiveFedora::ContentModel.pid_from_ruby_class(MockAFBaseRelationship))
         | 
| 489 444 | 
             
                  #check inbound correct, testing goes to :has_part and testing2 goes to :has_member
         | 
| 490 | 
            -
                  @test_object2.inbound_relationships.should == {:has_part=>[ | 
| 491 | 
            -
                  @test_object3.inbound_relationships.should == {:has_part=>[ | 
| 492 | 
            -
                  @test_object4.inbound_relationships.should == {:has_member=>[ | 
| 445 | 
            +
                  @test_object2.inbound_relationships.should == {:has_part=>[@test_object5.internal_uri]}
         | 
| 446 | 
            +
                  @test_object3.inbound_relationships.should == {:has_part=>[@test_object2.internal_uri],:has_member=>[@test_object5.internal_uri]}
         | 
| 447 | 
            +
                  @test_object4.inbound_relationships.should == {:has_member=>[@test_object2.internal_uri]}
         | 
| 493 448 | 
             
                  @test_object5.inbound_relationships.should == {}
         | 
| 494 449 | 
             
                end
         | 
| 495 450 | 
             
              end
         | 
| @@ -497,16 +452,12 @@ describe ActiveFedora::Base do | |
| 497 452 | 
             
              describe '#inbound_relationships_by_name' do
         | 
| 498 453 | 
             
                it 'should return a hash of inbound relationship names to array of objects' do
         | 
| 499 454 | 
             
                  @test_object2 = MockAFBaseRelationship.new
         | 
| 500 | 
            -
                  #@test_object2.new_object = true
         | 
| 501 455 | 
             
                  @test_object2.save
         | 
| 502 456 | 
             
                  @test_object3 = MockAFBaseRelationship.new
         | 
| 503 | 
            -
                  #@test_object3.new_object = true
         | 
| 504 457 | 
             
                  @test_object3.save
         | 
| 505 458 | 
             
                  @test_object4 = MockAFBaseRelationship.new
         | 
| 506 | 
            -
                  #@test_object4.new_object = true
         | 
| 507 459 | 
             
                  @test_object4.save
         | 
| 508 460 | 
             
                  @test_object5 = MockAFBaseRelationship.new
         | 
| 509 | 
            -
                  #@test_object5.new_object = true
         | 
| 510 461 | 
             
                  @test_object5.save
         | 
| 511 462 | 
             
                  #append to named relationship 'testing'
         | 
| 512 463 | 
             
                  @test_object2.testing_append(@test_object3)
         | 
| @@ -515,17 +466,12 @@ describe ActiveFedora::Base do | |
| 515 466 | 
             
                  @test_object5.testing2_append(@test_object3)
         | 
| 516 467 | 
             
                  @test_object2.save
         | 
| 517 468 | 
             
                  @test_object5.save
         | 
| 518 | 
            -
                  r2 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object2)
         | 
| 519 | 
            -
                  r3 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object3)
         | 
| 520 | 
            -
                  r4 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object4)
         | 
| 521 | 
            -
                  r5 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object5)
         | 
| 522 | 
            -
                  model_rel = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>ActiveFedora::ContentModel.pid_from_ruby_class(MockAFBaseRelationship))
         | 
| 523 469 | 
             
                  #check inbound correct, testing goes to :has_part and testing2 goes to :has_member
         | 
| 524 | 
            -
                  @test_object2.inbound_relationships_by_name.should == {"testing_inbound"=>[ | 
| 470 | 
            +
                  @test_object2.inbound_relationships_by_name.should == {"testing_inbound"=>[@test_object5.internal_uri],"testing_inbound2"=>[],
         | 
| 525 471 | 
             
                                                                       "testing_bidirectional_inbound"=>[],"testing_inbound3"=>[], "parts_inbound" => []}
         | 
| 526 | 
            -
                  @test_object3.inbound_relationships_by_name.should == {"testing_inbound"=>[ | 
| 472 | 
            +
                  @test_object3.inbound_relationships_by_name.should == {"testing_inbound"=>[@test_object2.internal_uri],"testing_inbound2"=>[@test_object5.internal_uri],
         | 
| 527 473 | 
             
                                                                       "testing_bidirectional_inbound"=>[],"testing_inbound3"=>[], "parts_inbound" => []}
         | 
| 528 | 
            -
                  @test_object4.inbound_relationships_by_name.should == {"testing_inbound"=>[],"testing_inbound2"=>[ | 
| 474 | 
            +
                  @test_object4.inbound_relationships_by_name.should == {"testing_inbound"=>[],"testing_inbound2"=>[@test_object2.internal_uri],
         | 
| 529 475 | 
             
                                                                       "testing_bidirectional_inbound"=>[],"testing_inbound3"=>[], "parts_inbound" => []}
         | 
| 530 476 | 
             
                  @test_object5.inbound_relationships_by_name.should == {"testing_inbound"=>[],"testing_inbound2"=>[],
         | 
| 531 477 | 
             
                                                                       "testing_bidirectional_inbound"=>[],"testing_inbound3"=>[], "parts_inbound" => []}
         | 
| @@ -535,16 +481,12 @@ describe ActiveFedora::Base do | |
| 535 481 | 
             
              describe '#relationships_by_name' do
         | 
| 536 482 | 
             
                it '' do
         | 
| 537 483 | 
             
                  @test_object2 = MockAFBaseRelationship.new
         | 
| 538 | 
            -
                  #@test_object2.new_object = true
         | 
| 539 484 | 
             
                  @test_object2.save
         | 
| 540 485 | 
             
                  @test_object3 = MockAFBaseRelationship.new
         | 
| 541 | 
            -
                  #@test_object3.new_object = true
         | 
| 542 486 | 
             
                  @test_object3.save
         | 
| 543 487 | 
             
                  @test_object4 = MockAFBaseRelationship.new
         | 
| 544 | 
            -
                  #@test_object4.new_object = true
         | 
| 545 488 | 
             
                  @test_object4.save
         | 
| 546 489 | 
             
                  @test_object5 = MockAFBaseRelationship.new
         | 
| 547 | 
            -
                  #@test_object5.new_object = true
         | 
| 548 490 | 
             
                  @test_object5.save
         | 
| 549 491 | 
             
                  #append to named relationship 'testing'
         | 
| 550 492 | 
             
                  @test_object2.testing_append(@test_object3)
         | 
| @@ -553,21 +495,16 @@ describe ActiveFedora::Base do | |
| 553 495 | 
             
                  @test_object5.testing2_append(@test_object3)
         | 
| 554 496 | 
             
                  @test_object2.save
         | 
| 555 497 | 
             
                  @test_object5.save
         | 
| 556 | 
            -
                  r2 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object2)
         | 
| 557 | 
            -
                  r3 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object3)
         | 
| 558 | 
            -
                  r4 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object4)
         | 
| 559 | 
            -
                  r5 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object5)
         | 
| 560 | 
            -
                  model_rel = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>ActiveFedora::ContentModel.pid_from_ruby_class(MockAFBaseRelationship))
         | 
| 561 498 | 
             
                  #check inbound correct, testing goes to :has_part and testing2 goes to :has_member
         | 
| 562 | 
            -
                  @test_object2.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[ | 
| 563 | 
            -
                  @test_object3.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[ | 
| 564 | 
            -
                  @test_object4.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[ | 
| 565 | 
            -
                  @test_object5.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[]}, :self=>{"testing2"=>[ | 
| 499 | 
            +
                  @test_object2.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[@test_object5.internal_uri], "testing_inbound2"=>[]}, :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"=>[]}}
         | 
| 500 | 
            +
                  @test_object3.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[@test_object2.internal_uri], "testing_inbound2"=>[@test_object5.internal_uri]}, :self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 501 | 
            +
                  @test_object4.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[@test_object2.internal_uri]}, :self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 502 | 
            +
                  @test_object5.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[]}, :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"=>[]}}
         | 
| 566 503 | 
             
                  #all inbound should now be empty if no parameter supplied to relationships
         | 
| 567 | 
            -
                  @test_object2.relationships_by_name.should == {:self=>{"testing2"=>[ | 
| 504 | 
            +
                  @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"=>[]}}
         | 
| 568 505 | 
             
                  @test_object3.relationships_by_name.should == {:self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 569 506 | 
             
                  @test_object4.relationships_by_name.should == {:self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 570 | 
            -
                  @test_object5.relationships_by_name.should == {:self=>{"testing2"=>[ | 
| 507 | 
            +
                  @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"=>[]}}
         | 
| 571 508 | 
             
                end
         | 
| 572 509 | 
             
              end
         | 
| 573 510 |  | 
| @@ -592,16 +529,11 @@ describe ActiveFedora::Base do | |
| 592 529 | 
             
                  @test_object5.add_relationship_by_name("testing2",@test_object3)
         | 
| 593 530 | 
             
                  @test_object2.save
         | 
| 594 531 | 
             
                  @test_object5.save
         | 
| 595 | 
            -
                  r2 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object2)
         | 
| 596 | 
            -
                  r3 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object3)
         | 
| 597 | 
            -
                  r4 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object4)
         | 
| 598 | 
            -
                  r5 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object5)
         | 
| 599 | 
            -
                  model_rel = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>ActiveFedora::ContentModel.pid_from_ruby_class(MockAFBaseRelationship))
         | 
| 600 532 | 
             
                  #check inbound correct, testing goes to :has_part and testing2 goes to :has_member
         | 
| 601 | 
            -
                  @test_object2.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[ | 
| 602 | 
            -
                  @test_object3.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[ | 
| 603 | 
            -
                  @test_object4.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[ | 
| 604 | 
            -
                  @test_object5.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[]}, :self=>{"testing2"=>[ | 
| 533 | 
            +
                  @test_object2.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[@test_object5.internal_uri], "testing_inbound2"=>[]}, :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"=>[]}}
         | 
| 534 | 
            +
                  @test_object3.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[@test_object2.internal_uri], "testing_inbound2"=>[@test_object5.internal_uri]}, :self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 535 | 
            +
                  @test_object4.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[@test_object2.internal_uri]}, :self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 536 | 
            +
                  @test_object5.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[]}, :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"=>[]}}
         | 
| 605 537 | 
             
                end
         | 
| 606 538 | 
             
              end
         | 
| 607 539 |  | 
| @@ -626,28 +558,24 @@ describe ActiveFedora::Base do | |
| 626 558 | 
             
                  @test_object5.add_relationship_by_name("testing2",@test_object3)
         | 
| 627 559 | 
             
                  @test_object2.save
         | 
| 628 560 | 
             
                  @test_object5.save
         | 
| 629 | 
            -
                  r2 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object2)
         | 
| 630 | 
            -
                  r3 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object3)
         | 
| 631 | 
            -
                  r4 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object4)
         | 
| 632 | 
            -
                  r5 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object5)
         | 
| 633 | 
            -
                  model_rel = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>ActiveFedora::ContentModel.pid_from_ruby_class(MockAFBaseRelationship))
         | 
| 634 561 | 
             
                  #check inbound correct, testing goes to :has_part and testing2 goes to :has_member
         | 
| 635 | 
            -
                  @test_object2.relationships_by_name(false).should == {:self=>{"testing"=>[ | 
| 636 | 
            -
                                                                        "testing2"=>[ | 
| 562 | 
            +
                  @test_object2.relationships_by_name(false).should == {:self=>{"testing"=>[@test_object3.internal_uri],
         | 
| 563 | 
            +
                                                                        "testing2"=>[@test_object4.internal_uri],
         | 
| 637 564 | 
             
                                                                        "testing_bidirectional_outbound"=>[],"testing3"=>[], 
         | 
| 638 | 
            -
                                                                        "collection_members"=>[], "part_of"=>[], "parts_outbound"=>[ | 
| 639 | 
            -
                                                                :inbound=>{"testing_inbound"=>[ | 
| 565 | 
            +
                                                                        "collection_members"=>[], "part_of"=>[], "parts_outbound"=>[@test_object3.internal_uri]},
         | 
| 566 | 
            +
                                                                :inbound=>{"testing_inbound"=>[@test_object5.internal_uri],"testing_inbound2"=>[],
         | 
| 640 567 | 
             
                      "testing_bidirectional_inbound"=>[],"testing_inbound3"=>[], "parts_inbound"=>[]}}
         | 
| 641 | 
            -
                  @test_object3.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[ | 
| 642 | 
            -
                  @test_object4.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[ | 
| 643 | 
            -
                  @test_object5.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[]}, :self=>{"testing2"=>[ | 
| 644 | 
            -
                  @test_object2.remove_relationship_by_name("testing",@test_object3)
         | 
| 568 | 
            +
                  @test_object3.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[@test_object2.internal_uri], "testing_inbound2"=>[@test_object5.internal_uri]}, :self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 569 | 
            +
                  @test_object4.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[@test_object2.internal_uri]}, :self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 570 | 
            +
                  @test_object5.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[]}, :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"=>[]}}
         | 
| 571 | 
            +
                  @test_object2.remove_relationship_by_name("testing",@test_object3.internal_uri)
         | 
| 645 572 | 
             
                  @test_object2.save
         | 
| 646 573 | 
             
                  #check now removed for both outbound and inbound
         | 
| 647 | 
            -
                  @test_object2.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[ | 
| 648 | 
            -
             | 
| 649 | 
            -
                  @ | 
| 650 | 
            -
                   | 
| 574 | 
            +
                  @test_object2.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[@test_object5.internal_uri], "testing_inbound2"=>[]}, :self=>{"testing2"=>[@test_object4.internal_uri], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 575 | 
            +
             | 
| 576 | 
            +
                  @test_object3.inbound_relationships[:has_part].should be_nil
         | 
| 577 | 
            +
                  
         | 
| 578 | 
            +
                  @test_object3.relationships_by_name(false).should == {:inbound=>{"testing_inbound3"=>[], "testing_bidirectional_inbound"=>[], "parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[@test_object5.internal_uri]}, :self=>{"testing2"=>[], "collection_members"=>[], "testing3"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[], "testing_bidirectional_outbound"=>[]}}
         | 
| 651 579 | 
             
                end
         | 
| 652 580 | 
             
              end
         | 
| 653 581 |  | 
| @@ -668,153 +596,26 @@ describe ActiveFedora::Base do | |
| 668 596 | 
             
                  @test_object5.add_relationship_by_name("testing2",@test_object3)
         | 
| 669 597 | 
             
                  @test_object2.save
         | 
| 670 598 | 
             
                  @test_object5.save
         | 
| 671 | 
            -
                   | 
| 672 | 
            -
                   | 
| 673 | 
            -
                   | 
| 674 | 
            -
                  r5 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object5)
         | 
| 675 | 
            -
                  model_rel = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>ActiveFedora::ContentModel.pid_from_ruby_class(MockAFBaseRelationship))
         | 
| 676 | 
            -
                  @test_object2.find_relationship_by_name("testing").should == [r3.object]
         | 
| 677 | 
            -
                  @test_object2.find_relationship_by_name("testing2").should == [r4.object]
         | 
| 678 | 
            -
                  @test_object2.find_relationship_by_name("testing_inbound").should == [r5.object]
         | 
| 599 | 
            +
                  @test_object2.find_relationship_by_name("testing").should == [@test_object3.internal_uri]
         | 
| 600 | 
            +
                  @test_object2.find_relationship_by_name("testing2").should == [@test_object4.internal_uri]
         | 
| 601 | 
            +
                  @test_object2.find_relationship_by_name("testing_inbound").should == [@test_object5.internal_uri]
         | 
| 679 602 | 
             
                  @test_object2.find_relationship_by_name("testing_inbound2").should == []
         | 
| 680 603 | 
             
                  @test_object3.find_relationship_by_name("testing").should == []
         | 
| 681 604 | 
             
                  @test_object3.find_relationship_by_name("testing2").should == []
         | 
| 682 | 
            -
                  @test_object3.find_relationship_by_name("testing_inbound").should == [ | 
| 683 | 
            -
                  @test_object3.find_relationship_by_name("testing_inbound2").should == [ | 
| 605 | 
            +
                  @test_object3.find_relationship_by_name("testing_inbound").should == [@test_object2.internal_uri]
         | 
| 606 | 
            +
                  @test_object3.find_relationship_by_name("testing_inbound2").should == [@test_object5.internal_uri]
         | 
| 684 607 | 
             
                  @test_object4.find_relationship_by_name("testing").should == []
         | 
| 685 608 | 
             
                  @test_object4.find_relationship_by_name("testing2").should == []
         | 
| 686 609 | 
             
                  @test_object4.find_relationship_by_name("testing_inbound").should == []
         | 
| 687 | 
            -
                  @test_object4.find_relationship_by_name("testing_inbound2").should == [ | 
| 688 | 
            -
                  @test_object5.find_relationship_by_name("testing").should == [ | 
| 689 | 
            -
                  @test_object5.find_relationship_by_name("testing2").should == [ | 
| 610 | 
            +
                  @test_object4.find_relationship_by_name("testing_inbound2").should == [@test_object2.internal_uri]
         | 
| 611 | 
            +
                  @test_object5.find_relationship_by_name("testing").should == [@test_object2.internal_uri]
         | 
| 612 | 
            +
                  @test_object5.find_relationship_by_name("testing2").should == [@test_object3.internal_uri]
         | 
| 690 613 | 
             
                  @test_object5.find_relationship_by_name("testing_inbound").should == []
         | 
| 691 614 | 
             
                  @test_object5.find_relationship_by_name("testing_inbound2").should == []
         | 
| 692 615 |  | 
| 693 616 | 
             
                end
         | 
| 694 617 | 
             
              end
         | 
| 695 618 |  | 
| 696 | 
            -
              #
         | 
| 697 | 
            -
              # Named datastream specs
         | 
| 698 | 
            -
              #
         | 
| 699 | 
            -
              describe '#add_named_datastream' do
         | 
| 700 | 
            -
                it 'should add a datastream with the given name to the object in fedora' do
         | 
| 701 | 
            -
                  @test_object2 = MockAFBaseDatastream.new
         | 
| 702 | 
            -
            #      @test_object2.new_object = true
         | 
| 703 | 
            -
                  f = File.open(File.join( File.dirname(__FILE__), "../fixtures/minivan.jpg"), 'rb')
         | 
| 704 | 
            -
                  f2 = File.open(File.join( File.dirname(__FILE__), "../fixtures/dino.jpg" ), 'rb')
         | 
| 705 | 
            -
                  f2.stubs(:original_filename).returns("dino.jpg")
         | 
| 706 | 
            -
                  f.stubs(:content_type).returns("image/jpeg")
         | 
| 707 | 
            -
                  @test_object2.add_named_datastream("thumbnail",{:content_type=>"image/jpeg",:blob=>f, :label=>"testDS"})
         | 
| 708 | 
            -
                  @test_object2.add_named_datastream("high",{:content_type=>"image/jpeg",:blob=>f2})
         | 
| 709 | 
            -
                  ds = @test_object2.thumbnail.first
         | 
| 710 | 
            -
                  ds2 = @test_object2.high.first
         | 
| 711 | 
            -
                  @test_object2.save
         | 
| 712 | 
            -
                  @test_object2 = MockAFBaseDatastream.load_instance(@test_object2.pid)
         | 
| 713 | 
            -
                  @test_object2.named_datastreams.keys.size.should == 2
         | 
| 714 | 
            -
                  @test_object2.named_datastreams.keys.include?("thumbnail").should == true
         | 
| 715 | 
            -
                  @test_object2.named_datastreams.keys.include?("high").should == true
         | 
| 716 | 
            -
                  @test_object2.named_datastreams["thumbnail"].size.should == 1
         | 
| 717 | 
            -
                  @test_object2.named_datastreams["high"].size.should == 1
         | 
| 718 | 
            -
                  t2_thumb1 = @test_object2.named_datastreams["thumbnail"].first
         | 
| 719 | 
            -
                  t2_thumb1.dsid.should == ds.dsid
         | 
| 720 | 
            -
                  t2_thumb1.mimeType.should == ds.mimeType
         | 
| 721 | 
            -
                  t2_thumb1.pid.should == ds.pid
         | 
| 722 | 
            -
                  t2_thumb1.dsLabel.should == ds.dsLabel
         | 
| 723 | 
            -
                  t2_thumb1.controlGroup.should == ds.controlGroup
         | 
| 724 | 
            -
                  t2_high1 = @test_object2.named_datastreams["high"].first
         | 
| 725 | 
            -
                  t2_high1.dsid.should == ds2.dsid
         | 
| 726 | 
            -
                  t2_high1.mimeType.should == ds2.mimeType
         | 
| 727 | 
            -
                  t2_high1.pid.should == ds2.pid
         | 
| 728 | 
            -
                  t2_high1.dsLabel.should == ds2.dsLabel
         | 
| 729 | 
            -
                  t2_high1.controlGroup.should == ds2.controlGroup
         | 
| 730 | 
            -
                end
         | 
| 731 | 
            -
              end
         | 
| 732 | 
            -
              
         | 
| 733 | 
            -
              describe '#add_named_file_datastream' do
         | 
| 734 | 
            -
                it 'should add a file datastream with the given name to the object in fedora' do
         | 
| 735 | 
            -
                  @test_object2 = MockAFBaseDatastream.new
         | 
| 736 | 
            -
            #      @test_object2.new_object = true
         | 
| 737 | 
            -
                  f = File.open(File.join( File.dirname(__FILE__), "../fixtures/minivan.jpg"), 'rb')
         | 
| 738 | 
            -
                  f.stubs(:content_type).returns("image/jpeg")
         | 
| 739 | 
            -
                  @test_object2.add_named_file_datastream("thumbnail",f)
         | 
| 740 | 
            -
                  ds = @test_object2.thumbnail.first
         | 
| 741 | 
            -
                  @test_object2.save
         | 
| 742 | 
            -
                  @test_object2 = MockAFBaseDatastream.load_instance(@test_object2.pid)
         | 
| 743 | 
            -
                  @test_object2.named_datastreams["thumbnail"].size.should == 1
         | 
| 744 | 
            -
                  t2_thumb1 = @test_object2.named_datastreams["thumbnail"].first
         | 
| 745 | 
            -
                  t2_thumb1.dsid.should == "THUMB1"
         | 
| 746 | 
            -
                  t2_thumb1.mimeType.should == "image/jpeg"
         | 
| 747 | 
            -
                  t2_thumb1.pid.should == @test_object2.pid
         | 
| 748 | 
            -
                  t2_thumb1.dsLabel.should == "minivan.jpg"
         | 
| 749 | 
            -
                  t2_thumb1.controlGroup.should == "M"
         | 
| 750 | 
            -
             | 
| 751 | 
            -
            # .attributes.should == {"label"=>ds.label,"dsid"=>ds.dsid,
         | 
| 752 | 
            -
            #                                                                                  "mimeType"=>ds.attributes[:mimeType],
         | 
| 753 | 
            -
            #                                                                                  :controlGroup=>ds.attributes[:controlGroup],
         | 
| 754 | 
            -
            #                                                                                  :pid=>ds.pid, :dsID=>ds.dsid, :dsLabel=>ds.attributes[:dsLabel]}
         | 
| 755 | 
            -
                end
         | 
| 756 | 
            -
              end
         | 
| 757 | 
            -
              
         | 
| 758 | 
            -
              describe '#update_named_datastream' do
         | 
| 759 | 
            -
                it 'should update a named datastream to have a new file' do
         | 
| 760 | 
            -
                  @test_object2 = MockAFBaseDatastream.new
         | 
| 761 | 
            -
                  f = File.open(File.join( File.dirname(__FILE__), "../fixtures/minivan.jpg"), 'rb')
         | 
| 762 | 
            -
                  minivan = f.read
         | 
| 763 | 
            -
                  f.rewind
         | 
| 764 | 
            -
                  f2 = File.open(File.join( File.dirname(__FILE__), "../fixtures/dino.jpg" ), 'rb')
         | 
| 765 | 
            -
                  dino = f2.read
         | 
| 766 | 
            -
                  f2.rewind
         | 
| 767 | 
            -
                  f.stubs(:content_type).returns("image/jpeg")
         | 
| 768 | 
            -
                  f.stubs(:original_filename).returns("minivan.jpg")
         | 
| 769 | 
            -
                  f2.stubs(:content_type).returns("image/jpeg")
         | 
| 770 | 
            -
                  f2.stubs(:original_filename).returns("dino.jpg")
         | 
| 771 | 
            -
                  #check raise exception if dsid not supplied
         | 
| 772 | 
            -
                  @test_object2.add_named_datastream("thumbnail",{:file=>f})
         | 
| 773 | 
            -
                  @test_object2.save
         | 
| 774 | 
            -
                  @test_object2 = MockAFBaseDatastream.load_instance(@test_object2.pid)
         | 
| 775 | 
            -
                  
         | 
| 776 | 
            -
                  @test_object2.thumbnail.size.should == 1
         | 
| 777 | 
            -
                  @test_object2.thumbnail_ids == ["THUMB1"]
         | 
| 778 | 
            -
                  ds = @test_object2.thumbnail.first
         | 
| 779 | 
            -
                  ds.dsid.should == "THUMB1"
         | 
| 780 | 
            -
                  ds.mimeType.should == "image/jpeg"
         | 
| 781 | 
            -
                  ds.pid.should == @test_object2.pid
         | 
| 782 | 
            -
                  ds.dsLabel.should == "minivan.jpg"
         | 
| 783 | 
            -
                  ds.controlGroup.should == "M"
         | 
| 784 | 
            -
             | 
| 785 | 
            -
                  ds.content.should == minivan 
         | 
| 786 | 
            -
                  @test_object2.update_named_datastream("thumbnail",{:file=>f2,:dsid=>"THUMB1"})
         | 
| 787 | 
            -
                  @test_object2.save
         | 
| 788 | 
            -
                  @test_object2 = MockAFBaseDatastream.load_instance(@test_object2.pid)
         | 
| 789 | 
            -
                  @test_object2.thumbnail.size.should == 1
         | 
| 790 | 
            -
                  @test_object2.thumbnail_ids == ["THUMB1"]
         | 
| 791 | 
            -
                  ds2 = @test_object2.thumbnail.first
         | 
| 792 | 
            -
                  ds2.dsid.should == "THUMB1"
         | 
| 793 | 
            -
                  ds2.mimeType.should == "image/jpeg"
         | 
| 794 | 
            -
                  ds2.pid.should == @test_object2.pid
         | 
| 795 | 
            -
                  ds2.dsLabel.should == "dino.jpg"
         | 
| 796 | 
            -
                  ds2.controlGroup.should == "M"
         | 
| 797 | 
            -
                  (ds2.content == dino).should be_true
         | 
| 798 | 
            -
                end
         | 
| 799 | 
            -
              end
         | 
| 800 | 
            -
              
         | 
| 801 | 
            -
              describe '#named_datastreams_ids' do
         | 
| 802 | 
            -
                it 'should return a hash of datastream name to an array of dsids' do
         | 
| 803 | 
            -
                  @test_object2 = MockAFBaseDatastream.new
         | 
| 804 | 
            -
            #      @test_object2.new_object = true
         | 
| 805 | 
            -
                  f = File.open(File.join( File.dirname(__FILE__), "../fixtures/minivan.jpg"), 'rb')
         | 
| 806 | 
            -
                  f2 = File.open(File.join( File.dirname(__FILE__), "../fixtures/dino.jpg" ), 'rb')
         | 
| 807 | 
            -
                  f2.stubs(:original_filename).returns("dino.jpg")
         | 
| 808 | 
            -
                  f.stubs(:content_type).returns("image/jpeg")
         | 
| 809 | 
            -
                  @test_object2.add_named_datastream("thumbnail",{:content_type=>"image/jpeg",:blob=>f, :label=>"testDS"})
         | 
| 810 | 
            -
                  @test_object2.add_named_datastream("thumbnail",{:content_type=>"image/jpeg",:blob=>f2})
         | 
| 811 | 
            -
                  @test_object2.save
         | 
| 812 | 
            -
                  @test_object2 = MockAFBaseDatastream.load_instance(@test_object2.pid)
         | 
| 813 | 
            -
                  @test_object2.named_datastreams_ids.should == {"high"=>[], "thumbnail"=>["THUMB1", "THUMB2"]}
         | 
| 814 | 
            -
                end
         | 
| 815 | 
            -
              end
         | 
| 816 | 
            -
             | 
| 817 | 
            -
              
         | 
| 818 619 | 
             
            #   describe '#load_instance_from_solr' do
         | 
| 819 620 | 
             
            #     it 'should populate an instance of an ActiveFedora::Base object using solr instead of Fedora' do
         | 
| 820 621 | 
             
            #       
         | 
| @@ -856,11 +657,7 @@ describe ActiveFedora::Base do | |
| 856 657 | 
             
            #       @test_object5.testing2_append(@test_object3)
         | 
| 857 658 | 
             
            #       @test_object2.save
         | 
| 858 659 | 
             
            #       @test_object5.save
         | 
| 859 | 
            -
            #        | 
| 860 | 
            -
            #       r3 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object3)
         | 
| 861 | 
            -
            #       r4 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object4)
         | 
| 862 | 
            -
            #       r5 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>@test_object5)
         | 
| 863 | 
            -
            #       model_rel = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:dummy, :object=>ActiveFedora::ContentModel.pid_from_ruby_class(MockAFBaseFromSolr))
         | 
| 660 | 
            +
            #       model_rel = ActiveFedora::ContentModel.pid_from_ruby_class(MockAFBaseFromSolr)
         | 
| 864 661 | 
             
            #       #check inbound correct, testing goes to :has_part and testing2 goes to :has_member
         | 
| 865 662 | 
             
            #       test_from_solr_object2 = MockAFBaseFromSolr.load_instance_from_solr(@test_object2.pid)
         | 
| 866 663 | 
             
            #       test_from_solr_object3 = MockAFBaseFromSolr.load_instance_from_solr(@test_object3.pid)
         | 
| @@ -884,37 +681,37 @@ describe ActiveFedora::Base do | |
| 884 681 | 
             
            #       Time.parse(test_from_solr_object5.modified_date).should == Time.parse(@test_object5.modified_date)
         | 
| 885 682 | 
             
            # 
         | 
| 886 683 | 
             
            #       # need to test outbound and inbound relationships
         | 
| 887 | 
            -
            #       test_from_solr_object2.relationships(false).should == {:self=>{:has_model=>[model_rel | 
| 888 | 
            -
            #                                                             :has_part=>[ | 
| 889 | 
            -
            #                                                             :has_member=>[ | 
| 890 | 
            -
            #                                                     :inbound=>{:has_part=>[ | 
| 891 | 
            -
            #       test_from_solr_object2.relationships_by_name(false).should == {:self=>{"testing"=>[ | 
| 892 | 
            -
            #         "collection_members"=>[],"part_of"=>[],"parts_outbound"=>[ | 
| 893 | 
            -
            #         :inbound=>{"testing_inbound"=>[ | 
| 894 | 
            -
            #       test_from_solr_object3.relationships(false).should == {:self=>{:has_model=>[model_rel | 
| 895 | 
            -
            #                                                    :inbound=>{:has_part=>[ | 
| 896 | 
            -
            #                                                                :has_member=>[ | 
| 684 | 
            +
            #       test_from_solr_object2.relationships(false).should == {:self=>{:has_model=>[model_rel],
         | 
| 685 | 
            +
            #                                                             :has_part=>[@test_object3],
         | 
| 686 | 
            +
            #                                                             :has_member=>[@test_object4]},
         | 
| 687 | 
            +
            #                                                     :inbound=>{:has_part=>[@test_object5]}}
         | 
| 688 | 
            +
            #       test_from_solr_object2.relationships_by_name(false).should == {:self=>{"testing"=>[@test_object3],"testing2"=>[@test_object4],
         | 
| 689 | 
            +
            #         "collection_members"=>[],"part_of"=>[],"parts_outbound"=>[@test_object3]},
         | 
| 690 | 
            +
            #         :inbound=>{"testing_inbound"=>[@test_object5],"testing_inbound2"=>[],"parts_inbound"=>[]}}
         | 
| 691 | 
            +
            #       test_from_solr_object3.relationships(false).should == {:self=>{:has_model=>[model_rel]},
         | 
| 692 | 
            +
            #                                                    :inbound=>{:has_part=>[@test_object2],
         | 
| 693 | 
            +
            #                                                                :has_member=>[@test_object5]}}
         | 
| 897 694 | 
             
            #       test_from_solr_object3.relationships_by_name(false).should == {:self=>{"testing"=>[],"testing2"=>[], "collection_members"=>[],"part_of"=>[],"parts_outbound"=>[]},
         | 
| 898 | 
            -
            #                                                                    :inbound=>{"testing_inbound"=>[ | 
| 899 | 
            -
            #       test_from_solr_object4.relationships(false).should == {:self=>{:has_model=>[model_rel | 
| 900 | 
            -
            #                                                     :inbound=>{:has_member=>[ | 
| 901 | 
            -
            #       test_from_solr_object4.relationships_by_name(false).should == {:inbound=>{"parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[ | 
| 902 | 
            -
            #       test_from_solr_object5.relationships(false).should == {:self=>{:has_model=>[model_rel | 
| 903 | 
            -
            #                                                             :has_part=>[ | 
| 904 | 
            -
            #                                                             :has_member=>[ | 
| 695 | 
            +
            #                                                                    :inbound=>{"testing_inbound"=>[@test_object2],"testing_inbound2"=>[@test_object5], "parts_inbound"=>[]}}                                                                  
         | 
| 696 | 
            +
            #       test_from_solr_object4.relationships(false).should == {:self=>{:has_model=>[model_rel]},
         | 
| 697 | 
            +
            #                                                     :inbound=>{:has_member=>[@test_object2]}}
         | 
| 698 | 
            +
            #       test_from_solr_object4.relationships_by_name(false).should == {:inbound=>{"parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[@test_object2]}, :self=>{"testing2"=>[], "collection_members"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[]}}                       
         | 
| 699 | 
            +
            #       test_from_solr_object5.relationships(false).should == {:self=>{:has_model=>[model_rel],
         | 
| 700 | 
            +
            #                                                             :has_part=>[@test_object2],
         | 
| 701 | 
            +
            #                                                             :has_member=>[@test_object3]},
         | 
| 905 702 | 
             
            #                                                     :inbound=>{}}
         | 
| 906 | 
            -
            #       test_from_solr_object5.relationships_by_name(false).should == {:inbound=>{"parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[]}, :self=>{"testing2"=>[ | 
| 703 | 
            +
            #       test_from_solr_object5.relationships_by_name(false).should == {:inbound=>{"parts_inbound"=>[], "testing_inbound"=>[], "testing_inbound2"=>[]}, :self=>{"testing2"=>[@test_object3], "collection_members"=>[], "part_of"=>[], "testing"=>[@test_object2], "parts_outbound"=>[@test_object2]}}
         | 
| 907 704 | 
             
            #       #all inbound should now be empty if no parameter supplied to relationships
         | 
| 908 | 
            -
            #       test_from_solr_object2.relationships.should == {:self=>{:has_part=>[ | 
| 909 | 
            -
            #       test_from_solr_object2.relationships_by_name.should == {:self=>{"testing2"=>[ | 
| 910 | 
            -
            #       test_from_solr_object3.relationships.should == {:self=>{:has_model=>[model_rel | 
| 705 | 
            +
            #       test_from_solr_object2.relationships.should == {:self=>{:has_part=>[@test_object3],:has_member=>[@test_object4],:has_model=>[model_rel]}}
         | 
| 706 | 
            +
            #       test_from_solr_object2.relationships_by_name.should == {:self=>{"testing2"=>[@test_object4], "collection_members"=>[], "part_of"=>[], "testing"=>[@test_object3], "parts_outbound"=>[@test_object3]}}
         | 
| 707 | 
            +
            #       test_from_solr_object3.relationships.should == {:self=>{:has_model=>[model_rel]}}
         | 
| 911 708 | 
             
            #       test_from_solr_object3.relationships_by_name.should == {:self=>{"testing2"=>[], "collection_members"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[]}}
         | 
| 912 | 
            -
            #       test_from_solr_object4.relationships.should == {:self=>{:has_model=>[model_rel | 
| 709 | 
            +
            #       test_from_solr_object4.relationships.should == {:self=>{:has_model=>[model_rel]}}
         | 
| 913 710 | 
             
            #       test_from_solr_object4.relationships_by_name.should == {:self=>{"testing2"=>[], "collection_members"=>[], "part_of"=>[], "testing"=>[], "parts_outbound"=>[]}} 
         | 
| 914 | 
            -
            #       test_from_solr_object5.relationships.should == {:self=>{:has_model=>[model_rel | 
| 915 | 
            -
            #                                                              :has_part=>[ | 
| 916 | 
            -
            #                                                              :has_member=>[ | 
| 917 | 
            -
            #       test_from_solr_object5.relationships_by_name.should == {:self=>{"testing2"=>[ | 
| 711 | 
            +
            #       test_from_solr_object5.relationships.should == {:self=>{:has_model=>[model_rel],
         | 
| 712 | 
            +
            #                                                              :has_part=>[@test_object2],
         | 
| 713 | 
            +
            #                                                              :has_member=>[@test_object3]}}
         | 
| 714 | 
            +
            #       test_from_solr_object5.relationships_by_name.should == {:self=>{"testing2"=>[@test_object3], "collection_members"=>[], "part_of"=>[], "testing"=>[@test_object2], "parts_outbound"=>[@test_object2]}}
         | 
| 918 715 | 
             
            #       # need to check metadata
         | 
| 919 716 | 
             
            #       test_from_solr_object2.fields[:language][:values].should == ["Italian"]
         | 
| 920 717 | 
             
            #       test_from_solr_object2.fields[:creator][:values].should == ["Linguist, A."]
         |