diff options
| author | Esteban Dugueperoux | 2015-02-24 08:30:41 +0000 |
|---|---|---|
| committer | Esteban DUGUEPEROUX | 2015-02-24 10:30:47 +0000 |
| commit | 4262fc18fbf99dfd33cef7ebbdfe7104a4928339 (patch) | |
| tree | b233c9e363e2dfd387c526985cb43dcea546df2d | |
| parent | 39266bf556f707c3927e94afedf1233a66c6c4fd (diff) | |
| download | org.eclipse.sirius-4262fc18fbf99dfd33cef7ebbdfe7104a4928339.tar.gz org.eclipse.sirius-4262fc18fbf99dfd33cef7ebbdfe7104a4928339.tar.xz org.eclipse.sirius-4262fc18fbf99dfd33cef7ebbdfe7104a4928339.zip | |
[452962] Have LayoutingModeOnECoreModelerTest copy its data in workspace
Have LayoutingModeOnECoreModelerTest copy its data in workspace to have
test
"resourceSet.getURIConverter().getAttributes(resourcetoSave.getURI(),
null).get(URIConverter.ATTRIBUTE_READ_ONLY)" returns false and have
session saveable for next commit.
Bug: 452962
Change-Id: I9dbdf5b84163ebbf67fa1d1eaa838e8b33e0f925
Signed-off-by: Esteban Dugueperoux <esteban.dugueperoux@obeo.fr>
2 files changed, 16 insertions, 28 deletions
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layoutingmode/AbstractLayoutingModeTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layoutingmode/AbstractLayoutingModeTest.java index fa9d583c31..d4ab858761 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layoutingmode/AbstractLayoutingModeTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layoutingmode/AbstractLayoutingModeTest.java @@ -11,11 +11,14 @@ package org.eclipse.sirius.tests.unit.diagram.layoutingmode; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.sirius.business.api.session.SessionStatus; import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.DiagramPackage; import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase; import org.eclipse.sirius.tests.support.api.TestsUtil; -import org.eclipse.sirius.tools.api.command.SiriusCommand; import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager; import org.eclipse.ui.IEditorPart; @@ -24,7 +27,6 @@ import org.eclipse.ui.IEditorPart; * LayoutingMode. * * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a> - * */ public class AbstractLayoutingModeTest extends SiriusDiagramTestCase { @@ -46,17 +48,13 @@ public class AbstractLayoutingModeTest extends SiriusDiagramTestCase { * Activates/Deactivate the LayoutingMode according to the given value. * * @param layoutingModeShouldBeActivated - * indicates whether layoutingmode should be activated or + * indicates whether layouting mode should be activated or * disabled */ protected void setLayoutingMode(final boolean layoutingModeShouldBeActivated) { - executeCommand(new SiriusCommand(session.getTransactionalEditingDomain()) { - @Override - protected void doExecute() { - diagram.setIsInLayoutingMode(layoutingModeShouldBeActivated); - } - }); - + TransactionalEditingDomain domain = session.getTransactionalEditingDomain(); + Command cmd = SetCommand.create(domain, diagram, DiagramPackage.Literals.DDIAGRAM__IS_IN_LAYOUTING_MODE, layoutingModeShouldBeActivated); + domain.getCommandStack().execute(cmd); } /** diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layoutingmode/LayoutingModeOnECoreModelerTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layoutingmode/LayoutingModeOnECoreModelerTest.java index dee3e61eca..79709fa5c3 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layoutingmode/LayoutingModeOnECoreModelerTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layoutingmode/LayoutingModeOnECoreModelerTest.java @@ -23,6 +23,7 @@ import org.eclipse.sirius.diagram.description.tool.ContainerDropDescription; import org.eclipse.sirius.diagram.description.tool.DirectEditLabel; import org.eclipse.sirius.diagram.description.tool.ReconnectEdgeDescription; 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.diagram.modeler.ecore.EcoreModeler; import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager; @@ -45,23 +46,18 @@ import com.google.common.collect.Iterables; * </p> * * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a> - * */ public class LayoutingModeOnECoreModelerTest extends AbstractLayoutingModeTest implements EcoreModeler { - private static final String SEMANTIC_MODEL_PATH = "/" + SiriusTestsPlugin.PLUGIN_ID + "/data/unit/layoutingMode/vp2120.ecore"; + private static final String SEMANTIC_MODEL_PATH = "/data/unit/layoutingMode/"; + + private static final String SEMANTIC_MODEL_NAME = "vp2120.ecore"; - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.tests.support.api.SiriusTestCase#setUp() - */ @Override protected void setUp() throws Exception { super.setUp(); - - genericSetUp(SEMANTIC_MODEL_PATH, MODELER_PATH); + EclipseTestsSupportHelper.INSTANCE.copyFile(SiriusTestsPlugin.PLUGIN_ID, SEMANTIC_MODEL_PATH + SEMANTIC_MODEL_NAME, TEMPORARY_PROJECT_NAME + "/" + SEMANTIC_MODEL_NAME); + genericSetUp(TEMPORARY_PROJECT_NAME + "/" + SEMANTIC_MODEL_NAME, MODELER_PATH); initViewpoint(DESIGN_VIEWPOINT_NAME); diagram = (DDiagram) createRepresentation(ENTITIES_DESC_NAME, semanticModel); @@ -70,12 +66,6 @@ public class LayoutingModeOnECoreModelerTest extends AbstractLayoutingModeTest i Job.getJobManager().join(AbstractRepresentationsFileJob.FAMILY, new NullProgressMonitor()); } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.tests.support.api.SiriusTestCase#tearDown() - */ @Override protected void tearDown() throws Exception { DialectUIManager.INSTANCE.closeEditor(editor, false); @@ -160,8 +150,8 @@ public class LayoutingModeOnECoreModelerTest extends AbstractLayoutingModeTest i public void testLayoutingModeOnDragAndDrop() { // Step 1 : getting tool and diagram elements ContainerDropDescription dndTool = (ContainerDropDescription) getTool(diagram, "Drop attribute"); - DDiagramElement eAttribute = getDiagramElementsFromLabel(diagram, "new Attribute").iterator().next(); - DragAndDropTarget eClass3 = (DragAndDropTarget) getDiagramElementsFromLabel(diagram, "new EClass 3").iterator().next(); + DDiagramElement eAttribute = getDiagramElementsFromLabel(diagram, "new Attribute").get(0); + DragAndDropTarget eClass3 = (DragAndDropTarget) getDiagramElementsFromLabel(diagram, "new EClass 3").get(0); // Step 2 : applying tool Command command = getCommandFactory().buildDropInContainerCommandFromTool(eClass3, eAttribute, dndTool); executeCommand(command); |
