lutaml-uml 0.4.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +22 -0
- data/Gemfile +1 -5
- data/README.adoc +4 -42
- data/Rakefile +0 -5
- data/lutaml-uml.gemspec +23 -38
- metadata +20 -292
- data/.github/workflows/macos.yml +0 -38
- data/.github/workflows/ubuntu.yml +0 -40
- data/.github/workflows/windows.yml +0 -51
- data/.gitignore +0 -12
- data/.rspec +0 -3
- data/.travis.yml +0 -6
- data/CODE_OF_CONDUCT.md +0 -74
- data/LUTAML.adoc +0 -372
- data/bin/console +0 -15
- data/bin/folder_yaml2lutaml.sh +0 -6
- data/bin/plantuml2lutaml +0 -59
- data/bin/setup +0 -8
- data/bin/yaml2lutaml +0 -144
- data/exe/lutaml-wsd2uml +0 -59
- data/exe/lutaml-yaml2uml +0 -144
- data/lib/lutaml/layout/engine.rb +0 -15
- data/lib/lutaml/layout/graph_viz_engine.rb +0 -19
- data/lib/lutaml/uml/abstraction.rb +0 -11
- data/lib/lutaml/uml/activity.rb +0 -11
- data/lib/lutaml/uml/actor.rb +0 -19
- data/lib/lutaml/uml/association.rb +0 -43
- data/lib/lutaml/uml/behavior.rb +0 -11
- data/lib/lutaml/uml/class.rb +0 -83
- data/lib/lutaml/uml/classifier.rb +0 -11
- data/lib/lutaml/uml/connector.rb +0 -21
- data/lib/lutaml/uml/constraint.rb +0 -12
- data/lib/lutaml/uml/constructor_end.rb +0 -16
- data/lib/lutaml/uml/data_type.rb +0 -75
- data/lib/lutaml/uml/dependency.rb +0 -21
- data/lib/lutaml/uml/diagram.rb +0 -8
- data/lib/lutaml/uml/document.rb +0 -81
- data/lib/lutaml/uml/enum.rb +0 -45
- data/lib/lutaml/uml/event.rb +0 -12
- data/lib/lutaml/uml/final_state.rb +0 -11
- data/lib/lutaml/uml/formatter/base.rb +0 -67
- data/lib/lutaml/uml/formatter/graphviz.rb +0 -334
- data/lib/lutaml/uml/formatter.rb +0 -21
- data/lib/lutaml/uml/has_attributes.rb +0 -14
- data/lib/lutaml/uml/has_members.rb +0 -30
- data/lib/lutaml/uml/instance.rb +0 -17
- data/lib/lutaml/uml/model.rb +0 -13
- data/lib/lutaml/uml/node/base.rb +0 -21
- data/lib/lutaml/uml/node/class_node.rb +0 -57
- data/lib/lutaml/uml/node/class_relationship.rb +0 -14
- data/lib/lutaml/uml/node/document.rb +0 -18
- data/lib/lutaml/uml/node/field.rb +0 -34
- data/lib/lutaml/uml/node/has_name.rb +0 -15
- data/lib/lutaml/uml/node/has_type.rb +0 -15
- data/lib/lutaml/uml/node/method.rb +0 -29
- data/lib/lutaml/uml/node/method_argument.rb +0 -16
- data/lib/lutaml/uml/node/relationship.rb +0 -28
- data/lib/lutaml/uml/opaque_behavior.rb +0 -11
- data/lib/lutaml/uml/operation.rb +0 -31
- data/lib/lutaml/uml/package.rb +0 -53
- data/lib/lutaml/uml/parsers/attribute.rb +0 -70
- data/lib/lutaml/uml/parsers/dsl.rb +0 -413
- data/lib/lutaml/uml/parsers/dsl_preprocessor.rb +0 -59
- data/lib/lutaml/uml/parsers/dsl_transform.rb +0 -27
- data/lib/lutaml/uml/parsers/yaml.rb +0 -46
- data/lib/lutaml/uml/port.rb +0 -8
- data/lib/lutaml/uml/primitive_type.rb +0 -14
- data/lib/lutaml/uml/property.rb +0 -27
- data/lib/lutaml/uml/pseudostate.rb +0 -11
- data/lib/lutaml/uml/realization.rb +0 -11
- data/lib/lutaml/uml/region.rb +0 -12
- data/lib/lutaml/uml/serializers/association.rb +0 -58
- data/lib/lutaml/uml/serializers/base.rb +0 -16
- data/lib/lutaml/uml/serializers/class.rb +0 -29
- data/lib/lutaml/uml/serializers/top_element_attribute.rb +0 -14
- data/lib/lutaml/uml/serializers/yaml_view.rb +0 -18
- data/lib/lutaml/uml/state.rb +0 -12
- data/lib/lutaml/uml/state_machine.rb +0 -12
- data/lib/lutaml/uml/top_element.rb +0 -58
- data/lib/lutaml/uml/top_element_attribute.rb +0 -38
- data/lib/lutaml/uml/transition.rb +0 -12
- data/lib/lutaml/uml/trigger.rb +0 -12
- data/lib/lutaml/uml/value.rb +0 -30
- data/lib/lutaml/uml/version.rb +0 -7
- data/lib/lutaml/uml/vertex.rb +0 -11
- data/lib/lutaml/uml.rb +0 -13
- data/spec/fixtures/datamodel/models/AddressClassProfile.yml +0 -90
- data/spec/fixtures/datamodel/models/AddressComponentProfile.yml +0 -63
- data/spec/fixtures/datamodel/models/AddressComponentSpecification.yml +0 -15
- data/spec/fixtures/datamodel/models/AddressProfile.yml +0 -36
- data/spec/fixtures/datamodel/models/AttributeProfile.yml +0 -32
- data/spec/fixtures/datamodel/models/InterchangeAddressClassProfile.yml +0 -79
- data/spec/fixtures/datamodel/models/Localization copy.yml +0 -23
- data/spec/fixtures/datamodel/models/Localization.yml +0 -23
- data/spec/fixtures/datamodel/models/ProfileCompliantAddress.yml +0 -36
- data/spec/fixtures/datamodel/models/ProfileCompliantAddressComponent.yml +0 -15
- data/spec/fixtures/datamodel/models/Signature.yml +0 -20
- data/spec/fixtures/datamodel/models/SignatureBlankDefinition.yml +0 -20
- data/spec/fixtures/datamodel/models/TextDirectionCode copy.yml +0 -16
- data/spec/fixtures/datamodel/models/TextDirectionCode.yml +0 -16
- data/spec/fixtures/datamodel/models/Validity.yml +0 -14
- data/spec/fixtures/datamodel/models/iso19160-1/Address.yml +0 -22
- data/spec/fixtures/datamodel/models/iso19160-1/AddressComponent.yml +0 -2
- data/spec/fixtures/datamodel/style.uml.inc +0 -37
- data/spec/fixtures/datamodel/views/AddressClassProfile.yml +0 -12
- data/spec/fixtures/datamodel/views/AddressProfile.yml +0 -3
- data/spec/fixtures/datamodel/views/CommonModels.yml +0 -9
- data/spec/fixtures/datamodel/views/TopDown.yml +0 -62
- data/spec/fixtures/dsl/broken_diagram.lutaml +0 -34
- data/spec/fixtures/dsl/diagram.lutaml +0 -3
- data/spec/fixtures/dsl/diagram_attributes.lutaml +0 -6
- data/spec/fixtures/dsl/diagram_blank_definion.lutaml +0 -6
- data/spec/fixtures/dsl/diagram_blank_entities.lutaml +0 -8
- data/spec/fixtures/dsl/diagram_class_assocation.lutaml +0 -29
- data/spec/fixtures/dsl/diagram_class_fields.lutaml +0 -25
- data/spec/fixtures/dsl/diagram_commented_includes.lutaml +0 -5
- data/spec/fixtures/dsl/diagram_comments.lutaml +0 -28
- data/spec/fixtures/dsl/diagram_concept_model.lutaml +0 -132
- data/spec/fixtures/dsl/diagram_data_types.lutaml +0 -44
- data/spec/fixtures/dsl/diagram_definitions.lutaml +0 -25
- data/spec/fixtures/dsl/diagram_includes.lutaml +0 -6
- data/spec/fixtures/dsl/diagram_multiply_classes.lutaml +0 -7
- data/spec/fixtures/dsl/diagram_non_existing_include.lutaml +0 -6
- data/spec/fixtures/dsl/shared.lutaml +0 -3
- data/spec/fixtures/dsl/shared1.lutaml +0 -4
- data/spec/fixtures/generated_dot/AddressClassProfile.dot +0 -170
- data/spec/fixtures/generated_dot/AddressProfile.dot +0 -34
- data/spec/lutaml/layout/graph_viz_engine_spec.rb +0 -31
- data/spec/lutaml/uml/formatter/graphviz_spec.rb +0 -41
- data/spec/lutaml/uml/parsers/dsl_spec.rb +0 -345
- data/spec/lutaml/uml/parsers/yaml_spec.rb +0 -18
- data/spec/lutaml/uml/serializers/yaml_view_spec.rb +0 -20
- data/spec/lutaml/uml_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -25
@@ -1,170 +0,0 @@
|
|
1
|
-
digraph G {
|
2
|
-
graph [splines="ortho" pad=0.5 ranksep="1.2.equally" nodesep="1.2.equally"]
|
3
|
-
edge [color="gray50"]
|
4
|
-
node [shape="box" fontname="Helvetica-bold"]
|
5
|
-
|
6
|
-
AddressProfile [
|
7
|
-
shape="plain"
|
8
|
-
fontname="Helvetica"
|
9
|
-
label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="10">
|
10
|
-
<TR>
|
11
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
12
|
-
<TR><TD ALIGN="CENTER"><B>AddressProfile</B></TD></TR>
|
13
|
-
</TABLE>
|
14
|
-
</TD>
|
15
|
-
</TR>
|
16
|
-
|
17
|
-
<TR>
|
18
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
19
|
-
<TR><TD ALIGN="LEFT"></TD></TR>
|
20
|
-
</TABLE></TD>
|
21
|
-
</TR>
|
22
|
-
|
23
|
-
<TR>
|
24
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
25
|
-
<TR><TD ALIGN="LEFT"></TD></TR>
|
26
|
-
</TABLE></TD>
|
27
|
-
</TR>
|
28
|
-
|
29
|
-
</TABLE>>]
|
30
|
-
|
31
|
-
AddressClassProfile [
|
32
|
-
shape="plain"
|
33
|
-
fontname="Helvetica"
|
34
|
-
label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="10">
|
35
|
-
<TR>
|
36
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
37
|
-
<TR><TD ALIGN="CENTER"><B>AddressClassProfile</B></TD></TR>
|
38
|
-
</TABLE>
|
39
|
-
</TD>
|
40
|
-
</TR>
|
41
|
-
|
42
|
-
<TR>
|
43
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
44
|
-
<TR><TD ALIGN="LEFT"></TD></TR>
|
45
|
-
</TABLE></TD>
|
46
|
-
</TR>
|
47
|
-
|
48
|
-
<TR>
|
49
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
50
|
-
<TR><TD ALIGN="LEFT"></TD></TR>
|
51
|
-
</TABLE></TD>
|
52
|
-
</TR>
|
53
|
-
|
54
|
-
</TABLE>>]
|
55
|
-
|
56
|
-
AddressComponentProfile [
|
57
|
-
shape="plain"
|
58
|
-
fontname="Helvetica"
|
59
|
-
label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="10">
|
60
|
-
<TR>
|
61
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
62
|
-
<TR><TD ALIGN="CENTER"><B>AddressComponentProfile</B></TD></TR>
|
63
|
-
</TABLE>
|
64
|
-
</TD>
|
65
|
-
</TR>
|
66
|
-
|
67
|
-
<TR>
|
68
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
69
|
-
<TR><TD ALIGN="LEFT"></TD></TR>
|
70
|
-
</TABLE></TD>
|
71
|
-
</TR>
|
72
|
-
|
73
|
-
<TR>
|
74
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
75
|
-
<TR><TD ALIGN="LEFT"></TD></TR>
|
76
|
-
</TABLE></TD>
|
77
|
-
</TR>
|
78
|
-
|
79
|
-
</TABLE>>]
|
80
|
-
|
81
|
-
AttributeProfile [
|
82
|
-
shape="plain"
|
83
|
-
fontname="Helvetica"
|
84
|
-
label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="10">
|
85
|
-
<TR>
|
86
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
87
|
-
<TR><TD ALIGN="CENTER"><B>AttributeProfile</B></TD></TR>
|
88
|
-
</TABLE>
|
89
|
-
</TD>
|
90
|
-
</TR>
|
91
|
-
|
92
|
-
<TR>
|
93
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
94
|
-
<TR><TD ALIGN="LEFT"></TD></TR>
|
95
|
-
</TABLE></TD>
|
96
|
-
</TR>
|
97
|
-
|
98
|
-
<TR>
|
99
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
100
|
-
<TR><TD ALIGN="LEFT"></TD></TR>
|
101
|
-
</TABLE></TD>
|
102
|
-
</TR>
|
103
|
-
|
104
|
-
</TABLE>>]
|
105
|
-
|
106
|
-
ProfileCompliantAddress [
|
107
|
-
shape="plain"
|
108
|
-
fontname="Helvetica"
|
109
|
-
label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="10">
|
110
|
-
<TR>
|
111
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
112
|
-
<TR><TD ALIGN="CENTER"><B>ProfileCompliantAddress</B></TD></TR>
|
113
|
-
</TABLE>
|
114
|
-
</TD>
|
115
|
-
</TR>
|
116
|
-
|
117
|
-
<TR>
|
118
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
119
|
-
<TR><TD ALIGN="LEFT"></TD></TR>
|
120
|
-
</TABLE></TD>
|
121
|
-
</TR>
|
122
|
-
|
123
|
-
<TR>
|
124
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
125
|
-
<TR><TD ALIGN="LEFT"></TD></TR>
|
126
|
-
</TABLE></TD>
|
127
|
-
</TR>
|
128
|
-
|
129
|
-
</TABLE>>]
|
130
|
-
|
131
|
-
InterchangeAddressClassProfile [
|
132
|
-
shape="plain"
|
133
|
-
fontname="Helvetica"
|
134
|
-
label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="10">
|
135
|
-
<TR>
|
136
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
137
|
-
<TR><TD ALIGN="CENTER"><B>InterchangeAddressClassProfile</B></TD></TR>
|
138
|
-
</TABLE>
|
139
|
-
</TD>
|
140
|
-
</TR>
|
141
|
-
|
142
|
-
<TR>
|
143
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
144
|
-
<TR><TD ALIGN="LEFT"></TD></TR>
|
145
|
-
</TABLE></TD>
|
146
|
-
</TR>
|
147
|
-
|
148
|
-
<TR>
|
149
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
150
|
-
<TR><TD ALIGN="LEFT"></TD></TR>
|
151
|
-
</TABLE></TD>
|
152
|
-
</TR>
|
153
|
-
|
154
|
-
</TABLE>>]
|
155
|
-
|
156
|
-
AddressProfile -> AddressComponentProfile [dir="back" label="defines ▶" arrowtail="onormal" arrowhead="odiamond" taillabel="+componentProfile 0..*"]
|
157
|
-
AddressProfile -> AddressClassProfile [dir="back" label="defines ▶" arrowtail="onormal" arrowhead="odiamond" taillabel="+addressProfile 0..*"]
|
158
|
-
AddressClassProfile -> AttributeProfile [dir="both" headlabel="+addressClassProfile" taillabel="+attributeProfile" arrowtail="odiamond" arrowhead="vee"]
|
159
|
-
AddressClassProfile -> ProfileCompliantAddress [dir="direct" label="◀ compliesWith" headlabel="+profile 1..1" arrowtail="onormal" arrowhead="vee"]
|
160
|
-
AddressComponentProfile -> AddressClassProfile [dir="direct" label="◀ uses" taillabel="+componentProfile" arrowtail="onormal" arrowhead="odiamond"]
|
161
|
-
AddressComponentProfile -> AttributeProfile [dir="both" headlabel="+addressClassProfile" taillabel="+attributeProfile" arrowtail="odiamond" arrowhead="vee"]
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
InterchangeAddressClassProfile -> AddressClassProfile [dir="direct" arrowtail="onormal" arrowhead="onormal"]
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
digraph G {
|
2
|
-
graph [splines="ortho" pad=0.5 ranksep="1.2.equally" nodesep="1.2.equally"]
|
3
|
-
edge [color="gray50"]
|
4
|
-
node [shape="box" fontname="Helvetica-bold"]
|
5
|
-
|
6
|
-
AddressProfile [
|
7
|
-
shape="plain"
|
8
|
-
fontname="Helvetica"
|
9
|
-
label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="10">
|
10
|
-
<TR>
|
11
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
12
|
-
<TR><TD ALIGN="CENTER"><B>AddressProfile</B></TD></TR>
|
13
|
-
</TABLE>
|
14
|
-
</TD>
|
15
|
-
</TR>
|
16
|
-
|
17
|
-
<TR>
|
18
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
19
|
-
<TR><TD ALIGN="LEFT">+country : iso3166Code[0..*]</TD></TR>
|
20
|
-
</TABLE>
|
21
|
-
</TD>
|
22
|
-
</TR>
|
23
|
-
|
24
|
-
<TR>
|
25
|
-
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
26
|
-
<TR><TD ALIGN="LEFT"></TD></TR>
|
27
|
-
</TABLE></TD>
|
28
|
-
</TR>
|
29
|
-
|
30
|
-
</TABLE>>]
|
31
|
-
|
32
|
-
AddressProfile -> AddressComponentProfile [dir="back" label="defines ▶" arrowtail="onormal" arrowhead="odiamond" taillabel="+componentProfile 0..*"]
|
33
|
-
AddressProfile -> AddressClassProfile [dir="back" label="defines ▶" arrowtail="onormal" arrowhead="odiamond" taillabel="+addressProfile 0..*"]
|
34
|
-
}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
RSpec.describe Lutaml::Layout::GraphVizEngine do
|
6
|
-
describe "#render" do
|
7
|
-
subject(:render) do
|
8
|
-
described_class.new(input: input).render(type)
|
9
|
-
end
|
10
|
-
let(:input) do
|
11
|
-
File.read(fixtures_path("generated_dot/AddressClassProfile.dot"))
|
12
|
-
end
|
13
|
-
|
14
|
-
context "when png output type" do
|
15
|
-
let(:type) { "png" }
|
16
|
-
let(:png_header) { "\x89PNG" }
|
17
|
-
|
18
|
-
it "renders input as png binary string" do
|
19
|
-
expect(render[0..3]).to(eq(png_header))
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context "when dot output type" do
|
24
|
-
let(:type) { "dot" }
|
25
|
-
|
26
|
-
it "renders input as dot string" do
|
27
|
-
expect(render).to(match("digraph G {"))
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
RSpec.describe Lutaml::Uml::Formatter::Graphviz do
|
6
|
-
describe ".format_document" do
|
7
|
-
subject(:format_document) do
|
8
|
-
described_class.new.format_document(input_document)
|
9
|
-
end
|
10
|
-
|
11
|
-
context "when simple aggregation" do
|
12
|
-
let(:input_document) do
|
13
|
-
Lutaml::Uml::Parsers::Yaml
|
14
|
-
.parse(fixtures_path("datamodel/views/AddressProfile.yml"))
|
15
|
-
end
|
16
|
-
|
17
|
-
let(:formatted_dot_content) do
|
18
|
-
File.read(fixtures_path("generated_dot/AddressProfile.dot"))
|
19
|
-
end
|
20
|
-
|
21
|
-
it "generates the correct relationship graph" do
|
22
|
-
expect(format_document).to eq(formatted_dot_content)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
context "when aggregation with inheritance" do
|
27
|
-
let(:input_document) do
|
28
|
-
Lutaml::Uml::Parsers::Yaml
|
29
|
-
.parse(fixtures_path("datamodel/views/AddressClassProfile.yml"))
|
30
|
-
end
|
31
|
-
|
32
|
-
let(:formatted_dot_content) do
|
33
|
-
File.read(fixtures_path("generated_dot/AddressClassProfile.dot"))
|
34
|
-
end
|
35
|
-
|
36
|
-
it "generates the correct relationship graph" do
|
37
|
-
expect(format_document).to eq(formatted_dot_content)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,345 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
RSpec.describe Lutaml::Uml::Parsers::Dsl do
|
6
|
-
describe ".parse" do
|
7
|
-
subject(:parse) { described_class.parse(content) }
|
8
|
-
subject(:format_parsed_document) do
|
9
|
-
Lutaml::Uml::Formatter::Graphviz.new.format_document(parse)
|
10
|
-
end
|
11
|
-
|
12
|
-
shared_examples "the correct graphviz formatting" do
|
13
|
-
it "does not raise error on graphviz formatting" do
|
14
|
-
expect { format_parsed_document }.to_not raise_error
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context "when simple diagram without attributes" do
|
19
|
-
let(:content) do
|
20
|
-
File.new(fixtures_path("dsl/diagram.lutaml"))
|
21
|
-
end
|
22
|
-
|
23
|
-
it "creates Lutaml::Uml::Document object from supplied dsl" do
|
24
|
-
expect(parse).to be_instance_of(Lutaml::Uml::Document)
|
25
|
-
end
|
26
|
-
|
27
|
-
it_behaves_like "the correct graphviz formatting"
|
28
|
-
end
|
29
|
-
|
30
|
-
context "when diagram with attributes" do
|
31
|
-
let(:content) do
|
32
|
-
File.new(fixtures_path("dsl/diagram_attributes.lutaml"))
|
33
|
-
end
|
34
|
-
|
35
|
-
it "creates Lutaml::Uml::Document object and sets its attributes" do
|
36
|
-
expect(parse).to be_instance_of(Lutaml::Uml::Document)
|
37
|
-
expect(parse.title).to eq("my diagram, another symbols: text.")
|
38
|
-
expect(parse.caption)
|
39
|
-
.to(eq("Block elements of StandardDocument, adapted from BasicDocument. Another - symbol"))
|
40
|
-
expect(parse.fontname).to eq("Arial")
|
41
|
-
end
|
42
|
-
|
43
|
-
it_behaves_like "the correct graphviz formatting"
|
44
|
-
end
|
45
|
-
|
46
|
-
context "when multiply classes entries" do
|
47
|
-
let(:content) do
|
48
|
-
File.new(fixtures_path("dsl/diagram_multiply_classes.lutaml"))
|
49
|
-
end
|
50
|
-
|
51
|
-
it "creates Lutaml::Uml::Document object and creates dependent classes" do
|
52
|
-
classes = parse.classes
|
53
|
-
expect(parse).to be_instance_of(Lutaml::Uml::Document)
|
54
|
-
expect(parse.classes.length).to eq(4)
|
55
|
-
expect(by_name(classes, "NamespacedClass").keyword).to eq("MyNamespace")
|
56
|
-
end
|
57
|
-
|
58
|
-
it_behaves_like "the correct graphviz formatting"
|
59
|
-
end
|
60
|
-
|
61
|
-
context "when class with fields" do
|
62
|
-
let(:content) do
|
63
|
-
File.new(fixtures_path("dsl/diagram_class_fields.lutaml"))
|
64
|
-
end
|
65
|
-
|
66
|
-
it "creates the correct classes and sets the \
|
67
|
-
correct number of attributes" do
|
68
|
-
classes = parse.classes
|
69
|
-
expect(by_name(classes, "Component").attributes).to be_nil
|
70
|
-
expect(by_name(classes, "AddressClassProfile")
|
71
|
-
.attributes.length).to eq(1)
|
72
|
-
expect(by_name(classes, "AttributeProfile")
|
73
|
-
.attributes.length).to eq(13)
|
74
|
-
expect(by_name(classes, "AttributeProfile")
|
75
|
-
.attributes.map(&:name))
|
76
|
-
.to(eq(["imlicistAttributeProfile",
|
77
|
-
"attributeProfile",
|
78
|
-
"attributeProfile1",
|
79
|
-
"privateAttributeProfile",
|
80
|
-
"friendlyAttributeProfile",
|
81
|
-
"friendlyAttributeProfile1",
|
82
|
-
"protectedAttributeProfile",
|
83
|
-
"type/text",
|
84
|
-
"slashType",
|
85
|
-
"application/docbook+xml",
|
86
|
-
"application/tei+xml",
|
87
|
-
"text/x-asciidoc",
|
88
|
-
"application/x-isodoc+xml"]))
|
89
|
-
end
|
90
|
-
|
91
|
-
it "creates the correct attributes with the correct visibility" do
|
92
|
-
attributes = by_name(parse.classes, "AttributeProfile").attributes
|
93
|
-
expect(by_name(attributes, "imlicistAttributeProfile").visibility)
|
94
|
-
.to be_nil
|
95
|
-
expect(by_name(attributes, "imlicistAttributeProfile").keyword)
|
96
|
-
.to be_nil
|
97
|
-
expect(by_name(attributes, "attributeProfile").visibility)
|
98
|
-
.to eq("public")
|
99
|
-
expect(by_name(attributes, "attributeProfile").keyword)
|
100
|
-
.to eq("BasicDocument")
|
101
|
-
expect(by_name(attributes, "attributeProfile1").visibility)
|
102
|
-
.to eq("public")
|
103
|
-
expect(by_name(attributes, "attributeProfile1").keyword)
|
104
|
-
.to eq("BasicDocument")
|
105
|
-
expect(by_name(attributes, "privateAttributeProfile").visibility)
|
106
|
-
.to eq("private")
|
107
|
-
expect(by_name(attributes, "friendlyAttributeProfile").visibility)
|
108
|
-
.to eq("friendly")
|
109
|
-
expect(by_name(attributes, "friendlyAttributeProfile").keyword)
|
110
|
-
.to eq("Type")
|
111
|
-
expect(by_name(attributes, "protectedAttributeProfile").visibility)
|
112
|
-
.to eq("protected")
|
113
|
-
end
|
114
|
-
|
115
|
-
it_behaves_like "the correct graphviz formatting"
|
116
|
-
end
|
117
|
-
|
118
|
-
context "when association blocks exists" do
|
119
|
-
let(:content) do
|
120
|
-
File.new(fixtures_path("dsl/diagram_class_assocation.lutaml"))
|
121
|
-
end
|
122
|
-
|
123
|
-
it "creates the correct number of associations" do
|
124
|
-
expect(parse.associations.length).to eq(3)
|
125
|
-
end
|
126
|
-
|
127
|
-
context "when bidirectional asscoiation syntax " do
|
128
|
-
subject(:association) do
|
129
|
-
by_name(parse.associations, "BidirectionalAsscoiation")
|
130
|
-
end
|
131
|
-
|
132
|
-
it "creates associations with the correct attributes" do
|
133
|
-
expect(association.owner_end_type).to(eq("aggregation"))
|
134
|
-
expect(association.member_end_type).to(eq("direct"))
|
135
|
-
expect(association.owner_end).to(eq("AddressClassProfile"))
|
136
|
-
expect(association.owner_end_attribute_name)
|
137
|
-
.to(eq("addressClassProfile"))
|
138
|
-
expect(association.member_end).to(eq("AttributeProfile"))
|
139
|
-
expect(association.member_end_attribute_name)
|
140
|
-
.to(eq("attributeProfile"))
|
141
|
-
expect(association.member_end_cardinality).to(eq("min" => "0", "max" => "*"))
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
context "when direct asscoiation syntax " do
|
146
|
-
subject(:association) do
|
147
|
-
by_name(parse.associations, "DirectAsscoiation")
|
148
|
-
end
|
149
|
-
|
150
|
-
it "creates associations with the correct attributes" do
|
151
|
-
expect(association.owner_end_type).to(be_nil)
|
152
|
-
expect(association.member_end_type).to(eq("direct"))
|
153
|
-
expect(association.owner_end).to(eq("AddressClassProfile"))
|
154
|
-
expect(association.owner_end_attribute_name).to(be_nil)
|
155
|
-
expect(association.member_end).to(eq("AttributeProfile"))
|
156
|
-
expect(association.member_end_attribute_name)
|
157
|
-
.to(eq("attributeProfile"))
|
158
|
-
expect(association.member_end_cardinality).to(be_nil)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
context "when reverse asscoiation syntax " do
|
163
|
-
subject(:association) do
|
164
|
-
by_name(parse.associations, "ReverseAsscoiation")
|
165
|
-
end
|
166
|
-
|
167
|
-
it "creates associations with the correct attributes" do
|
168
|
-
expect(association.owner_end_type).to(eq("aggregation"))
|
169
|
-
expect(association.member_end_type).to(be_nil)
|
170
|
-
expect(association.owner_end).to(eq("AddressClassProfile"))
|
171
|
-
expect(association.owner_end_attribute_name)
|
172
|
-
.to(eq("addressClassProfile"))
|
173
|
-
expect(association.member_end).to(eq("AttributeProfile"))
|
174
|
-
expect(association.member_end_attribute_name).to(be_nil)
|
175
|
-
expect(association.member_end_cardinality).to(be_nil)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
context "when data_types entries" do
|
181
|
-
let(:content) do
|
182
|
-
File.new(fixtures_path("dsl/diagram_data_types.lutaml"))
|
183
|
-
end
|
184
|
-
|
185
|
-
it "Generates the correct nodes for enums" do
|
186
|
-
enums = parse.enums
|
187
|
-
expect(by_name(enums, "MyEnum").attributes).to be_nil
|
188
|
-
expect(by_name(enums, "AddressClassProfile")
|
189
|
-
.attributes.length).to eq(1)
|
190
|
-
expect(by_name(enums, "Profile")
|
191
|
-
.attributes.length).to eq(5)
|
192
|
-
end
|
193
|
-
|
194
|
-
it "Generates the correct nodes for data_types" do
|
195
|
-
data_types = parse.data_types
|
196
|
-
expect(by_name(data_types, "Banking Information")
|
197
|
-
.attributes.map(&:name))
|
198
|
-
.to(eq(["art code", "CCT Number"]))
|
199
|
-
end
|
200
|
-
|
201
|
-
it "Generates the correct nodes for primitives" do
|
202
|
-
data_types = parse.primitives
|
203
|
-
expect(by_name(data_types, "Integer")).to_not be_nil
|
204
|
-
end
|
205
|
-
|
206
|
-
it_behaves_like "the correct graphviz formatting"
|
207
|
-
end
|
208
|
-
|
209
|
-
context "when concept model generated lutaml file" do
|
210
|
-
let(:content) do
|
211
|
-
File.new(fixtures_path("dsl/diagram_concept_model.lutaml"))
|
212
|
-
end
|
213
|
-
|
214
|
-
it "Generates the correct class/enums/associations list" do
|
215
|
-
document = parse
|
216
|
-
expect(document.classes.length).to(eq(9))
|
217
|
-
expect(document.enums.length).to(eq(3))
|
218
|
-
expect(document.associations.length).to(eq(16))
|
219
|
-
end
|
220
|
-
|
221
|
-
it "Generates the correct attributes list" do
|
222
|
-
attributes = by_name(parse.classes, "ExpressionDesignation").attributes
|
223
|
-
expect(attributes.length).to(eq(5))
|
224
|
-
expect(attributes.map(&:name))
|
225
|
-
.to(eq(%w[text language script pronunciation grammarInfo]))
|
226
|
-
expect(attributes.map(&:type))
|
227
|
-
.to(eq(["GlossaristTextElementType",
|
228
|
-
"Iso639ThreeCharCode",
|
229
|
-
"Iso15924Code",
|
230
|
-
"LocalizedString",
|
231
|
-
"GrammarInfo"]))
|
232
|
-
end
|
233
|
-
|
234
|
-
it_behaves_like "the correct graphviz formatting"
|
235
|
-
end
|
236
|
-
|
237
|
-
context "when include directives is used" do
|
238
|
-
let(:content) do
|
239
|
-
File.new(fixtures_path("dsl/diagram_includes.lutaml"))
|
240
|
-
end
|
241
|
-
|
242
|
-
it "includes supplied files into the document" do
|
243
|
-
expect(parse.classes.map(&:name))
|
244
|
-
.to(eq(%w[Foo Doo Koo AttributeProfile]))
|
245
|
-
expect(by_name(parse.classes, "AttributeProfile")
|
246
|
-
.attributes.map(&:name))
|
247
|
-
.to eq(["imlicistAttributeProfile", "attributeProfile"])
|
248
|
-
end
|
249
|
-
|
250
|
-
it_behaves_like "the correct graphviz formatting"
|
251
|
-
end
|
252
|
-
|
253
|
-
context "when include directives is used" do
|
254
|
-
let(:content) do
|
255
|
-
File.new(fixtures_path("dsl/diagram_comments.lutaml"))
|
256
|
-
end
|
257
|
-
|
258
|
-
it "create comments for document and classes" do
|
259
|
-
expect(parse.comments).to(eq(["My comment",
|
260
|
-
"this is multiline\n comment with {} special\n chars/\n\n +-|/"]))
|
261
|
-
expect(parse.classes.last.comments)
|
262
|
-
.to(eq(["this is attribute comment",
|
263
|
-
"this is another comment line\n with multiply lines"]))
|
264
|
-
end
|
265
|
-
|
266
|
-
it_behaves_like "the correct graphviz formatting"
|
267
|
-
end
|
268
|
-
|
269
|
-
context "when defninition directives included" do
|
270
|
-
let(:content) do
|
271
|
-
File.new(fixtures_path("dsl/diagram_definitions.lutaml"))
|
272
|
-
end
|
273
|
-
let(:class_definition) do
|
274
|
-
"this is multiline with `ascidoc`\ncomments\nand list\n{foo} {name}"
|
275
|
-
end
|
276
|
-
let(:attribute_definition) do
|
277
|
-
"this is attribute definition\nwith multiply lines\n{foo} {name}\nend definition"
|
278
|
-
end
|
279
|
-
|
280
|
-
it "create comments for document and classes" do
|
281
|
-
expect(by_name(parse.classes, "AddressClassProfile").definition)
|
282
|
-
.to(eq(class_definition))
|
283
|
-
expect(by_name(parse.classes, "AttributeProfile")
|
284
|
-
.attributes
|
285
|
-
.first
|
286
|
-
.definition)
|
287
|
-
.to(eq(attribute_definition))
|
288
|
-
end
|
289
|
-
|
290
|
-
it_behaves_like "the correct graphviz formatting"
|
291
|
-
end
|
292
|
-
|
293
|
-
context "when defninition is blank" do
|
294
|
-
let(:content) do
|
295
|
-
File.new(fixtures_path("dsl/diagram_blank_definion.lutaml"))
|
296
|
-
end
|
297
|
-
|
298
|
-
it "successfully renders" do
|
299
|
-
expect { parse }.to_not(raise_error)
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
|
-
context "when there are blank definitions" do
|
304
|
-
let(:content) do
|
305
|
-
File.new(fixtures_path("dsl/diagram_blank_entities.lutaml"))
|
306
|
-
end
|
307
|
-
|
308
|
-
it "successfully renders" do
|
309
|
-
expect { parse }.to_not(raise_error)
|
310
|
-
end
|
311
|
-
end
|
312
|
-
|
313
|
-
context "when its a non existing include file" do
|
314
|
-
let(:content) do
|
315
|
-
File.new(fixtures_path("dsl/diagram_non_existing_include.lutaml"))
|
316
|
-
end
|
317
|
-
|
318
|
-
it "successfully renders" do
|
319
|
-
expect { parse }.to_not(raise_error)
|
320
|
-
end
|
321
|
-
end
|
322
|
-
|
323
|
-
context "when there are commented preprocessor lines" do
|
324
|
-
let(:content) do
|
325
|
-
File.new(fixtures_path("dsl/diagram_commented_includes.lutaml"))
|
326
|
-
end
|
327
|
-
|
328
|
-
it "successfully renders" do
|
329
|
-
expect { parse }.to_not(raise_error)
|
330
|
-
end
|
331
|
-
end
|
332
|
-
|
333
|
-
context "when broken lutaml file passed" do
|
334
|
-
let(:content) do
|
335
|
-
File.new(fixtures_path("dsl/broken_diagram.lutaml"))
|
336
|
-
end
|
337
|
-
|
338
|
-
it "returns error object and prints line number" do
|
339
|
-
expect { described_class.parse(content, {}) }
|
340
|
-
.to(raise_error(Lutaml::Uml::Parsers::ParsingError,
|
341
|
-
/but got ":" at line 25 char 32/))
|
342
|
-
end
|
343
|
-
end
|
344
|
-
end
|
345
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
RSpec.describe Lutaml::Uml::Parsers::Yaml do
|
6
|
-
describe ".parse" do
|
7
|
-
subject(:parse) { described_class.parse(yaml_conent) }
|
8
|
-
|
9
|
-
let(:yaml_conent) do
|
10
|
-
fixtures_path("datamodel/views/TopDown.yml")
|
11
|
-
end
|
12
|
-
|
13
|
-
it "creates Lutaml::Uml::Document object from yaml" do
|
14
|
-
expect(parse).to be_instance_of(Lutaml::Uml::Document)
|
15
|
-
expect(parse.classes.first).to be_instance_of(Lutaml::Uml::Class)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
require "lutaml/uml/serializers/yaml_view"
|
5
|
-
|
6
|
-
RSpec.describe Lutaml::Uml::Serializers::YamlView do
|
7
|
-
describe "#new" do
|
8
|
-
subject(:serialize) { described_class.new(yaml_content) }
|
9
|
-
|
10
|
-
let(:yaml_content) do
|
11
|
-
YAML.safe_load(File.read(fixtures_path("datamodel/views/TopDown.yml")))
|
12
|
-
end
|
13
|
-
|
14
|
-
it "Correctly parses passed yaml file" do
|
15
|
-
expect(serialize.name).to eq(yaml_content["name"])
|
16
|
-
expect(serialize.title).to eq(yaml_content["title"])
|
17
|
-
expect(serialize.caption).to eq(yaml_content["caption"])
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|