Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-12-16 16:18:32 +0000
committerChristian W. Damus2014-12-16 16:18:32 +0000
commit7727eac28e5be36006b7d3ff240a82adde13433e (patch)
tree22a622f4891df0f62b849ccfe90ded4a9966dbbe
parente02728cd745de91b1660a67df6caf00aa097a4a0 (diff)
downloadorg.eclipse.papyrus-7727eac28e5be36006b7d3ff240a82adde13433e.tar.gz
org.eclipse.papyrus-7727eac28e5be36006b7d3ff240a82adde13433e.tar.xz
org.eclipse.papyrus-7727eac28e5be36006b7d3ff240a82adde13433e.zip
455329: [Repair Stereotypes] The Repair Stereotypes dialog pops up everytime for Deployed Dynamic profiles
https://bugs.eclipse.org/bugs/show_bug.cgi?id=455329 Ensure that the duality of dynamically registered profile definitions that are also loaded locally in the resource set is accounted for.
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippet.java18
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/META-INF/MANIFEST.MF5
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/build.properties3
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/fragment.xml44
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/dynamic/dynamic.profile.uml24
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug455329/model.di2
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug455329/model.notation39
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug455329/model.uml16
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java16
9 files changed, 161 insertions, 6 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippet.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippet.java
index f3d1bd3cfb7..c2037a08a7e 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippet.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippet.java
@@ -9,6 +9,7 @@
* Contributors:
* Christian W. Damus (CEA) - Initial API and implementation
* Christian W. Damus - bug 455248
+ * Christian W. Damus - bug 455329
*
*/
package org.eclipse.papyrus.uml.modelrepair.internal.stereotypes;
@@ -204,13 +205,28 @@ public class StereotypeApplicationRepairSnippet implements IModelSetSnippet {
for (ProfileApplication next : profileApplications) {
EPackage definition = next.getAppliedDefinition();
if ((definition != null) && !definition.eIsProxy()) {
- result.add(definition);
+ if (result.add(definition)) {
+ // Maybe it's a registered dynamic package? Look for a Doppelgänger in the registry
+ EPackage.Registry registry = getPackageRegistry();
+ if (registry != null) {
+ EPackage registered = registry.getEPackage(definition.getNsURI());
+ if ((registered != null) && (registered != definition)) {
+ // This is the schema that EMF actually used to create stereotype instances
+ result.add(registered);
+ }
+ }
+ }
}
}
return result;
}
+ private EPackage.Registry getPackageRegistry() {
+ ResourceSet resourceSet = adapter.getResourceSet();
+ return (resourceSet == null) ? EPackage.Registry.INSTANCE : resourceSet.getPackageRegistry();
+ }
+
private LabelProviderService getLabelProvider() {
if (labelProviderService == null) {
try {
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/META-INF/MANIFEST.MF
index 5fd82ef164f..aa6d0eb20f8 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/META-INF/MANIFEST.MF
@@ -5,12 +5,11 @@ Require-Bundle: org.junit;bundle-version="4.10.0",
Export-Package: org.eclipse.papyrus.uml.modelrepair.internal.stereotypes,
org.eclipse.papyrus.uml.modelrepair.tests
Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.uml.modelrepair;bundle-version="1.0
- .0"
+Fragment-Host: org.eclipse.papyrus.uml.modelrepair;bundle-version="1.0.1"
Bundle-Version: 1.0.1.qualifier
Bundle-Name: %pluginName
Bundle-Localization: fragment
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.modelrepair.tests
+Bundle-SymbolicName: org.eclipse.papyrus.uml.modelrepair.tests;singleton:=true
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/build.properties b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/build.properties
index d0b601e9361..2423785a815 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/build.properties
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/build.properties
@@ -4,5 +4,6 @@ bin.includes = META-INF/,\
.,\
fragment.properties,\
about.html,\
- resources/
+ resources/,\
+ fragment.xml
src.includes = about.html
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/fragment.xml b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/fragment.xml
new file mode 100644
index 00000000000..c8f9d20ccbe
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/fragment.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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
+
+ -->
+<?eclipse version="3.4"?>
+<fragment>
+ <extension
+ point="org.eclipse.emf.ecore.uri_mapping">
+ <mapping
+ source="pathmap://modelrepairtests/dynamicprofiles/"
+ target="platform:/plugin/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/dynamic/">
+ </mapping>
+ </extension>
+ <extension
+ point="org.eclipse.uml2.uml.dynamic_package">
+ <profile
+ location="pathmap://modelrepairtests/dynamicprofiles/dynamic.profile.uml#_0"
+ uri="http://www.eclipse.org/papyrus/2014/test/profile/dynamic">
+ </profile>
+ </extension>
+ <extension
+ point="org.eclipse.emf.ecore.dynamic_package">
+ <resource
+ location="pathmap://modelrepairtests/dynamicprofiles/dynamic.profile.uml#_1"
+ uri="http://www.eclipse.org/papyrus/2014/test/profile/dynamic">
+ </resource>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.uml.extensionpoints.UMLProfile">
+ <profile
+ name="Model Repair Tests Dynamic Profile"
+ path="pathmap://modelrepairtests/dynamicprofiles/dynamic.profile.uml">
+ </profile>
+ </extension>
+</fragment>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/dynamic/dynamic.profile.uml b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/dynamic/dynamic.profile.uml
new file mode 100644
index 00000000000..27cb2a64cc3
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/dynamic/dynamic.profile.uml
@@ -0,0 +1,24 @@
+<?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="_0" name="dynamic" URI="http://www.eclipse.org/papyrus/2014/test/profile/dynamic" metaclassReference="_c1MWoIU6EeSXvvt9wzgnnA">
+ <eAnnotations xmi:id="_ka9OIIU6EeSXvvt9wzgnnA" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <contents xmi:type="ecore:EPackage" xmi:id="_1" name="dynamic" nsURI="http://www.eclipse.org/papyrus/2014/test/profile/dynamic" nsPrefix="dynamic">
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="_ka9OIoU6EeSXvvt9wzgnnA" name="S1">
+ <eAnnotations xmi:id="_ka9OI4U6EeSXvvt9wzgnnA" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_YTzPEIU6EeSXvvt9wzgnnA"/>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_ka9OJIU6EeSXvvt9wzgnnA" name="base_Classifier" ordered="false" lowerBound="1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ </contents>
+ </eAnnotations>
+ <elementImport xmi:id="_c1MWoIU6EeSXvvt9wzgnnA">
+ <importedElement xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Classifier"/>
+ </elementImport>
+ <packagedElement xmi:type="uml:Stereotype" xmi:id="_YTzPEIU6EeSXvvt9wzgnnA" name="S1">
+ <ownedAttribute xmi:id="_ef5k8YU6EeSXvvt9wzgnnA" name="base_Classifier" association="_ef494IU6EeSXvvt9wzgnnA">
+ <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Classifier"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Extension" xmi:id="_ef494IU6EeSXvvt9wzgnnA" name="Classifier_S1" memberEnd="_ef5k8IU6EeSXvvt9wzgnnA _ef5k8YU6EeSXvvt9wzgnnA">
+ <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_ef5k8IU6EeSXvvt9wzgnnA" name="extension_S1" type="_YTzPEIU6EeSXvvt9wzgnnA" aggregation="composite" association="_ef494IU6EeSXvvt9wzgnnA"/>
+ </packagedElement>
+</uml:Profile>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug455329/model.di b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug455329/model.di
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug455329/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/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug455329/model.notation b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug455329/model.notation
new file mode 100644
index 00000000000..f24594d4679
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug455329/model.notation
@@ -0,0 +1,39 @@
+<?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="_1qKYAIUtEeShE72q-FdWsA" type="PapyrusUMLClassDiagram" name="classes" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_jvPOEIUuEeSlfqEMhfPvcw" type="2008">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_izjgkIU8EeSxYKUcfWASZQ" source="Stereotype_Annotation">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_izkusIU8EeSxYKUcfWASZQ" key="StereotypeWithQualifiedNameList" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_izkusYU8EeSxYKUcfWASZQ" key="StereotypeList" value="dynamic::S1"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_izkusoU8EeSxYKUcfWASZQ" key="Stereotype_Presentation_Kind" value="HorizontalStereo"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_izkus4U8EeSxYKUcfWASZQ" key="PropStereoDisplay" value=""/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_izlVwIU8EeSxYKUcfWASZQ" key="StereotypePropertyLocation" value="Compartment"/>
+ </eAnnotations>
+ <children xmi:type="notation:DecorationNode" xmi:id="_jvVUsIUuEeSlfqEMhfPvcw" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_jvbbUIUuEeSlfqEMhfPvcw" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_jvbbUYUuEeSlfqEMhfPvcw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_jvbbUoUuEeSlfqEMhfPvcw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_jvbbU4UuEeSlfqEMhfPvcw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jvbbVIUuEeSlfqEMhfPvcw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_jvbbVYUuEeSlfqEMhfPvcw" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_jvbbVoUuEeSlfqEMhfPvcw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_jvbbV4UuEeSlfqEMhfPvcw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_jvbbWIUuEeSlfqEMhfPvcw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jvbbWYUuEeSlfqEMhfPvcw"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_jvbbWoUuEeSlfqEMhfPvcw" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_jvcCYIUuEeSlfqEMhfPvcw"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_jvcCYYUuEeSlfqEMhfPvcw"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_jvcCYoUuEeSlfqEMhfPvcw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jvcCY4UuEeSlfqEMhfPvcw"/>
+ </children>
+ <element xmi:type="uml:Class" href="model.uml#_juRkwIUuEeSlfqEMhfPvcw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jvPOEYUuEeSlfqEMhfPvcw" x="184" y="113"/>
+ </children>
+ <styles xmi:type="notation:StringValueStyle" xmi:id="_1qKYAYUtEeShE72q-FdWsA" name="diagram_compatibility_version" stringValue="1.0.0"/>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_1qKYAoUtEeShE72q-FdWsA"/>
+ <styles xmi:type="style:PapyrusViewStyle" xmi:id="_1qKYA4UtEeShE72q-FdWsA">
+ <owner xmi:type="uml:Model" href="model.uml#_1n7jYIUtEeShE72q-FdWsA"/>
+ </styles>
+ <element xmi:type="uml:Model" href="model.uml#_1n7jYIUtEeShE72q-FdWsA"/>
+</notation:Diagram>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug455329/model.uml b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug455329/model.uml
new file mode 100644
index 00000000000..9be0e6e5ff3
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug455329/model.uml
@@ -0,0 +1,16 @@
+<?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:dynamic="http://www.eclipse.org/papyrus/2014/test/profile/dynamic" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/2014/test/profile/dynamic pathmap://modelrepairtests/dynamicprofiles/dynamic.profile.uml#_1">
+ <uml:Model xmi:id="_1n7jYIUtEeShE72q-FdWsA" name="Model">
+ <packageImport xmi:id="_1n7jYYUtEeShE72q-FdWsA">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Class" xmi:id="_juRkwIUuEeSlfqEMhfPvcw" name="Class1"/>
+ <profileApplication xmi:id="_bJvPgIU8EeSxYKUcfWASZQ">
+ <eAnnotations xmi:id="_bKVscIU8EeSxYKUcfWASZQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="pathmap://modelrepairtests/dynamicprofiles/dynamic.profile.uml#_1"/>
+ </eAnnotations>
+ <appliedProfile href="pathmap://modelrepairtests/dynamicprofiles/dynamic.profile.uml#_0"/>
+ </profileApplication>
+ </uml:Model>
+ <dynamic:S1 xmi:id="_gh0ugIU8EeSxYKUcfWASZQ" base_Classifier="_juRkwIUuEeSlfqEMhfPvcw"/>
+</xmi:XMI>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java
index ba7e76e88cd..b80a274cd72 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java
@@ -9,6 +9,7 @@
* Contributors:
* Christian W. Damus (CEA) - Initial API and implementation
* Christian W. Damus - bug 455248
+ * Christian W. Damus - bug 455329
*
*/
package org.eclipse.papyrus.uml.modelrepair.internal.stereotypes;
@@ -218,6 +219,19 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest {
assertThat("Should not have found zombie stereotypes", zombies, nullValue());
}
+ /**
+ * Tests that a model applying a registered dynamic profile does not detect spurious broken
+ * stereotype applications.
+ *
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=455329
+ */
+ @Test
+ @Bug("455329")
+ @PluginResource("/resources/regression/bug455329/model.uml")
+ public void registeredDynamicProfie_bug455329() {
+ assertThat("Should not have found zombie stereotypes", zombies, nullValue());
+ }
+
//
// Test framework
//
@@ -300,7 +314,7 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest {
}), "dispose", modelSet.getResourceSet());
}
- @Bug({ "436666bis", "455248" })
+ @Bug({ "436666bis", "455248", "455329" })
protected StereotypeApplicationRepairSnippet createSimpleFixture() {
return houseKeeper.cleanUpLater(new StereotypeApplicationRepairSnippet(Functions.constant((Profile) null)), "dispose", modelSet.getResourceSet());
}

Back to the top