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
7 changes: 5 additions & 2 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [services] All services that were previously available in `org.eclipse.syson.sysml.textual` package of `syson-sysml-metamodel` module have been moved to `org.eclipse.syson.sysml.metamodel.services.textual` package of `syson-sysml-metamodel-services` module.
- [services] All services that were previously available in `org.eclipse.syson.sysml.textual.utils` package of `syson-sysml-metamodel` module have been moved to `org.eclipse.syson.sysml.metamodel.services.textual.utils` package of `syson-sysml-metamodel-services` module.
- [services] All services that were previously available in `org.eclipse.syson.sysml.util` package of `syson-sysml-metamodel` module have been moved to `org.eclipse.syson.sysml.metamodel.util` package of `syson-sysml-metamodel-services` module.
- [services] All methods from `org.eclipse.syson.util.AQLUtils` except `aqlString` and `aqlSequence` have been removed.
- [frontend] The `variables.css` file, which used to define custom colors an typography settings has been removed.
It has long been unused by Sirius Web itself (since the transition to MUI).

Expand Down Expand Up @@ -39,8 +40,10 @@ It has long been unused by Sirius Web itself (since the transition to MUI).
Before, the selection dialog option with selection allowed choosing between all _timeslice/snapshot_ types.
Now, the choice is restricted to the _timeslice/snapshot_ type that match the graphical node type on which the tool is applied.
- https://github.com/eclipse-syson/syson/issues/2119[#2119] [details] Display expressions values in the _Details_ view and allow to edit them from there.
- https://github.com/eclipse-syson/syson/issues/2251[#2251] [explorer] Allow expression-related operations on their parent element
- https://github.com/eclipse-syson/syson/issues/2270[#2270] [diagram] Add dedicated tools to diagram elements palette to create/edit/delete expressions
- https://github.com/eclipse-syson/syson/issues/2251[#2251] [explorer] Allow expression-related operations on their parent element.
- https://github.com/eclipse-syson/syson/issues/2270[#2270] [diagram] Add dedicated tools to diagram elements palette to create/edit/delete expressions.
- https://github.com/eclipse-syson/syson/issues/2269[#2269] [diagram] When using direct edit on feature elements which have a value expression (e.g. an `Attribute` with a default value defined), the expression part (after the `=` sign) is no longer part of the initial direct edit value, and will be ignored if supplied in the new text value.
Users should use the dedicated tools to edit expressions instead, as they ensure only valid expressions (with all names resolving) are accepted.

=== New features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.function.Supplier;

