Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-09-12 11:35:57 +0000
committerCamille Letavernier2014-09-12 11:35:57 +0000
commitfb77477665ac38f187f3153abef55a37e9fa117a (patch)
tree0072d15b4dccd598af02ff65658ded7a8e731b4e
parent828f78d81cf1aa99180eee69a90f396ceb5fe2ba (diff)
downloadorg.eclipse.papyrus-fb77477665ac38f187f3153abef55a37e9fa117a.tar.gz
org.eclipse.papyrus-fb77477665ac38f187f3153abef55a37e9fa117a.tar.xz
org.eclipse.papyrus-fb77477665ac38f187f3153abef55a37e9fa117a.zip
410986: [Diagram Import] Papyrus shall enable to import layout
information of other tools models https://bugs.eclipse.org/bugs/show_bug.cgi?id=410986 - Fix test failures
-rw-r--r--extraplugins/migration/org.eclipse.papyrus.m2m.qvto/META-INF/MANIFEST.MF1
-rw-r--r--extraplugins/migration/org.eclipse.papyrus.migration.rsa/build.properties4
-rw-r--r--extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAActivityDiagram.qvto1
-rw-r--r--tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/ImportDiagramTest.java84
4 files changed, 42 insertions, 48 deletions
diff --git a/extraplugins/migration/org.eclipse.papyrus.m2m.qvto/META-INF/MANIFEST.MF b/extraplugins/migration/org.eclipse.papyrus.m2m.qvto/META-INF/MANIFEST.MF
index eac37bde788..c08cd0f7a00 100644
--- a/extraplugins/migration/org.eclipse.papyrus.m2m.qvto/META-INF/MANIFEST.MF
+++ b/extraplugins/migration/org.eclipse.papyrus.m2m.qvto/META-INF/MANIFEST.MF
@@ -1,3 +1,4 @@
+Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Qvto Library
Bundle-SymbolicName: org.eclipse.papyrus.m2m.qvto;singleton:=true
diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/build.properties b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/build.properties
index bb94712161a..177f3f0f48b 100644
--- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/build.properties
+++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/build.properties
@@ -6,4 +6,6 @@ bin.includes = META-INF/,\
plugin.xml,\
model/,\
transform/,\
- plugin.properties
+ plugin.properties,\
+ about.html
+src.includes = about.html
diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAActivityDiagram.qvto b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAActivityDiagram.qvto
index 60fea4ef6a5..7f5f136b3b9 100644
--- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAActivityDiagram.qvto
+++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAActivityDiagram.qvto
@@ -8,7 +8,6 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/ implementation
*****************************************************************************/
import RSAToPapyrus;
diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/ImportDiagramTest.java b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/ImportDiagramTest.java
index 98c1f85bf2c..33f375204e6 100644
--- a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/ImportDiagramTest.java
+++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/ImportDiagramTest.java
@@ -12,8 +12,6 @@
*****************************************************************************/
package org.eclipse.papyrus.migration.rsa.tests.qvt;
-import java.io.IOException;
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
@@ -21,7 +19,6 @@ import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.util.EList;
@@ -56,6 +53,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.UMLPackage;
@@ -75,7 +73,7 @@ public class ImportDiagramTest {
@AfterClass
- public static void dispose() throws CoreException {
+ public static void dispose() throws Exception {
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchPage page = wb.getActiveWorkbenchWindow().getActivePage();
@@ -85,21 +83,15 @@ public class ImportDiagramTest {
@BeforeClass
- public static void init() throws CoreException {
+ public static void init() throws Exception {
targetProject = ProjectUtils.createProject(Activator.PLUGIN_ID + ".testProject");
- URI rsaDiagramModelUri = URI.createPlatformPluginURI(Activator.PLUGIN_ID + "/resources/ModelTestClass.emx", false);
- URI rsaProfileModelUri = URI.createPlatformPluginURI(Activator.PLUGIN_ID + "/resources/Profile.epx", false);
+ URI rsaDiagramModelUri = URI.createPlatformPluginURI(Activator.PLUGIN_ID + "/resources/ModelTestClass.emx", true);
+ URI rsaProfileModelUri = URI.createPlatformPluginURI(Activator.PLUGIN_ID + "/resources/Profile.epx", true);
- try {
- FilesUtils.copyFiles(targetProject, "ModelTestClass.emx", new URL(rsaDiagramModelUri.toString()));
- FilesUtils.copyFiles(targetProject, "Profile.epx", new URL(rsaProfileModelUri.toString()));
+ FilesUtils.copyFiles(targetProject, "ModelTestClass.emx", new URL(rsaDiagramModelUri.toString()));
+ FilesUtils.copyFiles(targetProject, "Profile.epx", new URL(rsaProfileModelUri.toString()));
- } catch (MalformedURLException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- fileDiagram = URI.createPlatformResourceURI(Activator.PLUGIN_ID + ".testProject" + "/ModelTestClass.emx", false);
+ fileDiagram = URI.createPlatformResourceURI(Activator.PLUGIN_ID + ".testProject" + "/ModelTestClass.emx", true);
ImportTransformation transfoDiagram = new ImportTransformation(fileDiagram) {
@@ -113,7 +105,7 @@ public class ImportDiagramTest {
this.run(new NullProgressMonitor());
}
};
- fileProfile = URI.createPlatformResourceURI(Activator.PLUGIN_ID + ".testProject" + "/Profile.epx", false);
+ fileProfile = URI.createPlatformResourceURI(Activator.PLUGIN_ID + ".testProject" + "/Profile.epx", true);
ImportTransformation transfoProfile = new ImportTransformation(fileProfile) {
/**
@@ -133,7 +125,7 @@ public class ImportDiagramTest {
- //Test should be more generic
+ // Test should be more generic
@Test
public void openModelTest() throws Exception {
@@ -150,7 +142,7 @@ public class ImportDiagramTest {
registry.add(ModelSet.class, Integer.MAX_VALUE, modelSet);
registry.startRegistry();
} catch (ServiceException ex) {
- //Ignored: we don't need all services
+ // Ignored: we don't need all services
}
@@ -158,18 +150,18 @@ public class ImportDiagramTest {
TransactionalEditingDomain editingDomain = modelSet.getTransactionalEditingDomain();
Resource umlResource = UmlUtils.getUmlResource(modelSet);
- //Profile should be applied during the transformation
+ // Profile should be applied during the transformation
- if(umlResource instanceof UMLResource) {
+ if (umlResource instanceof UMLResource) {
EList<EObject> umlresourceContent = umlResource.getContents();
Iterator<EObject> umlite = umlresourceContent.iterator();
- while(umlite.hasNext()) {
+ while (umlite.hasNext()) {
Object currentobject = umlite.next();
- if(currentobject instanceof org.eclipse.uml2.uml.Package) {
+ if (currentobject instanceof org.eclipse.uml2.uml.Package) {
URI uri = URI.createURI(UMLResource.STANDARD_PROFILE_URI, true);
Resource resource = modelSet.getResource(uri, true);
- Profile profile = (Profile)EcoreUtil.getObjectByType(resource.getContents(), UMLPackage.Literals.PROFILE);
- Command command = new ApplyProfileCommand((org.eclipse.uml2.uml.Package)currentobject, profile, editingDomain);
+ Profile profile = (Profile) EcoreUtil.getObjectByType(resource.getContents(), UMLPackage.Literals.PROFILE);
+ Command command = new ApplyProfileCommand((org.eclipse.uml2.uml.Package) currentobject, profile, editingDomain);
try {
editingDomain.getCommandStack().execute(command);
} catch (Exception ex) {
@@ -184,7 +176,7 @@ public class ImportDiagramTest {
public void run() {
try {
- IFile fileToOpen = (IFile)ResourcesPlugin.getWorkspace().getRoot().findMember(fileDiagram.trimFileExtension().appendFileExtension("di").toPlatformString(true));
+ IFile fileToOpen = (IFile) ResourcesPlugin.getWorkspace().getRoot().findMember(fileDiagram.trimFileExtension().appendFileExtension("di").toPlatformString(true));
editor = EditorUtils.openPapyrusEditor(fileToOpen);
} catch (Exception ex) {
Activator.log.error(ex);
@@ -196,20 +188,20 @@ public class ImportDiagramTest {
Resource notationResource = NotationUtils.getNotationModel(editor.getServicesRegistry().getService(ModelSet.class)).getResource();
List<EObject> listcontent = notationResource.getContents();
- Assert.assertEquals(7, listcontent.size()); //Expected is 7 valid migrated diagrams
- for(EObject cont : listcontent) {
+ Assert.assertEquals(7, listcontent.size()); // Expected is 7 valid migrated diagrams
+ for (EObject cont : listcontent) {
Assert.assertTrue(cont instanceof Diagram);
- Diagram currentDia = (Diagram)cont;
+ Diagram currentDia = (Diagram) cont;
editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(new OpenDiagramCommand(editingDomain, currentDia)));
IEditorPart currentEditor = editor.getActiveEditor();
Assert.assertNotNull("could not open the diagram editor", currentEditor);
Assert.assertTrue("The active editor should be a GMF Diagram Editor", editor.getActiveEditor() instanceof IDiagramWorkbenchPart);
Object temp = currentEditor.getAdapter(EditPart.class);
Assert.assertNotNull(temp);
- EditPart editPart = (EditPart)temp;
+ EditPart editPart = (EditPart) temp;
List<IGraphicalEditPart> listEditPart = DiagramEditPartsUtil.getAllEditParts(editPart);
- for(EditPart currentEditPart : listEditPart) {
+ for (EditPart currentEditPart : listEditPart) {
Assert.assertNotNull("should not be invalid view", currentEditPart);
}
}
@@ -217,7 +209,7 @@ public class ImportDiagramTest {
try {
registry.disposeRegistry();
} catch (ServiceException ex) {
- //Ignore
+ // Ignore
}
}
@@ -236,24 +228,24 @@ public class ImportDiagramTest {
registry.add(ModelSet.class, Integer.MAX_VALUE, modelSet);
registry.startRegistry();
} catch (ServiceException ex) {
- //Ignored: we don't need all services
+ // Ignored: we don't need all services
}
TransactionalEditingDomain editingDomain = modelSet.getTransactionalEditingDomain();
Resource umlResource = UmlUtils.getUmlResource(modelSet);
- //Profile should be applied during the transformation
+ // Profile should be applied during the transformation
- if(umlResource instanceof UMLResource) {
+ if (umlResource instanceof UMLResource) {
EList<EObject> umlresourceContent = umlResource.getContents();
Iterator<EObject> umlite = umlresourceContent.iterator();
- while(umlite.hasNext()) {
+ while (umlite.hasNext()) {
Object currentobject = umlite.next();
- if(currentobject instanceof org.eclipse.uml2.uml.Package) {
+ if (currentobject instanceof org.eclipse.uml2.uml.Package) {
URI uri = URI.createURI(UMLResource.STANDARD_PROFILE_URI, true);
Resource resource = modelSet.getResource(uri, true);
- Profile profile = (Profile)EcoreUtil.getObjectByType(resource.getContents(), UMLPackage.Literals.PROFILE);
- Command command = new ApplyProfileCommand((org.eclipse.uml2.uml.Package)currentobject, profile, editingDomain);
+ Profile profile = (Profile) EcoreUtil.getObjectByType(resource.getContents(), UMLPackage.Literals.PROFILE);
+ Command command = new ApplyProfileCommand((org.eclipse.uml2.uml.Package) currentobject, profile, editingDomain);
try {
editingDomain.getCommandStack().execute(command);
} catch (Exception ex) {
@@ -268,9 +260,9 @@ public class ImportDiagramTest {
public void run() {
try {
- IFile fileToOpen = (IFile)ResourcesPlugin.getWorkspace().getRoot().findMember(fileProfile.trimFileExtension().appendFileExtension("profile.di").toPlatformString(true));
+ IFile fileToOpen = (IFile) ResourcesPlugin.getWorkspace().getRoot().findMember(fileProfile.trimFileExtension().appendFileExtension("profile.di").toPlatformString(true));
editor = EditorUtils.openPapyrusEditor(fileToOpen);
- } catch (Exception ex) {
+ } catch (PartInitException ex) {
Activator.log.error(ex);
Assert.fail(ex.getMessage());
}
@@ -281,19 +273,19 @@ public class ImportDiagramTest {
Resource notationResource = NotationUtils.getNotationModel(editor.getServicesRegistry().getService(ModelSet.class)).getResource();
List<EObject> listcontent = notationResource.getContents();
Assert.assertEquals(1, listcontent.size());
- for(EObject cont : listcontent) {
+ for (EObject cont : listcontent) {
Assert.assertTrue(cont instanceof Diagram);
- Diagram currentDia = (Diagram)cont;
+ Diagram currentDia = (Diagram) cont;
editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(new OpenDiagramCommand(editingDomain, currentDia)));
IEditorPart currentEditor = editor.getActiveEditor();
Assert.assertNotNull("could not open the diagram editor", currentEditor);
Assert.assertTrue("The active editor should be a GMF Diagram Editor", editor.getActiveEditor() instanceof IDiagramWorkbenchPart);
Object temp = currentEditor.getAdapter(EditPart.class);
Assert.assertNotNull(temp);
- EditPart editPart = (EditPart)temp;
+ EditPart editPart = (EditPart) temp;
List<IGraphicalEditPart> listEditPart = DiagramEditPartsUtil.getAllEditParts(editPart);
- for(EditPart currentEditPart : listEditPart) {
+ for (EditPart currentEditPart : listEditPart) {
Assert.assertNotNull("should not be invalid view", currentEditPart);
}
}
@@ -301,7 +293,7 @@ public class ImportDiagramTest {
try {
registry.disposeRegistry();
} catch (ServiceException ex) {
- //Ignore
+ // Ignore
}
}

Back to the top