Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-03-07 12:36:09 +0000
committerCamille Letavernier2014-03-07 12:36:09 +0000
commit8f71775f50a8ce1ce9062e6cb9fd743d95c47f96 (patch)
tree946ffba8165b243f24105bb923dd87ffcc9d96dc /tests/junit
parentae4b6818bfc31ad01ae292b0c069fccd1e9875d7 (diff)
parent97634ae58842a093a94b52adc043101b2b3eaa52 (diff)
downloadorg.eclipse.papyrus-8f71775f50a8ce1ce9062e6cb9fd743d95c47f96.tar.gz
org.eclipse.papyrus-8f71775f50a8ce1ce9062e6cb9fd743d95c47f96.tar.xz
org.eclipse.papyrus-8f71775f50a8ce1ce9062e6cb9fd743d95c47f96.zip
Merge branch '429239-models' into 429744-uml2.5
Diffstat (limited to 'tests/junit')
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.resourceloading.tests/test/org/eclipse/papyrus/core/resourceloading/tests/testModel1/AbstractResourceLoadingTestModel1.java18
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java10
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java10
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/DiContentProviderTest.java18
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageMngrImplTest.java9
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalDiContentProvider2Test.java78
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java4
7 files changed, 87 insertions, 60 deletions
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.resourceloading.tests/test/org/eclipse/papyrus/core/resourceloading/tests/testModel1/AbstractResourceLoadingTestModel1.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.resourceloading.tests/test/org/eclipse/papyrus/core/resourceloading/tests/testModel1/AbstractResourceLoadingTestModel1.java
index 3b728d6b561..5705ebffea8 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.core.resourceloading.tests/test/org/eclipse/papyrus/core/resourceloading/tests/testModel1/AbstractResourceLoadingTestModel1.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.core.resourceloading.tests/test/org/eclipse/papyrus/core/resourceloading/tests/testModel1/AbstractResourceLoadingTestModel1.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2010, 2013 Atos Origin, CEA, 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
@@ -14,6 +14,9 @@
*****************************************************************************/
package org.eclipse.papyrus.core.resourceloading.tests.testModel1;
+import java.util.LinkedList;
+import java.util.List;
+
import junit.framework.TestCase;
import org.eclipse.core.resources.IFile;
@@ -42,9 +45,9 @@ import org.junit.Before;
* - Check that all the controlled resources are loaded
* - Check that all the needed profiles (resource and pathmap) are loaded
* - Check that all references to controlled resource are resolved
- *
+ *
* @author eperico
- *
+ *
*/
public abstract class AbstractResourceLoadingTestModel1 extends TestCase {
@@ -80,7 +83,7 @@ public abstract class AbstractResourceLoadingTestModel1 extends TestCase {
/**
* Copy test model from the test plugin to the platform where the tests are executed
- *
+ *
* @return the project in the runtime platform
* @throws Exception
*/
@@ -128,7 +131,7 @@ public abstract class AbstractResourceLoadingTestModel1 extends TestCase {
/**
* Gets the current resource loading strategy.
- *
+ *
* @return the strategy
*/
public abstract int getStrategy();
@@ -291,7 +294,8 @@ public abstract class AbstractResourceLoadingTestModel1 extends TestCase {
@Override
protected void tearDown() throws Exception {
// Unload models
- for(Resource r : modelSet.getResources()) {
+ List<Resource> resources = new LinkedList<Resource>(modelSet.getResources());
+ for(Resource r : resources) {
try {
r.unload();
} catch (Exception e) {
@@ -303,7 +307,7 @@ public abstract class AbstractResourceLoadingTestModel1 extends TestCase {
/**
* Creates the folder name in the specified project
- *
+ *
* @param project
* @param name
* @throws CoreException
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 c2fd21aa647..4de36203f18 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
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
- *
+ *
* 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
@@ -36,9 +36,9 @@ import org.junit.Test;
/**
* Test case for handling models with special characters in their name/path
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class ModelSetTests extends AbstractEditorIntegrationTest {
@@ -48,7 +48,9 @@ public class ModelSetTests extends AbstractEditorIntegrationTest {
public void testOpenModelWithSpecialChars() throws Exception {
initModel("openSpecialChars", "^&_&^", getBundle());
IPageManager pageManager = getPageManager();
- Assert.assertEquals("Some pages cannot be found", 3, pageManager.allPages().size());
+ //Fix test to match re-specification in Bug 429242: we only expect 2 pages (Instead of 3), because one of them is
+ //now invalid (Table v1 framework is deprecated and not available anymore)
+ Assert.assertEquals("Some pages cannot be found", 2, pageManager.allPages().size());
UmlModel umlModel = (UmlModel)getModelSet().getModel(UmlModel.MODEL_ID);
Model rootModel = (Model)umlModel.lookupRoot();
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 ec871f40d07..db3221e50e8 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
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
- *
+ *
* 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
@@ -32,14 +32,14 @@ import org.junit.Test;
* Tests the cases where the di model is not totally valid
* The Editor should be able to load the valid parts and should not
* fail on the invalid ones
- *
+ *
* In most cases, we're simply interested in opening the Papyrus Editor
* (i.e. the model is invalid, so we don't expect to be able to manipulate
* the diagrams; but we should still be able to manipulate the editor
* and the semantic model, create new digrams, etc).
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class RecoveryTest extends AbstractEditorIntegrationTest {
@@ -81,8 +81,8 @@ public class RecoveryTest extends AbstractEditorIntegrationTest {
}
//We should be able to open a page even if is not (yet) in the availablePages list
- //This works programmatically, but is not supported by the current implementation of handler#isEnabled
@Test
+ @Ignore("This test is not required anymore, as the allPages() is computed dynamically (Bug 429239)")
public void testUnavailablePageRecovery() throws Exception {
initModel("unavailablePageRecovery", "missing_page_recovery", getBundle());
final IPageManager manager = editor.getServicesRegistry().getService(IPageManager.class);
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/DiContentProviderTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/DiContentProviderTest.java
index a0fff5232e2..aa6930a132a 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/DiContentProviderTest.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/DiContentProviderTest.java
@@ -17,10 +17,11 @@ import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder;
import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
import org.eclipse.swt.SWT;
import org.junit.Before;
+import org.junit.Ignore;
/**
- *
+ *
* @author cedric dumoulin
*/
public class DiContentProviderTest extends TestCase {
@@ -35,7 +36,7 @@ public class DiContentProviderTest extends TestCase {
/**
* Constructor.
- *
+ *
* @param name
*/
public DiContentProviderTest(String name) {
@@ -43,7 +44,7 @@ public class DiContentProviderTest extends TestCase {
}
/*
- *
+ *
*/
@Before
@Override
@@ -57,9 +58,9 @@ public class DiContentProviderTest extends TestCase {
}
/**
- *
+ *
* @see junit.framework.TestCase#tearDown()
- *
+ *
* @throws Exception
*/
@Override
@@ -69,7 +70,7 @@ public class DiContentProviderTest extends TestCase {
/**
* Lookup for a folder in the SashModel. Return the first folder found.
- *
+ *
* @return
*/
private ITabFolderModel lookupFolderModel() {
@@ -86,7 +87,7 @@ public class DiContentProviderTest extends TestCase {
/**
* Recursively search in sash models for a FolderModel.
* Return the first encountered folder.
- *
+ *
* @param panelModel
* @return
*/
@@ -209,6 +210,7 @@ public class DiContentProviderTest extends TestCase {
* Check if {@link DiContentProvider#setCurrentFolder(Object)}.
* Check if the method works and DO NO send any event.
*/
+ @Ignore("This test is currently deprecated; current folder cannot be set programmatically")
public void testSetCurrentFolder() {
// A listener on change event.
ContentChangeListener changeListener = new ContentChangeListener();
@@ -254,7 +256,7 @@ public class DiContentProviderTest extends TestCase {
/**
* Listener on ContentChange.
- *
+ *
* @author dumoulin
*/
public class ContentChangeListener implements IContentChangedListener {
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageMngrImplTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageMngrImplTest.java
index 168dcfb6fd5..9b5481b7c00 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageMngrImplTest.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/PageMngrImplTest.java
@@ -1,7 +1,7 @@
/*****************************************************************************
- * Copyright (c) 2009 CEA LIST & LIFL
+ * Copyright (c) 2009 CEA LIST & LIFL
+ *
*
- *
* 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
@@ -31,6 +31,7 @@ import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
import org.eclipse.swt.SWT;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
/**
@@ -136,6 +137,7 @@ public class PageMngrImplTest extends TestCase {
* Test method for
* {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#addPage(org.eclipse.emf.ecore.EObject)}.
*/
+ @Ignore("This test is deprecated (Bug 429239)")
public void testAddPage() {
// A listener on change event.
ContentChangeListener changeListener = new ContentChangeListener();
@@ -375,6 +377,7 @@ public class PageMngrImplTest extends TestCase {
* Test method for
* {@link org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.PageMngrImpl#removePage(org.eclipse.emf.ecore.EObject)}.
*/
+ @Ignore("This test is deprecated (Bug 429239)")
public void testRemovePage() {
// A listener on change event.
ContentChangeListener changeListener = new ContentChangeListener();
@@ -434,7 +437,7 @@ public class PageMngrImplTest extends TestCase {
contentProvider.getContentChangedEventProvider().addListener(changeListener);
// Create 3 editors, move one in another table
- // Then remove the moved one.
+ // Then remove the moved one.
// Add identifiers
// Use Object as identifiers.
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalDiContentProvider2Test.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalDiContentProvider2Test.java
index fea7d7a8a32..3cf23254804 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalDiContentProvider2Test.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.di.tests/test/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/internal/TransactionalDiContentProvider2Test.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 Cedric Dumoulin.
*
- *
+ *
* 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
@@ -35,43 +35,44 @@ import org.junit.Test;
/**
* @author dumoulin
- *
+ *
*/
public class TransactionalDiContentProvider2Test extends AbstractDiContentProviderTest {
protected TransactionalEditingDomain editingDomain;
+
/*
- *
+ *
*/
@Before
public void setUp() throws Exception {
- editingDomain =
- TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain();
-
-
+ editingDomain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain();
+
+
// Register the default resource factory -- only needed for stand-alone!
- editingDomain.getResourceSet().getResourceFactoryRegistry().getExtensionToFactoryMap().put(
- Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
+ editingDomain.getResourceSet().getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
final Resource resource = editingDomain.createResource("temp.di");
IPageModelFactory pageModelFactory = new FakePageModelFactory();
final SashModel diSashModel = DiUtils.createDefaultSashModel();
-
+
// Add model to ResourceSet
editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain) {
+
+ @Override
protected void doExecute() {
resource.getContents().add(diSashModel);
}
});
-
-
+
+
diContentProvider = new DiContentProvider(diSashModel, pageModelFactory);
-
-
-
+
+
+
contentProvider = new TransactionalDiContentProvider(diContentProvider, editingDomain);
// Create model query
modelQuery = new SashModelQuery(diSashModel);
@@ -87,15 +88,18 @@ public class TransactionalDiContentProvider2Test extends AbstractDiContentProvid
public void tearDown() throws Exception {
editingDomain.dispose();
}
+
/**
* @see org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.internal.AbstractDiContentProviderTest#createModel(org.eclipse.papyrus.infra.core.sasheditor.di.sashmodel.query.IQueryTerm)
- *
+ *
* @param query
- * @throws QueryException
+ * @throws QueryException
*/
@Override
protected void createModel(final IQueryExp query) throws QueryException {
editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain) {
+
+ @Override
protected void doExecute() {
try {
modelQuery.createModel(query);
@@ -105,52 +109,62 @@ public class TransactionalDiContentProvider2Test extends AbstractDiContentProvid
}
}
});
-
+
}
/**
* Test undo/Redo moving a page inside the same folder
- * @throws QueryException
+ *
+ * @throws QueryException
*/
@Test
public void testUndoRedoMovePageInsideFolder() throws QueryException {
-
+
// Create a folder with several page
- IQueryExp query1 = folder("f1", page("p1"), page("p2"), page("p3") );
+ IQueryExp query1 = folder("f1", page("p1"), page("p2"), page("p3"));
createModel(query1);
// Check creation
modelQuery.assertConform(query1);
-
+
// get models (from diModels, and factory for sashModel)
Map<String, Object> modelElements = modelQuery.queryModel(query1);
- SashContainerModels sashModels = new SashContainerModels(diContentProvider, modelElements);
+ final SashContainerModels sashModels = new SashContainerModels(diContentProvider, modelElements);
// do action : move a page
- contentProvider.movePage(sashModels.getFolder("f1"), 1, 0);
-
+ //Fix test after refactoring in Bug 429239: by default, the contentProvider actions are transactional, but not undoable
+ //Create a recording command to force it to be undoable
+ RecordingCommand movePageCommand = new RecordingCommand(editingDomain, "Move page") {
+
+ @Override
+ protected void doExecute() {
+ contentProvider.movePage(sashModels.getFolder("f1"), 1, 0);
+ }
+ };
+ editingDomain.getCommandStack().execute(movePageCommand);
+ //End of fix for Bug 429239
+
// check result
- IQueryExp query2 = folder("f1", page("p2"), page("p1"), page("p3") );
+ IQueryExp query2 = folder("f1", page("p2"), page("p1"), page("p3"));
modelQuery.assertConform(query2);
// do action : undo
- editingDomain.getCommandStack().undo();
+ editingDomain.getCommandStack().undo();
// check result
modelQuery.assertConform(query1);
// do action : redo
- editingDomain.getCommandStack().redo();
+ editingDomain.getCommandStack().redo();
// check result
modelQuery.assertConform(query2);
// do action : undo
- editingDomain.getCommandStack().undo();
+ editingDomain.getCommandStack().undo();
// check result
modelQuery.assertConform(query1);
// do action : redo
- editingDomain.getCommandStack().redo();
+ editingDomain.getCommandStack().redo();
// check result
modelQuery.assertConform(query2);
-
-}
+ }
}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java
index 96f7c5198cb..0f43da39e6d 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java
@@ -40,6 +40,7 @@ import org.eclipse.uml2.uml.NamedElement;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
/**
@@ -110,7 +111,8 @@ public class CSSCompartmentsTests {
/* Test Enumeration1 */
@Test
- //Currently fails. The EnumerationLiteral compartment is not defined in the NotationTypesMap
+ //Currently fails. The "case insensitive" attributes are not supported by Eclipse E4 CSS
+ @Ignore("The 'case insensitive' attributes are not supported by Eclipse E4 CSS")
public void testCaseInsensitiveForEnumeration() {
Shape enumeration = findShape("Enumeration1");
BasicCompartment compartment = findCompartment(enumeration, ENUMERATION_LITERAL_COMPARTMENT_TYPE);

Back to the top