import org.eclipse.sirius.components.collaborative.diagrams.dto.DiagramEventInput;
import org.eclipse.sirius.components.collaborative.diagrams.dto.DiagramRefreshedEventPayload;
Expand All @@ -35,13 +36,16 @@
import org.eclipse.sirius.web.tests.services.api.IGivenInitialServerState;
import org.eclipse.syson.AbstractIntegrationTests;
import org.eclipse.syson.GivenSysONServer;
import org.eclipse.syson.application.controllers.expressions.graphql.CreateExpressionMutationRunner;
import org.eclipse.syson.application.data.GeneralViewDirectEditTestProjectData;
import org.eclipse.syson.application.data.GeneralViewItemAndAttributeProjectData;
import org.eclipse.syson.application.data.GeneralViewPartUsageRedefinitionProjectData;
import org.eclipse.syson.services.SemanticRunnableFactory;
import org.eclipse.syson.services.diagrams.api.IGivenDiagramSubscription;
import org.eclipse.syson.sysml.PartUsage;
import org.eclipse.syson.sysml.PortionKind;
import org.eclipse.syson.sysml.dto.CreateExpressionInput;
import org.eclipse.syson.sysml.dto.CreateExpressionSuccessPayload;
import org.eclipse.syson.sysml.metamodel.helper.LabelConstants;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
Expand Down Expand Up @@ -72,6 +76,9 @@ public class GVDirectEditTests extends AbstractIntegrationTests {
@Autowired
private EditLabelMutationRunner editLabelMutationRunner;

@Autowired
private CreateExpressionMutationRunner createExpressionMutationRunner;

@Autowired
private IObjectSearchService objectSearchService;

Expand Down Expand Up @@ -395,7 +402,7 @@ public void directEditUsingShortNameAndScope() {
.verify(Duration.ofSeconds(10));
}

@DisplayName("GIVEN a diagram with an attribute, WHEN we direct edit with an operation using an unimported namespace, THEN the attribute is correctly set")
@DisplayName("GIVEN a diagram with an attribute, WHEN we set its value to an expression using an unimported namespace, THEN the attribute is correctly set")
@GivenSysONServer({ GeneralViewItemAndAttributeProjectData.SCRIPT_PATH })
@Test
public void directEditOperationUsingUnImportedNameSpaceName() {
Expand All @@ -407,33 +414,27 @@ public void directEditOperationUsingUnImportedNameSpaceName() {

var diagramId = new AtomicReference<String>();
var partNodeId = new AtomicReference<String>();
var partNodeTargetId = new AtomicReference<String>();
var partNodeLabelId = new AtomicReference<String>();

Consumer<Object> initialDiagramContentConsumer = assertRefreshedDiagramThat(diagram -> {
diagramId.set(diagram.getId());
var partNode = new DiagramNavigator(diagram).nodeWithLabel("x1").getNode();
partNodeId.set(partNode.getId());
partNodeLabelId.set(partNode.getInsideLabel().getId());
partNodeTargetId.set(partNode.getTargetObjectId());
});

Runnable editLabel = () -> {
var input = new EditLabelInput(UUID.randomUUID(), GeneralViewItemAndAttributeProjectData.EDITING_CONTEXT_ID, diagramId.get(), partNodeLabelId.get(), "t1 = 1[g]");
var result = this.editLabelMutationRunner.run(input);

String typename = JsonPath.read(result.data(), "$.data.editLabel.__typename");
assertThat(typename).isEqualTo(EditLabelSuccessPayload.class.getSimpleName());
List<String> messages = JsonPath.read(result.data(), "$.data.editLabel.messages[*].body");
assertThat(messages).hasSize(0);
};
Runnable createExpression = this.createExpression(GeneralViewItemAndAttributeProjectData.EDITING_CONTEXT_ID, partNodeTargetId::get, "1 [g]");

Consumer<Object> updatedDiagramContentMatcher = assertRefreshedDiagramThat(diagram -> {
var node = new DiagramNavigator(diagram).nodeWithId(partNodeId.get()).getNode();
DiagramAssertions.assertThat(node.getInsideLabel()).hasText("t1 = 1 [g]");
DiagramAssertions.assertThat(node.getInsideLabel()).hasText("x1 = 1 [g]");
});

StepVerifier.create(flux)
.consumeNextWith(initialDiagramContentConsumer)
.then(editLabel)
.then(createExpression)
.consumeNextWith(updatedDiagramContentMatcher)
.thenCancel()
.verify(Duration.ofSeconds(10));
Expand Down Expand Up @@ -622,10 +623,10 @@ public void directEditMultiplicityWithFeatureTyping() {
.verify(Duration.ofSeconds(10));
}

@DisplayName("GIVEN a diagram with a part, WHEN we direct edit with multiplicity and operation, THEN the part is correctly set only if the multiplicity is before the operation")
@DisplayName("GIVEN a diagram with a part, WHEN we direct edit with multiplicity, THEN the multiplicity is correctly set")
@GivenSysONServer({ GeneralViewItemAndAttributeProjectData.SCRIPT_PATH })
@Test
public void directEditMultiplicityWithOperation() {
public void directEditMultiplicity() {
var diagramEventInput = new DiagramEventInput(UUID.randomUUID(),
GeneralViewItemAndAttributeProjectData.EDITING_CONTEXT_ID,
GeneralViewItemAndAttributeProjectData.GraphicalIds.DIAGRAM_ID);
Expand All @@ -644,7 +645,7 @@ public void directEditMultiplicityWithOperation() {
});

Runnable editLabelWithMultiplicityBefore = () -> {
var input = new EditLabelInput(UUID.randomUUID(), GeneralViewItemAndAttributeProjectData.EDITING_CONTEXT_ID, diagramId.get(), partNodeLabelId.get(), "t1 [4] = 1[g]");
var input = new EditLabelInput(UUID.randomUUID(), GeneralViewItemAndAttributeProjectData.EDITING_CONTEXT_ID, diagramId.get(), partNodeLabelId.get(), "t1 [4]");
var result = this.editLabelMutationRunner.run(input);

String typename = JsonPath.read(result.data(), "$.data.editLabel.__typename");
Expand All @@ -653,20 +654,7 @@ public void directEditMultiplicityWithOperation() {
assertThat(messages).hasSize(0);
};

Runnable editLabelWithMultiplicityAfter = () -> {
var input = new EditLabelInput(UUID.randomUUID(), GeneralViewItemAndAttributeProjectData.EDITING_CONTEXT_ID, diagramId.get(), partNodeLabelId.get(), "t1 = 1[g] [4]");
var result = this.editLabelMutationRunner.run(input);

String typename = JsonPath.read(result.data(), "$.data.editLabel.__typename");
assertThat(typename).isEqualTo(EditLabelSuccessPayload.class.getSimpleName());
};

Consumer<Object> updatedDiagramContentMatcherBefore = assertRefreshedDiagramThat(diagram -> {
var node = new DiagramNavigator(diagram).nodeWithId(partNodeId.get()).getNode();
DiagramAssertions.assertThat(node.getInsideLabel()).hasText("t1 [4] = 1 [g]");
});

Consumer<Object> updatedDiagramContentMatcherAfter = assertRefreshedDiagramThat(diagram -> {
var node = new DiagramNavigator(diagram).nodeWithId(partNodeId.get()).getNode();
DiagramAssertions.assertThat(node.getInsideLabel()).hasText("t1 [4]");
});
Expand All @@ -675,8 +663,6 @@ public void directEditMultiplicityWithOperation() {
.consumeNextWith(initialDiagramContentConsumer)
.then(editLabelWithMultiplicityBefore)
.consumeNextWith(updatedDiagramContentMatcherBefore)
.then(editLabelWithMultiplicityAfter)
.consumeNextWith(updatedDiagramContentMatcherAfter)
.thenCancel()
.verify(Duration.ofSeconds(10));
}
Expand Down Expand Up @@ -746,4 +732,13 @@ public void directEditRedefinitionWithSameName() {
.thenCancel()
.verify(Duration.ofSeconds(10));
}

private Runnable createExpression(String editingContextId, Supplier<String> parentElementId, String expressionContent) {
return () -> {
var input = new CreateExpressionInput(UUID.randomUUID(), editingContextId, parentElementId.get(), expressionContent);
var result = this.createExpressionMutationRunner.run(input);
String typename = JsonPath.read(result.data(), "$.data.createExpression.__typename");
assertThat(typename).isEqualTo(CreateExpressionSuccessPayload.class.getSimpleName());
};
}
}
Loading
Loading