Changeset 167 for ruby/branches/0.5.0/lib/models/tests/rm/test_common.rb
- Timestamp:
- Aug 6, 2009, 1:20:05 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/branches/0.5.0/lib/models/tests/rm/test_common.rb
r163 r167 3 3 require 'rm' 4 4 5 include OpenE HR::RM::Data_Types::Text6 include OpenE HR::RM::Common::Resource7 include OpenE HR::RM::Common::Archetyped8 include OpenE HR::RM::Common::Generic9 include OpenE HR::RM::Common::Change_Control10 include OpenE HR::RM::Common::Directory11 include OpenE HR::RM::Support::Identification12 include OpenE HR::RM::Data_Types::Basic13 include OpenE HR::RM::Data_Types::Quantity14 include OpenE HR::RM::Data_Types::URI5 include OpenEhr::RM::DataTypes::Text 6 include OpenEhr::RM::Common::Resource 7 include OpenEhr::RM::Common::Archetyped 8 include OpenEhr::RM::Common::Generic 9 include OpenEhr::RM::Common::ChangeControl 10 include OpenEhr::RM::Common::Directory 11 include OpenEhr::RM::Support::Identification 12 include OpenEhr::RM::DataTypes::Basic 13 include OpenEhr::RM::DataTypes::Quantity 14 include OpenEhr::RM::DataTypes::Uri 15 15 16 16 class RM_Common_Resource_Test < Test::Unit::TestCase 17 17 def setup 18 terminology_id = Terminology _ID.new('openehr')19 code_phrase = Code _Phrase.new('ja', terminology_id)20 @translation_details = OpenE HR::RM::Common::Resource::Translation_Details.new(:language => code_phrase, :author => {'KOBAYASHI, Shinji', 'Ehime Univ'},18 terminology_id = TerminologyId.new('openehr') 19 code_phrase = CodePhrase.new('ja', terminology_id) 20 @translation_details = OpenEhr::RM::Common::Resource::TranslationDetails.new(:language => code_phrase, :author => {'KOBAYASHI, Shinji', 'Ehime Univ'}, 21 21 :accreditation => 'jp', :other_details => {'ruby', 'test'}) 22 @authored_resource = OpenE HR::RM::Common::Resource::Authored_Resource.new(:original_language => code_phrase, :translations => {'ja', @translation_details}, :description => "test")23 @resource_description_item = OpenE HR::RM::Common::Resource::Resource_Description_Item.new(:language => code_phrase,22 @authored_resource = OpenEhr::RM::Common::Resource::AuthoredResource.new(:original_language => code_phrase, :translations => {'ja', @translation_details}, :description => "test") 23 @resource_description_item = OpenEhr::RM::Common::Resource::ResourceDescriptionItem.new(:language => code_phrase, 24 24 :purpose => 'test', 25 25 :keywords => %w[test ruby], … … 29 29 :original_resource_uri => {'issuer', 'http://openehr.jp/'}, 30 30 :other_details => {'samos', 'icicth7'}) 31 @resource_description = OpenE HR::RM::Common::Resource::Resource_Description.new(:original_author => {'KOBAYASHI, Shinji' => 'Ehime University'},31 @resource_description = OpenEhr::RM::Common::Resource::ResourceDescription.new(:original_author => {'KOBAYASHI, Shinji' => 'Ehime University'}, 32 32 :lifecycle_state => 'experimental', 33 33 :details => {'ja', @resource_description_item}, … … 36 36 :other_details => {'ja', 'shikoku'}, 37 37 :parent_resource => @authored_resource) 38 @authored_resource = OpenE HR::RM::Common::Resource::Authored_Resource.new(:original_language => code_phrase, :translations => {'ja', @translation_details}, :description => @resource_description)38 @authored_resource = OpenEhr::RM::Common::Resource::AuthoredResource.new(:original_language => code_phrase, :translations => {'ja', @translation_details}, :description => @resource_description) 39 39 end 40 40 41 41 def test_init 42 assert_instance_of OpenE HR::RM::Common::Resource::Authored_Resource, @authored_resource43 assert_instance_of OpenE HR::RM::Common::Resource::Translation_Details, @translation_details44 assert_instance_of OpenE HR::RM::Common::Resource::Resource_Description_Item, @resource_description_item45 assert_instance_of OpenE HR::RM::Common::Resource::Resource_Description, @resource_description42 assert_instance_of OpenEhr::RM::Common::Resource::AuthoredResource, @authored_resource 43 assert_instance_of OpenEhr::RM::Common::Resource::TranslationDetails, @translation_details 44 assert_instance_of OpenEhr::RM::Common::Resource::ResourceDescriptionItem, @resource_description_item 45 assert_instance_of OpenEhr::RM::Common::Resource::ResourceDescription, @resource_description 46 46 end 47 47 … … 86 86 class RM_Common_Archetyped_Test < Test::Unit::TestCase 87 87 def setup 88 @dv_text = OpenE HR::RM::Data_Types::Text::DV_Text.new('Test')89 @uid_based_id = OpenE HR::RM::Support::Identification::UID_Based_ID.new('rrip::0.0.5')90 @archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")91 @template_id = OpenE HR::RM::Support::Identification::Template_ID.new('1.0.1')92 assert_nothing_raised(Exception){@archetyped = OpenE HR::RM::Common::Archetyped::Archetyped.new(@archetype_id, '1.0.1')}93 assert_nothing_raised(Exception){@link = OpenE HR::RM::Common::Archetyped::Link.new(OpenEHR::RM::Data_Types::Text::DV_Text.new("generic"), OpenEHR::RM::Data_Types::URI::DV_EHR_URI.new("ehr://test/"),OpenEHR::RM::Data_Types::Text::DV_Text.new("problem"))}94 assert_nothing_raised(Exception){ 95 @pathable = OpenE HR::RM::Common::Archetyped::Pathable.new }96 name = OpenE HR::RM::Data_Types::Text::DV_Text.new('blood')88 @dv_text = OpenEhr::RM::DataTypes::Text::DvText.new('Test') 89 @uid_based_id = OpenEhr::RM::Support::Identification::UidBasedId.new('rrip::0.0.5') 90 @archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3") 91 @template_id = OpenEhr::RM::Support::Identification::TemplateId.new('1.0.1') 92 assert_nothing_raised(Exception){@archetyped = OpenEhr::RM::Common::Archetyped::Archetyped.new(@archetype_id, '1.0.1')} 93 assert_nothing_raised(Exception){@link = OpenEhr::RM::Common::Archetyped::Link.new(OpenEhr::RM::DataTypes::Text::DvText.new("generic"), OpenEhr::RM::DataTypes::Uri::DvEhrUri.new("ehr://test/"),OpenEhr::RM::DataTypes::Text::DvText.new("problem"))} 94 assert_nothing_raised(Exception){ 95 @pathable = OpenEhr::RM::Common::Archetyped::Pathable.new } 96 name = OpenEhr::RM::DataTypes::Text::DvText.new('blood') 97 97 links = Set.new([@uid_based_id]) 98 98 assert_nothing_raised(Exception){ … … 100 100 :name => name, 101 101 :links => links)} 102 provider = Party _Identified.new(:name => 'NERV')103 location = Party _Identified.new(:name => 'GEOFRONT')104 object_version_id = Object _Version_ID.new('ABC::DEF::1.3.4')105 party_ref = Party _Ref.new('local', 'ORGANISATION', object_id)106 assert_nothing_raised(Exception){ 107 @feeder_audit_details = Feeder _Audit_Details.new(:system_id => 'MAGI',102 provider = PartyIdentified.new(:name => 'NERV') 103 location = PartyIdentified.new(:name => 'GEOFRONT') 104 object_version_id = ObjectVersionId.new('ABC::DEF::1.3.4') 105 party_ref = PartyRef.new('local', 'ORGANISATION', object_id) 106 assert_nothing_raised(Exception){ 107 @feeder_audit_details = FeederAuditDetails.new(:system_id => 'MAGI', 108 108 :provider => provider, 109 109 :location => location, 110 :time => D V_Date_Time.new('2009-07-03T12:16:31'),111 :subject => Party _Proxy.new(:external_ref => party_ref),110 :time => DvDateTime.new('2009-07-03T12:16:31'), 111 :subject => PartyProxy.new(:external_ref => party_ref), 112 112 :version_id => '0.0.4')} 113 feeder_audit_details = Feeder _Audit_Details.new(:system_id => 'AKAGI')114 dv_identifier = D V_Identifier.new('NERV', 'MELCHIOR', 'RITSUKO', 'COMPUTER')115 feeder_audit_details2 = Feeder _Audit_Details.new(:system_id => 'KATSURAGI')116 dv_identifier2 = D V_Identifier.new('NERV', 'SHOGOUKI', 'MISATO', 'EVANGELION')117 charset = OpenE HR::RM::Data_Types::Text::Code_Phrase.new('UTF-8','character-sets')118 language = OpenE HR::RM::Data_Types::Text::Code_Phrase.new('ja', 'languages')119 120 dv_encapsulated = OpenE HR::RM::Data_Types::Encapsulated::DV_Encapsulated.new(charset, language, 10)121 assert_nothing_raised(Exception){ 122 @feeder_audit = Feeder _Audit.new(:originating_system_audit => feeder_audit_details,113 feeder_audit_details = FeederAuditDetails.new(:system_id => 'AKAGI') 114 dv_identifier = DvIdentifier.new('NERV', 'MELCHIOR', 'RITSUKO', 'COMPUTER') 115 feeder_audit_details2 = FeederAuditDetails.new(:system_id => 'KATSURAGI') 116 dv_identifier2 = DvIdentifier.new('NERV', 'SHOGOUKI', 'MISATO', 'EVANGELION') 117 charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('UTF-8','character-sets') 118 language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('ja', 'languages') 119 120 dv_encapsulated = OpenEhr::RM::DataTypes::Encapsulated::DvEncapsulated.new(charset, language, 10) 121 assert_nothing_raised(Exception){ 122 @feeder_audit = FeederAudit.new(:originating_system_audit => feeder_audit_details, 123 123 :originating_system_item_ids => [dv_identifier], 124 124 :feeder_system_audit => feeder_audit_details2, … … 128 128 129 129 def test_init 130 assert_instance_of OpenE HR::RM::Common::Archetyped::Archetyped, @archetyped131 assert_instance_of OpenE HR::RM::Common::Archetyped::Link, @link132 assert_instance_of OpenE HR::RM::Common::Archetyped::Pathable, @pathable133 assert_instance_of OpenE HR::RM::Common::Archetyped::Locatable, @locatable134 assert_instance_of Feeder _Audit_Details, @feeder_audit_details135 assert_instance_of Feeder _Audit, @feeder_audit130 assert_instance_of OpenEhr::RM::Common::Archetyped::Archetyped, @archetyped 131 assert_instance_of OpenEhr::RM::Common::Archetyped::Link, @link 132 assert_instance_of OpenEhr::RM::Common::Archetyped::Pathable, @pathable 133 assert_instance_of OpenEhr::RM::Common::Archetyped::Locatable, @locatable 134 assert_instance_of FeederAuditDetails, @feeder_audit_details 135 assert_instance_of FeederAudit, @feeder_audit 136 136 end 137 137 … … 144 144 assert_nothing_raised(Exception){@archetyped.template_id = @template_id} 145 145 assert_equal @template_id, @archetyped.template_id 146 archetype_id2 = OpenE HR::RM::Support::Identification::Archetype_ID.new("1.0.2", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")146 archetype_id2 = OpenEhr::RM::Support::Identification::ArchetypeId.new("1.0.2", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3") 147 147 assert_nothing_raised(ArgumentError){@archetyped.archetype_id = archetype_id2} 148 148 assert_equal archetype_id2, @archetyped.archetype_id … … 157 157 assert_equal 'problem', @link.type.value 158 158 # test meaning 159 assert_nothing_raised(Exception){@link.meaning = OpenE HR::RM::Data_Types::Text::DV_Text.new('clinical')}159 assert_nothing_raised(Exception){@link.meaning = OpenEhr::RM::DataTypes::Text::DvText.new('clinical')} 160 160 assert_equal 'clinical', @link.meaning.value 161 161 assert_raise(ArgumentError){@link.meaning = nil} 162 162 # test target 163 assert_nothing_raised(Exception){@link.target = OpenE HR::RM::Data_Types::URI::DV_EHR_URI.new("ehr://try/")}163 assert_nothing_raised(Exception){@link.target = OpenEhr::RM::DataTypes::Uri::DvEhrUri.new("ehr://try/")} 164 164 assert_equal 'ehr://try/', @link.target.value 165 165 assert_raise(ArgumentError){@link.target = nil} 166 166 # test type 167 assert_nothing_raised(Exception){@link.type = OpenE HR::RM::Data_Types::Text::DV_Text.new("issue")}167 assert_nothing_raised(Exception){@link.type = OpenEhr::RM::DataTypes::Text::DvText.new("issue")} 168 168 assert_equal 'issue', @link.type.value 169 169 assert_raise(ArgumentError){@link.type = nil} … … 190 190 class RM_Common_Generic_Test < Test::Unit::TestCase 191 191 def setup 192 assert_nothing_raised(Exception){party_proxy = Party _Proxy.new}193 object_id = Object _ID.new('0.0.4')194 party_ref = Party _Ref.new('unknown', 'ORGANISATION', object_id)195 assert_nothing_raised(Exception){ 196 @party_proxy = Party _Proxy.new(:external_ref => party_ref)}197 assert_nothing_raised(Exception){party_self = Party _Self.new}198 assert_nothing_raised(Exception){ 199 @party_self = Party _Self.new(:external_ref => party_ref)}192 assert_nothing_raised(Exception){party_proxy = PartyProxy.new} 193 object_id = ObjectId.new('0.0.4') 194 party_ref = PartyRef.new('unknown', 'ORGANISATION', object_id) 195 assert_nothing_raised(Exception){ 196 @party_proxy = PartyProxy.new(:external_ref => party_ref)} 197 assert_nothing_raised(Exception){party_self = PartySelf.new} 198 assert_nothing_raised(Exception){ 199 @party_self = PartySelf.new(:external_ref => party_ref)} 200 200 assert_raise(ArgumentError){ 201 party_identified = Party _Identified.new}201 party_identified = PartyIdentified.new} 202 202 203 203 identifiers = [] 204 identifiers << D V_Identifier.new('NERV', 'MELCHIOR', 'GENDO', 'COMPUTER')205 identifiers << D V_Identifier.new('NERV', 'CASPER', 'GENDO', 'COMPUTER')206 identifiers << D V_Identifier.new('NERV', 'BALTHAZAR', 'GENDO', 'COMPUTER')207 assert_nothing_raised(Exception){ 208 @party_identified = Party _Identified.new(:name => 'NERV',204 identifiers << DvIdentifier.new('NERV', 'MELCHIOR', 'GENDO', 'COMPUTER') 205 identifiers << DvIdentifier.new('NERV', 'CASPER', 'GENDO', 'COMPUTER') 206 identifiers << DvIdentifier.new('NERV', 'BALTHAZAR', 'GENDO', 'COMPUTER') 207 assert_nothing_raised(Exception){ 208 @party_identified = PartyIdentified.new(:name => 'NERV', 209 209 :external_ref => party_ref, 210 210 :identifier => identifiers)} 211 211 212 terminology_id = Terminology _ID.new('test(0.04)')213 code_phrase = Code _Phrase.new('self', terminology_id)214 dv_coded_text = D V_Coded_Text.new('Seele',code_phrase)215 assert_nothing_raised(Exception){ 216 @party_related = Party _Related.new(:name => 'GEHIRN',212 terminology_id = TerminologyId.new('test(0.04)') 213 code_phrase = CodePhrase.new('self', terminology_id) 214 dv_coded_text = DvCodedText.new('Seele',code_phrase) 215 assert_nothing_raised(Exception){ 216 @party_related = PartyRelated.new(:name => 'GEHIRN', 217 217 :relationship => dv_coded_text)} 218 dv_text = D V_Text.new('commiter')219 dv_coded_text = D V_Coded_Text.new('present',terminology_id)220 dv_date_time1 = D V_Date_Time.new('2009-07-04T16:30:00')221 dv_date_time2 = D V_Date_Time.new('2009-07-14T00:00:00')222 dv_interval = D V_Interval.new(dv_date_time1, dv_date_time2)218 dv_text = DvText.new('commiter') 219 dv_coded_text = DvCodedText.new('present',terminology_id) 220 dv_date_time1 = DvDateTime.new('2009-07-04T16:30:00') 221 dv_date_time2 = DvDateTime.new('2009-07-14T00:00:00') 222 dv_interval = DvInterval.new(dv_date_time1, dv_date_time2) 223 223 assert_nothing_raised(Exception){ 224 224 @participation = Participation.new(:performer => @party_proxy, … … 226 226 :mode => dv_coded_text, 227 227 :time => dv_interval)} 228 dv_date_time = D V_Date_Time.new('2009-07-04T18:56:00')229 terminology_id = Terminology _ID.new('openehr(1.0.2)')230 code_phrase = Code _Phrase.new('249', terminology_id)231 dv_coded_text = D V_Coded_Text.new('creation', code_phrase)232 dv_text = D V_Text.new('test environment')233 assert_nothing_raised(Exception){ 234 @audit_details = Audit _Details.new(:system_id => 'MAGI',228 dv_date_time = DvDateTime.new('2009-07-04T18:56:00') 229 terminology_id = TerminologyId.new('openehr(1.0.2)') 230 code_phrase = CodePhrase.new('249', terminology_id) 231 dv_coded_text = DvCodedText.new('creation', code_phrase) 232 dv_text = DvText.new('test environment') 233 assert_nothing_raised(Exception){ 234 @audit_details = AuditDetails.new(:system_id => 'MAGI', 235 235 :committer => @party_proxy, 236 236 :time_committed => dv_date_time, 237 237 :change_type => dv_coded_text, 238 238 :description => dv_text)} 239 dv_text = D V_Text.new('authorisation')240 dv_ehr_uri = D V_EHR_URI.new('ehr://test/')239 dv_text = DvText.new('authorisation') 240 dv_ehr_uri = DvEhrUri.new('ehr://test/') 241 241 assert_nothing_raised(Exception){ 242 242 @attestation = Attestation.new(:system_id => 'NERV', … … 248 248 :proof => 'hashedstring', 249 249 :items => Set[dv_ehr_uri])} 250 object_version_id = Object _Version_ID.new('SHOGOUKI::NERV::1.1.1')251 audit_details2 = Audit _Details.new(:system_id => 'MAGI',250 object_version_id = ObjectVersionId.new('SHOGOUKI::NERV::1.1.1') 251 audit_details2 = AuditDetails.new(:system_id => 'MAGI', 252 252 :committer => @party_proxy, 253 253 :time_committed => dv_date_time2, 254 254 :change_type => dv_coded_text) 255 255 assert_nothing_raised(Exception){ 256 @revision_history_item = Revision _History_Item.new(:audits => [@audit_details, audit_details2],256 @revision_history_item = RevisionHistoryItem.new(:audits => [@audit_details, audit_details2], 257 257 :version_id => object_version_id)} 258 dv_date_time3 = D V_Date_Time.new('2009-07-14T12:00:00')259 dv_date_time4 = D V_Date_Time.new('2009-07-15T00:00:00')260 audit_details3 = Audit _Details.new(:system_id => 'MAGI',258 dv_date_time3 = DvDateTime.new('2009-07-14T12:00:00') 259 dv_date_time4 = DvDateTime.new('2009-07-15T00:00:00') 260 audit_details3 = AuditDetails.new(:system_id => 'MAGI', 261 261 :committer => @party_proxy, 262 262 :time_committed => dv_date_time3, 263 263 :change_type => dv_coded_text) 264 audit_details4 = Audit _Details.new(:system_id => 'MAGI',264 audit_details4 = AuditDetails.new(:system_id => 'MAGI', 265 265 :committer => @party_proxy, 266 266 :time_committed => dv_date_time4, 267 267 :change_type => dv_coded_text) 268 object_version_id = Object _Version_ID.new('NIGOUKI::NERV::2.2.2')269 revision_history_item2 = Revision _History_Item.new(:audits => [audit_details3, audit_details4],268 object_version_id = ObjectVersionId.new('NIGOUKI::NERV::2.2.2') 269 revision_history_item2 = RevisionHistoryItem.new(:audits => [audit_details3, audit_details4], 270 270 :version_id => object_version_id) 271 271 assert_nothing_raised(Exception){ 272 @revision_history = Revision _History.new([@revision_history_item, revision_history_item2])}272 @revision_history = RevisionHistory.new([@revision_history_item, revision_history_item2])} 273 273 end 274 274 275 275 def test_init 276 assert_instance_of Party _Proxy, @party_proxy277 assert_instance_of Party _Self, @party_self278 assert_instance_of Party _Identified, @party_identified276 assert_instance_of PartyProxy, @party_proxy 277 assert_instance_of PartySelf, @party_self 278 assert_instance_of PartyIdentified, @party_identified 279 279 assert_instance_of Participation, @participation 280 assert_instance_of Audit _Details, @audit_details280 assert_instance_of AuditDetails, @audit_details 281 281 assert_instance_of Attestation, @attestation 282 assert_instance_of Revision _History_Item, @revision_history_item283 assert_instance_of Revision _History, @revision_history282 assert_instance_of RevisionHistoryItem, @revision_history_item 283 assert_instance_of RevisionHistory, @revision_history 284 284 end 285 285 … … 347 347 def setup 348 348 archetype_node_id = 'at0001' 349 name = D V_Text.new('folder_test')350 object_id = Object _ID.new('1.1.1')351 object_ref = Object _Ref.new('local', 'PARTY', object_id)349 name = DvText.new('folder_test') 350 object_id = ObjectId.new('1.1.1') 351 object_ref = ObjectRef.new('local', 'PARTY', object_id) 352 352 assert_nothing_raised(Exception){ 353 353 @folder = Folder.new(:archetype_node_id => archetype_node_id, … … 359 359 360 360 def test_init 361 assert_instance_of OpenE HR::RM::Common::Directory::Folder, @folder361 assert_instance_of OpenEhr::RM::Common::Directory::Folder, @folder 362 362 end 363 363 … … 370 370 class RM_Common_Change_Control_Test < Test::Unit::TestCase 371 371 def setup 372 object_version_id1 = Object _Version_ID.new('ABC::DEF::2.2.3')373 object_version_id2 = Object _Version_ID.new('GHI::JKL::4.5.6')374 object_id = Object _ID.new('ehr://uniqueid1020')375 dv_date_time = D V_Date_Time.new('2009-07-06T21:10:12')376 party_ref = Party _Ref.new('unknown', 'ORGANISATION', object_id)377 party_proxy = Party _Proxy.new(:external_ref => party_ref)378 terminology_id = Terminology _ID.new('openehr(1.0.2)')379 code_phrase = Code _Phrase.new('249', terminology_id)380 dv_coded_text = D V_Coded_Text.new('creation', code_phrase)381 audit_details = Audit _Details.new(:system_id => 'MAGI',372 object_version_id1 = ObjectVersionId.new('ABC::DEF::2.2.3') 373 object_version_id2 = ObjectVersionId.new('GHI::JKL::4.5.6') 374 object_id = ObjectId.new('ehr://uniqueid1020') 375 dv_date_time = DvDateTime.new('2009-07-06T21:10:12') 376 party_ref = PartyRef.new('unknown', 'ORGANISATION', object_id) 377 party_proxy = PartyProxy.new(:external_ref => party_ref) 378 terminology_id = TerminologyId.new('openehr(1.0.2)') 379 code_phrase = CodePhrase.new('249', terminology_id) 380 dv_coded_text = DvCodedText.new('creation', code_phrase) 381 audit_details = AuditDetails.new(:system_id => 'MAGI', 382 382 :committer => party_proxy, 383 383 :time_committed => dv_date_time, 384 384 :change_type => dv_coded_text) 385 code_phrase = Code _Phrase.new('532', terminology_id)386 dv_coded_text = D V_Coded_Text.new('complete', code_phrase)387 object_id = Object _ID.new('ehr://test_location')388 object_ref = Object _Ref.new('local', 'PARTY', object_id)389 hier_object_id = Hier _Object_ID.new('ABC')385 code_phrase = CodePhrase.new('532', terminology_id) 386 dv_coded_text = DvCodedText.new('complete', code_phrase) 387 object_id = ObjectId.new('ehr://test_location') 388 object_ref = ObjectRef.new('local', 'PARTY', object_id) 389 hier_object_id = HierObjectId.new('ABC') 390 390 assert_nothing_raised(Exception){ 391 391 @version = Version.new(:uid => object_version_id1, … … 396 396 :signature => 'test_version', 397 397 :data => 'data')} 398 object_version_id3 = Object _Version_ID.new('MNO::PQR::7.8.9')399 object_version_id4 = Object _Version_ID.new('STU::VWX::1.2.3')400 code_phrase = Code _Phrase.new('240', terminology_id)401 dv_coded_text2 = D V_Coded_Text.new('signed', code_phrase)398 object_version_id3 = ObjectVersionId.new('MNO::PQR::7.8.9') 399 object_version_id4 = ObjectVersionId.new('STU::VWX::1.2.3') 400 code_phrase = CodePhrase.new('240', terminology_id) 401 dv_coded_text2 = DvCodedText.new('signed', code_phrase) 402 402 attestation = Attestation.new(:system_id => 'NERV', 403 403 :committer => party_proxy, 404 404 :time_committed => dv_date_time, 405 405 :change_type => dv_coded_text, 406 :reason => D V_Text.new('signed'))407 dv_date_time = D V_Date_Time.new('2009-07-07T21:10:12')408 audit_details = Audit _Details.new(:system_id => 'MAGI',406 :reason => DvText.new('signed')) 407 dv_date_time = DvDateTime.new('2009-07-07T21:10:12') 408 audit_details = AuditDetails.new(:system_id => 'MAGI', 409 409 :committer => party_proxy, 410 410 :time_committed => dv_date_time, 411 411 :change_type => dv_coded_text) 412 412 assert_nothing_raised(Exception){ 413 @original_version = Original _Version.new(:uid => object_version_id3,413 @original_version = OriginalVersion.new(:uid => object_version_id3, 414 414 :preceding_version_uid => object_version_id4, 415 415 :other_input_version_uids => Set[object_version_id1, object_version_id2], … … 419 419 :data => 'data', 420 420 :lifecycle_state => dv_coded_text)} 421 dv_date_time = D V_Date_Time.new('2009-07-08T21:10:12')422 audit_details = Audit _Details.new(:system_id => 'CASPER',421 dv_date_time = DvDateTime.new('2009-07-08T21:10:12') 422 audit_details = AuditDetails.new(:system_id => 'CASPER', 423 423 :committer => party_proxy, 424 424 :time_committed => dv_date_time, 425 425 :change_type => dv_coded_text, 426 426 :description => 'for contribution') 427 object_ref = Object _Ref.new('unknown', 'PARTY', object_id)428 assert_nothing_raised(Exception){ 429 @imported_version = Imported _Version.new(:item => @original_version,427 object_ref = ObjectRef.new('unknown', 'PARTY', object_id) 428 assert_nothing_raised(Exception){ 429 @imported_version = ImportedVersion.new(:item => @original_version, 430 430 :commit_audit => audit_details, 431 431 :contribution => object_ref, … … 435 435 :versions => Set[object_ref], 436 436 :audit => audit_details)} 437 dv_date_time = D V_Date_Time.new('2009-07-08T18:10:12')438 audit_details = Audit _Details.new(:system_id => 'MAGI',437 dv_date_time = DvDateTime.new('2009-07-08T18:10:12') 438 audit_details = AuditDetails.new(:system_id => 'MAGI', 439 439 :committer => party_proxy, 440 440 :time_committed => dv_date_time, … … 446 446 :change_type => dv_coded_text) 447 447 assert_nothing_raised(Exception){ 448 @versioned_object = Versioned _Object.new(:uid => hier_object_id,448 @versioned_object = VersionedObject.new(:uid => hier_object_id, 449 449 :owner_id => object_ref, 450 450 :time_created => dv_date_time, … … 453 453 454 454 def test_init 455 assert_instance_of OpenE HR::RM::Common::Change_Control::Version, @version456 assert_instance_of Original _Version, @original_version457 assert_instance_of Imported _Version, @imported_version458 assert_instance_of OpenE HR::RM::Common::Change_Control::Contribution, @contribution459 assert_instance_of Versioned _Object, @versioned_object455 assert_instance_of OpenEhr::RM::Common::ChangeControl::Version, @version 456 assert_instance_of OriginalVersion, @original_version 457 assert_instance_of ImportedVersion, @imported_version 458 assert_instance_of OpenEhr::RM::Common::ChangeControl::Contribution, @contribution 459 assert_instance_of VersionedObject, @versioned_object 460 460 end 461 461 … … 505 505 assert !@versioned_object.is_original_version?(@version.uid) 506 506 assert @versioned_object.is_original_version?(@original_version.uid) 507 assert @versioned_object.has_version_at_time?(D V_Date_Time.new('2009-07-06T21:10:12'))507 assert @versioned_object.has_version_at_time?(DvDateTime.new('2009-07-06T21:10:12')) 508 508 assert_equal @version, @versioned_object.version_with_id(@version.uid) 509 509 assert_equal @version, @versioned_object.version_at_time(@version.commit_audit.time_committed) … … 538 538 :item => @imported_version.item)} 539 539 assert_equal 7, @versioned_object.version_count 540 dv_date_time = D V_Date_Time.new('2009-07-07T22:11:31')540 dv_date_time = DvDateTime.new('2009-07-07T22:11:31') 541 541 attestation = Attestation.new(:system_id => 'NERV2', 542 542 :committer => @version.contribution, 543 543 :time_committed => dv_date_time, 544 544 :change_type => @original_version.commit_audit.change_type, 545 :reason => D V_Text.new('signed'))545 :reason => DvText.new('signed')) 546 546 assert_nothing_raised(Exception){ 547 547 @versioned_object.commit_attestation(:attestation => attestation,
Note:
See TracChangeset
for help on using the changeset viewer.