Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorrschnekenbu2013-05-02 06:34:50 -0400
committerrschnekenbu2013-05-02 06:34:50 -0400
commit029b4fc15522ad216180d590c0f4228a86a8b4f0 (patch)
treea3ae36d1b410f55a0cd38b4b1191b9ccd95525a3 /tests
parent0b1d3114b0a21b442e110e91883af58b3e6b3811 (diff)
downloadorg.eclipse.papyrus-029b4fc15522ad216180d590c0f4228a86a8b4f0.tar.gz
org.eclipse.papyrus-029b4fc15522ad216180d590c0f4228a86a8b4f0.tar.xz
org.eclipse.papyrus-029b4fc15522ad216180d590c0f4228a86a8b4f0.zip
407054: [Activity] Activity diagram shall reuse UML.Edit commands to create elements
https://bugs.eclipse.org/bugs/show_bug.cgi?id=407054
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/AbstractTestActivityChildNode.java55
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/AbstractTestActivityChildwithOtherCreation.java6
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityChildNodeInStructuredActivity.java18
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityDiagramChildNode.java102
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityDiagramChildWithOtherCreationNode.java30
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestNode.java31
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestChildNode.java14
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/META-INF/MANIFEST.MF10
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/build.properties5
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/fragment.xml5
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/icons/sample.gifbin0 -> 983 bytes
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/org.eclipse.papyrus.uml.service.types.tests.launch43
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestModel.di9
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestModel.notation2
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestModel.uml76
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestPureUMLModel.di17
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestPureUMLModel.notation5
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestPureUMLModel.uml34
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreateElementTest.java273
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreatePureUMLElementTest.java177
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/deletion/DeletePureUMLElementTest.java218
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/suites/AllTests.java11
22 files changed, 1011 insertions, 130 deletions
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/AbstractTestActivityChildNode.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/AbstractTestActivityChildNode.java
index 3780a15e8b1..def00400e1e 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/AbstractTestActivityChildNode.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/AbstractTestActivityChildNode.java
@@ -25,29 +25,16 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.commands.ICreationCommand;
import org.eclipse.papyrus.diagram.tests.canonical.TestChildNode;
-import org.junit.Before;
+import org.eclipse.papyrus.uml.diagram.activity.CreateActivityDiagramCommand;
+import org.eclipse.swt.widgets.Display;
public abstract class AbstractTestActivityChildNode extends TestChildNode {
- @Before
- @Override
- protected void setUp() throws Exception {
- projectCreation();
+ private Command createContainercommand;
- assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 1);
- GraphicalEditPart containerEditPart = (GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
- rootCompartment = null;
- int index = 0;
- while(rootCompartment == null && index < containerEditPart.getChildren().size()) {
- if((containerEditPart.getChildren().get(index)) instanceof ShapeCompartmentEditPart) {
- rootCompartment = (ShapeCompartmentEditPart)(containerEditPart.getChildren().get(index));
- }
- index++;
- }
- }
-
/**
* {@inheritDoc}
*/
@@ -57,6 +44,13 @@ public abstract class AbstractTestActivityChildNode extends TestChildNode {
}
/**
+ * {@inheritDoc}
+ */
+ protected ICreationCommand getDiagramCommandCreation() {
+ return new CreateActivityDiagramCommand();
+ }
+
+ /**
* Test change container.
*
* @param type
@@ -71,12 +65,19 @@ public abstract class AbstractTestActivityChildNode extends TestChildNode {
assertTrue(CHANGE_CONTAINER + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 1);
- Request requestcreation = CreateViewRequestFactory.getCreateShapeRequest(containerType, getContainerEditPart().getDiagramPreferencesHint());
- Command command = getContainerEditPart().getCommand(requestcreation);
- assertNotNull(CONTAINER_CREATION + COMMAND_NULL, command);
- assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
- assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ final Request requestcreation = CreateViewRequestFactory.getCreateShapeRequest(containerType, getContainerEditPart().getDiagramPreferencesHint());
+
+ createContainercommand = null;
+ Display.getDefault().syncExec( new Runnable() {
+
+ public void run() {
+ createContainercommand = getContainerEditPart().getCommand(requestcreation);
+ }
+ });
+ assertNotNull(CONTAINER_CREATION + COMMAND_NULL, createContainercommand);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_IS_CREATED, createContainercommand != UnexecutableCommand.INSTANCE);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, createContainercommand.canExecute() == true);
+ executeOnUIThread(createContainercommand);
assertTrue(CONTAINER_CREATION + TEST_THE_EXECUTION, getRootView().getChildren().size() == 2);
GraphicalEditPart containerEditPart = (GraphicalEditPart)getContainerEditPart().getChildren().get(1);
ChangeBoundsRequest changeBoundsRequest = new ChangeBoundsRequest(RequestConstants.REQ_ADD);
@@ -93,19 +94,19 @@ public abstract class AbstractTestActivityChildNode extends TestChildNode {
assertTrue("Container not found", compartment != null);
- command = compartment.getCommand(changeBoundsRequest);
+ Command command = compartment.getCommand(changeBoundsRequest);
assertNotNull(CHANGE_CONTAINER, command);
assertTrue(CHANGE_CONTAINER + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
assertTrue(CHANGE_CONTAINER + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ executeOnUIThread(command);
assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, getRootView().getChildren().size() == 1);
assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 1);
assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, compartment.getChildren().size() == 1);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
+ undoOnUIThread();
assertTrue(CHANGE_CONTAINER + TEST_THE_UNDO, getRootView().getChildren().size() == 2);
assertTrue(CHANGE_CONTAINER + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 2);
assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, compartment.getChildren().size() == 0);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
+ redoOnUIThread();
assertTrue(CHANGE_CONTAINER + TEST_THE_REDO, getRootView().getChildren().size() == 1);
//Here there is a problem for activity diagram it is not clear
//assertTrue(CHANGE_CONTAINER+TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==1);
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/AbstractTestActivityChildwithOtherCreation.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/AbstractTestActivityChildwithOtherCreation.java
index 966383c48b6..12c8ea1833d 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/AbstractTestActivityChildwithOtherCreation.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/AbstractTestActivityChildwithOtherCreation.java
@@ -36,7 +36,11 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.uml2.uml.Element;
import org.junit.Before;
-
+/**
+ * Set as deprecated.
+ * @use {@link AbstractTestActivityChildNode}
+ */
+@Deprecated
public abstract class AbstractTestActivityChildwithOtherCreation extends org.eclipse.papyrus.diagram.tests.canonical.AbstractPapyrusTestCase {
/** The root compartment. */
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityChildNodeInStructuredActivity.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityChildNodeInStructuredActivity.java
index 0c17c66e297..143bcf4291a 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityChildNodeInStructuredActivity.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityChildNodeInStructuredActivity.java
@@ -16,28 +16,26 @@ package org.eclipse.papyrus.uml.diagram.activity.tests.canonical;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
-import org.eclipse.papyrus.commands.ICreationCommand;
-import org.eclipse.papyrus.uml.diagram.activity.CreateActivityDiagramCommand;
import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
import org.junit.Test;
-public class TestActivityChildNodeInStructuredActivity extends AbstractTestActivityChildwithOtherCreation {
+public class TestActivityChildNodeInStructuredActivity extends AbstractTestActivityChildNode {
- @Override
+ /**
+ * {@inheritDoc}
+ */
protected CreateViewRequest createViewRequestShapeContainer() {
return CreateViewRequestFactory.getCreateShapeRequest(UMLElementTypes.StructuredActivityNode_3065, getDiagramEditPart().getDiagramPreferencesHint());
}
- @Override
- protected ICreationCommand getDiagramCommandCreation() {
- return new CreateActivityDiagramCommand();
- }
+
/**
- * Test to manage component.
+ * Test to manage opaque action.
*/
@Test
public void testToManageOpaqueAction() {
- testToManageChildNode(UMLElementTypes.OpaqueAction_3007, UMLElementTypes.StructuredActivityNode_3065, false);
+ testToManageNode(UMLElementTypes.OpaqueAction_3007, UMLPackage.eINSTANCE.getOpaqueAction(), UMLElementTypes.StructuredActivityNode_3065, false);
}
}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityDiagramChildNode.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityDiagramChildNode.java
index 30560f8325b..55b138889dd 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityDiagramChildNode.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityDiagramChildNode.java
@@ -14,11 +14,8 @@
package org.eclipse.papyrus.uml.diagram.activity.tests.canonical;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.papyrus.commands.ICreationCommand;
-import org.eclipse.papyrus.uml.diagram.activity.CreateActivityDiagramCommand;
import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes;
import org.eclipse.uml2.uml.UMLPackage;
-import org.junit.Ignore;
import org.junit.Test;
/**
@@ -31,7 +28,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageCentralBufferNode() {
- testToManageChildNode(UMLElementTypes.CentralBufferNode_3104, UMLPackage.eINSTANCE.getCentralBufferNode(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.CentralBufferNode_3104, UMLPackage.eINSTANCE.getCentralBufferNode(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -39,31 +36,31 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageOpaqueAction() {
- testToManageChildNode(UMLElementTypes.OpaqueAction_3007, UMLPackage.eINSTANCE.getOpaqueAction(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.OpaqueAction_3007, UMLPackage.eINSTANCE.getOpaqueAction(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
* Test to manage initialNode.
*/
@Test
- public void testToManageinitialNode() {
- testToManageChildNode(UMLElementTypes.InitialNode_3004, UMLPackage.eINSTANCE.getInitialNode(), UMLElementTypes.StructuredActivityNode_3065, true);
+ public void testToManageInitialNode() {
+ testToManageNode(UMLElementTypes.InitialNode_3004, UMLPackage.eINSTANCE.getInitialNode(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
* Test to manage finalNode.
*/
@Test
- public void testToManagefinalNode() {
- testToManageChildNode(UMLElementTypes.ActivityFinalNode_3005, UMLPackage.eINSTANCE.getFinalNode(), UMLElementTypes.StructuredActivityNode_3065, true);
+ public void testToManageActivityFinalNode() {
+ testToManageNode(UMLElementTypes.ActivityFinalNode_3005, UMLPackage.eINSTANCE.getActivityFinalNode(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
* Test to manage flow final.
*/
@Test
- public void testToManageflowfinal() {
- testToManageChildNode(UMLElementTypes.FlowFinalNode_3006, UMLPackage.eINSTANCE.getFlowFinalNode(), UMLElementTypes.StructuredActivityNode_3065, true);
+ public void testToManageFlowFinalNode() {
+ testToManageNode(UMLElementTypes.FlowFinalNode_3006, UMLPackage.eINSTANCE.getFlowFinalNode(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -71,7 +68,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageDecisionNode() {
- testToManageChildNode(UMLElementTypes.DecisionNode_3038, UMLPackage.eINSTANCE.getDecisionNode(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.DecisionNode_3038, UMLPackage.eINSTANCE.getDecisionNode(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -79,7 +76,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageMergeNode() {
- testToManageChildNode(UMLElementTypes.MergeNode_3039, UMLPackage.eINSTANCE.getMergeNode(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.MergeNode_3039, UMLPackage.eINSTANCE.getMergeNode(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -87,7 +84,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageJoinNode() {
- testToManageChildNode(UMLElementTypes.JoinNode_3041, UMLPackage.eINSTANCE.getJoinNode(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.JoinNode_3041, UMLPackage.eINSTANCE.getJoinNode(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -95,7 +92,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageForkNode() {
- testToManageChildNode(UMLElementTypes.ForkNode_3040, UMLPackage.eINSTANCE.getForkNode(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.ForkNode_3040, UMLPackage.eINSTANCE.getForkNode(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -103,7 +100,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageDataStoreNode() {
- testToManageChildNode(UMLElementTypes.DataStoreNode_3078, UMLPackage.eINSTANCE.getDataStoreNode(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.DataStoreNode_3078, UMLPackage.eINSTANCE.getDataStoreNode(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -111,7 +108,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageSendObjectAction() {
- testToManageChildNode(UMLElementTypes.SendObjectAction_3042, UMLPackage.eINSTANCE.getSendObjectAction(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.SendObjectAction_3042, UMLPackage.eINSTANCE.getSendObjectAction(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -119,7 +116,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageAcceptEventAction() {
- testToManageChildNode(UMLElementTypes.AcceptEventAction_3063, UMLPackage.eINSTANCE.getAcceptEventAction(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.AcceptEventAction_3063, UMLPackage.eINSTANCE.getAcceptEventAction(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -127,7 +124,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageValueSpecificationAction() {
- testToManageChildNode(UMLElementTypes.ValueSpecificationAction_3076, UMLPackage.eINSTANCE.getValueSpecificationAction(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.ValueSpecificationAction_3076, UMLPackage.eINSTANCE.getValueSpecificationAction(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -135,7 +132,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageActivityPartition() {
- testToManageChildNode(UMLElementTypes.ActivityPartition_3067, UMLPackage.eINSTANCE.getActivityPartition(), UMLElementTypes.StructuredActivityNode_3065, false);
+ testToManageNode(UMLElementTypes.ActivityPartition_3067, UMLPackage.eINSTANCE.getActivityPartition(), UMLElementTypes.StructuredActivityNode_3065, false);
}
/**
@@ -143,7 +140,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageInteruptibleActivityRegion() {
- testToManageChildNode(UMLElementTypes.InterruptibleActivityRegion_3068, UMLPackage.eINSTANCE.getInterruptibleActivityRegion(), UMLElementTypes.StructuredActivityNode_3065, false);
+ testToManageNode(UMLElementTypes.InterruptibleActivityRegion_3068, UMLPackage.eINSTANCE.getInterruptibleActivityRegion(), UMLElementTypes.StructuredActivityNode_3065, false);
}
/**
@@ -151,7 +148,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageStructuredActivity() {
- testToManageChildNode(UMLElementTypes.StructuredActivityNode_3065, UMLPackage.eINSTANCE.getStructuredActivityNode(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.StructuredActivityNode_3065, UMLPackage.eINSTANCE.getStructuredActivityNode(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -159,7 +156,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageReadSelfAction() {
- testToManageChildNode(UMLElementTypes.ReadSelfAction_3081, UMLPackage.eINSTANCE.getReadSelfAction(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.ReadSelfAction_3081, UMLPackage.eINSTANCE.getReadSelfAction(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -167,7 +164,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageConditionalNode() {
- testToManageChildNode(UMLElementTypes.ConditionalNode_3069, UMLPackage.eINSTANCE.getConditionalNode(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.ConditionalNode_3069, UMLPackage.eINSTANCE.getConditionalNode(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -175,7 +172,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageExpansionRegion() {
- testToManageChildNode(UMLElementTypes.ExpansionRegion_3070, UMLPackage.eINSTANCE.getExpansionRegion(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.ExpansionRegion_3070, UMLPackage.eINSTANCE.getExpansionRegion(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -183,7 +180,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageloopNode() {
- testToManageChildNode(UMLElementTypes.LoopNode_3071, UMLPackage.eINSTANCE.getLoopNode(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.LoopNode_3071, UMLPackage.eINSTANCE.getLoopNode(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -191,7 +188,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageSequenceNode() {
- testToManageChildNode(UMLElementTypes.SequenceNode_3073, UMLPackage.eINSTANCE.getSequenceNode(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.SequenceNode_3073, UMLPackage.eINSTANCE.getSequenceNode(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -199,24 +196,15 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageActivity() {
- testToManageChildNode(UMLElementTypes.Activity_3083, UMLPackage.eINSTANCE.getActivity(), UMLElementTypes.StructuredActivityNode_3065, false);
+ testToManageNode(UMLElementTypes.Activity_3083, UMLPackage.eINSTANCE.getActivity(), UMLElementTypes.StructuredActivityNode_3065, false);
}
/**
* Test to manage readStructuralFeatureAction
*/
@Test
- public void testToManagereadStructuralFeatureAction() {
- testToManageChildNode(UMLElementTypes.ReadStructuralFeatureAction_3088, UMLPackage.eINSTANCE.getReadStructuralFeatureAction(), UMLElementTypes.StructuredActivityNode_3065, true);
- }
-
- //readStructuralfeatureValueAction
- /**
- * Test to manageDecision Node.
- */
- @Test
- public void testToManagereadStructuralfeatureValueAction() {
- //testToManageChildNode(UMLElementTypes.r, UMLElementTypes.StructuredActivityNode_3065, true);
+ public void testToManageReadStructuralFeatureAction() {
+ testToManageNode(UMLElementTypes.ReadStructuralFeatureAction_3088, UMLPackage.eINSTANCE.getReadStructuralFeatureAction(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -224,7 +212,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageDestroyObjectAction() {
- testToManageChildNode(UMLElementTypes.DestroyObjectAction_3095, UMLPackage.eINSTANCE.getDestroyObjectAction(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.DestroyObjectAction_3095, UMLPackage.eINSTANCE.getDestroyObjectAction(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -232,17 +220,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageReadVariableAction() {
- testToManageChildNode(UMLElementTypes.ReadVariableAction_3097, UMLPackage.eINSTANCE.getReadVariableAction(), UMLElementTypes.StructuredActivityNode_3065, true);
- }
-
- //ReadVariableValueAction
- /**
- * Test to manageReadVariableValueAction.
- */
- @Ignore
- @Test
- public void testToManageReadVariableValueAction() {
- // testToManageChildNode(UMLElementTypes.ReadVariable, UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.ReadVariableAction_3097, UMLPackage.eINSTANCE.getReadVariableAction(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -250,7 +228,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageBroadCastSignalAction() {
- testToManageChildNode(UMLElementTypes.BroadcastSignalAction_3102, UMLPackage.eINSTANCE.getBroadcastSignalAction(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.BroadcastSignalAction_3102, UMLPackage.eINSTANCE.getBroadcastSignalAction(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -258,7 +236,7 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageCreateObjectAction() {
- testToManageChildNode(UMLElementTypes.CreateObjectAction_3086, UMLPackage.eINSTANCE.getCreateObjectAction(), UMLElementTypes.StructuredActivityNode_3065, true);
+ testToManageNode(UMLElementTypes.CreateObjectAction_3086, UMLPackage.eINSTANCE.getCreateObjectAction(), UMLElementTypes.StructuredActivityNode_3065, true);
}
/**
@@ -266,24 +244,14 @@ public class TestActivityDiagramChildNode extends AbstractTestActivityChildNode
*/
@Test
public void testToManageAddVariableValueAction() {
- testToManageChildNode(UMLElementTypes.AddVariableValueAction_3099, UMLPackage.eINSTANCE.getAddVariableValueAction(), UMLElementTypes.Activity_3083, true);
- }
-
- @Override
- protected ICreationCommand getDiagramCommandCreation() {
- return new CreateActivityDiagramCommand();
- }
-
- @Override
- protected CreateViewRequest createViewRequestShapeContainer() {
- return null;
+ testToManageNode(UMLElementTypes.AddVariableValueAction_3099, UMLPackage.eINSTANCE.getAddVariableValueAction(), UMLElementTypes.Activity_3083, true);
}
/**
* {@inheritDoc}
*/
- @Override
- protected boolean isSemanticTest() {
- return true;
+ protected CreateViewRequest createViewRequestShapeContainer() {
+ return null;
}
+
}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityDiagramChildWithOtherCreationNode.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityDiagramChildWithOtherCreationNode.java
index 044eed782f6..b5b92e72c3a 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityDiagramChildWithOtherCreationNode.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity.tests/src/org/eclipse/papyrus/uml/diagram/activity/tests/canonical/TestActivityDiagramChildWithOtherCreationNode.java
@@ -14,17 +14,15 @@
package org.eclipse.papyrus.uml.diagram.activity.tests.canonical;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.papyrus.commands.ICreationCommand;
-import org.eclipse.papyrus.uml.diagram.activity.CreateActivityDiagramCommand;
import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes;
-import org.junit.Ignore;
+import org.eclipse.uml2.uml.UMLPackage;
import org.junit.Test;
/**
* The Class TestClassDiagramChildNode.
*/
-public class TestActivityDiagramChildWithOtherCreationNode extends AbstractTestActivityChildwithOtherCreation {
+public class TestActivityDiagramChildWithOtherCreationNode extends AbstractTestActivityChildNode {
/**
@@ -32,32 +30,36 @@ public class TestActivityDiagramChildWithOtherCreationNode extends AbstractTestA
*/
@Test
public void testToManageCallbehaviorAction() {
- testToManageChildNode(UMLElementTypes.CallBehaviorAction_3008, UMLElementTypes.StructuredActivityNode_3065, false);
+ testToManageNode(UMLElementTypes.CallBehaviorAction_3008, UMLPackage.eINSTANCE.getCallBehaviorAction(), UMLElementTypes.StructuredActivityNode_3065, false);
}
/**
* Test to manage callOperationAction
*/
@Test
public void testToManageCallOperationAction() {
- testToManageChildNode(UMLElementTypes.CallOperationAction_3010, UMLElementTypes.StructuredActivityNode_3065, false);
+ testToManageNode(UMLElementTypes.CallOperationAction_3010, UMLPackage.eINSTANCE.getCallOperationAction(), UMLElementTypes.StructuredActivityNode_3065, false);
}
/**
- * Test to manageDecision Node.
+ * Test to manage SendSignalAction Node.
*/
@Test
public void testToManageSendSignalAction() {
- testToManageChildNode(UMLElementTypes.SendSignalAction_3052, UMLElementTypes.StructuredActivityNode_3065, false);
+ testToManageNode(UMLElementTypes.SendSignalAction_3052, UMLPackage.eINSTANCE.getSendSignalAction(), UMLElementTypes.StructuredActivityNode_3065, false);
}
- @Override
- protected ICreationCommand getDiagramCommandCreation() {
- return new CreateActivityDiagramCommand();
+ /**
+ * Test to SendObjectAction Node.
+ */
+ @Test
+ public void testToManageSendObjectAction() {
+ testToManageNode(UMLElementTypes.SendObjectAction_3042, UMLPackage.eINSTANCE.getSendObjectAction(), UMLElementTypes.StructuredActivityNode_3065, false);
}
-
- @Override
+
+ /**
+ * {@inheritDoc}
+ */
protected CreateViewRequest createViewRequestShapeContainer() {
- // TODO Auto-generated method stub
return null;
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestNode.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestNode.java
index 92463c70012..f508ba78ba1 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestNode.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestNode.java
@@ -17,6 +17,7 @@ import java.util.ArrayList;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.Request;
import org.eclipse.gef.RequestConstants;
@@ -114,6 +115,36 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
}
}
+ /**
+ * Test to manage child node.
+ *
+ * @param type
+ * the type
+ * @param containerType
+ * the container type
+ */
+ public void testToManageNode(IElementType type, EClass eClass, IElementType containerType, boolean containerMove, EReference containmentFeature) {
+ // create a node
+ testToCreateANode(type);
+ // creates a second one
+ testToCreateANode(type, 1, 1, 1, 1);
+ // destroy the first element
+ testDestroy(type, 2, 2, 1, 1);
+ // destroy the second one
+ testDestroy(type, 1, 1, 1, 1);
+ // the node has been destroyed, the UML element also. restore one element
+ undoOnUIThread();
+
+ // the node and the UML element are present
+ testViewDeletion(type);
+ // The node has been deleted, the uml element is still present
+ testDrop(type, eClass);
+ // the node and element are present
+ if(containerMove) {
+ testChangeContainer(type, containerType);
+ }
+ }
+
/**
* Test to manage child node.
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestChildNode.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestChildNode.java
index a1244d2839d..35379eb743c 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestChildNode.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestChildNode.java
@@ -43,12 +43,14 @@ public abstract class TestChildNode extends AbstractTestNode {
protected void setUp() throws Exception {
super.setUp();
CreateViewRequest requestcreation = createViewRequestShapeContainer();
- requestcreation.setSize(new Dimension(500, 500));
- Command command = getDiagramEditPart().getCommand(requestcreation);
- assertNotNull(CONTAINER_CREATION + COMMAND_NULL, command);
- assertNotSame(CONTAINER_CREATION + TEST_IF_THE_COMMAND_IS_CREATED, UnexecutableCommand.INSTANCE, command);
- assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute());
- executeOnUIThread(command);
+ if(requestcreation !=null) {
+ requestcreation.setSize(new Dimension(500, 500));
+ Command command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CONTAINER_CREATION + COMMAND_NULL, command);
+ assertNotSame(CONTAINER_CREATION + TEST_IF_THE_COMMAND_IS_CREATED, UnexecutableCommand.INSTANCE, command);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute());
+ executeOnUIThread(command);
+ }
assertEquals(CREATION + INITIALIZATION_TEST, 1, getDiagramEditPart().getChildren().size());
GraphicalEditPart containerEditPart = (GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/META-INF/MANIFEST.MF
index 019002b9bc8..c8153b334a7 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/META-INF/MANIFEST.MF
@@ -1,5 +1,8 @@
Manifest-Version: 1.0
-Require-Bundle: org.junit;bundle-version="4.10.0"
+Require-Bundle: org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="0.10.0",
+ org.eclipse.uml2.uml.edit;bundle-version="4.0.100",
+ org.eclipse.ui
Bundle-Vendor: %providerName
Fragment-Host: org.eclipse.papyrus.uml.service.types;bundle-version="0
.9.0"
@@ -7,6 +10,9 @@ Bundle-Version: 0.10.0.qualifier
Bundle-Name: %pluginName
Bundle-Localization: plugin
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.service.types.tests
+Bundle-SymbolicName: org.eclipse.papyrus.uml.service.types.tests;singleton:=true
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.uml.service.types.tests.creation,
+ org.eclipse.papyrus.uml.service.types.tests.registry,
+ org.eclipse.papyrus.uml.service.types.tests.suites
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/build.properties b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/build.properties
index 785a40c0ec7..ae02b391a1a 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/build.properties
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/build.properties
@@ -2,5 +2,8 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- about.html
+ about.html,\
+ plugin.properties,\
+ resource/,\
+ fragment.xml
src.includes = about.html
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/fragment.xml b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/fragment.xml
new file mode 100644
index 00000000000..fa1feeceb5d
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/fragment.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<fragment>
+
+</fragment>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/icons/sample.gif b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/icons/sample.gif
new file mode 100644
index 00000000000..34fb3c9d8cb
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/icons/sample.gif
Binary files differ
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/org.eclipse.papyrus.uml.service.types.tests.launch b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/org.eclipse.papyrus.uml.service.types.tests.launch
new file mode 100644
index 00000000000..23492497906
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/org.eclipse.papyrus.uml.service.types.tests.launch
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/suites/AllTests.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.uml.service.types.tests.suites.AllTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.uml.service.types.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -Dhelp.lucene.tokenizer=standard -Xms768m -Xmx1200m -XX:PermSize=256M -XX:MaxPermSize=512M"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="run_in_ui_thread" value="false"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestModel.di b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestModel.di
new file mode 100644
index 00000000000..279b08e24e1
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestModel.di
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi">
+ <pageList/>
+ <sashModel currentSelection="//@sashModel/@windows.0/@children.0">
+ <windows>
+ <children xsi:type="di:TabFolder"/>
+ </windows>
+ </sashModel>
+</di:SashWindowsMngr>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestModel.notation b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestModel.notation
new file mode 100644
index 00000000000..8634d4c00e0
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestModel.notation
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestModel.uml b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestModel.uml
new file mode 100644
index 00000000000..1787559d287
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestModel.uml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_05JHMJLTEeK-Fomwlc5mQg" name="TestModel">
+ <packagedElement xmi:type="uml:Activity" xmi:id="_61hmEJLTEeK-Fomwlc5mQg" name="TestActivity"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_l6hf4JLgEeKQTaIG2N8aVQ" name="TestClass"/>
+ <packagedElement xmi:type="uml:Activity" xmi:id="_n84ZMJLgEeKQTaIG2N8aVQ" name="TestActivityWithNode" node="_zKYzcJLgEeKQTaIG2N8aVQ">
+ <node xmi:type="uml:CentralBufferNode" xmi:id="_zKYzcJLgEeKQTaIG2N8aVQ" name="CentralBufferNode1">
+ <upperBound xmi:type="uml:LiteralInteger" xmi:id="_zKhWUJLgEeKQTaIG2N8aVQ" value="1"/>
+ </node>
+ </packagedElement>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_0-WXUJLTEeK-Fomwlc5mQg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_0-YMgJLTEeK-Fomwlc5mQg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#/"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_TZ_nULU5EduiKqCzJMWbGw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_1JP_wJLTEeK-Fomwlc5mQg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1JP_wZLTEeK-Fomwlc5mQg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//modelelements"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_Gx8MgLX7EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_1JXUgJLTEeK-Fomwlc5mQg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1JX7kJLTEeK-Fomwlc5mQg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_fSw28LX7EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_1JX7kZLTEeK-Fomwlc5mQg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1JYioJLTEeK-Fomwlc5mQg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//portandflows"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_rpx28LX7EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_1JYioZLTEeK-Fomwlc5mQg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1JZJsJLTEeK-Fomwlc5mQg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//constraints"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_5WYJ0LX7EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_1JZJsZLTEeK-Fomwlc5mQg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1JZJspLTEeK-Fomwlc5mQg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//activities"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_C2zXMLX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_1JZwwJLTEeK-Fomwlc5mQg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1JZwwZLTEeK-Fomwlc5mQg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//allocations"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_NxdG4LX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_1JaX0JLTEeK-Fomwlc5mQg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1JaX0ZLTEeK-Fomwlc5mQg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//requirements"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_OOJC4LX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_1Ja-4JLTEeK-Fomwlc5mQg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1Ja-4ZLTEeK-Fomwlc5mQg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//interactions"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_meOioLX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_1Jbl8JLTEeK-Fomwlc5mQg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1JcNAJLTEeK-Fomwlc5mQg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//statemachines"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_nAF5kLX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_1Jc0EJLTEeK-Fomwlc5mQg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_1Jc0EZLTEeK-Fomwlc5mQg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//usecases"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_neZmMLX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+</uml:Model>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestPureUMLModel.di b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestPureUMLModel.di
new file mode 100644
index 00000000000..1a38b5c6e6b
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestPureUMLModel.di
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi">
+ <pageList>
+ <availablePage>
+ <emfPageIdentifier href="TestPureUMLModel.notation#_ifkzQKjqEeKyBfPA9htSew"/>
+ </availablePage>
+ </pageList>
+ <sashModel currentSelection="//@sashModel/@windows.0/@children.0">
+ <windows>
+ <children xsi:type="di:TabFolder">
+ <children>
+ <emfPageIdentifier href="TestPureUMLModel.notation#_ifkzQKjqEeKyBfPA9htSew"/>
+ </children>
+ </children>
+ </windows>
+ </sashModel>
+</di:SashWindowsMngr>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestPureUMLModel.notation b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestPureUMLModel.notation
new file mode 100644
index 00000000000..0c72ca5d6a8
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestPureUMLModel.notation
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_ifkzQKjqEeKyBfPA9htSew" type="PapyrusUMLClassDiagram" name="ClassDiagram" measurementUnit="Pixel">
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_ifkzQajqEeKyBfPA9htSew"/>
+ <element xmi:type="uml:Model" href="TestPureUMLModel.uml#_05JHMJLTEeK-Fomwlc5mQg"/>
+</notation:Diagram>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestPureUMLModel.uml b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestPureUMLModel.uml
new file mode 100644
index 00000000000..252d0028787
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/TestPureUMLModel.uml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_05JHMJLTEeK-Fomwlc5mQg" name="TestModel">
+ <packagedElement xmi:type="uml:Activity" xmi:id="_61hmEJLTEeK-Fomwlc5mQg" name="TestActivity"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_l6hf4JLgEeKQTaIG2N8aVQ" name="TestClass"/>
+ <packagedElement xmi:type="uml:Activity" xmi:id="_n84ZMJLgEeKQTaIG2N8aVQ" name="TestActivityWithNode" node="_zKYzcJLgEeKQTaIG2N8aVQ">
+ <node xmi:type="uml:CentralBufferNode" xmi:id="_zKYzcJLgEeKQTaIG2N8aVQ" name="CentralBufferNode1">
+ <upperBound xmi:type="uml:LiteralInteger" xmi:id="_zKhWUJLgEeKQTaIG2N8aVQ" value="1"/>
+ </node>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Activity" xmi:id="_Nsk64KjpEeK-PI9mVkoyCA" name="TestActivityDelete" node="_YadZ4KjpEeK-PI9mVkoyCA _YuwO4KjpEeK-PI9mVkoyCA _kjcvgKjqEeKyBfPA9htSew _mpfO8KjqEeKyBfPA9htSew">
+ <node xmi:type="uml:CentralBufferNode" xmi:id="_YadZ4KjpEeK-PI9mVkoyCA" name="CentralBufferNode1">
+ <upperBound xmi:type="uml:LiteralInteger" xmi:id="_YadZ4ajpEeK-PI9mVkoyCA" value="1"/>
+ </node>
+ <node xmi:type="uml:CentralBufferNode" xmi:id="_YuwO4KjpEeK-PI9mVkoyCA" name="CentralBufferNode2">
+ <upperBound xmi:type="uml:LiteralInteger" xmi:id="_YuwO4ajpEeK-PI9mVkoyCA" value="1"/>
+ </node>
+ <node xmi:type="uml:AddVariableValueAction" xmi:id="_kjcvgKjqEeKyBfPA9htSew" name="AddVariableValueAction1">
+ <value xmi:id="_klBc0KjqEeKyBfPA9htSew" name="value">
+ <upperBound xmi:type="uml:LiteralInteger" xmi:id="_klCD4KjqEeKyBfPA9htSew" value="1"/>
+ </value>
+ <insertAt xmi:id="_klNqEKjqEeKyBfPA9htSew" name="insertAt">
+ <upperBound xmi:type="uml:LiteralInteger" xmi:id="_klNqEajqEeKyBfPA9htSew" value="1"/>
+ </insertAt>
+ </node>
+ <node xmi:type="uml:AddVariableValueAction" xmi:id="_mpfO8KjqEeKyBfPA9htSew" name="AddVariableValueAction2">
+ <value xmi:id="_mp3pcKjqEeKyBfPA9htSew" name="value">
+ <upperBound xmi:type="uml:LiteralInteger" xmi:id="_mp3pcajqEeKyBfPA9htSew" value="1"/>
+ </value>
+ <insertAt xmi:id="_mqG6AKjqEeKyBfPA9htSew" name="insertAt">
+ <upperBound xmi:type="uml:LiteralInteger" xmi:id="_mqG6AajqEeKyBfPA9htSew" value="1"/>
+ </insertAt>
+ </node>
+ </packagedElement>
+</uml:Model>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreateElementTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreateElementTest.java
new file mode 100644
index 00000000000..a9fb3d407b9
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreateElementTest.java
@@ -0,0 +1,273 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.service.types.tests.creation;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.command.CreateChildCommand;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.ModelUtils;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.junit.utils.EditorUtils;
+import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils;
+import org.eclipse.papyrus.junit.utils.ProjectUtils;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.papyrus.uml.tools.model.UmlModel;
+import org.eclipse.papyrus.uml.tools.model.UmlUtils;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.uml2.uml.Activity;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Test creation of UML elements (Creation / Undo / redo)
+ */
+public class CreateElementTest {
+
+ private static IProject createProject;
+
+ private static IFile copyPapyrusModel;
+
+ private static IMultiDiagramEditor openPapyrusEditor;
+
+ private static ModelSet modelset;
+
+ private static UmlModel umlIModel;
+
+ private static Model rootModel;
+
+ private static Activity testActivity;
+
+ private static TransactionalEditingDomain transactionalEditingDomain;
+
+ private static Class testClass;
+
+ private static Activity testActivityWithNode;
+
+ /**
+ * Init test class
+ */
+ @BeforeClass
+ public static void initCreateElementTest() {
+
+ // create Project
+ try {
+ createProject = ProjectUtils.createProject("UMLServiceTypesTest");
+ } catch (CoreException e) {
+ fail(e.getMessage());
+ }
+
+ // import test model
+ try {
+ copyPapyrusModel = PapyrusProjectUtils.copyPapyrusModel(createProject, Platform.getBundle("org.eclipse.papyrus.uml.service.types"), "/resource/", "TestModel");
+ } catch (CoreException e) {
+ fail(e.getMessage());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+
+ // open project
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ try {
+ openPapyrusEditor = EditorUtils.openPapyrusEditor(copyPapyrusModel);
+ } catch (PartInitException e) {
+ fail(e.getMessage());
+ }
+ }
+ });
+
+ transactionalEditingDomain = (TransactionalEditingDomain)openPapyrusEditor.getAdapter(TransactionalEditingDomain.class);
+ assertTrue("Impossible to init editing domain", transactionalEditingDomain instanceof TransactionalEditingDomain);
+
+ // retrieve UML model from this editor
+ try {
+ modelset = ModelUtils.getModelSetChecked(openPapyrusEditor.getServicesRegistry());
+ umlIModel = UmlUtils.getUmlModel(modelset);
+ rootModel = (Model)umlIModel.lookupRoot();
+ } catch (ServiceException e) {
+ fail(e.getMessage());
+ } catch (NotFoundException e) {
+ fail(e.getMessage());
+ } catch (ClassCastException e) {
+ fail(e.getMessage());
+ }
+ try {
+ initExistingElements();
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+
+ }
+
+ /**
+ * Init fields corresponding to element in the test model
+ */
+ private static void initExistingElements() throws Exception {
+ // existing test activity
+ testActivity = (Activity)rootModel.getOwnedMember("TestActivity");
+ testClass = (Class)rootModel.getOwnedMember("TestClass");
+ testActivityWithNode = (Activity)rootModel.getOwnedMember("TestActivityWithNode");
+ }
+
+
+
+ @Test
+ public void testCreateClassInModel() throws Exception {
+ runCreationTest(rootModel, UMLElementTypes.CLASS, true);
+ }
+
+ @Test
+ public void testCreateModelInClass() throws Exception {
+ // runs a test to see if unexecutable commands are really unexecutable
+ runCreationTest(testClass, UMLElementTypes.MODEL, false);
+ }
+
+ @Test
+ public void testCreateCentralBufferNodeInActivity() throws Exception {
+ int initialNumberOfNodes = 0;
+ Assert.assertTrue("Editor should not be dirty before test", !openPapyrusEditor.isDirty());
+ Command command = getCreateChildCommand(testActivity, UMLElementTypes.CENTRAL_BUFFER_NODE, true);
+ Assert.assertEquals("Wrong number of nodes before creation", initialNumberOfNodes, testActivity.getNodes().size());
+
+ transactionalEditingDomain.getCommandStack().execute(command);
+ Assert.assertEquals("Wrong number of nodes after creation", initialNumberOfNodes+1, testActivity.getNodes().size());
+ Assert.assertEquals("Wrong number of owned nodes after creation", initialNumberOfNodes+1, testActivity.getOwnedNodes().size());
+
+ transactionalEditingDomain.getCommandStack().undo();
+ Assert.assertTrue("Editor should not be dirty after undo", !openPapyrusEditor.isDirty());
+ Assert.assertEquals("Wrong number of owned nodes after undo", initialNumberOfNodes, testActivity.getOwnedNodes().size());
+ Assert.assertEquals("Wrong number of nodes after undo", initialNumberOfNodes, testActivity.getNodes().size());
+
+ transactionalEditingDomain.getCommandStack().redo();
+ Assert.assertEquals("Wrong number of nodes after redo", initialNumberOfNodes+1, testActivity.getNodes().size());
+
+ transactionalEditingDomain.getCommandStack().undo();
+ Assert.assertEquals("Wrong number of nodes after 2nd undo", initialNumberOfNodes, testActivity.getNodes().size());
+
+ // assert editor is not dirty
+ Assert.assertTrue("Editor should not be dirty after undo", !openPapyrusEditor.isDirty());
+ }
+
+ @Test
+ public void testCreateCentralBufferNodeInActivityWithNode() throws Exception {
+ int initialNumberOfNodes = 1;
+ Assert.assertTrue("Editor should not be dirty before test", !openPapyrusEditor.isDirty());
+ Command command = getCreateChildCommand(testActivityWithNode, UMLElementTypes.CENTRAL_BUFFER_NODE, true);
+ Assert.assertEquals("Wrong number of nodes before creation", initialNumberOfNodes, testActivityWithNode.getNodes().size());
+
+ transactionalEditingDomain.getCommandStack().execute(command);
+ Assert.assertEquals("Wrong number of nodes after creation", initialNumberOfNodes+1, testActivityWithNode.getNodes().size());
+ Assert.assertEquals("Wrong number of owned nodes after creation", initialNumberOfNodes+1, testActivityWithNode.getOwnedNodes().size());
+
+ transactionalEditingDomain.getCommandStack().undo();
+ Assert.assertTrue("Editor should not be dirty after undo", !openPapyrusEditor.isDirty());
+ Assert.assertEquals("Wrong number of owned nodes after undo", initialNumberOfNodes, testActivityWithNode.getOwnedNodes().size());
+ Assert.assertEquals("Wrong number of nodes after undo", initialNumberOfNodes, testActivityWithNode.getNodes().size());
+
+ transactionalEditingDomain.getCommandStack().redo();
+ Assert.assertEquals("Wrong number of nodes after redo", initialNumberOfNodes+1, testActivityWithNode.getNodes().size());
+
+ transactionalEditingDomain.getCommandStack().undo();
+ Assert.assertEquals("Wrong number of nodes after 2nd undo", initialNumberOfNodes, testActivityWithNode.getNodes().size());
+
+ // assert editor is not dirty
+ Assert.assertTrue("Editor should not be dirty after undo", !openPapyrusEditor.isDirty());
+ }
+
+ protected void runCreationTest(EObject owner, IHintedType hintedType, boolean canCreate) throws Exception {
+ Assert.assertTrue("Editor should not be dirty before test", !openPapyrusEditor.isDirty());
+ Command command = getCreateChildCommand(owner, hintedType, canCreate);
+
+ // command has been tested when created. Runs the test if it is possible
+ if(canCreate) {
+ transactionalEditingDomain.getCommandStack().execute(command);
+ transactionalEditingDomain.getCommandStack().undo();
+ Assert.assertTrue("Editor should not be dirty after undo", !openPapyrusEditor.isDirty());
+ transactionalEditingDomain.getCommandStack().redo();
+ transactionalEditingDomain.getCommandStack().undo();
+ // assert editor is not dirty
+ Assert.assertTrue("Editor should not be dirty after undo", !openPapyrusEditor.isDirty());
+ }
+
+ }
+
+ /**
+ * Creates the element in the given owner element, undo and redo the action
+ *
+ * @param owner
+ * owner of the new element
+ * @param hintedType
+ * type of the new element
+ * @param canCreate
+ * <code>true</code> if new element can be created in the specified owner
+ */
+ protected Command getCreateChildCommand(EObject owner, IHintedType hintedType, boolean canCreate) throws Exception {
+ IElementEditService elementEditService = ElementEditServiceUtils.getCommandProvider(owner);
+ ICommand command = elementEditService.getEditCommand(new CreateElementRequest(owner, hintedType));
+ assertTrue("Command should be a CreationCommand", command instanceof CreateElementCommand);
+ // test if the command is enable and compare with the canCreate parameter
+ boolean canExecute = command.canExecute();
+ if(canExecute) {
+ // executable but was expected as not executable
+ if(!canCreate) {
+ fail("Creation command is executable but it was expected as not executable");
+ } else {
+ // command is executable, and it was expected to => run the creation
+ Command emfCommand = new org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper(command);
+ return emfCommand;
+ }
+ } else {
+ if(canCreate) {
+ fail("Creation command is not executable but it was expected to be executable");
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreatePureUMLElementTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreatePureUMLElementTest.java
new file mode 100644
index 00000000000..ef8dcab5e4f
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/creation/CreatePureUMLElementTest.java
@@ -0,0 +1,177 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.service.types.tests.creation;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Collections;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils;
+import org.eclipse.papyrus.junit.utils.ProjectUtils;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.uml2.uml.Activity;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Model;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Class that provides tests only for UML based models, no DI/Notation
+ * <P>
+ * Goal of this class is to test the uml implementation, ex. SubsetAddComand
+ * </P>
+ */
+public class CreatePureUMLElementTest {
+
+ private static IProject createProject;
+
+ private static IFile copyPapyrusModel;
+
+ private static Model rootModel;
+
+ private static Activity testActivity;
+
+ private static TransactionalEditingDomain transactionalEditingDomain;
+
+ private static Class testClass;
+
+ private static Activity testActivityWithNode;
+
+ private static Resource resource;
+
+ private static TransactionalEditingDomain domain;
+
+ @BeforeClass
+ public static void initTest() {
+ // create Project
+ try {
+ createProject = ProjectUtils.createProject("UMLOnlyTest");
+ } catch (CoreException e) {
+ fail(e.getMessage());
+ }
+
+ // create UML resource
+ // import test model
+ try {
+ copyPapyrusModel = PapyrusProjectUtils.copyIFile("/resource/TestPureUMLModel.uml", Platform.getBundle("org.eclipse.papyrus.uml.service.types"), createProject, "TestPureUMLModel.uml");
+ } catch (CoreException e) {
+ fail(e.getMessage());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+
+ // open model as UML resource
+ ResourceSet set = new ResourceSetImpl();
+ domain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(set);
+ resource = set.createResource(URI.createPlatformResourceURI(createProject.getName()+'/'+copyPapyrusModel.getName(), true));
+ try {
+ resource.load(Collections.emptyMap());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+
+ rootModel = (Model)resource.getContents().get(0);
+ assertNotNull("Model should not be null", rootModel);
+ try {
+ initExistingElements();
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+
+ }
+
+ /**
+ * Init fields corresponding to element in the test model
+ */
+ private static void initExistingElements() throws Exception {
+ // existing test activity
+ testActivity = (Activity)rootModel.getOwnedMember("TestActivity");
+ testClass = (Class)rootModel.getOwnedMember("TestClass");
+ testActivityWithNode = (Activity)rootModel.getOwnedMember("TestActivityWithNode");
+ }
+
+ @Test
+ public void test() throws Exception {
+ int initialNumberOfNodes = 0;
+ Command command = getCreateChildCommand(testActivity, UMLElementTypes.CENTRAL_BUFFER_NODE, true);
+ Assert.assertEquals("Wrong number of nodes before creation", initialNumberOfNodes, testActivity.getNodes().size());
+
+ domain.getCommandStack().execute(command);
+ Assert.assertEquals("Wrong number of owned nodes after creation", initialNumberOfNodes+1, testActivity.getOwnedNodes().size());
+ Assert.assertEquals("Wrong number of nodes after creation", initialNumberOfNodes+1, testActivity.getNodes().size());
+
+ domain.getCommandStack().undo();
+ Assert.assertEquals("Wrong number of owned nodes after undo", initialNumberOfNodes, testActivity.getOwnedNodes().size());
+ Assert.assertEquals("Wrong number of nodes after undo", initialNumberOfNodes, testActivity.getNodes().size());
+
+ domain.getCommandStack().redo();
+ Assert.assertEquals("Wrong number of owned nodes after redo", initialNumberOfNodes+1, testActivity.getOwnedNodes().size());
+ Assert.assertEquals("Wrong number of nodes after redo", initialNumberOfNodes+1, testActivity.getNodes().size());
+
+ domain.getCommandStack().undo();
+ Assert.assertEquals("Wrong number of nodes after 2nd undo", initialNumberOfNodes, testActivity.getNodes().size());
+ }
+
+ /**
+ * Creates the element in the given owner element, undo and redo the action
+ *
+ * @param owner
+ * owner of the new element
+ * @param hintedType
+ * type of the new element
+ * @param canCreate
+ * <code>true</code> if new element can be created in the specified owner
+ */
+ protected Command getCreateChildCommand(EObject owner, IHintedType hintedType, boolean canCreate) throws Exception {
+ IElementEditService elementEditService = ElementEditServiceUtils.getCommandProvider(owner);
+ ICommand command = elementEditService.getEditCommand(new CreateElementRequest(owner, hintedType));
+ assertTrue("Command should be a CreationCommand", command instanceof CreateElementCommand);
+ // test if the command is enable and compare with the canCreate parameter
+ boolean canExecute = command.canExecute();
+ if(canExecute) {
+ // executable but was expected as not executable
+ if(!canCreate) {
+ fail("Creation command is executable but it was expected as not executable");
+ } else {
+ // command is executable, and it was expected to => run the creation
+ Command emfCommand = new org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper(command);
+ return emfCommand;
+ }
+ } else {
+ if(canCreate) {
+ fail("Creation command is not executable but it was expected to be executable");
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/deletion/DeletePureUMLElementTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/deletion/DeletePureUMLElementTest.java
new file mode 100644
index 00000000000..a77c488cda1
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/deletion/DeletePureUMLElementTest.java
@@ -0,0 +1,218 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.service.types.tests.deletion;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Collections;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils;
+import org.eclipse.papyrus.junit.utils.ProjectUtils;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.uml2.uml.Activity;
+import org.eclipse.uml2.uml.ActivityNode;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Model;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Class that provides tests only for UML based models, no DI/Notation
+ * <P>
+ * Goal of this class is to test the uml implementation, ex. SubsetAddComand
+ * </P>
+ */
+public class DeletePureUMLElementTest {
+
+ private static final int deleteActivityChildrenSize = 4;
+
+ private static IProject createProject;
+
+ private static IFile copyPapyrusModel;
+
+ private static Model rootModel;
+
+ private static TransactionalEditingDomain transactionalEditingDomain;
+
+ private static Resource resource;
+
+ private static TransactionalEditingDomain domain;
+
+ private static Activity testActivityDelete;
+
+ private static ActivityNode centralBufferNode1;
+
+ private static ActivityNode centralBufferNode2;
+
+ private static ActivityNode addVariableValueAction1;
+
+ private static ActivityNode addVariableValueAction2;
+
+ @BeforeClass
+ public static void initTest() {
+ // create Project
+ try {
+ createProject = ProjectUtils.createProject("UMLOnlyTest");
+ } catch (CoreException e) {
+ fail(e.getMessage());
+ }
+
+ // create UML resource
+ // import test model
+ try {
+ copyPapyrusModel = PapyrusProjectUtils.copyIFile("/resource/TestPureUMLModel.uml", Platform.getBundle("org.eclipse.papyrus.uml.service.types"), createProject, "TestPureUMLModel.uml");
+ } catch (CoreException e) {
+ fail(e.getMessage());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+
+ // open model as UML resource
+ ResourceSet set = new ResourceSetImpl();
+ domain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(set);
+ resource = set.createResource(URI.createPlatformResourceURI(createProject.getName()+'/'+copyPapyrusModel.getName(), true));
+ try {
+ resource.load(Collections.emptyMap());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+
+ rootModel = (Model)resource.getContents().get(0);
+ assertNotNull("Model should not be null", rootModel);
+ try {
+ initExistingElements();
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+
+ }
+
+ /**
+ * Init fields corresponding to element in the test model
+ */
+ private static void initExistingElements() throws Exception {
+ // existing test delete activity
+ testActivityDelete = (Activity)rootModel.getOwnedMember("TestActivityDelete");
+ assertNotNull("Impossible to find test activity for deletion ", testActivityDelete);
+
+ centralBufferNode1 = testActivityDelete.getNode("CentralBufferNode1");
+ assertNotNull("Impossible to find element for deletion ", centralBufferNode1);
+
+ centralBufferNode2 = testActivityDelete.getNode("CentralBufferNode2");
+ assertNotNull("Impossible to find element for deletion ", centralBufferNode2);
+
+ addVariableValueAction1 = testActivityDelete.getNode("AddVariableValueAction1");
+ assertNotNull("Impossible to find element for deletion ", addVariableValueAction1);
+ addVariableValueAction2 = testActivityDelete.getNode("AddVariableValueAction2");
+ assertNotNull("Impossible to find element for deletion ", addVariableValueAction2);
+ }
+
+ @Test
+ public void testDeleteOneAddVariableValueAction() throws Exception {
+ int initialNumberOfNodes = testActivityDelete.getOwnedNodes().size();
+ assertEquals("Test delete: Initialisation", deleteActivityChildrenSize, initialNumberOfNodes);
+
+ Command command = getDeleteChildCommand(addVariableValueAction1, true);
+ domain.getCommandStack().execute(command);
+ Assert.assertEquals("Wrong number of owned nodes after deletion", initialNumberOfNodes-1, testActivityDelete.getOwnedNodes().size());
+ Assert.assertEquals("Wrong number of nodes after deletion", initialNumberOfNodes-1, testActivityDelete.getNodes().size());
+
+ domain.getCommandStack().undo();
+ Assert.assertEquals("Wrong number of owned nodes after undo", initialNumberOfNodes, testActivityDelete.getOwnedNodes().size());
+ Assert.assertEquals("Wrong number of nodes after undo", initialNumberOfNodes, testActivityDelete.getNodes().size());
+
+ domain.getCommandStack().redo();
+ Assert.assertEquals("Wrong number of owned nodes after redo", initialNumberOfNodes-1, testActivityDelete.getOwnedNodes().size());
+ Assert.assertEquals("Wrong number of nodes after redo", initialNumberOfNodes-1, testActivityDelete.getNodes().size());
+
+ domain.getCommandStack().undo();
+ Assert.assertEquals("Wrong number of nodes after 2nd undo", initialNumberOfNodes, testActivityDelete.getNodes().size());
+ }
+
+ @Test
+ public void testDeleteOneCentralBufferNode() throws Exception {
+ int initialNumberOfNodes = testActivityDelete.getOwnedNodes().size();
+ assertEquals("Test delete: Initialisation", deleteActivityChildrenSize, initialNumberOfNodes);
+
+ Command command = getDeleteChildCommand(centralBufferNode1, true);
+ domain.getCommandStack().execute(command);
+ Assert.assertEquals("Wrong number of owned nodes after deletion", initialNumberOfNodes-1, testActivityDelete.getOwnedNodes().size());
+ Assert.assertEquals("Wrong number of nodes after deletion", initialNumberOfNodes-1, testActivityDelete.getNodes().size());
+
+ domain.getCommandStack().undo();
+ Assert.assertEquals("Wrong number of owned nodes after undo", initialNumberOfNodes, testActivityDelete.getOwnedNodes().size());
+ Assert.assertEquals("Wrong number of nodes after undo", initialNumberOfNodes, testActivityDelete.getNodes().size());
+
+ domain.getCommandStack().redo();
+ Assert.assertEquals("Wrong number of owned nodes after redo", initialNumberOfNodes-1, testActivityDelete.getOwnedNodes().size());
+ Assert.assertEquals("Wrong number of nodes after redo", initialNumberOfNodes-1, testActivityDelete.getNodes().size());
+
+ domain.getCommandStack().undo();
+ Assert.assertEquals("Wrong number of nodes after 2nd undo", initialNumberOfNodes, testActivityDelete.getNodes().size());
+ }
+
+ /**
+ * Creates the element in the given owner element, undo and redo the action
+ *
+ * @param owner
+ * owner of the new element
+ * @param hintedType
+ * type of the new element
+ * @param canCreate
+ * <code>true</code> if new element can be created in the specified owner
+ */
+ protected Command getDeleteChildCommand(EObject objectToDelete, boolean canDelete) throws Exception {
+ IElementEditService elementEditService = ElementEditServiceUtils.getCommandProvider(objectToDelete);
+ ICommand command = elementEditService.getEditCommand(new DestroyElementRequest(objectToDelete, false));
+ assertNotNull("Delete command should not be null", command);
+ // test if the command is enable and compare with the canCreate parameter
+ boolean canExecute = command.canExecute();
+ if(canExecute) {
+ // executable but was expected as not executable
+ if(!canDelete) {
+ fail("Delete command is executable but it was expected as not executable");
+ } else {
+ // command is executable, and it was expected to => run the creation
+ Command emfCommand = new org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper(command);
+ return emfCommand;
+ }
+ } else {
+ if(canDelete) {
+ fail("Delete command is not executable but it was expected to be executable");
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/suites/AllTests.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/suites/AllTests.java
index 687c3e7cb73..33a78e5094d 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/suites/AllTests.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/suites/AllTests.java
@@ -1,6 +1,8 @@
package org.eclipse.papyrus.uml.service.types.tests.suites;
-import org.eclipse.papyrus.uml.service.types.tests.registry.TestElementTypeRegistryContent;
+import org.eclipse.papyrus.uml.service.types.tests.creation.CreateElementTest;
+import org.eclipse.papyrus.uml.service.types.tests.creation.CreatePureUMLElementTest;
+import org.eclipse.papyrus.uml.service.types.tests.deletion.DeletePureUMLElementTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@@ -9,7 +11,12 @@ import org.junit.runners.Suite.SuiteClasses;
* Main Test suite.
*/
@RunWith(Suite.class)
-@SuiteClasses({ TestElementTypeRegistryContent.class })
+@SuiteClasses({
+ //TestElementTypeRegistryContent.class,
+ CreatePureUMLElementTest.class, // pure uml tests, only element edit service
+ CreateElementTest.class,
+ DeletePureUMLElementTest.class,
+ })
public class AllTests {
}

Back to the top