Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extraplugins/migration/org.eclipse.papyrus.migration.rsa/META-INF/MANIFEST.MF2
-rw-r--r--extraplugins/migration/org.eclipse.papyrus.migration.rsa/pom.xml2
-rw-r--r--extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java4
-rw-r--r--extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/MigrationResourceSetImpl.java44
-rw-r--r--extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ProfileMappingAwareURIConverter.java102
-rw-r--r--tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/META-INF/MANIFEST.MF4
-rw-r--r--tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/plugin.xml3
-rw-r--r--tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/pom.xml2
-rw-r--r--tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/resources/bug505330/first.emx38
-rw-r--r--tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/resources/bug505330/today.profile.uml137
-rw-r--r--tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/AbstractMigrationRegressionTest.java153
-rw-r--r--tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/RegressionTests.java1
-rw-r--r--tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/StereotypeApplicationsTest.java153
-rw-r--r--tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/StructureDiagramTest.java55
14 files changed, 625 insertions, 75 deletions
diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/META-INF/MANIFEST.MF b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/META-INF/MANIFEST.MF
index 5eddd4375e3..8b8fe618b38 100644
--- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/META-INF/MANIFEST.MF
+++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/META-INF/MANIFEST.MF
@@ -55,7 +55,7 @@ Export-Package: org.eclipse.papyrus.migration.rsa,
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
-Bundle-Version: 1.3.0.qualifier
+Bundle-Version: 1.3.1.qualifier
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-Activator: org.eclipse.papyrus.migration.rsa.Activator
diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/pom.xml b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/pom.xml
index 50b67527721..1425a4ead0d 100644
--- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/pom.xml
+++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/pom.xml
@@ -9,6 +9,6 @@
</parent>
<artifactId>org.eclipse.papyrus.migration.rsa</artifactId>
<groupId>org.eclipse.papyrus</groupId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.3.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java
index 5150068adb1..78592d38676 100644
--- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java
+++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java
@@ -8,7 +8,7 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus - bugs 496439, 496299
+ * Christian W. Damus - bugs 496439, 496299, 505330
*****************************************************************************/
package org.eclipse.papyrus.migration.rsa.transformation;
@@ -357,7 +357,7 @@ public class ImportTransformation {
* Initializes the resource set, and resolve all dependencies
*/
protected void initResourceSet(IProgressMonitor monitor) {
- resourceSet = new MigrationResourceSetImpl();
+ resourceSet = new MigrationResourceSetImpl(analysisHelper);
synchronized (UMLUtil.class) {
UMLUtil.init(resourceSet);
}
diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/MigrationResourceSetImpl.java b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/MigrationResourceSetImpl.java
index ad00c82feb0..aed65550072 100644
--- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/MigrationResourceSetImpl.java
+++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/MigrationResourceSetImpl.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
+ * Copyright (c) 2015, 2016 CEA LIST, 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
@@ -8,6 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus - bug 505330
*
*****************************************************************************/
@@ -26,34 +27,45 @@ public class MigrationResourceSetImpl extends ThreadSafeResourceSet implements M
private boolean frozen = false;
/**
- * @see org.eclipse.papyrus.migration.rsa.transformation.MigrationResourceSet#freeze()
- *
+ * Initializes me without a dependency analysis helper, which is not recommended
+ * because then it will be difficult for me to resolve profile namespace locations.
+ *
+ * @deprecated Use the {@link #MigrationResourceSetImpl(DependencyAnalysisHelper)} constructor, instead
*/
+ @Deprecated
+ public MigrationResourceSetImpl() {
+ this(null);
+ }
+
+ /**
+ * Initializes me with my dependency analysis helper.
+ *
+ * @param dependencyHelper
+ * my dependency analysis helper, or {@code null} if none
+ */
+ public MigrationResourceSetImpl(DependencyAnalysisHelper dependencyHelper) {
+ super();
+
+ if (dependencyHelper != null) {
+ // Install a URI converter that maps *.epx to *.profile.uml where
+ // the target actually exists
+ setURIConverter(new ProfileMappingAwareURIConverter(this, dependencyHelper));
+ }
+ }
+
@Override
public void freeze() {
this.frozen = true;
}
- /**
- * @see org.eclipse.papyrus.migration.rsa.transformation.MigrationResourceSet#unfreeze()
- *
- */
@Override
public void unfreeze() {
this.frozen = false;
}
-
- /**
- * @see org.eclipse.emf.ecore.resource.impl.ResourceSetImpl#getResource(org.eclipse.emf.common.util.URI, boolean)
- *
- * @param uri
- * @param loadOnDemand
- * @return
- */
+
@Override
public Resource getResource(URI uri, boolean loadOnDemand) {
return super.getResource(uri, frozen ? false : loadOnDemand);
}
-
}
diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ProfileMappingAwareURIConverter.java b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ProfileMappingAwareURIConverter.java
new file mode 100644
index 00000000000..f50bdb24085
--- /dev/null
+++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ProfileMappingAwareURIConverter.java
@@ -0,0 +1,102 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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.migration.rsa.transformation;
+
+import static org.eclipse.emf.common.util.URI.createURI;
+
+import java.util.Map;
+import java.util.Optional;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl;
+import org.eclipse.emf.ecore.resource.impl.URIMappingRegistryImpl;
+import org.eclipse.papyrus.migration.rsa.RSAToPapyrusParameters.URIMapping;
+
+import com.google.common.collect.Maps;
+
+/**
+ * A custom URI converter that lets the resource set find the Papyrus versions of
+ * profiles imported from RSA automatically, especially to resolve schema locations
+ * before the dependency-mapping/stereotype-repair phase.
+ */
+class ProfileMappingAwareURIConverter extends ExtensibleURIConverterImpl {
+
+ private final ResourceSet owner;
+ private final DependencyAnalysisHelper dependencyHelper;
+
+ private final Map<URI, Optional<URIMapping>> profileMappings = Maps.newConcurrentMap();
+
+ /**
+ * Initializes me with the resource set that owns me and a dependency analysis
+ * helper that resolves profile mappings within it.
+ *
+ * @param owner
+ * my contextual resource set
+ * @param dependencyHelper
+ * the profile mapping helper
+ */
+ public ProfileMappingAwareURIConverter(ResourceSet owner, DependencyAnalysisHelper dependencyHelper) {
+ super();
+
+ this.owner = owner;
+ this.dependencyHelper = dependencyHelper;
+ }
+
+ @Override
+ protected URIMap getInternalURIMap() {
+
+ if (uriMap == null) {
+ URIMap delegate = super.getInternalURIMap();
+ uriMap = (URIMap) new URIMappingRegistryImpl() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected URI delegatedGetURI(URI uri) {
+ URI result;
+
+ if (!"epx".equalsIgnoreCase(uri.fileExtension())) {
+ result = delegate.getURI(uri);
+ } else {
+ Optional<URIMapping> mapping = getProfileMapping(uri);
+ result = mapping
+ .map(m -> createURI(m.getTargetURI()))
+ .orElseGet(() -> delegate.getURI(uri));
+ }
+
+ return result;
+ }
+ }.map();
+ }
+
+ return uriMap;
+
+ }
+
+ private Optional<URIMapping> getProfileMapping(URI uri) {
+ return profileMappings.computeIfAbsent(uri, this::findProfileMapping);
+ }
+
+ private Optional<URIMapping> findProfileMapping(URI uri) {
+ // If the EPX actually exists, use it. And we must use an independent
+ // converter instance for this test, because otherwise we will
+ // deadlock on re-entrance into looking for a profile mapping
+ URIMapping result = URIConverter.INSTANCE.exists(uri, null)
+ ? null
+ : dependencyHelper.findExistingProfileMapping(uri, owner);
+ return Optional.ofNullable(result);
+ }
+
+}
diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/META-INF/MANIFEST.MF b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/META-INF/MANIFEST.MF
index 126a9ffb7d0..95383ef7e8c 100644
--- a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/META-INF/MANIFEST.MF
@@ -5,7 +5,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.m2m.qvt.oml;bundle-version="3.4.0",
org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="1.2.0",
- org.eclipse.papyrus.migration.rsa;bundle-version="1.3.0",
+ org.eclipse.papyrus.migration.rsa;bundle-version="1.3.1",
org.eclipse.ui;bundle-version="3.106.0",
org.junit;bundle-version="4.11.0",
org.eclipse.papyrus.m2m.qvto;bundle-version="1.3.0",
@@ -38,7 +38,7 @@ Export-Package: org.eclipse.papyrus.migration.rsa.tests,
org.eclipse.papyrus.migration.rsa.tests.qvt
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.3.0.qualifier
+Bundle-Version: 1.3.1.qualifier
Bundle-Name: Model import migration Tests (Incubation)
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.papyrus.migration.rsa.tests.Activator
diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/plugin.xml b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/plugin.xml
index ab5c4ed8ea6..6d899470e3d 100644
--- a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/plugin.xml
+++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/plugin.xml
@@ -40,5 +40,8 @@
<transformation
className="org.eclipse.papyrus.migration.rsa.tests.UML25HandlerExtension">
</transformation>
+ <transformation
+ className="org.eclipse.papyrus.migration.rsa.tests.regression.StereotypeApplicationsTest$MigrationTracker">
+ </transformation>
</extension>
</plugin>
diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/pom.xml b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/pom.xml
index fafe9903b74..2d52aa34723 100644
--- a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/pom.xml
+++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/pom.xml
@@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.papyrus</groupId>
<artifactId>org.eclipse.papyrus.migration.rsa.tests</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.3.1-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
</project>
diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/resources/bug505330/first.emx b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/resources/bug505330/first.emx
new file mode 100644
index 00000000000..529b7dcf99d
--- /dev/null
+++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/resources/bug505330/first.emx
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--xtools2_universal_type_manager-->
+<!--Rational Software Architect RealTime Edition 9.1.2-->
+<?com.ibm.xtools.emf.core.signature <signature id="com.ibm.xtools.mmi.ui.signatures.diagram" version="7.0.0"><feature description="" name="Rational Modeling Platform (com.ibm.xtools.rmp)" url="" version="7.0.0"/></signature>?>
+<?com.ibm.xtools.emf.core.signature <signature id="com.ibm.xtools.uml.msl.model" version="7.0.0"><feature description="" name="com.ibm.xtools.ruml.feature" url="" version="7.0.0"/></signature>?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:today="http:///schemas/today/__PMdsJBVEea9gsZP7hrDPQ/2" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xsi:schemaLocation="http:///schemas/today/__PMdsJBVEea9gsZP7hrDPQ/2 today.epx#__PMdsZBVEea9gsZP7hrDPQ?today/today?">
+ <uml:Package xmi:id="_JExbsJBWEea9gsZP7hrDPQ" name="first">
+ <eAnnotations xmi:id="_JExbsZBWEea9gsZP7hrDPQ" source="uml2.diagrams"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_OLZ-UJBWEea9gsZP7hrDPQ" name="Class1"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_Q_aXAJBWEea9gsZP7hrDPQ" name="Class2"/>
+ <profileApplication xmi:id="_JExbtJBWEea9gsZP7hrDPQ">
+ <eAnnotations xmi:id="_JExbtZBWEea9gsZP7hrDPQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="pathmap://UML_PROFILES/Standard.profile.uml#_yzU58YinEdqtvbnfB2L_5w"/>
+ </eAnnotations>
+ <appliedProfile href="pathmap://UML_PROFILES/Standard.profile.uml#_0"/>
+ </profileApplication>
+ <profileApplication xmi:id="_JExbtpBWEea9gsZP7hrDPQ">
+ <eAnnotations xmi:id="_JExbt5BWEea9gsZP7hrDPQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="pathmap://UML2_MSL_PROFILES/Default.epx#_fNwoAAqoEd6-N_NOT9vsCA?Default/Default?"/>
+ </eAnnotations>
+ <appliedProfile href="pathmap://UML2_MSL_PROFILES/Default.epx#_a_S3wNWLEdiy4IqP8whjFA?Default?"/>
+ </profileApplication>
+ <profileApplication xmi:id="_JExbuJBWEea9gsZP7hrDPQ">
+ <eAnnotations xmi:id="_JExbuZBWEea9gsZP7hrDPQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="pathmap://UML2_MSL_PROFILES/Deployment.epx#_4OVBUD0TEeKt-L0gyEptgQ?Deployment/Deployment?"/>
+ </eAnnotations>
+ <appliedProfile href="pathmap://UML2_MSL_PROFILES/Deployment.epx#_vjbuwOvHEdiDX5bji0iVSA?Deployment?"/>
+ </profileApplication>
+ <profileApplication xmi:id="_MiMk0JBWEea9gsZP7hrDPQ">
+ <eAnnotations xmi:id="_MiMk0ZBWEea9gsZP7hrDPQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="today.epx#__PMdsZBVEea9gsZP7hrDPQ?today/today?"/>
+ </eAnnotations>
+ <appliedProfile href="today.epx#_0UUrkJBVEea9gsZP7hrDPQ?today?"/>
+ </profileApplication>
+ </uml:Package>
+ <today:Foo xmi:id="_QLtCIJBWEea9gsZP7hrDPQ" base_Classifier="_OLZ-UJBWEea9gsZP7hrDPQ"/>
+ <today:Bar xmi:id="_RxU8IJBWEea9gsZP7hrDPQ" base_Classifier="_Q_aXAJBWEea9gsZP7hrDPQ"/>
+</xmi:XMI>
diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/resources/bug505330/today.profile.uml b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/resources/bug505330/today.profile.uml
new file mode 100644
index 00000000000..de54d55173a
--- /dev/null
+++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/resources/bug505330/today.profile.uml
@@ -0,0 +1,137 @@
+<?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="_0UUrkJBVEea9gsZP7hrDPQ" name="today" metamodelReference="_0UUrkZBVEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_0UUrlZBVEea9gsZP7hrDPQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <contents xmi:type="ecore:EPackage" xmi:id="_lojlQZBWEea9gsZP7hrDPQ" name="today" nsURI="http:///schemas/today/_lojlQJBWEea9gsZP7hrDPQ/4" nsPrefix="today">
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="_lojlQpBWEea9gsZP7hrDPQ" name="Foo">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_lojlQ5BWEea9gsZP7hrDPQ" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_317KEJBVEea9gsZP7hrDPQ"/>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_lojlRJBWEea9gsZP7hrDPQ" name="base_Classifier" ordered="false" lowerBound="1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/3.0.0/UML#//Classifier"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_lojlRpBWEea9gsZP7hrDPQ" name="base_Property" ordered="false" lowerBound="1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/3.0.0/UML#//Property"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="_lojlSJBWEea9gsZP7hrDPQ" name="Bar">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_lojlSZBWEea9gsZP7hrDPQ" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_8_Y-QJBVEea9gsZP7hrDPQ"/>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_lojlSpBWEea9gsZP7hrDPQ" name="base_Classifier" ordered="false" lowerBound="1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/3.0.0/UML#//Classifier"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_lojlTJBWEea9gsZP7hrDPQ" name="base_Property" ordered="false" lowerBound="1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/3.0.0/UML#//Property"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ </contents>
+ <contents xmi:type="ecore:EPackage" xmi:id="__PMdsZBVEea9gsZP7hrDPQ" name="today" nsURI="http:///schemas/today/__PMdsJBVEea9gsZP7hrDPQ/2" nsPrefix="today">
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="__PMdspBVEea9gsZP7hrDPQ" name="Foo">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="__PMds5BVEea9gsZP7hrDPQ" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_317KEJBVEea9gsZP7hrDPQ"/>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="__PMdtJBVEea9gsZP7hrDPQ" name="base_Classifier" ordered="false" lowerBound="1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/3.0.0/UML#//Classifier"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xmi:type="ecore:EClass" xmi:id="__PMdtpBVEea9gsZP7hrDPQ" name="Bar">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="__PMdt5BVEea9gsZP7hrDPQ" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_8_Y-QJBVEea9gsZP7hrDPQ"/>
+ <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="__PMduJBVEea9gsZP7hrDPQ" name="base_Classifier" ordered="false" lowerBound="1">
+ <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/3.0.0/UML#//Classifier"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ </contents>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_AYWeIJBWEea9gsZP7hrDPQ" source="uml2.versions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_AYWeIZBWEea9gsZP7hrDPQ" key="2" value="1.0"/>
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_ml8akJBWEea9gsZP7hrDPQ" key="4" value="2.0"/>
+ </eAnnotations>
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_0UUrkZBVEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_72h4xpBVEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_72h4x5BVEea9gsZP7hrDPQ" key="addedInVersion" value="1"/>
+ </eAnnotations>
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_METAMODELS/UML.metamodel.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:Stereotype" xmi:id="_317KEJBVEea9gsZP7hrDPQ" name="Foo">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_72h4yJBVEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_72h4yZBVEea9gsZP7hrDPQ" key="addedInVersion" value="1"/>
+ </eAnnotations>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_6lUIgpBVEea9gsZP7hrDPQ" name="base_Classifier" association="_6lUIgJBVEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_72h4ypBVEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_72h4y5BVEea9gsZP7hrDPQ" key="addedInVersion" value="1"/>
+ </eAnnotations>
+ <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Classifier"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_PAz_sJB_EeaU9eIeWn3qjg"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_PAz_sZB_EeaU9eIeWn3qjg" value="1"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_ipEVUpBWEea9gsZP7hrDPQ" name="base_Property" association="_ipEVUJBWEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_jI9WXJBWEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_jI9WXZBWEea9gsZP7hrDPQ" key="addedInVersion" value="3"/>
+ </eAnnotations>
+ <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Property"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_PAz_spB_EeaU9eIeWn3qjg"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_PAz_s5B_EeaU9eIeWn3qjg" value="1"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Extension" xmi:id="_6lUIgJBVEea9gsZP7hrDPQ" name="Classifier_Foo" memberEnd="_6lUIgZBVEea9gsZP7hrDPQ _6lUIgpBVEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_72h4zJBVEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_72h4zZBVEea9gsZP7hrDPQ" key="addedInVersion" value="1"/>
+ </eAnnotations>
+ <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_6lUIgZBVEea9gsZP7hrDPQ" name="extension_Foo" type="_317KEJBVEea9gsZP7hrDPQ" aggregation="composite" association="_6lUIgJBVEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_72h4zpBVEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_72h4z5BVEea9gsZP7hrDPQ" key="addedInVersion" value="1"/>
+ </eAnnotations>
+ </ownedEnd>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Stereotype" xmi:id="_8_Y-QJBVEea9gsZP7hrDPQ" name="Bar">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="__PMdupBVEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="__PMdu5BVEea9gsZP7hrDPQ" key="addedInVersion" value="2"/>
+ </eAnnotations>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_-955YpBVEea9gsZP7hrDPQ" name="base_Classifier" association="_-955YJBVEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="__PMdvJBVEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="__PMdvZBVEea9gsZP7hrDPQ" key="addedInVersion" value="2"/>
+ </eAnnotations>
+ <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Classifier"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_PAz_tJB_EeaU9eIeWn3qjg"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_PAz_tZB_EeaU9eIeWn3qjg" value="1"/>
+ </ownedAttribute>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_lS8hopBWEea9gsZP7hrDPQ" name="base_Property" association="_lS8hoJBWEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_lojlTpBWEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_lojlT5BWEea9gsZP7hrDPQ" key="addedInVersion" value="4"/>
+ </eAnnotations>
+ <type xmi:type="uml:Class" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Property"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_PAz_tpB_EeaU9eIeWn3qjg"/>
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_PAz_t5B_EeaU9eIeWn3qjg" value="1"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Extension" xmi:id="_-955YJBVEea9gsZP7hrDPQ" name="Classifier_Bar" memberEnd="_-955YZBVEea9gsZP7hrDPQ _-955YpBVEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="__PMdvpBVEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="__PMdv5BVEea9gsZP7hrDPQ" key="addedInVersion" value="2"/>
+ </eAnnotations>
+ <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_-955YZBVEea9gsZP7hrDPQ" name="extension_Bar" type="_8_Y-QJBVEea9gsZP7hrDPQ" aggregation="composite" association="_-955YJBVEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="__PMdwJBVEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="__PMdwZBVEea9gsZP7hrDPQ" key="addedInVersion" value="2"/>
+ </eAnnotations>
+ </ownedEnd>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Extension" xmi:id="_ipEVUJBWEea9gsZP7hrDPQ" name="Property_Foo" memberEnd="_ipEVUZBWEea9gsZP7hrDPQ _ipEVUpBWEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_jI9WXpBWEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_jI9WX5BWEea9gsZP7hrDPQ" key="addedInVersion" value="3"/>
+ </eAnnotations>
+ <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_ipEVUZBWEea9gsZP7hrDPQ" name="extension_Foo" type="_317KEJBVEea9gsZP7hrDPQ" aggregation="composite" association="_ipEVUJBWEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_jI9WYJBWEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_jI9WYZBWEea9gsZP7hrDPQ" key="addedInVersion" value="3"/>
+ </eAnnotations>
+ </ownedEnd>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Extension" xmi:id="_lS8hoJBWEea9gsZP7hrDPQ" name="Property_Bar" memberEnd="_lS8hoZBWEea9gsZP7hrDPQ _lS8hopBWEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_lojlUJBWEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_lojlUZBWEea9gsZP7hrDPQ" key="addedInVersion" value="4"/>
+ </eAnnotations>
+ <ownedEnd xmi:type="uml:ExtensionEnd" xmi:id="_lS8hoZBWEea9gsZP7hrDPQ" name="extension_Bar" type="_8_Y-QJBVEea9gsZP7hrDPQ" aggregation="composite" association="_lS8hoJBWEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_lojlUpBWEea9gsZP7hrDPQ" source="uml2.extensions">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_lojlU5BWEea9gsZP7hrDPQ" key="addedInVersion" value="4"/>
+ </eAnnotations>
+ </ownedEnd>
+ </packagedElement>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_0UUrkpBVEea9gsZP7hrDPQ">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_0UUrk5BVEea9gsZP7hrDPQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/dsmlvalidation#/"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://DSMLValidation_PROFILES/PapyrusValidationRuleDSML.uml#__sUW0OhNEeCjcc2EgK3Uwg"/>
+ </profileApplication>
+</uml:Profile>
diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/AbstractMigrationRegressionTest.java b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/AbstractMigrationRegressionTest.java
new file mode 100644
index 00000000000..40d87448295
--- /dev/null
+++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/AbstractMigrationRegressionTest.java
@@ -0,0 +1,153 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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.migration.rsa.tests.regression;
+
+import static org.junit.Assert.fail;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.papyrus.junit.utils.JUnitUtils;
+import org.eclipse.papyrus.junit.utils.rules.AnnotationRule;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.papyrus.migration.rsa.internal.extension.TransformationExtension;
+import org.eclipse.papyrus.migration.rsa.tests.qvt.AbstractTransformationTest;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.junit.rules.TestRule;
+import org.junit.rules.TestWatcher;
+import org.junit.runner.Description;
+
+import com.google.common.collect.Lists;
+
+/**
+ * Common framework for regression tests in RSA migration.
+ */
+public abstract class AbstractMigrationRegressionTest extends AbstractTransformationTest {
+
+ @Rule
+ public final TestName name = new TestName();
+
+ @Rule
+ public final AnnotationRule<String[]> testModel = AnnotationRule.create(PluginResource.class);
+
+ @Rule
+ public final AnnotationRule<Boolean> batchMode = AnnotationRule.create(BatchMigration.class);
+
+ @Rule
+ public final TestRule transformationExtensions = new TransformationRule();
+
+ /**
+ * Initializes me.
+ */
+ protected AbstractMigrationRegressionTest() {
+ super();
+ }
+
+ @Before
+ public void importAndOpen() throws Exception {
+ List<String> resourcePaths = Lists.newArrayList(testModel.get());
+
+ Matcher bugMatcher = Pattern.compile("^(bug\\d+)/").matcher("");
+
+ resourcePaths.replaceAll(p -> {
+ String bug;
+
+ bugMatcher.reset(p);
+
+ if (bugMatcher.find()) {
+ bug = bugMatcher.group(1);
+
+ // Don't be redundant
+ p = p.substring(bugMatcher.end());
+ } else {
+ bug = name.getMethodName();
+ bug = bug.substring(bug.lastIndexOf('_') + 1);
+ }
+
+ return String.format("resources/%s/%s", bug, p);
+ });
+
+ simpleImport(resourcePaths.get(0),
+ resourcePaths.stream().skip(1).toArray(String[]::new),
+ batchMode.get());
+
+ openEditor();
+ }
+
+ //
+ // Nested types
+ //
+
+ /**
+ * Annotates a test or suite with the transformation extensions that
+ * it should enable for the duration of the test.
+ */
+ @Target({ ElementType.TYPE, ElementType.METHOD })
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface TransformationExtensionClass {
+ /** The transformation extension classes to enable. */
+ java.lang.Class<? extends TransformationExtension>[] value();
+ }
+
+ /**
+ * Annotates a test or suite to indicate whether batch import is needed.
+ */
+ @Target({ ElementType.TYPE, ElementType.METHOD })
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface BatchMigration {
+ /** Migrate in batch? */
+ boolean value() default true;
+ }
+
+ private static final class TransformationRule extends TestWatcher {
+ /**
+ * Enable the test transformations.
+ */
+ @Override
+ protected void starting(Description description) {
+ TransformationExtensionClass ext = JUnitUtils.getAnnotation(description, TransformationExtensionClass.class);
+ if (ext != null) {
+ Arrays.asList(ext.value()).forEach(e -> setEnabled(e, true));
+ }
+ }
+
+ /**
+ * Disable the test transformations.
+ */
+ @Override
+ protected void finished(Description description) {
+ TransformationExtensionClass ext = JUnitUtils.getAnnotation(description, TransformationExtensionClass.class);
+ if (ext != null) {
+ Arrays.asList(ext.value()).forEach(e -> setEnabled(e, true));
+ }
+ }
+
+ private void setEnabled(java.lang.Class<? extends TransformationExtension> ext, boolean enabled) {
+ try {
+ ext.getDeclaredField("isEnabled").set(null, enabled);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Failed to enable or disable transformation extension");
+ }
+ }
+ }
+}
diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/RegressionTests.java b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/RegressionTests.java
index 58748706b11..c953070317f 100644
--- a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/RegressionTests.java
+++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/RegressionTests.java
@@ -24,6 +24,7 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
StructureDiagramTest.class,
+ StereotypeApplicationsTest.class,
})
public class RegressionTests {
// All is specified in annotations
diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/StereotypeApplicationsTest.java b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/StereotypeApplicationsTest.java
new file mode 100644
index 00000000000..425758fb6a7
--- /dev/null
+++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/StereotypeApplicationsTest.java
@@ -0,0 +1,153 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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.migration.rsa.tests.regression;
+
+import static java.util.Spliterators.spliteratorUnknownSize;
+import static org.eclipse.papyrus.junit.matchers.MoreMatchers.lessThan;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.Spliterator;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.m2m.qvt.oml.ExecutionContext;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.papyrus.migration.rsa.concurrent.ExecutorsPool;
+import org.eclipse.papyrus.migration.rsa.internal.extension.TransformationExtension;
+import org.eclipse.papyrus.migration.rsa.tests.regression.AbstractMigrationRegressionTest.TransformationExtensionClass;
+import org.eclipse.papyrus.migration.rsa.tests.regression.StereotypeApplicationsTest.MigrationTracker;
+import org.eclipse.papyrus.migration.rsa.transformation.ImportTransformation;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Element;
+import org.junit.Test;
+
+/**
+ * Specific regression tests for bugs in access to stereotype applications
+ * in the context of transformation extensions.
+ */
+@TransformationExtensionClass(MigrationTracker.class)
+public class StereotypeApplicationsTest extends AbstractMigrationRegressionTest {
+
+ /**
+ * Initializes me.
+ */
+ public StereotypeApplicationsTest() {
+ super();
+ }
+
+ /**
+ * Verifies that transformation extensions have access to stereotype applications
+ * in the before and after phases, before dependency fixing and stereotype repair,
+ * as long as the RSA profile has already been imported to Papyrus at the same
+ * location.
+ *
+ * @see <a href="http://eclip.se/505330">bug 505330</a>
+ */
+ @Test
+ @PluginResource({ "bug505330/first.emx", "bug505330/today.profile.uml" })
+ @BatchMigration // because the batch launcher sets up the dependency analysis helper
+ public void extensionsFindAppliedStereotypes() throws Exception {
+ assertThat(MigrationTracker.foundBeforeMainMigration, not(lessThan(2L)));
+ assertThat(MigrationTracker.foundAfterMainMigration, not(lessThan(2L)));
+ }
+
+ //
+ // Test framework
+ //
+
+ public static class MigrationTracker implements TransformationExtension {
+
+ public static boolean isEnabled = false;
+
+ static long foundBeforeMainMigration;
+ static long foundAfterMainMigration;
+
+ private ImportTransformation transformation;
+
+ @Override
+ public Set<EPackage> getAdditionalSourceEPackages() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public void setResourceSet(ResourceSet resourceSet) {
+ // Pass
+ }
+
+ @Override
+ public void setExecutorsPool(ExecutorsPool executorsPool) {
+ // Pass
+ }
+
+ @Override
+ public void setTransformation(ImportTransformation importTransformation) {
+ // Re-initialize counts for this test
+ foundBeforeMainMigration = 0L;
+ foundAfterMainMigration = 0L;
+
+ this.transformation = importTransformation;
+ }
+
+ @Override
+ public IStatus executeBefore(ExecutionContext context, IProgressMonitor monitor) {
+ if (isEnabled) {
+ foundBeforeMainMigration = countStereotypes();
+ monitor.worked(1);
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public IStatus executeAfter(ExecutionContext context, IProgressMonitor monitor) {
+ if (isEnabled) {
+ foundAfterMainMigration = countStereotypes();
+ monitor.worked(1);
+ }
+ return Status.OK_STATUS;
+ }
+
+ long countStereotypes() {
+ List<EObject> models = transformation.getInOutUMLModel().getContents();
+ Stream<EObject> all = StreamSupport.stream(spliteratorUnknownSize(EcoreUtil.getAllContents(models, true),
+ Spliterator.DISTINCT | Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.ORDERED),
+ false);
+
+ return all.filter(Classifier.class::isInstance).map(Classifier.class::cast)
+ .filter(this::hasStereotype)
+ .count();
+ }
+
+ boolean hasStereotype(Element element) {
+ return (element.getAppliedStereotype("today::Foo") != null)
+ || (element.getAppliedStereotype("today::Bar") != null);
+ }
+
+ @Override
+ public int getNumberOfSteps() {
+ return isEnabled ? 2 : 0;
+ }
+
+ }
+}
diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/StructureDiagramTest.java b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/StructureDiagramTest.java
index 9b2eceeeadd..08e34a9243e 100644
--- a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/StructureDiagramTest.java
+++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/regression/StructureDiagramTest.java
@@ -20,8 +20,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assume.assumeThat;
import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.Node;
@@ -29,32 +27,21 @@ import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.Shape;
import org.eclipse.gmf.runtime.notation.Size;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.junit.utils.rules.AnnotationRule;
import org.eclipse.papyrus.junit.utils.rules.PluginResource;
import org.eclipse.papyrus.migration.rsa.tests.UML25HandlerExtension;
-import org.eclipse.papyrus.migration.rsa.tests.qvt.AbstractTransformationTest;
+import org.eclipse.papyrus.migration.rsa.tests.regression.AbstractMigrationRegressionTest.TransformationExtensionClass;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeEditPart;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeNameEditPart;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Port;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.TestName;
/**
* Specific regression tests for bugs in the import of structure diagrams.
*/
-public class StructureDiagramTest extends AbstractTransformationTest {
-
- @Rule
- public final TestName name = new TestName();
-
- @Rule
- public final AnnotationRule<String[]> testModel = AnnotationRule.create(PluginResource.class);
+@TransformationExtensionClass(UML25HandlerExtension.class)
+public class StructureDiagramTest extends AbstractMigrationRegressionTest {
/**
* Initializes me.
@@ -138,40 +125,4 @@ public class StructureDiagramTest extends AbstractTransformationTest {
.filter(s -> s.getElement() instanceof Port)
.forEach(p -> assertThat(p.eIsSet(NotationPackage.Literals.FILL_STYLE__FILL_COLOR), is(false)));
}
-
- //
- // Test framework
- //
-
- @Before
- public void importAndOpen() throws Exception {
- String resourcePath = testModel.get()[0];
-
- Matcher bugMatcher = Pattern.compile("^(bug\\d+)/").matcher(resourcePath);
- String bug;
-
- if (bugMatcher.find()) {
- bug = bugMatcher.group(1);
-
- // Don't be redundant
- resourcePath = resourcePath.substring(bugMatcher.end());
- } else {
- bug = name.getMethodName();
- bug = bug.substring(bug.lastIndexOf('_') + 1);
- }
-
- simpleImport(String.format("resources/%s/%s", bug, resourcePath));
-
- openEditor();
- }
-
- @BeforeClass
- public static void enableUML25Transformation() {
- UML25HandlerExtension.isEnabled = true;
- }
-
- @AfterClass
- public static void disableUML25Transformation() {
- UML25HandlerExtension.isEnabled = false;
- }
}

Back to the top