lutaml-xmi 0.1.0 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,6 +16,7 @@ RSpec.describe Lutaml::XMI::Parsers::XML do
16
16
  Requirement
17
17
  RequirementSubpart
18
18
  RequirementType
19
+ TemporalGeometricPrimitive
19
20
  ]
20
21
  end
21
22
  let(:expected_class_xmi_ids) do
@@ -28,6 +29,7 @@ RSpec.describe Lutaml::XMI::Parsers::XML do
28
29
  EAID_2AC20C81_1E83_400d_B098_BAB784395E06
29
30
  EAID_035D8176_5E9E_42c8_B447_64411AE96F57
30
31
  EAID_C1155D80_E68B_46d5_ADE5_F5639486163D
32
+ EAID_37BF1557_0370_435d_94BB_8FCC4574561B
31
33
  ]
32
34
  end
33
35
  let(:expected_enum_names) { ["ObligationType"] }
@@ -58,29 +60,84 @@ RSpec.describe Lutaml::XMI::Parsers::XML do
58
60
  verification
59
61
  ]
60
62
  end
63
+ let(:expected_attributes_types) do
64
+ %w[
65
+ EAJava_ClassificationType_0..___
66
+ EAJava_RequirementSubpart_0..___
67
+ EAJava_String_0..1__
68
+ EAJava_String_
69
+ EAJava_RequirementSubpart_0..___
70
+ EAJava_String_0..___
71
+ EAJava_boolean_0..1__
72
+ EAJava_boolean_0..1__
73
+ EAJava_String_0..1__
74
+ EAJava_RequirementSubpart_0..___
75
+ EAJava_String_0..1__
76
+ EAJava_String_0..1__
77
+ EAJava_ObligationType_1..___
78
+ EAJava_BibliographicItem_0..1__
79
+ EAJava_RequirementSubpart_0..___
80
+ EAJava_String_0..1__
81
+ EAJava_RequirementSubpart_0..___
82
+ EAJava_String_0..1__
83
+ EAJava_FormattedString_0..1__
84
+ EAJava_String_0..1__
85
+ EAJava_boolean_0..1__
86
+ EAJava_RequirementSubpart_0..___
87
+ ]
88
+ end
89
+ let(:expected_association_names) do
90
+ %w[
91
+ TemporalGeometricPrimitive
92
+ Primitive
93
+ TemporalGeometry
94
+ Interval
95
+ Instant
96
+ ]
97
+ end
98
+ let(:first_package) { parse.packages.first }
99
+ let(:first_nested_package) { parse.packages.first.packages.first }
61
100
 
62
101
  it "parses xml file into Lutaml::Uml::Node::Document object" do
63
102
  expect(parse).to(be_instance_of(::Lutaml::Uml::Document))
64
103
  end
65
104
 
66
- it "correctly parses entities of class type" do
67
- expect(parse.classes.map(&:name)).to(eq(expected_class_names))
68
- expect(parse.classes.map(&:xmi_id)).to(eq(expected_class_xmi_ids))
105
+ it "correctly parses package tree" do
106
+ expect(parse.packages.map(&:name)).to(eq(['ISO 19170-1 Edition 1']))
107
+ expect(first_package.packages.map(&:name))
108
+ .to(eq(["requirement type class diagram", "Common Spatio-temporal Classes"]))
109
+ expect(first_package.packages.last.packages.map(&:name))
110
+ .to(eq(["Temporal and Zonal Geometry", "Temporal and Zonal RS using Identifiers"]))
111
+ end
112
+
113
+ it "correctly parses package` classes" do
114
+ expect(first_nested_package.classes.map(&:name)).to(eq(expected_class_names))
115
+ expect(first_nested_package.classes.map(&:xmi_id)).to(eq(expected_class_xmi_ids))
69
116
  end
70
117
 
71
118
  it "correctly parses entities of enums type" do
72
- expect(parse.enums.map(&:name)).to(eq(expected_enum_names))
73
- expect(parse.enums.map(&:xmi_id)).to(eq(expected_enum_xmi_ids))
119
+ expect(first_nested_package.enums.map(&:name)).to(eq(expected_enum_names))
120
+ expect(first_nested_package.enums.map(&:xmi_id)).to(eq(expected_enum_xmi_ids))
74
121
  end
75
122
 
76
123
  it "correctly parses entities and attributes for class" do
77
- klass = parse.classes.find { |entity| entity.name == 'RequirementType' }
124
+ klass = first_nested_package.classes.find { |entity| entity.name == 'RequirementType' }
78
125
  expect(klass.attributes.map(&:name)).to(eq(expected_attributes_names))
126
+ expect(klass.attributes.map(&:type)).to(eq(expected_attributes_types))
79
127
  end
80
128
 
81
129
  it "correctly parses associations for class" do
82
- klass = parse.classes.find { |entity| entity.name == 'BibliographicItem' }
83
- expect(klass.associations.map(&:member_end)).to(eq(['RequirementType']))
130
+ klass = first_nested_package.classes.find { |entity| entity.name == 'TemporalGeometricPrimitive' }
131
+ expect(klass.associations.map(&:member_end).compact).to(eq(expected_association_names))
132
+
133
+ inheritance = klass.associations.find { |entity| entity.member_end == 'TemporalGeometry' }
134
+ expect(inheritance.member_end_type).to eq('inheritance')
135
+ expect(inheritance.member_end_cardinality).to eq({"min"=>"C", "max"=>"*"})
136
+
137
+ aggregation = klass.associations.find { |entity| entity.member_end == 'TemporalGeometricPrimitive' }
138
+ expect(aggregation.member_end_attribute_name).to eq('element')
139
+ expect(aggregation.member_end_type).to eq('aggregation')
140
+ expect(aggregation.member_end_cardinality).to eq({"min"=>"C", "max"=>"*"})
84
141
  end
85
142
  end
86
143
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml-xmi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-20 00:00:00.000000000 Z
11
+ date: 2021-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -40,18 +40,32 @@ dependencies:
40
40
  version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: lutaml-uml
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: nokogiri
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '0.2'
61
+ version: '1.10'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '0.2'
68
+ version: '1.10'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +94,6 @@ dependencies:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: nokogiri
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '1.10'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '1.10'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -165,6 +165,7 @@ files:
165
165
  - ".rspec"
166
166
  - CODE_OF_CONDUCT.md
167
167
  - Gemfile
168
+ - Makefile
168
169
  - README.adoc
169
170
  - Rakefile
170
171
  - bin/console
@@ -201,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
202
  - !ruby/object:Gem::Version
202
203
  version: '0'
203
204
  requirements: []
204
- rubygems_version: 3.0.3
205
+ rubygems_version: 3.1.6
205
206
  signing_key:
206
207
  specification_version: 4
207
208
  summary: XML Metadata Interchange (XMI) Specification parser in Ruby, tools for accessing