Skip to content

Commit 28f9a69

Browse files
committed
Bug killing in TOSCA node types
1 parent 2c39396 commit 28f9a69

File tree

8 files changed

+44
-27
lines changed

8 files changed

+44
-27
lines changed
Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
tosca_definitions_version: tosca_simple_yaml_1_3
22

3-
metadata:
4-
targetNamespace: ""
5-
name: "Face_Application"
3+
imports:
4+
- file: .tosca
5+
namespace_uri: example.eu.myrtus.nodetypes
6+
namespace_prefix: MYRTUS-
67

7-
topology_template:
8-
node_templates:
9-
relationship_templates:
10-
con_HostedOn_2:
11-
type: tosca.relationships.hostedOn
12-
con_HostedOn_1:
13-
type: tosca.relationships.hostedOn
14-
con_HostedOn_0:
15-
type: tosca.relationships.hostedOn
16-
con_ConnectsTo_1:
17-
type: tosca.relationships.ConnectsTo
18-
con_ConnectsTo_0:
19-
type: tosca.relationships.ConnectsTo
8+
node_types:
9+
example.eu.myrtus.nodetypes.Myrtus-Workstation:
10+
derived_from: tosca.nodes.Compute
11+
metadata:
12+
targetNamespace: "example.eu.myrtus.nodetypes"
13+
abstract: "false"
14+
final: "false"
15+
16+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
tosca_definitions_version: tosca_simple_yaml_1_3
2+
3+
imports:
4+
- file: .tosca
5+
namespace_uri: example.eu.myrtus.nodetypes
6+
namespace_prefix: MYRTUS-
7+
8+
node_types:
9+
example.eu.myrtus.nodetypes.MyrtusCameraFeed:
10+
derived_from: example.eu.myrtus.nodetypes.MyrtusSWComponent
11+
metadata:
12+
targetNamespace: "example.eu.myrtus.nodetypes"
13+
abstract: "false"
14+
final: "false"
15+
16+

ToscaDesigner/Generated TOSCA files/MyrtusFace_Application.tosca

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ topology_template:
1919
requirements:
2020
- host:
2121
node: Myrtus_Workstation_1
22-
relationship:
22+
relationship: con_HostedOn_0
2323
capability: host
2424

2525

@@ -32,17 +32,17 @@ topology_template:
3232
requirements:
3333
- egress1:
3434
node: MyrtusCameraFeed_0
35-
relationship:
35+
relationship: con_ConnectsTo_0
3636
capability: CameraFeed.WebService
3737

3838
- egress2:
3939
node: MyrtusFaceDetectionService_0
40-
relationship:
40+
relationship: con_ConnectsTo_1
4141
capability: FaceDetectionService
4242

4343
- host:
4444
node: Myrtus_Workstation_1
45-
relationship:
45+
relationship: con_HostedOn_2
4646
capability: host
4747

4848

@@ -54,7 +54,7 @@ topology_template:
5454
requirements:
5555
- host:
5656
node: Myrtus_Workstation_1
57-
relationship:
57+
relationship: con_HostedOn_1
5858
capability: host
5959

6060

@@ -67,6 +67,6 @@ topology_template:
6767
con_HostedOn_0:
6868
type: hostedOn
6969
con_ConnectsTo_1:
70-
type: hostedOn
70+
type: connectTo
7171
con_ConnectsTo_0:
72-
type: hostedOn
72+
type: connectTo

ToscaDesigner/src/main/java/fr/softeam/toscadesigner/export/AbstractToscaFileGenerator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.github.jknack.handlebars.Template;
2626
import com.github.jknack.handlebars.helper.ConditionalHelpers;
2727
import com.github.jknack.handlebars.io.ClassPathTemplateLoader;
28+
import com.modeliosoft.modelio.javadesigner.annotations.mdl.prop;
2829

2930
import fr.softeam.toscadesigner.api.tosca.standard.association.TRelationshipTemplate;
3031
import fr.softeam.toscadesigner.api.tosca.standard.attribute.TCapabilityDefinition;
@@ -74,6 +75,9 @@ private Handlebars setupHandlebars() {
7475
} else if (searchedPropertyName.equals("capability")) {
7576
CapabilityStereotype capability = tRequirement.getCapability();
7677
propertyStringValue = capability != null ? capability.getElement().getName() : "";
78+
} else if (searchedPropertyName.equals("relationship")) {
79+
TRelationshipTemplate relationship = tRequirement.getRelationship();
80+
propertyStringValue = relationship != null ? relationship.getElement().getName() : "";
7781
}
7882
} else if (stereotype.getName().equals("TRequirementDefinition")) {
7983

ToscaDesigner/src/main/resources/fr/softeam/templates/TNodeTemplate.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{{#each ../ownedElement}}{{#extension}}{{#eq name "RequirementsType"}}{{#each ../ownedElement}}{{#extension}}{{#eq name "TRequirement"}}
1313
- {{../name}}:
1414
node: {{getProperty ../this "node"}}
15-
relationship: {{relationship}}
15+
relationship: {{getProperty ../this "relationship"}}
1616
capability: {{getProperty ../this "capability"}}
1717
{{#unless (noStereotypeApplications ../this "TPropertyDef")}}properties:{{/unless}}
1818
{{#each ../ownedAttribute}}{{#extension}}{{#eq name "TPropertyDef"}}

ToscaDesigner/src/main/resources/fr/softeam/templates/TNodeType.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ node_types:
77
targetNamespace: "{{getProperty this "targetNamespace"}}"
88
abstract: "{{getProperty this "abstract"}}"
99
final: "{{getProperty this "final"}}"
10-
{{#unless (noStereotypeApplications this "RequirementDefinitionType")}}requirements:{{/unless}}
11-
{{#each ownedElement}}{{#extension}}{{#eq name "RequirementDefinitionType"}}{{#each ../ownedAttribute}}{{#extension}}{{#eq name "TRequirementDefinition"}}
10+
{{#unless (noStereotypeApplications this "RequirementDefinitionsType")}}requirements:{{/unless}}
11+
{{#each ownedElement}}{{#extension}}{{#eq name "RequirementDefinitionsType"}}{{#each ../ownedElement}}{{#extension}}{{#eq name "TRequirementDefinition"}}
1212
- {{../name}}:
1313
capability: {{getProperty ../this "capability"}}
1414
relationship: {{getProperty ../this "relationshipType"}}
1515
occurrences: [{{../multiplicityMin}}, {{../multiplicityMax}}]
1616
{{/eq}}{{/extension}}{{/each}}{{/eq}}{{/extension}}{{/each}}
1717
{{#unless (noStereotypeApplications this "CapabilityDefinitionsType")}}capabilities:{{/unless}}
18-
{{#each ownedElement}}{{#extension}}{{#eq name "CapabilityDefinitionsType"}}{{#each ../ownedAttribute}}{{#extension}}{{#eq name "TCapabilityDefinition"}}
18+
{{#each ownedElement}}{{#extension}}{{#eq name "CapabilityDefinitionsType"}}{{#each ../ownedElement}}{{#extension}}{{#eq name "TCapabilityDefinition"}}
1919
{{../name}}:
2020
occurrences: [{{../multiplicityMin}}, {{../multiplicityMax}}]
2121
type: tosca.capabilities.Endpoint
77 Bytes
Binary file not shown.
56 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)