Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
* `String getCompartmentItemName(String prefix, String suffix)`
* `String getInheritedCompartmentItemName(String prefix, String suffix)`
* `String getEdgeName(String prefix, String suffix)`
- [services] In order to match the new service architecture the following methods has been moved:
* `ViewCreateService.createPartUsageAndBindingConnectorAsUsage(PartUsage self)` to `ModelMutationElementService.createPartUsageAndBindingConnectorAsUsage(PartUsage self)`
* `ViewCreateService.createPartUsageAndFlowConnection(PartUsage self)` to `ModelMutationElementService.createPartUsageAndFlowConnection(PartUsage self)`
* `ViewCreateService.createPartUsageAndInterface(PartUsage self)` to `ModelMutationElementService.createPartUsageAndInterface(PartUsage self)`
* `ViewEdgeService.getTarget(ConnectorAsUsage connector)` to `MetamodelElementQueryService.getTarget(ConnectorAsUsage connector)`
* `ViewEdgeService.getSource(ConnectorAsUsage connector)` to `MetamodelElementQueryService.getSource(ConnectorAsUsage connector)`
* `ViewEdgeService.reconnectSource(ConnectorAsUsage bind, Feature newSource)` to `DiagramMutationElementService.reconnectSource(ConnectorAsUsage connectorAsUsage, Feature newSource, Node sourceNode, Node targetNode, IEditingContext editingContext, Diagram diagram)`
* `ViewEdgeService.reconnectTarget(ConnectorAsUsage bind, Feature newTarget)` to `DiagramMutationElementService.reconnectTarget(ConnectorAsUsage connectorAsUsage, Feature newTarget, Node sourceNode, Node targetNode, IEditingContext editingContext, Diagram diagram)`
* `UtilService.createFlowConnectionEnd(Feature targetedFeature)` to `MetamodelMutationElementService.createFlowConnectionEnd(Feature targetedFeature)`
* `UtilService.setConnectorEnds(ConnectorAsUsage connectorAsUsage, Feature source, Feature target, Type connectorContainer)` to `MetamodelMutationElementService.setConnectorEnds(ConnectorAsUsage connectorAsUsage, Feature source, Feature target, Element connectorContainer)`

NOTE: The signature of the _reconnectSource_ and _reconnect_Target_ now takes graphical nodes as inputs. It helps handling inherited elements that are not displayed in their semantic owner.

=== Dependency update

