Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java51
1 files changed, 10 insertions, 41 deletions
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java
index 8ff09c1adc6..a5f4b1ccb65 100644
--- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java
@@ -13,11 +13,7 @@ package org.eclipse.papyrus.junit.utils.tests;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RunnableWithResult;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
@@ -26,14 +22,10 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.junit.utils.Activator;
import org.eclipse.papyrus.junit.utils.EditorUtils;
-import org.eclipse.papyrus.junit.utils.ModelExplorerUtils;
import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils;
import org.eclipse.papyrus.junit.utils.ProjectUtils;
-import org.eclipse.papyrus.views.modelexplorer.ModelExplorerView;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.uml2.uml.Model;
import org.junit.After;
import org.junit.Assert;
import org.osgi.framework.Bundle;
@@ -45,9 +37,6 @@ public abstract class AbstractEditorTest {
protected IProject project;
- protected static ModelExplorerView view;
-
- protected static Model rootModel;
/**
*
* @return
@@ -62,43 +51,23 @@ public abstract class AbstractEditorTest {
* Fails or throws an exception if an error occurs
*
* @param bundle
- * the bundle to use to create the project and init the model
+ * TODO
*/
- protected void initModel(String projectName, String modelName, final Bundle bundle) throws Exception {
- ProjectUtils.removeAllProjectFromTheWorkspace();
- IProject testProject = ProjectUtils.createProject(projectName);
- final IFile file = PapyrusProjectUtils.copyPapyrusModel(testProject, bundle, getSourcePath(), modelName);
- RunnableWithResult<?> runnableWithResult = new RunnableWithResult.Impl<Object>() {
+ protected void initModel(String projectName, String modelName, Bundle bundle) throws Exception {
+ project = ProjectUtils.createProject(projectName);
+ final IFile diModelFile = PapyrusProjectUtils.copyPapyrusModel(project, bundle, getSourcePath(), modelName);
+ Display.getDefault().syncExec(new Runnable() {
-
public void run() {
try {
- editor = EditorUtils.openPapyrusEditor(file);
- } catch (PartInitException e) {
- setStatus(new Status(IStatus.ERROR, bundle.getSymbolicName(), e.getMessage()));
+ editor = EditorUtils.openPapyrusEditor(diModelFile);
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ Assert.fail(ex.getMessage());
}
- try {
- AbstractEditorTest.view = ModelExplorerUtils.openModelExplorerView();
- } catch (PartInitException e) {
- setStatus(new Status(IStatus.ERROR, bundle.getSymbolicName(), e.getMessage()));
- }
- EObject root = ModelExplorerUtils.getRootInModelExplorer(AbstractEditorTest.view);
- rootModel = (Model)root;
-
- if(rootModel != null) {
- setStatus(Status.OK_STATUS);
-
- } else {
- setStatus(new Status(IStatus.ERROR, bundle.getSymbolicName(), "Requirement1 not found")); //$NON-NLS-1$
-
- }
-
}
+ });
- };
- Display.getDefault().syncExec(runnableWithResult);
-
- Assert.assertEquals(runnableWithResult.getStatus().getMessage(), IStatus.OK, runnableWithResult.getStatus().getSeverity());
Assert.assertNotNull(editor);
}

Back to the top