Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian W. Damus2015-08-14 23:15:30 +0000
committerChristian W. Damus2015-08-14 23:15:30 +0000
commit0af7110e6622feb819150c78173479a38e5d5e5f (patch)
tree1c9c7868a2904d6f344a7da350c7a9508ccc59b3 /tests
parent882d6aede72aee1ec71d25fd1aea77acbb8813ba (diff)
downloadorg.eclipse.papyrus-0af7110e6622feb819150c78173479a38e5d5e5f.tar.gz
org.eclipse.papyrus-0af7110e6622feb819150c78173479a38e5d5e5f.tar.xz
org.eclipse.papyrus-0af7110e6622feb819150c78173479a38e5d5e5f.zip
Bug 473148: [Synchronization] Classes show attributes for association ends
https://bugs.eclipse.org/bugs/show_bug.cgi?id=473148 Ensure that the canonical edit policy only visualizes association ends inside the attribute compartment in the case that the end's association will not be visualized. Includes new JUnit tests for association ends that do and that do not have their associations presented canonically. Another existing test needed to be adjusted for this new behaviour.
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/bugs/473148.di2
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/bugs/473148.notation61
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/bugs/473148.uml20
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.uml11
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCanonicalTest.java10
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/EditingInModelInClassDiagramTest.java42
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/RegressionTest.java35
7 files changed, 162 insertions, 19 deletions
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/bugs/473148.di b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/bugs/473148.di
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/bugs/473148.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/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/bugs/473148.notation b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/bugs/473148.notation
new file mode 100644
index 00000000000..013f11023e3
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/bugs/473148.notation
@@ -0,0 +1,61 @@
+<?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="_vBl_EELLEeWmC5E_nIZ9vQ" type="PapyrusUMLClassDiagram" name="classes" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_weurcELLEeWmC5E_nIZ9vQ" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_we3OUELLEeWmC5E_nIZ9vQ" type="5029"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_we3OUULLEeWmC5E_nIZ9vQ" type="8510">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_we3OUkLLEeWmC5E_nIZ9vQ" y="5"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_we98AELLEeWmC5E_nIZ9vQ" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_we98AULLEeWmC5E_nIZ9vQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_we98AkLLEeWmC5E_nIZ9vQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_we98A0LLEeWmC5E_nIZ9vQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_we98BELLEeWmC5E_nIZ9vQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_we98BULLEeWmC5E_nIZ9vQ" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_we98BkLLEeWmC5E_nIZ9vQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_we98B0LLEeWmC5E_nIZ9vQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_we98CELLEeWmC5E_nIZ9vQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_we98CULLEeWmC5E_nIZ9vQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_we98CkLLEeWmC5E_nIZ9vQ" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_we98C0LLEeWmC5E_nIZ9vQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_we98DELLEeWmC5E_nIZ9vQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_we98DULLEeWmC5E_nIZ9vQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_we98DkLLEeWmC5E_nIZ9vQ"/>
+ </children>
+ <element xmi:type="uml:Class" href="473148.uml#_webJcELLEeWmC5E_nIZ9vQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_weurcULLEeWmC5E_nIZ9vQ" x="61" y="157"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_xIezEELLEeWmC5E_nIZ9vQ" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_xIfaIELLEeWmC5E_nIZ9vQ" type="5029"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_xIfaIULLEeWmC5E_nIZ9vQ" type="8510">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_xIfaIkLLEeWmC5E_nIZ9vQ" y="5"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_xIfaI0LLEeWmC5E_nIZ9vQ" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_xIfaJELLEeWmC5E_nIZ9vQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_xIfaJULLEeWmC5E_nIZ9vQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_xIfaJkLLEeWmC5E_nIZ9vQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_xIfaJ0LLEeWmC5E_nIZ9vQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_xIfaKELLEeWmC5E_nIZ9vQ" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_xIfaKULLEeWmC5E_nIZ9vQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_xIfaKkLLEeWmC5E_nIZ9vQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_xIfaK0LLEeWmC5E_nIZ9vQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_xIfaLELLEeWmC5E_nIZ9vQ"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_xIfaLULLEeWmC5E_nIZ9vQ" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_xIfaLkLLEeWmC5E_nIZ9vQ"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_xIfaL0LLEeWmC5E_nIZ9vQ"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_xIfaMELLEeWmC5E_nIZ9vQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_xIfaMULLEeWmC5E_nIZ9vQ"/>
+ </children>
+ <element xmi:type="uml:Class" href="473148.uml#_xIcW0ELLEeWmC5E_nIZ9vQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_xIezEULLEeWmC5E_nIZ9vQ" x="325" y="158"/>
+ </children>
+ <styles xmi:type="notation:StringValueStyle" xmi:id="_vBl_EULLEeWmC5E_nIZ9vQ" name="diagram_compatibility_version" stringValue="1.1.0"/>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_vBl_EkLLEeWmC5E_nIZ9vQ"/>
+ <styles xmi:type="style:PapyrusViewStyle" xmi:id="_vBl_E0LLEeWmC5E_nIZ9vQ">
+ <owner xmi:type="uml:Model" href="473148.uml#_u8yXkELLEeWmC5E_nIZ9vQ"/>
+ </styles>
+ <element xmi:type="uml:Model" href="473148.uml#_u8yXkELLEeWmC5E_nIZ9vQ"/>
+</notation:Diagram>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/bugs/473148.uml b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/bugs/473148.uml
new file mode 100644
index 00000000000..0187e00bd20
--- /dev/null
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/bugs/473148.uml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_u8yXkELLEeWmC5E_nIZ9vQ" name="model">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_vWnM0ELLEeWmC5E_nIZ9vQ">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Class" xmi:id="_webJcELLEeWmC5E_nIZ9vQ" name="Class1">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_zCqn0ELLEeWmC5E_nIZ9vQ" name="name">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_2A-zEELLEeWmC5E_nIZ9vQ" name="class2" type="_xIcW0ELLEeWmC5E_nIZ9vQ" association="_2A7vwELLEeWmC5E_nIZ9vQ"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Class" xmi:id="_xIcW0ELLEeWmC5E_nIZ9vQ" name="Class2">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_2A_aIELLEeWmC5E_nIZ9vQ" name="class1" type="_webJcELLEeWmC5E_nIZ9vQ" association="_2A7vwELLEeWmC5E_nIZ9vQ"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Association" xmi:id="_2A7vwELLEeWmC5E_nIZ9vQ" memberEnd="_2A-zEELLEeWmC5E_nIZ9vQ _2A_aIELLEeWmC5E_nIZ9vQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_2A9k8ELLEeWmC5E_nIZ9vQ" source="org.eclipse.papyrus">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_2A-MAELLEeWmC5E_nIZ9vQ" key="nature" value="UML_Nature"/>
+ </eAnnotations>
+ </packagedElement>
+</uml:Model>
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.uml b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.uml
index cacc06880af..c530aa74661 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.uml
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/models/classdiagram_canonical.uml
@@ -30,6 +30,17 @@
</packagedElement>
<packagedElement xmi:type="uml:DataType" xmi:id="_KR5MYMK4EeSkv8vaizVybg" name="Date"/>
<packagedElement xmi:type="uml:Dependency" xmi:id="_mS1QMNCxEeSgLrtEqH-xrA" client="_AINmoMK4EeSkv8vaizVybg" supplier="_KR5MYMK4EeSkv8vaizVybg"/>
+ <packagedElement xmi:type="uml:DataType" xmi:id="_fSZ90ELVEeWmC5E_nIZ9vQ" name="Struct">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_gMoxcELVEeWmC5E_nIZ9vQ" name="name" visibility="public">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_i7uN4ELVEeWmC5E_nIZ9vQ" name="age" visibility="public">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_mHoJMELVEeWmC5E_nIZ9vQ" name="tag" visibility="public">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ </ownedAttribute>
+ </packagedElement>
</packagedElement>
<packagedElement xmi:type="uml:Class" xmi:id="_pmtIkMK3EeSkv8vaizVybg" name="Super"/>
<packagedElement xmi:type="uml:Association" xmi:id="_qkgNkMK3EeSkv8vaizVybg" memberEnd="_qkgNkcK3EeSkv8vaizVybg _qkfmgMK3EeSkv8vaizVybg">
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCanonicalTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCanonicalTest.java
index 1238103af42..269bc27c820 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCanonicalTest.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/AbstractCanonicalTest.java
@@ -84,6 +84,8 @@ import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassAttributeCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassNestedClassifierCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassOperationCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DataTypeAttributeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DataTypeAttributeCompartmentEditPartCN;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.EnumerationEnumerationLiteralCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.PackagePackageableElementCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -230,6 +232,14 @@ public class AbstractCanonicalTest extends AbstractPapyrusTest {
return getCompartment(class_, ClassNestedClassifierCompartmentEditPart.VISUAL_ID);
}
+ protected IGraphicalEditPart getDataTypeAttributeCompartment(IGraphicalEditPart dataType) {
+ IGraphicalEditPart result = getCompartment(dataType, DataTypeAttributeCompartmentEditPart.VISUAL_ID);
+ if (result == null) {
+ result = getCompartment(dataType, DataTypeAttributeCompartmentEditPartCN.VISUAL_ID);
+ }
+ return result;
+ }
+
protected IGraphicalEditPart getEnumerationLiteralCompartment(IGraphicalEditPart enumeration) {
return getCompartment(enumeration, EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID);
}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/EditingInModelInClassDiagramTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/EditingInModelInClassDiagramTest.java
index 27ec7a3cae7..dca0de2e32c 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/EditingInModelInClassDiagramTest.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/EditingInModelInClassDiagramTest.java
@@ -50,8 +50,6 @@ public class EditingInModelInClassDiagramTest extends AbstractCanonicalTest {
private org.eclipse.uml2.uml.Package root;
private org.eclipse.uml2.uml.Class foo;
- private Property foo_ok;
- private Property foo_bar;
private Operation foo_doit;
private org.eclipse.uml2.uml.Class bar;
private org.eclipse.uml2.uml.Class super_;
@@ -60,6 +58,9 @@ public class EditingInModelInClassDiagramTest extends AbstractCanonicalTest {
private org.eclipse.uml2.uml.Package types;
private org.eclipse.uml2.uml.Class types_subfoo;
private DataType types_date;
+ private DataType types_struct;
+ private Property struct_name;
+ private Property struct_age;
private Generalization types_subfoo_foo;
@@ -293,34 +294,36 @@ public class EditingInModelInClassDiagramTest extends AbstractCanonicalTest {
@Scenario({ "execute", "undo", "redo" })
public void reorderPropertiesInClass_bug420549() {
- IGraphicalEditPart attributes = getClassAttributeCompartment(requireEditPart(foo));
+ setCanonical(true, requireEditPart(types_struct));
- // Move 'bar' ahead of 'ok'
- execute(MoveCommand.create(editor.getEditingDomain(), foo, UMLPackage.Literals.STRUCTURED_CLASSIFIER__OWNED_ATTRIBUTE, foo_bar, 0));
+ IGraphicalEditPart attributes = getDataTypeAttributeCompartment(requireEditPart(types_struct));
+
+ // Move 'age' ahead of 'name'
+ execute(MoveCommand.create(editor.getEditingDomain(), types_struct, UMLPackage.Literals.DATA_TYPE__OWNED_ATTRIBUTE, struct_age, 0));
if (verificationPoint()) {
- IGraphicalEditPart okEditPart = getEditPart(foo_ok, attributes);
- IGraphicalEditPart barEditPart = getEditPart(foo_bar, attributes);
- assertThat(attributes.getChildren().indexOf(barEditPart), is(0));
- assertThat(attributes.getChildren().indexOf(okEditPart), is(1));
+ IGraphicalEditPart nameEditPart = getEditPart(struct_name, attributes);
+ IGraphicalEditPart ageEditPart = getEditPart(struct_age, attributes);
+ assertThat(attributes.getChildren().indexOf(ageEditPart), is(0));
+ assertThat(attributes.getChildren().indexOf(nameEditPart), is(1));
}
undo();
if (verificationPoint()) {
- IGraphicalEditPart okEditPart = getEditPart(foo_ok, attributes);
- IGraphicalEditPart barEditPart = getEditPart(foo_bar, attributes);
- assertThat(attributes.getChildren().indexOf(barEditPart), is(1));
- assertThat(attributes.getChildren().indexOf(okEditPart), is(0));
+ IGraphicalEditPart nameEditPart = getEditPart(struct_name, attributes);
+ IGraphicalEditPart ageEditPart = getEditPart(struct_age, attributes);
+ assertThat(attributes.getChildren().indexOf(ageEditPart), is(1));
+ assertThat(attributes.getChildren().indexOf(nameEditPart), is(0));
}
redo();
if (verificationPoint()) {
- IGraphicalEditPart okEditPart = getEditPart(foo_ok, attributes);
- IGraphicalEditPart barEditPart = getEditPart(foo_bar, attributes);
- assertThat(attributes.getChildren().indexOf(barEditPart), is(0));
- assertThat(attributes.getChildren().indexOf(okEditPart), is(1));
+ IGraphicalEditPart nameEditPart = getEditPart(struct_name, attributes);
+ IGraphicalEditPart ageEditPart = getEditPart(struct_age, attributes);
+ assertThat(attributes.getChildren().indexOf(ageEditPart), is(0));
+ assertThat(attributes.getChildren().indexOf(nameEditPart), is(1));
}
}
@@ -334,8 +337,6 @@ public class EditingInModelInClassDiagramTest extends AbstractCanonicalTest {
root = editor.getModel();
foo = (org.eclipse.uml2.uml.Class) root.getOwnedType("Foo");
- foo_ok = foo.getOwnedAttribute("ok", null);
- foo_bar = foo.getOwnedAttribute("bar", null);
foo_doit = foo.getOwnedOperation("doIt", null, null);
bar = (org.eclipse.uml2.uml.Class) root.getOwnedType("Bar");
super_ = (org.eclipse.uml2.uml.Class) root.getOwnedType("Super");
@@ -344,6 +345,9 @@ public class EditingInModelInClassDiagramTest extends AbstractCanonicalTest {
types = root.getNestedPackage("types");
types_subfoo = (org.eclipse.uml2.uml.Class) types.getOwnedType("SubFoo");
types_date = (DataType) types.getOwnedType("Date");
+ types_struct = (DataType) types.getOwnedType("Struct");
+ struct_name = types_struct.getOwnedAttribute("name", null);
+ struct_age = types_struct.getOwnedAttribute("age", null);
types_subfoo_foo = types_subfoo.getGeneralization(foo);
}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/RegressionTest.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/RegressionTest.java
index 34d7cfba9bf..69dc6eb4099 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/RegressionTest.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.canonical.tests/src/org/eclipse/papyrus/infra/gmfdiag/canonical/tests/RegressionTest.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.infra.gmfdiag.canonical.tests;
import static org.eclipse.papyrus.junit.framework.runner.ScenarioRunner.verificationPoint;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;
@@ -122,4 +123,38 @@ public class RegressionTest extends AbstractCanonicalTest {
assertThat(next.getType(), not(is((Type) behavior)));
}
}
+
+ @PluginResource("models/bugs/473148.di")
+ @Test
+ public void associationEndCanonicalPresentation_bug473148() {
+ org.eclipse.uml2.uml.Class class1 = (org.eclipse.uml2.uml.Class) editor.getModel().getOwnedType("Class1");
+ org.eclipse.uml2.uml.Class class2 = (org.eclipse.uml2.uml.Class) editor.getModel().getOwnedType("Class2");
+ Property name = class1.getOwnedAttribute("name", null);
+ Property end = class1.getOwnedAttribute("class2", class2);
+
+ setCanonical(true, requireEditPart(class1));
+
+ requireEditPart(name); // the attribute should be shown
+ assertNoView(end); // but not the association end
+ }
+
+ @PluginResource("models/bugs/473148.di")
+ @Test
+ public void associationEndWhenNoAssociationEdge_bug473148() {
+ org.eclipse.uml2.uml.Class class1 = (org.eclipse.uml2.uml.Class) editor.getModel().getOwnedType("Class1");
+ org.eclipse.uml2.uml.Class class2 = (org.eclipse.uml2.uml.Class) editor.getModel().getOwnedType("Class2");
+ Property name = class1.getOwnedAttribute("name", null);
+ Property end = class1.getOwnedAttribute("class2", class2);
+
+ // Ensure that we will not canonically present the association
+ delete(requireEditPart(class2));
+ assertAttached(class2); // we didn't accidentally delete the class
+ assertThat(end.getType(), is((Type) class2)); // nor mess with the association end
+ assertThat(end.getAssociation(), not(nullValue()));
+
+ setCanonical(true, requireEditPart(class1));
+
+ requireEditPart(name); // the attribute should be shown
+ requireEditPart(end); // and also the association end because we can't show the association
+ }
}

Back to the top