Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2015-11-09 13:22:56 +0000
committerGerrit Code Review @ Eclipse.org2015-11-10 15:50:15 +0000
commit5ce08843b47589b81538ab57555bd65e035b70f9 (patch)
treea6ef1ad749a4500264797289c17555258902f4da /tests/junit/plugins/uml/decoratormodel
parent3de7eb4632c9a61581842271564c629805a14ba1 (diff)
downloadorg.eclipse.papyrus-5ce08843b47589b81538ab57555bd65e035b70f9.tar.gz
org.eclipse.papyrus-5ce08843b47589b81538ab57555bd65e035b70f9.tar.xz
org.eclipse.papyrus-5ce08843b47589b81538ab57555bd65e035b70f9.zip
Bug 481302: [Profile] when reapply profile you can lose information
https://bugs.eclipse.org/bugs/show_bug.cgi?id=481302 Work around the missing "foreign definitions" reference from a dynamic profile definition to a static definition that it extends. In the Papyrus implementation of the stereotype-application copier, look up UML definitions of Ecore elements in the implicitly referenced "foreign definitions" when not found by the default UML implementation. This provides for compatibility with dynamic profiles already deployed that are missing this annotation (even if an eventual fix for bug 481712 adds them to profile definitions in the future). Includes regression tests for: * dynamic profile extending a dynamic profile (control case) * dynamic profile extending a static profile, using Papyrus algorithm * dynamic profile extending a static profile, using UML2 algorithm (annotated as a failing test)
Diffstat (limited to 'tests/junit/plugins/uml/decoratormodel')
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/.classpath2
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/META-INF/MANIFEST.MF2
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/org.eclipse.papyrus.uml.decoratormodel.tests.launch5
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model.di2
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model.notation2
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model.uml13
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model2.di2
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model2.notation2
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model2.uml13
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/myreq.profile.uml30
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/p1.profile.uml30
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/p2.profile.uml36
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/AllTests.java6
-rw-r--r--tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/RegressionTest.java89
15 files changed, 231 insertions, 9 deletions
diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/.classpath b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/.classpath
index ad32c83a788..eca7bdba8f0 100644
--- a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/.classpath
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/.settings/org.eclipse.jdt.core.prefs
index 94d61f00da6..b3aa6d60f94 100644
--- a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,10 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/META-INF/MANIFEST.MF
index a3451c0155c..052cbaa2861 100644
--- a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/META-INF/MANIFEST.MF
@@ -30,4 +30,4 @@ Bundle-Name: %pluginName
Bundle-Localization: plugin
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.papyrus.uml.decoratormodel.tests;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
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 a32190d4f51..54d27be6342 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
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
<booleanAttribute key="append.args" value="true"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
<booleanAttribute key="askclear" value="false"/>
<booleanAttribute key="automaticAdd" value="true"/>
<booleanAttribute key="automaticValidate" value="false"/>
@@ -27,7 +28,7 @@
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.uml.decoratormodel.tests.AllTests"/>
<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"/>
@@ -41,5 +42,5 @@
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
<booleanAttribute key="useDefaultConfigArea" value="false"/>
-<booleanAttribute key="useProduct" value="true"/>
+<booleanAttribute key="useProduct" value="false"/>
</launchConfiguration>
diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model.di b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model.di
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/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/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model.notation b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model.notation
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model.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/regression/bug481302/model.uml b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model.uml
new file mode 100644
index 00000000000..b50128d5957
--- /dev/null
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model.uml
@@ -0,0 +1,13 @@
+<?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:p2="http://www.eclipse.org/papyrus/2015/test/p2" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/2015/test/p2 p2.profile.uml#_mFvSUYONEeW6odZslpwYig">
+ <uml:Model xmi:id="_rmch0IONEeW6odZslpwYig" name="model">
+ <packagedElement xmi:type="uml:Class" xmi:id="_yjSYIIONEeW6odZslpwYig" name="Requirement1"/>
+ <profileApplication xmi:id="_wtmB0IONEeW6odZslpwYig">
+ <eAnnotations xmi:id="_wtpsMIONEeW6odZslpwYig" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="p2.profile.uml#_mFvSUYONEeW6odZslpwYig"/>
+ </eAnnotations>
+ <appliedProfile href="p2.profile.uml#_7LcWMIOMEeW6odZslpwYig"/>
+ </profileApplication>
+ </uml:Model>
+ <p2:MyRequirement xmi:id="_ztlBAIONEeW6odZslpwYig" base_Class="_yjSYIIONEeW6odZslpwYig" id="R1"/>
+</xmi:XMI>
diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model2.di b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model2.di
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model2.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/regression/bug481302/model2.notation b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model2.notation
new file mode 100644
index 00000000000..bf9abab340f
--- /dev/null
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model2.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/regression/bug481302/model2.uml b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model2.uml
new file mode 100644
index 00000000000..3f1e464673c
--- /dev/null
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/model2.uml
@@ -0,0 +1,13 @@
+<?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:myreq="http://www.eclipse.org/papyrus/2015/test/myreq" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/2015/test/myreq myreq.profile.uml#_i5vQYYONEeW6odZslpwYig">
+ <uml:Model xmi:id="_rmch0IONEeW6odZslpwYig" name="model">
+ <packagedElement xmi:type="uml:Class" xmi:id="_yjSYIIONEeW6odZslpwYig" name="Requirement1"/>
+ <profileApplication xmi:id="_nAVyAIOQEeW6odZslpwYig">
+ <eAnnotations xmi:id="_nAVyAYOQEeW6odZslpwYig" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="myreq.profile.uml#_i5vQYYONEeW6odZslpwYig"/>
+ </eAnnotations>
+ <appliedProfile href="myreq.profile.uml#_GTaloIOMEeW6odZslpwYig"/>
+ </profileApplication>
+ </uml:Model>
+ <myreq:MyRequirement xmi:id="_oVHMkIOQEeW6odZslpwYig" id="R1" base_Class="_yjSYIIONEeW6odZslpwYig"/>
+</xmi:XMI>
diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/myreq.profile.uml b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/myreq.profile.uml
new file mode 100644
index 00000000000..b8fe8af4bbe
--- /dev/null
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/myreq.profile.uml
@@ -0,0 +1,30 @@
+<?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="_GTaloIOMEeW6odZslpwYig" name="myreq" URI="http://www.eclipse.org/papyrus/2015/test/myreq">
+ <eAnnotations xmi:id="_i5vQYIONEeW6odZslpwYig" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <contents xmi:type="ecore:EPackage" xmi:id="_zgrtIIOQEeW6odZslpwYig" name="myreq" nsURI="http://www.eclipse.org/papyrus/2015/test/myreq" nsPrefix="myreq">
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="_zgrtIYOQEeW6odZslpwYig" name="MyRequirement">
+ <eAnnotations xmi:id="_zgrtIoOQEeW6odZslpwYig" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_dBPocIOMEeW6odZslpwYig"/>
+ <eSuperTypes href="http://www.eclipse.org/papyrus/0.7.0/SysML#//requirements/Requirement"/>
+ <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_zgrtI4OQEeW6odZslpwYig" name="tag" ordered="false" upperBound="-1">
+ <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ </contents>
+ <contents xmi:type="ecore:EPackage" xmi:id="_i5vQYYONEeW6odZslpwYig" name="myreq" nsURI="http://www.eclipse.org/papyrus/2015/test/myreq" nsPrefix="myreq">
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="_i5vQYoONEeW6odZslpwYig" name="MyRequirement">
+ <eAnnotations xmi:id="_i5vQY4ONEeW6odZslpwYig" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_dBPocIOMEeW6odZslpwYig"/>
+ <eSuperTypes href="http://www.eclipse.org/papyrus/0.7.0/SysML#//requirements/Requirement"/>
+ </eClassifiers>
+ </contents>
+ </eAnnotations>
+ <packagedElement xmi:type="uml:Stereotype" xmi:id="_dBPocIOMEeW6odZslpwYig" name="MyRequirement">
+ <generalization xmi:id="_gIr6gIOMEeW6odZslpwYig">
+ <general xmi:type="uml:Stereotype" href="pathmap://SysML_PROFILES/SysML.profile.uml#_xajygLXqEduHWpAaWjM62w"/>
+ </generalization>
+ <ownedAttribute xmi:id="_sntDIIOQEeW6odZslpwYig" name="tag">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_t2Zq4IOQEeW6odZslpwYig"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_vUTzUIOQEeW6odZslpwYig" value="*"/>
+ </ownedAttribute>
+ </packagedElement>
+</uml:Profile>
diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/p1.profile.uml b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/p1.profile.uml
new file mode 100644
index 00000000000..37f049f96c4
--- /dev/null
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/p1.profile.uml
@@ -0,0 +1,30 @@
+<?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="_7LcWMIOMEeW6odZslpwYig" name="p1" URI="http://www.eclipse.org/papyrus/2015/test/p1" metaclassReference="_DkXwAIONEeW6odZslpwYig">
+ <eAnnotations xmi:id="_MxK2wIONEeW6odZslpwYig" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <contents xmi:type="ecore:EPackage" xmi:id="_MxK2wYONEeW6odZslpwYig" name="p1" nsURI="http://www.eclipse.org/papyrus/2015/test/p1" nsPrefix="p1">
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="_MxK2woONEeW6odZslpwYig" name="Requirement">
+ <eAnnotations xmi:id="_MxK2w4ONEeW6odZslpwYig" source="http://www.eclipse.org/uml2/2.0.0/UML" references="__yTMkIOMEeW6odZslpwYig"/>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_MxK2xIONEeW6odZslpwYig" name="base_Class" ordered="false" lowerBound="1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_MxK2xoONEeW6odZslpwYig" name="id" ordered="false" lowerBound="1">
+ <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ </contents>
+ </eAnnotations>
+ <elementImport xmi:id="_DkXwAIONEeW6odZslpwYig">
+ <importedElement xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ </elementImport>
+ <packagedElement xmi:type="uml:Stereotype" xmi:id="__yTMkIOMEeW6odZslpwYig" name="Requirement">
+ <ownedAttribute xmi:id="_E8A4YIONEeW6odZslpwYig" name="base_Class" association="_E8ARUIONEeW6odZslpwYig">
+ <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Class"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:id="_HQWSgIONEeW6odZslpwYig" name="id">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Extension" xmi:id="_E8ARUIONEeW6odZslpwYig" name="Class_Requirement" memberEnd="_E8ARUYONEeW6odZslpwYig _E8A4YIONEeW6odZslpwYig">
+ <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_E8ARUYONEeW6odZslpwYig" name="extension_Requirement" type="__yTMkIOMEeW6odZslpwYig" aggregation="composite" association="_E8ARUIONEeW6odZslpwYig"/>
+ </packagedElement>
+</uml:Profile>
diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/p2.profile.uml b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/p2.profile.uml
new file mode 100644
index 00000000000..6bf9c86da70
--- /dev/null
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/resources/regression/bug481302/p2.profile.uml
@@ -0,0 +1,36 @@
+<?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="_7LcWMIOMEeW6odZslpwYig" name="p2" URI="http://www.eclipse.org/papyrus/2015/test/p2">
+ <eAnnotations xmi:id="_mFvSUIONEeW6odZslpwYig" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <contents xmi:type="ecore:EPackage" xmi:id="_BEbtYIOOEeW6odZslpwYig" name="p2" nsURI="http://www.eclipse.org/papyrus/2015/test/p2" nsPrefix="p2">
+ <eAnnotations xmi:id="_BEbtYYOOEeW6odZslpwYig" source="http://www.eclipse.org/uml2/4.1.0/UML">
+ <references xmi:type="ecore:EPackage" href="p1.profile.uml#_MxK2wYONEeW6odZslpwYig"/>
+ </eAnnotations>
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="_BEbtYoOOEeW6odZslpwYig" name="MyRequirement">
+ <eAnnotations xmi:id="_BEbtY4OOEeW6odZslpwYig" source="http://www.eclipse.org/uml2/2.0.0/UML" references="__yTMkIOMEeW6odZslpwYig"/>
+ <eSuperTypes href="p1.profile.uml#_MxK2woONEeW6odZslpwYig"/>
+ <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_BEbtZIOOEeW6odZslpwYig" name="tag" ordered="false" upperBound="-1">
+ <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ </contents>
+ <contents xmi:type="ecore:EPackage" xmi:id="_mFvSUYONEeW6odZslpwYig" name="p2" nsURI="http://www.eclipse.org/papyrus/2015/test/p2" nsPrefix="p2">
+ <eAnnotations xmi:id="_mFvSUoONEeW6odZslpwYig" source="http://www.eclipse.org/uml2/4.1.0/UML">
+ <references xmi:type="ecore:EPackage" href="p1.profile.uml#_MxK2wYONEeW6odZslpwYig"/>
+ </eAnnotations>
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="_mFvSU4ONEeW6odZslpwYig" name="MyRequirement">
+ <eAnnotations xmi:id="_mFvSVIONEeW6odZslpwYig" source="http://www.eclipse.org/uml2/2.0.0/UML" references="__yTMkIOMEeW6odZslpwYig"/>
+ <eSuperTypes href="p1.profile.uml#_MxK2woONEeW6odZslpwYig"/>
+ </eClassifiers>
+ </contents>
+ </eAnnotations>
+ <packagedElement xmi:type="uml:Stereotype" xmi:id="__yTMkIOMEeW6odZslpwYig" name="MyRequirement">
+ <generalization xmi:id="_YVcLMIONEeW6odZslpwYig">
+ <general xmi:type="uml:Stereotype" href="p1.profile.uml#__yTMkIOMEeW6odZslpwYig"/>
+ </generalization>
+ <ownedAttribute xmi:id="_7E8QIIONEeW6odZslpwYig" name="tag">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_8kuA0IONEeW6odZslpwYig"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_9Xh90IONEeW6odZslpwYig" value="*"/>
+ </ownedAttribute>
+ </packagedElement>
+</uml:Profile>
diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/AllTests.java b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/AllTests.java
index b45c7d3f852..c44373f37da 100644
--- a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/AllTests.java
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/AllTests.java
@@ -10,10 +10,12 @@
* Remi Schnekenburger (CEA LIST) - Initial API and implementation
* Christian W. Damus - bug 399859
* Christian W. Damus - bug 468030
+ * Christian W. Damus - bug 481302
*
*****************************************************************************/
package org.eclipse.papyrus.uml.decoratormodel.tests;
+import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite;
import org.eclipse.papyrus.uml.decoratormodel.helper.tests.DecoratorModelUtilsTest;
import org.eclipse.papyrus.uml.decoratormodel.helper.tests.PapyrusStereotypeApplicationHelperTest;
import org.eclipse.papyrus.uml.decoratormodel.internal.expressions.tests.FilePropertyTesterTest;
@@ -21,7 +23,6 @@ import org.eclipse.papyrus.uml.decoratormodel.internal.resource.index.tests.Prof
import org.eclipse.papyrus.uml.decoratormodel.internal.resource.tests.DecoratorModelCopierTest;
import org.eclipse.papyrus.uml.decoratormodel.internal.resource.tests.DecoratorModelIndexTest;
import org.junit.runner.RunWith;
-import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite;
import org.junit.runners.Suite.SuiteClasses;
@@ -35,7 +36,8 @@ import org.junit.runners.Suite.SuiteClasses;
DecoratorModelIndexTest.class, DecoratorModelCopierTest.class, //
DecoratorModelUtilsTest.class, PapyrusStereotypeApplicationHelperTest.class, //
FilePropertyTesterTest.class,
- ProfileIndexTest.class
+ ProfileIndexTest.class,
+ RegressionTest.class,
})
public class AllTests {
// Test suite
diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/RegressionTest.java b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/RegressionTest.java
new file mode 100644
index 00000000000..ffe951885dd
--- /dev/null
+++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/RegressionTest.java
@@ -0,0 +1,89 @@
+/*****************************************************************************
+ * Copyright (c) 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.decoratormodel.tests;
+
+import static java.util.Arrays.asList;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assume.assumeThat;
+
+import java.util.function.BiConsumer;
+
+import org.eclipse.papyrus.junit.framework.classification.FailingTest;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.papyrus.uml.tools.helper.IProfileApplicationDelegate;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.Stereotype;
+import org.junit.Test;
+
+/**
+ * Tests regressions in specific bugs.
+ */
+public class RegressionTest extends AbstractProfileExternalizationTest {
+ public RegressionTest() {
+ super();
+ }
+
+ @Test
+ @PluginResource("/resources/regression/bug481302/model.di")
+ public void migrateProfileExtendingDynamic_bug481302() throws Exception {
+ doTestMigrateProfileExtendingOther_bug481302("p2", this::migrate);
+ }
+
+ protected void doTestMigrateProfileExtendingOther_bug481302(String profileName,
+ BiConsumer<? super Package, ? super Profile> migrator) throws Exception {
+
+ Package model = modelSet.getModel();
+ org.eclipse.uml2.uml.Class req1 = (org.eclipse.uml2.uml.Class) model.getOwnedType("Requirement1");
+ Profile profile = modelSet.getModel().getAllAppliedProfiles().get(0);
+ Stereotype myReq = req1.getAppliedStereotype(profileName + "::MyRequirement");
+
+ // Initial conditions check
+ assumeThat((String) req1.getValue(myReq, "id"), is("R1"));
+
+ execute(() -> migrator.accept(model, profile));
+
+ // Verify that no data lost and new attribute is available
+ assertThat((String) req1.getValue(myReq, "id"), is("R1"));
+ execute(() -> req1.setValue(myReq, "tag", asList("red", "high")));
+ String tag = (String) req1.getValue(myReq, "tag[1]");
+ assertThat(tag, is("high"));
+ }
+
+ @Test
+ @PluginResource("/resources/regression/bug481302/model2.di")
+ public void migrateProfileExtendingStatic_bug481302() throws Exception {
+ doTestMigrateProfileExtendingOther_bug481302("myreq", this::migrate);
+ }
+
+ @Test
+ @FailingTest("Use case not supported by UML2: bug 481712")
+ @PluginResource("/resources/regression/bug481302/model2.di")
+ public void basicUMLMigrateProfileExtendingStatic_bug481302() throws Exception {
+ doTestMigrateProfileExtendingOther_bug481302("myreq",
+ (package_, profile) -> package_.applyProfile(profile));
+ }
+
+ //
+ // Test framework
+ //
+
+ void migrate(Package package_, Profile profile) {
+ @SuppressWarnings("restriction")
+ IProfileApplicationDelegate delegate = new org.eclipse.papyrus.uml.decoratormodel.internal.providers.ExternalizedProfileApplicationDelegate();
+
+ delegate.reapplyProfile(package_, profile, null);
+ }
+}

Back to the top