Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBelqassim Djafer2014-11-27 10:15:41 +0000
committerLaurent Redor2014-12-03 13:58:04 +0000
commitf217147fd0c0c9288799718ed46a825709a44557 (patch)
tree275e8237a8f0464bc75990c90e644ff5ac7ea1f5
parentf9fbedd0c778992d058550f7eb9082aeab82d1b2 (diff)
downloadorg.eclipse.sirius-f217147fd0c0c9288799718ed46a825709a44557.tar.gz
org.eclipse.sirius-f217147fd0c0c9288799718ed46a825709a44557.tar.xz
org.eclipse.sirius-f217147fd0c0c9288799718ed46a825709a44557.zip
[449167] Test removing Acceleo 3 expressions migration
Test migration participant to update object values in VSM before loading this objects from XML file. Bug: 449167 Change-Id: Ia52b9beba9c8d6bdac3c072e71ba1ee328319bd8 Signed-off-by: Belqassim Djafer <belqassim.djafer@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/RemoveAcceleo3References/RemoveAcceleoReferences.aird84
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/RemoveAcceleo3References/RemoveAcceleoReferences.ecore6
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/RemoveAcceleo3References/RemoveAcceleoReferences.odesign39
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/common/AllCommonPluginTests.java2
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/migration/RemoveAcceleoReferencesMigrationTest.java98
5 files changed, 229 insertions, 0 deletions
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/RemoveAcceleo3References/RemoveAcceleoReferences.aird b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/RemoveAcceleo3References/RemoveAcceleoReferences.aird
new file mode 100644
index 0000000000..db47643586
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/RemoveAcceleo3References/RemoveAcceleoReferences.aird
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<viewpoint:DAnalysis xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:diagram="http://www.eclipse.org/sirius/diagram/1.1.0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/style" xmi:id="_xZb0AHYWEeSwS-Y23Kt5MQ" selectedViews="_MKK2IHYYEeSwS-Y23Kt5MQ" version="8.1.1">
+ <models xmi:type="ecore:EPackage" href="RemoveAcceleoReferences.ecore#/"/>
+ <ownedViews xmi:type="viewpoint:DRepresentationContainer" xmi:id="_MKK2IHYYEeSwS-Y23Kt5MQ" initialized="true">
+ <ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_QDvIsHYYEeSwS-Y23Kt5MQ" name="new Representation">
+ <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_QEL0oHYYEeSwS-Y23Kt5MQ" source="GMF_DIAGRAMS">
+ <data xmi:type="notation:Diagram" xmi:id="_QEL0oXYYEeSwS-Y23Kt5MQ" type="Sirius" element="_QDvIsHYYEeSwS-Y23Kt5MQ" measurementUnit="Pixel">
+ <children xmi:type="notation:Node" xmi:id="_TSmRYHYYEeSwS-Y23Kt5MQ" type="2002" element="_TO4PAHYYEeSwS-Y23Kt5MQ">
+ <children xmi:type="notation:Node" xmi:id="_TSwCYHYYEeSwS-Y23Kt5MQ" type="5006"/>
+ <children xmi:type="notation:Node" xmi:id="_TSwCYXYYEeSwS-Y23Kt5MQ" type="7001">
+ <children xmi:type="notation:Node" xmi:id="_TTC9UHYYEeSwS-Y23Kt5MQ" type="3008" element="_TPeE4HYYEeSwS-Y23Kt5MQ">
+ <children xmi:type="notation:Node" xmi:id="_TTC9U3YYEeSwS-Y23Kt5MQ" type="5005"/>
+ <children xmi:type="notation:Node" xmi:id="_TTMuUHYYEeSwS-Y23Kt5MQ" type="7002">
+ <styles xmi:type="notation:SortingStyle" xmi:id="_TTMuUXYYEeSwS-Y23Kt5MQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_TTMuUnYYEeSwS-Y23Kt5MQ"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_TTC9UXYYEeSwS-Y23Kt5MQ" fontName="Segoe UI" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_TTC9UnYYEeSwS-Y23Kt5MQ" x="30" y="30"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_TTMuU3YYEeSwS-Y23Kt5MQ" type="3008" element="_TPeE53YYEeSwS-Y23Kt5MQ">
+ <children xmi:type="notation:Node" xmi:id="_TTMuVnYYEeSwS-Y23Kt5MQ" type="5005"/>
+ <children xmi:type="notation:Node" xmi:id="_TTMuV3YYEeSwS-Y23Kt5MQ" type="7002">
+ <styles xmi:type="notation:SortingStyle" xmi:id="_TTMuWHYYEeSwS-Y23Kt5MQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_TTMuWXYYEeSwS-Y23Kt5MQ"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_TTMuVHYYEeSwS-Y23Kt5MQ" fontName="Segoe UI" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_TTMuVXYYEeSwS-Y23Kt5MQ" x="210" y="30"/>
+ </children>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_TSwCYnYYEeSwS-Y23Kt5MQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_TSwCY3YYEeSwS-Y23Kt5MQ"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_TSmRYXYYEeSwS-Y23Kt5MQ" fontName="Segoe UI" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_TSmRYnYYEeSwS-Y23Kt5MQ" x="225" y="80"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_QEL0onYYEeSwS-Y23Kt5MQ"/>
+ </data>
+ </ownedAnnotationEntries>
+ <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_TO4PAHYYEeSwS-Y23Kt5MQ" name="P">
+ <target xmi:type="ecore:EPackage" href="RemoveAcceleoReferences.ecore#/"/>
+ <semanticElements xmi:type="ecore:EPackage" href="RemoveAcceleoReferences.ecore#/"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_TPBY8HYYEeSwS-Y23Kt5MQ">
+ <labelColor xmi:type="viewpoint:RGBValues" xmi:id="_TPBY8XYYEeSwS-Y23Kt5MQ"/>
+ <description xmi:type="style:FlatContainerStyleDescription" href="RemoveAcceleoReferences.odesign#//@ownedViewpoints[name='RemoveAcceleoReferences']/@ownedRepresentations[name='Representation']/@defaultLayer/@containerMappings[name='Package']/@style"/>
+ <borderColor xmi:type="viewpoint:RGBValues" xmi:id="_TPBY8nYYEeSwS-Y23Kt5MQ"/>
+ <backgroundColor xmi:type="viewpoint:RGBValues" xmi:id="_9LGR8HYbEeSwS-Y23Kt5MQ" red="161" green="191" blue="223"/>
+ <foregroundColor xmi:type="viewpoint:RGBValues" xmi:id="_aofg4XYYEeSwS-Y23Kt5MQ" red="161" green="191" blue="223"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:ContainerMapping" href="RemoveAcceleoReferences.odesign#//@ownedViewpoints[name='RemoveAcceleoReferences']/@ownedRepresentations[name='Representation']/@defaultLayer/@containerMappings[name='Package']"/>
+ <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_TPeE4HYYEeSwS-Y23Kt5MQ" name="C1">
+ <target xmi:type="ecore:EClass" href="RemoveAcceleoReferences.ecore#//C1"/>
+ <semanticElements xmi:type="ecore:EClass" href="RemoveAcceleoReferences.ecore#//C1"/>
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_TPeE4XYYEeSwS-Y23Kt5MQ">
+ <labelColor xmi:type="viewpoint:RGBValues" xmi:id="_TPeE4nYYEeSwS-Y23Kt5MQ"/>
+ <description xmi:type="style:FlatContainerStyleDescription" href="RemoveAcceleoReferences.odesign#//@ownedViewpoints[name='RemoveAcceleoReferences']/@ownedRepresentations[name='Representation']/@defaultLayer/@containerMappings[name='Package']/@subContainerMappings[name='Class']/@style"/>
+ <borderColor xmi:type="viewpoint:RGBValues" xmi:id="_TPeE43YYEeSwS-Y23Kt5MQ"/>
+ <backgroundColor xmi:type="viewpoint:RGBValues" xmi:id="_TPeE5nYYEeSwS-Y23Kt5MQ" red="255" green="255" blue="255"/>
+ <foregroundColor xmi:type="viewpoint:RGBValues" xmi:id="_9LGR8XYbEeSwS-Y23Kt5MQ" red="161" green="191" blue="223"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:ContainerMapping" href="RemoveAcceleoReferences.odesign#//@ownedViewpoints[name='RemoveAcceleoReferences']/@ownedRepresentations[name='Representation']/@defaultLayer/@containerMappings[name='Package']/@subContainerMappings[name='Class']"/>
+ </ownedDiagramElements>
+ <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_TPeE53YYEeSwS-Y23Kt5MQ" name="C2">
+ <target xmi:type="ecore:EClass" href="RemoveAcceleoReferences.ecore#//C2"/>
+ <semanticElements xmi:type="ecore:EClass" href="RemoveAcceleoReferences.ecore#//C2"/>
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_TPeE6HYYEeSwS-Y23Kt5MQ">
+ <labelColor xmi:type="viewpoint:RGBValues" xmi:id="_TPeE6XYYEeSwS-Y23Kt5MQ"/>
+ <description xmi:type="style:FlatContainerStyleDescription" href="RemoveAcceleoReferences.odesign#//@ownedViewpoints[name='RemoveAcceleoReferences']/@ownedRepresentations[name='Representation']/@defaultLayer/@containerMappings[name='Package']/@subContainerMappings[name='Class']/@style"/>
+ <borderColor xmi:type="viewpoint:RGBValues" xmi:id="_TPeE6nYYEeSwS-Y23Kt5MQ"/>
+ <backgroundColor xmi:type="viewpoint:RGBValues" xmi:id="_TPeE7XYYEeSwS-Y23Kt5MQ" red="255" green="255" blue="255"/>
+ <foregroundColor xmi:type="viewpoint:RGBValues" xmi:id="_9LGR8nYbEeSwS-Y23Kt5MQ" red="161" green="191" blue="223"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:ContainerMapping" href="RemoveAcceleoReferences.odesign#//@ownedViewpoints[name='RemoveAcceleoReferences']/@ownedRepresentations[name='Representation']/@defaultLayer/@containerMappings[name='Package']/@subContainerMappings[name='Class']"/>
+ </ownedDiagramElements>
+ </ownedDiagramElements>
+ <description xmi:type="description_1:DiagramDescription" href="RemoveAcceleoReferences.odesign#//@ownedViewpoints[name='RemoveAcceleoReferences']/@ownedRepresentations[name='Representation']"/>
+ <filterVariableHistory xmi:type="diagram:FilterVariableHistory" xmi:id="_QDvIsXYYEeSwS-Y23Kt5MQ"/>
+ <activatedLayers xmi:type="description_1:Layer" href="RemoveAcceleoReferences.odesign#//@ownedViewpoints[name='RemoveAcceleoReferences']/@ownedRepresentations[name='Representation']/@defaultLayer"/>
+ <target xmi:type="ecore:EPackage" href="RemoveAcceleoReferences.ecore#/"/>
+ </ownedRepresentations>
+ <viewpoint xmi:type="description:Viewpoint" href="RemoveAcceleoReferences.odesign#//@ownedViewpoints[name='RemoveAcceleoReferences']"/>
+ </ownedViews>
+</viewpoint:DAnalysis>
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/RemoveAcceleo3References/RemoveAcceleoReferences.ecore b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/RemoveAcceleo3References/RemoveAcceleoReferences.ecore
new file mode 100644
index 0000000000..e2616091b1
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/RemoveAcceleo3References/RemoveAcceleoReferences.ecore
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="P">
+ <eClassifiers xsi:type="ecore:EClass" name="C1"/>
+ <eClassifiers xsi:type="ecore:EClass" name="C2"/>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/RemoveAcceleo3References/RemoveAcceleoReferences.odesign b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/RemoveAcceleo3References/RemoveAcceleoReferences.odesign
new file mode 100644
index 0000000000..f9155e4b1f
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/RemoveAcceleo3References/RemoveAcceleoReferences.odesign
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<description:Group xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" name="RemoveAcceleoReferences" version="8.1.0">
+ <ownedViewpoints name="RemoveAcceleoReferences">
+ <ownedRepresentations xsi:type="description_1:DiagramDescription" name="Representation" domainClass="EPackage">
+ <defaultLayer name="Default">
+ <containerMappings name="Package" semanticCandidatesExpression="[self/]" domainClass="EPackage">
+ <subContainerMappings name="Class" semanticCandidatesExpression="feature:eAllContents" domainClass="EClass">
+ <style xsi:type="style:FlatContainerStyleDescription" backgroundColor="//@userColorsPalettes[name='Colors']/@entries[name='white_blue']" foregroundColor="//@userColorsPalettes[name='Colors']/@entries[name='blue_white']">
+ <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ </style>
+ </subContainerMappings>
+ <style xsi:type="style:FlatContainerStyleDescription" backgroundColor="//@userColorsPalettes[name='Colors']/@entries[name='blue_white']" foregroundColor="//@userColorsPalettes[name='Colors']/@entries[name='white_blue']">
+ <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ </style>
+ </containerMappings>
+ </defaultLayer>
+ </ownedRepresentations>
+ </ownedViewpoints>
+ <userColorsPalettes name="Colors">
+ <entries xsi:type="description:InterpolatedColor" name="blue_white" colorValueComputationExpression="1">
+ <colorSteps associatedValue="0">
+ <associatedColor href="environment:/viewpoint#//@systemColors/@entries[name='blue']"/>
+ </colorSteps>
+ <colorSteps associatedValue="3">
+ <associatedColor href="environment:/viewpoint#//@systemColors/@entries[name='white']"/>
+ </colorSteps>
+ </entries>
+ <entries xsi:type="description:InterpolatedColor" name="white_blue">
+ <colorSteps associatedValue="0">
+ <associatedColor href="environment:/viewpoint#//@systemColors/@entries[name='white']"/>
+ </colorSteps>
+ <colorSteps associatedValue="3">
+ <associatedColor href="environment:/viewpoint#//@systemColors/@entries[name='blue']"/>
+ </colorSteps>
+ </entries>
+ </userColorsPalettes>
+</description:Group>
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/common/AllCommonPluginTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/common/AllCommonPluginTests.java
index c01fb22de6..324e872f6c 100644
--- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/common/AllCommonPluginTests.java
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/common/AllCommonPluginTests.java
@@ -106,6 +106,7 @@ import org.eclipse.sirius.tests.unit.diagram.migration.MigrationOfHideLabelFilte
import org.eclipse.sirius.tests.unit.diagram.migration.MigrationRoutingStyleEndUserOverrideTest;
import org.eclipse.sirius.tests.unit.diagram.migration.OptionalLayerToAdditionalLayerMigrationTest;
import org.eclipse.sirius.tests.unit.diagram.migration.ReferencedModelResourceMigrationTest;
+import org.eclipse.sirius.tests.unit.diagram.migration.RemoveAcceleoReferencesMigrationTest;
import org.eclipse.sirius.tests.unit.diagram.migration.RepairMigrateLostDiagramElementsTC1Test;
import org.eclipse.sirius.tests.unit.diagram.migration.RepairMigrateLostDiagramElementsTC2Test;
import org.eclipse.sirius.tests.unit.diagram.migration.RepairMigratePinStatusTest;
@@ -172,6 +173,7 @@ public class AllCommonPluginTests extends TestCase {
suite.addTestSuite(DDiagramSetRemovalMigrationTest.class);
// suite.addTestSuite(AutomaticMigrationOnAirdResourceTest.class);
suite.addTestSuite(ReferencedModelResourceMigrationTest.class);
+ suite.addTestSuite(RemoveAcceleoReferencesMigrationTest.class);
// suite.addTestSuite(SequenceInstanceRoleSizeRepairMigrationTestCase.class);
suite.addTestSuite(OptionalLayerToAdditionalLayerMigrationTest.class);
suite.addTestSuite(MigrationRoutingStyleEndUserOverrideTest.class);
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/migration/RemoveAcceleoReferencesMigrationTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/migration/RemoveAcceleoReferencesMigrationTest.java
new file mode 100644
index 0000000000..098c913687
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/migration/RemoveAcceleoReferencesMigrationTest.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2014 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.tests.unit.diagram.migration;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.sirius.business.api.session.SessionManager;
+import org.eclipse.sirius.business.api.session.SessionStatus;
+import org.eclipse.sirius.diagram.ui.business.internal.migration.description.AcceleoExpressionsMigrationParticipant;
+import org.eclipse.sirius.tests.SiriusTestsPlugin;
+import org.eclipse.sirius.tests.support.api.SiriusTestCase;
+import org.eclipse.sirius.tools.api.command.ICommandFactory;
+import org.eclipse.sirius.viewpoint.description.Group;
+import org.eclipse.sirius.viewpoint.description.InterpolatedColor;
+import org.osgi.framework.Version;
+
+/**
+ * Test migration participant to update object values in VSM before loading this
+ * objects from XML file.
+ *
+ * @author <a href="mailto:belqassim.djafer@obeo.fr">Belqassim Djafer</a>
+ *
+ */
+public class RemoveAcceleoReferencesMigrationTest extends SiriusTestCase {
+
+ private static final String PATH = "data/unit/migration/do_not_migrate/RemoveAcceleo3References/";
+
+ private static final String VSM_RESOURCE_NAME = "RemoveAcceleoReferences.odesign";
+
+ private static final String SESSION_RESOURCE_NAME = "RemoveAcceleoReferences.aird";
+
+ private Group group;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ICommandFactory getCommandFactory() {
+ return null;
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ genericSetUp();
+ copyFilesToTestProject(SiriusTestsPlugin.PLUGIN_ID, PATH, VSM_RESOURCE_NAME, SESSION_RESOURCE_NAME);
+ URI vsmResourceURI = URI.createPlatformPluginURI(SiriusTestsPlugin.PLUGIN_ID + "/" + PATH + VSM_RESOURCE_NAME, true);
+ ResourceSet resourceSet = new ResourceSetImpl();
+ Resource vsmResource = resourceSet.getResource(vsmResourceURI, true);
+ group = (Group) vsmResource.getContents().get(0);
+ }
+
+ /**
+ * Test that the data were not migrated on the repo. It allows to check the
+ * effect of the migration in the other test.
+ */
+ public void testMigrationIsNeededOnData() {
+ Version acceleoExpressionMigrationVersion = new AcceleoExpressionsMigrationParticipant().getMigrationVersion();
+
+ // Check that the vsm migration is needed.
+ Version loadedVersion = checkVsmFileMigrationStatus(URI.createPlatformPluginURI(SiriusTestsPlugin.PLUGIN_ID + "/" + PATH + VSM_RESOURCE_NAME, true), true);
+ assertTrue("The list migration must be required on test data.", acceleoExpressionMigrationVersion.compareTo(loadedVersion) > 0);
+ }
+
+ /**
+ * Ensure that the editor should not be dirty after the diagram opening.
+ */
+ public void testRemoveAcceleoReferencesMigration() {
+ session = SessionManager.INSTANCE.getSession(URI.createPlatformPluginURI(SiriusTestsPlugin.PLUGIN_ID + "/" + PATH + SESSION_RESOURCE_NAME, true), new NullProgressMonitor());
+ if (!session.isOpen()) {
+ session.open(new NullProgressMonitor());
+ }
+ assertFalse("The editor should not be dirty after the diagram opening.", session.getStatus().equals(SessionStatus.DIRTY));
+ }
+
+ /**
+ * Check Color Value Computation Expression values after migration.
+ */
+ public void testValuesAfterMigration() {
+ InterpolatedColor interpolatedColor1 = (InterpolatedColor) group.getUserColorsPalettes().get(0).getEntries().get(0);
+ InterpolatedColor interpolatedColor2 = (InterpolatedColor) group.getUserColorsPalettes().get(0).getEntries().get(1);
+ assertEquals("Setted Color Value Computation Expression values in VSM should not change after migration", interpolatedColor1.getColorValueComputationExpression(), "1");
+ assertEquals("Default Color Value Computation Expression values in VSM must be set to [eContents()->size()/]", interpolatedColor2.getColorValueComputationExpression(),
+ "[eContents()->size()/]");
+ }
+
+}

Back to the top