Skip to main content
summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorvlorenzo2013-06-20 15:50:58 +0000
committervlorenzo2013-06-20 15:50:58 +0000
commit11f70824ff356ea4f8e073bf9c0011ca3d1ef54c (patch)
tree31b23dffae6575426644f97750e04d59ef7ce41f /tests
parenta2084b108bcc9a781c332b0e28d411e41cf4df5b (diff)
downloadorg.eclipse.papyrus-11f70824ff356ea4f8e073bf9c0011ca3d1ef54c.tar.gz
org.eclipse.papyrus-11f70824ff356ea4f8e073bf9c0011ca3d1ef54c.tar.xz
org.eclipse.papyrus-11f70824ff356ea4f8e073bf9c0011ca3d1ef54c.zip
411272: [Table 2] NatTable editor must contribute to the tests of the plugin org.eclipse.papyrus.editor.integration.tests
https://bugs.eclipse.org/bugs/show_bug.cgi?id=411272 in oep.editor.integration.tests.tests.AbstractEditorIntegrationTest add the method getBundle() add an arguement to initModel (+bundle)
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/AbstractEditorIntegrationTest.java17
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java2
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/PageManagerTests.java20
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java16
4 files changed, 34 insertions, 21 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 03609ee5a4b..a98efb09618 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
@@ -28,6 +28,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
import org.junit.After;
import org.junit.Assert;
+import org.osgi.framework.Bundle;
public abstract class AbstractEditorIntegrationTest {
@@ -37,12 +38,24 @@ public abstract class AbstractEditorIntegrationTest {
protected IProject project;
/**
+ *
+ * @return
+ * the current bundle
+ */
+ 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) throws Exception {
+ protected void initModel(String projectName, String modelName, Bundle bundle) throws Exception {
project = ProjectUtils.createProject(projectName);
- final IFile diModelFile = PapyrusProjectUtils.copyPapyrusModel(project, Activator.getDefault().getBundle(), getSourcePath(), modelName);
+ final IFile diModelFile = PapyrusProjectUtils.copyPapyrusModel(project, getBundle(), getSourcePath(), modelName);
Display.getDefault().syncExec(new Runnable() {
public void run() {
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 ebefb1c7574..d615cba7047 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
@@ -48,7 +48,7 @@ public class ModelSetTests extends AbstractEditorIntegrationTest {
@Test
public void testOpenModelWithSpecialChars() throws Exception {
System.out.println("Begin");
- initModel("openSpecialChars", "^&_&^");
+ initModel("openSpecialChars", "^&_&^", getBundle());
IPageManager pageManager = getPageManager();
Assert.assertEquals("Some pages cannot be found", 3, pageManager.allPages().size());
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/PageManagerTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/PageManagerTests.java
index b0e536e46b0..7a490f44436 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/PageManagerTests.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/PageManagerTests.java
@@ -200,14 +200,14 @@ public class PageManagerTests extends AbstractEditorIntegrationTest {
@Test
public void testOpenEmptyModel() throws Exception {
- initModel("openEmptyModel", "empty_model");
+ initModel("openEmptyModel", "empty_model", getBundle());
IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class);
Assert.assertEquals(0, pageManager.allPages().size());
}
@Test
public void testAvailableAndActivePage() throws Exception {
- initModel("availableAndActivePage", "two_diagrams_model");
+ initModel("availableAndActivePage", "two_diagrams_model", getBundle());
IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class);
Assert.assertEquals(2, pageManager.allPages().size());
@@ -285,7 +285,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest {
@Test
public void testDiagramCreation() throws Exception {
- initModel("diagramCreation", "empty_model");
+ initModel("diagramCreation", "empty_model", getBundle());
ICreationCommand diagramCreationCommand = new CreateClassDiagramCommand();
ModelSet modelSet = editor.getServicesRegistry().getService(ModelSet.class);
@@ -301,7 +301,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest {
@Test
public void testDiagramDeletion() throws Exception {
- initModel("diagramDeletion", "simple_class_model");
+ initModel("diagramDeletion", "simple_class_model", getBundle());
ModelSet modelSet = getModelSet();
final Diagram diagram = (Diagram)NotationUtils.getNotationModel(modelSet).getResource().getContents().get(0);
testPageDeletion(diagram, UmlClassDiagramForMultiEditor.class);
@@ -325,7 +325,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest {
//This is an EMF Facet Table bug, which tries to delete columns for an empty table as soon as the table is created
@Test
public void testTableCreation() throws Exception {
- initModel("tableCreation", "empty_model");
+ initModel("tableCreation", "empty_model", getBundle());
final ServicesRegistry registry = editor.getServicesRegistry();
ModelSet modelSet = registry.getService(ModelSet.class);
@@ -360,7 +360,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest {
@Test
public void testTableDeletion() throws Exception {
- initModel("tableDeletion", "simple_table_model");
+ initModel("tableDeletion", "simple_table_model", getBundle());
ModelSet modelSet = editor.getServicesRegistry().getService(ModelSet.class);
final PapyrusTableInstance table = (PapyrusTableInstance)SashModelUtils.getSashModel(modelSet).getResource().getContents().get(1);
testPageDeletion(table, DefaultNattableEditor.class);
@@ -432,7 +432,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest {
@Test
public void testContainedDiagramDeletion() throws Exception {
- initModel("deleteContainedDiagrams", "delete_contained_diagram");
+ initModel("deleteContainedDiagrams", "delete_contained_diagram", getBundle());
ModelSet modelSet = getModelSet();
IPageManager pageManager = getPageManager();
TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
@@ -484,7 +484,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest {
*/
@Test
public void testContainedNatTableDeletion() throws Exception {
- initModel("deleteContainedNatTable", "delete_contained_table");
+ initModel("deleteContainedNatTable", "delete_contained_table", getBundle());
ModelSet modelSet = getModelSet();
IPageManager pageManager = getPageManager();
TransactionalEditingDomain editingDomain = getTransactionalEditingDomain();
@@ -538,12 +538,12 @@ public class PageManagerTests extends AbstractEditorIntegrationTest {
@Test
public void testMultipageEditor() throws Exception {
- initModel("multipageEditor", "complex_multipage_model");
+ initModel("multipageEditor", "complex_multipage_model", getBundle());
}
@Test
public void testOpenModel() throws Exception {
- initModel("openModel", "complex_multipage_model");
+ initModel("openModel", "complex_multipage_model", getBundle());
}
@Override
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java
index d6b8423e391..ec871f40d07 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java
@@ -48,7 +48,7 @@ public class RecoveryTest extends AbstractEditorIntegrationTest {
//Should work
@Test
public void testInvalidAvailablePage() throws Exception {
- initModel("invalidAvailablePage", "invalidAvailablePage");
+ initModel("invalidAvailablePage", "invalidAvailablePage", getBundle());
Assert.assertTrue(editor.getActiveEditor() instanceof UmlClassDiagramForMultiEditor);
//IPageManager manager = editor.getServicesRegistry().getService(IPageManager.class);
//Is the page manager supposed to filter the invalid pages..?
@@ -59,7 +59,7 @@ public class RecoveryTest extends AbstractEditorIntegrationTest {
//Bug 401109: [PageManager] Deleting an element which contains an opened page leads to critical model corruption
@Test
public void testInvalidTab() throws Exception {
- initModel("invalidTab", "invalid_child_tab");
+ initModel("invalidTab", "invalid_child_tab", getBundle());
IPageManager manager = editor.getServicesRegistry().getService(IPageManager.class);
Assert.assertEquals(1, manager.allPages().size());
}
@@ -70,7 +70,7 @@ public class RecoveryTest extends AbstractEditorIntegrationTest {
//We should be able to open a Papyrus editor and manipulate the PageManager
@Test
public void testEmptyDiModel() throws Exception {
- initModel("emptyDiModel", "empty_di_model");
+ initModel("emptyDiModel", "empty_di_model", getBundle());
IPageManager manager = editor.getServicesRegistry().getService(IPageManager.class);
Assert.assertEquals(0, manager.allPages().size());
NotationModel notationModel = (NotationModel)editor.getServicesRegistry().getService(ModelSet.class).getModel(NotationModel.MODEL_ID);
@@ -84,7 +84,7 @@ public class RecoveryTest extends AbstractEditorIntegrationTest {
//This works programmatically, but is not supported by the current implementation of handler#isEnabled
@Test
public void testUnavailablePageRecovery() throws Exception {
- initModel("unavailablePageRecovery", "missing_page_recovery");
+ initModel("unavailablePageRecovery", "missing_page_recovery", getBundle());
final IPageManager manager = editor.getServicesRegistry().getService(IPageManager.class);
int availablePages = manager.allPages().size();
NotationModel notationModel = (NotationModel)editor.getServicesRegistry().getService(ModelSet.class).getModel(NotationModel.MODEL_ID);
@@ -107,7 +107,7 @@ public class RecoveryTest extends AbstractEditorIntegrationTest {
//Should work. The invalid tab is loaded as an "unresolved tab" and displays a warning.
@Test
public void testProxyDiagram() throws Exception {
- initModel("proxyDiagram", "proxy_diagram_recovery");
+ initModel("proxyDiagram", "proxy_diagram_recovery", getBundle());
IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class);
Assert.assertEquals(2, pageManager.allPages().size());
}
@@ -117,7 +117,7 @@ public class RecoveryTest extends AbstractEditorIntegrationTest {
/** @see {link #testInvalidTab()} */
@Test
public void testProxyTable() throws Exception {
- initModel("proxyTable", "proxy_table_recovery");
+ initModel("proxyTable", "proxy_table_recovery", getBundle());
//IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class);
//Assert.assertEquals(2, pageManager.allPages());
}
@@ -125,7 +125,7 @@ public class RecoveryTest extends AbstractEditorIntegrationTest {
//This model contains a few different errors (Unresolved proxy, invalid tabs, invalid available pages, ...)
@Test
public void testCompleteCase() throws Exception {
- initModel("completeCase", "complex_invalid_model");
+ initModel("completeCase", "complex_invalid_model", getBundle());
// IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class);
// Assert.assertEquals(3, pageManager.allPages().size());
}
@@ -133,7 +133,7 @@ public class RecoveryTest extends AbstractEditorIntegrationTest {
//We should be able to delete a diagram, even when there is an invalid page in the model
@Test
public void testDeleteDiagramWithInvalidAvailablePage() throws Exception {
- initModel("deleteDiagramWithInvalidPage", "invalidAvailablePage");
+ initModel("deleteDiagramWithInvalidPage", "invalidAvailablePage", getBundle());
//Di layout: Diagram 0 - Invalid page - Diagram 1
//We take the diagram at index 1 (i.e. after the invalid page) and try to delete it

Back to the top