Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2013-07-24 05:02:23 -0400
committerCamille Letavernier2013-07-24 05:02:23 -0400
commit6e109e8db7159055446a32881742e152f65bbea6 (patch)
tree5399ce708717fb40b79e08e5e53497f66331cfa2 /tests/junit/plugins/core
parent9ab021e479d8f243341388dd84d4a4d886bc7bc9 (diff)
downloadorg.eclipse.papyrus-6e109e8db7159055446a32881742e152f65bbea6.tar.gz
org.eclipse.papyrus-6e109e8db7159055446a32881742e152f65bbea6.tar.xz
org.eclipse.papyrus-6e109e8db7159055446a32881742e152f65bbea6.zip
408491: Papyrus shall enable to easily switch between local and
registered profiles. https://bugs.eclipse.org/bugs/show_bug.cgi?id=408491 Add test case
Diffstat (limited to 'tests/junit/plugins/core')
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/AbstractEditorIntegrationTest.java95
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java3
2 files changed, 4 insertions, 94 deletions
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/AbstractEditorIntegrationTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/AbstractEditorIntegrationTest.java
index a98efb09618..3dc26b39d77 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/AbstractEditorIntegrationTest.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/AbstractEditorIntegrationTest.java
@@ -11,105 +11,16 @@
*****************************************************************************/
package org.eclipse.papyrus.editor.integration.tests.tests;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.editor.integration.tests.Activator;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.junit.utils.EditorUtils;
-import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils;
-import org.eclipse.papyrus.junit.utils.ProjectUtils;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorPart;
-import org.junit.After;
-import org.junit.Assert;
+import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
import org.osgi.framework.Bundle;
-public abstract class AbstractEditorIntegrationTest {
+public abstract class AbstractEditorIntegrationTest extends AbstractEditorTest {
- protected IMultiDiagramEditor editor;
-
- protected IProject project;
-
- /**
- *
- * @return
- * the current bundle
- */
+ @Override
protected Bundle getBundle() {
return Activator.getDefault().getBundle();
}
- /**
- * Inits this.editor
- * Fails or throws an exception if an error occurs
- *
- * @param bundle
- * TODO
- */
- protected void initModel(String projectName, String modelName, Bundle bundle) throws Exception {
- project = ProjectUtils.createProject(projectName);
- final IFile diModelFile = PapyrusProjectUtils.copyPapyrusModel(project, getBundle(), getSourcePath(), modelName);
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- try {
- editor = EditorUtils.openPapyrusEditor(diModelFile);
- } catch (Exception ex) {
- Activator.log.error(ex);
- Assert.fail(ex.getMessage());
- }
- }
- });
-
- Assert.assertNotNull(editor);
- }
-
- @After
- public void dispose() throws Exception {
- if(editor != null) {
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- ((IEditorPart)editor).getSite().getPage().closeEditor(editor, false);
- }
- });
-
- editor = null;
- }
-
- if(project != null) {
- project.delete(true, new NullProgressMonitor());
- project = null;
- }
- }
-
- protected IPageManager getPageManager() throws ServiceException {
- return getServicesRegistry().getService(IPageManager.class);
- }
-
- protected ServicesRegistry getServicesRegistry() throws ServiceException {
- return editor.getServicesRegistry();
- }
-
- protected TransactionalEditingDomain getTransactionalEditingDomain() throws ServiceException {
- return getServicesRegistry().getService(TransactionalEditingDomain.class);
- }
-
- protected ModelSet getModelSet() throws ServiceException {
- return getServicesRegistry().getService(ModelSet.class);
- }
-
- /**
- * The path to the source model folder
- *
- * @return
- */
- protected abstract String getSourcePath();
}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java
index d615cba7047..1e449d6bd1b 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java
@@ -11,8 +11,6 @@
*****************************************************************************/
package org.eclipse.papyrus.editor.integration.tests.tests;
-import junit.framework.Assert;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -33,6 +31,7 @@ import org.eclipse.papyrus.uml.diagram.common.commands.CreateUMLModelCommand;
import org.eclipse.papyrus.uml.tools.model.UmlModel;
import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Model;
+import org.junit.Assert;
import org.junit.Test;
/**

Back to the top