Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/copypaste/CopyPastePartTest.java_bak')
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/copypaste/CopyPastePartTest.java_bak129
1 files changed, 129 insertions, 0 deletions
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/copypaste/CopyPastePartTest.java_bak b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/copypaste/CopyPastePartTest.java_bak
new file mode 100644
index 00000000000..c32b1b55815
--- /dev/null
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/copypaste/CopyPastePartTest.java_bak
@@ -0,0 +1,129 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.modelexplorer.tests.copypaste;
+
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.ui.IWorkbenchCommandConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.uml2.uml.Association;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ * Test for Copy / Paste of a Part
+ */
+public class CopyPastePartTest extends AbstractCopyPasteTest {
+
+ /**
+ * prepare the copy
+ *
+ * @throws Exception
+ * exception thrown in case of problems
+ */
+ @Before
+ public void testPrepare() throws Exception {
+ // check editor state (should be non dirty)
+ Assert.assertFalse("Editor should not be dirty at initialization", isEditorDirty());
+ // retrieve elements in the model explorer
+ selectAndReveal(pB2_B1_EObject);
+
+ // copy Paste b1EObject
+ ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
+ commandService.refreshElements(IWorkbenchCommandConstants.EDIT_COPY, null);
+ org.eclipse.core.commands.Command copyCommand = commandService.getCommand(IWorkbenchCommandConstants.EDIT_COPY);
+ Assert.assertNotNull("Impossible to find copy command", copyCommand);
+ Assert.assertTrue("command in not enabled", copyCommand.isEnabled());
+ Assert.assertTrue("command in not defined", copyCommand.isDefined());
+ copyCommand.executeWithChecks(new ExecutionEvent());
+
+ // check editor state (should be non dirty)
+ // Assert.assertFalse("Editor should not be dirty after copy", isEditorDirty());
+
+ // NOTE: save editor. The copy command should not dirty the model, the implementation of the copy command or the editor should be modified
+ Assert.assertTrue("Copy command is dirtying the model, whereas it should not. This assert is here to remember that the test code should be modified: Isdirty = false after copy...", isEditorDirty());
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().doSave(new NullProgressMonitor());
+ Assert.assertFalse("Save command is non-dirtying the model, whereas it should. ", isEditorDirty());
+ // END NOTE
+ }
+
+ @Override
+ protected void initializeTest(Map<Object, Object> additionalChecks, EObject targetContainer, EObject copiedEObject) {
+ super.initializeTest(additionalChecks, targetContainer, copiedEObject);
+ // nothing here
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void postCopyAdditionalChecks(Map<?, ?> originalModel, EObject newValue) throws Exception {
+ super.postCopyAdditionalChecks(originalModel, newValue);
+
+ Association newAssociation = ((Property)newValue).getAssociation();
+ Assert.assertNotNull("New Part should have an association", newAssociation);
+
+ }
+
+ /**
+ * Test the copy /paste of a part
+ *
+ * @throws Exception
+ * exception thrown in case of problems
+ */
+ @Test
+ public void testPastePartInBlockB1() throws Exception {
+ testExecutableCopyPaste(b1_EObject, pB2_B1_EObject, UMLPackage.eINSTANCE.getClassifier_Attribute());
+ }
+
+ /**
+ * Test the copy /paste of a part
+ *
+ * @throws Exception
+ * exception thrown in case of problems
+ */
+ @Test
+ public void testPastePartInBlockB2() throws Exception {
+ testExecutableCopyPaste(b2_EObject, pB2_B1_EObject, UMLPackage.eINSTANCE.getClassifier_Attribute());
+ }
+
+ /**
+ * Test the copy /paste of a part
+ *
+ * @throws Exception
+ * exception thrown in case of problems
+ */
+ @Test
+ public void testPastePartInBlockB1P1() throws Exception {
+ testExecutableCopyPaste(b1P1_P1_EObject, pB2_B1_EObject, UMLPackage.eINSTANCE.getClassifier_Attribute());
+ }
+
+ /**
+ * Test the copy /paste of a part
+ *
+ * @throws Exception
+ * exception thrown in case of problems
+ */
+ @Test
+ public void testPastePartInBlockB2P1() throws Exception {
+ testExecutableCopyPaste(b2P1_P1_EObject, pB2_B1_EObject, UMLPackage.eINSTANCE.getClassifier_Attribute());
+ }
+}

Back to the top