Expand Down Expand Up @@ -49,6 +61,7 @@ A new compartment named _satisfy requirements_ has also been added to `PartDefin
- https://github.com/eclipse-syson/syson/issues/1737[#1737] [diagrams] Add creation tools to InterconnectionCompartmentNode
- https://github.com/eclipse-syson/syson/issues/1395[#1395] Provide a way to duplicate a semantic element ans its representation node in the _General View_ diagram.
- https://github.com/eclipse-syson/syson/issues/1740[#1740] [diagrams] Add _items_ compartment and graphical border node on `PortDefinition` graphical nodes in the _General View_ diagram.
- https://github.com/eclipse-syson/syson/issues/1738[#1738] [diagrams] Add `ConnectionUsage` as edges in _General View_ diagram.

== v2025.12.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.eclipse.sirius.components.representations.Message;
import org.eclipse.sirius.components.representations.MessageLevel;
import org.eclipse.syson.application.configuration.SysMLv2PropertiesConfigurer;
import org.eclipse.syson.services.ElementInitializerSwitch;
import org.eclipse.syson.services.ImportService;
import org.eclipse.syson.services.UtilService;
import org.eclipse.syson.sysml.AcceptActionUsage;
Expand Down Expand Up @@ -69,6 +68,7 @@
import org.eclipse.syson.sysml.TransitionUsage;
import org.eclipse.syson.sysml.Type;
import org.eclipse.syson.sysml.ViewUsage;
import org.eclipse.syson.sysml.metamodel.services.ElementInitializerSwitch;
import org.eclipse.syson.sysml.textual.SysMLElementSerializer;
import org.eclipse.syson.sysml.textual.utils.FileNameDeresolver;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import org.eclipse.sirius.components.emf.services.api.IEMFEditingContext;
import org.eclipse.sirius.components.representations.VariableManager;
import org.eclipse.syson.services.DeleteService;
import org.eclipse.syson.services.ElementInitializerSwitch;
import org.eclipse.syson.services.UtilService;
import org.eclipse.syson.services.api.ISysONResourceService;
import org.eclipse.syson.sysml.Element;
Expand All @@ -53,6 +52,7 @@
import org.eclipse.syson.sysml.SysmlFactory;
import org.eclipse.syson.sysml.SysmlPackage;
import org.eclipse.syson.sysml.ViewUsage;
import org.eclipse.syson.sysml.metamodel.services.ElementInitializerSwitch;
import org.eclipse.syson.sysml.util.ElementUtil;
import org.eclipse.syson.util.GetIntermediateContainerCreationSwitch;
import org.eclipse.syson.util.SysMLMetamodelHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@

import org.eclipse.sirius.components.collaborative.diagrams.dto.DiagramRefreshedEventPayload;
import org.eclipse.sirius.components.core.api.IIdentityService;
import org.eclipse.sirius.components.diagrams.Diagram;
import org.eclipse.syson.application.controller.editingContext.checkers.SemanticCheckerService;
import org.eclipse.syson.sysml.BindingConnectorAsUsage;
import org.eclipse.syson.sysml.ConnectorAsUsage;
import org.eclipse.syson.sysml.FeatureChaining;

import reactor.test.StepVerifier.Step;

/**
* Checker that verify semantic of a {@link BindingConnectorAsUsage}.
* Checker that verify semantic of a {@link org.eclipse.syson.sysml.ConnectorAsUsage}.
*
* @param <T> Type of {@link ConnectorAsUsage} to check.
* @author Arthur Daussy
*/
public class BindingConnectorAsUsageChecker {
public class ConnectorAsUsageChecker<T extends ConnectorAsUsage> {

private String expectedSourceSemanticId;

Expand All @@ -51,74 +51,77 @@ public class BindingConnectorAsUsageChecker {

private final SemanticCheckerService semanticCheckerService;

public BindingConnectorAsUsageChecker(
private final Class<T> expectedType;

public ConnectorAsUsageChecker(
IIdentityService identityService,
SemanticCheckerService semanticCheckerService) {
SemanticCheckerService semanticCheckerService,
Class<T> expectedType) {
this.identityService = identityService;
this.semanticCheckerService = semanticCheckerService;
this.expectedType = expectedType;
}

public BindingConnectorAsUsageChecker setExpectedSemanticContainer(String anExpectedSemanticContainer) {
public ConnectorAsUsageChecker<T> setExpectedSemanticContainer(String anExpectedSemanticContainer) {
this.expectedSemanticContainer = anExpectedSemanticContainer;
return this;
}

public BindingConnectorAsUsageChecker setExpectedSourceFeatureChain(List<String> anExpectedSourceFeatureChain) {
public ConnectorAsUsageChecker<T> setExpectedSourceFeatureChain(List<String> anExpectedSourceFeatureChain) {
this.expectedSourceFeatureChain = anExpectedSourceFeatureChain;
return this;
}

public BindingConnectorAsUsageChecker setExpectedSourceReference(String anExpectedSourceReference) {
public ConnectorAsUsageChecker<T> setExpectedSourceReference(String anExpectedSourceReference) {
this.expectedSourceReference = anExpectedSourceReference;
return this;
}

public BindingConnectorAsUsageChecker setExpectedSourceSemanticId(String anExpectedSourceSemanticId) {
public ConnectorAsUsageChecker<T> setExpectedSourceSemanticId(String anExpectedSourceSemanticId) {
this.expectedSourceSemanticId = anExpectedSourceSemanticId;
return this;
}

public BindingConnectorAsUsageChecker setExpectedTargetSemanticId(String anExpectedTargetSemanticId) {
public ConnectorAsUsageChecker<T> setExpectedTargetSemanticId(String anExpectedTargetSemanticId) {
this.expectedTargetSemanticId = anExpectedTargetSemanticId;
return this;
}

public BindingConnectorAsUsageChecker setExpectedTargetFeatureChain(List<String> anExpectedTargetFeatureChain) {
public ConnectorAsUsageChecker<T> setExpectedTargetFeatureChain(List<String> anExpectedTargetFeatureChain) {
this.expectedTargetFeatureChain = anExpectedTargetFeatureChain;
return this;
}

public BindingConnectorAsUsageChecker setExpectedTargetReference(String anExpectedTargetReference) {
public ConnectorAsUsageChecker<T> setExpectedTargetReference(String anExpectedTargetReference) {
this.expectedTargetReference = anExpectedTargetReference;
return this;
}

public void run(Step<DiagramRefreshedEventPayload> verifier, AtomicReference<Diagram> diagram, AtomicReference<String> bindingIdProvider) {
public <T extends ConnectorAsUsage> void run(Step<DiagramRefreshedEventPayload> verifier, AtomicReference<String> edgeIdProvider) {

this.semanticCheckerService.checkElement(verifier, BindingConnectorAsUsage.class, () -> bindingIdProvider.get(),
binding -> {
assertThat(this.identityService.getId(binding.getSourceFeature().getFeatureTarget()))
this.semanticCheckerService.checkElement(verifier, this.expectedType, edgeIdProvider::get,
connectorAsUsage -> {
assertThat(this.identityService.getId(connectorAsUsage.getSourceFeature().getFeatureTarget()))
.isEqualTo(this.expectedSourceSemanticId);
assertThat(this.identityService.getId(binding.getTargetFeature().get(0).getFeatureTarget()))
assertThat(this.identityService.getId(connectorAsUsage.getTargetFeature().get(0).getFeatureTarget()))
.isEqualTo(this.expectedTargetSemanticId);
assertThat(this.identityService.getId(binding.getOwningType())).isEqualTo(this.expectedSemanticContainer);
assertThat(this.identityService.getId(connectorAsUsage.getOwner())).isEqualTo(this.expectedSemanticContainer);

if (this.expectedSourceReference != null) {
assertThat(this.identityService.getId(binding.getSourceFeature()))
assertThat(this.identityService.getId(connectorAsUsage.getSourceFeature()))
.isEqualTo(this.expectedSourceReference);
} else if (this.expectedSourceFeatureChain != null) {
assertThat(binding.getSourceFeature().getOwnedFeatureChaining().stream()
assertThat(connectorAsUsage.getSourceFeature().getOwnedFeatureChaining().stream()
.map(FeatureChaining::getChainingFeature)
.map(fc -> this.identityService.getId(fc))
.toList())
.isEqualTo(this.expectedSourceFeatureChain);
}

if (this.expectedTargetReference != null) {
assertThat(this.identityService.getId(binding.getTargetFeature().get(0)))
assertThat(this.identityService.getId(connectorAsUsage.getTargetFeature().get(0)))
.isEqualTo(this.expectedTargetReference);
} else if (this.expectedTargetFeatureChain != null) {
assertThat(binding.getTargetFeature().get(0).getOwnedFeatureChaining().stream()
assertThat(connectorAsUsage.getTargetFeature().get(0).getOwnedFeatureChaining().stream()
.map(FeatureChaining::getChainingFeature)
.map(fc -> this.identityService.getId(fc))
.toList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
import org.eclipse.syson.AbstractIntegrationTests;
import org.eclipse.syson.SysONTestsProperties;
import org.eclipse.syson.application.controller.editingContext.checkers.SemanticCheckerService;
import org.eclipse.syson.application.controllers.diagrams.checkers.BindingConnectorAsUsageChecker;
import org.eclipse.syson.application.controllers.diagrams.checkers.CheckDiagramElementCount;
import org.eclipse.syson.application.controllers.diagrams.checkers.ConnectorAsUsageChecker;
import org.eclipse.syson.application.controllers.diagrams.checkers.DiagramCheckerService;
import org.eclipse.syson.application.controllers.diagrams.checkers.IDiagramChecker;
import org.eclipse.syson.application.controllers.diagrams.testers.EdgeCreationTester;
Expand Down Expand Up @@ -163,7 +163,7 @@ public void bindingNestedLevel1() {
.setExpectedSemanticContainer(GeneralViewBindingConnectorProjectData.SemanticIds.A0_ID)
.setExpectedSourceReference(GeneralViewBindingConnectorProjectData.SemanticIds.I0_ID)
.setExpectedTargetFeatureChain(List.of(GeneralViewBindingConnectorProjectData.SemanticIds.A1_ID, GeneralViewBindingConnectorProjectData.SemanticIds.I1_ID))
.run(this.verifier, this.diagram, newEdge);
.run(this.verifier, newEdge);

}

Expand All @@ -186,7 +186,7 @@ public void bindingNestedLevel1Reversed() {
.setExpectedSemanticContainer(GeneralViewBindingConnectorProjectData.SemanticIds.A0_ID)
.setExpectedTargetReference(GeneralViewBindingConnectorProjectData.SemanticIds.I0_ID)
.setExpectedSourceFeatureChain(List.of(GeneralViewBindingConnectorProjectData.SemanticIds.A1_ID, GeneralViewBindingConnectorProjectData.SemanticIds.I1_ID))
.run(this.verifier, this.diagram, newEdge);
.run(this.verifier, newEdge);

}

Expand All @@ -209,7 +209,7 @@ public void bindingNestedLevel2() {
.setExpectedSourceReference(GeneralViewBindingConnectorProjectData.SemanticIds.I0_ID)
.setExpectedTargetFeatureChain(List.of(GeneralViewBindingConnectorProjectData.SemanticIds.A1_ID, GeneralViewBindingConnectorProjectData.SemanticIds.A11_ID,
GeneralViewBindingConnectorProjectData.SemanticIds.I11_ID))
.run(this.verifier, this.diagram, newEdge);
.run(this.verifier, newEdge);
}

@DisplayName("GIVEN a ActionUsage owning sibling items, WHEN creating a BindingConnectorAsUsage, THEN the binding should be created the common container (A11) and feature should be directly referenced")
Expand All @@ -231,7 +231,7 @@ public void bindingSameLevel() {
.setExpectedSemanticContainer(GeneralViewBindingConnectorProjectData.SemanticIds.A11_ID)
.setExpectedSourceReference(GeneralViewBindingConnectorProjectData.SemanticIds.I11_ID)
.setExpectedTargetReference(GeneralViewBindingConnectorProjectData.SemanticIds.I11TEST_ID)
.run(this.verifier, this.diagram, newEdge);
.run(this.verifier, newEdge);
}

@DisplayName("GIVEN a ActionUsage with existing binding, WHEN reconnecting target, THEN binding should be moved to new the common container (A1) and the source/target should be recomputed")
Expand All @@ -251,11 +251,11 @@ public void reconnectTargetSameLevel() {
.setExpectedSourceReference(GeneralViewBindingConnectorProjectData.SemanticIds.I1_ID)
// No more feature chain required
.setExpectedTargetReference(GeneralViewBindingConnectorProjectData.SemanticIds.I2_ID)
.run(this.verifier, this.diagram, newEdge);
.run(this.verifier, newEdge);
}

private BindingConnectorAsUsageChecker createChecker() {
return new BindingConnectorAsUsageChecker(this.identityService, this.semanticCheckerService);
private ConnectorAsUsageChecker<BindingConnectorAsUsage> createChecker() {
return new ConnectorAsUsageChecker<>(this.identityService, this.semanticCheckerService, BindingConnectorAsUsage.class);
}

private AtomicReference<String> reconnect(String edgeId, String newTarget, ReconnectEdgeKind reconnectionKind, String expectedSourceGraplicalId, String expectedTargetGraplicalId) {
Expand Down
Loading