Skip to content

Commit a014eb8

Browse files
adaussyAxelRICHARD
authored andcommitted
[1045] Improve export to properly handle named SuccessionAsUsage
Bug: #1045 Signed-off-by: Arthur Daussy <arthur.daussy@obeo.fr>
1 parent 82e702a commit a014eb8

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

CHANGELOG.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ A new dra & drop tool is available on the diagram, allowing moving `Satisfy Requ
3131
- https://github.com/eclipse-syson/syson/issues/1024[#1024] [diagrams] Allow `Usage` and `Definition` graphical node labels to be wrapped to handle long names more easily.
3232
- https://github.com/eclipse-syson/syson/issues/1030[#1030] [metamodel] `ConnectorAsUsage.getSourceFeature` and `ConnectorAsUsage.getTargetFeature` should redefine `Relationship.source` and `Relationship.target` features
3333
- https://github.com/eclipse-syson/syson/issues/1042[#1042] [import] Improve textual import of `SuccessionAsUsage` which define a new target action directly after the 'then' keyword.
34+
- https://github.com/eclipse-syson/syson/issues/1045[#1045] [export] Improve textual export by properly handle named `SuccessionAsUsage`.
3435

3536
=== New features
3637

backend/application/syson-application/src/test/java/org/eclipse/syson/application/export/ImportExportTests.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ public void setUp() {
5555
this.checker = new SysmlImportExportChecker(this.sysmlLoader, this.editingDomainFactory, this.exporter, this.sysMLEditingContextProcessor);
5656
}
5757

58+
@Test
59+
@DisplayName("Given a named SuccessionAsUsage, when importing and exporting the model, then the exported text file should be the same as the imported one.")
60+
public void checkNamedSuccessionAsUsageInActionDefinitionTest() throws IOException {
61+
var input = """
62+
action def A4 {
63+
action a1;
64+
action a2;
65+
succession s1 first a1 then a2;
66+
}""";
67+
68+
this.checker.check(input, input);
69+
}
70+
5871
@Test
5972
@DisplayName("Given a SuccessionAsUsage with an implicit source feature, when importing and exporting the model, then the exported text file should be the same as the imported one.")
6073
public void checkSuccessionAsUsageImplicitSourceTest() throws IOException {

backend/application/syson-sysml-export/src/main/java/org/eclipse/syson/sysml/export/SysMLElementSerializer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public String caseSuccessionAsUsage(SuccessionAsUsage successionAsUsage) {
359359
this.appendUsageDeclaration(declarationBuilder, successionAsUsage);
360360

361361
if (!declarationBuilder.isEmpty()) {
362-
builder.appendWithSpaceIfNeeded(declarationBuilder.toString());
362+
builder.appendWithSpaceIfNeeded("succession ").append(declarationBuilder.toString());
363363
}
364364

365365
List<EndFeatureMembership> endFeatureMemberships = successionAsUsage.getFeatureMembership().stream()
@@ -416,7 +416,7 @@ private boolean isSourceFeaturePreviousDefinedFeature(SuccessionAsUsage successi
416416

417417
/**
418418
* Checks if the source feature define force the given {@link EndFeatureMembership} is implicit or not
419-
*
419+
*
420420
* @param endFeatureMembership
421421
* the element to test
422422
* @return <code>true</code> if the given EndFeatureMembership represent an implicit feature

doc/content/modules/user-manual/pages/release-notes/2025.4.0.adoc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,22 @@ image::release-notes-gv-satisfy-requirement-usage.png[Satisfy Requirement Usage
5454
For example importing the following SysML file would now create a valid semantic model:
5555

5656
```
57-
action def ActionDef1 {
57+
action def ActionDef1 {
5858
first start;
5959
then action a1;
6060
then action a2;
6161
}
6262
```
63+
- Improve textual export of `SuccessionAsUsage` by properly handle its _name_.
64+
For example exporting a model of an `ActionDefinition` containing two `ActionUsages` and a named `SuccessionAsUsage` would produce the following file:
65+
66+
```
67+
action def ActionDef1 {
68+
action a1;
69+
action a2;
70+
succession s1 first a1 then a2;
71+
}
72+
```
6373

6474
== Dependency update
6575

0 commit comments

Comments
 (0)