Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ This removes Rollup warnings about missing global names for externalized peer de
- https://github.com/eclipse-syson/syson/issues/2380[#2380] [diagrams] Add support of `SatisfyRequirementUsage` inheritance in _satisfy requirements_ compartment of `PartUsage` and `PartDefinition` graphical nodes.
- https://github.com/eclipse-syson/syson/issues/2382[#2382] [diagrams] Add support of stakeholder inheritance in _stakeholders_ compartments of `RequirementUsage` and `RequirementDefinition` graphical nodes.
- https://github.com/eclipse-syson/syson/issues/2387[#2387] [diagrams] Add support of objective requirement inheritance in _objective_ compartments of `CaseUsage` and `CaseDefinition` graphical nodes.
- https://github.com/eclipse-syson/syson/issues/2391[#2391] [diagrams] Add support of actor inheritance in _actors_ compartment of `CaseDefinition` and `CaseUsage` graphical nodes.

== v2026.7.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,68 @@ public void checkObjectiveInheritanceWithSpecialization(String subclassifier, St
.run();
}

private static Stream<Arguments> actorInheritanceParameters() {
return Stream.of(
Arguments.of("New Requirement Definition", "New Subclassification", SysmlPackage.eINSTANCE.getRequirementDefinition(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.REQUIREMENT_DEFINITION_ID),
Arguments.of("New Case Definition", "New Subclassification", SysmlPackage.eINSTANCE.getCaseDefinition(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.CASE_DEFINITION_ID),
Arguments.of("New Requirement", "New Redefinition", SysmlPackage.eINSTANCE.getRequirementUsage(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.REQUIREMENT_USAGE_ID),
Arguments.of("New Case", "New Redefinition", SysmlPackage.eINSTANCE.getCaseUsage(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.CASE_USAGE_ID),
Arguments.of("New Satisfy Requirement", "New Redefinition", SysmlPackage.eINSTANCE.getSatisfyRequirementUsage(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.SATISFY_REQUIREMENT_USAGE_ID),
Arguments.of("New Requirement", "New Subsetting", SysmlPackage.eINSTANCE.getRequirementUsage(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.REQUIREMENT_USAGE_ID),
Arguments.of("New Case", "New Subsetting", SysmlPackage.eINSTANCE.getCaseUsage(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.CASE_USAGE_ID),
Arguments.of("New Satisfy Requirement", "New Subsetting", SysmlPackage.eINSTANCE.getSatisfyRequirementUsage(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.SATISFY_REQUIREMENT_USAGE_ID),
Arguments.of("New Requirement", "New Reference Subsetting", SysmlPackage.eINSTANCE.getRequirementUsage(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.REQUIREMENT_USAGE_ID),
Arguments.of("New Case", "New Reference Subsetting", SysmlPackage.eINSTANCE.getCaseUsage(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.CASE_USAGE_ID),
Arguments.of("New Satisfy Requirement", "New Reference Subsetting", SysmlPackage.eINSTANCE.getSatisfyRequirementUsage(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.SATISFY_REQUIREMENT_USAGE_ID)
);
}

@ParameterizedTest
@MethodSource("actorInheritanceParameters")
public void checkActorInheritanceWithSpecialization(String subclassifier, String specialization, EClass eClass, String baseElementNodeId) {
new ElementSpecializationInheritanceTestRunner()
.baseElementToInheritFromEClass(eClass)
.baseElementToInheritFromNodeId(baseElementNodeId)
.elementToInheritCreationToolName("New Actor")
.withEdgeExpected()
.withSelectedElementId("")
.elementToInheritExpectedListItemLabelText("actor1")
.compartmentName("actors")
.elementThatInheritFromBaseElementCreationToolName(subclassifier)
.elementThatInheritFromBaseElementEClass(eClass)
.specializationToolName(specialization)
.withSpecializationCreationExtraEdges(1)
.run();
}
// when https://github.com/eclipse-syson/syson/issues/2393 will be fixed, ConcernXXX should be aligned with other elements.
// These arguments should be injected to actorInheritanceParameters
private static Stream<Arguments> actorInheritanceConcernParameters() {
return Stream.of(
Arguments.of("New Concern Definition", "New Subclassification", SysmlPackage.eINSTANCE.getConcernDefinition(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.CONCERN_DEFINITION_ID),
Arguments.of("New Concern", "New Redefinition", SysmlPackage.eINSTANCE.getConcernUsage(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.CONCERN_USAGE_ID),
Arguments.of("New Concern", "New Subsetting", SysmlPackage.eINSTANCE.getConcernUsage(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.CONCERN_USAGE_ID),
Arguments.of("New Concern", "New Reference Subsetting", SysmlPackage.eINSTANCE.getConcernUsage(), GeneralViewWithTopNodesTestProjectData.GraphicalIds.CONCERN_USAGE_ID)
);
}

// when https://github.com/eclipse-syson/syson/issues/2393 will be fixed, ConcernXXX should be aligned with other elements.
// This test could be removed since Concern tests will be covered by checkActorInheritanceWithSpecialization
@ParameterizedTest
@MethodSource("actorInheritanceConcernParameters")
public void checkActorInheritanceForConcernWithSpecialization(String subclassifier, String specialization, EClass eClass, String baseElementNodeId) {
new ElementSpecializationInheritanceTestRunner()
.baseElementToInheritFromEClass(eClass)
.baseElementToInheritFromNodeId(baseElementNodeId)
.elementToInheritCreationToolName("New Actor")
.withSelectedElementId("")
.elementToInheritExpectedListItemLabelText("actor1")
.compartmentName("actors")
.elementThatInheritFromBaseElementCreationToolName(subclassifier)
.elementThatInheritFromBaseElementEClass(eClass)
.specializationToolName(specialization)
.run();
}

/**
* This test runner verifies that creating a specializing relationship create inherited elements.
*
Expand Down Expand Up @@ -985,6 +1047,13 @@ private final class ElementSpecializationInheritanceTestRunner {
*/
private int withInnerBaseElementCreationExtraEdges;

/**
* Additional edges could be created when the specialization tool ({@code specializationToolName} is performed.
* <p>
* For instance, when subclassification is created on a RequirementDefinition containing an actor an extra
* </p>
*/
private int withSpecializationCreationExtraEdges;
/**
* The selected element required for the creation tool applied on the base element.
*/
Expand Down Expand Up @@ -1045,6 +1114,11 @@ public ElementSpecializationInheritanceTestRunner withInnerBaseElementCreationEx
return this;
}

public ElementSpecializationInheritanceTestRunner withSpecializationCreationExtraEdges(int extraEdgesExpected) {
this.withSpecializationCreationExtraEdges = extraEdgesExpected;
return this;
}

public ElementSpecializationInheritanceTestRunner withSelectedElementId(String selectedElementId) {
this.selectedElementId = Optional.of(selectedElementId);
return this;
Expand Down Expand Up @@ -1171,10 +1245,14 @@ public void run() {

// Check new created element inherits from the base element, and thus, contains a list item with '^' in its label
Consumer<Object> createFeatureTypeDiagramConsumer = assertRefreshedDiagramThat(newDiagram -> {
var expectedNewEdgesCount = 1; // The specialization edge
if (this.withSpecializationCreationExtraEdges > 0) {
expectedNewEdgesCount += this.withSpecializationCreationExtraEdges;
}
new CheckDiagramElementCount(GVCompartmentItemInheritanceTests.this.diagramComparator)
.hasNewBorderNodeCount(0)
.hasNewNodeCount(1) // The list item inherited from the base element
.hasNewEdgeCount(1) // The specialization edge
.hasNewEdgeCount(expectedNewEdgesCount)
.check(diagram.get(), newDiagram);

var parameterCompartment = new DiagramNavigator(newDiagram)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ public Boolean casePartUsage(PartUsage object) {
} else if (this.isStakeholderReference()) {
// We are dealing with a stakeholder
// so the part usage is a stakeholder if and only if, it is contained by a StakeholderMembership
result = object.getOwningMembership() instanceof StakeholderMembership;
result = object.getOwningMembership() instanceof StakeholderMembership;
} else if (this.isActorReference()) {
// We are dealing with an Actor
// so the part usage is an actor if and only if, it is contained by a ActorMembership
result = object.getOwningMembership() instanceof ActorMembership;
result = object.getOwningMembership() instanceof ActorMembership;
} else {
EClassifier eType = this.eReference.getEType();
EClass eClass = object.eClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.eclipse.syson.sysml.InterfaceDefinition;
import org.eclipse.syson.sysml.Namespace;
import org.eclipse.syson.sysml.PortUsage;
import org.eclipse.syson.sysml.PartUsage;
import org.eclipse.syson.sysml.RequirementConstraintMembership;
import org.eclipse.syson.sysml.TransitionUsage;
import org.eclipse.syson.sysml.metamodel.services.MetamodelQueryElementService;
Expand Down Expand Up @@ -160,4 +161,11 @@ public List<ConcernUsage> getFramedConcerns(Namespace namespace) {
public List<PortUsage> getInterfaceEnds(InterfaceDefinition interfaceDefinition) {
return this.metamodelQueryElementService.getInterfaceEnds(interfaceDefinition);
}

/**
* {@link MetamodelQueryElementService#getActors(Namespace)}.
*/
public List<PartUsage> getActors(Namespace namespace) {
return this.metamodelQueryElementService.getActors(namespace);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import org.eclipse.syson.sysml.ActorMembership;
import org.eclipse.syson.sysml.AllocationUsage;
import org.eclipse.syson.sysml.BooleanExpression;
import org.eclipse.syson.sysml.CaseDefinition;
import org.eclipse.syson.sysml.CaseUsage;
import org.eclipse.syson.sysml.ConcernUsage;
import org.eclipse.syson.sysml.Connector;
import org.eclipse.syson.sysml.ConstraintUsage;
Expand Down Expand Up @@ -541,4 +543,37 @@ public List<PortUsage> getInterfaceEnds(InterfaceDefinition interfaceDefinition)
.forEach(interfaceEnds::add);
return interfaceEnds;
}

/**
* Retrieves actors of the given element.
* <p>
* The {@link CaseDefinition#getActorParameter()}, {@link CaseUsage#getActorParameter()},
* {@link RequirementDefinition#getActorParameter()} and {@link RequirementUsage#getActorParameter()}
* * are not suitable because they collect inherited actors as well as owned ones.
* * We are only looking for directly owned actors of the given element.
* </p>
*
* @param namespace
* an element that could own an actor.
* It could be {@link CaseDefinition}, {@link CaseUsage}, {@link RequirementDefinition} or {@link RequirementUsage}.
* @return the list of actor owned by the given element.
*/
public List<PartUsage> getActors(Namespace namespace) {
List<PartUsage> actors = new ArrayList<>();
if (this.canContainActor(namespace)) {
namespace.getOwnedRelationship().stream()
.filter(ActorMembership.class::isInstance)
.map(ActorMembership.class::cast)
.map(ActorMembership::getOwnedActorParameter)
.forEach(actors::add);
}
return actors;
}

private boolean canContainActor(Namespace namespace) {
return namespace instanceof CaseDefinition ||
namespace instanceof CaseUsage ||
namespace instanceof RequirementDefinition ||
namespace instanceof RequirementUsage;
}
}
Loading
Loading