Changeset 99


Ignore:
Timestamp:
Aug 17, 2008, 8:07:11 PM (16 years ago)
Author:
KOBAYASHI, Shinji
Message:

refs #39
fixed Access_Group_Ref

Location:
ruby/trunk/lib/models
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ruby/trunk/lib/models/rm/support/identification.rb

    r98 r99  
    170170
    171171        class Party_Ref < Object_Ref
    172           TYPE = ['PERSON', 'ORGANISATION', 'GROUP', 'AGENT', 'ROLE',' PARTY', 'ACTOR']
     172          TYPE = ['PERSON', 'ORGANISATION', 'GROUP', 'AGENT', 'ROLE','PARTY', 'ACTOR']
    173173          def initialize(namespace, type, id)
    174174            super(namespace, type, id)
     
    176176
    177177          def type=(type)
    178             raise ArgumentError, 'type mismatch' if !TYPE.include? type
     178            raise ArgumentError, 'type invalid' if !TYPE.include? type
    179179            @type = type
    180180          end
    181181        end
     182
     183        class Access_Group_Ref < Object_Ref
     184          def type=(type)
     185            raise ArgumentError, 'type invalid' if !(type == 'ACCESS_GROUP')
     186            @type = type
     187          end
     188        end
     189
    182190        class Hier_Object_ID < UID_Based_ID
    183191
  • ruby/trunk/lib/models/tests/test_reference_model.rb

    r98 r99  
    155155    assert_nothing_raised(Exception){@locatable_ref = OpenEHR::RM::Support::Identification::Locatable_Ref.new('unknown', 'PERSON', @uid_based_id, 'data/event[at0001, standing]')}
    156156    assert_nothing_raised(Exception){@party_ref = OpenEHR::RM::Support::Identification::Party_Ref.new('unknown', 'ORGANISATION', @object_id)}
     157    assert_nothing_raised(Exception){@access_group_ref = OpenEHR::RM::Support::Identification::Access_Group_Ref.new('unknown', 'ACCESS_GROUP', @object_id)}
    157158  end
    158159 
     
    168169    assert_instance_of OpenEHR::RM::Support::Identification::Locatable_Ref, @locatable_ref
    169170    assert_instance_of OpenEHR::RM::Support::Identification::Party_Ref, @party_ref
     171    assert_instance_of OpenEHR::RM::Support::Identification::Access_Group_Ref, @access_group_ref
    170172  end
    171173
     
    376378    assert_nothing_raised(Exception){@party_ref.type = 'ACTOR'}
    377379  end
     380
     381  def test_access_group_ref
     382# test constructor
     383    assert_equal 'unknown', @access_group_ref.namespace
     384    assert_equal 'ACCESS_GROUP', @access_group_ref.type
     385    assert_equal @object_id, @access_group_ref.id
     386# test type validation
     387    assert_raise(ArgumentError){@access_group_ref.type = 'PERSON'}
     388    assert_nothing_raised(Exception){@access_group_ref.type = 'ACCESS_GROUP'}
     389  end
    378390end
Note: See TracChangeset for help on using the changeset viewer.