diff options
author | Christian W. Damus | 2015-02-13 22:29:50 +0000 |
---|---|---|
committer | Christian W. Damus | 2015-02-13 22:32:04 +0000 |
commit | 34c82d81e164fa682c5dd7406e6742a8b721410d (patch) | |
tree | 632c32c306a9e6785ea3fcf2af2730fc68648132 /tests | |
parent | f8ccc260f9c90a0724ef6bd4d62394eedf32f59d (diff) | |
download | org.eclipse.papyrus-34c82d81e164fa682c5dd7406e6742a8b721410d.tar.gz org.eclipse.papyrus-34c82d81e164fa682c5dd7406e6742a8b721410d.tar.xz org.eclipse.papyrus-34c82d81e164fa682c5dd7406e6742a8b721410d.zip |
Bug 459613: [Profile Applications] [Submodels] Separate Profile Application stereotypes lost for fragmented models
https://bugs.eclipse.org/bugs/show_bug.cgi?id=459613
Fix problem of stereotype applications in non-package model units not being moved
into the decorator model resource when a profile application is externalized.
Includes JUnit for that scenario and a new regression test verifying that stereotype
applications pertaining to repeated profile applications in nested packages are not
moved when the application of the same profile at a higher level of nesting is
externalized.
Diffstat (limited to 'tests')
15 files changed, 321 insertions, 35 deletions
diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests.launch b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests.launch index 8b845a31489..7601a3794b8 100644 --- a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests.launch +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests.launch @@ -32,7 +32,7 @@ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.uml.decoratormodel.controlmode.tests"/> <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> -<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.6 -Xms128m -Xmx1200m -XX:PermSize=256M -XX:MaxPermSize=512M"/> +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.6 -Xms128m -Xmx1200m -XX:PermSize=256M -XX:MaxPermSize=512M -Doomph.setup.skip=true -Doomph.setup.questionnaire.skip=true"/> <stringAttribute key="pde.version" value="3.3"/> <stringAttribute key="product" value="org.eclipse.platform.ide"/> <booleanAttribute key="run_in_ui_thread" value="false"/> diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/Class1.di b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/Class1.di new file mode 100644 index 00000000000..cac982021da --- /dev/null +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/Class1.di @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi"> + <sashModel currentSelection="//@sashModel/@windows.0/@children.0"> + <windows> + <children xsi:type="di:TabFolder"/> + </windows> + </sashModel> +</di:SashWindowsMngr> diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/Class1.notation b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/Class1.notation new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/Class1.notation @@ -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/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/Class1.uml b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/Class1.uml new file mode 100644 index 00000000000..5a95c2f9399 --- /dev/null +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/Class1.uml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:standard="http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> + <uml:Class xmi:id="_Cio-ILPEEeSSD9qlFZY_Xw" name="Class1"/> + <standard:Utility xmi:id="_Op6R8LPEEeSSD9qlFZY_Xw" base_Class="_Cio-ILPEEeSSD9qlFZY_Xw"/> +</xmi:XMI> diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/classunit.di b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/classunit.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/classunit.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/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/classunit.notation b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/classunit.notation new file mode 100644 index 00000000000..771af9203fa --- /dev/null +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/classunit.notation @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8"?> +<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" 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/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_rAbGcLPCEeSAs8yZUYG_uw" type="PapyrusUMLClassDiagram" name="Main" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_-5WjQLPDEeSSD9qlFZY_Xw" type="2007"> + <children xmi:type="notation:DecorationNode" xmi:id="_-5bbwLPDEeSSD9qlFZY_Xw" type="5026"/> + <children xmi:type="notation:DecorationNode" xmi:id="_-5cp4LPDEeSSD9qlFZY_Xw" type="7016"> + <children xmi:type="notation:Shape" xmi:id="_CCL8cLPEEeSSD9qlFZY_Xw" type="3010"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_N0wyoLPEEeSSD9qlFZY_Xw" source="Stereotype_Annotation"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_nccXcLPEEeSSD9qlFZY_Xw" key="StereotypeWithQualifiedNameList" value=""/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_nccXcbPEEeSSD9qlFZY_Xw" key="StereotypeList" value="StandardProfile::Utility,StandardProfile::Auxiliary"/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_nccXcrPEEeSSD9qlFZY_Xw" key="Stereotype_Presentation_Kind" value="HorizontalStereo"/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_nccXc7PEEeSSD9qlFZY_Xw" key="PropStereoDisplay" value=""/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_nccXdLPEEeSSD9qlFZY_Xw" key="StereotypePropertyLocation" value="Compartment"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_CCL8crPEEeSSD9qlFZY_Xw" type="5014"/> + <children xmi:type="notation:DecorationNode" xmi:id="_CCL8c7PEEeSSD9qlFZY_Xw" type="8518"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_CCL8dLPEEeSSD9qlFZY_Xw" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_CCNxoLPEEeSSD9qlFZY_Xw" type="7011"> + <styles xmi:type="notation:TitleStyle" xmi:id="_CCNxobPEEeSSD9qlFZY_Xw"/> + <styles xmi:type="notation:SortingStyle" xmi:id="_CCNxorPEEeSSD9qlFZY_Xw"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_CCNxo7PEEeSSD9qlFZY_Xw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_CCNxpLPEEeSSD9qlFZY_Xw"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_CCOYsLPEEeSSD9qlFZY_Xw" type="7012"> + <styles xmi:type="notation:TitleStyle" xmi:id="_CCOYsbPEEeSSD9qlFZY_Xw"/> + <styles xmi:type="notation:SortingStyle" xmi:id="_CCOYsrPEEeSSD9qlFZY_Xw"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_CCOYs7PEEeSSD9qlFZY_Xw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_CCOYtLPEEeSSD9qlFZY_Xw"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_CCOYtbPEEeSSD9qlFZY_Xw" type="7013"> + <styles xmi:type="notation:TitleStyle" xmi:id="_CCOYtrPEEeSSD9qlFZY_Xw"/> + <styles xmi:type="notation:SortingStyle" xmi:id="_CCOYt7PEEeSSD9qlFZY_Xw"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_CCOYuLPEEeSSD9qlFZY_Xw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_CCOYubPEEeSSD9qlFZY_Xw"/> + </children> + <element xmi:type="uml:Class" href="classunit.uml#_CB_vMLPEEeSSD9qlFZY_Xw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_CCL8cbPEEeSSD9qlFZY_Xw" x="48" y="27"/> + </children> + <styles xmi:type="notation:TitleStyle" xmi:id="_-5cp4bPDEeSSD9qlFZY_Xw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_-5cp4rPDEeSSD9qlFZY_Xw"/> + </children> + <element xmi:type="uml:Package" href="classunit.uml#_-37m8LPDEeSSD9qlFZY_Xw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_-5WjQbPDEeSSD9qlFZY_Xw" x="91" y="125" width="258" height="210"/> + </children> + <children xmi:type="notation:Shape" xmi:id="__ujF4LPDEeSSD9qlFZY_Xw" type="2007"> + <children xmi:type="notation:DecorationNode" xmi:id="__ujs8LPDEeSSD9qlFZY_Xw" type="5026"/> + <children xmi:type="notation:DecorationNode" xmi:id="__ujs8bPDEeSSD9qlFZY_Xw" type="7016"> + <children xmi:type="notation:Shape" xmi:id="_CiqMQLPEEeSSD9qlFZY_Xw" type="3010"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_OqCNwLPEEeSSD9qlFZY_Xw" source="Stereotype_Annotation"> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_gyTasLPEEeSSD9qlFZY_Xw" key="StereotypeWithQualifiedNameList" value=""/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_gyUBwLPEEeSSD9qlFZY_Xw" key="StereotypeList" value=""/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_gyUBwbPEEeSSD9qlFZY_Xw" key="Stereotype_Presentation_Kind" value="HorizontalStereo"/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_gyUBwrPEEeSSD9qlFZY_Xw" key="PropStereoDisplay" value=""/> + <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_gyUBw7PEEeSSD9qlFZY_Xw" key="StereotypePropertyLocation" value="Compartment"/> + </eAnnotations> + <children xmi:type="notation:DecorationNode" xmi:id="_CiqMQrPEEeSSD9qlFZY_Xw" type="5014"/> + <children xmi:type="notation:DecorationNode" xmi:id="_CiqMQ7PEEeSSD9qlFZY_Xw" type="8518"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_CiqMRLPEEeSSD9qlFZY_Xw" y="5"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_CiqMRbPEEeSSD9qlFZY_Xw" type="7011"> + <styles xmi:type="notation:TitleStyle" xmi:id="_CiqMRrPEEeSSD9qlFZY_Xw"/> + <styles xmi:type="notation:SortingStyle" xmi:id="_CiqMR7PEEeSSD9qlFZY_Xw"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_CiqMSLPEEeSSD9qlFZY_Xw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_CiqMSbPEEeSSD9qlFZY_Xw"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_CiqzULPEEeSSD9qlFZY_Xw" type="7012"> + <styles xmi:type="notation:TitleStyle" xmi:id="_CiqzUbPEEeSSD9qlFZY_Xw"/> + <styles xmi:type="notation:SortingStyle" xmi:id="_CiqzUrPEEeSSD9qlFZY_Xw"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_CiqzU7PEEeSSD9qlFZY_Xw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_CiqzVLPEEeSSD9qlFZY_Xw"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_CiqzVbPEEeSSD9qlFZY_Xw" type="7013"> + <styles xmi:type="notation:TitleStyle" xmi:id="_CiqzVrPEEeSSD9qlFZY_Xw"/> + <styles xmi:type="notation:SortingStyle" xmi:id="_CiqzV7PEEeSSD9qlFZY_Xw"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_CiqzWLPEEeSSD9qlFZY_Xw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_CiqzWbPEEeSSD9qlFZY_Xw"/> + </children> + <element xmi:type="uml:Class" href="classunit.uml#_Cio-ILPEEeSSD9qlFZY_Xw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_CiqMQbPEEeSSD9qlFZY_Xw" x="78" y="31"/> + </children> + <styles xmi:type="notation:TitleStyle" xmi:id="__ujs8rPDEeSSD9qlFZY_Xw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="__ujs87PDEeSSD9qlFZY_Xw"/> + </children> + <element xmi:type="uml:Package" href="classunit.uml#__ugpoLPDEeSSD9qlFZY_Xw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="__ujF4bPDEeSSD9qlFZY_Xw" x="421" y="115" width="302" height="224"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_rAbGcbPCEeSAs8yZUYG_uw" name="diagram_compatibility_version" stringValue="1.0.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_rAbGcrPCEeSAs8yZUYG_uw"/> + <styles xmi:type="style:PapyrusViewStyle" xmi:id="_rAbGc7PCEeSAs8yZUYG_uw"> + <owner xmi:type="uml:Model" href="classunit.uml#_q821ELPCEeSAs8yZUYG_uw"/> + </styles> + <element xmi:type="uml:Model" href="classunit.uml#_q821ELPCEeSAs8yZUYG_uw"/> +</notation:Diagram> diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/classunit.uml b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/classunit.uml new file mode 100644 index 00000000000..5ea1019c1ba --- /dev/null +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/resources/classunit.uml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:standard="http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> + <uml:Model xmi:id="_q821ELPCEeSAs8yZUYG_uw" name="Model"> + <packageImport xmi:type="uml:PackageImport" xmi:id="_q821EbPCEeSAs8yZUYG_uw"> + <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> + </packageImport> + <packagedElement xmi:type="uml:Package" xmi:id="_-37m8LPDEeSSD9qlFZY_Xw" name="Package1"> + <packagedElement xmi:type="uml:Class" xmi:id="_CB_vMLPEEeSSD9qlFZY_Xw" name="Class1"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="__ugpoLPDEeSSD9qlFZY_Xw" name="Package2"> + <packagedElement xmi:type="uml:Class" href="Class1.uml#_Cio-ILPEEeSSD9qlFZY_Xw"/> + </packagedElement> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_I_g68LPEEeSSD9qlFZY_Xw"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_I_3gQLPEEeSSD9qlFZY_Xw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard#/"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="pathmap://UML_PROFILES/Standard.profile.uml#_0"/> + </profileApplication> + </uml:Model> + <standard:Utility xmi:id="_N0OAELPEEeSSD9qlFZY_Xw" base_Class="_CB_vMLPEEeSSD9qlFZY_Xw"/> + <standard:Auxiliary xmi:id="_l3z78LPEEeSSD9qlFZY_Xw"> + <base_Class xmi:type="uml:Class" href="Class1.uml#_Cio-ILPEEeSSD9qlFZY_Xw"/> + </standard:Auxiliary> + <standard:Auxiliary xmi:id="_ncVCsLPEEeSSD9qlFZY_Xw" base_Class="_CB_vMLPEEeSSD9qlFZY_Xw"/> +</xmi:XMI> diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/src/org/eclipse/papyrus/uml/decoratormodel/controlmode/tests/AbstractDecoratorModelControlModeTest.java b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/src/org/eclipse/papyrus/uml/decoratormodel/controlmode/tests/AbstractDecoratorModelControlModeTest.java index a089f7aa5f5..21d493ecf0a 100644 --- a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/src/org/eclipse/papyrus/uml/decoratormodel/controlmode/tests/AbstractDecoratorModelControlModeTest.java +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/src/org/eclipse/papyrus/uml/decoratormodel/controlmode/tests/AbstractDecoratorModelControlModeTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 Christian W. Damus and others. + * Copyright (c) 2014, 2015 Christian W. Damus and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -509,6 +509,22 @@ public abstract class AbstractDecoratorModelControlModeTest extends AbstractPapy return getProfileExternalizationProfile().getOwnedStereotype("ApplyProfiles"); } + protected Profile getStandardProfile() { + return UML2Util.load(modelSet.getResourceSet(), URI.createURI(UMLResource.STANDARD_PROFILE_URI), UMLPackage.Literals.PROFILE); + } + + protected URI getStandardProfileURI() { + return EcoreUtil.getURI(getStandardProfile()); + } + + protected Stereotype getAuxiliaryStereotype() { + return getStandardProfile().getOwnedStereotype("Auxiliary"); + } + + protected Stereotype getUtilityStereotype() { + return getStandardProfile().getOwnedStereotype("Utility"); + } + protected boolean isDefinedIn(Stereotype stereotype, Profile profile) { return EcoreUtil.isAncestor(profile, stereotype); } diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/src/org/eclipse/papyrus/uml/decoratormodel/controlmode/tests/AdditionalModelStructuresTest.java b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/src/org/eclipse/papyrus/uml/decoratormodel/controlmode/tests/AdditionalModelStructuresTest.java index eed43c313b2..ad7f49baa20 100644 --- a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/src/org/eclipse/papyrus/uml/decoratormodel/controlmode/tests/AdditionalModelStructuresTest.java +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.controlmode.tests/src/org/eclipse/papyrus/uml/decoratormodel/controlmode/tests/AdditionalModelStructuresTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 Christian W. Damus and others. + * Copyright (c) 2014, 2015 Christian W. Damus and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -14,6 +14,7 @@ package org.eclipse.papyrus.uml.decoratormodel.controlmode.tests; import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.fail; @@ -118,4 +119,32 @@ public class AdditionalModelStructuresTest extends AbstractDecoratorModelControl assertThat(getExternalProfiles(package2_1_2, "package2_1"), is(Collections.<URI> emptySet())); assertThat(getExternalProfiles(package2_1_2_1, "package2_1"), is(Collections.<URI> emptySet())); } + + /** + * Scenario: control a <b>class</b> (not a package) that has stereotypes applied, externalize the + * parent unit's profile application. Verify that all of the class's stereotype applications are + * moved to the decorator model resource. + * + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=459613 + */ + @Test + @PluginResource("/resources/classunit.di") + public void classUnitExternalizeParentUnitProfileApplication_bug459613() { + Class classUnit = (Class) getModel().getNestedPackage("Package2").getOwnedType("Class1"); + assertThat("Class unit not found", classUnit, notNullValue()); + EObject auxiliary = classUnit.getStereotypeApplication(getAuxiliaryStereotype()); + assertThat("<<auxiliary>> not found", auxiliary, notNullValue()); + EObject utility = classUnit.getStereotypeApplication(getUtilityStereotype()); + assertThat("<<utility>> not found", utility, notNullValue()); + + URI resourceURI = externalize(getModel(), getStandardProfile(), "standard"); + + save(); + + Resource resource = modelSet.getResourceSet().getResource(resourceURI, false); + assertThat(resource, notNullValue()); + + assertThat(auxiliary.eResource(), is(resource)); + assertThat(utility.eResource(), is(resource)); + } } diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/org.eclipse.papyrus.uml.decoratormodel.tests.launch b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/org.eclipse.papyrus.uml.decoratormodel.tests.launch index 6172ac73f5e..a32190d4f51 100644 --- a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/org.eclipse.papyrus.uml.decoratormodel.tests.launch +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/org.eclipse.papyrus.uml.decoratormodel.tests.launch @@ -32,7 +32,7 @@ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.uml.decoratormodel.tests"/> <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/> -<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.6 -Xms128m -Xmx1200m -XX:PermSize=256M -XX:MaxPermSize=512M"/> +<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.6 -Xms128m -Xmx1200m -XX:PermSize=256M -XX:MaxPermSize=512M -Doomph.setup.skip=true -Doomph.setup.questionnaire.skip=true"/> <stringAttribute key="pde.version" value="3.3"/> <stringAttribute key="product" value="org.eclipse.platform.ide"/> <booleanAttribute key="run_in_ui_thread" value="true"/> diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/nestedpackages.di b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/nestedpackages.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/nestedpackages.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/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/nestedpackages.notation b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/nestedpackages.notation new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/nestedpackages.notation @@ -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/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/nestedpackages.uml b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/nestedpackages.uml new file mode 100644 index 00000000000..e2305d987b7 --- /dev/null +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/nestedpackages.uml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:profile1="http:///schemas/profile1/_AJk_8EijEeSKm9FE-lgkJg/0" xmlns:profile1.relationships="http:///profile1/relationships.ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http:///schemas/profile1/_AJk_8EijEeSKm9FE-lgkJg/0 profile/profile1.profile.uml#_AJoDQEijEeSKm9FE-lgkJg http:///profile1/relationships.ecore profile/profile1.profile.uml#_AJoDUkijEeSKm9FE-lgkJg"> + <uml:Model xmi:id="_Jqf8kEijEeSKm9FE-lgkJg" name="nestedpackages"> + <packageImport xmi:id="_Jqf8kUijEeSKm9FE-lgkJg"> + <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> + </packageImport> + <packagedElement xmi:type="uml:Package" xmi:id="_MLPToEimEeSYXMOYgqfvhA" name="package1"> + <packagedElement xmi:type="uml:Class" xmi:id="_aipeEEimEeSYXMOYgqfvhA" name="Entity1"> + <ownedOperation xmi:id="_d-B_0EimEeSYXMOYgqfvhA" name="find"> + <ownedParameter xmi:id="_jv5QwEimEeSYXMOYgqfvhA" name="id"> + <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> + </ownedParameter> + </ownedOperation> + </packagedElement> + <packagedElement xmi:type="uml:Class" xmi:id="_npgmoEimEeSYXMOYgqfvhA" name="BusinessRules"/> + <packagedElement xmi:type="uml:Dependency" xmi:id="_qnlhUEimEeSYXMOYgqfvhA" client="_aipeEEimEeSYXMOYgqfvhA" supplier="_npgmoEimEeSYXMOYgqfvhA"/> + </packagedElement> + <packagedElement xmi:type="uml:Package" xmi:id="_Nb6RUEimEeSYXMOYgqfvhA" name="package2"> + <packagedElement xmi:type="uml:Class" xmi:id="_8I2YoEimEeSYXMOYgqfvhA" name="Bean2"/> + <packagedElement xmi:type="uml:Class" xmi:id="_-9S2MEimEeSYXMOYgqfvhA" name="MessageProcessor"/> + <packagedElement xmi:type="uml:Dependency" xmi:id="_ANhH8EinEeSYXMOYgqfvhA" client="_8I2YoEimEeSYXMOYgqfvhA" supplier="_-9S2MEimEeSYXMOYgqfvhA"/> + <profileApplication xmi:id="_QfKKELPJEeSSD9qlFZY_Xw"> + <eAnnotations xmi:id="_QfKKEbPJEeSSD9qlFZY_Xw" source="PapyrusVersion"> + <details xmi:id="_QfKKErPJEeSSD9qlFZY_Xw" key="Version" value="0.0.1"/> + <details xmi:id="_QfKKE7PJEeSSD9qlFZY_Xw" key="Comment" value=""/> + <details xmi:id="_QfKKFLPJEeSSD9qlFZY_Xw" key="Copyright" value="Copyright (c) 2014 Christian W. Damus 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:
 Christian W. Damus - Initial API and implementation"/> + <details xmi:id="_QfKKFbPJEeSSD9qlFZY_Xw" key="Date" value="2014-09-30"/> + <details xmi:id="_QfKKFrPJEeSSD9qlFZY_Xw" key="Author" value="Christian W. Damus"/> + </eAnnotations> + <eAnnotations xmi:id="_QfKKF7PJEeSSD9qlFZY_Xw" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="profile/profile1.profile.uml#_AJoDQEijEeSKm9FE-lgkJg"/> + </eAnnotations> + <appliedProfile href="profile/profile1.profile.uml#_raLqoEigEeSRp-p9nf2EsA"/> + </profileApplication> + </packagedElement> + <profileApplication xmi:id="_4CRaQEilEeSYXMOYgqfvhA"> + <eAnnotations xmi:id="_4CutQEilEeSYXMOYgqfvhA" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard#/"/> + </eAnnotations> + <appliedProfile href="pathmap://UML_PROFILES/Standard.profile.uml#_0"/> + </profileApplication> + <profileApplication xmi:id="_RpH4oEimEeSYXMOYgqfvhA"> + <eAnnotations xmi:id="_RpdP0EimEeSYXMOYgqfvhA" source="PapyrusVersion"> + <details xmi:id="_RpdP0UimEeSYXMOYgqfvhA" key="Version" value="0.0.1"/> + <details xmi:id="_RpdP0kimEeSYXMOYgqfvhA" key="Comment" value=""/> + <details xmi:id="_RpdP00imEeSYXMOYgqfvhA" key="Copyright" value="Copyright (c) 2014 Christian W. Damus 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:
 Christian W. Damus - Initial API and implementation"/> + <details xmi:id="_RpdP1EimEeSYXMOYgqfvhA" key="Date" value="2014-09-30"/> + <details xmi:id="_RpdP1UimEeSYXMOYgqfvhA" key="Author" value="Christian W. Damus"/> + </eAnnotations> + <eAnnotations xmi:id="_RpcowEimEeSYXMOYgqfvhA" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="profile/profile1.profile.uml#_AJoDQEijEeSKm9FE-lgkJg"/> + </eAnnotations> + <appliedProfile href="profile/profile1.profile.uml#_raLqoEigEeSRp-p9nf2EsA"/> + </profileApplication> + </uml:Model> + <profile1:Bean xmi:id="_b2GC8EimEeSYXMOYgqfvhA" base_Class="_aipeEEimEeSYXMOYgqfvhA" finder="_fYVaoEimEeSYXMOYgqfvhA"/> + <profile1:Finder xmi:id="_fYVaoEimEeSYXMOYgqfvhA" base_Operation="_d-B_0EimEeSYXMOYgqfvhA"/> + <profile1.relationships:Import xmi:id="_rjJKoEimEeSYXMOYgqfvhA" base_Dependency="_qnlhUEimEeSYXMOYgqfvhA"/> + <profile1:Bean xmi:id="_t8BGgEimEeSYXMOYgqfvhA" base_Class="_npgmoEimEeSYXMOYgqfvhA" kind="session"/> + <profile1:Bean xmi:id="_L_rHALPJEeSSD9qlFZY_Xw" base_Class="_8I2YoEimEeSYXMOYgqfvhA"/> + <profile1:Bean xmi:id="_OIyvoLPJEeSSD9qlFZY_Xw" base_Class="_-9S2MEimEeSYXMOYgqfvhA"/> +</xmi:XMI> diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/profile/profile1.profile.uml b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/profile/profile1.profile.uml index 63ee8525c1d..d31a167e41f 100644 --- a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/profile/profile1.profile.uml +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/profile/profile1.profile.uml @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <uml:Profile 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="_raLqoEigEeSRp-p9nf2EsA" name="profile1" metaclassReference="_33I6kEigEeSRp-p9nf2EsA _6kVgoEigEeSRp-p9nf2EsA _AX-6QEihEeSRp-p9nf2EsA" metamodelReference="_raLqoUigEeSRp-p9nf2EsA"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_0O4lAEihEeSRp-p9nf2EsA" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <eAnnotations xmi:id="_0O4lAEihEeSRp-p9nf2EsA" source="http://www.eclipse.org/uml2/2.0.0/UML"> <contents xmi:type="ecore:EPackage" xmi:id="_AJoDQEijEeSKm9FE-lgkJg" name="profile1" nsURI="http:///schemas/profile1/_AJk_8EijEeSKm9FE-lgkJg/0" nsPrefix="profile1"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_AJrGkEijEeSKm9FE-lgkJg" source="PapyrusVersion"> - <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_AJrGkUijEeSKm9FE-lgkJg" key="Version" value="0.0.1"/> - <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_AJrGkkijEeSKm9FE-lgkJg" key="Comment" value=""/> - <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_AJrGk0ijEeSKm9FE-lgkJg" key="Copyright" value="Copyright (c) 2014 Christian W. Damus 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:
 Christian W. Damus - Initial API and implementation"/> - <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_AJrGlEijEeSKm9FE-lgkJg" key="Date" value="2014-09-30"/> - <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_AJrGlUijEeSKm9FE-lgkJg" key="Author" value="Christian W. Damus"/> + <eAnnotations xmi:id="_AJrGkEijEeSKm9FE-lgkJg" source="PapyrusVersion"> + <details xmi:id="_AJrGkUijEeSKm9FE-lgkJg" key="Version" value="0.0.1"/> + <details xmi:id="_AJrGkkijEeSKm9FE-lgkJg" key="Comment" value=""/> + <details xmi:id="_AJrGk0ijEeSKm9FE-lgkJg" key="Copyright" value="Copyright (c) 2014 Christian W. Damus 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:
 Christian W. Damus - Initial API and implementation"/> + <details xmi:id="_AJrGlEijEeSKm9FE-lgkJg" key="Date" value="2014-09-30"/> + <details xmi:id="_AJrGlUijEeSKm9FE-lgkJg" key="Author" value="Christian W. Damus"/> </eAnnotations> <eClassifiers xmi:type="ecore:EClass" xmi:id="_AJoDQUijEeSKm9FE-lgkJg" name="Bean"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_AJoDQkijEeSKm9FE-lgkJg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_Be-XgEihEeSRp-p9nf2EsA"/> + <eAnnotations xmi:id="_AJoDQkijEeSKm9FE-lgkJg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_Be-XgEihEeSRp-p9nf2EsA"/> <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_AJoDQ0ijEeSKm9FE-lgkJg" name="base_Class" ordered="false" lowerBound="1"> <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/> </eStructuralFeatures> @@ -18,21 +18,21 @@ <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_AJoDR0ijEeSKm9FE-lgkJg" name="kind" ordered="false" lowerBound="1" eType="_AJoDTUijEeSKm9FE-lgkJg"/> </eClassifiers> <eClassifiers xmi:type="ecore:EClass" xmi:id="_AJoDSUijEeSKm9FE-lgkJg" name="Finder"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_AJoDSkijEeSKm9FE-lgkJg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_DNegsEihEeSRp-p9nf2EsA"/> + <eAnnotations xmi:id="_AJoDSkijEeSKm9FE-lgkJg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_DNegsEihEeSRp-p9nf2EsA"/> <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_AJoDS0ijEeSKm9FE-lgkJg" name="base_Operation" ordered="false" lowerBound="1"> <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Operation"/> </eStructuralFeatures> </eClassifiers> <eClassifiers xmi:type="ecore:EEnum" xmi:id="_AJoDTUijEeSKm9FE-lgkJg" name="BeanKind"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_AJoDTkijEeSKm9FE-lgkJg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_WA1SAEihEeSRp-p9nf2EsA"/> - <eLiterals xmi:type="ecore:EEnumLiteral" xmi:id="_AJoDT0ijEeSKm9FE-lgkJg" name="entity"/> - <eLiterals xmi:type="ecore:EEnumLiteral" xmi:id="_AJoDUEijEeSKm9FE-lgkJg" name="session" value="1"/> - <eLiterals xmi:type="ecore:EEnumLiteral" xmi:id="_AJoDUUijEeSKm9FE-lgkJg" name="messagedriven" value="2"/> + <eAnnotations xmi:id="_AJoDTkijEeSKm9FE-lgkJg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_WA1SAEihEeSRp-p9nf2EsA"/> + <eLiterals xmi:id="_AJoDT0ijEeSKm9FE-lgkJg" name="entity"/> + <eLiterals xmi:id="_AJoDUEijEeSKm9FE-lgkJg" name="session" value="1"/> + <eLiterals xmi:id="_AJoDUUijEeSKm9FE-lgkJg" name="messagedriven" value="2"/> </eClassifiers> - <eSubpackages xmi:type="ecore:EPackage" xmi:id="_AJoDUkijEeSKm9FE-lgkJg" name="relationships" nsURI="http:///profile1/relationships.ecore" nsPrefix="profile1.relationships"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_AJoDU0ijEeSKm9FE-lgkJg" source="http://www.eclipse.org/uml2/4.0.0/UML" references="_oOlmcEiiEeSKm9FE-lgkJg"/> + <eSubpackages xmi:id="_AJoDUkijEeSKm9FE-lgkJg" name="relationships" nsURI="http:///profile1/relationships.ecore" nsPrefix="profile1.relationships"> + <eAnnotations xmi:id="_AJoDU0ijEeSKm9FE-lgkJg" source="http://www.eclipse.org/uml2/4.0.0/UML" references="_oOlmcEiiEeSKm9FE-lgkJg"/> <eClassifiers xmi:type="ecore:EClass" xmi:id="_AJoDVEijEeSKm9FE-lgkJg" name="Import"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_AJoDVUijEeSKm9FE-lgkJg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_Eo_ccEihEeSRp-p9nf2EsA"/> + <eAnnotations xmi:id="_AJoDVUijEeSKm9FE-lgkJg" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_Eo_ccEihEeSRp-p9nf2EsA"/> <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_AJoDVkijEeSKm9FE-lgkJg" name="base_Dependency" ordered="false" lowerBound="1"> <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Dependency"/> </eStructuralFeatures> @@ -40,33 +40,33 @@ </eSubpackages> </contents> </eAnnotations> - <elementImport xmi:type="uml:ElementImport" xmi:id="_33I6kEigEeSRp-p9nf2EsA" alias="Class"> + <elementImport xmi:id="_33I6kEigEeSRp-p9nf2EsA" alias="Class"> <importedElement xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/> </elementImport> - <elementImport xmi:type="uml:ElementImport" xmi:id="_6kVgoEigEeSRp-p9nf2EsA" alias="Dependency"> + <elementImport xmi:id="_6kVgoEigEeSRp-p9nf2EsA" alias="Dependency"> <importedElement xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Dependency"/> </elementImport> - <elementImport xmi:type="uml:ElementImport" xmi:id="_AX-6QEihEeSRp-p9nf2EsA" alias="Operation"> + <elementImport xmi:id="_AX-6QEihEeSRp-p9nf2EsA" alias="Operation"> <importedElement xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Operation"/> </elementImport> - <packageImport xmi:type="uml:PackageImport" xmi:id="_raLqoUigEeSRp-p9nf2EsA"> + <packageImport xmi:id="_raLqoUigEeSRp-p9nf2EsA"> <importedPackage xmi:type="uml:Model" href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/> </packageImport> - <packageImport xmi:type="uml:PackageImport" xmi:id="_raLqokigEeSRp-p9nf2EsA"> + <packageImport xmi:id="_raLqokigEeSRp-p9nf2EsA"> <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> </packageImport> <packagedElement xmi:type="uml:Stereotype" xmi:id="_Be-XgEihEeSRp-p9nf2EsA" name="Bean"> - <ownedAttribute xmi:type="uml:Property" xmi:id="_Gi2hEEihEeSRp-p9nf2EsA" name="base_Class" association="_Gi3IIEihEeSRp-p9nf2EsA"> + <ownedAttribute xmi:id="_Gi2hEEihEeSRp-p9nf2EsA" name="base_Class" association="_Gi3IIEihEeSRp-p9nf2EsA"> <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/> </ownedAttribute> - <ownedAttribute xmi:type="uml:Property" xmi:id="_IwZWsEihEeSRp-p9nf2EsA" name="finder" type="_DNegsEihEeSRp-p9nf2EsA" association="_IwZ9wEihEeSRp-p9nf2EsA"> + <ownedAttribute xmi:id="_IwZWsEihEeSRp-p9nf2EsA" name="finder" type="_DNegsEihEeSRp-p9nf2EsA" association="_IwZ9wEihEeSRp-p9nf2EsA"> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_IwZWsUihEeSRp-p9nf2EsA"/> <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_IwZWskihEeSRp-p9nf2EsA" value="1"/> </ownedAttribute> - <ownedAttribute xmi:type="uml:Property" xmi:id="_btMX4EihEeSRp-p9nf2EsA" name="kind" type="_WA1SAEihEeSRp-p9nf2EsA"/> + <ownedAttribute xmi:id="_btMX4EihEeSRp-p9nf2EsA" name="kind" type="_WA1SAEihEeSRp-p9nf2EsA"/> </packagedElement> <packagedElement xmi:type="uml:Stereotype" xmi:id="_DNegsEihEeSRp-p9nf2EsA" name="Finder"> - <ownedAttribute xmi:type="uml:Property" xmi:id="_HDxc0EihEeSRp-p9nf2EsA" name="base_Operation" association="_HDyD4EihEeSRp-p9nf2EsA"> + <ownedAttribute xmi:id="_HDxc0EihEeSRp-p9nf2EsA" name="base_Operation" association="_HDyD4EihEeSRp-p9nf2EsA"> <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Operation"/> </ownedAttribute> </packagedElement> @@ -77,19 +77,19 @@ <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_HDyD4UihEeSRp-p9nf2EsA" name="extension_Finder" type="_DNegsEihEeSRp-p9nf2EsA" aggregation="composite" association="_HDyD4EihEeSRp-p9nf2EsA"/> </packagedElement> <packagedElement xmi:type="uml:Association" xmi:id="_IwZ9wEihEeSRp-p9nf2EsA" name="bean_finder_1" memberEnd="_IwZ9wUihEeSRp-p9nf2EsA _IwZWsEihEeSRp-p9nf2EsA"> - <ownedEnd xmi:type="uml:Property" xmi:id="_IwZ9wUihEeSRp-p9nf2EsA" name="bean" type="_Be-XgEihEeSRp-p9nf2EsA" association="_IwZ9wEihEeSRp-p9nf2EsA"> + <ownedEnd xmi:id="_IwZ9wUihEeSRp-p9nf2EsA" name="bean" type="_Be-XgEihEeSRp-p9nf2EsA" association="_IwZ9wEihEeSRp-p9nf2EsA"> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_IwZ9wkihEeSRp-p9nf2EsA" value="1"/> <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_IwZ9w0ihEeSRp-p9nf2EsA" value="1"/> </ownedEnd> </packagedElement> <packagedElement xmi:type="uml:Enumeration" xmi:id="_WA1SAEihEeSRp-p9nf2EsA" name="BeanKind"> - <ownedLiteral xmi:type="uml:EnumerationLiteral" xmi:id="_XMd-sEihEeSRp-p9nf2EsA" name="entity"/> - <ownedLiteral xmi:type="uml:EnumerationLiteral" xmi:id="_Yzr0IEihEeSRp-p9nf2EsA" name="session"/> - <ownedLiteral xmi:type="uml:EnumerationLiteral" xmi:id="_Zg2cIEihEeSRp-p9nf2EsA" name="messagedriven"/> + <ownedLiteral xmi:id="_XMd-sEihEeSRp-p9nf2EsA" name="entity"/> + <ownedLiteral xmi:id="_Yzr0IEihEeSRp-p9nf2EsA" name="session"/> + <ownedLiteral xmi:id="_Zg2cIEihEeSRp-p9nf2EsA" name="messagedriven"/> </packagedElement> <packagedElement xmi:type="uml:Package" xmi:id="_oOlmcEiiEeSKm9FE-lgkJg" name="relationships"> <packagedElement xmi:type="uml:Stereotype" xmi:id="_Eo_ccEihEeSRp-p9nf2EsA" name="Import"> - <ownedAttribute xmi:type="uml:Property" xmi:id="_HjbNQEihEeSRp-p9nf2EsA" name="base_Dependency" association="_HjbNQUihEeSRp-p9nf2EsA"> + <ownedAttribute xmi:id="_HjbNQEihEeSRp-p9nf2EsA" name="base_Dependency" association="_HjbNQUihEeSRp-p9nf2EsA"> <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Dependency"/> </ownedAttribute> </packagedElement> diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/ExternalizeProfileApplicationTest.java b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/ExternalizeProfileApplicationTest.java index e358a951dac..57ffcb413d0 100644 --- a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/ExternalizeProfileApplicationTest.java +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/ExternalizeProfileApplicationTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 Christian W. Damus and others. + * Copyright (c) 2014, 2015 Christian W. Damus and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -26,6 +26,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.uml2.uml.Class; import org.eclipse.uml2.uml.Package; import org.eclipse.uml2.uml.UMLPackage; import org.junit.Test; @@ -152,4 +153,43 @@ public class ExternalizeProfileApplicationTest extends AbstractProfileExternaliz assertThat(stereo.eResource().getURI(), is(decoratorURI)); } + + /** + * Scenario: externalize the application of a profile on the root package where some nested package + * also has the same profile applied. Verify that the stereotype applications governed by the nested + * package's profile application are unaffected. + * + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=459613 + */ + @Test + @PluginResource("/resources/nestedpackages.di") + public void nestedPackageApplicationOfSameProfile_bug459613() { + Class entity1 = (Class) getModel().getNestedPackage("package1").getOwnedType("Entity1"); + Class businessRules = (Class) getModel().getNestedPackage("package1").getOwnedType("BusinessRules"); + Class bean2 = (Class) getModel().getNestedPackage("package2").getOwnedType("Bean2"); + Class messageProcessor = (Class) getModel().getNestedPackage("package2").getOwnedType("MessageProcessor"); + + EObject entity1Bean = entity1.getStereotypeApplication(getBeanStereotype()); + assertThat("<<bean>> not found", entity1Bean, notNullValue()); + EObject businessRulesBean = businessRules.getStereotypeApplication(getBeanStereotype()); + assertThat("<<bean>> not found", businessRulesBean, notNullValue()); + EObject bean2Bean = bean2.getStereotypeApplication(getBeanStereotype()); + assertThat("<<bean>> not found", bean2Bean, notNullValue()); + EObject messageProcessorBean = messageProcessor.getStereotypeApplication(getBeanStereotype()); + assertThat("<<bean>> not found", messageProcessorBean, notNullValue()); + + URI resourceURI = externalize(getModel(), getTestProfile(), "beans"); + + save(); + + Resource resource = modelSet.getResourceSet().getResource(resourceURI, false); + assertThat(resource, notNullValue()); + + assertThat(entity1Bean.eResource(), is(resource)); + assertThat(businessRulesBean.eResource(), is(resource)); + + // These did not have their profile application externalized! + assertThat(bean2Bean.eResource(), is(getModel().eResource())); + assertThat(messageProcessorBean.eResource(), is(getModel().eResource())); + } } |