Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Fasani2017-05-02 16:23:41 +0000
committerLaurent Fasani2017-05-05 09:37:15 +0000
commit995f880c08bfdea953166e79495b56bfe7b403c1 (patch)
tree61c38ea2facd0e96062e11c9c1839e0e3122a1d0 /plugins/org.eclipse.sirius.tests.junit
parentad4113a17b605c548d363eef70fbc4ed549a799b (diff)
downloadorg.eclipse.sirius-995f880c08bfdea953166e79495b56bfe7b403c1.tar.gz
org.eclipse.sirius-995f880c08bfdea953166e79495b56bfe7b403c1.tar.xz
org.eclipse.sirius-995f880c08bfdea953166e79495b56bfe7b403c1.zip
[493353] Add a mean to store custom data on DRepresentationDescriptor
* Add DAnnotation.references feature and DRepresentationDescriptor inheritance from DModelElement * This feature allows to add custom additional data on DRepresentationDescriptor. These data will be useful to not be forced to load DRepresentation(when lazy loading will be operational). * Add an helper to retrieve impacted DRepresentationDescriptor * Add a junit test * Update release notes Bug:493353 Change-Id: Ie92285497b896d2d7d8bc6f35256080cebb4d53c Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
Diffstat (limited to 'plugins/org.eclipse.sirius.tests.junit')
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/data/unit/mm/annotation/annotation.aird532
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/data/unit/mm/annotation/annotation.ecore6
-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/api/mm/DAnnotationTest.java115
4 files changed, 655 insertions, 0 deletions
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/mm/annotation/annotation.aird b/plugins/org.eclipse.sirius.tests.junit/data/unit/mm/annotation/annotation.aird
new file mode 100644
index 0000000000..fe68be37f1
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/mm/annotation/annotation.aird
@@ -0,0 +1,532 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI 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">
+ <viewpoint:DAnalysis
+ xmi:id="_TLM7QC_aEee7g4P9nJOL3Q"
+ selectedViews="_gOkq8C_aEee7g4P9nJOL3Q"
+ version="12.0.0.201704191300">
+ <semanticResources>annotation.ecore</semanticResources>
+ <ownedViews
+ xmi:type="viewpoint:DView"
+ xmi:id="_gOkq8C_aEee7g4P9nJOL3Q">
+ <viewpoint
+ xmi:type="description:Viewpoint"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']"/>
+ <ownedRepresentationDescriptors
+ xmi:type="viewpoint:DRepresentationDescriptor"
+ xmi:id="_gYxIwC_aEee7g4P9nJOL3Q"
+ name="root package entities1"
+ repPath="#_gYuFcC_aEee7g4P9nJOL3Q">
+ <eAnnotations
+ xmi:type="description:DAnnotation"
+ xmi:id="_QZ9GMC_bEee7g4P9nJOL3Q"
+ source="dummy">
+ <references
+ xmi:type="ecore:EClass"
+ href="annotation.ecore#//NewEClass1"/>
+ <references
+ xmi:type="ecore:EClass"
+ href="annotation.ecore#//NewEClass2"/>
+ </eAnnotations>
+ <description
+ xmi:type="description_1:DiagramDescription"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
+ <target
+ xmi:type="ecore:EPackage"
+ href="annotation.ecore#/"/>
+ </ownedRepresentationDescriptors>
+ <ownedRepresentationDescriptors
+ xmi:type="viewpoint:DRepresentationDescriptor"
+ xmi:id="_7O3oiS_aEee7g4P9nJOL3Q"
+ name="root package entities2"
+ repPath="#_7O3ogC_aEee7g4P9nJOL3Q">
+ <description
+ xmi:type="description_1:DiagramDescription"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
+ <target
+ xmi:type="ecore:EPackage"
+ href="annotation.ecore#/"/>
+ </ownedRepresentationDescriptors>
+ <ownedRepresentationDescriptors
+ xmi:type="viewpoint:DRepresentationDescriptor"
+ xmi:id="_I77OYC_bEee7g4P9nJOL3Q"
+ name="root package entities3"
+ repPath="#_I76nUC_bEee7g4P9nJOL3Q">
+ <description
+ xmi:type="description_1:DiagramDescription"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
+ <target
+ xmi:type="ecore:EPackage"
+ href="annotation.ecore#/"/>
+ </ownedRepresentationDescriptors>
+ </ownedViews>
+ </viewpoint:DAnalysis>
+ <diagram:DSemanticDiagram
+ xmi:id="_gYuFcC_aEee7g4P9nJOL3Q"
+ name="root package entities1">
+ <ownedAnnotationEntries
+ xmi:type="description:AnnotationEntry"
+ xmi:id="_gYuFcS_aEee7g4P9nJOL3Q"
+ source="DANNOTATION_CUSTOMIZATION_KEY">
+ <data
+ xmi:type="diagram:ComputedStyleDescriptionRegistry"
+ xmi:id="_gYuFci_aEee7g4P9nJOL3Q"/>
+ </ownedAnnotationEntries>
+ <ownedAnnotationEntries
+ xmi:type="description:AnnotationEntry"
+ xmi:id="_gZEDsC_aEee7g4P9nJOL3Q"
+ source="GMF_DIAGRAMS">
+ <data
+ xmi:type="notation:Diagram"
+ xmi:id="_gZEDsS_aEee7g4P9nJOL3Q"
+ type="Sirius"
+ element="_gYuFcC_aEee7g4P9nJOL3Q"
+ measurementUnit="Pixel">
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_it7pUC_aEee7g4P9nJOL3Q"
+ type="2003"
+ element="_irsNoC_aEee7g4P9nJOL3Q">
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_iuCXAC_aEee7g4P9nJOL3Q"
+ type="5007"/>
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_iuEzQC_aEee7g4P9nJOL3Q"
+ type="7004">
+ <styles
+ xmi:type="notation:SortingStyle"
+ xmi:id="_iuEzQS_aEee7g4P9nJOL3Q"/>
+ <styles
+ xmi:type="notation:FilteringStyle"
+ xmi:id="_iuEzQi_aEee7g4P9nJOL3Q"/>
+ </children>
+ <styles
+ xmi:type="notation:ShapeStyle"
+ xmi:id="_it7pUS_aEee7g4P9nJOL3Q"
+ fontName="Segoe UI"
+ fontHeight="8"/>
+ <layoutConstraint
+ xmi:type="notation:Bounds"
+ xmi:id="_it7pUi_aEee7g4P9nJOL3Q"
+ x="456"
+ y="96"/>
+ </children>
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_i-J2oC_aEee7g4P9nJOL3Q"
+ type="2003"
+ element="_i9kAwC_aEee7g4P9nJOL3Q">
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_i-KdsC_aEee7g4P9nJOL3Q"
+ type="5007"/>
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_i-KdsS_aEee7g4P9nJOL3Q"
+ type="7004">
+ <styles
+ xmi:type="notation:SortingStyle"
+ xmi:id="_i-Kdsi_aEee7g4P9nJOL3Q"/>
+ <styles
+ xmi:type="notation:FilteringStyle"
+ xmi:id="_i-Kdsy_aEee7g4P9nJOL3Q"/>
+ </children>
+ <styles
+ xmi:type="notation:ShapeStyle"
+ xmi:id="_i-J2oS_aEee7g4P9nJOL3Q"
+ fontName="Segoe UI"
+ fontHeight="8"/>
+ <layoutConstraint
+ xmi:type="notation:Bounds"
+ xmi:id="_i-J2oi_aEee7g4P9nJOL3Q"
+ x="168"
+ y="96"/>
+ </children>
+ <styles
+ xmi:type="notation:DiagramStyle"
+ xmi:id="_gZEDsi_aEee7g4P9nJOL3Q"/>
+ </data>
+ </ownedAnnotationEntries>
+ <ownedDiagramElements
+ xmi:type="diagram:DNodeList"
+ xmi:id="_irsNoC_aEee7g4P9nJOL3Q"
+ name="NewEClass1"
+ tooltipText="root.NewEClass1">
+ <target
+ xmi:type="ecore:EClass"
+ href="annotation.ecore#//NewEClass1"/>
+ <semanticElements
+ xmi:type="ecore:EClass"
+ href="annotation.ecore#//NewEClass1"/>
+ <ownedStyle
+ xmi:type="diagram:FlatContainerStyle"
+ xmi:id="_isBk0C_aEee7g4P9nJOL3Q"
+ borderSize="1"
+ borderSizeComputationExpression="1"
+ backgroundStyle="GradientTopToBottom">
+ <description
+ xmi:type="style:FlatContainerStyleDescription"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
+ </ownedStyle>
+ <actualMapping
+ xmi:type="description_1:ContainerMapping"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
+ </ownedDiagramElements>
+ <ownedDiagramElements
+ xmi:type="diagram:DNodeList"
+ xmi:id="_i9kAwC_aEee7g4P9nJOL3Q"
+ name="NewEClass2"
+ tooltipText="root.NewEClass2">
+ <target
+ xmi:type="ecore:EClass"
+ href="annotation.ecore#//NewEClass2"/>
+ <semanticElements
+ xmi:type="ecore:EClass"
+ href="annotation.ecore#//NewEClass2"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle
+ xmi:type="diagram:FlatContainerStyle"
+ xmi:id="_i9kn0C_aEee7g4P9nJOL3Q"
+ borderSize="1"
+ borderSizeComputationExpression="1"
+ backgroundStyle="GradientTopToBottom">
+ <description
+ xmi:type="style:FlatContainerStyleDescription"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
+ </ownedStyle>
+ <actualMapping
+ xmi:type="description_1:ContainerMapping"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
+ </ownedDiagramElements>
+ <description
+ xmi:type="description_1:DiagramDescription"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
+ <filterVariableHistory
+ xmi:type="diagram:FilterVariableHistory"
+ xmi:id="_gYuFdC_aEee7g4P9nJOL3Q"/>
+ <activatedLayers
+ xmi:type="description_1:Layer"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer"/>
+ <activatedLayers
+ xmi:type="description_1:AdditionalLayer"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Package']"/>
+ <target
+ xmi:type="ecore:EPackage"
+ href="annotation.ecore#/"/>
+ </diagram:DSemanticDiagram>
+ <diagram:DSemanticDiagram
+ xmi:id="_7O3ogC_aEee7g4P9nJOL3Q"
+ name="root package entities2">
+ <ownedAnnotationEntries
+ xmi:type="description:AnnotationEntry"
+ xmi:id="_7O3ogS_aEee7g4P9nJOL3Q"
+ source="DANNOTATION_CUSTOMIZATION_KEY">
+ <data
+ xmi:type="diagram:ComputedStyleDescriptionRegistry"
+ xmi:id="_7O3ogi_aEee7g4P9nJOL3Q"/>
+ </ownedAnnotationEntries>
+ <ownedAnnotationEntries
+ xmi:type="description:AnnotationEntry"
+ xmi:id="_7O4PkC_aEee7g4P9nJOL3Q"
+ source="GMF_DIAGRAMS">
+ <data
+ xmi:type="notation:Diagram"
+ xmi:id="_7O4PkS_aEee7g4P9nJOL3Q"
+ type="Sirius"
+ element="_7O3ogC_aEee7g4P9nJOL3Q"
+ measurementUnit="Pixel">
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_7O4Pky_aEee7g4P9nJOL3Q"
+ type="2003"
+ element="_7O3ohC_aEee7g4P9nJOL3Q">
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_7O6EwC_aEee7g4P9nJOL3Q"
+ type="5007"/>
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_7O6EwS_aEee7g4P9nJOL3Q"
+ type="7004">
+ <styles
+ xmi:type="notation:SortingStyle"
+ xmi:id="_7O6Ewi_aEee7g4P9nJOL3Q"/>
+ <styles
+ xmi:type="notation:FilteringStyle"
+ xmi:id="_7O6Ewy_aEee7g4P9nJOL3Q"/>
+ </children>
+ <styles
+ xmi:type="notation:ShapeStyle"
+ xmi:id="_7O4PlC_aEee7g4P9nJOL3Q"
+ fontName="Segoe UI"
+ fontHeight="8"/>
+ <layoutConstraint
+ xmi:type="notation:Bounds"
+ xmi:id="_7O4PlS_aEee7g4P9nJOL3Q"/>
+ </children>
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_7O6r0C_aEee7g4P9nJOL3Q"
+ type="2003"
+ element="_7O3ohi_aEee7g4P9nJOL3Q">
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_7O7S4C_aEee7g4P9nJOL3Q"
+ type="5007"/>
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_7O7S4S_aEee7g4P9nJOL3Q"
+ type="7004">
+ <styles
+ xmi:type="notation:SortingStyle"
+ xmi:id="_7O7S4i_aEee7g4P9nJOL3Q"/>
+ <styles
+ xmi:type="notation:FilteringStyle"
+ xmi:id="_7O7S4y_aEee7g4P9nJOL3Q"/>
+ </children>
+ <styles
+ xmi:type="notation:ShapeStyle"
+ xmi:id="_7O6r0S_aEee7g4P9nJOL3Q"
+ fontName="Segoe UI"
+ fontHeight="8"/>
+ <layoutConstraint
+ xmi:type="notation:Bounds"
+ xmi:id="_7O6r0i_aEee7g4P9nJOL3Q"
+ x="156"/>
+ </children>
+ <styles
+ xmi:type="notation:DiagramStyle"
+ xmi:id="_7O4Pki_aEee7g4P9nJOL3Q"/>
+ </data>
+ </ownedAnnotationEntries>
+ <ownedDiagramElements
+ xmi:type="diagram:DNodeList"
+ xmi:id="_7O3ohC_aEee7g4P9nJOL3Q"
+ name="NewEClass1"
+ tooltipText="root.NewEClass1">
+ <target
+ xmi:type="ecore:EClass"
+ href="annotation.ecore#//NewEClass1"/>
+ <semanticElements
+ xmi:type="ecore:EClass"
+ href="annotation.ecore#//NewEClass1"/>
+ <ownedStyle
+ xmi:type="diagram:FlatContainerStyle"
+ xmi:id="_7O3ohS_aEee7g4P9nJOL3Q"
+ borderSize="1"
+ borderSizeComputationExpression="1"
+ backgroundStyle="GradientTopToBottom">
+ <description
+ xmi:type="style:FlatContainerStyleDescription"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
+ </ownedStyle>
+ <actualMapping
+ xmi:type="description_1:ContainerMapping"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
+ </ownedDiagramElements>
+ <ownedDiagramElements
+ xmi:type="diagram:DNodeList"
+ xmi:id="_7O3ohi_aEee7g4P9nJOL3Q"
+ name="NewEClass2"
+ tooltipText="root.NewEClass2">
+ <target
+ xmi:type="ecore:EClass"
+ href="annotation.ecore#//NewEClass2"/>
+ <semanticElements
+ xmi:type="ecore:EClass"
+ href="annotation.ecore#//NewEClass2"/>
+ <ownedStyle
+ xmi:type="diagram:FlatContainerStyle"
+ xmi:id="_7O3ohy_aEee7g4P9nJOL3Q"
+ borderSize="1"
+ borderSizeComputationExpression="1"
+ backgroundStyle="GradientTopToBottom">
+ <description
+ xmi:type="style:FlatContainerStyleDescription"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
+ </ownedStyle>
+ <actualMapping
+ xmi:type="description_1:ContainerMapping"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
+ </ownedDiagramElements>
+ <description
+ xmi:type="description_1:DiagramDescription"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
+ <filterVariableHistory
+ xmi:type="diagram:FilterVariableHistory"
+ xmi:id="_7O3oiC_aEee7g4P9nJOL3Q"/>
+ <activatedLayers
+ xmi:type="description_1:Layer"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer"/>
+ <activatedLayers
+ xmi:type="description_1:AdditionalLayer"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Package']"/>
+ <target
+ xmi:type="ecore:EPackage"
+ href="annotation.ecore#/"/>
+ </diagram:DSemanticDiagram>
+ <diagram:DSemanticDiagram
+ xmi:id="_I76nUC_bEee7g4P9nJOL3Q"
+ name="root package entities3">
+ <ownedAnnotationEntries
+ xmi:type="description:AnnotationEntry"
+ xmi:id="_I76nUS_bEee7g4P9nJOL3Q"
+ source="DANNOTATION_CUSTOMIZATION_KEY">
+ <data
+ xmi:type="diagram:ComputedStyleDescriptionRegistry"
+ xmi:id="_I76nUi_bEee7g4P9nJOL3Q"/>
+ </ownedAnnotationEntries>
+ <ownedAnnotationEntries
+ xmi:type="description:AnnotationEntry"
+ xmi:id="_I771cC_bEee7g4P9nJOL3Q"
+ source="GMF_DIAGRAMS">
+ <data
+ xmi:type="notation:Diagram"
+ xmi:id="_I771cS_bEee7g4P9nJOL3Q"
+ type="Sirius"
+ element="_I76nUC_bEee7g4P9nJOL3Q"
+ measurementUnit="Pixel">
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_I78cgC_bEee7g4P9nJOL3Q"
+ type="2003"
+ element="_I76nVC_bEee7g4P9nJOL3Q">
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_I78cgy_bEee7g4P9nJOL3Q"
+ type="5007"/>
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_I79DkC_bEee7g4P9nJOL3Q"
+ type="7004">
+ <styles
+ xmi:type="notation:SortingStyle"
+ xmi:id="_I79DkS_bEee7g4P9nJOL3Q"/>
+ <styles
+ xmi:type="notation:FilteringStyle"
+ xmi:id="_I79Dki_bEee7g4P9nJOL3Q"/>
+ </children>
+ <styles
+ xmi:type="notation:ShapeStyle"
+ xmi:id="_I78cgS_bEee7g4P9nJOL3Q"
+ fontName="Segoe UI"
+ fontHeight="8"/>
+ <layoutConstraint
+ xmi:type="notation:Bounds"
+ xmi:id="_I78cgi_bEee7g4P9nJOL3Q"/>
+ </children>
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_I79Dky_bEee7g4P9nJOL3Q"
+ type="2003"
+ element="_I76nVi_bEee7g4P9nJOL3Q">
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_I79Dli_bEee7g4P9nJOL3Q"
+ type="5007"/>
+ <children
+ xmi:type="notation:Node"
+ xmi:id="_I79qoC_bEee7g4P9nJOL3Q"
+ type="7004">
+ <styles
+ xmi:type="notation:SortingStyle"
+ xmi:id="_I79qoS_bEee7g4P9nJOL3Q"/>
+ <styles
+ xmi:type="notation:FilteringStyle"
+ xmi:id="_I79qoi_bEee7g4P9nJOL3Q"/>
+ </children>
+ <styles
+ xmi:type="notation:ShapeStyle"
+ xmi:id="_I79DlC_bEee7g4P9nJOL3Q"
+ fontName="Segoe UI"
+ fontHeight="8"/>
+ <layoutConstraint
+ xmi:type="notation:Bounds"
+ xmi:id="_I79DlS_bEee7g4P9nJOL3Q"
+ x="156"/>
+ </children>
+ <styles
+ xmi:type="notation:DiagramStyle"
+ xmi:id="_I771ci_bEee7g4P9nJOL3Q"/>
+ </data>
+ </ownedAnnotationEntries>
+ <ownedDiagramElements
+ xmi:type="diagram:DNodeList"
+ xmi:id="_I76nVC_bEee7g4P9nJOL3Q"
+ name="NewEClass1"
+ tooltipText="root.NewEClass1">
+ <target
+ xmi:type="ecore:EClass"
+ href="annotation.ecore#//NewEClass1"/>
+ <semanticElements
+ xmi:type="ecore:EClass"
+ href="annotation.ecore#//NewEClass1"/>
+ <ownedStyle
+ xmi:type="diagram:FlatContainerStyle"
+ xmi:id="_I76nVS_bEee7g4P9nJOL3Q"
+ borderSize="1"
+ borderSizeComputationExpression="1"
+ backgroundStyle="GradientTopToBottom">
+ <description
+ xmi:type="style:FlatContainerStyleDescription"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
+ </ownedStyle>
+ <actualMapping
+ xmi:type="description_1:ContainerMapping"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
+ </ownedDiagramElements>
+ <ownedDiagramElements
+ xmi:type="diagram:DNodeList"
+ xmi:id="_I76nVi_bEee7g4P9nJOL3Q"
+ name="NewEClass2"
+ tooltipText="root.NewEClass2">
+ <target
+ xmi:type="ecore:EClass"
+ href="annotation.ecore#//NewEClass2"/>
+ <semanticElements
+ xmi:type="ecore:EClass"
+ href="annotation.ecore#//NewEClass2"/>
+ <ownedStyle
+ xmi:type="diagram:FlatContainerStyle"
+ xmi:id="_I76nVy_bEee7g4P9nJOL3Q"
+ borderSize="1"
+ borderSizeComputationExpression="1"
+ backgroundStyle="GradientTopToBottom">
+ <description
+ xmi:type="style:FlatContainerStyleDescription"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
+ </ownedStyle>
+ <actualMapping
+ xmi:type="description_1:ContainerMapping"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
+ </ownedDiagramElements>
+ <description
+ xmi:type="description_1:DiagramDescription"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
+ <filterVariableHistory
+ xmi:type="diagram:FilterVariableHistory"
+ xmi:id="_I76nWC_bEee7g4P9nJOL3Q"/>
+ <activatedLayers
+ xmi:type="description_1:Layer"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer"/>
+ <activatedLayers
+ xmi:type="description_1:AdditionalLayer"
+ href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Package']"/>
+ <target
+ xmi:type="ecore:EPackage"
+ href="annotation.ecore#/"/>
+ </diagram:DSemanticDiagram>
+</xmi:XMI>
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/mm/annotation/annotation.ecore b/plugins/org.eclipse.sirius.tests.junit/data/unit/mm/annotation/annotation.ecore
new file mode 100644
index 0000000000..84e603fb69
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/mm/annotation/annotation.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="root">
+ <eClassifiers xsi:type="ecore:EClass" name="NewEClass1"/>
+ <eClassifiers xsi:type="ecore:EClass" name="NewEClass2"/>
+</ecore:EPackage>
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 8598a2eb99..6b1be59d2c 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
@@ -30,6 +30,7 @@ import org.eclipse.sirius.tests.unit.api.find.FindTest;
import org.eclipse.sirius.tests.unit.api.initialization.InitializationTest;
import org.eclipse.sirius.tests.unit.api.interpreter.CompletionTests;
import org.eclipse.sirius.tests.unit.api.interpreter.crossReferencer.AcceleoCrossReferencerTest;
+import org.eclipse.sirius.tests.unit.api.mm.DAnnotationTest;
import org.eclipse.sirius.tests.unit.api.modelingproject.SaveWhenNoEditorsTests;
import org.eclipse.sirius.tests.unit.api.modelingproject.SemanticResourcesManagementTests;
import org.eclipse.sirius.tests.unit.api.navigator.GroupingContentProviderByContainingTest;
@@ -326,6 +327,7 @@ public class AllCommonPluginTests extends TestCase {
suite.addTestSuite(SubMenusPrioritiesTest.class);
suite.addTestSuite(ZombieViewpointsTest.class);
suite.addTestSuite(Session1MillionTests.class);
+ suite.addTestSuite(DAnnotationTest.class);
}
/**
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/mm/DAnnotationTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/mm/DAnnotationTest.java
new file mode 100644
index 0000000000..a710615df9
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/mm/DAnnotationTest.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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.api.mm;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.sirius.business.api.query.EObjectQuery;
+import org.eclipse.sirius.tests.SiriusTestsPlugin;
+import org.eclipse.sirius.tests.support.api.EclipseTestsSupportHelper;
+import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase;
+import org.eclipse.sirius.viewpoint.DRepresentationDescriptor;
+import org.eclipse.sirius.viewpoint.description.DAnnotation;
+import org.eclipse.sirius.viewpoint.description.DescriptionFactory;
+
+/**
+ * Test setting and getting DAnnotation
+ *
+ * @author lfasani
+ */
+public class DAnnotationTest extends SiriusDiagramTestCase {
+
+ private static final String PATH = "/data/unit/mm/annotation/";
+
+ private static final String SEMANTIC_MODEL_FILENAME = "annotation.ecore";
+
+ private static final String REPRESENTATIONS_FILENAME = "annotation.aird";
+
+ private static final String REPRESENTATION_DESC_PREFIX_NAME = "root package entities";
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ EclipseTestsSupportHelper.INSTANCE.copyFile(SiriusTestsPlugin.PLUGIN_ID, PATH + "/" + SEMANTIC_MODEL_FILENAME, "/" + TEMPORARY_PROJECT_NAME + "/" + SEMANTIC_MODEL_FILENAME);
+ EclipseTestsSupportHelper.INSTANCE.copyFile(SiriusTestsPlugin.PLUGIN_ID, PATH + "/" + REPRESENTATIONS_FILENAME, "/" + TEMPORARY_PROJECT_NAME + "/" + REPRESENTATIONS_FILENAME);
+ genericSetUp(Collections.singleton(TEMPORARY_PROJECT_NAME + "/" + SEMANTIC_MODEL_FILENAME), Collections.emptyList(), TEMPORARY_PROJECT_NAME + "/" + REPRESENTATIONS_FILENAME);
+ }
+
+ /**
+ * This method checks that it is possible to set {@link DAnnotation}
+ * referencing semantic elements on {@link DRepresentationDescriptor} and to
+ * retrieve the impacted {@link DRepresentationDescriptor
+ * DRepresentationDescriptors} from the semantic elements.
+ *
+ * @throws Exception
+ * in case of problem
+ */
+ public void testDAnnotationOnDRepDesc() throws Exception {
+ // annotation.aird contains 3 DRepresentationDescriptors : "root package
+ // entities1", 2 and 3
+ // "root package entities1" already contains DAnnotation with a
+ // reference to NewEClass1
+
+ // check that "root package entities1" is found inverseCrossreferencing
+ // from NewEClass1
+ assertEquals("Bad test data", 1, session.getSemanticResources().size());
+ EClass newEClass1 = (EClass) session.getSemanticResources().iterator().next().getContents().get(0).eContents().get(0);
+
+ List<DRepresentationDescriptor> dRepDescListToCheck = new ArrayList<>();
+ dRepDescListToCheck.add(getRepDesc("1"));
+ checkImpactedDRepDesc(newEClass1, dRepDescListToCheck, "dummy");
+
+ // add DAnnotation on "root package entities2" and check the impacted
+ // DRepresentationDescriptor
+ DRepresentationDescriptor repDesc2 = getRepDesc("2");
+ session.getTransactionalEditingDomain().getCommandStack().execute(new RecordingCommand(session.getTransactionalEditingDomain()) {
+ @Override
+ protected void doExecute() {
+ DAnnotation dAnnotation = DescriptionFactory.eINSTANCE.createDAnnotation();
+ dAnnotation.getReferences().add(newEClass1);
+ repDesc2.getEAnnotations().add(dAnnotation);
+ }
+ });
+ dRepDescListToCheck.add(getRepDesc("2"));
+ checkImpactedDRepDesc(newEClass1, dRepDescListToCheck, null);
+
+ // Check that the result is filtered when a parameter is used with
+ // multiple possible impacted DRepresentation
+ dRepDescListToCheck.remove(getRepDesc("2"));
+ checkImpactedDRepDesc(newEClass1, dRepDescListToCheck, "dummy");
+ }
+
+ private void checkImpactedDRepDesc(EObject impactingEObject, List<DRepresentationDescriptor> expectedImpactedDRepDesc, String key) {
+ List<DRepresentationDescriptor> impactedRepDescriptorFromDAnnotationData = new EObjectQuery(impactingEObject).getImpactedRepDescriptorFromDAnnotationData(key);
+ assertEquals("Bad number of impacted DRepresentationDescriptor", expectedImpactedDRepDesc.size(), impactedRepDescriptorFromDAnnotationData.size());
+ for (DRepresentationDescriptor dRepresentationDescriptor : expectedImpactedDRepDesc) {
+ assertTrue(dRepresentationDescriptor.getName() + " should be found as impacted DRepresentationDescriptor.", impactedRepDescriptorFromDAnnotationData.contains(dRepresentationDescriptor));
+ }
+ }
+
+ private DRepresentationDescriptor getRepDesc(String suffix) {
+ Iterator<DRepresentationDescriptor> iterator = session.getOwnedViews().iterator().next().getOwnedRepresentationDescriptors().iterator();
+ while (iterator.hasNext()) {
+ DRepresentationDescriptor dRepDesc = iterator.next();
+ if (dRepDesc.getName().equals(REPRESENTATION_DESC_PREFIX_NAME + suffix)) {
+ return dRepDesc;
+ }
+ }
+ fail("Bad test data");
+ return null;
+ }
+}

Back to the top