Skip to content
Draft
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
6 changes: 5 additions & 1 deletion CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,17 @@ As a result, the application won't start if a service call is constructed with a
- https://github.com/eclipse-syson/syson/issues/1988[#1988] [syson] Extract Elasticsearch container initialization in a dedicated abstract test class.
Integration tests that require Elasticsearch now need to extend `AbstractIntegrationTestsWithElasticsearch`.
- https://github.com/eclipse-syson/syson/issues/1983[#1983] [details] `reqId` property of `RequirementDefinition` is now visible in the _Core_ tab of the _Details_ view.
- https://github.com/eclipse-syson/syson/issues/1945[#1945] [diagrams] Add ends compartment on `AllocationDefinition` and `ConnectionDefinition` graphical nodes
- https://github.com/eclipse-syson/syson/issues/1945[#1945] [diagrams] Add ends compartment on `AllocationDefinition` and `ConnectionDefinition` graphical nodes.
Newly created `AllocationDefinition` and `ConnectionDefinition` graphical nodes now have two initial _connection ends_, named _source_ and _target_.
Additional ends can be created using the _New end_ graphical node tool (which replaces the _New Part as end_ previously available only on `AllocationDefinition` graphical nodes).
- https://github.com/eclipse-syson/syson/issues/1972[#1972] [diagrams] Add _ends_ compartment on `InterfaceDefinition` graphical node.
Newly created `InterfaceDefinition` graphical nodes now have two initial _ports_ named _source_ and _target_.
Additional ports can be created using the _New Port as end_ graphical node tool.
- https://github.com/eclipse-syson/syson/issues/1863[#1863] [diagrams] Dropping an elements on a diagram which is already visible gives feedback again.
- https://github.com/eclipse-syson/syson/issues/2003[#2003] [diagrams] Rework the way _New Binding Connector As Usage (bind)_, _New Flow (flow)_ and _New Interface (interface)_ graphical edge tools works.
Currently, when a binding/interface/flow graphical edge tool is executed, if it involves an inherited feature(s) (as source and/or target of the tool), then the inherited feature(s) is/are redefined first.
Instead SysON will now use the inherited elements without redefining them first, as it is done by the _New Connection (connect)_ edge tool.


=== New features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.eclipse.syson.sysml.Dependency;
import org.eclipse.syson.sysml.Element;
import org.eclipse.syson.sysml.Feature;
import org.eclipse.syson.sysml.FeatureChaining;
import org.eclipse.syson.sysml.FeatureTyping;
import org.eclipse.syson.sysml.FeatureValue;
import org.eclipse.syson.sysml.LiteralBoolean;
Expand Down Expand Up @@ -97,6 +98,14 @@ public List<EStructuralFeature> caseFeature(Feature object) {
return features;
}

@Override
public List<EStructuralFeature> caseFeatureChaining(FeatureChaining object) {
var features = new ArrayList<EStructuralFeature>();
features.addAll(this.caseElement(object));
features.add(SysmlPackage.eINSTANCE.getFeatureChaining_ChainingFeature());
return features;
}

@Override
public List<EStructuralFeature> caseFeatureValue(FeatureValue object) {
var features = new ArrayList<EStructuralFeature>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ public void getCoreFeaturesOfPartUsage() {
SysmlPackage.eINSTANCE.getOccurrenceUsage_IsIndividual());
}

@Test
public void getCoreFeaturesOfFeatureChaining() {
List<EStructuralFeature> coreStructuralFeatures = this.detailsViewService.getCoreFeatures(SysmlFactory.eINSTANCE.createFeatureChaining());
assertThat(coreStructuralFeatures).containsOnly(SysmlPackage.eINSTANCE.getElement_DeclaredName(),
SysmlPackage.eINSTANCE.getElement_QualifiedName(),
SysmlPackage.eINSTANCE.getElement_DeclaredShortName(),
SysmlPackage.eINSTANCE.getFeatureChaining_ChainingFeature());
}

