source: ruby/trunk/spec/lib/open_ehr/serializer/sample_archetype_spec.rb@ 408

Last change on this file since 408 was 408, checked in by KOBAYASHI, Shinji, 14 years ago

serializer implementation

File size: 2.6 KB
Line 
1require File.dirname(__FILE__) + '/../../../spec_helper'
2include OpenEHR::AM::Archetype
3include OpenEHR::AM::Archetype::ConstraintModel
4include OpenEHR::AM::Archetype::Ontology
5include OpenEHR::RM::Support::Identification
6include OpenEHR::RM::DataTypes::Text
7include OpenEHR::AssumedLibraryTypes
8
9shared_examples_for 'sample archetype' do
10 before(:all) do
11 terminologies_available = Set.new('ja')
12 term_codes = ['at0000']
13 archetype_term = ArchetypeTerm.new(:code => 'ja',
14 :items => {'text' => 'simple test',
15 'description' => 'simple test for serializer'})
16 term_definitions = {'ja' => {'at0000' => archetype_term}}
17 ontology =
18 ArchetypeOntology.new(:terminologies_available => terminologies_available,
19 :specialisation_depth => 0,
20 :term_codes => term_codes,
21 :constraint_codes => [],
22 :term_attribute_names => ['text','description'],
23 :term_definitions => term_definitions)
24 archetype_id = ArchetypeID.new(:value =>
25 'openEHR-EHR-SECTION.test.v1')
26 terminology_id = TerminologyID.new(:value => 'ISO_639-1')
27 original_language = CodePhrase.new(:code_string => 'ja',
28 :terminology_id => terminology_id)
29 occurrences = Interval.new(:upper => 1, :lower => 1)
30 definition = CComplexObject.new(:path => '/',
31 :rm_type_name => 'SECTION',
32 :occurrences => occurrences,
33 :node_id => 'at0000')
34 original_author = {'email' => 'skoba@moss.gr.jp',
35 'organisation' => 'openEHR.jp',
36 'name' => 'Shinji KOBAYASHI'}
37 resource_description_item =
38 ResourceDescriptionItem.new(:language => original_language,
39 :purpose => 'Serializer test',
40 :misuse => 'evaluate message')
41 details = {'ja' => resource_description_item}
42 description = ResourceDescription.new(:original_author => original_author,
43 :lifecycle_state => 'draft',
44 :details => details)
45 @archetype = Archetype.new(:archetype_id => archetype_id,
46 :concept => 'at0000',
47 :original_language => original_language,
48 :ontology => ontology,
49 :description => description,
50 :definition => definition)
51 end
52end
Note: See TracBrowser for help on using the repository browser.