Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGabriel Pascual2014-10-09 09:25:38 +0000
committerGabriel Pascual2014-10-16 15:47:06 +0000
commitccd4ecc63cd7beecd0a0ce0e342524968a38c4f7 (patch)
tree0f70e6a7562ce2aba5d50478c1934963b4385e22 /tests
parent0c2b269879258d46e6c4b34031a0addfac2b1af5 (diff)
downloadorg.eclipse.papyrus-ccd4ecc63cd7beecd0a0ce0e342524968a38c4f7.tar.gz
org.eclipse.papyrus-ccd4ecc63cd7beecd0a0ce0e342524968a38c4f7.tar.xz
org.eclipse.papyrus-ccd4ecc63cd7beecd0a0ce0e342524968a38c4f7.zip
418509: [Class Diagram] Redirecting Associations does not move
association end properties owned by classifiers https://bugs.eclipse.org/bugs/show_bug.cgi?id=418509 - Add correct behaviour during reorientation action - Add unit tests Change-Id: I69d29cfa0eec1491d25f1445529d2e429031c825 Signed-off-by: Gabriel Pascual <gabriel.pascual@all4tec.net>
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/META-INF/MANIFEST.MF69
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/resources/418509/model.di2
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/resources/418509/model.notation124
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/resources/418509/model.uml21
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/AllTests.java56
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/Bug418509_ReorientationAssociation.java166
6 files changed, 376 insertions, 62 deletions
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/META-INF/MANIFEST.MF
index caf1d69bdef..2e85c389cd0 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/META-INF/MANIFEST.MF
@@ -1,34 +1,35 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.junit,
- org.eclipse.emf.transaction,
- org.eclipse.ui.ide,
- org.eclipse.papyrus.junit.framework;bundle-version="1.0.1",
- org.eclipse.papyrus.infra.core;bundle-version="1.0.1",
- org.eclipse.papyrus.uml.tools;bundle-version="1.0.1",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.1",
- org.eclipse.gmf.runtime.notation.edit,
- org.eclipse.papyrus.infra.widgets;bundle-version="1.0.1",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.1",
- org.eclipse.papyrus.uml.diagram.tests;bundle-version="1.0.1",
- org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="1.0.1",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.1",
- org.eclipse.papyrus.junit.utils;bundle-version="1.0.1"
-Export-Package: org.eclipse.papyrus.uml.diagram.common.tests,
- org.eclipse.papyrus.uml.diagram.common.tests.css,
- org.eclipse.papyrus.uml.diagram.common.tests.parser,
- org.eclipse.papyrus.uml.diagram.common.tests.tests
-Bundle-Vendor: %Bundle-Vendor
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.0.1.qualifier
-Bundle-Localization: plugin
-Bundle-Name: %Bundle-Name
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.common.tests.Activat
- or
-Bundle-ManifestVersion: 2
-Bundle-Description: This plugin provides tests for the papyrus plugin
- UML Diagram Common
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.common.tests
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.junit,
+ org.eclipse.emf.transaction,
+ org.eclipse.ui.ide,
+ org.eclipse.papyrus.junit.framework;bundle-version="1.0.1",
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.1",
+ org.eclipse.papyrus.uml.tools;bundle-version="1.0.1",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.1",
+ org.eclipse.gmf.runtime.notation.edit,
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.0.1",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.1",
+ org.eclipse.papyrus.uml.diagram.tests;bundle-version="1.0.1",
+ org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="1.0.1",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.1",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.0.1",
+ org.eclipse.papyrus.uml.diagram.clazz;bundle-version="1.0.1"
+Export-Package: org.eclipse.papyrus.uml.diagram.common.tests,
+ org.eclipse.papyrus.uml.diagram.common.tests.css,
+ org.eclipse.papyrus.uml.diagram.common.tests.parser,
+ org.eclipse.papyrus.uml.diagram.common.tests.tests
+Bundle-Vendor: %Bundle-Vendor
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.0.1.qualifier
+Bundle-Localization: plugin
+Bundle-Name: %Bundle-Name
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.common.tests.Activat
+ or
+Bundle-ManifestVersion: 2
+Bundle-Description: This plugin provides tests for the papyrus plugin
+ UML Diagram Common
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.common.tests
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/resources/418509/model.di b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/resources/418509/model.di
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/resources/418509/model.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/resources/418509/model.notation b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/resources/418509/model.notation
new file mode 100644
index 00000000000..73a72b48ec2
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/resources/418509/model.notation
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_y8nSME-vEeSh_JAKhK0MSw" type="PapyrusUMLClassDiagram" name="418509" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_66fuwE-vEeSh_JAKhK0MSw" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_67LrQE-vEeSh_JAKhK0MSw" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_67l68E-vEeSh_JAKhK0MSw" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_67miAE-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_67miAU-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_67miAk-vEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_67miA0-vEeSh_JAKhK0MSw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_67miBE-vEeSh_JAKhK0MSw" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_67miBU-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_67miBk-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_67miB0-vEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_67miCE-vEeSh_JAKhK0MSw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_67miCU-vEeSh_JAKhK0MSw" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_67miCk-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_67miC0-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_67miDE-vEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_67miDU-vEeSh_JAKhK0MSw"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_6xtmME-vEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_66fuwU-vEeSh_JAKhK0MSw" x="184" y="130" width="164" height="156"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_8kWBcE-vEeSh_JAKhK0MSw" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_8kXPkE-vEeSh_JAKhK0MSw" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_8kXPkU-vEeSh_JAKhK0MSw" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_8kXPkk-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_8kXPk0-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_8kXPlE-vEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_8kXPlU-vEeSh_JAKhK0MSw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_8kX2oE-vEeSh_JAKhK0MSw" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_8kX2oU-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_8kX2ok-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_8kX2o0-vEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_8kX2pE-vEeSh_JAKhK0MSw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_8kYdsE-vEeSh_JAKhK0MSw" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_8kYdsU-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_8kYdsk-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_8kYds0-vEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_8kYdtE-vEeSh_JAKhK0MSw"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_8kS-IE-vEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_8kWBcU-vEeSh_JAKhK0MSw" x="499" y="136" width="169" height="145"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_--9CsE-vEeSh_JAKhK0MSw" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_--9pwE-vEeSh_JAKhK0MSw" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_--9pwU-vEeSh_JAKhK0MSw" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_--9pwk-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_--9pw0-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_--9pxE-vEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_--9pxU-vEeSh_JAKhK0MSw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_--9pxk-vEeSh_JAKhK0MSw" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_--9px0-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_--9pyE-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_--9pyU-vEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_--9pyk-vEeSh_JAKhK0MSw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_---Q0E-vEeSh_JAKhK0MSw" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_---Q0U-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_---Q0k-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_---Q00-vEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_---Q1E-vEeSh_JAKhK0MSw"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_--7NgE-vEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_--9CsU-vEeSh_JAKhK0MSw" x="180" y="312" width="179" height="162"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_BEKbsE-wEeSh_JAKhK0MSw" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_BELCwE-wEeSh_JAKhK0MSw" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_BELCwU-wEeSh_JAKhK0MSw" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_BELCwk-wEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_BELCw0-wEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_BELCxE-wEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_BELCxU-wEeSh_JAKhK0MSw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_BELCxk-wEeSh_JAKhK0MSw" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_BELCx0-wEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_BELCyE-wEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_BELp0E-wEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_BELp0U-wEeSh_JAKhK0MSw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_BELp0k-wEeSh_JAKhK0MSw" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_BELp00-wEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_BELp1E-wEeSh_JAKhK0MSw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_BELp1U-wEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_BELp1k-wEeSh_JAKhK0MSw"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_BEJNkE-wEeSh_JAKhK0MSw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_BEKbsU-wEeSh_JAKhK0MSw" x="502" y="316" width="176" height="153"/>
+ </children>
+ <styles xmi:type="notation:StringValueStyle" xmi:id="_y8nSMU-vEeSh_JAKhK0MSw" name="diagram_compatibility_version" stringValue="1.0.0"/>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_y8nSMk-vEeSh_JAKhK0MSw"/>
+ <styles xmi:type="style:PapyrusViewStyle" xmi:id="_y8nSM0-vEeSh_JAKhK0MSw">
+ <owner xmi:type="uml:Model" href="model.uml#_y15mME-vEeSh_JAKhK0MSw"/>
+ </styles>
+ <element xmi:type="uml:Model" href="model.uml#_y15mME-vEeSh_JAKhK0MSw"/>
+ <edges xmi:type="notation:Connector" xmi:id="_DkfDYE-wEeSh_JAKhK0MSw" type="4001" source="_8kWBcE-vEeSh_JAKhK0MSw" target="_66fuwE-vEeSh_JAKhK0MSw">
+ <children xmi:type="notation:DecorationNode" xmi:id="_DkfqcE-wEeSh_JAKhK0MSw" type="6001">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_DkgRgE-wEeSh_JAKhK0MSw" y="-20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_Dkg4kE-wEeSh_JAKhK0MSw" type="6002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Dkg4kU-wEeSh_JAKhK0MSw" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_DkhfoE-wEeSh_JAKhK0MSw" type="6003">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_DkhfoU-wEeSh_JAKhK0MSw" y="-20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_DkiGsE-wEeSh_JAKhK0MSw" type="6005">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_DkiGsU-wEeSh_JAKhK0MSw" y="14"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_DkiGsk-wEeSh_JAKhK0MSw" type="6033">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_DkiGs0-wEeSh_JAKhK0MSw" y="20"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_DkitwE-wEeSh_JAKhK0MSw" type="6034">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_DkitwU-wEeSh_JAKhK0MSw" y="-20"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_DkfDYU-wEeSh_JAKhK0MSw"/>
+ <element xmi:type="uml:Association" href="model.uml#_Dj3_YE-wEeSh_JAKhK0MSw"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_DkfDYk-wEeSh_JAKhK0MSw" points="[-84, -5, 233, -5]$[-235, -73, 82, -73]"/>
+ </edges>
+</notation:Diagram>
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/resources/418509/model.uml b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/resources/418509/model.uml
new file mode 100644
index 00000000000..4df32a63258
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/resources/418509/model.uml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_y15mME-vEeSh_JAKhK0MSw" name="Model">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_y15mMU-vEeSh_JAKhK0MSw">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Class" xmi:id="_6xtmME-vEeSh_JAKhK0MSw" name="A"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_8kS-IE-vEeSh_JAKhK0MSw" name="B">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_Dj2xQE-wEeSh_JAKhK0MSw" name="a" type="_6xtmME-vEeSh_JAKhK0MSw" association="_Dj3_YE-wEeSh_JAKhK0MSw">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_Dj2xQU-wEeSh_JAKhK0MSw" value="1"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_Dj2xQk-wEeSh_JAKhK0MSw" value="1"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Class" xmi:id="_--7NgE-vEeSh_JAKhK0MSw" name="C"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_BEJNkE-wEeSh_JAKhK0MSw" name="D"/>
+ <packagedElement xmi:type="uml:Association" xmi:id="_Dj3_YE-wEeSh_JAKhK0MSw" name="Association" memberEnd="_Dj3_YU-wEeSh_JAKhK0MSw _Dj2xQE-wEeSh_JAKhK0MSw">
+ <ownedEnd xmi:type="uml:Property" xmi:id="_Dj3_YU-wEeSh_JAKhK0MSw" name="b" type="_8kS-IE-vEeSh_JAKhK0MSw" association="_Dj3_YE-wEeSh_JAKhK0MSw">
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_Dj3_Yk-wEeSh_JAKhK0MSw" value="1"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_Dj3_Y0-wEeSh_JAKhK0MSw" value="1"/>
+ </ownedEnd>
+ </packagedElement>
+</uml:Model>
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/AllTests.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/AllTests.java
index 3d0af9e28b9..0549789ea71 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/AllTests.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/AllTests.java
@@ -1,28 +1,28 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.tests.tests;
-
-
-import org.eclipse.papyrus.uml.diagram.common.tests.css.Bug431694_UndoDeleteTest;
-import org.eclipse.papyrus.uml.diagram.common.tests.parser.HTMLCleanerTestCase;
-import org.eclipse.papyrus.uml.diagram.common.tests.parser.HTMLCornerBentFigureTestCase;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses({ CommonBendpointsTest.class ,HTMLCleanerTestCase.class, HTMLCornerBentFigureTestCase.class, Bug431694_UndoDeleteTest.class})
-public class AllTests {
- // JUnit 4 test suite
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.tests.tests;
+
+
+import org.eclipse.papyrus.uml.diagram.common.tests.css.Bug431694_UndoDeleteTest;
+import org.eclipse.papyrus.uml.diagram.common.tests.parser.HTMLCleanerTestCase;
+import org.eclipse.papyrus.uml.diagram.common.tests.parser.HTMLCornerBentFigureTestCase;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({ CommonBendpointsTest.class, HTMLCleanerTestCase.class, HTMLCornerBentFigureTestCase.class, Bug431694_UndoDeleteTest.class, Bug418509_ReorientationAssociation.class })
+public class AllTests {
+ // JUnit 4 test suite
+}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/Bug418509_ReorientationAssociation.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/Bug418509_ReorientationAssociation.java
new file mode 100644
index 00000000000..533e1194f38
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common.tests/src/org/eclipse/papyrus/uml/diagram/common/tests/tests/Bug418509_ReorientationAssociation.java
@@ -0,0 +1,166 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.tests.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.junit.utils.rules.ModelSetFixture;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.StructuredClassifier;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * The test class to verify that there is no regression in relation to Bug 418509.
+ *
+ * @author Gabriel Pascual
+ */
+public class Bug418509_ReorientationAssociation {
+
+ /** The model set fixture. */
+ @Rule
+ public final ModelSetFixture modelSetFixture = new ModelSetFixture();
+
+
+ /**
+ * Case of an association between A and B, end a is owned by Class B and end b is owned by the association. End a is navigable but not End b. Test changes A to C.
+ */
+ @Test
+ @PluginResource("/resources/418509/model.di")
+ public void testCase1() {
+
+ // Get data test
+ Association association = (Association) modelSetFixture.getModel().getMember("Association");
+ NamedElement target = modelSetFixture.getModel().getMember("C");
+ NamedElement source = modelSetFixture.getModel().getMember("A");
+ StructuredClassifier sourceAssiociation = (StructuredClassifier) modelSetFixture.getModel().getMember("B");
+
+
+ // Build a request and execute it
+ ReorientRelationshipRequest request = new ReorientRelationshipRequest(association, target, source, ReorientRequest.REORIENT_TARGET);
+ ICommand command = new CAssociationReorientCommand(request);
+ modelSetFixture.getEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(command));
+
+ assertNotNull(association.getMemberEnd(target.getName().toLowerCase(), (Type) target));
+ assertNotNull(sourceAssiociation.getOwnedAttribute(target.getName().toLowerCase(), (Type) target));
+ assertNotNull(association.getOwnedEnd(sourceAssiociation.getName().toLowerCase(), sourceAssiociation));
+
+
+ }
+
+ /**
+ * Case of an association between A and B, end a is owned by Class B and end b is owned by the association. End a is navigable but not End b. Test changes B to D.
+ */
+ @Test
+ @PluginResource("/resources/418509/model.di")
+ public void testCase2() {
+
+ // Get data test
+ Association association = (Association) modelSetFixture.getModel().getMember("Association");
+ StructuredClassifier target = (StructuredClassifier) modelSetFixture.getModel().getMember("D");
+ NamedElement source = modelSetFixture.getModel().getMember("B");
+ StructuredClassifier targetAssiociation = (StructuredClassifier) modelSetFixture.getModel().getMember("A");
+
+
+ // Build a request and execute it
+ ReorientRelationshipRequest request = new ReorientRelationshipRequest(association, target, source, ReorientRequest.REORIENT_SOURCE);
+ ICommand command = new CAssociationReorientCommand(request);
+ modelSetFixture.getEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(command));
+
+ assertNotNull(association.getMemberEnd(target.getName().toLowerCase(), target));
+ assertNotNull(target.getOwnedAttribute(targetAssiociation.getName().toLowerCase(), targetAssiociation));
+ assertNotNull(association.getOwnedEnd(target.getName().toLowerCase(), target));
+
+
+ }
+
+ /**
+ * Case of an association between A and B, end a is owned by Class B and end b is owned by Class A. Both ends are navigable. Test changes B to D.
+ */
+ @Test
+ @PluginResource("/resources/418509/model.di")
+ public void testCase3() {
+
+ // Get data test
+ Association association = (Association) modelSetFixture.getModel().getMember("Association");
+ StructuredClassifier target = (StructuredClassifier) modelSetFixture.getModel().getMember("D");
+ StructuredClassifier source = (StructuredClassifier) modelSetFixture.getModel().getMember("B");
+ StructuredClassifier targetAssiociation = (StructuredClassifier) modelSetFixture.getModel().getMember("A");
+
+ // Set End a to Class B
+ SetValueCommand setCommand = new SetValueCommand(new SetRequest(targetAssiociation, UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute(), association.getMemberEnd(source.getName().toLowerCase(), source)));
+ modelSetFixture.getEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(setCommand));
+
+ assertTrue(association.getOwnedEnds().isEmpty());
+
+ // Build a request and execute it
+ ReorientRelationshipRequest request = new ReorientRelationshipRequest(association, target, source, ReorientRequest.REORIENT_SOURCE);
+ ICommand command = new CAssociationReorientCommand(request);
+ modelSetFixture.getEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(command));
+
+ assertTrue(association.getOwnedEnds().isEmpty());
+ assertNotNull(association.getMemberEnd(target.getName().toLowerCase(), target));
+ assertNotNull(target.getOwnedAttribute(targetAssiociation.getName().toLowerCase(), targetAssiociation));
+ assertNull(source.getOwnedAttribute(targetAssiociation.getName().toLowerCase(), targetAssiociation));
+
+
+ }
+
+ /**
+ * Case of an association between A and B, Both ends are not navigable and contained by the association. Test changes B to D.
+ */
+ @Test
+ @PluginResource("/resources/418509/model.di")
+ public void testCase4() {
+
+ // Get data test
+ Association association = (Association) modelSetFixture.getModel().getMember("Association");
+ StructuredClassifier target = (StructuredClassifier) modelSetFixture.getModel().getMember("D");
+ StructuredClassifier source = (StructuredClassifier) modelSetFixture.getModel().getMember("B");
+ StructuredClassifier targetAssiociation = (StructuredClassifier) modelSetFixture.getModel().getMember("A");
+
+ // Set End a to association
+ SetValueCommand setCommand = new SetValueCommand(new SetRequest(association, UMLPackage.eINSTANCE.getAssociation_OwnedEnd(), association.getMemberEnd(targetAssiociation.getName().toLowerCase(), targetAssiociation)));
+ modelSetFixture.getEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(setCommand));
+
+ assertEquals(2, association.getOwnedEnds().size());
+
+ // Build a request and execute it
+ ReorientRelationshipRequest request = new ReorientRelationshipRequest(association, target, source, ReorientRequest.REORIENT_SOURCE);
+ ICommand command = new CAssociationReorientCommand(request);
+ modelSetFixture.getEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(command));
+
+ assertEquals(2, association.getOwnedEnds().size());
+ assertNotNull(association.getOwnedEnd(target.getName().toLowerCase(), target));
+ assertNotNull(association.getOwnedEnd(targetAssiociation.getName().toLowerCase(), targetAssiociation));
+ assertFalse(target.eIsSet(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute()));
+ assertFalse(targetAssiociation.eIsSet(UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute()));
+
+ }
+}

Back to the top