@Test
public void getCoreFeaturesOfFeatureValue() {
List<EStructuralFeature> coreStructuralFeatures = this.detailsViewService.getCoreFeatures(SysmlFactory.eINSTANCE.createFeatureValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@

import org.eclipse.sirius.components.core.api.IIdentityService;
import org.eclipse.syson.application.controller.editingContext.checkers.SemanticCheckerService;
import org.eclipse.syson.sysml.ConnectorAsUsage;
import org.eclipse.syson.sysml.Connector;
import org.eclipse.syson.sysml.FeatureChaining;

/**
* Builder for a checker that verify semantic of a {@link org.eclipse.syson.sysml.ConnectorAsUsage}.
* Builder for a checker that verify semantic of a {@link org.eclipse.syson.sysml.Connector}.
*
* @param <T> Type of {@link ConnectorAsUsage} to check.
* @param <T>
* Type of {@link Connector} to check.
* @author Arthur Daussy
*/
public class ConnectorAsUsageCheckerBuilder<T extends ConnectorAsUsage> {
public class ConnectorCheckerBuilder<T extends Connector> {

private String expectedSourceSemanticId;

Expand All @@ -50,7 +51,7 @@ public class ConnectorAsUsageCheckerBuilder<T extends ConnectorAsUsage> {

private final SemanticCheckerService semanticCheckerService;

public ConnectorAsUsageCheckerBuilder(
public ConnectorCheckerBuilder(
IIdentityService identityService,
Class<T> expectedType,
SemanticCheckerService semanticCheckerService) {
Expand All @@ -59,71 +60,70 @@ public ConnectorAsUsageCheckerBuilder(
this.semanticCheckerService = semanticCheckerService;
}

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

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

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

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

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

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

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

public Runnable build(AtomicReference<String> edgeIdProvider) {
return this.semanticCheckerService.checkElement(this.expectedType, edgeIdProvider::get,
connectorAsUsage -> {
assertThat(this.identityService.getId(connectorAsUsage.getSourceFeature().getFeatureTarget()))
connector -> {
assertThat(this.identityService.getId(connector.getSourceFeature().getFeatureTarget()))
.isEqualTo(this.expectedSourceSemanticId);
assertThat(this.identityService.getId(connectorAsUsage.getTargetFeature().get(0).getFeatureTarget()))
assertThat(this.identityService.getId(connector.getTargetFeature().get(0).getFeatureTarget()))
.isEqualTo(this.expectedTargetSemanticId);
assertThat(this.identityService.getId(connectorAsUsage.getOwner())).isEqualTo(this.expectedSemanticContainer);
assertThat(this.identityService.getId(connector.getOwner())).isEqualTo(this.expectedSemanticContainer);

if (this.expectedSourceReference != null) {
assertThat(this.identityService.getId(connectorAsUsage.getSourceFeature()))
assertThat(this.identityService.getId(connector.getSourceFeature()))
.isEqualTo(this.expectedSourceReference);
} else if (this.expectedSourceFeatureChain != null) {
assertThat(connectorAsUsage.getSourceFeature().getOwnedFeatureChaining().stream()
assertThat(connector.getSourceFeature().getOwnedFeatureChaining().stream()
.map(FeatureChaining::getChainingFeature)
.map(this.identityService::getId)
.toList())
.isEqualTo(this.expectedSourceFeatureChain);
}
if (this.expectedTargetReference != null) {
assertThat(this.identityService.getId(connectorAsUsage.getTargetFeature().get(0)))
assertThat(this.identityService.getId(connector.getTargetFeature().get(0)))
.isEqualTo(this.expectedTargetReference);
} else if (this.expectedTargetFeatureChain != null) {
assertThat(connectorAsUsage.getTargetFeature().get(0).getOwnedFeatureChaining().stream()
assertThat(connector.getTargetFeature().get(0).getOwnedFeatureChaining().stream()
.map(FeatureChaining::getChainingFeature)
.map(this.identityService::getId)
.toList())
.isEqualTo(this.expectedTargetFeatureChain);
}
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import org.eclipse.syson.SysONTestsProperties;
import org.eclipse.syson.application.controller.editingContext.checkers.SemanticCheckerService;
import org.eclipse.syson.application.controllers.diagrams.checkers.CheckDiagramElementCount;
import org.eclipse.syson.application.controllers.diagrams.checkers.ConnectorAsUsageCheckerBuilder;
import org.eclipse.syson.application.controllers.diagrams.checkers.ConnectorCheckerBuilder;
import org.eclipse.syson.application.controllers.diagrams.testers.EdgeCreationTester;
import org.eclipse.syson.application.controllers.diagrams.testers.EdgeReconnectionTester;
import org.eclipse.syson.application.data.GeneralViewBindingConnectorProjectData;
Expand Down Expand Up @@ -320,8 +320,8 @@ public void reconnectTargetSameLevel() {
.verify(Duration.ofSeconds(10));
}

private ConnectorAsUsageCheckerBuilder<BindingConnectorAsUsage> createCheckerBuilder() {
return new ConnectorAsUsageCheckerBuilder<>(this.identityService, BindingConnectorAsUsage.class, this.semanticCheckerService);
private ConnectorCheckerBuilder<BindingConnectorAsUsage> createCheckerBuilder() {
return new ConnectorCheckerBuilder<>(this.identityService, BindingConnectorAsUsage.class, this.semanticCheckerService);
}

private Consumer<Object> assertReconnectThat(String expectedSourceGraplicalId, String expectedTargetGraplicalId, AtomicReference<Diagram> diagram, Consumer<String> newEdgeConsumer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import org.eclipse.syson.GivenSysONServer;
import org.eclipse.syson.application.controller.editingContext.checkers.SemanticCheckerService;
import org.eclipse.syson.application.controllers.diagrams.checkers.CheckDiagramElementCount;
import org.eclipse.syson.application.controllers.diagrams.checkers.ConnectorAsUsageCheckerBuilder;
import org.eclipse.syson.application.controllers.diagrams.checkers.ConnectorCheckerBuilder;
import org.eclipse.syson.application.controllers.diagrams.testers.DirectEditTester;
import org.eclipse.syson.application.controllers.diagrams.testers.EdgeCreationTester;
import org.eclipse.syson.application.controllers.diagrams.testers.EdgeReconnectionTester;
Expand Down Expand Up @@ -575,8 +575,8 @@ private Consumer<Object> assertNewEdgeThat(String expectedSourceGraphicalId, Str
});
}

private ConnectorAsUsageCheckerBuilder<ConnectionUsage> createCheckerBuilder() {
return new ConnectorAsUsageCheckerBuilder<>(this.identityService, ConnectionUsage.class, this.semanticCheckerService);
private ConnectorCheckerBuilder<ConnectionUsage> createCheckerBuilder() {
return new ConnectorCheckerBuilder<>(this.identityService, ConnectionUsage.class, this.semanticCheckerService);
}

private Runnable buildReconnectRunnable(String edgeId, String newTarget, ReconnectEdgeKind reconnectionKind, AtomicReference<Diagram> diagram) {
Expand All @@ -587,7 +587,7 @@ private Runnable buildReconnectRunnable(String edgeId, String newTarget, Reconne
reconnectionKind);
}

private Consumer<Object> assertReconnectThat(String expectedSourceGraplicalId, String expectedTargetGraplicalId, AtomicReference<Diagram> diagram, Consumer<String> newEdgeConsumer) {
private Consumer<Object> assertReconnectThat(String expectedSourceGrapicalId, String expectedTargetGraphicalId, AtomicReference<Diagram> diagram, Consumer<String> newEdgeConsumer) {
return assertRefreshedDiagramThat(newDiagram -> {
new CheckDiagramElementCount(this.diagramComparator)
.hasNewEdgeCount(1)
Expand All @@ -596,8 +596,8 @@ private Consumer<Object> assertReconnectThat(String expectedSourceGraplicalId, S
Edge newEdge = this.diagramComparator.newEdges(diagram.get(), newDiagram).get(0);
newEdgeConsumer.accept(newEdge.getTargetObjectId());
DiagramAssertions.assertThat(newEdge)
.hasSourceId(expectedSourceGraplicalId)
.hasTargetId(expectedTargetGraplicalId)
.hasSourceId(expectedSourceGrapicalId)
.hasTargetId(expectedTargetGraphicalId)
.extracting(Edge::getStyle, EDGE_STYLE)
.hasSourceArrow(ArrowStyle.None)
.hasTargetArrow(ArrowStyle.None);
Expand Down
Loading
Loading