diff options
| author | Esteban Dugueperoux | 2015-02-20 13:46:42 +0000 |
|---|---|---|
| committer | Esteban DUGUEPEROUX | 2015-02-23 08:06:01 +0000 |
| commit | 0fb7177d285bcd60589afcc87949e19ea818bcf0 (patch) | |
| tree | e998961900ea8bb33483c811e61ce0baf8b12eb4 | |
| parent | 2a55dec445a87a8bc88cb22335debdd6f62f43aa (diff) | |
| download | org.eclipse.sirius-0fb7177d285bcd60589afcc87949e19ea818bcf0.tar.gz org.eclipse.sirius-0fb7177d285bcd60589afcc87949e19ea818bcf0.tar.xz org.eclipse.sirius-0fb7177d285bcd60589afcc87949e19ea818bcf0.zip | |
[452962] Update tests to copy their data in workspace
Update tests to copy their data in workspace instead of opening a
session directly on them with plugin resource URIs. We do that because
the SavingPolicy will not consider resource with plugin resource URI as
saveable.
Bug: 452962
Change-Id: Ic10bbf93c9f5463d5584aa8f90d66f6fef14ebbf
Signed-off-by: Esteban Dugueperoux <esteban.dugueperoux@obeo.fr>
12 files changed, 92 insertions, 117 deletions
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/mappings/edgeonedge/AbstractEdgeOnEdgeTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/mappings/edgeonedge/AbstractEdgeOnEdgeTest.java index 4673740569..52732d32ae 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/mappings/edgeonedge/AbstractEdgeOnEdgeTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/mappings/edgeonedge/AbstractEdgeOnEdgeTest.java @@ -17,6 +17,7 @@ import org.eclipse.emf.ecore.EPackage; import org.eclipse.sirius.diagram.DDiagram; import org.eclipse.sirius.diagram.description.DiagramElementMapping; import org.eclipse.sirius.tests.SiriusTestsPlugin; +import org.eclipse.sirius.tests.support.api.EclipseTestsSupportHelper; import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase; import org.eclipse.sirius.tests.support.api.TestsUtil; import org.eclipse.sirius.tools.api.command.SiriusCommand; @@ -28,17 +29,16 @@ import org.eclipse.ui.IEditorPart; * on Edges. * * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a> - * */ public class AbstractEdgeOnEdgeTest extends SiriusDiagramTestCase { - protected static final String FOLDER_PATH = "/" + SiriusTestsPlugin.PLUGIN_ID + "/data/unit/mappings/edges_on_edges/"; + protected static final String FOLDER_PATH = "/data/unit/mappings/edges_on_edges/"; - private static final String DEFAULT_SEMANTIC_MODEL_PATH = FOLDER_PATH + "2182.ecore"; + private static final String DEFAULT_SEMANTIC_MODEL = "2182.ecore"; - private static final String DEFAULT_SESSION_FILE_PATH = FOLDER_PATH + "2182.aird"; + private static final String DEFAULT_SESSION_MODEL = "2182.aird"; - private static final String DEFAULT_MODELER_PATH = FOLDER_PATH + "2182.odesign"; + private static final String DEFAULT_MODELER_MODEL = "2182.odesign"; private static final String VIEWPOINT_NAME = "doremi_2182"; @@ -50,16 +50,13 @@ public class AbstractEdgeOnEdgeTest extends SiriusDiagramTestCase { protected EPackage semanticRoot; - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.tests.support.api.SiriusTestCase#setUp() - */ @Override protected void setUp() throws Exception { super.setUp(); - genericSetUp(getSemanticModelPath(), getModelerPath(), getSessionFilePath()); + EclipseTestsSupportHelper.INSTANCE.copyFile(SiriusTestsPlugin.PLUGIN_ID, getFolder() + "/" + getSemanticModelPath(), TEMPORARY_PROJECT_NAME + "/" + getSemanticModelPath()); + EclipseTestsSupportHelper.INSTANCE.copyFile(SiriusTestsPlugin.PLUGIN_ID, getFolder() + "/" + getModelerPath(), TEMPORARY_PROJECT_NAME + "/" + getModelerPath()); + EclipseTestsSupportHelper.INSTANCE.copyFile(SiriusTestsPlugin.PLUGIN_ID, getFolder() + "/" + getSessionFilePath(), TEMPORARY_PROJECT_NAME + "/" + getSessionFilePath()); + genericSetUp(TEMPORARY_PROJECT_NAME + "/" + getSemanticModelPath(), TEMPORARY_PROJECT_NAME + "/" + getModelerPath(), TEMPORARY_PROJECT_NAME + "/" + getSessionFilePath()); initViewpoint(VIEWPOINT_NAME); diagram = (DDiagram) getRepresentations(REPRESENTATION_DECRIPTION_NAME).toArray()[0]; assertNotNull(diagram); @@ -120,7 +117,8 @@ public class AbstractEdgeOnEdgeTest extends SiriusDiagramTestCase { * Closes the current editor and opens a new one on the same diagram. */ protected void closeAndReopenEditor() { - DialectUIManager.INSTANCE.closeEditor(editor, true); + session.save(new NullProgressMonitor()); + DialectUIManager.INSTANCE.closeEditor(editor, false); TestsUtil.emptyEventsFromUIThread(); diagram = (DDiagram) getRepresentations(REPRESENTATION_DECRIPTION_NAME).toArray()[0]; @@ -147,13 +145,23 @@ public class AbstractEdgeOnEdgeTest extends SiriusDiagramTestCase { } /** + * Returns the path of the folder common to aird/odesign and semantic + * resources. + * + * @return the path of the folder + */ + protected String getFolder() { + return FOLDER_PATH; + } + + /** * Returns the path of the aird file to open. Subclasses can override this * method. * * @return the path of the aird file to open */ protected String getSessionFilePath() { - return DEFAULT_SESSION_FILE_PATH; + return DEFAULT_SESSION_MODEL; } /** @@ -163,7 +171,7 @@ public class AbstractEdgeOnEdgeTest extends SiriusDiagramTestCase { * @return the path of the semantic model file to open */ protected String getSemanticModelPath() { - return DEFAULT_SEMANTIC_MODEL_PATH; + return DEFAULT_SEMANTIC_MODEL; } /** @@ -173,6 +181,6 @@ public class AbstractEdgeOnEdgeTest extends SiriusDiagramTestCase { * @return the path of the semantic model file to open */ protected String getModelerPath() { - return DEFAULT_MODELER_PATH; + return DEFAULT_MODELER_MODEL; } } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/modelingproject/SaveWhenNoEditorsTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/modelingproject/SaveWhenNoEditorsTests.java index 568f292468..00c4745b2d 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/modelingproject/SaveWhenNoEditorsTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/modelingproject/SaveWhenNoEditorsTests.java @@ -23,6 +23,8 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.sirius.business.api.session.SessionStatus; import org.eclipse.sirius.business.internal.session.danalysis.SaveSessionJob; import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.tests.SiriusTestsPlugin; +import org.eclipse.sirius.tests.support.api.EclipseTestsSupportHelper; import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase; import org.eclipse.sirius.tests.support.api.TestsUtil; import org.eclipse.sirius.tests.unit.diagram.modeler.ecore.EcoreModeler; @@ -53,7 +55,8 @@ public class SaveWhenNoEditorsTests extends SiriusDiagramTestCase implements Eco changeSiriusUIPreference(SiriusUIPreferencesKeys.PREF_SAVE_WHEN_NO_EDITOR.name(), true); TestsUtil.emptyEventsFromUIThread(); - genericSetUp(TEST_SEMANTIC_MODEL_PATH, MODELER_PATH); + EclipseTestsSupportHelper.INSTANCE.copyFile(SiriusTestsPlugin.PLUGIN_ID, TEST_SEMANTIC_MODEL_PROJECT_RELATIVE_PATH, TEMPORARY_PROJECT_NAME + "/" + TEST_SEMANTIC_MODEL_FILENAME); + genericSetUp(TEMPORARY_PROJECT_NAME + "/" + TEST_SEMANTIC_MODEL_FILENAME, MODELER_PATH); initViewpoint(DESIGN_VIEWPOINT_NAME); TestsUtil.synchronizationWithUIThread(); Job.getJobManager().join(SaveSessionJob.FAMILY, new NullProgressMonitor()); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SessionWorkspaceSyncTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SessionWorkspaceSyncTests.java index ba42097dc6..3d9fa5f4e0 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SessionWorkspaceSyncTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SessionWorkspaceSyncTests.java @@ -46,6 +46,8 @@ import org.eclipse.sirius.common.tools.api.resource.ResourceSetSync; import org.eclipse.sirius.common.tools.internal.resource.ResourceSyncClientNotifier; import org.eclipse.sirius.diagram.DDiagram; import org.eclipse.sirius.diagram.DiagramPackage; +import org.eclipse.sirius.tests.SiriusTestsPlugin; +import org.eclipse.sirius.tests.support.api.EclipseTestsSupportHelper; import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase; import org.eclipse.sirius.tests.support.api.TestsUtil; import org.eclipse.sirius.tests.unit.diagram.modeler.ecore.EcoreModeler; @@ -78,8 +80,9 @@ public class SessionWorkspaceSyncTests extends SiriusDiagramTestCase implements changeSiriusUIPreference(SiriusUIPreferencesKeys.PREF_RELOAD_ON_LAST_EDITOR_CLOSE.name(), false); changeSiriusUIPreference(SiriusUIPreferencesKeys.PREF_SAVE_WHEN_NO_EDITOR.name(), false); - - genericSetUp(PACKAGES_SEMANTIC_MODEL_PATH, MODELER_PATH); + EclipseTestsSupportHelper.INSTANCE.copyFile(SiriusTestsPlugin.PLUGIN_ID, PACKAGES_SEMANTIC_MODEL_FOLDER_PATH + PACKAGES_SEMANTIC_MODEL_NAME, TEMPORARY_PROJECT_NAME + "/" + + PACKAGES_SEMANTIC_MODEL_NAME); + genericSetUp(TEMPORARY_PROJECT_NAME + "/" + PACKAGES_SEMANTIC_MODEL_NAME, MODELER_PATH); initViewpoint(DESIGN_VIEWPOINT_NAME); TestsUtil.emptyEventsFromUIThread(); } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/CreateEdgeOnEdgeTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/CreateEdgeOnEdgeTest.java index 99375db229..00f847b08d 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/CreateEdgeOnEdgeTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/CreateEdgeOnEdgeTest.java @@ -45,7 +45,6 @@ import com.google.common.base.Predicate; * </p> * * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a> - * */ public class CreateEdgeOnEdgeTest extends AbstractEdgeOnEdgeTest { diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DisabledDragAndDropForEdgesonEdgesFromDiagramTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DisabledDragAndDropForEdgesonEdgesFromDiagramTest.java index ed03be4163..1983b35189 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DisabledDragAndDropForEdgesonEdgesFromDiagramTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DisabledDragAndDropForEdgesonEdgesFromDiagramTest.java @@ -36,11 +36,14 @@ import com.google.common.base.Predicate; * </p> */ public class DisabledDragAndDropForEdgesonEdgesFromDiagramTest extends AbstractEdgeOnEdgeTest { - private static final String SEMANTIC_MODEL_PATH = FOLDER_PATH + "/drag_and_drop/from_diagram/2182.ecore"; - private static final String SESSION_FILE_PATH = FOLDER_PATH + "drag_and_drop/from_diagram/2182-dnd.aird"; + private static final String FOLDER = FOLDER_PATH + "/drag_and_drop/from_diagram/"; - private static final String MODELER_PATH = FOLDER_PATH + "drag_and_drop/from_diagram/2182-dnd.odesign"; + private static final String SEMANTIC_MODEL_PATH = "2182.ecore"; + + private static final String SESSION_FILE_PATH = "2182-dnd.aird"; + + private static final String MODELER_PATH = "2182-dnd.odesign"; private Predicate<EPackage> dndFromModelContentViewFromNodeToEdgeSemanticPredicate_fromdiagram = new Predicate<EPackage>() { public boolean apply(EPackage semanticRoot) { @@ -68,34 +71,20 @@ public class DisabledDragAndDropForEdgesonEdgesFromDiagramTest extends AbstractE } }; - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.tests.unit.api.mappings.edgeonedge.AbstractEdgeOnEdgeTest#getSemanticModelPath() - */ + protected String getFolder() { + return FOLDER; + } + @Override protected String getSemanticModelPath() { return SEMANTIC_MODEL_PATH; } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.tests.unit.api.mappings.edgeonedge.AbstractEdgeOnEdgeTest#getSessionFilePath() - */ @Override protected String getSessionFilePath() { return SESSION_FILE_PATH; } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.tests.unit.api.mappings.edgeonedge.AbstractEdgeOnEdgeTest#getModelerPath() - */ @Override protected String getModelerPath() { return MODELER_PATH; diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DragAndDropForEdgesonEdgesFromDiagramTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DragAndDropForEdgesonEdgesFromDiagramTest.java index 2cf1b6b461..e6f3367f83 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DragAndDropForEdgesonEdgesFromDiagramTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/DragAndDropForEdgesonEdgesFromDiagramTest.java @@ -23,6 +23,8 @@ import org.eclipse.sirius.diagram.DDiagramElement; import org.eclipse.sirius.diagram.DEdge; import org.eclipse.sirius.diagram.DragAndDropTarget; import org.eclipse.sirius.diagram.ui.edit.api.part.IDiagramEdgeEditPart; +import org.eclipse.sirius.tests.SiriusTestsPlugin; +import org.eclipse.sirius.tests.support.api.EclipseTestsSupportHelper; import org.eclipse.sirius.tests.support.api.TestsUtil; import org.eclipse.sirius.tests.unit.api.mappings.edgeonedge.AbstractEdgeOnEdgeTest; import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager; @@ -52,11 +54,13 @@ import com.google.common.base.Predicate; */ public class DragAndDropForEdgesonEdgesFromDiagramTest extends AbstractEdgeOnEdgeTest { - private static final String SEMANTIC_MODEL_PATH = FOLDER_PATH + "/drag_and_drop/from_diagram/2182.ecore"; + private static final String FOLDER = FOLDER_PATH + "/drag_and_drop/from_diagram/"; - private static final String SESSION_FILE_PATH = FOLDER_PATH + "drag_and_drop/from_diagram/2182-dnd.aird"; + private static final String SEMANTIC_MODEL_PATH = "2182.ecore"; - private static final String MODELER_PATH = FOLDER_PATH + "drag_and_drop/from_diagram/2182-dnd.odesign"; + private static final String SESSION_FILE_PATH = "2182-dnd.aird"; + + private static final String MODELER_PATH = "2182-dnd.odesign"; private Predicate<EPackage> dndFromModelContentViewFromNodeToEdgeSemanticPredicate_fromdiagram = new Predicate<EPackage>() { public boolean apply(EPackage semanticRoot) { @@ -84,34 +88,20 @@ public class DragAndDropForEdgesonEdgesFromDiagramTest extends AbstractEdgeOnEdg } }; - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.tests.unit.api.mappings.edgeonedge.AbstractEdgeOnEdgeTest#getSemanticModelPath() - */ + protected String getFolder() { + return FOLDER; + } + @Override protected String getSemanticModelPath() { return SEMANTIC_MODEL_PATH; } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.tests.unit.api.mappings.edgeonedge.AbstractEdgeOnEdgeTest#getSessionFilePath() - */ @Override protected String getSessionFilePath() { return SESSION_FILE_PATH; } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.tests.unit.api.mappings.edgeonedge.AbstractEdgeOnEdgeTest#getModelerPath() - */ @Override protected String getModelerPath() { return MODELER_PATH; @@ -119,7 +109,10 @@ public class DragAndDropForEdgesonEdgesFromDiagramTest extends AbstractEdgeOnEdg @Override protected void setUp() throws Exception { - genericSetUp(getSemanticModelPath(), getModelerPath(), getSessionFilePath()); + EclipseTestsSupportHelper.INSTANCE.copyFile(SiriusTestsPlugin.PLUGIN_ID, getFolder() + "/" + getSemanticModelPath(), TEMPORARY_PROJECT_NAME + "/" + getSemanticModelPath()); + EclipseTestsSupportHelper.INSTANCE.copyFile(SiriusTestsPlugin.PLUGIN_ID, getFolder() + "/" + getModelerPath(), TEMPORARY_PROJECT_NAME + "/" + getModelerPath()); + EclipseTestsSupportHelper.INSTANCE.copyFile(SiriusTestsPlugin.PLUGIN_ID, getFolder() + "/" + getSessionFilePath(), TEMPORARY_PROJECT_NAME + "/" + getSessionFilePath()); + genericSetUp(TEMPORARY_PROJECT_NAME + "/" + getSemanticModelPath(), TEMPORARY_PROJECT_NAME + "/" + getModelerPath(), TEMPORARY_PROJECT_NAME + "/" + getSessionFilePath()); diagram = (DDiagram) getRepresentations(REPRESENTATION_DECRIPTION_NAME).toArray()[0]; assertNotNull(diagram); editor = DialectUIManager.INSTANCE.openEditor(session, diagram, new NullProgressMonitor()); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/EditEdgeOnEdgeTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/EditEdgeOnEdgeTest.java index faa50a9764..0fe8befc18 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/EditEdgeOnEdgeTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/tools/EditEdgeOnEdgeTest.java @@ -48,7 +48,6 @@ import com.google.common.base.Predicate; * </p> * * @author <a href="mailto:julien.dupont@obeo.fr">Julien Dupont</a> - * */ public class EditEdgeOnEdgeTest extends AbstractEdgeOnEdgeTest { @@ -58,7 +57,6 @@ public class EditEdgeOnEdgeTest extends AbstractEdgeOnEdgeTest { * A predicate that return true if the edge edit label modified the semantic * model has expected. */ - private Predicate<EPackage> edgeLabelEditedFromEdgeToNodeSemanticPredicate = new Predicate<EPackage>() { public boolean apply(EPackage semanticRoot) { EReference annotationReference = ((EClass) semanticRoot.getEClassifier("C0")).getEReferences().iterator().next(); @@ -443,10 +441,9 @@ public class EditEdgeOnEdgeTest extends AbstractEdgeOnEdgeTest { assertNotNull("Edge should have been edited ", gmfEP); if (gmfEP.getSource() instanceof DEdgeEditPart) { if (((DEdgeEditPart) gmfEP.getSource()).getChildren().get(0) instanceof DEdgeNameEditPart) { - Assert.assertTrue("The figure should be a SiriusWrapLabel.", - ((DEdgeNameEditPart) ((DEdgeEditPart) gmfEP.getSource()).getChildren().get(0)).getFigure() instanceof SiriusWrapLabel); - assertEquals("Edge should have been edited", true, ((SiriusWrapLabel) ((DEdgeNameEditPart) ((DEdgeEditPart) gmfEP.getSource()).getChildren().get(0)).getFigure()).getText() - .contains(EDIT_LABEL)); + Assert.assertTrue("The figure should be a SiriusWrapLabel.", ((DEdgeNameEditPart) ((DEdgeEditPart) gmfEP.getSource()).getChildren().get(0)).getFigure() instanceof SiriusWrapLabel); + assertEquals("Edge should have been edited", true, + ((SiriusWrapLabel) ((DEdgeNameEditPart) ((DEdgeEditPart) gmfEP.getSource()).getChildren().get(0)).getFigure()).getText().contains(EDIT_LABEL)); } } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/action/DeleteEdgeOnEdgeTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/action/DeleteEdgeOnEdgeTest.java index 0b762d8608..25b9ab8f36 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/action/DeleteEdgeOnEdgeTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/action/DeleteEdgeOnEdgeTest.java @@ -48,7 +48,6 @@ import com.google.common.base.Predicate; * </p> * * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a> - * */ public class DeleteEdgeOnEdgeTest extends AbstractEdgeOnEdgeTest { diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/action/EntitiesDiagramHideRevealTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/action/EntitiesDiagramHideRevealTests.java index 241d029fff..4f1e240838 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/action/EntitiesDiagramHideRevealTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/action/EntitiesDiagramHideRevealTests.java @@ -34,6 +34,8 @@ import org.eclipse.sirius.diagram.business.api.helper.graphicalfilters.HideFilte import org.eclipse.sirius.diagram.business.api.query.EObjectQuery; import org.eclipse.sirius.diagram.ui.tools.internal.actions.visibility.HideDDiagramElementAction; import org.eclipse.sirius.diagram.ui.tools.internal.actions.visibility.RevealAllElementsAction; +import org.eclipse.sirius.tests.SiriusTestsPlugin; +import org.eclipse.sirius.tests.support.api.EclipseTestsSupportHelper; import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase; import org.eclipse.sirius.tests.support.api.TestsUtil; import org.eclipse.sirius.tests.unit.diagram.modeler.ecore.EcoreModeler; @@ -74,14 +76,12 @@ public class EntitiesDiagramHideRevealTests extends SiriusDiagramTestCase implem private IGraphicalEditPart diagramEditPart; - /** - * @{inheritDoc - */ @Override protected void setUp() throws Exception { super.setUp(); - - genericSetUp(TEST_SEMANTIC_MODEL_PATH, MODELER_PATH); + String ecoreDestination = TEMPORARY_PROJECT_NAME + "/test.ecore"; + EclipseTestsSupportHelper.INSTANCE.copyFile(SiriusTestsPlugin.PLUGIN_ID, TEST_SEMANTIC_MODEL_PROJECT_RELATIVE_PATH, ecoreDestination); + genericSetUp(ecoreDestination, MODELER_PATH); initViewpoint(DESIGN_VIEWPOINT_NAME); diagram = (DDiagram) getRepresentations(ENTITIES_DESC_NAME).toArray()[0]; @@ -462,12 +462,15 @@ public class EntitiesDiagramHideRevealTests extends SiriusDiagramTestCase implem assertEquals("We should have only one GMF diagram for each viewpoint diagram.", 1, inverseReferences.size()); } - /** - * @{inheritDoc - */ @Override protected void tearDown() throws Exception { + diagram = null; + diagramEditor = null; + editorPart = null; + class1DiagramElement = null; + hideAction = null; + revealAction = null; + diagramEditPart = null; super.tearDown(); } - } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/modeler/ecore/EcoreModeler.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/modeler/ecore/EcoreModeler.java index b827446497..681deee560 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/modeler/ecore/EcoreModeler.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/modeler/ecore/EcoreModeler.java @@ -20,7 +20,11 @@ public interface EcoreModeler { String TEST_SEMANTIC_MODEL_PATH = "/" + SiriusTestsPlugin.PLUGIN_ID + TEST_SEMANTIC_MODEL_PROJECT_RELATIVE_PATH; //$NON-NLS-1$ - String PACKAGES_SEMANTIC_MODEL_PATH = "/" + SiriusTestsPlugin.PLUGIN_ID + "/data/unit/modelers/ecore/packages.ecore"; //$NON-NLS-1$ $NON-NLS-2$ + String PACKAGES_SEMANTIC_MODEL_NAME = "packages.ecore"; //$NON-NLS-1$ + + String PACKAGES_SEMANTIC_MODEL_FOLDER_PATH = "/data/unit/modelers/ecore/"; //$NON-NLS-1$ + + String PACKAGES_SEMANTIC_MODEL_PATH = "/" + SiriusTestsPlugin.PLUGIN_ID + PACKAGES_SEMANTIC_MODEL_FOLDER_PATH + PACKAGES_SEMANTIC_MODEL_NAME; //$NON-NLS-1$ String ZOOM_SEMANTIC_MODEL_PATH = "/" + SiriusTestsPlugin.PLUGIN_ID + "/data/unit/modelers/ecore/design/zoom.ecore"; //$NON-NLS-1$ $NON-NLS-2$ @@ -47,7 +51,7 @@ public interface EcoreModeler { String DEPENDENCIES_DESC_NAME = "Dependencies"; String RELATIONS_DESC_NAME = "Relations";//$NON-NLS-1$ - + String TAGS_DESC_NAME = "Tags";//$NON-NLS-1$ String LAYER_DOCUMENTATION_NAME = "Documentation";//$NON-NLS-1$ diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/CrossReferencedDLineDeleteTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/CrossReferencedDLineDeleteTest.java index 28f4cb98db..297a84332c 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/CrossReferencedDLineDeleteTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/CrossReferencedDLineDeleteTest.java @@ -133,7 +133,7 @@ public class CrossReferencedDLineDeleteTest extends SiriusTestCase { @Override protected void tearDown() throws Exception { - DialectUIManager.INSTANCE.closeEditor(tableEditor, true); + DialectUIManager.INSTANCE.closeEditor(tableEditor, false); TestsUtil.synchronizationWithUIThread(); tableCommandFactory = null; tableEditor = null; diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DCellDeleteTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DCellDeleteTest.java index 8a05a37043..4fc11ddb43 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DCellDeleteTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/table/unit/refresh/DCellDeleteTest.java @@ -29,7 +29,6 @@ import org.eclipse.ui.IEditorPart; * Test the table synchronizer. * * @author mporhel - * */ public class DCellDeleteTest extends TableTestCase { @@ -66,8 +65,10 @@ public class DCellDeleteTest extends TableTestCase { /** * The test is here to check that table reacts to semantic changes and * update the corresponding cells. + * + * @throws Exception */ - public void testDeleteLastCellInLine() { + public void testDeleteLastCellInLine() throws Exception { final EClass c2 = (EClass) testPackage.getEClassifiers().get(2); DCell superTypeCell = TableHelper.getCell(table, 2, 1); @@ -90,11 +91,7 @@ public class DCellDeleteTest extends TableTestCase { assertEquals("DCell should be deleted", null, superTypeCell.getColumn()); assertEquals("DCell should be the same", null, TableHelper.getCell(table, 2, 1)); - try { - undo(); - } catch (Exception e) { - fail(e.getMessage()); - } + undo(); // Check initial data assertEquals(INCORRECT_DATA, 1, c2.getESuperTypes().size()); @@ -102,11 +99,7 @@ public class DCellDeleteTest extends TableTestCase { assertEquals(INCORRECT_DATA, "X", superTypeCell.getLabel()); assertEquals("DCell should be the same", superTypeCell, TableHelper.getCell(table, 2, 1)); - try { - redo(); - } catch (Exception e) { - fail(e.getMessage()); - } + redo(); // Check modified data assertEquals(INCORRECT_DATA, 0, c2.getESuperTypes().size()); @@ -115,7 +108,7 @@ public class DCellDeleteTest extends TableTestCase { assertEquals("DCell should be deleted", null, TableHelper.getCell(table, 2, 1)); } - public void testDeleteLastDomainBasedCellInLine() { + public void testDeleteLastDomainBasedCellInLine() throws Exception { final EClass c0 = (EClass) testPackage.getEClassifiers().get(0); final EClass c1 = (EClass) testPackage.getEClassifiers().get(1); DCell refType = TableHelper.getCell(table, 0, 4); @@ -138,11 +131,7 @@ public class DCellDeleteTest extends TableTestCase { assertEquals("DCell should be deleted", null, refType.getColumn()); assertEquals("DCell should be deleted", null, TableHelper.getCell(table, 0, 4)); - try { - undo(); - } catch (Exception e) { - fail(e.getMessage()); - } + undo(); // Check initial data assertEquals(INCORRECT_DATA, c1, c0.getEReferences().get(0).getEType()); @@ -152,11 +141,7 @@ public class DCellDeleteTest extends TableTestCase { assertTrue("DCell should be the same", refType.getColumn() != null); assertEquals("DCell should be the same", refType, TableHelper.getCell(table, 0, 4)); - try { - redo(); - } catch (Exception e) { - fail(e.getMessage()); - } + redo(); // Check modified data assertEquals(INCORRECT_DATA, null, c0.getEReferences().get(0).getEType()); @@ -165,7 +150,7 @@ public class DCellDeleteTest extends TableTestCase { assertEquals("DCell should be deleted", null, TableHelper.getCell(table, 0, 4)); } - public void testDeleteManyCells() { + public void testDeleteManyCells() throws Exception { final EClass c1 = (EClass) testPackage.getEClassifiers().get(1); DCell superTypeCell = TableHelper.getCell(table, 1, 0); DCell superTypeCell2 = TableHelper.getCell(table, 1, 2); @@ -192,11 +177,7 @@ public class DCellDeleteTest extends TableTestCase { assertEquals("DCell should be deleted", null, superTypeCell2.getColumn()); assertEquals("DCell should be deleted", null, TableHelper.getCell(table, 1, 2)); - try { - undo(); - } catch (Exception e) { - fail(e.getMessage()); - } + undo(); // Check initial data assertEquals(INCORRECT_DATA, 2, c1.getESuperTypes().size()); @@ -204,11 +185,7 @@ public class DCellDeleteTest extends TableTestCase { assertEquals(INCORRECT_DATA, "X", superTypeCell.getLabel()); assertEquals(INCORRECT_DATA, "X", superTypeCell2.getLabel()); - try { - redo(); - } catch (Exception e) { - fail(e.getMessage()); - } + redo(); // Check modified data assertEquals(INCORRECT_DATA, 0, c1.getESuperTypes().size()); @@ -222,7 +199,7 @@ public class DCellDeleteTest extends TableTestCase { @Override protected void tearDown() throws Exception { - DialectUIManager.INSTANCE.closeEditor(tableEditor, true); + DialectUIManager.INSTANCE.closeEditor(tableEditor, false); TestsUtil.synchronizationWithUIThread(); tableEditor = null; table = null; |
