lutaml-xmi 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lutaml/xmi/parsers/xml.rb +40 -10
- data/lib/lutaml/xmi/version.rb +1 -1
- data/lutaml-xmi.gemspec +1 -1
- data/spec/fixtures/ea-xmi-2.4.2.xmi +1207 -239
- data/spec/lutaml/parsers/xmi_spec.rb +44 -7
- metadata +6 -6
@@ -58,28 +58,65 @@ RSpec.describe Lutaml::XMI::Parsers::XML do
|
|
58
58
|
verification
|
59
59
|
]
|
60
60
|
end
|
61
|
+
let(:expected_attributes_types) do
|
62
|
+
%w[
|
63
|
+
EAJava_ClassificationType_0..___
|
64
|
+
EAJava_RequirementSubpart_0..___
|
65
|
+
EAJava_String_0..1__
|
66
|
+
EAJava_String_
|
67
|
+
EAJava_RequirementSubpart_0..___
|
68
|
+
EAJava_String_0..___
|
69
|
+
EAJava_boolean_0..1__
|
70
|
+
EAJava_boolean_0..1__
|
71
|
+
EAJava_String_0..1__
|
72
|
+
EAJava_RequirementSubpart_0..___
|
73
|
+
EAJava_String_0..1__
|
74
|
+
EAJava_String_0..1__
|
75
|
+
EAJava_ObligationType_1..___
|
76
|
+
EAJava_BibliographicItem_0..1__
|
77
|
+
EAJava_RequirementSubpart_0..___
|
78
|
+
EAJava_String_0..1__
|
79
|
+
EAJava_RequirementSubpart_0..___
|
80
|
+
EAJava_String_0..1__
|
81
|
+
EAJava_FormattedString_0..1__
|
82
|
+
EAJava_String_0..1__
|
83
|
+
EAJava_boolean_0..1__
|
84
|
+
EAJava_RequirementSubpart_0..___
|
85
|
+
]
|
86
|
+
end
|
87
|
+
let(:first_package) { parse.packages.first }
|
88
|
+
let(:first_nested_package) { parse.packages.first.packages.first }
|
61
89
|
|
62
90
|
it "parses xml file into Lutaml::Uml::Node::Document object" do
|
63
91
|
expect(parse).to(be_instance_of(::Lutaml::Uml::Document))
|
64
92
|
end
|
65
93
|
|
66
|
-
it "correctly parses
|
67
|
-
expect(parse.
|
68
|
-
expect(
|
94
|
+
it "correctly parses package tree" do
|
95
|
+
expect(parse.packages.map(&:name)).to(eq(['ISO 19170-1 Edition 1']))
|
96
|
+
expect(first_package.packages.map(&:name))
|
97
|
+
.to(eq(["requirement type class diagram", "Common Spatio-temporal Classes"]))
|
98
|
+
expect(first_package.packages.last.packages.map(&:name))
|
99
|
+
.to(eq(["Temporal and Zonal Geometry", "Temporal and Zonal RS using Identifiers"]))
|
100
|
+
end
|
101
|
+
|
102
|
+
it "correctly parses package` classes" do
|
103
|
+
expect(first_nested_package.classes.map(&:name)).to(eq(expected_class_names))
|
104
|
+
expect(first_nested_package.classes.map(&:xmi_id)).to(eq(expected_class_xmi_ids))
|
69
105
|
end
|
70
106
|
|
71
107
|
it "correctly parses entities of enums type" do
|
72
|
-
expect(
|
73
|
-
expect(
|
108
|
+
expect(first_nested_package.enums.map(&:name)).to(eq(expected_enum_names))
|
109
|
+
expect(first_nested_package.enums.map(&:xmi_id)).to(eq(expected_enum_xmi_ids))
|
74
110
|
end
|
75
111
|
|
76
112
|
it "correctly parses entities and attributes for class" do
|
77
|
-
klass =
|
113
|
+
klass = first_nested_package.classes.find { |entity| entity.name == 'RequirementType' }
|
78
114
|
expect(klass.attributes.map(&:name)).to(eq(expected_attributes_names))
|
115
|
+
expect(klass.attributes.map(&:type)).to(eq(expected_attributes_types))
|
79
116
|
end
|
80
117
|
|
81
118
|
it "correctly parses associations for class" do
|
82
|
-
klass =
|
119
|
+
klass = first_nested_package.classes.find { |entity| entity.name == 'BibliographicItem' }
|
83
120
|
expect(klass.associations.map(&:member_end)).to(eq(['RequirementType']))
|
84
121
|
end
|
85
122
|
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.
|
4
|
+
version: 0.1.1
|
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-
|
11
|
+
date: 2021-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: lutaml-uml
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0
|
47
|
+
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|