Class: IpaTestKit::Generator
- Inherits:
-
Object
- Object
- IpaTestKit::Generator
show all
- Defined in:
- lib/ipa_test_kit/generator.rb,
lib/ipa_test_kit/generator/naming.rb,
lib/ipa_test_kit/generator/ig_loader.rb,
lib/ipa_test_kit/generator/ig_metadata.rb,
lib/ipa_test_kit/generator/ig_resources.rb,
lib/ipa_test_kit/generator/special_cases.rb,
lib/ipa_test_kit/generator/group_metadata.rb,
lib/ipa_test_kit/generator/group_generator.rb,
lib/ipa_test_kit/generator/suite_generator.rb,
lib/ipa_test_kit/generator/value_extractor.rb,
lib/ipa_test_kit/generator/read_test_generator.rb,
lib/ipa_test_kit/generator/ig_metadata_extractor.rb,
lib/ipa_test_kit/generator/search_test_generator.rb,
lib/ipa_test_kit/generator/resource_list_generator.rb,
lib/ipa_test_kit/generator/group_metadata_extractor.rb,
lib/ipa_test_kit/generator/search_metadata_extractor.rb,
lib/ipa_test_kit/generator/validation_test_generator.rb,
lib/ipa_test_kit/generator/must_support_test_generator.rb,
lib/ipa_test_kit/generator/must_support_metadata_extractor.rb,
lib/ipa_test_kit/generator/reference_resolution_test_generator.rb,
lib/ipa_test_kit/generator/search_definition_metadata_extractor.rb,
lib/ipa_test_kit/generator/terminology_binding_metadata_extractor.rb,
lib/ipa_test_kit/generator/provenance_revinclude_search_test_generator.rb
Defined Under Namespace
Modules: Naming, SpecialCases
Classes: GroupGenerator, GroupMetadata, GroupMetadataExtractor, IGLoader, IGMetadata, IGMetadataExtractor, IGResources, MustSupportMetadataExtractor, MustSupportTestGenerator, ProvenanceRevincludeSearchTestGenerator, ReadTestGenerator, ReferenceResolutionTestGenerator, ResourceListGenerator, SearchDefinitionMetadataExtractor, SearchMetadataExtractor, SearchTestGenerator, SuiteGenerator, TerminologyBindingMetadataExtractor, ValidationTestGenerator, ValueExactor
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(ig_file_name) ⇒ Generator
Returns a new instance of Generator.
30
31
32
|
# File 'lib/ipa_test_kit/generator.rb', line 30
def initialize(ig_file_name)
self.ig_file_name = ig_file_name
end
|
Instance Attribute Details
#base_search_params ⇒ Object
Returns the value of attribute base_search_params.
28
29
30
|
# File 'lib/ipa_test_kit/generator.rb', line 28
def base_search_params
@base_search_params
end
|
#ig_file_name ⇒ Object
Returns the value of attribute ig_file_name.
28
29
30
|
# File 'lib/ipa_test_kit/generator.rb', line 28
def ig_file_name
@ig_file_name
end
|
Returns the value of attribute ig_metadata.
28
29
30
|
# File 'lib/ipa_test_kit/generator.rb', line 28
def ig_metadata
@ig_metadata
end
|
#ig_resources ⇒ Object
Returns the value of attribute ig_resources.
28
29
30
|
# File 'lib/ipa_test_kit/generator.rb', line 28
def ig_resources
@ig_resources
end
|
Class Method Details
.generate ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/ipa_test_kit/generator.rb', line 20
def self.generate
ig_packages = Dir.glob(File.join(Dir.pwd, 'lib', 'ipa_test_kit', 'igs', '*.tgz'))
ig_packages.each do |ig_package|
new(ig_package).generate
end
end
|
Instance Method Details
#base_output_dir ⇒ Object
74
75
76
|
# File 'lib/ipa_test_kit/generator.rb', line 74
def base_output_dir
File.join(__dir__, 'generated', ig_metadata.ig_version)
end
|
65
66
67
68
69
70
71
72
|
# File 'lib/ipa_test_kit/generator.rb', line 65
def
self.ig_metadata = IGMetadataExtractor.new(ig_resources, base_search_params).
FileUtils.mkdir_p(base_output_dir)
File.open(File.join(base_output_dir, 'metadata.yml'), 'w') do |file|
file.write(YAML.dump(ig_metadata.to_hash))
end
end
|
#generate ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/ipa_test_kit/generator.rb', line 34
def generate
puts "Generating tests for IG #{File.basename(ig_file_name)}"
load_ig_package
load_base_search_params
generate_resource_list
generate_search_tests
generate_read_tests
generate_provenance_revinclude_search_tests
generate_validation_tests
generate_must_support_tests
generate_reference_resolution_tests
generate_groups
generate_suites
end
|
#generate_groups ⇒ Object
111
112
113
114
|
# File 'lib/ipa_test_kit/generator.rb', line 111
def generate_groups
binding.pry if ig_metadata.nil?
GroupGenerator.generate(ig_metadata, base_output_dir)
end
|
#generate_must_support_tests ⇒ Object
#generate_provenance_revinclude_search_tests ⇒ Object
#generate_read_tests ⇒ Object
99
100
101
|
# File 'lib/ipa_test_kit/generator.rb', line 99
def generate_read_tests
ReadTestGenerator.generate(ig_metadata, base_output_dir)
end
|
#generate_reference_resolution_tests ⇒ Object
#generate_resource_list ⇒ Object
83
84
85
|
# File 'lib/ipa_test_kit/generator.rb', line 83
def generate_resource_list
ResourceListGenerator.generate(ig_metadata, base_output_dir)
end
|
#generate_search_tests ⇒ Object
103
104
105
|
# File 'lib/ipa_test_kit/generator.rb', line 103
def generate_search_tests
SearchTestGenerator.generate(ig_metadata, base_output_dir)
end
|
#generate_suites ⇒ Object
116
117
118
|
# File 'lib/ipa_test_kit/generator.rb', line 116
def generate_suites
SuiteGenerator.generate(ig_metadata, base_output_dir)
end
|
#generate_validation_tests ⇒ Object
#load_base_search_params ⇒ Object
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/ipa_test_kit/generator.rb', line 54
def load_base_search_params
self.base_search_params =
JSON.parse(
File.read(
File.join(
Dir.pwd, 'lib', 'ipa_test_kit', 'igs', 'ipa_v100', 'search-parameters.json'
)
)
)
end
|
#load_ig_package ⇒ Object
78
79
80
81
|
# File 'lib/ipa_test_kit/generator.rb', line 78
def load_ig_package
FHIR.logger = Logger.new('/dev/null')
self.ig_resources = IGLoader.new(ig_file_name).load
end
|