Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorrschnekenbu2013-07-03 09:17:18 +0000
committerrschnekenbu2013-07-03 09:17:18 +0000
commit583dc01f165beadcd374c6b68b5f128dad28f6fa (patch)
tree492058882ac68c240a6af57dd2a29f8be3502683 /tests
parent449eea2fd9ec975a939bd266ff9bdbd139b596a8 (diff)
downloadorg.eclipse.papyrus-583dc01f165beadcd374c6b68b5f128dad28f6fa.tar.gz
org.eclipse.papyrus-583dc01f165beadcd374c6b68b5f128dad28f6fa.tar.xz
org.eclipse.papyrus-583dc01f165beadcd374c6b68b5f128dad28f6fa.zip
Update tests framework :
- applied patches from following bugs - uml diagram tests plugins are broken => desactivate them in the build test feature and in the launcher of all tests. Fixes will appear in upcoming commits 412167: [Refactoring Tests] The Class diagram tests should be refactored https://bugs.eclipse.org/bugs/show_bug.cgi?id=412167 412165: [Refactoring Tests] The tests plug-in should be refactored https://bugs.eclipse.org/bugs/show_bug.cgi?id=412165
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF3
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java24
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/Activator.java13
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/AllTests.java2
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/IClassDiagramTestsConstants.java22
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/AbstractPapyrusTestCase.java5
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/AllCanonicalTests.java6
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramChildLabel.java28
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramChildNode.java16
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramContainment.java24
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramLink.java38
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramLinkOwnedBySource.java36
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramNestedClassifier.java30
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramTopNode.java43
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestContainmentLink.java306
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestDropfunction.java115
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestMutliLink.java28
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestStaticFeatureRepresentation.java82
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load100ClassTest.java14
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load10ClassTest.java14
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load200ClassTest.java15
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load300ClassTest.java14
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load400ClassTest.java14
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load500ClassTest.java15
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/LoadTests.java6
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/Activator.java19
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractPapyrusTestCase.java66
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestMultiLink.java69
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestNode.java56
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestChildLabel.java326
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestChildNode.java12
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestCommentLink.java245
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestConstraintLink.java245
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestContainmentLink.java262
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java62
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkOwnedBySource.java350
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestNested.java11
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestTopNode.java2
38 files changed, 1510 insertions, 1128 deletions
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
index 72f86b08a32..f212f67d542 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF
@@ -35,7 +35,8 @@ Require-Bundle: org.eclipse.ui,
org.junit;bundle-version="4.10.0",
org.eclipse.papyrus.uml.diagram.interactionoverview.tests;bundle-version="0.10.0",
org.eclipse.papyrus.uml.diagram.deployment.tests;bundle-version="0.10.0",
- org.eclipse.papyrus.uml.diagram.component.tests;bundle-version="0.10.0"
+ org.eclipse.papyrus.uml.diagram.component.tests;bundle-version="0.10.0",
+ org.eclipse.papyrus.sysml.diagram.requirement.tests;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.0.qualifier
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
index 4fe9eb551ae..11f279f64e5 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java
@@ -67,7 +67,8 @@ public class AllTests {
suiteClasses.add(new FragmentTestSuiteClass("org.eclipse.papyrus.sysml.modelexplorer", "org.eclipse.papyrus.sysml.modelexplorer.tests.suites.AllTests"));
suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.sysml.diagram.internalblock.Activator.PLUGIN_ID, "org.eclipse.papyrus.sysml.diagram.internalblock.tests.suites.AllTests"));
suiteClasses.add(new FragmentTestSuiteClass("org.eclipse.papyrus.sysml.diagram.blockdefinition", "org.eclipse.papyrus.sysml.diagram.blockdefinition.tests.suites.AllTests"));
-
+ //suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.sysml.diagram.requirement.test.AllTests.class));
+
/* uml */
suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.uml.diagram.common.Activator.ID, "org.eclipse.papyrus.diagram.common.tests.AllTests"));
suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.uml.service.types.Activator.PLUGIN_ID, "org.eclipse.papyrus.uml.service.types.tests.suites.AllTests"));
@@ -75,19 +76,20 @@ public class AllTests {
//suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.dnd.tests.tests.AllTests.class)); //Temporarily disabled as they do not run on Hudson
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.tools.tests.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.diagram.stereotypeproperty.AllTests.class));
- //suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.interactionoverview.tests.AllTests.class)); //Disabled. They currently do not run on Hudson
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.diagram.clazz.test.AllTests.class));
- //suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.usecase.tests.AllTests.class)); //Disabled. They currently do not run on Hudson
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.timing.tests.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.component.test.AllTests.class));
- suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.deployment.test.AllTests.class));
- //The following test suites do not run on Hudson
- // suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.sequence.tests.AllTests.class));
- // suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.activity.tests.AllTests.class));
+ /* uml idagrams */
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.diagram.clazz.test.AllTests.class));
+ //---- deactivate during test refactoring
+ //suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.timing.tests.AllTests.class));
+ //suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.component.test.AllTests.class));
+ //suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.deployment.test.AllTests.class));
+ // ---- end deactivate
+ // suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.sequence.tests.AllTests.class));
+ // suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.activity.tests.AllTests.class));
+ // suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.interactionoverview.tests.AllTests.class)); //Disabled. They currently do not run on Hudson
+ // suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.uml.diagram.usecase.tests.AllTests.class)); //Disabled. They currently do not run on Hudson
-
//end
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/Activator.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/Activator.java
index 1490478109c..f2d8587c141 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/Activator.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/Activator.java
@@ -1,3 +1,15 @@
+/*****************************************************************************
+ * 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:
+ * (CEA LIST) - Initial API and implementation
+ /*****************************************************************************/
package org.eclipse.papyrus.diagram.clazz.test;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -50,5 +62,4 @@ public class Activator extends AbstractUIPlugin {
public static Activator getDefault() {
return plugin;
}
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/AllTests.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/AllTests.java
index c65d11ad40e..e03590f2753 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/AllTests.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/AllTests.java
@@ -25,10 +25,8 @@ import org.junit.runners.Suite.SuiteClasses;
@SuiteClasses({
// canonical
AllCanonicalTests.class,
-
// load
//LoadTests.class
})
public class AllTests {
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/IClassDiagramTestsConstants.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/IClassDiagramTestsConstants.java
new file mode 100644
index 00000000000..4be74796e18
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/IClassDiagramTestsConstants.java
@@ -0,0 +1,22 @@
+/*****************************************************************************
+ * 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:
+ * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
+ /*****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.test;
+
+public interface IClassDiagramTestsConstants {
+
+ /** name of the test project */
+ public final String PROJECT_NAME = "ClassDiagramTestProject";
+
+ /** name of the test model */
+ public final String FILE_NAME = "ClassDiagramTest.di";
+}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/AbstractPapyrusTestCase.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/AbstractPapyrusTestCase.java
index 7ca6559bb83..b19b0b26dff 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/AbstractPapyrusTestCase.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/AbstractPapyrusTestCase.java
@@ -16,7 +16,6 @@ package org.eclipse.papyrus.diagram.clazz.test.canonical;
import org.eclipse.papyrus.commands.ICreationCommand;
import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
-
/**
* The Class AbstractPapyrusTestCase.
*/
@@ -24,8 +23,6 @@ public abstract class AbstractPapyrusTestCase extends org.eclipse.papyrus.diagra
@Override
protected ICreationCommand getDiagramCommandCreation() {
- return new CreateClassDiagramCommand();
+ return new CreateClassDiagramCommand();
}
-
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/AllCanonicalTests.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/AllCanonicalTests.java
index 9ea98c09a23..41c9b30b9a9 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/AllCanonicalTests.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/AllCanonicalTests.java
@@ -15,7 +15,6 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
-
/**
* All test in canonical package
*/
@@ -40,9 +39,6 @@ TestDropfunction.class,
//test is a static operation is underlined
TestStaticFeatureRepresentation.class,
//test nested classifier
-TestClassDiagramNestedClassifier.class,
-
-})
+TestClassDiagramNestedClassifier.class, })
public class AllCanonicalTests {
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramChildLabel.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramChildLabel.java
index 7b6deb941e1..676f0560a44 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramChildLabel.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramChildLabel.java
@@ -16,6 +16,7 @@
package org.eclipse.papyrus.diagram.clazz.test.canonical;
import org.eclipse.papyrus.commands.ICreationCommand;
+import org.eclipse.papyrus.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.tests.canonical.TestChildLabel;
import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassAttributeCompartmentEditPart;
@@ -46,6 +47,16 @@ public class TestClassDiagramChildLabel extends TestChildLabel {
return new CreateClassDiagramCommand();
}
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
+ }
+
@Test
public void testToManageInstanceSlot() {
//instance specification
@@ -68,35 +79,30 @@ public class TestClassDiagramChildLabel extends TestChildLabel {
public void testToManageComponentNestedInterface() {
//Interface
testToManageTopNode(UMLElementTypes.Component_2002, UMLElementTypes.Interface_3037, ComponentNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
public void testToManageComponentNestedSignal() {
//Signal
testToManageTopNode(UMLElementTypes.Component_2002, UMLElementTypes.Signal_3051, ComponentNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
public void testToManageComponentNestedDataType() {
//Data Type
testToManageTopNode(UMLElementTypes.Component_2002, UMLElementTypes.DataType_3045, ComponentNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
public void testToManageComponentNestedEnumeration() {
//Enumeration
testToManageTopNode(UMLElementTypes.Component_2002, UMLElementTypes.Enumeration_3053, ComponentNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
public void testToManageComponentNestedPrimitiveType() {
//primitive Type
testToManageTopNode(UMLElementTypes.Component_2002, UMLElementTypes.PrimitiveType_3046, ComponentNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
@@ -127,42 +133,36 @@ public class TestClassDiagramChildLabel extends TestChildLabel {
public void testToManageInterfaceNestedClass() {
//Class
testToManageTopNode(UMLElementTypes.Interface_2004, UMLElementTypes.Class_3008, InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
public void testToManageInterfaceNestedInterface() {
//Interface
testToManageTopNode(UMLElementTypes.Interface_2004, UMLElementTypes.Interface_3038, InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
public void testToManageInterfaceNestedSignal() {
//Signal
testToManageTopNode(UMLElementTypes.Interface_2004, UMLElementTypes.Signal_3049, InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
public void testToManageInterfaceNestedDataType() {
//Data Type
testToManageTopNode(UMLElementTypes.Interface_2004, UMLElementTypes.DataType_3043, InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
public void testToManageInterfaceNestedEnumeration() {
//Enumeration
testToManageTopNode(UMLElementTypes.Interface_2004, UMLElementTypes.Enumeration_3054, InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
public void testToManageInterfaceNestedPrimitiveType() {
//Primitive Type
testToManageTopNode(UMLElementTypes.Interface_2004, UMLElementTypes.PrimitiveType_3048, InterfaceNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
@@ -193,42 +193,36 @@ public class TestClassDiagramChildLabel extends TestChildLabel {
public void testToManageClassNestedClass() {
//class
testToManageTopNode(UMLElementTypes.Class_2008, UMLElementTypes.Class_3014, ClassNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
public void testToManageClassNestedInetrface() {
//Interface
testToManageTopNode(UMLElementTypes.Class_2008, UMLElementTypes.Interface_3036, ClassNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
public void testToManageClassNestedSignal() {
//Signal
testToManageTopNode(UMLElementTypes.Class_2008, UMLElementTypes.Signal_3050, ClassNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
public void testToManageClassNestedDataType() {
//Data Type
testToManageTopNode(UMLElementTypes.Class_2008, UMLElementTypes.DataType_3044, ClassNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
public void testToManageClassNestedEnumeration() {
//Enumeration
testToManageTopNode(UMLElementTypes.Class_2008, UMLElementTypes.Enumeration_3052, ClassNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
public void testToManageClassNestedPrimitiveType() {
//Primitive Type
testToManageTopNode(UMLElementTypes.Class_2008, UMLElementTypes.PrimitiveType_3047, ClassNestedClassifierCompartmentEditPart.VISUAL_ID);
-
}
@Test
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramChildNode.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramChildNode.java
index 448d8e5f576..325b2f1d9ff 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramChildNode.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramChildNode.java
@@ -16,24 +16,33 @@ package org.eclipse.papyrus.diagram.clazz.test.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.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.tests.canonical.TestChildNode;
import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.eclipse.uml2.uml.UMLPackage;
import org.junit.Test;
-
/**
* The Class TestClassDiagramChildNode.
*/
public class TestClassDiagramChildNode extends TestChildNode {
-
@Override
protected CreateViewRequest createViewRequestShapeContainer() {
return CreateViewRequestFactory.getCreateShapeRequest(UMLElementTypes.Package_2007, getDiagramEditPart().getDiagramPreferencesHint());
}
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
+ }
+
/**
* {@inheritDoc}
*/
@@ -41,7 +50,7 @@ public class TestClassDiagramChildNode extends TestChildNode {
protected boolean isSemanticTest() {
return true;
}
-
+
/**
* Test to manage component.
*/
@@ -142,5 +151,4 @@ public class TestClassDiagramChildNode extends TestChildNode {
protected ICreationCommand getDiagramCommandCreation() {
return new CreateClassDiagramCommand();
}
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramContainment.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramContainment.java
index 9ce12bad835..c58aba0e026 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramContainment.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramContainment.java
@@ -13,17 +13,35 @@
*****************************************************************************/
package org.eclipse.papyrus.diagram.clazz.test.canonical;
+import org.eclipse.papyrus.commands.ICreationCommand;
+import org.eclipse.papyrus.diagram.clazz.test.IClassDiagramTestsConstants;
+import org.eclipse.papyrus.diagram.tests.canonical.TestContainmentLink;
+import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.junit.Test;
+public class TestClassDiagramContainment extends TestContainmentLink {
+
+ @Override
+ protected ICreationCommand getDiagramCommandCreation() {
+ return new CreateClassDiagramCommand();
+ }
+
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
+ }
-public class TestClassDiagramContainment extends TestContainmentLink{
/**
* Test to manage containmentLink.
*/
@Test
public void testToManageContainment() {
- testToManageLink(UMLElementTypes.Class_2008,UMLElementTypes.Class_2008,UMLElementTypes.Link_4023,UMLElementTypes.Package_2007);
+ testToManageLink(UMLElementTypes.Class_2008, UMLElementTypes.Class_2008, UMLElementTypes.Link_4023, UMLElementTypes.Package_2007);
}
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramLink.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramLink.java
index 34ef138929d..1129ccc767d 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramLink.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramLink.java
@@ -14,37 +14,48 @@
package org.eclipse.papyrus.diagram.clazz.test.canonical;
import org.eclipse.papyrus.commands.ICreationCommand;
+import org.eclipse.papyrus.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.tests.canonical.TestLink;
import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.junit.Test;
-
/**
* The Class TestClassDiagramLink use to test link that are contained by the owner of the target and the source
*/
public class TestClassDiagramLink extends TestLink {
-
@Override
protected ICreationCommand getDiagramCommandCreation() {
- return new CreateClassDiagramCommand();
+ return new CreateClassDiagramCommand();
+ }
+
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
}
+
/**
* Test to manage component.
*/
@Test
public void testToManageDependency() {
- testToManageLink(UMLElementTypes.Component_2002,UMLElementTypes.Component_2002,UMLElementTypes.Dependency_4008,UMLElementTypes.Package_2007,true);
+ testToManageLink(UMLElementTypes.Component_2002, UMLElementTypes.Component_2002, UMLElementTypes.Dependency_4008, UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage Association.
*/
@Test
public void testToManageAssociation() {
- testToManageLink(UMLElementTypes.Class_2008,UMLElementTypes.Class_2008,UMLElementTypes.Association_4001,UMLElementTypes.Package_2007,true);
+ testToManageLink(UMLElementTypes.Class_2008, UMLElementTypes.Class_2008, UMLElementTypes.Association_4001, UMLElementTypes.Package_2007, true);
}
+
//test generatlization
//test interfaceRealization
//test substitution
@@ -53,31 +64,31 @@ public class TestClassDiagramLink extends TestLink {
*/
@Test
public void testToManageRealization() {
- testToManageLink(UMLElementTypes.Class_2008,UMLElementTypes.Class_2008,UMLElementTypes.Realization_4005,UMLElementTypes.Package_2007,true);
+ testToManageLink(UMLElementTypes.Class_2008, UMLElementTypes.Class_2008, UMLElementTypes.Realization_4005, UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage Abstraction
*/
@Test
public void testToManageAbstraction() {
- testToManageLink(UMLElementTypes.Class_2008,UMLElementTypes.Class_2008,UMLElementTypes.Abstraction_4006,UMLElementTypes.Package_2007,true);
+ testToManageLink(UMLElementTypes.Class_2008, UMLElementTypes.Class_2008, UMLElementTypes.Abstraction_4006, UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage Usage
*/
@Test
public void testToManageUsage() {
- testToManageLink(UMLElementTypes.Class_2008,UMLElementTypes.Class_2008,UMLElementTypes.Usage_4007,UMLElementTypes.Package_2007,true);
+ testToManageLink(UMLElementTypes.Class_2008, UMLElementTypes.Class_2008, UMLElementTypes.Usage_4007, UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage Usage
*/
@Test
public void testToManageInformationFlow() {
- testToManageLink(UMLElementTypes.Class_2008,UMLElementTypes.Class_2008,UMLElementTypes.InformationFlow_4026,UMLElementTypes.Package_2007,true);
+ testToManageLink(UMLElementTypes.Class_2008, UMLElementTypes.Class_2008, UMLElementTypes.InformationFlow_4026, UMLElementTypes.Package_2007, true);
}
//test Element import
//testPackageImport
@@ -85,5 +96,4 @@ public class TestClassDiagramLink extends TestLink {
//test constraintLink
//test template binding
//test instancespecificationLink
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramLinkOwnedBySource.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramLinkOwnedBySource.java
index 0b9d10506c9..28b2a1693ea 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramLinkOwnedBySource.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramLinkOwnedBySource.java
@@ -14,12 +14,12 @@
package org.eclipse.papyrus.diagram.clazz.test.canonical;
import org.eclipse.papyrus.commands.ICreationCommand;
+import org.eclipse.papyrus.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.tests.canonical.TestLinkOwnedBySource;
import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.junit.Test;
-
/**
* The Class TestClassDiagramLink use to test link that are contained by the owner of the target and the source
*/
@@ -27,53 +27,61 @@ public class TestClassDiagramLinkOwnedBySource extends TestLinkOwnedBySource {
@Override
protected ICreationCommand getDiagramCommandCreation() {
- return new CreateClassDiagramCommand();
+ return new CreateClassDiagramCommand();
+ }
+
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
}
-
+
/**
* Test to manage Association.
*/
@Test
public void testToManageGeneralization() {
- testToManageLink(UMLElementTypes.Class_2008,UMLElementTypes.Class_2008,UMLElementTypes.Generalization_4002,UMLElementTypes.Package_2007,true);
+ testToManageLink(UMLElementTypes.Class_2008, UMLElementTypes.Class_2008, UMLElementTypes.Generalization_4002, UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage InterfaceRealization.
*/
@Test
public void testToManageInterfaceRealization() {
- testToManageLink(UMLElementTypes.Class_2008,UMLElementTypes.Interface_2004,UMLElementTypes.InterfaceRealization_4003,UMLElementTypes.Package_2007,true);
+ testToManageLink(UMLElementTypes.Class_2008, UMLElementTypes.Interface_2004, UMLElementTypes.InterfaceRealization_4003, UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage Substitution.
*/
@Test
public void testToManageSubstitution() {
- testToManageLink(UMLElementTypes.Class_2008,UMLElementTypes.Class_2008,UMLElementTypes.Substitution_4004,UMLElementTypes.Package_2007,true);
+ testToManageLink(UMLElementTypes.Class_2008, UMLElementTypes.Class_2008, UMLElementTypes.Substitution_4004, UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage ElementImport.
*/
@Test
public void testToManageElementImport() {
- testToManageLink(UMLElementTypes.Class_2008,UMLElementTypes.Class_2008,UMLElementTypes.ElementImport_4009,UMLElementTypes.Package_2007,true);
+ testToManageLink(UMLElementTypes.Class_2008, UMLElementTypes.Class_2008, UMLElementTypes.ElementImport_4009, UMLElementTypes.Package_2007, true);
}
+
/**
* Test to manage ElementImport.
*/
@Test
public void testToManagePackageImport() {
- testToManageLink(UMLElementTypes.Package_2007,UMLElementTypes.Package_2007,UMLElementTypes.PackageImport_4010,UMLElementTypes.Package_2007,true);
+ testToManageLink(UMLElementTypes.Package_2007, UMLElementTypes.Package_2007, UMLElementTypes.PackageImport_4010, UMLElementTypes.Package_2007, true);
}
-
-
//test comment link
//test constraintLink
//test template binding
//test containment link
//test instancespecificationLink
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramNestedClassifier.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramNestedClassifier.java
index 99d8fa19196..3623f4f22b3 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramNestedClassifier.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramNestedClassifier.java
@@ -14,6 +14,7 @@
package org.eclipse.papyrus.diagram.clazz.test.canonical;
import org.eclipse.papyrus.commands.ICreationCommand;
+import org.eclipse.papyrus.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.tests.canonical.TestNested;
import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassNestedClassifierCompartmentEditPartCN;
@@ -33,130 +34,121 @@ public class TestClassDiagramNestedClassifier extends TestNested {
return new CreateClassDiagramCommand();
}
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
+ }
+
@Test
public void testToManageComponentNestedClass() {
//Class
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Component_3021, UMLElementTypes.Class_3004, PackagePackageableElementCompartmentEditPart.VISUAL_ID, ComponentNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageComponentNestedInterface() {
//Interface
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Component_3021, UMLElementTypes.Interface_3037, PackagePackageableElementCompartmentEditPart.VISUAL_ID, ComponentNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageComponentNestedSignal() {
//Signal
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Component_3021, UMLElementTypes.Signal_3051, PackagePackageableElementCompartmentEditPart.VISUAL_ID, ComponentNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageComponentNestedDataType() {
//Data Type
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Component_3021, UMLElementTypes.DataType_3045, PackagePackageableElementCompartmentEditPart.VISUAL_ID, ComponentNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageComponentNestedEnumeration() {
//Enumeration
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Component_3021, UMLElementTypes.Enumeration_3053, PackagePackageableElementCompartmentEditPart.VISUAL_ID, ComponentNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageComponentNestedPrimitiveType() {
//primitive Type
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Component_3021, UMLElementTypes.PrimitiveType_3046, PackagePackageableElementCompartmentEditPart.VISUAL_ID, ComponentNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageInterfaceNestedClass() {
//Class
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Interface_3023, UMLElementTypes.Class_3008, PackagePackageableElementCompartmentEditPart.VISUAL_ID, InterfaceNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageInterfaceNestedInterface() {
//Interface
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Interface_3023, UMLElementTypes.Interface_3038, PackagePackageableElementCompartmentEditPart.VISUAL_ID, InterfaceNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageInterfaceNestedSignal() {
//Signal
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Interface_3023, UMLElementTypes.Signal_3049, PackagePackageableElementCompartmentEditPart.VISUAL_ID, InterfaceNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageInterfaceNestedDataType() {
//Data Type
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Interface_3023, UMLElementTypes.DataType_3043, PackagePackageableElementCompartmentEditPart.VISUAL_ID, InterfaceNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageInterfaceNestedEnumeration() {
//Enumeration
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Interface_3023, UMLElementTypes.Enumeration_3054, PackagePackageableElementCompartmentEditPart.VISUAL_ID, InterfaceNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageInterfaceNestedPrimitiveType() {
//Primitive Type
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Interface_3023, UMLElementTypes.PrimitiveType_3048, PackagePackageableElementCompartmentEditPart.VISUAL_ID, InterfaceNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageClassNestedClass() {
//class
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Class_3010, UMLElementTypes.Class_3014, PackagePackageableElementCompartmentEditPart.VISUAL_ID, ClassNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageClassNestedInetrface() {
//Interface
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Class_3010, UMLElementTypes.Interface_3036, PackagePackageableElementCompartmentEditPart.VISUAL_ID, ClassNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageClassNestedSignal() {
//Signal
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Class_3010, UMLElementTypes.Signal_3050, PackagePackageableElementCompartmentEditPart.VISUAL_ID, ClassNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageClassNestedDataType() {
//Data Type
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Class_3010, UMLElementTypes.DataType_3044, PackagePackageableElementCompartmentEditPart.VISUAL_ID, ClassNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageclassNestedEnumeration() {
//Enumeration
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Class_3010, UMLElementTypes.Enumeration_3052, PackagePackageableElementCompartmentEditPart.VISUAL_ID, ClassNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
@Test
public void testToManageClassNestedPrimitiveType() {
//Primitive Type
testToManageTopNode(UMLElementTypes.Package_2007, UMLElementTypes.Class_3010, UMLElementTypes.PrimitiveType_3047, PackagePackageableElementCompartmentEditPart.VISUAL_ID, ClassNestedClassifierCompartmentEditPartCN.VISUAL_ID);
-
}
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramTopNode.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramTopNode.java
index 820dc2d3312..71defe6ab88 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramTopNode.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestClassDiagramTopNode.java
@@ -16,25 +16,33 @@ package org.eclipse.papyrus.diagram.clazz.test.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.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.tests.canonical.TestTopNode;
import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.eclipse.uml2.uml.UMLPackage;
import org.junit.Test;
-
-// TODO: Auto-generated Javadoc
/**
* The Class TestClassDiagramTopNode.
*/
public class TestClassDiagramTopNode extends TestTopNode {
-
-
+
@Override
protected ICreationCommand getDiagramCommandCreation() {
- return new CreateClassDiagramCommand();
+ return new CreateClassDiagramCommand();
+ }
+
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
}
-
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
+ }
+
/**
* Test to manage component.
*/
@@ -42,7 +50,7 @@ public class TestClassDiagramTopNode extends TestTopNode {
public void testToManageComponent() {
testToManageNode(UMLElementTypes.Component_2002, UMLPackage.eINSTANCE.getComponent(), UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage instance specification.
*/
@@ -50,7 +58,7 @@ public class TestClassDiagramTopNode extends TestTopNode {
public void testToManageInstanceSpecification() {
testToManageNode(UMLElementTypes.InstanceSpecification_2001, UMLPackage.eINSTANCE.getInstanceSpecification(), UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage signal.
*/
@@ -58,7 +66,7 @@ public class TestClassDiagramTopNode extends TestTopNode {
public void testToManageSignal() {
testToManageNode(UMLElementTypes.Signal_2003, UMLPackage.eINSTANCE.getSignal(), UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage model.
*/
@@ -66,7 +74,7 @@ public class TestClassDiagramTopNode extends TestTopNode {
public void testToManageModel() {
testToManageNode(UMLElementTypes.Model_2005, UMLPackage.eINSTANCE.getModel(), UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage enumeration.
*/
@@ -74,7 +82,7 @@ public class TestClassDiagramTopNode extends TestTopNode {
public void testToManageEnumeration() {
testToManageNode(UMLElementTypes.Enumeration_2006, UMLPackage.eINSTANCE.getEnumeration(), UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage i package.
*/
@@ -82,7 +90,7 @@ public class TestClassDiagramTopNode extends TestTopNode {
public void testToManageIPackage() {
testToManageNode(UMLElementTypes.Package_2007, UMLPackage.eINSTANCE.getPackage(), UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage class.
*/
@@ -90,7 +98,7 @@ public class TestClassDiagramTopNode extends TestTopNode {
public void testToManageClass() {
testToManageNode(UMLElementTypes.Class_2008, UMLPackage.eINSTANCE.getClass_(), UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage primitive type.
*/
@@ -98,7 +106,7 @@ public class TestClassDiagramTopNode extends TestTopNode {
public void testToManagePrimitiveType() {
testToManageNode(UMLElementTypes.PrimitiveType_2009, UMLPackage.eINSTANCE.getPrimitiveType(), UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage data type.
*/
@@ -106,7 +114,7 @@ public class TestClassDiagramTopNode extends TestTopNode {
public void testToManageDataType() {
testToManageNode(UMLElementTypes.DataType_2010, UMLPackage.eINSTANCE.getDataType(), UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage constraint.
*/
@@ -114,7 +122,7 @@ public class TestClassDiagramTopNode extends TestTopNode {
public void testToManageConstraint() {
testToManageNode(UMLElementTypes.Constraint_2011, UMLPackage.eINSTANCE.getConstraint(), UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage comment.
*/
@@ -122,7 +130,7 @@ public class TestClassDiagramTopNode extends TestTopNode {
public void testToManageComment() {
testToManageNode(UMLElementTypes.Comment_2012, UMLPackage.eINSTANCE.getComment(), UMLElementTypes.Package_2007, true);
}
-
+
/**
* Test to manage component.
*/
@@ -138,5 +146,4 @@ public class TestClassDiagramTopNode extends TestTopNode {
protected CreateViewRequest createViewRequestShapeContainer() {
return CreateViewRequestFactory.getCreateShapeRequest(UMLElementTypes.Package_2007, getDiagramEditPart().getDiagramPreferencesHint());
}
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestContainmentLink.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestContainmentLink.java
deleted file mode 100644
index 4b5cc761fd8..00000000000
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestContainmentLink.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.diagram.clazz.test.canonical;
-
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.GroupRequest;
-import org.eclipse.gef.requests.ReconnectRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
-import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.commands.ICreationCommand;
-import org.eclipse.papyrus.diagram.tests.canonical.TestLink;
-import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
-import org.eclipse.uml2.uml.Element;
-
-
-public class TestContainmentLink extends TestLink {
-
- @Override
- protected ICreationCommand getDiagramCommandCreation() {
- return new CreateClassDiagramCommand();
- }
- /**
- * Test view deletion.
- *
- * @param type the type
- */
- @Override
- public void testViewDeletion(IElementType type) {
- //DELETION OF THE VIEW
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(VIEW_DELETION +INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size()==3);
- assertTrue(VIEW_DELETION +INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
- Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
- Command command = ((ConnectionEditPart)source.getChildBySemanticHint("3032").getSourceConnections().get(0)).getCommand(deleteViewRequest);
- assertNotNull(VIEW_DELETION +COMMAND_NULL,command);
- assertTrue(VIEW_DELETION +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(VIEW_DELETION +TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==0);
- assertTrue(VIEW_DELETION +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==3);
- assertTrue(VIEW_DELETION +TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(VIEW_DELETION +TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==3);
- assertTrue(VIEW_DELETION +TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==0);
- assertTrue(VIEW_DELETION +TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==3);
- assertTrue(VIEW_DELETION +TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
-
- }
-
- /**
- * Test destroy.
- *
- * @param type the type
- */
- @Override
- public void testDestroy(IElementType type) {
-
-
- //DESTROY SEMANTIC+ VIEW
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(CREATION +INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
- assertTrue(DESTROY_DELETION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==3);
-
- Request deleteViewRequest = new EditCommandRequestWrapper( new DestroyElementRequest(false));
- Command command = ((ConnectionEditPart)source.getChildBySemanticHint("3032").getSourceConnections().get(0)).getCommand(deleteViewRequest);
- assertNotNull(DESTROY_DELETION +COMMAND_NULL,command);
- assertTrue(DESTROY_DELETION +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(DESTROY_DELETION+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==0);
- assertTrue(DESTROY_DELETION +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(DESTROY_DELETION +TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==0);
-
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(DESTROY_DELETION +TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==3);
- assertTrue(DESTROY_DELETION +TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==0);
- assertTrue(DESTROY_DELETION +TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(DESTROY_DELETION +TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==0);
- }
-
-
- /**
- * Test drop.
- *
- * @param type the type
- */
- @Override
- public void testDrop(IElementType type) {
- //DROP
-
- //it is impossible to drop but you can recreat the link between this element
- assertTrue(DROP +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==4);
- assertTrue(DROP +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==3);
- assertTrue(DROP +INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
- assertTrue(DROP +TEST_THE_REDO,((Diagram)getRootView()).getEdges().size()==0);
-
-
- }
-
-
-
-
- /**
- * Test to create a link.
- *
- * @param linkType the type
- */
- @Override
- public void testToCreateALink(IElementType linkType) {
- assertTrue(CREATION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==4);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(CREATION +INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==0);
-
- Command command = target.getCommand(createConnectionViewRequest(linkType, source, target));
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CONTAINER_CREATION+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CREATION +TEST_THE_EXECUTION,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(CREATION +TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(CREATION +TEST_THE_EXECUTION,((Diagram)getRootView()).getEdges().size()==0);
- assertTrue(CREATION +TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==0);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(CREATION +TEST_THE_EXECUTION,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(CREATION +TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
-
- }
- @Override
- public void installEnvironment(IElementType sourceType,IElementType targetType ){
- assertTrue(CREATION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==0);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==0);
-
- //create the source
- CreateViewRequest requestcreation=CreateViewRequestFactory.getCreateShapeRequest(sourceType, getDiagramEditPart().getDiagramPreferencesHint());
- requestcreation.setLocation(new Point(100, 100));
- Command command=getDiagramEditPart().getCommand(requestcreation);
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue("CREATION: "+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
-
- //create the source player to test reconnect
- requestcreation=CreateViewRequestFactory.getCreateShapeRequest(sourceType, getDiagramEditPart().getDiagramPreferencesHint());
- requestcreation.setLocation(new Point(100, 300));
- command=getDiagramEditPart().getCommand(requestcreation);
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue("CREATION: "+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
- //create the target
- requestcreation=CreateViewRequestFactory.getCreateShapeRequest(targetType, getDiagramEditPart().getDiagramPreferencesHint());
- requestcreation.setLocation(new Point(300, 100));
- command=getDiagramEditPart().getCommand(requestcreation);
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue("CREATION: "+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
- //create the target player to test reconnect
- requestcreation=CreateViewRequestFactory.getCreateShapeRequest(targetType, getDiagramEditPart().getDiagramPreferencesHint());
- requestcreation.setLocation(new Point(300, 300));
- command=getDiagramEditPart().getCommand(requestcreation);
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue("CREATION: "+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
-
-
-
- source=(GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
- sourcePlayer=(GraphicalEditPart)getDiagramEditPart().getChildren().get(1);
- target=(GraphicalEditPart)getDiagramEditPart().getChildren().get(2);
- targetPlayer=(GraphicalEditPart)getDiagramEditPart().getChildren().get(3);
-
- }
-
-
-
-
-
- @Override
- public void testTargetReconnectAMultiLink(IElementType type) {
-
- //target reconnection
- ReconnectRequest reconnectRequest= new ReconnectRequest();
- assertTrue(THE_LINK_RECONNECT_EXISTS,((ConnectionEditPart)source.getChildBySemanticHint("3032").getSourceConnections().get(0))!=null);
- ConnectionEditPart binaryLink=((ConnectionEditPart)source.getChildBySemanticHint("3032").getSourceConnections().get(0));
- reconnectRequest.setConnectionEditPart(binaryLink);
- reconnectRequest.setTargetEditPart(targetPlayer);
- reconnectRequest.setType(RequestConstants.REQ_RECONNECT_TARGET);
-
- Command cmd = targetPlayer.getCommand(reconnectRequest);
-
- assertTrue(RECONNECTION_TARGET+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,cmd.canExecute()==true);
- getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().execute(cmd);
- // EditorUtils.getTransactionalEditingDomain().getCommandStack().execute(cmd);
- assertTrue(RECONNECTION_TARGET+TEST_THE_EXECUTION,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(RECONNECTION_TARGET +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==3);
- assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET,binaryLink.getTarget().equals(targetPlayer));
-
- //undo
- getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET+ TEST_THE_UNDO,binaryLink.getTarget().equals(target));
-
- //redo
- getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET+ TEST_THE_REDO,binaryLink.getTarget().equals(targetPlayer));
-
-
-
- }
-
- @Override
- public void testSourceReconnectAMultiLink(IElementType type) {
-
- //target reconnection
- ReconnectRequest reconnectRequest= new ReconnectRequest();
- assertTrue(THE_LINK_TO_RECONNECT_EXISTS,((ConnectionEditPart)source.getChildBySemanticHint("3032").getSourceConnections().get(0))!=null);
- ConnectionEditPart branch=((ConnectionEditPart)source.getChildBySemanticHint("3032").getSourceConnections().get(0));
- reconnectRequest.setConnectionEditPart(branch);
- reconnectRequest.setTargetEditPart(sourcePlayer);
- reconnectRequest.setType(RequestConstants.REQ_RECONNECT_SOURCE);
-
- Command cmd = sourcePlayer.getCommand(reconnectRequest);
- //it is impossible to reconnect source of the link
- assertTrue(RECONNECTION_SOURCE+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,cmd.canExecute()==false);
-
-
- }
-
- /**
- * Test to manage top node.
- *
- * @param type the type
- * @param containerType the container type
- */
- public void testToManageLink(IElementType sourceType,IElementType targetType, IElementType linkType, IElementType containerType) {
- installEnvironment(sourceType, targetType);
- testToCreateALink(linkType);
- testDestroy(linkType);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- testViewDeletion(linkType);
- testDrop(linkType);
- testRecreation(linkType);
- testSourceReconnectAMultiLink(linkType);
- testTargetReconnectAMultiLink(linkType);
-
- }
-
- public void testRecreation(IElementType linkType) {
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==0);
- assertTrue(CREATION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==4);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==3);
- assertTrue(CREATION +INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
-
- Command command = target.getCommand(createConnectionViewRequest(linkType, source, target));
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CONTAINER_CREATION+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(CREATION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==4);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==3);
- assertTrue(CREATION +INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==0);
- assertTrue(CREATION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==4);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==3);
- assertTrue(CREATION +INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
- diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(CREATION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==4);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==3);
- assertTrue(CREATION +INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
-
- }
-}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestDropfunction.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestDropfunction.java
index 8ca9fab137b..ba0afaaa1f1 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestDropfunction.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestDropfunction.java
@@ -29,6 +29,7 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.commands.ICreationCommand;
+import org.eclipse.papyrus.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.tests.canonical.TestChildLabel;
import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.EnumerationEnumerationLiteralCompartmentEditPart;
@@ -40,97 +41,101 @@ import org.junit.Test;
* test in order to verify if the drop respect the order of the selection
* Create an enumeration, create subenumerationliterals, select them, drop into the diagram
* the order of enumeration list has to be the same that as the list in the request drop.
- *
+ *
*/
+public class TestDropfunction extends TestChildLabel {
-public class TestDropfunction extends TestChildLabel {
-
@Override
protected ICreationCommand getDiagramCommandCreation() {
- return new CreateClassDiagramCommand();
+ return new CreateClassDiagramCommand();
+ }
+
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
}
- public static int MAX=20;
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
+ }
+
+ public static int MAX = 20;
+
@Test
- public void testDropWithOrder(){
+ public void testDropWithOrder() {
testToCreateATopNode(UMLElementTypes.Enumeration_2006);
testToCreateSetOfNode(UMLElementTypes.EnumerationLiteral_3017, EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID);
testSetOfDrop(UMLElementTypes.EnumerationLiteral_3017, EnumerationEnumerationLiteralCompartmentEditPart.VISUAL_ID);
}
- protected void testToCreateSetOfNode(IElementType type,int containerType) {
- ListCompartmentEditPart compartment=null;
- int index=0;
- while (compartment==null && index <getTopEditPart().getChildren().size()){
- if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart&& (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals(""+containerType))){
- compartment= (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
+ protected void testToCreateSetOfNode(IElementType type, int containerType) {
+ ListCompartmentEditPart compartment = null;
+ int index = 0;
+ while(compartment == null && index < getTopEditPart().getChildren().size()) {
+ if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart && (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals("" + containerType))) {
+ compartment = (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
}
index++;
}
- assertTrue("Container not found", compartment!=null);
+ assertTrue("Container not found", compartment != null);
//CREATION
- assertTrue(CREATION +INITIALIZATION_TEST,compartment.getChildren().size()==0);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==0);
-
-
- for(int i=0; i<MAX;i++){
- CreateViewRequest requestcreation=CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
- Command command=compartment.getCommand(requestcreation);
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue("CREATION: "+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ assertTrue(CREATION + INITIALIZATION_TEST, compartment.getChildren().size() == 0);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 0);
+ for(int i = 0; i < MAX; i++) {
+ CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
+ Command command = compartment.getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
//creation of label
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CREATION+TEST_THE_EXECUTION,compartment.getChildren().size()==1);
+ assertTrue(CREATION + TEST_THE_EXECUTION, compartment.getChildren().size() == 1);
//deletion view
Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
command = ((GraphicalEditPart)compartment.getChildren().get(0)).getCommand(deleteViewRequest);
- assertNotNull(VIEW_DELETION +COMMAND_NULL,command);
+ assertNotNull(VIEW_DELETION + COMMAND_NULL, command);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
}
-
}
+
/**
* Test drop.
*
- * @param type the type
- * @param containerType the container type
+ * @param type
+ * the type
+ * @param containerType
+ * the container type
*/
- protected void testSetOfDrop(IElementType type,int containerType) {
- ListCompartmentEditPart compartment=null;
- int index=0;
- while (compartment==null && index <getTopEditPart().getChildren().size()){
- if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart&& (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals(""+containerType))){
- compartment= (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
+ protected void testSetOfDrop(IElementType type, int containerType) {
+ ListCompartmentEditPart compartment = null;
+ int index = 0;
+ while(compartment == null && index < getTopEditPart().getChildren().size()) {
+ if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart && (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals("" + containerType))) {
+ compartment = (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
}
index++;
}
- assertTrue("Container not found", compartment!=null);
+ assertTrue("Container not found", compartment != null);
//DROP
- assertTrue(DROP +INITIALIZATION_TEST,compartment.getChildren().size()==0);
- assertTrue(DROP +INITIALIZATION_TEST,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==MAX);
-
-
- DropObjectsRequest dropObjectsRequest= new DropObjectsRequest();
+ assertTrue(DROP + INITIALIZATION_TEST, compartment.getChildren().size() == 0);
+ assertTrue(DROP + INITIALIZATION_TEST, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == MAX);
+ DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
ArrayList<Element> list = new ArrayList<Element>();
- for(int i=0; i<MAX;i++){
+ for(int i = 0; i < MAX; i++) {
list.add(getRootSemanticModel().getOwnedElements().get(i));
}
dropObjectsRequest.setObjects(list);
- dropObjectsRequest.setLocation(new Point(20,20));
- Command command= compartment.getCommand(dropObjectsRequest);
- assertNotNull(DROP+COMMAND_NULL,command);
- assertTrue(DROP +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(DROP+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ dropObjectsRequest.setLocation(new Point(20, 20));
+ Command command = compartment.getCommand(dropObjectsRequest);
+ assertNotNull(DROP + COMMAND_NULL, command);
+ assertTrue(DROP + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(DROP + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(DROP +TEST_THE_EXECUTION,compartment.getChildren().size()==MAX);
- assertTrue(DROP +TEST_THE_EXECUTION,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==MAX);
-
- for(int i=0; i<MAX;i++){
- assertEquals(getRootSemanticModel().getOwnedElements().get(i),((GraphicalEditPart) compartment.getChildren().get(i)).resolveSemanticElement());
+ assertTrue(DROP + TEST_THE_EXECUTION, compartment.getChildren().size() == MAX);
+ assertTrue(DROP + TEST_THE_EXECUTION, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == MAX);
+ for(int i = 0; i < MAX; i++) {
+ assertEquals(getRootSemanticModel().getOwnedElements().get(i), ((GraphicalEditPart)compartment.getChildren().get(i)).resolveSemanticElement());
}
-
}
-
-
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestMutliLink.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestMutliLink.java
index 5dbe0ce2966..9d0778234a1 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestMutliLink.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestMutliLink.java
@@ -1,19 +1,44 @@
+/*****************************************************************************
+ * 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:
+ * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
+ /*****************************************************************************/
package org.eclipse.papyrus.diagram.clazz.test.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.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.tests.canonical.AbstractTestMultiLink;
import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.junit.Test;
public class TestMutliLink extends AbstractTestMultiLink {
+
@Override
protected CreateViewRequest createViewRequestShapeContainer() {
// TODO Auto-generated method stub
return CreateViewRequestFactory.getCreateShapeRequest(UMLElementTypes.Class_2008, getDiagramEditPart().getDiagramPreferencesHint());
}
+
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
+ }
+
/**
* Test to manage dependency.
*/
@@ -29,8 +54,9 @@ public class TestMutliLink extends AbstractTestMultiLink {
public void testToManageMultiAssociation() {
testToManageMultiLink(UMLElementTypes.Association_4001, UMLElementTypes.Association_4019, false);
}
+
@Override
protected ICreationCommand getDiagramCommandCreation() {
- return new CreateClassDiagramCommand();
+ return new CreateClassDiagramCommand();
}
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestStaticFeatureRepresentation.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestStaticFeatureRepresentation.java
index 645f820e4a0..6f30bf26013 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestStaticFeatureRepresentation.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/canonical/TestStaticFeatureRepresentation.java
@@ -1,3 +1,15 @@
+/*****************************************************************************
+ * 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:
+ * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
+ /*****************************************************************************/
package org.eclipse.papyrus.diagram.clazz.test.canonical;
import org.eclipse.draw2d.text.FlowPage;
@@ -13,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.commands.ICreationCommand;
import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
+import org.eclipse.papyrus.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.tests.canonical.TestChildLabel;
import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassAttributeCompartmentEditPart;
@@ -25,65 +38,68 @@ import org.junit.Test;
/**
* this class is used to test if feature are a representation for static
- *
+ *
*/
public class TestStaticFeatureRepresentation extends TestChildLabel {
@Override
protected ICreationCommand getDiagramCommandCreation() {
- return new CreateClassDiagramCommand();
+ return new CreateClassDiagramCommand();
}
+
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
+ }
+
@Test
- public void testStaticOperation(){
+ public void testStaticOperation() {
testToCreateATopNode(UMLElementTypes.Class_2008);
testToTestStaticoperation(UMLElementTypes.Operation_3013, ClassOperationCompartmentEditPart.VISUAL_ID);
-
}
-
+
@Test
- public void testStaticProperty(){
+ public void testStaticProperty() {
testToCreateATopNode(UMLElementTypes.Class_2008);
testToTestStaticoperation(UMLElementTypes.Property_3012, ClassAttributeCompartmentEditPart.VISUAL_ID);
-
}
- protected void testToTestStaticoperation(IElementType type,int containerType) {
- ListCompartmentEditPart compartment=null;
- int index=0;
- while (compartment==null && index <getTopEditPart().getChildren().size()){
- if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart&& (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals(""+containerType))){
- compartment= (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
+ protected void testToTestStaticoperation(IElementType type, int containerType) {
+ ListCompartmentEditPart compartment = null;
+ int index = 0;
+ while(compartment == null && index < getTopEditPart().getChildren().size()) {
+ if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart && (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals("" + containerType))) {
+ compartment = (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
}
index++;
}
- assertTrue("Container not found", compartment!=null);
+ assertTrue("Container not found", compartment != null);
//CREATION
- assertTrue(CREATION +INITIALIZATION_TEST,compartment.getChildren().size()==0);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==0);
-
-
- CreateViewRequest requestcreation=CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
- Command command=compartment.getCommand(requestcreation);
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue("CREATION: "+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
-
-
+ assertTrue(CREATION + INITIALIZATION_TEST, compartment.getChildren().size() == 0);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 0);
+ CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
+ Command command = compartment.getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
//creation of label
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CREATION+TEST_THE_EXECUTION,compartment.getChildren().size()==1);
- assertTrue("ceated editpart is a feature editpart",((compartment.getChildren().get(0)) instanceof UMLCompartmentEditPart));
- UMLCompartmentEditPart featureEditPart= (UMLCompartmentEditPart)compartment.getChildren().get(0);
-
+ assertTrue(CREATION + TEST_THE_EXECUTION, compartment.getChildren().size() == 1);
+ assertTrue("ceated editpart is a feature editpart", ((compartment.getChildren().get(0)) instanceof UMLCompartmentEditPart));
+ UMLCompartmentEditPart featureEditPart = (UMLCompartmentEditPart)compartment.getChildren().get(0);
//make it static
- SetCommand setStaticOperation= new SetCommand(diagramEditor.getEditingDomain(), featureEditPart.resolveSemanticElement(), UMLPackage.eINSTANCE.getFeature_IsStatic(), true);
+ SetCommand setStaticOperation = new SetCommand(diagramEditor.getEditingDomain(), featureEditPart.resolveSemanticElement(), UMLPackage.eINSTANCE.getFeature_IsStatic(), true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(new ICommandProxy(new EMFtoGMFCommandWrapper(setStaticOperation)));
- TextFlowEx label=(TextFlowEx)((FlowPage)featureEditPart.getFigure().getChildren().get(0)).getChildren().get(0);
+ TextFlowEx label = (TextFlowEx)((FlowPage)featureEditPart.getFigure().getChildren().get(0)).getChildren().get(0);
featureEditPart.refresh();
//the semantic element is static
- assertTrue("the feature is static",((Feature)featureEditPart.resolveSemanticElement()).isStatic());
+ assertTrue("the feature is static", ((Feature)featureEditPart.resolveSemanticElement()).isStatic());
//the graphical element is underlined
assertTrue("the figigure is drawn as static", label.isTextUnderlined());
-
}
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load100ClassTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load100ClassTest.java
index 28952b1bf96..5c1df6dcd5d 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load100ClassTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load100ClassTest.java
@@ -18,19 +18,28 @@ import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.clazz.test.canonical.AbstractPapyrusTestCase;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.junit.Ignore;
import org.junit.Test;
-
-
// TODO: Auto-generated Javadoc
/**
* The Class Load100ClassTest.
*/
public class Load100ClassTest extends AbstractPapyrusTestCase {
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
+ }
+
/**
* Test to create a node.
*
@@ -44,7 +53,6 @@ public class Load100ClassTest extends AbstractPapyrusTestCase {
assertTrue("CREATION: test if the command is created", command != UnexecutableCommand.INSTANCE);
assertTrue("CREATION: test if the command can be executed", command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
}
/**
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load10ClassTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load10ClassTest.java
index 45735e22e45..56fc166fa38 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load10ClassTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load10ClassTest.java
@@ -18,19 +18,28 @@ import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.clazz.test.canonical.AbstractPapyrusTestCase;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.junit.Ignore;
import org.junit.Test;
-
-
// TODO: Auto-generated Javadoc
/**
* The Class Load10ClassTest.
*/
public class Load10ClassTest extends AbstractPapyrusTestCase {
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
+ }
+
/**
* Test to create a node.
*
@@ -44,7 +53,6 @@ public class Load10ClassTest extends AbstractPapyrusTestCase {
assertTrue("CREATION: test if the command is created", command != UnexecutableCommand.INSTANCE);
assertTrue("CREATION: test if the command can be executed", command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
}
/**
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load200ClassTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load200ClassTest.java
index b0e53caccb3..c8874ef0060 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load200ClassTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load200ClassTest.java
@@ -18,19 +18,28 @@ import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.clazz.test.canonical.AbstractPapyrusTestCase;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.junit.Ignore;
import org.junit.Test;
-
-
// TODO: Auto-generated Javadoc
/**
* The Class Load200ClassTest.
*/
public class Load200ClassTest extends AbstractPapyrusTestCase {
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
+ }
+
/**
* Test to create a node.
*
@@ -44,7 +53,6 @@ public class Load200ClassTest extends AbstractPapyrusTestCase {
assertTrue("CREATION: test if the command is created", command != UnexecutableCommand.INSTANCE);
assertTrue("CREATION: test if the command can be executed", command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
}
/**
@@ -57,5 +65,4 @@ public class Load200ClassTest extends AbstractPapyrusTestCase {
testToCreateANode(UMLElementTypes.Class_2008);
}
}
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load300ClassTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load300ClassTest.java
index 97a0e681f03..a55621f418c 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load300ClassTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load300ClassTest.java
@@ -18,19 +18,28 @@ import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.clazz.test.canonical.AbstractPapyrusTestCase;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.junit.Ignore;
import org.junit.Test;
-
-
// TODO: Auto-generated Javadoc
/**
* The Class Load300ClassTest.
*/
public class Load300ClassTest extends AbstractPapyrusTestCase {
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
+ }
+
/**
* Test to create a node.
*
@@ -44,7 +53,6 @@ public class Load300ClassTest extends AbstractPapyrusTestCase {
assertTrue("CREATION: test if the command is created", command != UnexecutableCommand.INSTANCE);
assertTrue("CREATION: test if the command can be executed", command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
}
/**
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load400ClassTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load400ClassTest.java
index f72cda1e70c..1f0c9208f8d 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load400ClassTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load400ClassTest.java
@@ -18,19 +18,28 @@ import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.clazz.test.canonical.AbstractPapyrusTestCase;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.junit.Ignore;
import org.junit.Test;
-
-
// TODO: Auto-generated Javadoc
/**
* The Class Load400ClassTest.
*/
public class Load400ClassTest extends AbstractPapyrusTestCase {
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
+ }
+
/**
* Test to create a node.
*
@@ -44,7 +53,6 @@ public class Load400ClassTest extends AbstractPapyrusTestCase {
assertTrue("CREATION: test if the command is created", command != UnexecutableCommand.INSTANCE);
assertTrue("CREATION: test if the command can be executed", command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
}
/**
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load500ClassTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load500ClassTest.java
index 7d88c8bfb3f..8d385a96410 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load500ClassTest.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/Load500ClassTest.java
@@ -18,19 +18,28 @@ import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.papyrus.diagram.clazz.test.IClassDiagramTestsConstants;
import org.eclipse.papyrus.diagram.clazz.test.canonical.AbstractPapyrusTestCase;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.junit.Ignore;
import org.junit.Test;
-
-
// TODO: Auto-generated Javadoc
/**
* The Class Load500ClassTest.
*/
public class Load500ClassTest extends AbstractPapyrusTestCase {
+ @Override
+ protected String getProjectName() {
+ return IClassDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IClassDiagramTestsConstants.FILE_NAME;
+ }
+
/**
* Test to create a node.
*
@@ -44,7 +53,6 @@ public class Load500ClassTest extends AbstractPapyrusTestCase {
assertTrue("CREATION: test if the command is created", command != UnexecutableCommand.INSTANCE);
assertTrue("CREATION: test if the command can be executed", command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
}
/**
@@ -57,5 +65,4 @@ public class Load500ClassTest extends AbstractPapyrusTestCase {
testToCreateANode(UMLElementTypes.Class_2008);
}
}
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/LoadTests.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/LoadTests.java
index cbd63e6fa88..c3445125a4d 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/LoadTests.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.clazz.tests/test/org/eclipse/papyrus/diagram/clazz/test/load/LoadTests.java
@@ -11,10 +11,8 @@
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
*
*****************************************************************************/
-
package org.eclipse.papyrus.diagram.clazz.test.load;
-
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@@ -35,8 +33,6 @@ Load300ClassTest.class,
// 400 classes
Load400ClassTest.class,
// 500 classes
-Load500ClassTest.class,
-})
+Load500ClassTest.class, })
public class LoadTests {
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/Activator.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/Activator.java
index 012a8ae3487..a24e7b462bc 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/Activator.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/Activator.java
@@ -1,3 +1,15 @@
+/*****************************************************************************
+ * 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:
+ * (CEA LIST) - Initial API and implementation
+ /*****************************************************************************/
package org.eclipse.papyrus.diagram.tests;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -13,7 +25,7 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
-
+
/**
* The constructor
*/
@@ -22,6 +34,7 @@ public class Activator extends AbstractUIPlugin {
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
@@ -31,6 +44,7 @@ public class Activator extends AbstractUIPlugin {
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
@@ -40,11 +54,10 @@ public class Activator extends AbstractUIPlugin {
/**
* Returns the shared instance
- *
+ *
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractPapyrusTestCase.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractPapyrusTestCase.java
index c6b358acb28..95a6dba1b91 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractPapyrusTestCase.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractPapyrusTestCase.java
@@ -44,17 +44,14 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.intro.IIntroPart;
import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.part.IntroPart;
import org.eclipse.uml2.uml.Element;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
-
/**
* The Class AbstractPapyrusTestCase.
*/
-@SuppressWarnings("deprecation")
public abstract class AbstractPapyrusTestCase extends TestCase {
protected boolean operationFailed = false;
@@ -119,8 +116,8 @@ public abstract class AbstractPapyrusTestCase extends TestCase {
/** The diagram editor. */
protected UmlGmfDiagramEditor diagramEditor = null;
- /** The clazzdiagramedit part. */
- protected DiagramEditPart clazzdiagrameditPart;
+ /** The diagram edit part. */
+ protected DiagramEditPart diagramEditPart;
/**
* @see junit.framework.TestCase#setUp()
@@ -168,20 +165,17 @@ public abstract class AbstractPapyrusTestCase extends TestCase {
//diResourceSet.save( new NullProgressMonitor());
//diagramEditor.close(true);
papyrusEditor = null;
- clazzdiagrameditPart = null;
+ diagramEditPart = null;
diagramEditor = null;
page.closeAllEditors(true);
project.delete(true, new NullProgressMonitor());
-
setResult(true);
} catch (Exception ex) {
ex.printStackTrace(System.out);
setResult(false);
}
}
-
};
-
Display.getDefault().syncExec(runnable);
if(!runnable.getResult()) {
fail("Cannot close the editor and delete the project");
@@ -194,29 +188,38 @@ public abstract class AbstractPapyrusTestCase extends TestCase {
* @return the diagram edit part
*/
protected DiagramEditPart getDiagramEditPart() {
- if(clazzdiagrameditPart == null) {
+ if(diagramEditPart == null) {
diagramEditor = (UmlGmfDiagramEditor)papyrusEditor.getActiveEditor();
- clazzdiagrameditPart = (DiagramEditPart)papyrusEditor.getAdapter(DiagramEditPart.class);
+ diagramEditPart = (DiagramEditPart)papyrusEditor.getAdapter(DiagramEditPart.class);
Assert.assertNotNull("Cannot find the diagram editor", diagramEditor);
- Assert.assertNotNull("Cannot find the Diagram edit part", clazzdiagrameditPart);
+ Assert.assertNotNull("Cannot find the Diagram edit part", diagramEditPart);
}
- return clazzdiagrameditPart;
+ return diagramEditPart;
}
protected abstract ICreationCommand getDiagramCommandCreation();
/**
+ * Returns the Project
+ */
+ protected abstract String getProjectName();
+
+ /**
+ * Returns the File
+ */
+ protected abstract String getFileName();
+
+ /**
* Project creation.
*/
protected void projectCreation() {
-
// assert the intro is not visible
Runnable closeIntroRunnable = new Runnable() {
public void run() {
try {
IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager().getIntro();
- if(introPart!=null) {
+ if(introPart != null) {
PlatformUI.getWorkbench().getIntroManager().closeIntro(introPart);
}
} catch (Exception ex) {
@@ -225,16 +228,18 @@ public abstract class AbstractPapyrusTestCase extends TestCase {
}
}
};
-
Display.getDefault().syncExec(closeIntroRunnable);
-
-
IWorkspace workspace = ResourcesPlugin.getWorkspace();
root = workspace.getRoot();
- project = root.getProject("ClazzDiagramTestProject");
- file = project.getFile("ClazzDiagramTest.di");
+ /*
+ * final String timestamp = Long.toString(System.currentTimeMillis());
+ *
+ * project = root.getProject("DiagramTestProject_" + timestamp);
+ * file = project.getFile("DiagramTest_" + timestamp + ".di"); //$NON-NLS-2$
+ */
+ project = root.getProject(getProjectName());
+ file = project.getFile(getFileName()); //$NON-NLS-2$
this.diResourceSet = new DiResourceSet();
-
//at this point, no resources have been created
try {
if(!project.exists()) {
@@ -243,11 +248,9 @@ public abstract class AbstractPapyrusTestCase extends TestCase {
if(!project.isOpen()) {
project.open(null);
}
-
if(file.exists()) {
file.delete(true, new NullProgressMonitor());
}
-
if(!file.exists()) {
file.create(new ByteArrayInputStream(new byte[0]), true, new NullProgressMonitor());
diResourceSet.createsModels(file);
@@ -264,7 +267,6 @@ public abstract class AbstractPapyrusTestCase extends TestCase {
command.createDiagram(diResourceSet, null, "DiagramToTest");
diResourceSet.save(new NullProgressMonitor());
}
-
Runnable runnable = new Runnable() {
public void run() {
@@ -277,7 +279,6 @@ public abstract class AbstractPapyrusTestCase extends TestCase {
}
}
};
-
Display.getDefault().syncExec(runnable);
Assert.assertNotNull("Failed to open the editor", papyrusEditor);
} catch (Exception e) {
@@ -285,7 +286,7 @@ public abstract class AbstractPapyrusTestCase extends TestCase {
fail("Project creation failed: " + e.getMessage());
}
}
-
+
/** Call {@link AbstractPapyrusTestCase#execute(Command) execute} on the UI thread. */
protected void executeOnUIThread(final Command command) {
Display.getDefault().syncExec(new Runnable() {
@@ -315,14 +316,11 @@ public abstract class AbstractPapyrusTestCase extends TestCase {
}
});
}
-
+
protected void assertLastOperationSuccessful() {
- assertFalse(
- "The operation failed. Look at the log, or put a breakpoint on ExecutionException or DefaultOperationHistory#notifyNotOK to find the cause.",
- this.operationFailed);
+ assertFalse("The operation failed. Look at the log, or put a breakpoint on ExecutionException or DefaultOperationHistory#notifyNotOK to find the cause.", this.operationFailed);
}
-
-
+
/**
* Reset the "operation failed" state. Call this before executing each operation for which you want to test whether
* if failed with {@link AbstractPapyrusTestCase#assertLastOperationSuccessful()}.
@@ -330,7 +328,7 @@ public abstract class AbstractPapyrusTestCase extends TestCase {
protected void resetLastOperationFailedState() {
this.operationFailed = false;
}
-
+
/** Execute the given command in the diagram editor. */
protected void execute(final Command command) {
resetLastOperationFailedState();
@@ -361,6 +359,4 @@ public abstract class AbstractPapyrusTestCase extends TestCase {
// not "diagramEditor.getDiagramEditDomain().getDiagramCommandStack()" because it messes up undo contexts
return this.diagramEditor.getEditingDomain().getCommandStack();
}
-
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestMultiLink.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestMultiLink.java
index e06d2af2b3b..72241584500 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestMultiLink.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestMultiLink.java
@@ -43,8 +43,6 @@ import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Relationship;
import org.junit.Before;
-
-
/**
* The Class MultiLink.
*/
@@ -126,7 +124,6 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
//DELETION OF THE VIEW
//DELETION OF ALL THE VIEW
assertTrue(VIEW_DELETION + INITIALIZATION_TEST, linkNode != null);
-
Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
Command command = linkNode.getCommand(deleteViewRequest);
assertNotNull(VIEW_DELETION + COMMAND_NULL, command);
@@ -135,37 +132,27 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, getDiagramEditPart().getChildren().size() == 5);
assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 0);
-
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
assertTrue(VIEW_DELETION + TEST_THE_UNDO, getDiagramEditPart().getChildren().size() == 6);
assertTrue(VIEW_DELETION + TEST_THE_UNDO, ((Diagram)getRootView()).getEdges().size() == 4);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
assertTrue(VIEW_DELETION + TEST_THE_REDO, getDiagramEditPart().getChildren().size() == 5);
assertTrue(VIEW_DELETION + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 0);
-
-
-
}
public static Point getIntersectionPoint(ConnectionEditPart connEP, boolean source) {
-
ConnectionAnchor sourceAnchor;
ConnectionAnchor targetAnchor;
-
NodeEditPart sourceEP = (NodeEditPart)connEP.getSource();
NodeEditPart targetEP = (NodeEditPart)connEP.getTarget();
-
Point endLocation;
-
sourceAnchor = sourceEP.getSourceConnectionAnchor(connEP);
targetAnchor = targetEP.getTargetConnectionAnchor(connEP);
-
if(source) {
endLocation = sourceAnchor.getLocation(targetAnchor.getReferencePoint()).getCopy();
} else {
endLocation = targetAnchor.getLocation(sourceAnchor.getReferencePoint()).getCopy();
}
-
return endLocation;
}
@@ -178,7 +165,6 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
public void testDestroy(IElementType type) {
//DESTROY SEMANTIC+ VIEW
assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 6);
-
Request deleteViewRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
Command command = linkNode.getCommand(deleteViewRequest);
assertNotNull(DESTROY_DELETION + COMMAND_NULL, command);
@@ -187,8 +173,6 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().execute(command);
assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, getDiagramEditPart().getChildren().size() == 5);
assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 0);
-
-
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
assertTrue(DESTROY_DELETION + TEST_THE_UNDO, getDiagramEditPart().getChildren().size() == 6);
assertTrue(DESTROY_DELETION + TEST_THE_UNDO, ((Diagram)getRootView()).getEdges().size() == 4);
@@ -197,7 +181,6 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
assertTrue(DESTROY_DELETION + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 0);
}
-
/**
* Test drop.
*
@@ -212,8 +195,6 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
assertTrue(DROP + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 0);
assertTrue(DROP + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().get(5) instanceof Relationship);
Relationship relationship = (Relationship)getRootSemanticModel().getOwnedElements().get(5);
-
-
//DO
DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
ArrayList<Element> list = new ArrayList<Element>();
@@ -227,12 +208,10 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
assertTrue(DROP + TEST_THE_EXECUTION, getDiagramEditPart().getChildren().size() == 6);
assertTrue(DROP + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 4);
-
//UNDO
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
assertTrue(DROP + TEST_THE_UNDO, getDiagramEditPart().getChildren().size() == 5);
assertTrue(DROP + TEST_THE_UNDO, ((Diagram)getRootView()).getEdges().size() == 0);
-
//REDO
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
assertTrue(DROP + TEST_THE_REDO, getDiagramEditPart().getChildren().size() == 6);
@@ -240,8 +219,6 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
assertTrue(DROP + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 4);
}
-
-
/**
* Test to create a node.
*
@@ -252,8 +229,6 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
*
*/
public void testToCreateAMultiLink(IElementType branchType, boolean flow) {
-
-
//test to create the branch for dependency to node
Command cmd = target.getCommand(createConnectionViewRequest(branchType, binaryLink, thirdPlayer));
assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, cmd.canExecute() == true);
@@ -261,48 +236,37 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
// EditorUtils.getTransactionalEditingDomain().getCommandStack().execute(cmd);
assertTrue(CREATION + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 3);
assertTrue(CREATION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 6);
-
//Undo
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().undo();
assertTrue(CREATION + TEST_THE_UNDO, ((Diagram)getRootView()).getEdges().size() == 1);
assertTrue(CREATION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 6);
-
-
//redo
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().redo();
assertTrue(CREATION + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 3);
assertTrue(CREATION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 6);
assertTrue(CREATION + TEST_THE_REDO, getDiagramEditPart().getChildren().get(5) != null);
linkNode = (ShapeNodeEditPart)getDiagramEditPart().getChildren().get(5);
-
//test to create the branch from node to multidependency
if(flow) {
cmd = linkNode.getCommand(createConnectionViewRequest(branchType, fourthPlayer, linkNode));
-
} else {//test to create the branch from multidependency to node
cmd = linkNode.getCommand(createConnectionViewRequest(branchType, linkNode, fourthPlayer));
}
-
assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, cmd.canExecute() == true);
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().execute(cmd);
assertTrue(CREATION + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 4);
assertTrue(CREATION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 6);
-
//undo
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().undo();
assertTrue(CREATION + TEST_THE_UNDO, ((Diagram)getRootView()).getEdges().size() == 3);
assertTrue(CREATION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 6);
-
//redo
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().redo();
assertTrue(CREATION + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 4);
assertTrue(CREATION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 6);
}
-
-
public void testTargetReconnectAMultiLink(IElementType type) {
-
//target reconnection
ReconnectRequest reconnectRequest = new ReconnectRequest();
assertTrue(THE_BRANCH_TO_RECONNECT_EXISTS, (ConnectionEditPart)target.getTargetConnections().get(0) != null);
@@ -310,31 +274,23 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
reconnectRequest.setConnectionEditPart(branch);
reconnectRequest.setTargetEditPart(guestPlayer);
reconnectRequest.setType(RequestConstants.REQ_RECONNECT_TARGET);
-
Command cmd = guestPlayer.getCommand(reconnectRequest);
-
assertTrue(RECONNECTION_TARGET + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, cmd.canExecute() == true);
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().execute(cmd);
// EditorUtils.getTransactionalEditingDomain().getCommandStack().execute(cmd);
assertTrue(RECONNECTION_TARGET + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 4);
assertTrue(RECONNECTION_TARGET + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 6);
assertTrue(BRANCH_EXISTS_RECONNECTION_ON_TARGET, branch.getTarget().equals(guestPlayer));
-
//undo
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().undo();
assertTrue(BRANCH_EXISTS_RECONNECTION_ON_TARGET + TEST_THE_UNDO, branch.getTarget().equals(target));
-
//redo
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().redo();
assertTrue(BRANCH_EXISTS_RECONNECTION_ON_TARGET + TEST_THE_REDO, branch.getTarget().equals(guestPlayer));
-
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().undo();
-
-
}
public void testSourceReconnectAMultiLink(IElementType type) {
-
//target reconnection
ReconnectRequest reconnectRequest = new ReconnectRequest();
assertTrue(THE_BRANCH_TO_RECONNECT_EXISTS, (ConnectionEditPart)source.getSourceConnections().get(0) != null);
@@ -342,32 +298,25 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
reconnectRequest.setConnectionEditPart(branch);
reconnectRequest.setTargetEditPart(guestPlayer);
reconnectRequest.setType(RequestConstants.REQ_RECONNECT_SOURCE);
-
Command cmd = guestPlayer.getCommand(reconnectRequest);
-
assertTrue(RECONNECTION_SOURCE + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, cmd.canExecute() == true);
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().execute(cmd);
assertTrue(RECONNECTION_SOURCE + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 4);
assertTrue(RECONNECTION_SOURCE + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 6);
assertTrue(BRANCH_EXISTS_RECONNECTION_ON_SOURCE + TEST_THE_EXECUTION, branch.getSource().equals(guestPlayer));
-
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().undo();
assertTrue(BRANCH_EXISTS_RECONNECTION_ON_SOURCE + TEST_THE_UNDO, branch.getSource().equals(source));
-
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().redo();
assertTrue(BRANCH_EXISTS_RECONNECTION_ON_SOURCE + TEST_THE_REDO, branch.getSource().equals(guestPlayer));
-
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().undo();
}
public CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target) {
CreateConnectionViewRequest connectionRequest = CreateViewRequestFactory.getCreateConnectionRequest(type, ((IGraphicalEditPart)getDiagramEditPart()).getDiagramPreferencesHint());
-
connectionRequest.setSourceEditPart(null);
connectionRequest.setTargetEditPart(source);
connectionRequest.setType(RequestConstants.REQ_CONNECTION_START);
source.getCommand(connectionRequest);
-
// Now, setup the request in preparation to get the
// connection end
// command.
@@ -377,7 +326,6 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
return connectionRequest;
}
-
protected abstract CreateViewRequest createViewRequestShapeContainer();
/**
@@ -389,7 +337,6 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
-
CreateViewRequest requestcreation = createViewRequestShapeContainer();
//1st node
requestcreation.setLocation(new Point(10, 10));
@@ -399,8 +346,6 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 1);
-
-
requestcreation.setLocation(new Point(400, 10));
//2d node
command = getDiagramEditPart().getCommand(requestcreation);
@@ -409,7 +354,6 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 2);
-
requestcreation.setLocation(new Point(200, 200));
//3d node
command = getDiagramEditPart().getCommand(requestcreation);
@@ -421,7 +365,6 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
source = (GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
target = (GraphicalEditPart)getDiagramEditPart().getChildren().get(1);
thirdPlayer = (GraphicalEditPart)getDiagramEditPart().getChildren().get(2);
-
//4d node
requestcreation.setLocation(new Point(400, 400));
command = getDiagramEditPart().getCommand(requestcreation);
@@ -440,24 +383,16 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 5);
guestPlayer = (GraphicalEditPart)getDiagramEditPart().getChildren().get(4);
-
-
-
-
-
}
public void installbinaryLink(IElementType type) {
//binaryLink
Command command = target.getCommand(createConnectionViewRequest(type, source, target));
-
assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 1);
assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 6);
-
binaryLink = (ConnectionEditPart)source.getSourceConnections().get(0);
-
}
/**
@@ -465,7 +400,6 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
*
* @return
*/
-
@Override
protected View getRootView() {
return (View)getDiagramEditPart().getModel();
@@ -491,10 +425,7 @@ public abstract class AbstractTestMultiLink extends AbstractPapyrusTestCase {
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
assertTrue(CREATION + TEST_THE_UNDO, getDiagramEditPart().getChildren().get(5) instanceof ShapeNodeEditPart);
linkNode = (ShapeNodeEditPart)getDiagramEditPart().getChildren().get(5);
-
testViewDeletion(branchType);
testDrop(branchType);
}
-
-
}
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 4ae6f3fe57e..21468d19e18 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
@@ -14,7 +14,6 @@ package org.eclipse.papyrus.diagram.tests.canonical;
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;
@@ -39,18 +38,17 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Element;
import org.junit.Before;
-
/**
- * Abstract class to test nodes
+ * Abstract class to test nodes
*/
-public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests.canonical.AbstractPapyrusTestCase{
-
+public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests.canonical.AbstractPapyrusTestCase {
+
/** <code>true</code> if semantic tests should be run on graphical manipulation */
private boolean testSemantic;
/** command computed on the ui thread */
protected Command command;
-
+
/**
* @see org.eclipse.papyrus.diagram.clazz.test.canonical.AbstractPapyrusTestCase#setUp()
*
@@ -77,14 +75,13 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
*
* @return
*/
-
protected abstract View getRootView();
/**
- * Returns the container edit part
+ * Returns the container edit part
*/
protected abstract IGraphicalEditPart getContainerEditPart();
-
+
/**
* Test to manage child node.
*
@@ -104,7 +101,6 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
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
@@ -114,7 +110,7 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
testChangeContainer(type, containerType);
}
}
-
+
/**
* Test to manage child node.
*
@@ -134,7 +130,6 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
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
@@ -144,8 +139,7 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
testChangeContainer(type, containerType);
}
}
-
-
+
/**
* Test to manage child node.
*
@@ -153,7 +147,7 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
* the type
* @param containerType
* the container type
- * @deprecated, @use {@link AbstractTestNode#testToManageNode(IElementType, EClass, IElementType, boolean)}
+ * @deprecated, @use {@link AbstractTestNode#testToManageNode(IElementType, EClass, IElementType, boolean)}
*/
@Deprecated
public void testToManageChildNode(IElementType type, EClass eClass, IElementType containerType, boolean containerMove) {
@@ -182,7 +176,6 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
if(testSemantic) {
assertEquals(DESTROY_DELETION + INITIALIZATION_TEST, expectedSemanticChildren, getRootSemanticModel().getOwnedElements().size());
}
-
Request deleteViewRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
Command command = ((GraphicalEditPart)getContainerEditPart().getChildren().get(0)).getCommand(deleteViewRequest);
assertNotNull(DESTROY_DELETION + COMMAND_NULL, command);
@@ -193,13 +186,11 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
if(testSemantic) {
assertEquals(DESTROY_DELETION + INITIALIZATION_TEST, expectedSemanticChildren - removedSemanticChildren, getRootSemanticModel().getOwnedElements().size());
}
-
undoOnUIThread();
assertEquals(DESTROY_DELETION + TEST_THE_UNDO, expectedGraphicalChildren, getContainerEditPart().getChildren().size());
if(testSemantic) {
assertEquals(DESTROY_DELETION + TEST_THE_UNDO, expectedSemanticChildren, getRootSemanticModel().getOwnedElements().size());
}
-
redoOnUIThread();
assertEquals(DESTROY_DELETION + TEST_THE_REDO, expectedGraphicalChildren - removedGraphicalChildren, getContainerEditPart().getChildren().size());
if(testSemantic) {
@@ -219,7 +210,6 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
if(testSemantic) {
assertEquals(DROP + INITIALIZATION_TEST, 1, getRootSemanticModel().getOwnedElements().size());
}
-
DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
ArrayList<Element> list = new ArrayList<Element>();
for(Element element : getRootSemanticModel().getOwnedElements()) {
@@ -233,17 +223,14 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
assertNotNull(DROP + COMMAND_NULL, command);
assertTrue(DROP + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
assertTrue(DROP + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute());
-
// execute the drop
executeOnUIThread(command);
assertTrue(DROP + TEST_THE_EXECUTION, getContainerEditPart().getChildren().size() != 0);
assertTrue(DROP + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() != 0);
-
// undo the drop
undoOnUIThread();
assertEquals(DROP + TEST_THE_UNDO, 0, getContainerEditPart().getChildren().size());
assertTrue(DROP + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() != 0);
-
// redo the drop
redoOnUIThread();
assertTrue(DROP + TEST_THE_REDO, getContainerEditPart().getChildren().size() != 0);
@@ -262,12 +249,10 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
//CHANGE CONTAINER
assertEquals(CHANGE_CONTAINER + INITIALIZATION_TEST, 1, getContainerEditPart().getChildren().size());
assertEquals(CHANGE_CONTAINER + INITIALIZATION_TEST, 1, getRootSemanticModel().getOwnedElements().size());
-
final Request requestcreation = CreateViewRequestFactory.getCreateShapeRequest(containerType, getContainerEditPart().getDiagramPreferencesHint());
-
command = null;
- Display.getDefault().syncExec( new Runnable() {
-
+ Display.getDefault().syncExec(new Runnable() {
+
public void run() {
command = getContainerEditPart().getCommand(requestcreation);
}
@@ -290,30 +275,25 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
index++;
}
assertTrue("Container not found", compartment != null);
-
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());
-
// execute change container
executeOnUIThread(command);
assertEquals(CHANGE_CONTAINER + TEST_THE_EXECUTION, 1, getRootView().getChildren().size());
assertEquals(CHANGE_CONTAINER + TEST_THE_EXECUTION, 1, getRootSemanticModel().getOwnedElements().size());
assertEquals(CHANGE_CONTAINER + TEST_THE_EXECUTION, 1, compartment.getChildren().size());
-
// undo change container
undoOnUIThread();
assertEquals(CHANGE_CONTAINER + TEST_THE_UNDO, 2, getRootView().getChildren().size());
assertEquals(CHANGE_CONTAINER + TEST_THE_UNDO, 2, getRootSemanticModel().getOwnedElements().size());
assertEquals(CHANGE_CONTAINER + TEST_THE_EXECUTION, 0, compartment.getChildren().size());
-
// redo change container
redoOnUIThread();
assertEquals(CHANGE_CONTAINER + TEST_THE_REDO, 1, getRootView().getChildren().size());
assertEquals(CHANGE_CONTAINER + TEST_THE_REDO, 1, getRootSemanticModel().getOwnedElements().size());
assertEquals(CHANGE_CONTAINER + TEST_THE_EXECUTION, 1, compartment.getChildren().size());
-
}
/**
@@ -327,38 +307,34 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
//CREATION
assertEquals(CREATION + INITIALIZATION_TEST, expectedGraphicalChildren, getContainerEditPart().getChildren().size());
assertEquals(CREATION + INITIALIZATION_TEST, expectedSemanticChildren, getRootSemanticModel().getOwnedElements().size());
-
final CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getContainerEditPart().getDiagramPreferencesHint());
Display.getDefault().syncExec(new Runnable() {
+
public void run() {
- command = getContainerEditPart().getCommand(requestcreation);
+ command = getContainerEditPart().getCommand(requestcreation);
}
});
assertNotNull(CREATION + COMMAND_NULL, command);
assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute());
-
// execute the creation
executeOnUIThread(command);
assertEquals(CREATION + TEST_THE_EXECUTION, expectedGraphicalChildren + addedGraphicalChildren, getRootView().getChildren().size());
if(testSemantic) {
assertEquals(CREATION + TEST_THE_EXECUTION, expectedSemanticChildren + addedSemanticChildren, getRootSemanticModel().getOwnedElements().size());
}
-
// undo the creation
undoOnUIThread();
assertEquals(CREATION + TEST_THE_UNDO, expectedGraphicalChildren, getRootView().getChildren().size());
if(testSemantic) {
assertEquals(CREATION + TEST_THE_UNDO, expectedSemanticChildren, getRootSemanticModel().getOwnedElements().size());
}
-
// redo the creation test
redoOnUIThread();
assertEquals(CREATION + TEST_THE_REDO, expectedGraphicalChildren + addedGraphicalChildren, getRootView().getChildren().size());
if(testSemantic) {
assertEquals(CREATION + TEST_THE_REDO, expectedSemanticChildren + addedSemanticChildren, getRootSemanticModel().getOwnedElements().size());
}
-
}
/**
@@ -381,36 +357,30 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
//DELETION OF THE VIEW
assertEquals(VIEW_DELETION + INITIALIZATION_TEST, 1, getContainerEditPart().getChildren().size());
if(testSemantic) {
-
}
-
Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
Command command = ((IGraphicalEditPart)getContainerEditPart().getChildren().get(0)).getCommand(deleteViewRequest);
assertNotNull(VIEW_DELETION + COMMAND_NULL, command);
assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute());
-
// execute hide the view
executeOnUIThread(command);
assertEquals(VIEW_DELETION + TEST_THE_EXECUTION, 0, getContainerEditPart().getChildren().size());
if(testSemantic) {
//assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == numberOfRelatedSemanticElement);
}
-
// undo hide the view
undoOnUIThread();
assertEquals(VIEW_DELETION + TEST_THE_UNDO, 1, getContainerEditPart().getChildren().size());
if(testSemantic) {
//assertTrue(VIEW_DELETION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == numberOfRelatedSemanticElement);
}
-
// redo hide the view
redoOnUIThread();
assertEquals(VIEW_DELETION + TEST_THE_REDO, 0, getContainerEditPart().getChildren().size());
if(testSemantic) {
//assertTrue(VIEW_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == numberOfRelatedSemanticElement);
}
-
}
protected abstract CreateViewRequest createViewRequestShapeContainer();
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestChildLabel.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestChildLabel.java
index 26f97a47dd0..ddd40a96f83 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestChildLabel.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestChildLabel.java
@@ -34,15 +34,12 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.uml2.uml.Element;
-
-
// TODO: Auto-generated Javadoc
/**
* The Class TestChildLabel.
*/
public abstract class TestChildLabel extends org.eclipse.papyrus.diagram.tests.canonical.AbstractPapyrusTestCase {
-
/** The Constant CREATION. */
protected static final String CREATION = "CREATION:";
@@ -88,240 +85,231 @@ public abstract class TestChildLabel extends org.eclipse.papyrus.diagram.tests.c
/**
* Test view deletion.
*
- * @param type the type
- * @param containerType the container type
+ * @param type
+ * the type
+ * @param containerType
+ * the container type
*/
- public void testViewDeletion(IElementType type,int containerType) {
-
- ListCompartmentEditPart compartment=null;
- int index=0;
- while (compartment==null && index <getTopEditPart().getChildren().size()){
- if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart&& (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals(""+containerType))){
- compartment= (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
+ public void testViewDeletion(IElementType type, int containerType) {
+ ListCompartmentEditPart compartment = null;
+ int index = 0;
+ while(compartment == null && index < getTopEditPart().getChildren().size()) {
+ if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart && (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals("" + containerType))) {
+ compartment = (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
}
index++;
}
- assertTrue("Container not found", compartment!=null);
+ assertTrue("Container not found", compartment != null);
//DELETION OF THE VIEW
- assertTrue(VIEW_DELETION +INITIALIZATION_TEST,compartment.getChildren().size()==1);
- assertTrue(VIEW_DELETION +INITIALIZATION_TEST,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==1);
-
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, compartment.getChildren().size() == 1);
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == 1);
Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
Command command = ((GraphicalEditPart)compartment.getChildren().get(0)).getCommand(deleteViewRequest);
- assertNotNull(VIEW_DELETION +COMMAND_NULL,command);
- assertTrue(VIEW_DELETION +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(VIEW_DELETION +TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ assertNotNull(VIEW_DELETION + COMMAND_NULL, command);
+ assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(VIEW_DELETION +TEST_THE_EXECUTION,compartment.getChildren().size()==0);
- assertTrue(VIEW_DELETION +TEST_THE_EXECUTION,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==1);
-
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, compartment.getChildren().size() == 0);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(VIEW_DELETION +TEST_THE_UNDO,compartment.getChildren().size()==1);
- assertTrue(VIEW_DELETION +TEST_THE_UNDO,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==1);
-
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, compartment.getChildren().size() == 1);
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(VIEW_DELETION +TEST_THE_REDO,compartment.getChildren().size()==0);
- assertTrue(VIEW_DELETION +TEST_THE_REDO,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==1);
-
-
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, compartment.getChildren().size() == 0);
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == 1);
}
/**
* Test destroy.
*
- * @param type the type
- * @param containerType the container type
+ * @param type
+ * the type
+ * @param containerType
+ * the container type
*/
- public void testDestroy(IElementType type,int containerType) {
- ListCompartmentEditPart compartment=null;
- int index=0;
- while (compartment==null && index <getTopEditPart().getChildren().size()){
- if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart&& (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals(""+containerType))){
- compartment= (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
+ public void testDestroy(IElementType type, int containerType) {
+ ListCompartmentEditPart compartment = null;
+ int index = 0;
+ while(compartment == null && index < getTopEditPart().getChildren().size()) {
+ if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart && (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals("" + containerType))) {
+ compartment = (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
}
index++;
}
- assertTrue("Container not found", compartment!=null);
+ assertTrue("Container not found", compartment != null);
//DESTROY SEMANTIC+ VIEW
- assertTrue(DESTROY_DELETION +INITIALIZATION_TEST,compartment.getChildren().size()==1);
- assertTrue(DESTROY_DELETION +INITIALIZATION_TEST,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==1);
-
- Request deleteViewRequest = new EditCommandRequestWrapper( new DestroyElementRequest(false));
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, compartment.getChildren().size() == 1);
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == 1);
+ Request deleteViewRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
Command command = ((GraphicalEditPart)compartment.getChildren().get(0)).getCommand(deleteViewRequest);
- assertNotNull(DESTROY_DELETION +COMMAND_NULL,command);
- assertTrue(DESTROY_DELETION +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(DESTROY_DELETION+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ assertNotNull(DESTROY_DELETION + COMMAND_NULL, command);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(DESTROY_DELETION +TEST_THE_EXECUTION,compartment.getChildren().size()==0);
- assertTrue(DESTROY_DELETION +TEST_THE_EXECUTION,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==0);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, compartment.getChildren().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
//assertTrue(DESTROY_DELETION +TEST_THE_UNDO,compartment.getChildren().size()==1);
- assertTrue(DESTROY_DELETION +TEST_THE_UNDO,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==1);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(DESTROY_DELETION +TEST_THE_REDO,compartment.getChildren().size()==0);
- assertTrue(DESTROY_DELETION +TEST_THE_REDO,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==0);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, compartment.getChildren().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == 0);
}
-
/**
* Test drop.
*
- * @param type the type
- * @param containerType the container type
+ * @param type
+ * the type
+ * @param containerType
+ * the container type
*/
- public void testDrop(IElementType type,int containerType) {
- ListCompartmentEditPart compartment=null;
- int index=0;
- while (compartment==null && index <getTopEditPart().getChildren().size()){
- if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart&& (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals(""+containerType))){
- compartment= (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
+ public void testDrop(IElementType type, int containerType) {
+ ListCompartmentEditPart compartment = null;
+ int index = 0;
+ while(compartment == null && index < getTopEditPart().getChildren().size()) {
+ if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart && (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals("" + containerType))) {
+ compartment = (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
}
index++;
}
- assertTrue("Container not found", compartment!=null);
+ assertTrue("Container not found", compartment != null);
//DROP
- assertTrue(DROP +INITIALIZATION_TEST,compartment.getChildren().size()==0);
- assertTrue(DROP +INITIALIZATION_TEST,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==1);
-
-
- DropObjectsRequest dropObjectsRequest= new DropObjectsRequest();
+ assertTrue(DROP + INITIALIZATION_TEST, compartment.getChildren().size() == 0);
+ assertTrue(DROP + INITIALIZATION_TEST, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == 1);
+ DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
ArrayList<Element> list = new ArrayList<Element>();
list.add(getRootSemanticModel().getOwnedElements().get(0));
dropObjectsRequest.setObjects(list);
- dropObjectsRequest.setLocation(new Point(20,20));
- Command command= compartment.getCommand(dropObjectsRequest);
- assertNotNull(DROP+COMMAND_NULL,command);
- assertTrue(DROP +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(DROP+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ dropObjectsRequest.setLocation(new Point(20, 20));
+ Command command = compartment.getCommand(dropObjectsRequest);
+ assertNotNull(DROP + COMMAND_NULL, command);
+ assertTrue(DROP + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(DROP + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(DROP +TEST_THE_EXECUTION,compartment.getChildren().size()!=0);
- assertTrue(DROP +TEST_THE_EXECUTION,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()!=0);
+ assertTrue(DROP + TEST_THE_EXECUTION, compartment.getChildren().size() != 0);
+ assertTrue(DROP + TEST_THE_EXECUTION, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() != 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(DROP+TEST_THE_UNDO,compartment.getChildren().size()==0);
- assertTrue(DROP+TEST_THE_UNDO,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()!=0);
+ assertTrue(DROP + TEST_THE_UNDO, compartment.getChildren().size() == 0);
+ assertTrue(DROP + TEST_THE_UNDO, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() != 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(DROP+TEST_THE_REDO,compartment.getChildren().size()!=0);
- assertTrue(DROP+TEST_THE_REDO,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()!=0);
+ assertTrue(DROP + TEST_THE_REDO, compartment.getChildren().size() != 0);
+ assertTrue(DROP + TEST_THE_REDO, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() != 0);
}
-
/**
* Test change container.
*
- * @param topNodeType the top node type
- * @param type the type
- * @param containerType the container type
+ * @param topNodeType
+ * the top node type
+ * @param type
+ * the type
+ * @param containerType
+ * the container type
*/
- public void testChangeContainer(IElementType topNodeType,IElementType type, int containerType) {
- ListCompartmentEditPart compartment=null;
- int index=0;
- while (compartment==null && index <getTopEditPart().getChildren().size()){
- if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart&& (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals(""+containerType))){
- compartment= (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
+ public void testChangeContainer(IElementType topNodeType, IElementType type, int containerType) {
+ ListCompartmentEditPart compartment = null;
+ int index = 0;
+ while(compartment == null && index < getTopEditPart().getChildren().size()) {
+ if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart && (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals("" + containerType))) {
+ compartment = (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
}
index++;
}
- assertTrue("Container not found", compartment!=null);
-
+ assertTrue("Container not found", compartment != null);
//CHANGE CONTAINER
- assertTrue(CHANGE_CONTAINER +INITIALIZATION_TEST,compartment.getChildren().size()==1);
- assertTrue(CHANGE_CONTAINER +INITIALIZATION_TEST,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==1);
-
-
- Request requestcreation=CreateViewRequestFactory.getCreateShapeRequest(topNodeType, getDiagramEditPart().getDiagramPreferencesHint());
- Command command=getDiagramEditPart().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);
+ assertTrue(CHANGE_CONTAINER + INITIALIZATION_TEST, compartment.getChildren().size() == 1);
+ assertTrue(CHANGE_CONTAINER + INITIALIZATION_TEST, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == 1);
+ Request requestcreation = CreateViewRequestFactory.getCreateShapeRequest(topNodeType, getDiagramEditPart().getDiagramPreferencesHint());
+ Command command = getDiagramEditPart().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);
- assertTrue(CONTAINER_CREATION+TEST_THE_EXECUTION,getRootView().getChildren().size()==2);
- GraphicalEditPart newContainerEditPart= (GraphicalEditPart)getDiagramEditPart().getChildren().get(1);
+ assertTrue(CONTAINER_CREATION + TEST_THE_EXECUTION, getRootView().getChildren().size() == 2);
+ GraphicalEditPart newContainerEditPart = (GraphicalEditPart)getDiagramEditPart().getChildren().get(1);
ChangeBoundsRequest changeBoundsRequest = new ChangeBoundsRequest(RequestConstants.REQ_ADD);
changeBoundsRequest.setEditParts((EditPart)compartment.getChildren().get(0));
- changeBoundsRequest.setLocation(new Point(30,30));
- ListCompartmentEditPart newCompartment=null;
- index=0;
- while (newCompartment==null && index <newContainerEditPart.getChildren().size()){
- if((newContainerEditPart.getChildren().get(index)) instanceof ListCompartmentEditPart&& (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals(""+containerType))){
- newCompartment= (ListCompartmentEditPart)(newContainerEditPart.getChildren().get(index));
+ changeBoundsRequest.setLocation(new Point(30, 30));
+ ListCompartmentEditPart newCompartment = null;
+ index = 0;
+ while(newCompartment == null && index < newContainerEditPart.getChildren().size()) {
+ if((newContainerEditPart.getChildren().get(index)) instanceof ListCompartmentEditPart && (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals("" + containerType))) {
+ newCompartment = (ListCompartmentEditPart)(newContainerEditPart.getChildren().get(index));
}
index++;
}
- assertTrue("NewContainer not found", newCompartment!=null);
-
-
- command=newCompartment.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);
+ assertTrue("NewContainer not found", newCompartment != null);
+ command = newCompartment.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);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,compartment.getChildren().size()==0);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==0);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,newCompartment.getChildren().size()==1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, compartment.getChildren().size() == 0);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == 0);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, newCompartment.getChildren().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(CHANGE_CONTAINER+TEST_THE_UNDO,compartment.getChildren().size()==1);
- assertTrue(CHANGE_CONTAINER+TEST_THE_UNDO,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==1);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,newCompartment.getChildren().size()==0);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_UNDO, compartment.getChildren().size() == 1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_UNDO, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == 1);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, newCompartment.getChildren().size() == 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(CHANGE_CONTAINER+TEST_THE_REDO,compartment.getChildren().size()==0);
- assertTrue(CHANGE_CONTAINER+TEST_THE_REDO,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==0);
- assertTrue(CHANGE_CONTAINER+TEST_THE_EXECUTION,newCompartment.getChildren().size()==1);
-
+ assertTrue(CHANGE_CONTAINER + TEST_THE_REDO, compartment.getChildren().size() == 0);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_REDO, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == 0);
+ assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, newCompartment.getChildren().size() == 1);
}
/**
* Test to create a node.
*
- * @param type the type
- * @param containerType the container type
+ * @param type
+ * the type
+ * @param containerType
+ * the container type
*/
- public void testToCreateANode(IElementType type,int containerType) {
- ListCompartmentEditPart compartment=null;
- int index=0;
- while (compartment==null && index <getTopEditPart().getChildren().size()){
- if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart&& (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals(""+containerType))){
- compartment= (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
+ public void testToCreateANode(IElementType type, int containerType) {
+ ListCompartmentEditPart compartment = null;
+ int index = 0;
+ while(compartment == null && index < getTopEditPart().getChildren().size()) {
+ if((getTopEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart && (((View)((ListCompartmentEditPart)(getTopEditPart().getChildren().get(index))).getModel()).getType().equals("" + containerType))) {
+ compartment = (ListCompartmentEditPart)(getTopEditPart().getChildren().get(index));
}
index++;
}
- assertTrue("Container not found", compartment!=null);
+ assertTrue("Container not found", compartment != null);
//CREATION
- assertTrue(CREATION +INITIALIZATION_TEST,compartment.getChildren().size()==0);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==0);
-
- CreateViewRequest requestcreation=CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
- Command command=compartment.getCommand(requestcreation);
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue("CREATION: "+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ assertTrue(CREATION + INITIALIZATION_TEST, compartment.getChildren().size() == 0);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 0);
+ CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
+ Command command = compartment.getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CREATION+TEST_THE_EXECUTION,compartment.getChildren().size()==1);
+ assertTrue(CREATION + TEST_THE_EXECUTION, compartment.getChildren().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(CREATION+TEST_THE_UNDO,compartment.getChildren().size()==0);
- assertTrue(CREATION+TEST_THE_UNDO,((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size()==0);
+ assertTrue(CREATION + TEST_THE_UNDO, compartment.getChildren().size() == 0);
+ assertTrue(CREATION + TEST_THE_UNDO, ((Element)((View)getTopEditPart().getModel()).getElement()).getOwnedElements().size() == 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue("CREATION: "+TEST_THE_REDO,compartment.getChildren().size()==1);
-
+ assertTrue("CREATION: " + TEST_THE_REDO, compartment.getChildren().size() == 1);
}
/**
* Test to create a top node.
*
- * @param type the type
+ * @param type
+ * the type
*/
public void testToCreateATopNode(IElementType type) {
-
//CREATION
- assertTrue(CREATION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==0);
- assertTrue(CREATION +INITIALIZATION_TEST,((Element)((View)getDiagramEditPart().getModel()).getElement()).getOwnedElements().size()==0);
-
- CreateViewRequest requestcreation=CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
- Command command=getDiagramEditPart().getCommand(requestcreation);
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 0);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Element)((View)getDiagramEditPart().getModel()).getElement()).getOwnedElements().size() == 0);
+ CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
+ Command command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CREATION+TEST_THE_EXECUTION,getRootView().getChildren().size()==1);
+ assertTrue(CREATION + TEST_THE_EXECUTION, getRootView().getChildren().size() == 1);
topNode = (GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
}
@@ -330,16 +318,15 @@ public abstract class TestChildLabel extends org.eclipse.papyrus.diagram.tests.c
*
* @return the top edit part
*/
- public GraphicalEditPart getTopEditPart(){
+ public GraphicalEditPart getTopEditPart() {
return topNode;
}
/**
* @see org.eclipse.papyrus.diagram.clazz.test.canonical.AbstractPapyrusTestCase#getRootSemanticModel()
- *
+ *
* @return
*/
-
@Override
protected Element getRootSemanticModel() {
// TODO Auto-generated method stub
@@ -349,19 +336,20 @@ public abstract class TestChildLabel extends org.eclipse.papyrus.diagram.tests.c
/**
* Test to manage top node.
*
- * @param topNodeType the top node type
- * @param type the type
- * @param containerType the container type
+ * @param topNodeType
+ * the top node type
+ * @param type
+ * the type
+ * @param containerType
+ * the container type
*/
- public void testToManageTopNode(IElementType topNodeType,IElementType type, int containerType) {
+ public void testToManageTopNode(IElementType topNodeType, IElementType type, int containerType) {
testToCreateATopNode(topNodeType);
- testToCreateANode(type,containerType);
- testDestroy(type,containerType);
+ testToCreateANode(type, containerType);
+ testDestroy(type, containerType);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- testViewDeletion(type,containerType);
- testDrop(type,containerType);
- testChangeContainer(topNodeType,type, containerType);
+ testViewDeletion(type, containerType);
+ testDrop(type, containerType);
+ testChangeContainer(topNodeType, type, containerType);
}
-
-
}
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 35379eb743c..8d3d46265ce 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,16 +43,15 @@ public abstract class TestChildNode extends AbstractTestNode {
protected void setUp() throws Exception {
super.setUp();
CreateViewRequest requestcreation = createViewRequestShapeContainer();
- if(requestcreation !=null) {
+ 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);
+ executeOnUIThread(command);
}
assertEquals(CREATION + INITIALIZATION_TEST, 1, getDiagramEditPart().getChildren().size());
-
GraphicalEditPart containerEditPart = (GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
rootCompartment = null;
int index = 0;
@@ -62,11 +61,9 @@ public abstract class TestChildNode extends AbstractTestNode {
}
index++;
}
-
assertNotNull("There should be at least one container for the node tests", rootCompartment);
}
-
-
+
/**
* {@inheritDoc}
*/
@@ -74,13 +71,12 @@ public abstract class TestChildNode extends AbstractTestNode {
protected IGraphicalEditPart getContainerEditPart() {
return rootCompartment;
}
-
+
/**
* @see org.eclipse.papyrus.diagram.clazz.test.canonical.AbstractPapyrusTestCase#getRootView()
*
* @return
*/
-
@Override
protected View getRootView() {
return (View)rootCompartment.getModel();
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestCommentLink.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestCommentLink.java
new file mode 100644
index 00000000000..b7f81cbf1f3
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestCommentLink.java
@@ -0,0 +1,245 @@
+/*****************************************************************************
+ * 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:
+ * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
+ /*****************************************************************************/
+package org.eclipse.papyrus.diagram.tests.canonical;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.GroupRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
+import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.uml2.uml.Element;
+
+public abstract class TestCommentLink extends TestLink {
+
+ /**
+ * Test view deletion.
+ *
+ * @param type
+ * the type
+ */
+ @Override
+ public void testViewDeletion(IElementType type) {
+ //DELETION OF THE VIEW
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, source.getSourceConnections().size() == 1);
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);//1
+ Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
+ Command command = ((ConnectionEditPart)source.getSourceConnections().get(0)).getCommand(deleteViewRequest);
+ assertNotNull(VIEW_DELETION + COMMAND_NULL, command);
+ assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 0);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);//1
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, source.getSourceConnections().size() == 1);
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);//1
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, source.getSourceConnections().size() == 0);
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);//1
+ }
+
+ /**
+ * Test destroy.
+ *
+ * @param type
+ * the type
+ */
+ @Override
+ public void testDestroy(IElementType type) {
+ //DESTROY SEMANTIC+ VIEW
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, source.getSourceConnections().size() == 1);
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);//1
+ Request deleteViewRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
+ Command command = ((ConnectionEditPart)source.getSourceConnections().get(0)).getCommand(deleteViewRequest);
+ assertNotNull(DESTROY_DELETION + COMMAND_NULL, command);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, source.getSourceConnections().size() == 1);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);//1
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, source.getSourceConnections().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);
+ }
+
+ /**
+ * Test drop.
+ *
+ * @param type
+ * the type
+ */
+ @Override
+ public void testDrop(IElementType type) {
+ //DROP
+ //it is impossible to drop but you can recreat the link between this element
+ assertTrue(DROP + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DROP + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);//1
+ assertTrue(DROP + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 0);
+ }
+
+ /**
+ * Test to create a link.
+ *
+ * @param linkType
+ * the type
+ */
+ @Override
+ public void testToCreateALink(IElementType linkType) {
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);
+ Command command = target.getCommand(createConnectionViewRequest(linkType, source, target));
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ assertTrue(CREATION + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(CREATION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(CREATION + TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);//1
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(CREATION + TEST_THE_UNDO, getRootView().getChildren().size() == 4);
+ assertTrue(CREATION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(CREATION + TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(CREATION + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(CREATION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(CREATION + TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);//1
+ }
+
+ @Override
+ public void installEnvironment(IElementType sourceType, IElementType targetType) {
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 0);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 0);
+ //create the source
+ CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(sourceType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation.setLocation(new Point(100, 100));
+ Command command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ //create the source player to test reconnect
+ requestcreation = CreateViewRequestFactory.getCreateShapeRequest(sourceType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation.setLocation(new Point(100, 300));
+ command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ //create the target
+ requestcreation = CreateViewRequestFactory.getCreateShapeRequest(targetType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation.setLocation(new Point(300, 100));
+ command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ //create the target player to test reconnect
+ requestcreation = CreateViewRequestFactory.getCreateShapeRequest(targetType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation.setLocation(new Point(300, 300));
+ command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ source = (GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
+ sourcePlayer = (GraphicalEditPart)getDiagramEditPart().getChildren().get(1);
+ target = (GraphicalEditPart)getDiagramEditPart().getChildren().get(2);
+ targetPlayer = (GraphicalEditPart)getDiagramEditPart().getChildren().get(3);
+ }
+
+ @Override
+ public void testTargetReconnectAMultiLink(IElementType type) {
+ //target reconnection
+ ReconnectRequest reconnectRequest = new ReconnectRequest();
+ assertTrue(THE_LINK_RECONNECT_EXISTS, (ConnectionEditPart)target.getTargetConnections().get(0) != null);
+ ConnectionEditPart binaryLink = (ConnectionEditPart)target.getTargetConnections().get(0);
+ reconnectRequest.setConnectionEditPart(binaryLink);
+ reconnectRequest.setTargetEditPart(targetPlayer);
+ reconnectRequest.setType(RequestConstants.REQ_RECONNECT_TARGET);
+ Command cmd = targetPlayer.getCommand(reconnectRequest);
+ assertTrue(RECONNECTION_TARGET + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, cmd.canExecute() == true);
+ getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().execute(cmd);
+ // EditorUtils.getTransactionalEditingDomain().getCommandStack().execute(cmd);
+ assertTrue(RECONNECTION_TARGET + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(RECONNECTION_TARGET + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET, binaryLink.getTarget().equals(targetPlayer));
+ //undo
+ getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET + TEST_THE_UNDO, binaryLink.getTarget().equals(target));
+ //redo
+ getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET + TEST_THE_REDO, binaryLink.getTarget().equals(targetPlayer));
+ }
+
+ @Override
+ public void testSourceReconnectAMultiLink(IElementType type) {
+ }
+
+ /**
+ * test the drop of a link where the source and the target are the same objects
+ *
+ * @param linkType
+ * @param allowed
+ */
+ @Override
+ protected void testToDropAlinkOnTheSame(IElementType linkType, boolean allowed) {
+ }
+
+ /**
+ * test the creation of a link where the source and the target are the same objects
+ *
+ * @param linkType
+ * @param allowed
+ */
+ @Override
+ protected void testToCreateAlinkOnTheSame(IElementType linkType, boolean allowed) {
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ Command command = target.getCommand(createConnectionViewRequest(linkType, source, source));
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == allowed);
+ if(allowed) {
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 2);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(CREATION + TEST_THE_UNDO, getRootView().getChildren().size() == 4);
+ assertTrue(CREATION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(CREATION + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 2);
+ assertTrue(CREATION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ }
+ }
+}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestConstraintLink.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestConstraintLink.java
new file mode 100644
index 00000000000..6f0e639f400
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestConstraintLink.java
@@ -0,0 +1,245 @@
+/*****************************************************************************
+ * 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:
+ * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
+ /*****************************************************************************/
+package org.eclipse.papyrus.diagram.tests.canonical;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.GroupRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
+import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.uml2.uml.Element;
+
+public abstract class TestConstraintLink extends TestLink {
+
+ /**
+ * Test view deletion.
+ *
+ * @param type
+ * the type
+ */
+ @Override
+ public void testViewDeletion(IElementType type) {
+ //DELETION OF THE VIEW
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, source.getSourceConnections().size() == 1);
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
+ Command command = ((ConnectionEditPart)source.getSourceConnections().get(0)).getCommand(deleteViewRequest);
+ assertNotNull(VIEW_DELETION + COMMAND_NULL, command);
+ assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 0);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, source.getSourceConnections().size() == 1);
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, source.getSourceConnections().size() == 0);
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ }
+
+ /**
+ * Test destroy.
+ *
+ * @param type
+ * the type
+ */
+ @Override
+ public void testDestroy(IElementType type) {
+ //DESTROY SEMANTIC+ VIEW
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, source.getSourceConnections().size() == 1);
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ Request deleteViewRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
+ Command command = ((ConnectionEditPart)source.getSourceConnections().get(0)).getCommand(deleteViewRequest);
+ assertNotNull(DESTROY_DELETION + COMMAND_NULL, command);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, source.getSourceConnections().size() == 1);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, source.getSourceConnections().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ }
+
+ /**
+ * Test drop.
+ *
+ * @param type
+ * the type
+ */
+ @Override
+ public void testDrop(IElementType type) {
+ //DROP
+ //it is impossible to drop but you can recreat the link between this element
+ assertTrue(DROP + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DROP + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ assertTrue(DROP + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 0);
+ }
+
+ /**
+ * Test to create a link.
+ *
+ * @param linkType
+ * the type
+ */
+ @Override
+ public void testToCreateALink(IElementType linkType) {
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ Command command = target.getCommand(createConnectionViewRequest(linkType, source, target));
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ assertTrue(CREATION + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(CREATION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(CREATION + TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(CREATION + TEST_THE_UNDO, getRootView().getChildren().size() == 4);
+ assertTrue(CREATION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(CREATION + TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(CREATION + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(CREATION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(CREATION + TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ }
+
+ @Override
+ public void installEnvironment(IElementType sourceType, IElementType targetType) {
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 0);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 0);
+ //create the source
+ CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(sourceType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation.setLocation(new Point(100, 100));
+ Command command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ //create the source player to test reconnect
+ requestcreation = CreateViewRequestFactory.getCreateShapeRequest(sourceType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation.setLocation(new Point(100, 300));
+ command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ //create the target
+ requestcreation = CreateViewRequestFactory.getCreateShapeRequest(targetType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation.setLocation(new Point(300, 100));
+ command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ //create the target player to test reconnect
+ requestcreation = CreateViewRequestFactory.getCreateShapeRequest(targetType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation.setLocation(new Point(300, 300));
+ command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ source = (GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
+ sourcePlayer = (GraphicalEditPart)getDiagramEditPart().getChildren().get(1);
+ target = (GraphicalEditPart)getDiagramEditPart().getChildren().get(2);
+ targetPlayer = (GraphicalEditPart)getDiagramEditPart().getChildren().get(3);
+ }
+
+ @Override
+ public void testTargetReconnectAMultiLink(IElementType type) {
+ //target reconnection
+ ReconnectRequest reconnectRequest = new ReconnectRequest();
+ assertTrue(THE_LINK_RECONNECT_EXISTS, (ConnectionEditPart)target.getTargetConnections().get(0) != null);
+ ConnectionEditPart binaryLink = (ConnectionEditPart)target.getTargetConnections().get(0);
+ reconnectRequest.setConnectionEditPart(binaryLink);
+ reconnectRequest.setTargetEditPart(targetPlayer);
+ reconnectRequest.setType(RequestConstants.REQ_RECONNECT_TARGET);
+ Command cmd = targetPlayer.getCommand(reconnectRequest);
+ assertTrue(RECONNECTION_TARGET + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, cmd.canExecute() == true);
+ getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().execute(cmd);
+ // EditorUtils.getTransactionalEditingDomain().getCommandStack().execute(cmd);
+ assertTrue(RECONNECTION_TARGET + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(RECONNECTION_TARGET + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET, binaryLink.getTarget().equals(targetPlayer));
+ //undo
+ getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET + TEST_THE_UNDO, binaryLink.getTarget().equals(target));
+ //redo
+ getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET + TEST_THE_REDO, binaryLink.getTarget().equals(targetPlayer));
+ }
+
+ @Override
+ public void testSourceReconnectAMultiLink(IElementType type) {
+ }
+
+ /**
+ * test the drop of a link where the source and the target are the same objects
+ *
+ * @param linkType
+ * @param allowed
+ */
+ @Override
+ protected void testToDropAlinkOnTheSame(IElementType linkType, boolean allowed) {
+ }
+
+ /**
+ * test the creation of a link where the source and the target are the same objects
+ *
+ * @param linkType
+ * @param allowed
+ */
+ @Override
+ protected void testToCreateAlinkOnTheSame(IElementType linkType, boolean allowed) {
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ Command command = target.getCommand(createConnectionViewRequest(linkType, source, source));
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == allowed);
+ if(allowed) {
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 2);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(CREATION + TEST_THE_UNDO, getRootView().getChildren().size() == 4);
+ assertTrue(CREATION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(CREATION + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 2);
+ assertTrue(CREATION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ }
+ }
+}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestContainmentLink.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestContainmentLink.java
new file mode 100644
index 00000000000..9980012ae6e
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestContainmentLink.java
@@ -0,0 +1,262 @@
+/*****************************************************************************
+ * Copyright (c) 2009 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.tests.canonical;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.GroupRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
+import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.uml2.uml.Element;
+
+public abstract class TestContainmentLink extends TestLink {
+
+ /**
+ * Test view deletion.
+ *
+ * @param type
+ * the type
+ */
+ @Override
+ public void testViewDeletion(IElementType type) {
+ //DELETION OF THE VIEW
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 3);
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
+ Command command = ((ConnectionEditPart)source.getChildBySemanticHint("3032").getSourceConnections().get(0)).getCommand(deleteViewRequest);
+ assertNotNull(VIEW_DELETION + COMMAND_NULL, command);
+ assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 0);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 3);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 3);
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 0);
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 3);
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ }
+
+ /**
+ * Test destroy.
+ *
+ * @param type
+ * the type
+ */
+ @Override
+ public void testDestroy(IElementType type) {
+ //DESTROY SEMANTIC+ VIEW
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 3);
+ Request deleteViewRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
+ Command command = ((ConnectionEditPart)source.getChildBySemanticHint("3032").getSourceConnections().get(0)).getCommand(deleteViewRequest);
+ assertNotNull(DESTROY_DELETION + COMMAND_NULL, command);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 3);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);
+ }
+
+ /**
+ * Test drop.
+ *
+ * @param type
+ * the type
+ */
+ @Override
+ public void testDrop(IElementType type) {
+ //DROP
+ //it is impossible to drop but you can recreat the link between this element
+ assertTrue(DROP + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 3);
+ assertTrue(DROP + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ assertTrue(DROP + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 0);
+ }
+
+ /**
+ * Test to create a link.
+ *
+ * @param linkType
+ * the type
+ */
+ @Override
+ public void testToCreateALink(IElementType linkType) {
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);
+ Command command = target.getCommand(createConnectionViewRequest(linkType, source, target));
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ assertTrue(CREATION + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(CREATION + TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(CREATION + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 0);
+ assertTrue(CREATION + TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(CREATION + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(CREATION + TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ }
+
+ @Override
+ public void installEnvironment(IElementType sourceType, IElementType targetType) {
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 0);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 0);
+ //create the source
+ CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(sourceType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation.setLocation(new Point(100, 100));
+ Command command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ //create the source player to test reconnect
+ requestcreation = CreateViewRequestFactory.getCreateShapeRequest(sourceType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation.setLocation(new Point(100, 300));
+ command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ //create the target
+ requestcreation = CreateViewRequestFactory.getCreateShapeRequest(targetType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation.setLocation(new Point(300, 100));
+ command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ //create the target player to test reconnect
+ requestcreation = CreateViewRequestFactory.getCreateShapeRequest(targetType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation.setLocation(new Point(300, 300));
+ command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ source = (GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
+ sourcePlayer = (GraphicalEditPart)getDiagramEditPart().getChildren().get(1);
+ target = (GraphicalEditPart)getDiagramEditPart().getChildren().get(2);
+ targetPlayer = (GraphicalEditPart)getDiagramEditPart().getChildren().get(3);
+ }
+
+ @Override
+ public void testTargetReconnectAMultiLink(IElementType type) {
+ //target reconnection
+ ReconnectRequest reconnectRequest = new ReconnectRequest();
+ assertTrue(THE_LINK_RECONNECT_EXISTS, ((ConnectionEditPart)source.getChildBySemanticHint("3032").getSourceConnections().get(0)) != null);
+ ConnectionEditPart binaryLink = ((ConnectionEditPart)source.getChildBySemanticHint("3032").getSourceConnections().get(0));
+ reconnectRequest.setConnectionEditPart(binaryLink);
+ reconnectRequest.setTargetEditPart(targetPlayer);
+ reconnectRequest.setType(RequestConstants.REQ_RECONNECT_TARGET);
+ Command cmd = targetPlayer.getCommand(reconnectRequest);
+ assertTrue(RECONNECTION_TARGET + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, cmd.canExecute() == true);
+ getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().execute(cmd);
+ // EditorUtils.getTransactionalEditingDomain().getCommandStack().execute(cmd);
+ assertTrue(RECONNECTION_TARGET + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(RECONNECTION_TARGET + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 3);
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET, binaryLink.getTarget().equals(targetPlayer));
+ //undo
+ getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET + TEST_THE_UNDO, binaryLink.getTarget().equals(target));
+ //redo
+ getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET + TEST_THE_REDO, binaryLink.getTarget().equals(targetPlayer));
+ }
+
+ @Override
+ public void testSourceReconnectAMultiLink(IElementType type) {
+ //target reconnection
+ ReconnectRequest reconnectRequest = new ReconnectRequest();
+ assertTrue(THE_LINK_TO_RECONNECT_EXISTS, ((ConnectionEditPart)source.getChildBySemanticHint("3032").getSourceConnections().get(0)) != null);
+ ConnectionEditPart branch = ((ConnectionEditPart)source.getChildBySemanticHint("3032").getSourceConnections().get(0));
+ reconnectRequest.setConnectionEditPart(branch);
+ reconnectRequest.setTargetEditPart(sourcePlayer);
+ reconnectRequest.setType(RequestConstants.REQ_RECONNECT_SOURCE);
+ Command cmd = sourcePlayer.getCommand(reconnectRequest);
+ //it is impossible to reconnect source of the link
+ assertTrue(RECONNECTION_SOURCE + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, cmd.canExecute() == false);
+ }
+
+ /**
+ * Test to manage top node.
+ *
+ * @param type
+ * the type
+ * @param containerType
+ * the container type
+ */
+ public void testToManageLink(IElementType sourceType, IElementType targetType, IElementType linkType, IElementType containerType) {
+ installEnvironment(sourceType, targetType);
+ testToCreateALink(linkType);
+ testDestroy(linkType);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
+ testViewDeletion(linkType);
+ testDrop(linkType);
+ testRecreation(linkType);
+ testSourceReconnectAMultiLink(linkType);
+ testTargetReconnectAMultiLink(linkType);
+ }
+
+ public void testRecreation(IElementType linkType) {
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 0);
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 3);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ Command command = target.getCommand(createConnectionViewRequest(linkType, source, target));
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 3);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 0);
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 3);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 3);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ }
+}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java
index df4b1b70b72..d170a75aba1 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java
@@ -42,8 +42,6 @@ import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.uml2.uml.Element;
-
-
// TODO: Auto-generated Javadoc
/**
* The Class TestTopLink to test when this is link . The link is attached to a semantic element that has to be contained by the source and the target.
@@ -51,9 +49,6 @@ import org.eclipse.uml2.uml.Element;
*/
public abstract class TestLink extends AbstractPapyrusTestCase {
-
-
-
protected static final String THE_LINK_RECONNECT_EXISTS = "The Link exist";
protected static final String RECONNECTION_TARGET = "Reconnection of target";
@@ -84,7 +79,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
//DELETION OF THE VIEW
assertTrue(VIEW_DELETION + INITIALIZATION_TEST, source.getSourceConnections().size() == 1);
assertTrue(VIEW_DELETION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 5);
-
Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
Command command = ((ConnectionEditPart)source.getSourceConnections().get(0)).getCommand(deleteViewRequest);
assertNotNull(VIEW_DELETION + COMMAND_NULL, command);
@@ -99,7 +93,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
assertTrue(VIEW_DELETION + TEST_THE_REDO, source.getSourceConnections().size() == 0);
assertTrue(VIEW_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 5);
-
}
/**
@@ -112,11 +105,9 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
TransactionalEditingDomain editingDomain = null;
try {
editingDomain = serviceUtils.getTransactionalEditingDomain();
-
} catch (ServiceException e) {
Activator.log.error(e);
}
-
return editingDomain;
}
@@ -127,14 +118,10 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
* the type
*/
public void testDestroy(IElementType type) {
-
-
//DESTROY SEMANTIC+ VIEW
assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 1);
assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, source.getSourceConnections().size() == 1);
assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 5);
-
-
Request deleteViewRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
Command command = ((ConnectionEditPart)source.getSourceConnections().get(0)).getCommand(deleteViewRequest);
assertNotNull(DESTROY_DELETION + COMMAND_NULL, command);
@@ -144,7 +131,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 0);
assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 0);
assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
-
assertTrue(DESTROY_DELETION + TEST_THE_UNDO, diagramEditor.getDiagramEditDomain().getDiagramCommandStack().canUndo() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
assertTrue(DESTROY_DELETION + TEST_THE_UNDO, ((Diagram)getRootView()).getEdges().size() == 1);
@@ -156,7 +142,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
assertTrue(DESTROY_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
}
-
/**
* Test drop.
*
@@ -168,9 +153,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
assertTrue(DROP + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
assertTrue(DROP + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 5);
assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 0);
-
-
-
DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
ArrayList<Element> list = new ArrayList<Element>();
list.add(getRootSemanticModel().getOwnedElements().get(4));
@@ -194,7 +176,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
assertTrue(DROP + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 1);
}
-
/**
* Test change container.
*
@@ -207,8 +188,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
//CHANGE CONTAINER
assertTrue(CHANGE_CONTAINER + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 1);
assertTrue(CHANGE_CONTAINER + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 1);
-
-
Request requestcreation = CreateViewRequestFactory.getCreateShapeRequest(containerType, getDiagramEditPart().getDiagramPreferencesHint());
Command command = getDiagramEditPart().getCommand(requestcreation);
assertNotNull(CONTAINER_CREATION + COMMAND_NULL, command);
@@ -229,8 +208,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
index++;
}
assertTrue("Container not found", compartment != null);
-
-
command = compartment.getCommand(changeBoundsRequest);
assertNotNull(CHANGE_CONTAINER, command);
assertTrue(CHANGE_CONTAINER + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
@@ -247,7 +224,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
assertTrue(CHANGE_CONTAINER + TEST_THE_REDO, getRootView().getChildren().size() == 1);
assertTrue(CHANGE_CONTAINER + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 1);
assertTrue(CHANGE_CONTAINER + TEST_THE_EXECUTION, compartment.getChildren().size() == 1);
-
}
/**
@@ -259,7 +235,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
public void testToCreateALink(IElementType linkType) {
assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
-
Command command = target.getCommand(createConnectionViewRequest(linkType, source, target));
assertNotNull(CREATION + COMMAND_NULL, command);
assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
@@ -272,13 +247,11 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
assertTrue(CREATION + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 1);
assertTrue(CREATION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 5);
-
}
public void installEnvironment(IElementType sourceType, IElementType targetType) {
assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 0);
assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 0);
-
//create the source
CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(sourceType, getDiagramEditPart().getDiagramPreferencesHint());
requestcreation.setLocation(new Point(100, 100));
@@ -287,8 +260,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
-
//create the source player to test reconnect
requestcreation = CreateViewRequestFactory.getCreateShapeRequest(sourceType, getDiagramEditPart().getDiagramPreferencesHint());
requestcreation.setLocation(new Point(100, 300));
@@ -297,7 +268,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
//create the target
requestcreation = CreateViewRequestFactory.getCreateShapeRequest(targetType, getDiagramEditPart().getDiagramPreferencesHint());
requestcreation.setLocation(new Point(300, 100));
@@ -306,7 +276,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
//create the target player to test reconnect
requestcreation = CreateViewRequestFactory.getCreateShapeRequest(targetType, getDiagramEditPart().getDiagramPreferencesHint());
requestcreation.setLocation(new Point(300, 300));
@@ -315,25 +284,18 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
-
-
-
source = (GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
sourcePlayer = (GraphicalEditPart)getDiagramEditPart().getChildren().get(1);
target = (GraphicalEditPart)getDiagramEditPart().getChildren().get(2);
targetPlayer = (GraphicalEditPart)getDiagramEditPart().getChildren().get(3);
-
}
public CreateConnectionViewRequest createConnectionViewRequest(IElementType type, EditPart source, EditPart target) {
CreateConnectionViewRequest connectionRequest = CreateViewRequestFactory.getCreateConnectionRequest(type, ((IGraphicalEditPart)getDiagramEditPart()).getDiagramPreferencesHint());
-
connectionRequest.setSourceEditPart(null);
connectionRequest.setTargetEditPart(source);
connectionRequest.setType(RequestConstants.REQ_CONNECTION_START);
source.getCommand(connectionRequest);
-
// Now, setup the request in preparation to get the
// connection end
// command.
@@ -343,10 +305,7 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
return connectionRequest;
}
-
-
public void testTargetReconnectAMultiLink(IElementType type) {
-
//target reconnection
ReconnectRequest reconnectRequest = new ReconnectRequest();
assertTrue(THE_LINK_RECONNECT_EXISTS, (ConnectionEditPart)target.getTargetConnections().get(0) != null);
@@ -354,30 +313,22 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
reconnectRequest.setConnectionEditPart(binaryLink);
reconnectRequest.setTargetEditPart(targetPlayer);
reconnectRequest.setType(RequestConstants.REQ_RECONNECT_TARGET);
-
Command cmd = targetPlayer.getCommand(reconnectRequest);
-
assertTrue(RECONNECTION_TARGET + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, cmd.canExecute() == true);
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().execute(cmd);
// EditorUtils.getTransactionalEditingDomain().getCommandStack().execute(cmd);
assertTrue(RECONNECTION_TARGET + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 1);
assertTrue(RECONNECTION_TARGET + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 5);
assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET, binaryLink.getTarget().equals(targetPlayer));
-
//undo
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().undo();
assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET + TEST_THE_UNDO, binaryLink.getTarget().equals(target));
-
//redo
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().redo();
assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET + TEST_THE_REDO, binaryLink.getTarget().equals(targetPlayer));
-
-
-
}
public void testSourceReconnectAMultiLink(IElementType type) {
-
//target reconnection
ReconnectRequest reconnectRequest = new ReconnectRequest();
assertTrue(THE_LINK_TO_RECONNECT_EXISTS, (ConnectionEditPart)source.getSourceConnections().get(0) != null);
@@ -385,21 +336,16 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
reconnectRequest.setConnectionEditPart(branch);
reconnectRequest.setTargetEditPart(sourcePlayer);
reconnectRequest.setType(RequestConstants.REQ_RECONNECT_SOURCE);
-
Command cmd = sourcePlayer.getCommand(reconnectRequest);
-
assertTrue(RECONNECTION_SOURCE + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, cmd.canExecute() == true);
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().execute(cmd);
assertTrue(RECONNECTION_SOURCE + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 1);
assertTrue(RECONNECTION_SOURCE + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 5);
assertTrue(LINK_EXISTS_RECONNECTION_ON_SOURCE + TEST_THE_EXECUTION, branch.getSource().equals(sourcePlayer));
-
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().undo();
assertTrue(LINK_EXISTS_RECONNECTION_ON_SOURCE + TEST_THE_UNDO, branch.getSource().equals(source));
-
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().redo();
assertTrue(LINK_EXISTS_RECONNECTION_ON_SOURCE + TEST_THE_REDO, branch.getSource().equals(sourcePlayer));
-
}
/**
@@ -422,7 +368,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
testTargetReconnectAMultiLink(linkType);
testToCreateAlinkOnTheSame(linkType, allowedOntheSame);
testToDropAlinkOnTheSame(linkType, allowedOntheSame);
-
}
/**
@@ -437,7 +382,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
assertTrue(DROP + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
assertTrue(DROP + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 6);
assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 2);
-
DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
ArrayList<Element> list = new ArrayList<Element>();
list.add(getRootSemanticModel().getOwnedElements().get(5));
@@ -460,7 +404,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
assertTrue(DROP + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 6);
assertTrue(DROP + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 3);
}
-
}
/**
@@ -472,7 +415,6 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
protected void testToCreateAlinkOnTheSame(IElementType linkType, boolean allowed) {
assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 5);
-
Command command = target.getCommand(createConnectionViewRequest(linkType, source, source));
assertNotNull(CREATION + COMMAND_NULL, command);
assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == allowed);
@@ -487,9 +429,5 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
assertTrue(CREATION + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 2);
assertTrue(CREATION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 6);
}
-
-
}
-
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkOwnedBySource.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkOwnedBySource.java
index 403acd6c9eb..7a7fd78f34d 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkOwnedBySource.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkOwnedBySource.java
@@ -33,322 +33,284 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.uml2.uml.Element;
-
-public abstract class TestLinkOwnedBySource extends TestLink {
-
+public abstract class TestLinkOwnedBySource extends TestLink {
/**
* Test view deletion.
*
- * @param type the type
+ * @param type
+ * the type
*/
@Override
public void testViewDeletion(IElementType type) {
//DELETION OF THE VIEW
- assertTrue(VIEW_DELETION +INITIALIZATION_TEST, source.getSourceConnections().size()==1);
- assertTrue(VIEW_DELETION +INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(VIEW_DELETION +INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, source.getSourceConnections().size() == 1);
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(VIEW_DELETION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
Command command = ((ConnectionEditPart)source.getSourceConnections().get(0)).getCommand(deleteViewRequest);
- assertNotNull(VIEW_DELETION +COMMAND_NULL,command);
- assertTrue(VIEW_DELETION +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(VIEW_DELETION +TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ assertNotNull(VIEW_DELETION + COMMAND_NULL, command);
+ assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(VIEW_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(VIEW_DELETION +TEST_THE_EXECUTION,source.getSourceConnections().size()==0);
- assertTrue(VIEW_DELETION +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(VIEW_DELETION +TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 0);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(VIEW_DELETION + TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(VIEW_DELETION +TEST_THE_UNDO,source.getSourceConnections().size()==1);
- assertTrue(VIEW_DELETION +TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(VIEW_DELETION +TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, source.getSourceConnections().size() == 1);
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(VIEW_DELETION + TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(VIEW_DELETION +TEST_THE_REDO,source.getSourceConnections().size()==0);
- assertTrue(VIEW_DELETION +TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(VIEW_DELETION +TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
-
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, source.getSourceConnections().size() == 0);
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(VIEW_DELETION + TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
}
/**
* Test destroy.
*
- * @param type the type
+ * @param type
+ * the type
*/
@Override
public void testDestroy(IElementType type) {
-
-
//DESTROY SEMANTIC+ VIEW
- assertTrue(DESTROY_DELETION +INITIALIZATION_TEST,source.getSourceConnections().size()==1);
- assertTrue(DESTROY_DELETION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(DESTROY_DELETION +INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
-
- Request deleteViewRequest = new EditCommandRequestWrapper( new DestroyElementRequest(false));
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, source.getSourceConnections().size() == 1);
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DESTROY_DELETION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ Request deleteViewRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
Command command = ((ConnectionEditPart)source.getSourceConnections().get(0)).getCommand(deleteViewRequest);
- assertNotNull(DESTROY_DELETION +COMMAND_NULL,command);
- assertTrue(DESTROY_DELETION +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(DESTROY_DELETION+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ assertNotNull(DESTROY_DELETION + COMMAND_NULL, command);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(DESTROY_DELETION +TEST_THE_EXECUTION,source.getSourceConnections().size()==0);
- assertTrue(DESTROY_DELETION +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(DESTROY_DELETION +TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==0);
-
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(DESTROY_DELETION +TEST_THE_UNDO,source.getSourceConnections().size()==1);
- assertTrue(DESTROY_DELETION +TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(DESTROY_DELETION +TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, source.getSourceConnections().size() == 1);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DESTROY_DELETION + TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(DESTROY_DELETION +TEST_THE_REDO,source.getSourceConnections().size()==0);
- assertTrue(DESTROY_DELETION +TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(DESTROY_DELETION +TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==0);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, source.getSourceConnections().size() == 0);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DESTROY_DELETION + TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);
}
-
/**
* Test drop.
*
- * @param type the type
+ * @param type
+ * the type
*/
@Override
public void testDrop(IElementType type) {
//DROP
- assertTrue(DROP +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==4);
- assertTrue(DROP +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(DROP +INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
- assertTrue(DROP +TEST_THE_REDO,((Diagram)getRootView()).getEdges().size()==0);
-
- DropObjectsRequest dropObjectsRequest= new DropObjectsRequest();
+ assertTrue(DROP + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DROP + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ assertTrue(DROP + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 0);
+ DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
ArrayList<Element> list = new ArrayList<Element>();
list.add(((Element)source.resolveSemanticElement()).getOwnedElements().get(0));
dropObjectsRequest.setObjects(list);
- dropObjectsRequest.setLocation(new Point(20,20));
- Command command= getDiagramEditPart().getCommand(dropObjectsRequest);
- assertNotNull(DROP+COMMAND_NULL,command);
- assertTrue(DROP +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(DROP+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ dropObjectsRequest.setLocation(new Point(20, 20));
+ Command command = getDiagramEditPart().getCommand(dropObjectsRequest);
+ assertNotNull(DROP + COMMAND_NULL, command);
+ assertTrue(DROP + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(DROP + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(DROP +TEST_THE_EXECUTION,getDiagramEditPart().getChildren().size()==4);
- assertTrue(DROP +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(DROP +TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
- assertTrue(DROP +TEST_THE_EXECUTION,((Diagram)getRootView()).getEdges().size()==1);
+ assertTrue(DROP + TEST_THE_EXECUTION, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DROP + TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ assertTrue(DROP + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(DROP +TEST_THE_REDO,getDiagramEditPart().getChildren().size()==4);
- assertTrue(DROP +TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(DROP +TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
- assertTrue(DROP +TEST_THE_REDO,((Diagram)getRootView()).getEdges().size()==0);
+ assertTrue(DROP + TEST_THE_REDO, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DROP + TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ assertTrue(DROP + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(DROP +TEST_THE_REDO,getDiagramEditPart().getChildren().size()==4);
- assertTrue(DROP +TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(DROP +TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
- assertTrue(DROP +TEST_THE_REDO,((Diagram)getRootView()).getEdges().size()==1);
+ assertTrue(DROP + TEST_THE_REDO, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DROP + TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
+ assertTrue(DROP + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 1);
}
-
-
-
/**
* Test to create a link.
*
- * @param linkType the type
+ * @param linkType
+ * the type
*/
@Override
public void testToCreateALink(IElementType linkType) {
- assertTrue(CREATION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==4);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(CREATION +INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==0);
-
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);
Command command = target.getCommand(createConnectionViewRequest(linkType, source, target));
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CONTAINER_CREATION+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CREATION +TEST_THE_EXECUTION,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(CREATION +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(CREATION +TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
+ assertTrue(CREATION + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(CREATION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(CREATION + TEST_THE_EXECUTION, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(CREATION+TEST_THE_UNDO,getRootView().getChildren().size()==4);
- assertTrue(CREATION+TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(CREATION +TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==0);
+ assertTrue(CREATION + TEST_THE_UNDO, getRootView().getChildren().size() == 4);
+ assertTrue(CREATION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(CREATION + TEST_THE_UNDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(CREATION +TEST_THE_REDO,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(CREATION +TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(CREATION +TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size()==1);
-
+ assertTrue(CREATION + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(CREATION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(CREATION + TEST_THE_REDO, ((Element)source.resolveSemanticElement()).getOwnedElements().size() == 1);
}
- @Override
- public void installEnvironment(IElementType sourceType,IElementType targetType ){
- assertTrue(CREATION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==0);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==0);
+ @Override
+ public void installEnvironment(IElementType sourceType, IElementType targetType) {
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 0);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 0);
//create the source
- CreateViewRequest requestcreation=CreateViewRequestFactory.getCreateShapeRequest(sourceType, getDiagramEditPart().getDiagramPreferencesHint());
+ CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(sourceType, getDiagramEditPart().getDiagramPreferencesHint());
requestcreation.setLocation(new Point(100, 100));
- Command command=getDiagramEditPart().getCommand(requestcreation);
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue("CREATION: "+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ Command command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
-
//create the source player to test reconnect
- requestcreation=CreateViewRequestFactory.getCreateShapeRequest(sourceType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation = CreateViewRequestFactory.getCreateShapeRequest(sourceType, getDiagramEditPart().getDiagramPreferencesHint());
requestcreation.setLocation(new Point(100, 300));
- command=getDiagramEditPart().getCommand(requestcreation);
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue("CREATION: "+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
//create the target
- requestcreation=CreateViewRequestFactory.getCreateShapeRequest(targetType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation = CreateViewRequestFactory.getCreateShapeRequest(targetType, getDiagramEditPart().getDiagramPreferencesHint());
requestcreation.setLocation(new Point(300, 100));
- command=getDiagramEditPart().getCommand(requestcreation);
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue("CREATION: "+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
//create the target player to test reconnect
- requestcreation=CreateViewRequestFactory.getCreateShapeRequest(targetType, getDiagramEditPart().getDiagramPreferencesHint());
+ requestcreation = CreateViewRequestFactory.getCreateShapeRequest(targetType, getDiagramEditPart().getDiagramPreferencesHint());
requestcreation.setLocation(new Point(300, 300));
- command=getDiagramEditPart().getCommand(requestcreation);
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CREATION+TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue("CREATION: "+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ command = getDiagramEditPart().getCommand(requestcreation);
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue("CREATION: " + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
-
-
-
-
- source=(GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
- sourcePlayer=(GraphicalEditPart)getDiagramEditPart().getChildren().get(1);
- target=(GraphicalEditPart)getDiagramEditPart().getChildren().get(2);
- targetPlayer=(GraphicalEditPart)getDiagramEditPart().getChildren().get(3);
-
+ source = (GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
+ sourcePlayer = (GraphicalEditPart)getDiagramEditPart().getChildren().get(1);
+ target = (GraphicalEditPart)getDiagramEditPart().getChildren().get(2);
+ targetPlayer = (GraphicalEditPart)getDiagramEditPart().getChildren().get(3);
}
-
-
-
-
@Override
public void testTargetReconnectAMultiLink(IElementType type) {
-
//target reconnection
- ReconnectRequest reconnectRequest= new ReconnectRequest();
- assertTrue(THE_LINK_RECONNECT_EXISTS,(ConnectionEditPart)target.getTargetConnections().get(0)!=null);
- ConnectionEditPart binaryLink=(ConnectionEditPart)target.getTargetConnections().get(0);
+ ReconnectRequest reconnectRequest = new ReconnectRequest();
+ assertTrue(THE_LINK_RECONNECT_EXISTS, (ConnectionEditPart)target.getTargetConnections().get(0) != null);
+ ConnectionEditPart binaryLink = (ConnectionEditPart)target.getTargetConnections().get(0);
reconnectRequest.setConnectionEditPart(binaryLink);
reconnectRequest.setTargetEditPart(targetPlayer);
reconnectRequest.setType(RequestConstants.REQ_RECONNECT_TARGET);
-
Command cmd = targetPlayer.getCommand(reconnectRequest);
-
- assertTrue(RECONNECTION_TARGET+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,cmd.canExecute()==true);
+ assertTrue(RECONNECTION_TARGET + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, cmd.canExecute() == true);
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().execute(cmd);
// EditorUtils.getTransactionalEditingDomain().getCommandStack().execute(cmd);
- assertTrue(RECONNECTION_TARGET+TEST_THE_EXECUTION,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(RECONNECTION_TARGET +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET,binaryLink.getTarget().equals(targetPlayer));
-
+ assertTrue(RECONNECTION_TARGET + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(RECONNECTION_TARGET + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET, binaryLink.getTarget().equals(targetPlayer));
//undo
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET+ TEST_THE_UNDO,binaryLink.getTarget().equals(target));
-
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET + TEST_THE_UNDO, binaryLink.getTarget().equals(target));
//redo
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET+ TEST_THE_REDO,binaryLink.getTarget().equals(targetPlayer));
-
-
-
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_TARGET + TEST_THE_REDO, binaryLink.getTarget().equals(targetPlayer));
}
@Override
public void testSourceReconnectAMultiLink(IElementType type) {
-
//target reconnection
- ReconnectRequest reconnectRequest= new ReconnectRequest();
- assertTrue(THE_LINK_TO_RECONNECT_EXISTS,(ConnectionEditPart)source.getSourceConnections().get(0)!=null);
- ConnectionEditPart branch=(ConnectionEditPart)source.getSourceConnections().get(0);
+ ReconnectRequest reconnectRequest = new ReconnectRequest();
+ assertTrue(THE_LINK_TO_RECONNECT_EXISTS, (ConnectionEditPart)source.getSourceConnections().get(0) != null);
+ ConnectionEditPart branch = (ConnectionEditPart)source.getSourceConnections().get(0);
reconnectRequest.setConnectionEditPart(branch);
reconnectRequest.setTargetEditPart(sourcePlayer);
reconnectRequest.setType(RequestConstants.REQ_RECONNECT_SOURCE);
-
Command cmd = sourcePlayer.getCommand(reconnectRequest);
-
- assertTrue(RECONNECTION_SOURCE+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,cmd.canExecute()==true);
+ assertTrue(RECONNECTION_SOURCE + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, cmd.canExecute() == true);
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().execute(cmd);
- assertTrue(RECONNECTION_SOURCE+TEST_THE_EXECUTION,((Diagram)getRootView()).getEdges().size()==1);
- assertTrue(RECONNECTION_SOURCE +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(LINK_EXISTS_RECONNECTION_ON_SOURCE+TEST_THE_EXECUTION,branch.getSource().equals(sourcePlayer));
-
+ assertTrue(RECONNECTION_SOURCE + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 1);
+ assertTrue(RECONNECTION_SOURCE + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_SOURCE + TEST_THE_EXECUTION, branch.getSource().equals(sourcePlayer));
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(LINK_EXISTS_RECONNECTION_ON_SOURCE+ TEST_THE_UNDO,branch.getSource().equals(source));
-
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_SOURCE + TEST_THE_UNDO, branch.getSource().equals(source));
getDiagramEditPart().getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(LINK_EXISTS_RECONNECTION_ON_SOURCE+TEST_THE_REDO,branch.getSource().equals(sourcePlayer));
-
+ assertTrue(LINK_EXISTS_RECONNECTION_ON_SOURCE + TEST_THE_REDO, branch.getSource().equals(sourcePlayer));
}
+
/**
* test the drop of a link where the source and the target are the same objects
+ *
* @param linkType
* @param allowed
*/
@Override
protected void testToDropAlinkOnTheSame(IElementType linkType, boolean allowed) {
//DROP
- if(allowed){
- assertTrue(DROP +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==4);
- assertTrue(DROP +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==2);
-
- DropObjectsRequest dropObjectsRequest= new DropObjectsRequest();
+ if(allowed) {
+ assertTrue(DROP + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 2);
+ DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
ArrayList<Element> list = new ArrayList<Element>();
list.add(((Element)source.resolveSemanticElement()).getOwnedElements().get(1));
dropObjectsRequest.setObjects(list);
- dropObjectsRequest.setLocation(new Point(20,20));
- Command command= getDiagramEditPart().getCommand(dropObjectsRequest);
- assertNotNull(DROP+COMMAND_NULL,command);
- assertTrue(DROP +TEST_IF_THE_COMMAND_IS_CREATED,command!=UnexecutableCommand.INSTANCE);
- assertTrue(DROP+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==true);
+ dropObjectsRequest.setLocation(new Point(20, 20));
+ Command command = getDiagramEditPart().getCommand(dropObjectsRequest);
+ assertNotNull(DROP + COMMAND_NULL, command);
+ assertTrue(DROP + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
+ assertTrue(DROP + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(DROP +TEST_THE_EXECUTION,getDiagramEditPart().getChildren().size()==4);
- assertTrue(DROP +TEST_THE_EXECUTION,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(DROP +TEST_THE_EXECUTION,((Diagram)getRootView()).getEdges().size()==3);
+ assertTrue(DROP + TEST_THE_EXECUTION, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DROP + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 3);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(DROP +TEST_THE_UNDO,getDiagramEditPart().getChildren().size()==4);
- assertTrue(DROP +TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(DROP +TEST_THE_UNDO,((Diagram)getRootView()).getEdges().size()==2);
+ assertTrue(DROP + TEST_THE_UNDO, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DROP + TEST_THE_UNDO, ((Diagram)getRootView()).getEdges().size() == 2);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(DROP +TEST_THE_REDO,getDiagramEditPart().getChildren().size()==4);
- assertTrue(DROP +TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==4);
- assertTrue(DROP +TEST_THE_REDO,((Diagram)getRootView()).getEdges().size()==3);
+ assertTrue(DROP + TEST_THE_REDO, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(DROP + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
+ assertTrue(DROP + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 3);
}
-
}
+
/**
* test the creation of a link where the source and the target are the same objects
+ *
* @param linkType
* @param allowed
*/
@Override
protected void testToCreateAlinkOnTheSame(IElementType linkType, boolean allowed) {
- assertTrue(CREATION +INITIALIZATION_TEST,getDiagramEditPart().getChildren().size()==4);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==4);
-
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 4);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
Command command = target.getCommand(createConnectionViewRequest(linkType, source, source));
- assertNotNull(CREATION+COMMAND_NULL,command);
- assertTrue(CONTAINER_CREATION+TEST_IF_THE_COMMAND_CAN_BE_EXECUTED,command.canExecute()==allowed);
- if(allowed){
+ assertNotNull(CREATION + COMMAND_NULL, command);
+ assertTrue(CONTAINER_CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == allowed);
+ if(allowed) {
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
- assertTrue(CREATION +INITIALIZATION_TEST,((Diagram)getRootView()).getEdges().size()==2);
- assertTrue(CREATION +INITIALIZATION_TEST,getRootSemanticModel().getOwnedElements().size()==4);
+ assertTrue(CREATION + INITIALIZATION_TEST, ((Diagram)getRootView()).getEdges().size() == 2);
+ assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 4);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().undo();
- assertTrue(CREATION+TEST_THE_UNDO,getRootView().getChildren().size()==4);
- assertTrue(CREATION+TEST_THE_UNDO,getRootSemanticModel().getOwnedElements().size()==4);
+ assertTrue(CREATION + TEST_THE_UNDO, getRootView().getChildren().size() == 4);
+ assertTrue(CREATION + TEST_THE_UNDO, getRootSemanticModel().getOwnedElements().size() == 4);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
- assertTrue(CREATION +TEST_THE_REDO,((Diagram)getRootView()).getEdges().size()==2);
- assertTrue(CREATION +TEST_THE_REDO,getRootSemanticModel().getOwnedElements().size()==4);
+ assertTrue(CREATION + TEST_THE_REDO, ((Diagram)getRootView()).getEdges().size() == 2);
+ assertTrue(CREATION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 4);
}
-
-
}
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestNested.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestNested.java
index 7d29dc5cac5..7745ff74a21 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestNested.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestNested.java
@@ -43,7 +43,6 @@ public abstract class TestNested extends org.eclipse.papyrus.diagram.tests.canon
public void testToCreateAChildLabel(IElementType type, int containerType) {
ListCompartmentEditPart compartment = null;
int index = 0;
-
while(compartment == null && index < getChildEditPart().getChildren().size()) {
if((getChildEditPart().getChildren().get(index)) instanceof ListCompartmentEditPart && (((View)((ListCompartmentEditPart)(getChildEditPart().getChildren().get(index))).getModel()).getType().equals("" + containerType))) {
compartment = (ListCompartmentEditPart)(getChildEditPart().getChildren().get(index));
@@ -54,7 +53,6 @@ public abstract class TestNested extends org.eclipse.papyrus.diagram.tests.canon
//CREATION
assertTrue(CREATION + INITIALIZATION_TEST, compartment.getChildren().size() == 0);
assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModelchild().getOwnedElements().size() == 0);
-
CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
Command command = compartment.getCommand(requestcreation);
assertNotNull(CREATION + COMMAND_NULL, command);
@@ -67,7 +65,6 @@ public abstract class TestNested extends org.eclipse.papyrus.diagram.tests.canon
assertTrue(CREATION + TEST_THE_UNDO, ((Element)((View)getChildEditPart().getModel()).getElement()).getOwnedElements().size() == 0);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
assertTrue("CREATION: " + TEST_THE_REDO, compartment.getChildren().size() == 1);
-
}
/**
@@ -93,7 +90,6 @@ public abstract class TestNested extends org.eclipse.papyrus.diagram.tests.canon
//CREATION
assertTrue(CREATION + INITIALIZATION_TEST, compartment.getChildren().size() == 0);
assertTrue(CREATION + INITIALIZATION_TEST, getRootSemanticModel().getOwnedElements().size() == 0);
-
CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
Command command = compartment.getCommand(requestcreation);
assertNotNull(CREATION + COMMAND_NULL, command);
@@ -107,7 +103,6 @@ public abstract class TestNested extends org.eclipse.papyrus.diagram.tests.canon
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().redo();
assertTrue("CREATION: " + TEST_THE_REDO, compartment.getChildren().size() == 1);
childNode = (GraphicalEditPart)compartment.getChildren().get(0);
-
}
/**
@@ -126,11 +121,9 @@ public abstract class TestNested extends org.eclipse.papyrus.diagram.tests.canon
* the type
*/
public void testToCreateATopNode(IElementType type) {
-
//CREATION
assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 0);
assertTrue(CREATION + INITIALIZATION_TEST, ((Element)((View)getDiagramEditPart().getModel()).getElement()).getOwnedElements().size() == 0);
-
CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
Command command = getDiagramEditPart().getCommand(requestcreation);
assertNotNull(CREATION + COMMAND_NULL, command);
@@ -164,7 +157,6 @@ public abstract class TestNested extends org.eclipse.papyrus.diagram.tests.canon
*
* @return
*/
-
@Override
protected Element getRootSemanticModel() {
return (Element)((View)getTopEditPart().getModel()).getElement();
@@ -179,14 +171,11 @@ public abstract class TestNested extends org.eclipse.papyrus.diagram.tests.canon
* the container type
*/
public void testToManageTopNode(IElementType parentNodeType, IElementType topNodeType, IElementType type, int containerChilType, int containerType) {
-
//Parent Node
testToCreateATopNode(parentNodeType);
//Top Node
testToCreateANode(topNodeType, containerChilType);
//Nested classifier
testToCreateAChildLabel(type, containerType);
-
}
-
}
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestTopNode.java b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestTopNode.java
index 809d0dc4812..8008bc87507 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestTopNode.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestTopNode.java
@@ -36,7 +36,7 @@ public abstract class TestTopNode extends AbstractTestNode {
protected View getRootView() {
return (View)getContainerEditPart().getModel();
}
-
+
/**
* {@inheritDoc}
*/

Back to the top