Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Porhel2015-05-26 08:16:58 +0000
committerMaxime Porhel2015-05-26 14:58:29 +0000
commit9907ed0e5fabb260a4d3a535ae4acbc6a752f666 (patch)
treef88bfcb094d104817682cb3ca1616fa6423d184c
parent29cba00235392b6f1197743ff460794c0a16c216 (diff)
downloadorg.eclipse.sirius-9907ed0e5fabb260a4d3a535ae4acbc6a752f666.tar.gz
org.eclipse.sirius-9907ed0e5fabb260a4d3a535ae4acbc6a752f666.tar.xz
org.eclipse.sirius-9907ed0e5fabb260a4d3a535ae4acbc6a752f666.zip
[424422] Improve migration and test it
Test the loaded version before trying to migrate font formats. Test the migration effect. Bug: 424422 Change-Id: Ic5690402eee488ba14cbf1f937b91b25bc0e0368 Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/fontFormat/fontFormat.aird152
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/fontFormat/fontFormat.ecore5
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/fontFormat/fontFormat.odesign62
-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/FontFormatMigrationTest.java170
-rw-r--r--plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/migration/FontFormatMigrationParticipant.java38
6 files changed, 410 insertions, 19 deletions
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/fontFormat/fontFormat.aird b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/fontFormat/fontFormat.aird
new file mode 100644
index 0000000000..79d95da1ff
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/fontFormat/fontFormat.aird
@@ -0,0 +1,152 @@
+<?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:description_2="http://www.eclipse.org/sirius/table/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:table="http://www.eclipse.org/sirius/table/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/table/description/1.1.0 http://www.eclipse.org/sirius/table/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="_sQvy0AN3EeW5NODoYcfJTw" selectedViews="_ZvfMMAN5EeW5NODoYcfJTw" version="10.0.0.201505131200">
+ <semanticResources>platform:/resource/df/fontFormat.ecore</semanticResources>
+ <ownedViews xmi:type="viewpoint:DRepresentationContainer" xmi:id="_ZvfMMAN5EeW5NODoYcfJTw">
+ <ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_cFezMAN5EeW5NODoYcfJTw" name="fontFormatDiag">
+ <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_cFezMQN5EeW5NODoYcfJTw" source="DANNOTATION_CUSTOMIZATION_KEY">
+ <data xmi:type="diagram:ComputedStyleDescriptionRegistry" xmi:id="_cFezMgN5EeW5NODoYcfJTw"/>
+ </ownedAnnotationEntries>
+ <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_cFfaQAN5EeW5NODoYcfJTw" source="GMF_DIAGRAMS">
+ <data xmi:type="notation:Diagram" xmi:id="_cFfaQQN5EeW5NODoYcfJTw" type="Sirius" element="_cFezMAN5EeW5NODoYcfJTw" measurementUnit="Pixel">
+ <children xmi:type="notation:Node" xmi:id="_cFgoYAN5EeW5NODoYcfJTw" type="2001" element="_cFezMwN5EeW5NODoYcfJTw">
+ <children xmi:type="notation:Node" xmi:id="_cFidkAN5EeW5NODoYcfJTw" type="5002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cFidkQN5EeW5NODoYcfJTw" y="5"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_cFqZYAN5EeW5NODoYcfJTw" type="3003" element="_cFezNAN5EeW5NODoYcfJTw">
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_cFqZYQN5EeW5NODoYcfJTw" fontName=".Helvetica Neue DeskInterface"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cFqZYgN5EeW5NODoYcfJTw"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_cFgoYQN5EeW5NODoYcfJTw" fontName=".Helvetica Neue DeskInterface" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cFgoYgN5EeW5NODoYcfJTw" x="148" y="96" width="65" height="68"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_cFkSwAN5EeW5NODoYcfJTw" type="2001" element="_cFezNQN5EeW5NODoYcfJTw">
+ <children xmi:type="notation:Node" xmi:id="_cFmH8AN5EeW5NODoYcfJTw" type="5002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cFmH8QN5EeW5NODoYcfJTw" y="5"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_cFrngAN5EeW5NODoYcfJTw" type="3003" element="_cFezNgN5EeW5NODoYcfJTw">
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_cFrngQN5EeW5NODoYcfJTw" fontName=".Helvetica Neue DeskInterface"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cFrnggN5EeW5NODoYcfJTw"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_cFkSwQN5EeW5NODoYcfJTw" fontName=".Helvetica Neue DeskInterface" fontHeight="8" bold="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cFkSwgN5EeW5NODoYcfJTw" x="232" y="96" width="73" height="68"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_cFnWEAN5EeW5NODoYcfJTw" type="2002" element="_cFezNwN5EeW5NODoYcfJTw">
+ <children xmi:type="notation:Node" xmi:id="_cFn9IAN5EeW5NODoYcfJTw" type="5006"/>
+ <children xmi:type="notation:Node" xmi:id="_cFokMAN5EeW5NODoYcfJTw" type="7001">
+ <styles xmi:type="notation:SortingStyle" xmi:id="_cFokMQN5EeW5NODoYcfJTw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_cFokMgN5EeW5NODoYcfJTw"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_cFnWEQN5EeW5NODoYcfJTw" fontName=".Helvetica Neue DeskInterface" fontHeight="8" italic="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cFnWEgN5EeW5NODoYcfJTw" x="324" y="96" width="150" height="70"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_cFpLQAN5EeW5NODoYcfJTw" type="2002" element="_cFezOQN5EeW5NODoYcfJTw">
+ <children xmi:type="notation:Node" xmi:id="_cFpyUAN5EeW5NODoYcfJTw" type="5006"/>
+ <children xmi:type="notation:Node" xmi:id="_cFpyUQN5EeW5NODoYcfJTw" type="7001">
+ <styles xmi:type="notation:SortingStyle" xmi:id="_cFpyUgN5EeW5NODoYcfJTw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_cFpyUwN5EeW5NODoYcfJTw"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_cFpLQQN5EeW5NODoYcfJTw" fontName=".Helvetica Neue DeskInterface" fontHeight="8" bold="true" italic="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cFpLQgN5EeW5NODoYcfJTw" x="492" y="96"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_cFfaQgN5EeW5NODoYcfJTw"/>
+ </data>
+ </ownedAnnotationEntries>
+ <ownedDiagramElements xmi:type="diagram:DNode" xmi:id="_cFezMwN5EeW5NODoYcfJTw" name="normal" width="3" height="3" resizeKind="NSEW">
+ <target xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="diagram:Square" xmi:id="_cFezNAN5EeW5NODoYcfJTw" labelPosition="node">
+ <description xmi:type="style:SquareDescription" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatDiag']/@defaultLayer/@nodeMappings[name='normal']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:NodeMapping" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatDiag']/@defaultLayer/@nodeMappings[name='normal']"/>
+ </ownedDiagramElements>
+ <ownedDiagramElements xmi:type="diagram:DNode" xmi:id="_cFezNQN5EeW5NODoYcfJTw" name="bold" width="3" height="3" resizeKind="NSEW">
+ <target xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="diagram:Square" xmi:id="_cFezNgN5EeW5NODoYcfJTw" labelFormat="bold" labelPosition="node">
+ <description xmi:type="style:SquareDescription" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatDiag']/@defaultLayer/@nodeMappings[name='bold']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:NodeMapping" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatDiag']/@defaultLayer/@nodeMappings[name='bold']"/>
+ </ownedDiagramElements>
+ <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_cFezNwN5EeW5NODoYcfJTw" name="italic">
+ <target xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_cFezOAN5EeW5NODoYcfJTw" labelFormat="italic">
+ <description xmi:type="style:FlatContainerStyleDescription" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatDiag']/@defaultLayer/@containerMappings[name='italic']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:ContainerMapping" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatDiag']/@defaultLayer/@containerMappings[name='italic']"/>
+ </ownedDiagramElements>
+ <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_cFezOQN5EeW5NODoYcfJTw" name="bold_italic">
+ <target xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_cFezOgN5EeW5NODoYcfJTw" labelFormat="bold_italic">
+ <description xmi:type="style:FlatContainerStyleDescription" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatDiag']/@defaultLayer/@containerMappings[name='bold_italic']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:ContainerMapping" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatDiag']/@defaultLayer/@containerMappings[name='bold_italic']"/>
+ </ownedDiagramElements>
+ <description xmi:type="description_1:DiagramDescription" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatDiag']"/>
+ <filterVariableHistory xmi:type="diagram:FilterVariableHistory" xmi:id="_cFezOwN5EeW5NODoYcfJTw"/>
+ <activatedLayers xmi:type="description_1:Layer" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatDiag']/@defaultLayer"/>
+ <target xmi:type="ecore:EPackage" href="fontFormat.ecore#/"/>
+ </ownedRepresentations>
+ <ownedRepresentations xmi:type="table:DTable" xmi:id="_c-BkwAN5EeW5NODoYcfJTw" name="fontFormatTable" headerColumnWidth="102">
+ <target xmi:type="ecore:EPackage" href="fontFormat.ecore#/"/>
+ <lines xmi:type="table:DLine" xmi:id="_c-BkwQN5EeW5NODoYcfJTw" label="normal">
+ <target xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <originMapping xmi:type="description_2:LineMapping" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatTable']/@ownedLineMappings[name='normal']"/>
+ <cells xmi:type="table:DCell" xmi:id="_yBohcAN5EeW5NODoYcfJTw" label="normal" column="_yBn6YAN5EeW5NODoYcfJTw">
+ <target xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ </cells>
+ <currentStyle xmi:type="table:DTableElementStyle" xmi:id="_c-BkwgN5EeW5NODoYcfJTw" labelSize="12" defaultForegroundStyle="true"/>
+ </lines>
+ <lines xmi:type="table:DLine" xmi:id="_c-BkwwN5EeW5NODoYcfJTw" label="bold">
+ <target xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <originMapping xmi:type="description_2:LineMapping" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatTable']/@ownedLineMappings[name='bold']"/>
+ <cells xmi:type="table:DCell" xmi:id="_yBohcQN5EeW5NODoYcfJTw" label="bold" column="_yBn6YAN5EeW5NODoYcfJTw">
+ <target xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ </cells>
+ <currentStyle xmi:type="table:DTableElementStyle" xmi:id="_c-BkxAN5EeW5NODoYcfJTw" labelSize="12" labelFormat="bold" defaultForegroundStyle="true"/>
+ </lines>
+ <lines xmi:type="table:DLine" xmi:id="_c-BkxQN5EeW5NODoYcfJTw" label="italic">
+ <target xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <originMapping xmi:type="description_2:LineMapping" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatTable']/@ownedLineMappings[name='italic']"/>
+ <cells xmi:type="table:DCell" xmi:id="_yBohcgN5EeW5NODoYcfJTw" label="italic" column="_yBn6YAN5EeW5NODoYcfJTw">
+ <target xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ </cells>
+ <currentStyle xmi:type="table:DTableElementStyle" xmi:id="_c-BkxgN5EeW5NODoYcfJTw" labelSize="12" labelFormat="italic" defaultForegroundStyle="true"/>
+ </lines>
+ <lines xmi:type="table:DLine" xmi:id="_c-BkxwN5EeW5NODoYcfJTw" label="bold_italic">
+ <target xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <originMapping xmi:type="description_2:LineMapping" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatTable']/@ownedLineMappings[name='bold_italic']"/>
+ <cells xmi:type="table:DCell" xmi:id="_yBpIgAN5EeW5NODoYcfJTw" label="bold_italic" column="_yBn6YAN5EeW5NODoYcfJTw">
+ <target xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="fontFormat.ecore#//NewEClass1"/>
+ </cells>
+ <currentStyle xmi:type="table:DTableElementStyle" xmi:id="_c-BkyAN5EeW5NODoYcfJTw" labelSize="12" labelFormat="bold_italic" defaultForegroundStyle="true"/>
+ </lines>
+ <columns xmi:type="table:DFeatureColumn" xmi:id="_yBn6YAN5EeW5NODoYcfJTw" label="fontFormat" cells="_yBohcAN5EeW5NODoYcfJTw _yBohcQN5EeW5NODoYcfJTw _yBohcgN5EeW5NODoYcfJTw _yBpIgAN5EeW5NODoYcfJTw" width="95" featureName="*">
+ <originMapping xmi:type="description_2:FeatureColumnMapping" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatTable']/@ownedColumnMappings[name='fontFormatcol']"/>
+ </columns>
+ <description xmi:type="description_2:EditionTableDescription" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']/@ownedRepresentations[name='fontFormatTable']"/>
+ </ownedRepresentations>
+ <viewpoint xmi:type="description:Viewpoint" href="fontFormat.odesign#//@ownedViewpoints[name='fontFormat']"/>
+ </ownedViews>
+</viewpoint:DAnalysis>
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/fontFormat/fontFormat.ecore b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/fontFormat/fontFormat.ecore
new file mode 100644
index 0000000000..1e360daa9e
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/fontFormat/fontFormat.ecore
@@ -0,0 +1,5 @@
+<?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="">
+ <eClassifiers xsi:type="ecore:EClass" name="NewEClass1"/>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/fontFormat/fontFormat.odesign b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/fontFormat/fontFormat.odesign
new file mode 100644
index 0000000000..6ee2687e35
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/fontFormat/fontFormat.odesign
@@ -0,0 +1,62 @@
+<?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:description_2="http://www.eclipse.org/sirius/table/description/1.1.0" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" name="fontFormat" version="10.0.0.201504091800">
+ <ownedViewpoints name="fontFormat">
+ <ownedRepresentations xsi:type="description_1:DiagramDescription" name="fontFormatDiag" domainClass="EPackage" enablePopupBars="true">
+ <defaultLayer name="Default">
+ <nodeMappings name="normal" semanticCandidatesExpression="feature:eContents" domainClass="EClass">
+ <style xsi:type="style:SquareDescription" labelExpression="normal" labelPosition="node" resizeKind="NSEW">
+ <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
+ </style>
+ </nodeMappings>
+ <nodeMappings name="bold" semanticCandidatesExpression="feature:eContents" domainClass="EClass">
+ <style xsi:type="style:SquareDescription" labelFormat="bold" labelExpression="bold" labelPosition="node" resizeKind="NSEW">
+ <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
+ </style>
+ </nodeMappings>
+ <containerMappings name="italic" semanticCandidatesExpression="feature:eContents" domainClass="EClass">
+ <style xsi:type="style:FlatContainerStyleDescription" labelFormat="italic" labelExpression="italic">
+ <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/>
+ <foregroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='light_gray']"/>
+ </style>
+ </containerMappings>
+ <containerMappings name="bold_italic" semanticCandidatesExpression="feature:eContents" domainClass="EClass">
+ <style xsi:type="style:FlatContainerStyleDescription" labelFormat="bold_italic" labelExpression="bold_italic">
+ <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/>
+ <foregroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='light_gray']"/>
+ </style>
+ </containerMappings>
+ </defaultLayer>
+ </ownedRepresentations>
+ <ownedRepresentations xsi:type="description_2:EditionTableDescription" name="fontFormatTable" domainClass="EPackage">
+ <ownedLineMappings name="normal" domainClass="EClass" semanticCandidatesExpression="feature:eContents" headerLabelExpression="normal">
+ <defaultForeground>
+ <foreGroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ </defaultForeground>
+ </ownedLineMappings>
+ <ownedLineMappings name="bold" domainClass="EClass" semanticCandidatesExpression="feature:eContents" headerLabelExpression="bold">
+ <defaultForeground labelFormat="bold">
+ <foreGroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ </defaultForeground>
+ </ownedLineMappings>
+ <ownedLineMappings name="italic" domainClass="EClass" semanticCandidatesExpression="feature:eContents" headerLabelExpression="italic">
+ <defaultForeground labelFormat="italic">
+ <foreGroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ </defaultForeground>
+ </ownedLineMappings>
+ <ownedLineMappings name="bold_italic" domainClass="EClass" semanticCandidatesExpression="feature:eContents" headerLabelExpression="bold_italic">
+ <defaultForeground labelFormat="bold_italic">
+ <foreGroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ </defaultForeground>
+ </ownedLineMappings>
+ <ownedColumnMappings name="fontFormatcol" headerLabelExpression="fontFormat" featureName="*" labelExpression="[line.label/]"/>
+ </ownedRepresentations>
+ </ownedViewpoints>
+</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 d7e2855cb9..6ed695a400 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
@@ -104,6 +104,7 @@ import org.eclipse.sirius.tests.unit.diagram.migration.ComputedStyleDescriptionC
import org.eclipse.sirius.tests.unit.diagram.migration.CorruptedViewsMigrationTests;
import org.eclipse.sirius.tests.unit.diagram.migration.DDiagramSetRemovalMigrationTest;
import org.eclipse.sirius.tests.unit.diagram.migration.DiagramSplitMigrationTest;
+import org.eclipse.sirius.tests.unit.diagram.migration.FontFormatMigrationTest;
import org.eclipse.sirius.tests.unit.diagram.migration.FontStyleForDNodeListElementMigrationTest;
import org.eclipse.sirius.tests.unit.diagram.migration.FragmentedFilesMigrationTest;
import org.eclipse.sirius.tests.unit.diagram.migration.ListContainerAttributeMigrationTest;
@@ -194,6 +195,7 @@ public class AllCommonPluginTests extends TestCase {
suite.addTestSuite(ComputedStyleDescriptionCachePackingFileMigrationParticipantTests.class);
suite.addTestSuite(RgbValuesEDataTypeMigrationTest.class);
suite.addTestSuite(ConvertViewpointModelingProjectToSiriusModelingProjectTest.class);
+ suite.addTestSuite(FontFormatMigrationTest.class);
suite.addTest(new JUnit4TestAdapter(CommonPreferencesTest.class));
suite.addTest(new JUnit4TestAdapter(GroupingContentProviderTest.class));
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/migration/FontFormatMigrationTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/migration/FontFormatMigrationTest.java
new file mode 100644
index 0000000000..1977ed706c
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/migration/FontFormatMigrationTest.java
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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 java.util.Collection;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.sirius.business.internal.migration.FontFormatMigrationParticipant;
+import org.eclipse.sirius.diagram.DDiagram;
+import org.eclipse.sirius.diagram.DDiagramElement;
+import org.eclipse.sirius.diagram.DNode;
+import org.eclipse.sirius.diagram.DNodeContainer;
+import org.eclipse.sirius.diagram.description.AbstractNodeMapping;
+import org.eclipse.sirius.diagram.description.ContainerMapping;
+import org.eclipse.sirius.diagram.description.DiagramDescription;
+import org.eclipse.sirius.diagram.description.NodeMapping;
+import org.eclipse.sirius.table.metamodel.table.DLine;
+import org.eclipse.sirius.table.metamodel.table.DTable;
+import org.eclipse.sirius.table.metamodel.table.description.LineMapping;
+import org.eclipse.sirius.table.metamodel.table.description.TableDescription;
+import org.eclipse.sirius.tests.SiriusTestsPlugin;
+import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase;
+import org.eclipse.sirius.viewpoint.FontFormat;
+import org.eclipse.sirius.viewpoint.LabelStyle;
+import org.osgi.framework.Version;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * Test the migration of label and label description font formats.
+ *
+ * @author mporhel
+ */
+public class FontFormatMigrationTest extends SiriusDiagramTestCase {
+
+ private String PATH = "/data/unit/migration/do_not_migrate/fontFormat/";
+
+ private String VSM = "/" + SiriusTestsPlugin.PLUGIN_ID + PATH + "fontFormat.odesign";
+
+ private String MODEL = "/" + SiriusTestsPlugin.PLUGIN_ID + PATH + "fontFormat.ecore";
+
+ private String AIRD = "/" + SiriusTestsPlugin.PLUGIN_ID + PATH + "fontFormat.aird";
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ genericSetUp(MODEL, VSM, AIRD);
+ }
+
+ /**
+ * 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 loadedVersion = checkRepresentationFileMigrationStatus(URI.createPlatformPluginURI(AIRD, true), true);
+
+ // Check that the migration is needed.
+ Version migration = new FontFormatMigrationParticipant().getMigrationVersion();
+ assertTrue("The migration must be required on test data.", loadedVersion == null || migration.compareTo(loadedVersion) > 0);
+ }
+
+ /**
+ * Test the migration effect.
+ */
+ public void testFontFormatDescriptionAfterMigration() {
+ DiagramDescription diagDesc = (DiagramDescription) getRepresentationDescription("fontFormatDiag", getViewpointFromName("fontFormat", session));
+ Iterable<AbstractNodeMapping> mappings = Iterables.filter(diagDesc.getDefaultLayer().eContents(), AbstractNodeMapping.class);
+ assertEquals(4, Iterables.size(mappings));
+ Collection<String> oldFontFormats = getOldFontFormats();
+ for (AbstractNodeMapping mapping : mappings) {
+ String expectedStyle = mapping.getName();
+ Collection<FontFormat> labelFormat = getLabelFormat(mapping);
+ checkFontFormat(expectedStyle, labelFormat);
+ oldFontFormats.remove(expectedStyle);
+ }
+ assertTrue("The migration has not been tested on " + oldFontFormats.toString(),oldFontFormats.isEmpty());
+
+ TableDescription tableDesc = (TableDescription) getRepresentationDescription("fontFormatTable", getViewpointFromName("fontFormat", session));
+ Collection<LineMapping> lineMappings = tableDesc.getAllLineMappings();
+ assertEquals(4, lineMappings.size());
+ oldFontFormats = getOldFontFormats();
+ for (LineMapping mapping : lineMappings) {
+ String expectedStyle = mapping.getName();
+ Collection<FontFormat> labelFormat = mapping.getDefaultForeground().getLabelFormat();
+ checkFontFormat(expectedStyle, labelFormat);
+ oldFontFormats.remove(expectedStyle);
+ }
+ assertTrue("The migration has not been tested on " + oldFontFormats.toString(),oldFontFormats.isEmpty());
+ }
+
+ /**
+ * Test the migration effect.
+ */
+ public void testFontFormatAfterMigration() {
+ DDiagram diag = (DDiagram) getRepresentations("fontFormatDiag").iterator().next();
+ Collection<DDiagramElement> ddes = diag.getDiagramElements();
+ assertEquals(4, Iterables.size(ddes));
+ Collection<String> oldFontFormats = getOldFontFormats();
+ for (DDiagramElement dde : ddes) {
+ String expectedStyle = dde.getName();
+ Collection<FontFormat> labelFormat = getLabelFormat(dde);
+ checkFontFormat(expectedStyle, labelFormat);
+ oldFontFormats.remove(expectedStyle);
+ }
+ assertTrue("The migration has not been tested on " + oldFontFormats.toString(),oldFontFormats.isEmpty());
+
+ DTable table = (DTable) getRepresentations("fontFormatTable").iterator().next();
+ Collection<DLine> lines = table.getLines();
+ assertEquals(4, lines.size());
+ oldFontFormats = getOldFontFormats();
+ for (DLine line : lines) {
+ String expectedStyle = line.getLabel();
+ Collection<FontFormat> labelFormat = line.getCurrentStyle().getLabelFormat();
+ checkFontFormat(expectedStyle, labelFormat);
+ oldFontFormats.remove(expectedStyle);
+ }
+ assertTrue("The migration has not been tested on " + oldFontFormats.toString(),oldFontFormats.isEmpty());
+ }
+
+ private Collection<String> getOldFontFormats() {
+ return Lists.newArrayList("normal", "bold", "italic", "bold_italic");
+ }
+
+ private Collection<FontFormat> getLabelFormat(AbstractNodeMapping mapping) {
+ Collection<FontFormat> fontFormat = null;
+ if (mapping instanceof NodeMapping) {
+ fontFormat = ((NodeMapping) mapping).getStyle().getLabelFormat();
+ } else if (mapping instanceof ContainerMapping) {
+ fontFormat = ((ContainerMapping) mapping).getStyle().getLabelFormat();
+ }
+ return fontFormat;
+ }
+
+ private Collection<FontFormat> getLabelFormat(DDiagramElement dde) {
+ Collection<FontFormat> fontFormat = null;
+ if (dde instanceof DNode) {
+ fontFormat = ((LabelStyle) ((DNode) dde).getStyle()).getLabelFormat();
+ } else if (dde instanceof DNodeContainer) {
+ fontFormat = ((LabelStyle) ((DNodeContainer) dde).getStyle()).getLabelFormat();
+ }
+ return fontFormat;
+ }
+
+ private void checkFontFormat(String name, Collection<FontFormat> labelFormat) {
+ if ("normal".equals(name)) {
+ assertTrue(labelFormat.isEmpty());
+ } else if ("bold".equals(name)) {
+ assertEquals(1, labelFormat.size());
+ assertTrue(labelFormat.contains(FontFormat.BOLD_LITERAL));
+ } else if ("italic".equals(name)) {
+ assertEquals(1, labelFormat.size());
+ assertTrue(labelFormat.contains(FontFormat.ITALIC_LITERAL));
+ } else if ("bold_italic".equals(name)) {
+ assertEquals(2, labelFormat.size());
+ assertTrue(labelFormat.contains(FontFormat.BOLD_LITERAL));
+ assertTrue(labelFormat.contains(FontFormat.ITALIC_LITERAL));
+ } else {
+ fail("The test data must contains only expected style ");
+ }
+ }
+}
diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/migration/FontFormatMigrationParticipant.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/migration/FontFormatMigrationParticipant.java
index 8ac2f3d8ca..552d94003c 100644
--- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/migration/FontFormatMigrationParticipant.java
+++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/migration/FontFormatMigrationParticipant.java
@@ -43,26 +43,26 @@ public class FontFormatMigrationParticipant extends AbstractMigrationParticipant
@Override
public Object getValue(EObject object, EStructuralFeature feature, Object value, String loadedVersion) {
- List<FontFormat> labelFormat = Lists.newArrayList();
- // All features typed by FontFormat have been modified: the cardinality
- // has been changed from [0..1] to [0..n], the value, which was a
- // FontFormat, now has to be a list of FontFormat.
- // The previous "normal" value correspond to an empty list.
- if (feature.getEType() == ViewpointPackage.Literals.FONT_FORMAT && value instanceof String) {
- String oldFontFormat = (String) value;
- if (oldFontFormat.contains(ITALIC)) {
- FontFormatHelper.setFontFormat(labelFormat, FontFormat.ITALIC_LITERAL);
+ if (Version.parseVersion(loadedVersion).compareTo(FontFormatMigrationParticipant.MIGRATION_VERSION) < 0) {
+ // All features typed by FontFormat have been modified: the
+ // cardinality has been changed from [0..1] to [0..n], the value,
+ // which was a FontFormat, now has to be a list of FontFormat.
+ // The previous "normal" value correspond to an empty list, it was
+ // the default value and was not serialized.
+ if (feature.getEType() == ViewpointPackage.Literals.FONT_FORMAT && value instanceof String) {
+ List<FontFormat> labelFormat = Lists.newArrayList();
+ String oldFontFormat = (String) value;
+ if (oldFontFormat.contains(ITALIC)) {
+ FontFormatHelper.setFontFormat(labelFormat, FontFormat.ITALIC_LITERAL);
+ }
+ // The previous "bold_italic" value is treated by the two
+ // "if contains" blocks.
+ if (oldFontFormat.contains(BOLD)) {
+ FontFormatHelper.setFontFormat(labelFormat, FontFormat.BOLD_LITERAL);
+ }
+ return labelFormat.toString().replaceAll(",", "").replace("[", "").replace("]", "");
}
- // The previous "bold_italic" value is treated by the two
- // "if contains" blocks.
- if (oldFontFormat.contains(BOLD)) {
- FontFormatHelper.setFontFormat(labelFormat, FontFormat.BOLD_LITERAL);
- }
- }
-
- if (labelFormat.isEmpty()) {
- return null;
}
- return labelFormat.toString().replaceAll(",", "").replace("[", "").replace("]", "");
+ return null;
}
}

Back to the top