From a6ee1bae264e39720a5af7f18a00faacc9e63c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20ROU=C3=8BN=C3=89?= Date: Mon, 1 Jul 2024 10:55:21 +0200 Subject: [PATCH] [3669] Add migration participant to hide label borders by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: https://github.com/eclipse-sirius/sirius-web/issues/3669 Signed-off-by: Florian ROUËNÉ --- CHANGELOG.adoc | 2 +- ...elStyleBorderSizeMigrationParticipant.java | 55 ++++ .../sirius/web/data/MigrationIdentifiers.java | 4 + ...leBorderSizeMigrationParticipantTests.java | 281 ++++++++++++++++++ ...riptionColorMigrationParticipantTests.java | 136 ++++----- .../src/test/resources/scripts/migration.sql | 184 +++++++++++- 6 files changed, 592 insertions(+), 70 deletions(-) create mode 100644 packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/editingcontext/migration/participants/DiagramLabelStyleBorderSizeMigrationParticipant.java create mode 100644 packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/migration/DiagramLabelStyleBorderSizeMigrationParticipantTests.java diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index c9e9f36d16c..628b9f5698d 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -120,7 +120,7 @@ image:doc/screenshots/insideLabelPositions.png[Inside label positions, 70%] - https://github.com/eclipse-sirius/sirius-web/issues/3645[#3645] [core] Revert earlier change made in #3595 which caused regressions - https://github.com/eclipse-sirius/sirius-web/issues/3651[#3651] [diagram] Improve performances when interacting with the diagram, especially when dragging a node - https://github.com/eclipse-sirius/sirius-web/issues/3641[#3641] [core] Do not fetch representation content when we only need the metadata - +- https://github.com/eclipse-sirius/sirius-web/issues/3669[#3669] [diagram] Add migration participant to hide label borders by default == v2024.5.0 diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/editingcontext/migration/participants/DiagramLabelStyleBorderSizeMigrationParticipant.java b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/editingcontext/migration/participants/DiagramLabelStyleBorderSizeMigrationParticipant.java new file mode 100644 index 00000000000..056ca583c04 --- /dev/null +++ b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/editingcontext/migration/participants/DiagramLabelStyleBorderSizeMigrationParticipant.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2024 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.web.application.editingcontext.migration.participants; + +import com.google.gson.JsonObject; + +import java.util.Optional; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.components.emf.migration.api.IMigrationParticipant; +import org.eclipse.sirius.components.view.diagram.EdgeDescription; +import org.eclipse.sirius.components.view.diagram.NodeDescription; +import org.springframework.stereotype.Service; + +/** + * MigrationParticipant that update the BorderStyle of NodeLabelStyle. + * + * @author mcharfadi + */ +@Service +public class DiagramLabelStyleBorderSizeMigrationParticipant implements IMigrationParticipant { + + private static final String PARTICIPANT_VERSION = "2024.7.0-202407011045"; + + @Override + public String getVersion() { + return PARTICIPANT_VERSION; + } + + @Override + public void postObjectLoading(EObject eObject, JsonObject jsonObject) { + if (eObject instanceof NodeDescription nodeDescription) { + var optionalNodeDescriptionData = Optional.ofNullable(jsonObject.getAsJsonObject("data")); + optionalNodeDescriptionData.ifPresent(nodeDescriptionData -> { + var optionalInsideLabel = Optional.ofNullable(nodeDescriptionData.get("insideLabel")); + optionalInsideLabel.ifPresent(insideLabel -> nodeDescription.getInsideLabel().getStyle().setBorderSize(0)); + var optionalOutsideLabels = Optional.ofNullable(nodeDescriptionData.get("outsideLabels")); + optionalOutsideLabels.ifPresent(outsideLabels -> nodeDescription.getOutsideLabels().forEach(outsideLabelDescription -> outsideLabelDescription.getStyle().setBorderSize(0))); + }); + } else if (eObject instanceof EdgeDescription edgeDescription) { + var optionalEdgeDescriptionData = Optional.ofNullable(jsonObject.getAsJsonObject("data")); + optionalEdgeDescriptionData.ifPresent(edgeDescriptionData -> edgeDescription.getStyle().setBorderSize(0)); + } + } +} diff --git a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/data/MigrationIdentifiers.java b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/data/MigrationIdentifiers.java index 2a143bd4a39..4453971ddba 100644 --- a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/data/MigrationIdentifiers.java +++ b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/data/MigrationIdentifiers.java @@ -31,6 +31,10 @@ public final class MigrationIdentifiers { public static final UUID MIGRATION_STUDIO_DIAGRAM_HIERARCHY = UUID.fromString("35f1cd7b-e5bb-443d-95ef-bab372a92b0f"); + public static final UUID MIGRATION_DIAGRAM_LABEL_STYLE_BORDER_SIZE_STUDIO = UUID.fromString("8ce6147e-1f5b-426f-b1be-dfeabd37a50a"); + + public static final String MIGRATION_DIAGRAM_LABEL_STYLE_BORDER_SIZE_STUDIO_DIAGRAM = "DiagramLabelStyle#borderSize migration"; + private MigrationIdentifiers() { // Prevent instantiation } diff --git a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/migration/DiagramLabelStyleBorderSizeMigrationParticipantTests.java b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/migration/DiagramLabelStyleBorderSizeMigrationParticipantTests.java new file mode 100644 index 00000000000..f501bd23f2e --- /dev/null +++ b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/migration/DiagramLabelStyleBorderSizeMigrationParticipantTests.java @@ -0,0 +1,281 @@ +/******************************************************************************* + * Copyright (c) 2024 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.web.services.migration; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.jayway.jsonpath.JsonPath; + +import java.io.ByteArrayInputStream; +import java.nio.charset.StandardCharsets; +import java.util.Comparator; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +import java.util.function.BiFunction; +import java.util.function.Predicate; + +import org.eclipse.sirius.components.core.api.IEditingContext; +import org.eclipse.sirius.components.core.api.IEditingContextSearchService; +import org.eclipse.sirius.components.core.api.IInput; +import org.eclipse.sirius.components.core.api.IPayload; +import org.eclipse.sirius.components.emf.ResourceMetadataAdapter; +import org.eclipse.sirius.components.emf.migration.api.IMigrationParticipant; +import org.eclipse.sirius.components.emf.migration.api.MigrationData; +import org.eclipse.sirius.components.graphql.api.UploadFile; +import org.eclipse.sirius.components.graphql.tests.ExecuteEditingContextFunctionInput; +import org.eclipse.sirius.components.graphql.tests.ExecuteEditingContextFunctionRunner; +import org.eclipse.sirius.components.graphql.tests.ExecuteEditingContextFunctionSuccessPayload; +import org.eclipse.sirius.components.view.diagram.DiagramDescription; +import org.eclipse.sirius.web.AbstractIntegrationTests; +import org.eclipse.sirius.web.application.document.dto.UploadDocumentInput; +import org.eclipse.sirius.web.application.document.dto.UploadDocumentSuccessPayload; +import org.eclipse.sirius.web.application.editingcontext.EditingContext; +import org.eclipse.sirius.web.data.MigrationIdentifiers; +import org.eclipse.sirius.web.tests.graphql.UploadDocumentMutationRunner; +import org.eclipse.sirius.web.tests.services.api.IGivenCommittedTransaction; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.jdbc.Sql; +import org.springframework.test.context.jdbc.SqlConfig; +import org.springframework.test.context.transaction.TestTransaction; +import org.springframework.transaction.annotation.Transactional; + +import reactor.test.StepVerifier; + +/** + * Integration tests of DiagramLabelStyleBorderSizeMigrationParticipant. + * + * @author frouene + */ +@Transactional +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class DiagramLabelStyleBorderSizeMigrationParticipantTests extends AbstractIntegrationTests { + + @Autowired + private IEditingContextSearchService editingContextSearchService; + + @Autowired + private IGivenCommittedTransaction givenCommittedTransaction; + + @Autowired + private ExecuteEditingContextFunctionRunner executeEditingContextFunctionRunner; + + @Autowired + private UploadDocumentMutationRunner uploadDocumentMutationRunner; + + @Autowired + private List migrationParticipants; + + @Test + @DisplayName("Given a project with an old model, DiagramLabelStyleBorderSizeMigrationParticipant migrates the model correctly") + @Sql(scripts = { "/scripts/migration.sql" }, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) + @Sql(scripts = { "/scripts/cleanup.sql" }, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED)) + public void givenAnOldModelMigrationParticipantCanBeContributedToUpdateTheModel() { + var optionalEditingContext = this.editingContextSearchService.findById(MigrationIdentifiers.MIGRATION_DIAGRAM_LABEL_STYLE_BORDER_SIZE_STUDIO.toString()); + assertThat(optionalEditingContext).isPresent(); + this.testIsMigrationSuccessful(optionalEditingContext.get()); + } + + @Test + @DisplayName("Given an uploaded project with an old model, DiagramLabelStyleBorderSizeMigrationParticipant migrates the model correctly") + @Sql(scripts = { "/scripts/migration.sql" }, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) + @Sql(scripts = { "/scripts/cleanup.sql" }, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED)) + public void givenAnOldViewDiagramMigrationServiceIsExecutedProperly() { + var content = """ + { + "json": { "version": "1.0", "encoding": "utf-8" }, + "ns": { + "diagram": "http://www.eclipse.org/sirius-web/diagram", + "view": "http://www.eclipse.org/sirius-web/view" + }, + "content": [ + { + "id": "9674f8f7-ff1a-4061-bb32-a4a235a9c2ca", + "eClass": "view:View", + "data": { + "descriptions": [ + { + "id": "c1a0ae1c-8420-4aa7-b443-1a05044076e2", + "eClass": "diagram:DiagramDescription", + "data": { + "name": "DiagramLabelStyle#borderSize migration", + "domainType": "flow::System", + "edgeDescriptions": [ + { + "data": { + "centerLabelExpression": "", + "name": "LabelBorderSize Edge", + "semanticCandidatesExpression": "", + "sourceNodeDescriptions": [ + "//@descriptions.0/@nodeDescriptions.0" + ], + "sourceNodesExpression": "aql:self", + "style": { + "data": { + "color": "//@colorPalettes.0/@colors.0" + }, + "eClass": "diagram:EdgeStyle", + "id": "748824cb-cd5f-42fe-95a8-4f21172ba2ce" + }, + "targetNodeDescriptions": [ + "//@descriptions.0/@nodeDescriptions.1" + ], + "targetNodesExpression": "aql:self.linkedTo" + }, + "eClass": "diagram:EdgeDescription", + "id": "c1077629-a4ec-4232-8eb5-5209b58c7464" + } + ], + "nodeDescriptions": [ + { + "id": "4d1ec4d1-dd2c-4cb2-bbed-df02f0babbd8", + "eClass": "diagram:NodeDescription", + "data": { + "name": "LabelBorderSize migration", + "domainType": "flow::CompositeProcessor", + "insideLabel": { + "data": { + "style": { + "eClass": "diagram:InsideLabelStyle", + "id": "d70178c4-d36f-40d7-a3ab-ef8568e4ee2b" + } + }, + "eClass": "diagram:InsideLabelDescription", + "id": "046b48ee-4554-4d8a-a457-5391b690d2a9" + }, + "outsideLabels": [ + { + "data": { + "style": { + "eClass": "diagram:OutsideLabelStyle", + "id": "c69b0853-26ab-40b0-979d-f0a4974ad865" + } + }, + "eClass": "diagram:OutsideLabelDescription", + "id": "fd8638cc-8ebb-48e6-bf3f-2c09206f6a09" + }, + { + "data": { + "style": { + "eClass": "diagram:OutsideLabelStyle", + "id": "601e5a1d-3d8a-49bc-96b9-f0c47ee594ee" + } + }, + "eClass": "diagram:OutsideLabelDescription", + "id": "a8a2bf4c-82b7-4050-b4e7-09fd26a2f7c0" + } + ], + "childrenLayoutStrategy": { + "id": "558f8558-bee6-4ae9-8dc7-4344efe2b83e", + "eClass": "diagram:FreeFormLayoutStrategyDescription" + }, + "style": { + "data": { + "background": "//@colorPalettes.0/@colors.0", + "borderColor": "//@colorPalettes.0/@colors.0" + }, + "eClass": "diagram:RectangularNodeStyleDescription", + "id": "dacddb12-7c2c-4463-bf71-a7c3e68e2132" + } + } + } + ] + } + } + ] + } + } + ] + } + """; + this.uploadDocument(MigrationIdentifiers.MIGRATION_DIAGRAM_LABEL_STYLE_BORDER_SIZE_STUDIO.toString(), "test_upload", content); + } + + private void uploadDocument(String editingContextId, String name, String content) { + this.givenCommittedTransaction.commit(); + + var file = new UploadFile(name, new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))); + var input = new UploadDocumentInput(UUID.randomUUID(), editingContextId, file); + var result = this.uploadDocumentMutationRunner.run(input); + + TestTransaction.flagForCommit(); + TestTransaction.end(); + + String typename = JsonPath.read(result, "$.data.uploadDocument.__typename"); + assertThat(typename).isEqualTo(UploadDocumentSuccessPayload.class.getSimpleName()); + + Predicate predicate = payload -> Optional.of(payload) + .filter(ExecuteEditingContextFunctionSuccessPayload.class::isInstance) + .map(ExecuteEditingContextFunctionSuccessPayload.class::cast) + .map(ExecuteEditingContextFunctionSuccessPayload::result) + .filter(Boolean.class::isInstance) + .map(Boolean.class::cast) + .orElse(false); + + var optionalLastMigrationData = this.migrationParticipants.stream() + .sorted(Comparator.comparing(IMigrationParticipant::getVersion).reversed()) + .map(migrationParticipant -> new MigrationData(migrationParticipant.getClass().getSimpleName(), migrationParticipant.getVersion())) + .findFirst(); + assertThat(optionalLastMigrationData).isPresent(); + var lastMigrationData = optionalLastMigrationData.get(); + + BiFunction function = (editingContext, executeEditingContextFunctionInput) -> { + var isMigrated = Optional.of(editingContext) + .filter(EditingContext.class::isInstance) + .map(EditingContext.class::cast) + .map(siriusWebEditingContext -> siriusWebEditingContext.getViews().stream() + .anyMatch(view -> view.eResource().eAdapters().stream() + .filter(ResourceMetadataAdapter.class::isInstance) + .map(ResourceMetadataAdapter.class::cast) + .filter(resourceMetadataAdapter -> resourceMetadataAdapter.getMigrationData() != null) + .anyMatch(resourceMetadataAdapter -> resourceMetadataAdapter.getMigrationData().migrationVersion().equals(lastMigrationData.migrationVersion()) + && resourceMetadataAdapter.getMigrationData().lastMigrationPerformed().equals(lastMigrationData.lastMigrationPerformed())) + )) + .orElse(false); + return new ExecuteEditingContextFunctionSuccessPayload(executeEditingContextFunctionInput.id(), isMigrated); + }; + + var mono = this.executeEditingContextFunctionRunner.execute(new ExecuteEditingContextFunctionInput(UUID.randomUUID(), editingContextId, function)); + StepVerifier.create(mono) + .expectNextMatches(predicate) + .thenCancel() + .verify(); + } + + private void testIsMigrationSuccessful(IEditingContext editingContext) { + if (editingContext instanceof EditingContext siriusWebEditingContext) { + var optionalDiagramDescription = siriusWebEditingContext.getViews().stream().flatMap(view -> view.getDescriptions().stream()) + .filter(representationDescription -> representationDescription.getName().equals(MigrationIdentifiers.MIGRATION_DIAGRAM_LABEL_STYLE_BORDER_SIZE_STUDIO_DIAGRAM)).findFirst(); + assertThat(optionalDiagramDescription).isPresent(); + assertThat(optionalDiagramDescription.get()).isInstanceOf(DiagramDescription.class); + optionalDiagramDescription.ifPresent(representationDescription -> { + if (representationDescription instanceof DiagramDescription diagramDescription) { + assertThat(diagramDescription.getNodeDescriptions()).hasSize(1); + diagramDescription.getNodeDescriptions().forEach(nodeDescription -> { + assertThat(nodeDescription.getInsideLabel().getStyle().getBorderSize()).isEqualTo(0); + assertThat(nodeDescription.getOutsideLabels()).hasSize(2); + assertThat(nodeDescription.getOutsideLabels()).allMatch(outsideLabelDescription -> outsideLabelDescription.getStyle().getBorderSize() == 0); + }); + assertThat(diagramDescription.getEdgeDescriptions()).hasSize(1); + diagramDescription.getEdgeDescriptions().forEach(edgeDescription -> { + assertThat(edgeDescription.getStyle().getBorderSize()).isEqualTo(0); + }); + } + }); + } + } + +} diff --git a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/migration/NodeStyleDescriptionColorMigrationParticipantTests.java b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/migration/NodeStyleDescriptionColorMigrationParticipantTests.java index caf6222401a..6dbfa2b8db6 100644 --- a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/migration/NodeStyleDescriptionColorMigrationParticipantTests.java +++ b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/migration/NodeStyleDescriptionColorMigrationParticipantTests.java @@ -65,6 +65,73 @@ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class NodeStyleDescriptionColorMigrationParticipantTests extends AbstractIntegrationTests { + public static final String DOCUMENT_CONTENT = """ + { + "json": { "version": "1.0", "encoding": "utf-8" }, + "ns": { + "diagram": "http://www.eclipse.org/sirius-web/diagram", + "view": "http://www.eclipse.org/sirius-web/view" + }, + "content": [ + { + "id": "9674f8f7-ff1a-4061-bb32-a4a235a9c2ca", + "eClass": "view:View", + "data": { + "colorPalettes": [ + { + "data": { + "colors": [ + { + "data": { + "name": "color_empty", + "value": "" + }, + "eClass": "view:FixedColor", + "id": "63184ddc-74c4-4888-bb65-418361689e2b" + } + ] + }, + "eClass": "view:ColorPalette", + "id": "d315989f-826f-490d-b898-d94200b0caa2" + } + ], + "descriptions": [ + { + "id": "22fb1f4d-109d-4e73-bff0-f7cd96fb5fbb", + "eClass": "diagram:DiagramDescription", + "data": { + "name": "NodeStyleDescription#color migration_upload", + "domainType": "flow::System", + "nodeDescriptions": [ + { + "id": "6949ddfe-f480-473b-bc8a-6f2bdde07e4d", + "eClass": "diagram:NodeDescription", + "data": { + "name": "NodeWithoutImage migration", + "domainType": "flow::CompositeProcessor", + "childrenLayoutStrategy": { + "id": "20651d93-2ee5-41cb-b2bd-1e75958c73cf", + "eClass": "diagram:FreeFormLayoutStrategyDescription" + }, + "style": { + "id": "92fe9d3f-2c5b-41ab-81ea-8482c8cd57b9", + "eClass": "diagram:RectangularNodeStyleDescription", + "data": { + "borderColor": "//@colorPalettes.0/@colors.0", + "color": "//@colorPalettes.0/@colors.0" + } + } + } + } + ] + } + } + ] + } + } + ] + } + """; @Autowired private IEditingContextSearchService editingContextSearchService; @@ -95,74 +162,7 @@ public void givenAnOldModelMigrationParticipantCanBeContributedToUpdateTheModel( @Sql(scripts = { "/scripts/migration.sql" }, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = { "/scripts/cleanup.sql" }, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED)) public void givenAnOldViewDiagramMigrationServiceIsExecutedProperly() { - var content = """ - { - "json": { "version": "1.0", "encoding": "utf-8" }, - "ns": { - "diagram": "http://www.eclipse.org/sirius-web/diagram", - "view": "http://www.eclipse.org/sirius-web/view" - }, - "content": [ - { - "id": "9674f8f7-ff1a-4061-bb32-a4a235a9c2ca", - "eClass": "view:View", - "data": { - "colorPalettes": [ - { - "data": { - "colors": [ - { - "data": { - "name": "color_empty", - "value": "" - }, - "eClass": "view:FixedColor", - "id": "63184ddc-74c4-4888-bb65-418361689e2b" - } - ] - }, - "eClass": "view:ColorPalette", - "id": "d315989f-826f-490d-b898-d94200b0caa2" - } - ], - "descriptions": [ - { - "id": "22fb1f4d-109d-4e73-bff0-f7cd96fb5fbb", - "eClass": "diagram:DiagramDescription", - "data": { - "name": "NodeStyleDescription#color migration_upload", - "domainType": "flow::System", - "nodeDescriptions": [ - { - "id": "6949ddfe-f480-473b-bc8a-6f2bdde07e4d", - "eClass": "diagram:NodeDescription", - "data": { - "name": "NodeWithoutImage migration", - "domainType": "flow::CompositeProcessor", - "childrenLayoutStrategy": { - "id": "20651d93-2ee5-41cb-b2bd-1e75958c73cf", - "eClass": "diagram:FreeFormLayoutStrategyDescription" - }, - "style": { - "id": "92fe9d3f-2c5b-41ab-81ea-8482c8cd57b9", - "eClass": "diagram:RectangularNodeStyleDescription", - "data": { - "borderColor": "//@colorPalettes.0/@colors.0", - "color": "//@colorPalettes.0/@colors.0" - } - } - } - } - ] - } - } - ] - } - } - ] - } - """; - this.uploadDocument(MigrationIdentifiers.MIGRATION_NODE_STYLE_DESCRIPTION_COLOR_STUDIO.toString(), content); + this.uploadDocument(MigrationIdentifiers.MIGRATION_NODE_STYLE_DESCRIPTION_COLOR_STUDIO.toString(), DOCUMENT_CONTENT); } private void uploadDocument(String editingContextId, String content) { diff --git a/packages/sirius-web/backend/sirius-web/src/test/resources/scripts/migration.sql b/packages/sirius-web/backend/sirius-web/src/test/resources/scripts/migration.sql index b9c9280e286..7c755f8916c 100644 --- a/packages/sirius-web/backend/sirius-web/src/test/resources/scripts/migration.sql +++ b/packages/sirius-web/backend/sirius-web/src/test/resources/scripts/migration.sql @@ -313,4 +313,186 @@ INSERT INTO representation_data ( '2024-01-02 9:42:0.000', 'none', '0' -); \ No newline at end of file +); + + +INSERT INTO project ( + id, + name, + created_on, + last_modified_on +) VALUES ( + '8ce6147e-1f5b-426f-b1be-dfeabd37a50a', + 'Migration DiagramLabelStyle#borderSize Studio', + '2024-07-01 15:00:0.000', + '2024-07-01 15:00:0.000' +); +INSERT INTO nature ( + project_id, + name +) VALUES ( + '8ce6147e-1f5b-426f-b1be-dfeabd37a50a', + 'siriusComponents://nature?kind=studio' +); +INSERT INTO semantic_data ( + id, + project_id, + created_on, + last_modified_on +) VALUES ( + '65edc1f2-989c-4001-971b-29981179ebfa', + '8ce6147e-1f5b-426f-b1be-dfeabd37a50a', + '2024-07-01 15:00:0.000', + '2024-07-01 15:00:0.000' +); +INSERT INTO semantic_data_domain ( + semantic_data_id, + uri +) VALUES ( + '65edc1f2-989c-4001-971b-29981179ebfa', + 'http://www.eclipse.org/sirius-web/view' +); +INSERT INTO semantic_data_domain ( + semantic_data_id, + uri +) VALUES ( + '65edc1f2-989c-4001-971b-29981179ebfa', + 'http://www.eclipse.org/sirius-web/diagram' +); +INSERT INTO document ( + id, + semantic_data_id, + name, + content, + created_on, + last_modified_on +) VALUES ( + 'fa110225-6b86-4bc1-b707-54c7c995cebf', + '65edc1f2-989c-4001-971b-29981179ebfa', + 'NodeDescription#labelBorderStyle migration', + '{ + "json": { "version": "1.0", "encoding": "utf-8" }, + "ns": { + "diagram": "http://www.eclipse.org/sirius-web/diagram", + "view": "http://www.eclipse.org/sirius-web/view" + }, + "content": [ + { + "id": "567668c6-f841-4330-af9c-1a17ef28492b", + "eClass": "view:View", + "data": { + "colorPalettes": [ + { + "data": { + "colors": [ + { + "data": { + "name": "color_empty", + "value": "" + }, + "eClass": "view:FixedColor", + "id": "19e41e76-e016-4f15-abef-e762956f5275" + } + ] + }, + "eClass": "view:ColorPalette", + "id": "8c4140a3-a696-4016-a862-da474028fc2c" + } + ], + "descriptions": [ + { + "id": "c1a0ae1c-8420-4aa7-b443-1a05044076e2", + "eClass": "diagram:DiagramDescription", + "data": { + "name": "DiagramLabelStyle#borderSize migration", + "domainType": "flow::System", + "edgeDescriptions": [ + { + "data": { + "centerLabelExpression": "", + "name": "LabelBorderSize Edge", + "semanticCandidatesExpression": "", + "sourceNodeDescriptions": [ + "//@descriptions.0/@nodeDescriptions.0" + ], + "sourceNodesExpression": "aql:self", + "style": { + "data": { + "color": "//@colorPalettes.0/@colors.0" + }, + "eClass": "diagram:EdgeStyle", + "id": "748824cb-cd5f-42fe-95a8-4f21172ba2ce" + }, + "targetNodeDescriptions": [ + "//@descriptions.0/@nodeDescriptions.1" + ], + "targetNodesExpression": "aql:self.linkedTo" + }, + "eClass": "diagram:EdgeDescription", + "id": "c1077629-a4ec-4232-8eb5-5209b58c7464" + } + ], + "nodeDescriptions": [ + { + "id": "4d1ec4d1-dd2c-4cb2-bbed-df02f0babbd8", + "eClass": "diagram:NodeDescription", + "data": { + "name": "LabelBorderSize migration", + "domainType": "flow::CompositeProcessor", + "insideLabel": { + "data": { + "style": { + "eClass": "diagram:InsideLabelStyle", + "id": "d70178c4-d36f-40d7-a3ab-ef8568e4ee2b" + } + }, + "eClass": "diagram:InsideLabelDescription", + "id": "046b48ee-4554-4d8a-a457-5391b690d2a9" + }, + "outsideLabels": [ + { + "data": { + "style": { + "eClass": "diagram:OutsideLabelStyle", + "id": "c69b0853-26ab-40b0-979d-f0a4974ad865" + } + }, + "eClass": "diagram:OutsideLabelDescription", + "id": "fd8638cc-8ebb-48e6-bf3f-2c09206f6a09" + }, + { + "data": { + "style": { + "eClass": "diagram:OutsideLabelStyle", + "id": "601e5a1d-3d8a-49bc-96b9-f0c47ee594ee" + } + }, + "eClass": "diagram:OutsideLabelDescription", + "id": "a8a2bf4c-82b7-4050-b4e7-09fd26a2f7c0" + } + ], + "childrenLayoutStrategy": { + "id": "558f8558-bee6-4ae9-8dc7-4344efe2b83e", + "eClass": "diagram:FreeFormLayoutStrategyDescription" + }, + "style": { + "data": { + "background": "//@colorPalettes.0/@colors.0", + "borderColor": "//@colorPalettes.0/@colors.0" + }, + "eClass": "diagram:RectangularNodeStyleDescription", + "id": "dacddb12-7c2c-4463-bf71-a7c3e68e2132" + } + } + } + ] + } + } + ] + } + } + ] + }', + '2024-07-01 15:00:0.000', + '2024-07-01 15:00:0.000' +);