Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorptessier2013-10-30 13:39:31 -0400
committerptessier2013-10-30 13:49:14 -0400
commitf4517dd8c6b3e39ffd6750d18eb50ad258f569ae (patch)
treedf29b5f6dd0fdff7fc9f6b48bd94b794e7f4c631 /tests
parentb6496a204a2a88b8bf9e426bd01e9e81be123adb (diff)
downloadorg.eclipse.papyrus-f4517dd8c6b3e39ffd6750d18eb50ad258f569ae.tar.gz
org.eclipse.papyrus-f4517dd8c6b3e39ffd6750d18eb50ad258f569ae.tar.xz
org.eclipse.papyrus-f4517dd8c6b3e39ffd6750d18eb50ad258f569ae.zip
Applied Patch for R. Chevrel to :
add test about parametric in the context of 297816: [SysML Parametric Diagram] Papyrus shall provide a parametric diagram editor. https://bugs.eclipse.org/bugs/show_bug.cgi?id=297816
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/.classpath7
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/.project28
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/META-INF/MANIFEST.MF11
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/about.html28
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/build.properties10
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/Copy of ModelWithPD.di17
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/ModelWithPD.di23
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/ModelWithPD.notation41
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/ModelWithPD.uml75
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/plugin.properties14
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4B.java120
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4CB.java31
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationForSourcesTest.java117
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationForSourcesTest4CB.java117
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationFromElementTest.java148
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationFromElementTest4CB.java147
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkPrepareTest.java173
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkPrepareTest4CB.java174
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromConstraintParameter.java108
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromPart.java87
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromPart4CB.java87
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromReference.java87
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromReference4CB.java87
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromValue.java87
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromValue4CB.java87
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnBlock.java81
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnBlockStructureCompartment.java82
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnComment.java87
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnComment4CB.java87
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraint.java87
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraint4CB.java87
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintBlock4CB.java80
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintBlockStructureCompartment4CB.java81
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintProperty.java84
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintProperty4CB.java84
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnDiagram.java63
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnDiagram4CB.java62
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnPart.java84
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnPartStructureCompartement.java85
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnReference.java84
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnReferenceStructureCompartment.java85
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnValue.java84
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnValueStructureCompartment.java85
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/dnd/node/TestNodeDropOnBlockStructureCompartment.java69
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/dnd/node/TestNodeDropOnBlockStructureCompartment4CB.java69
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationLinkTestsOnParametricOwnedByBlock.java22
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationLinkTestsOnParametricOwnedByConstraintBlock.java19
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationNodeTestsOnParametricOwnedByBlock.java53
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationNodeTestsOnParametricOwnedByConstraintBlock.java41
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllNodeDndTestsOnParametricOwnedByBlock.java15
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllNodeDndTestsOnParametricOwnedByConstraintBlock.java15
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllTests.java31
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/Constants.java7
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/EditorUtils.java143
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/TestPrepareUtils.java296
-rw-r--r--tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/TestUtils.java773
57 files changed, 4943 insertions, 0 deletions
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/.classpath b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/.project b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/.project
new file mode 100644
index 00000000000..f43a5bc1fac
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.sysml.diagram.parametric.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..44217f8c068
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..52ab5b0b0f6
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.sysml.diagram.parametric.tests
+Bundle-Version: 0.10.1.qualifier
+Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.1",
+ org.junit;bundle-version="4.10.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Fragment-Host: org.eclipse.papyrus.sysml.diagram.parametric;bundle-version="0.10.1"
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/about.html b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/build.properties b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/build.properties
new file mode 100644
index 00000000000..1224600ab66
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/build.properties
@@ -0,0 +1,10 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ model/,\
+ plugin.properties,\
+ about.html
+src.includes = model/,\
+ plugin.properties,\
+ about.html
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/Copy of ModelWithPD.di b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/Copy of ModelWithPD.di
new file mode 100644
index 00000000000..bf088778d68
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/Copy of ModelWithPD.di
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi">
+ <pageList>
+ <availablePage>
+ <emfPageIdentifier href="ModelWithPD.notation#_Fi2LwApyEeOc89pTvmF9Gw"/>
+ </availablePage>
+ </pageList>
+ <sashModel currentSelection="//@sashModel/@windows.0/@children.0">
+ <windows>
+ <children xsi:type="di:TabFolder">
+ <children>
+ <emfPageIdentifier href="ModelWithPD.notation#_Fi2LwApyEeOc89pTvmF9Gw"/>
+ </children>
+ </children>
+ </windows>
+ </sashModel>
+</di:SashWindowsMngr>
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/ModelWithPD.di b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/ModelWithPD.di
new file mode 100644
index 00000000000..734a7eeec94
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/ModelWithPD.di
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi">
+ <pageList>
+ <availablePage>
+ <emfPageIdentifier href="ModelWithPD.notation#_Fi2LwApyEeOc89pTvmF9Gw"/>
+ </availablePage>
+ <availablePage>
+ <emfPageIdentifier href="ModelWithPD.notation#_VpI8wA5KEeO7JIqowJboVA"/>
+ </availablePage>
+ </pageList>
+ <sashModel currentSelection="//@sashModel/@windows.0/@children.0">
+ <windows>
+ <children xsi:type="di:TabFolder">
+ <children>
+ <emfPageIdentifier href="ModelWithPD.notation#_Fi2LwApyEeOc89pTvmF9Gw"/>
+ </children>
+ <children>
+ <emfPageIdentifier href="ModelWithPD.notation#_VpI8wA5KEeO7JIqowJboVA"/>
+ </children>
+ </children>
+ </windows>
+ </sashModel>
+</di:SashWindowsMngr>
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/ModelWithPD.notation b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/ModelWithPD.notation
new file mode 100644
index 00000000000..0440fada09b
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/ModelWithPD.notation
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML">
+ <notation:Diagram xmi:id="_Fi2LwApyEeOc89pTvmF9Gw" type="Parametric" name="BlockParametricDiagram" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_Fi2LwQpyEeOc89pTvmF9Gw" type="shape_sysml_block_as_composite">
+ <children xmi:type="notation:DecorationNode" xmi:id="_Fi2LwgpyEeOc89pTvmF9Gw" type="label_sysml_block_name"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_Fi2LwwpyEeOc89pTvmF9Gw" type="compartment_sysml_structure">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_Fi2LxApyEeOc89pTvmF9Gw" showTitle="true"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_FjS3sApyEeOc89pTvmF9Gw" visible="false" type="compartment_shape_display">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_FjS3swpyEeOc89pTvmF9Gw" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_FjS3tApyEeOc89pTvmF9Gw" key="mutable" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_FjS3sQpyEeOc89pTvmF9Gw"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_FjS3sgpyEeOc89pTvmF9Gw"/>
+ </children>
+ <element xmi:type="uml:Class" href="ModelWithPD.uml#_gLmaIGbVEeGgmux_Cozgdg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Fi2LxQpyEeOc89pTvmF9Gw" x="20" y="20" width="1000" height="600"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_Fi2LxgpyEeOc89pTvmF9Gw"/>
+ <element xmi:type="uml:Class" href="ModelWithPD.uml#_gLmaIGbVEeGgmux_Cozgdg"/>
+ </notation:Diagram>
+ <notation:Diagram xmi:id="_VpI8wA5KEeO7JIqowJboVA" type="Parametric" name="ConstrainBlockParametricDiagram" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_VpI8wQ5KEeO7JIqowJboVA" type="shape_sysml_block_as_composite">
+ <children xmi:type="notation:DecorationNode" xmi:id="_VpI8wg5KEeO7JIqowJboVA" type="label_sysml_block_name"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_VpI8ww5KEeO7JIqowJboVA" type="compartment_sysml_structure">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_VpI8xA5KEeO7JIqowJboVA" showTitle="true"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_Vpm20A5KEeO7JIqowJboVA" visible="false" type="compartment_shape_display">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_Vpnd4A5KEeO7JIqowJboVA" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_Vpnd4Q5KEeO7JIqowJboVA" key="mutable" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_Vpm20Q5KEeO7JIqowJboVA"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Vpm20g5KEeO7JIqowJboVA"/>
+ </children>
+ <element xmi:type="uml:Class" href="ModelWithPD.uml#_R89l8A5KEeO7JIqowJboVA"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VpJj0A5KEeO7JIqowJboVA" x="20" y="20" width="1000" height="600"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_VpJj0Q5KEeO7JIqowJboVA"/>
+ <element xmi:type="uml:Class" href="ModelWithPD.uml#_R89l8A5KEeO7JIqowJboVA"/>
+ </notation:Diagram>
+</xmi:XMI>
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/ModelWithPD.uml b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/ModelWithPD.uml
new file mode 100644
index 00000000000..87f624124c6
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/model/ModelWithPD.uml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Blocks="http://www.eclipse.org/papyrus/0.7.0/SysML/Blocks" xmlns:Constraints="http://www.eclipse.org/papyrus/0.7.0/SysML/Constraints" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/0.7.0/SysML/Blocks http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks http://www.eclipse.org/papyrus/0.7.0/SysML/Constraints http://www.eclipse.org/papyrus/0.7.0/SysML#//constraints">
+ <uml:Model xmi:id="_fMOAwGbVEeGgmux_Cozgdg" name="SysMLmodel">
+ <packagedElement xmi:type="uml:Class" xmi:id="_gLmaIGbVEeGgmux_Cozgdg" name="Block1"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_R89l8A5KEeO7JIqowJboVA" name="ConstraintBlock1"/>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_fM0dsGbVEeGgmux_Cozgdg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_fM0dsWbVEeGgmux_Cozgdg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#/"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_TZ_nULU5EduiKqCzJMWbGw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_fPWNQGbVEeGgmux_Cozgdg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_fPWNQWbVEeGgmux_Cozgdg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//modelelements"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_Gx8MgLX7EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_fPWNQmbVEeGgmux_Cozgdg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_fPWNQ2bVEeGgmux_Cozgdg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_fSw28LX7EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_fPWNRGbVEeGgmux_Cozgdg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_fPWNRWbVEeGgmux_Cozgdg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//portandflows"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_rpx28LX7EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_fPWNRmbVEeGgmux_Cozgdg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_fPWNR2bVEeGgmux_Cozgdg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//constraints"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_5WYJ0LX7EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_fPWNSGbVEeGgmux_Cozgdg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_fPWNSWbVEeGgmux_Cozgdg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//activities"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_C2zXMLX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_fPWNSmbVEeGgmux_Cozgdg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_fPWNS2bVEeGgmux_Cozgdg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//allocations"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_NxdG4LX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_fPWNTGbVEeGgmux_Cozgdg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_fPf-QGbVEeGgmux_Cozgdg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//requirements"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_OOJC4LX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_fPf-QWbVEeGgmux_Cozgdg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_fPf-QmbVEeGgmux_Cozgdg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//interactions"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_meOioLX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_fPf-Q2bVEeGgmux_Cozgdg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_fPf-RGbVEeGgmux_Cozgdg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//statemachines"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_nAF5kLX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_fPf-RWbVEeGgmux_Cozgdg">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_fPf-RmbVEeGgmux_Cozgdg" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//usecases"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_neZmMLX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ </uml:Model>
+ <Blocks:Block xmi:id="_gLmaIWbVEeGgmux_Cozgdg" base_Class="_gLmaIGbVEeGgmux_Cozgdg"/>
+ <Constraints:ConstraintBlock xmi:id="_R-HcgA5KEeO7JIqowJboVA" base_Class="_R89l8A5KEeO7JIqowJboVA"/>
+</xmi:XMI>
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/plugin.properties b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/plugin.properties
new file mode 100644
index 00000000000..f16aae62c20
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/plugin.properties
@@ -0,0 +1,14 @@
+#################################################################################
+# 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:
+#
+# Régis CHEVREL (chevrel.regis@gmail.com) CEA LIST - Initial API and Implementation.
+#
+##################################################################################
+pluginName=Papyrus SysML Parametric Diagram Tests (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4B.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4B.java
new file mode 100644
index 00000000000..68ed06cd1bc
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4B.java
@@ -0,0 +1,120 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.sysml.diagram.parametric.Activator;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.Constants;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
+/**
+ * Abstract Papyrus initialization class (required to get Service activation).
+ */
+public abstract class AbstractTest4B {
+
+ public static boolean isInitialized = false;
+
+ public static IEditorPart editor = null;
+
+ public static String editorID = "org.eclipse.papyrus.infra.core.papyrusEditor";
+
+ @BeforeClass
+ public static void openPapyrusWithAParametricDiagramOwnedByBlock() throws Exception {
+ // Prepare new project for tests
+ IProject testProject = ResourcesPlugin.getWorkspace().getRoot().getProject("TestProject");
+ if(!testProject.exists()) {
+ testProject.create(new NullProgressMonitor());
+ }
+
+ if(!testProject.isOpen()) {
+ testProject.open(new NullProgressMonitor());
+ }
+
+ // Copy EmptyModel from bundle to the test project
+ final IFile emptyModel_di = testProject.getFile("ModelWithPD.di");
+ IFile emptyModel_no = testProject.getFile("ModelWithPD.notation");
+ IFile emptyModel_uml = testProject.getFile("ModelWithPD.uml");
+
+ if(!isInitialized) {
+ isInitialized = true;
+ emptyModel_di.create(Activator.getInstance().getBundle().getResource("/model/ModelWithPD.di").openStream(), true, new NullProgressMonitor());
+ emptyModel_no.create(Activator.getInstance().getBundle().getResource("/model/ModelWithPD.notation").openStream(), true, new NullProgressMonitor());
+ emptyModel_uml.create(Activator.getInstance().getBundle().getResource("/model/ModelWithPD.uml").openStream(), true, new NullProgressMonitor());
+ }
+
+ // Open the EmptyModel.di file with Papyrus (assumed to be the default editor for "di" files here).
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try {
+ editor = page.openEditor(new FileEditorInput(emptyModel_di), editorID);
+ } catch (Exception ex) {
+ ex.printStackTrace(System.out);
+ }
+ }
+ });
+
+ setActiveDiagramViewByName(Constants.PARAMETRIC_OWNED_BY_BLOCK_DIAGRAM_NAME);
+
+ Assert.assertNotNull("Failed to open the editor", editor);
+ }
+
+ public static boolean setActiveDiagramViewByName(String diagramName) throws Exception {
+ if (diagramName == null) {
+ return false;
+ }
+ ServicesRegistry serviceRegistry = (ServicesRegistry)EditorUtils.getEditor().getAdapter(ServicesRegistry.class);
+ IPageManager iPageManager = ServiceUtils.getInstance().getIPageManager(serviceRegistry);
+ List<Object> allPages = iPageManager.allPages();
+ for (Object object : allPages) {
+ if (object instanceof Diagram) {
+ if (diagramName.equals(((Diagram) object).getName())) {
+ iPageManager.selectPage(object);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @AfterClass
+ public static void closePapyrusAndCleanProject() throws Exception {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ // Close the editor without saving content created during tests
+ editor.getSite().getPage().closeEditor(editor, false);
+ }
+ });
+ editor = null;
+ }
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4CB.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4CB.java
new file mode 100644
index 00000000000..83e1c6da861
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/AbstractTest4CB.java
@@ -0,0 +1,31 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests;
+
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.Constants;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
+/**
+ * Abstract Papyrus initialization class (required to get Service activation).
+ */
+public abstract class AbstractTest4CB extends AbstractTest4B {
+
+ @BeforeClass
+ public static void openPapyrusWithAParametricDiagramOwnedByConstraintBlock() throws Exception {
+ setActiveDiagramViewByName(Constants.PARAMETRIC_OWNED_BY_CONSTRAINTBLOCK_DIAGRAM_NAME);
+
+ Assert.assertNotNull("Failed to open the editor", editor);
+ }
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationForSourcesTest.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationForSourcesTest.java
new file mode 100644
index 00000000000..b9b4712afb4
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationForSourcesTest.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.link;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createEdgeFromPalette;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.junit.Test;
+
+/**
+ * JUnit abstract tests for Link creation test (via palette tools).
+ */
+public class AbstractLinkCreationForSourcesTest extends AbstractLinkPrepareTest {
+
+ public static String toolID;
+
+ @Test
+ public void createLinkWithSourceBlock() throws Exception {
+ View sourceView = diagramContainerSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourcePart() throws Exception {
+ View sourceView = partSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceNestedPart() throws Exception {
+ View sourceView = nestedPartSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceReference() throws Exception {
+ View sourceView = referenceSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceNestedReference() throws Exception {
+ View sourceView = nestedReferenceSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceValue() throws Exception {
+ View sourceView = valueSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceNestedValue() throws Exception {
+ View sourceView = nestedValueSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceComment() throws Exception {
+ View sourceView = commentSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceCommentCN() throws Exception {
+ View sourceView = commentCNSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceConstraint() throws Exception {
+ View sourceView = constraintSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceConstraintCN() throws Exception {
+ View sourceView = constraintCNSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceDeepNestedPart() throws Exception {
+ View sourceView = subNestedPartContainer1_1_1SourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceDeepNestedProperty() throws Exception {
+ View sourceView = subNestedPropertyContainer1_1_1SourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceDeepNestedReference() throws Exception {
+ View sourceView = subNestedReferenceContainer1_1_1SourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceDeepNestedValue() throws Exception {
+ View sourceView = subNestedValueContainer1_1_1SourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationForSourcesTest4CB.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationForSourcesTest4CB.java
new file mode 100644
index 00000000000..0a263bc57bf
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationForSourcesTest4CB.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.link;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createEdgeFromPalette;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.junit.Test;
+
+/**
+ * JUnit abstract tests for Link creation test (via palette tools).
+ */
+public class AbstractLinkCreationForSourcesTest4CB extends AbstractLinkPrepareTest4CB {
+
+ public static String toolID;
+
+ @Test
+ public void createLinkWithSourceBlock() throws Exception {
+ View sourceView = diagramContainerSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourcePart() throws Exception {
+ View sourceView = partSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceNestedPart() throws Exception {
+ View sourceView = nestedPartSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceReference() throws Exception {
+ View sourceView = referenceSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceNestedReference() throws Exception {
+ View sourceView = nestedReferenceSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceValue() throws Exception {
+ View sourceView = valueSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceNestedValue() throws Exception {
+ View sourceView = nestedValueSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceComment() throws Exception {
+ View sourceView = commentSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceCommentCN() throws Exception {
+ View sourceView = commentCNSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceConstraint() throws Exception {
+ View sourceView = constraintSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceConstraintCN() throws Exception {
+ View sourceView = constraintCNSourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceDeepNestedPart() throws Exception {
+ View sourceView = subNestedPartContainer1_1_1SourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceDeepNestedProperty() throws Exception {
+ View sourceView = subNestedPropertyContainer1_1_1SourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceDeepNestedReference() throws Exception {
+ View sourceView = subNestedReferenceContainer1_1_1SourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+
+ @Test
+ public void createLinkWithSourceDeepNestedValue() throws Exception {
+ View sourceView = subNestedValueContainer1_1_1SourceView;
+ createEdgeFromPalette(toolID, sourceView, null, isCreationAllowed.get(sourceView));
+ }
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationFromElementTest.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationFromElementTest.java
new file mode 100644
index 00000000000..3afb516701d
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationFromElementTest.java
@@ -0,0 +1,148 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.link;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createEdgeConnectorFromPalette;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.AbstractLinkPrepareTest;
+import org.eclipse.uml2.uml.Property;
+import org.junit.Test;
+
+/**
+ * JUnit abstract tests for Link creation test (via palette tools).
+ */
+public class AbstractLinkCreationFromElementTest extends AbstractLinkPrepareTest {
+
+ public static String toolID;
+
+ public static View sourceView;
+
+ public static Map<View, List<Property>> expectedSourceNestedPath;
+
+ public static Map<View, List<Property>> expectedTargetNestedPath;
+
+ @Test
+ public void createLinkWithTargetBlock() throws Exception {
+ View targetView = diagramContainerTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetConstraintProperty() throws Exception {
+ View targetView = constraintPropertyTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetConstraintParameter() throws Exception {
+ View targetView = constraintParameterTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetNestedConstraintProperty() throws Exception {
+ View targetView = nestedConstraintPropertyTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetNestedConstraintParameter() throws Exception {
+ View targetView = nestedConstraintParameterTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetPart() throws Exception {
+ View targetView = partTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetNestedPart() throws Exception {
+ View targetView = nestedPartTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetReference() throws Exception {
+ View targetView = referenceTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetNestedReference() throws Exception {
+ View targetView = nestedReferenceTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetValue() throws Exception {
+ View targetView = valueTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetNestedValue() throws Exception {
+ View targetView = nestedValueTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetComment() throws Exception {
+ View targetView = commentTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetCommentCN() throws Exception {
+ View targetView = commentCNTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetConstraint() throws Exception {
+ View targetView = constraintTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetConstraintCN() throws Exception {
+ View targetView = constraintCNTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ // deep nested tests
+ @Test
+ public void createLinkWithTargetSubNestedPartContainer_1_1_1() throws Exception {
+ View targetView = subNestedPartContainer1_1_1TargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetSubNestedPartContainer_1_2_1() throws Exception {
+ View targetView = subNestedPartContainer1_2_1TargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetSubNestedPartContainer_1_1_2() throws Exception {
+ View targetView = subNestedPartContainer1_1_2TargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationFromElementTest4CB.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationFromElementTest4CB.java
new file mode 100644
index 00000000000..1ecb3078f70
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkCreationFromElementTest4CB.java
@@ -0,0 +1,147 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.link;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createEdgeConnectorFromPalette;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.uml2.uml.Property;
+import org.junit.Test;
+
+/**
+ * JUnit abstract tests for Link creation test (via palette tools).
+ */
+public class AbstractLinkCreationFromElementTest4CB extends AbstractLinkPrepareTest4CB {
+
+ public static String toolID;
+
+ public static View sourceView;
+
+ public static Map<View, List<Property>> expectedSourceNestedPath;
+
+ public static Map<View, List<Property>> expectedTargetNestedPath;
+
+ @Test
+ public void createLinkWithTargetBlock() throws Exception {
+ View targetView = diagramContainerTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetConstraintProperty() throws Exception {
+ View targetView = constraintPropertyTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetNestedConstraintProperty() throws Exception {
+ View targetView = nestedConstraintPropertyTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetConstraintParameter() throws Exception {
+ View targetView = constraintParameterTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetNestedConstraintParameter() throws Exception {
+ View targetView = nestedConstraintParameterTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetPart() throws Exception {
+ View targetView = partTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetNestedPart() throws Exception {
+ View targetView = nestedPartTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetReference() throws Exception {
+ View targetView = referenceTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetNestedReference() throws Exception {
+ View targetView = nestedReferenceTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetValue() throws Exception {
+ View targetView = valueTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetNestedValue() throws Exception {
+ View targetView = nestedValueTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetComment() throws Exception {
+ View targetView = commentTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetCommentCN() throws Exception {
+ View targetView = commentCNTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetConstraint() throws Exception {
+ View targetView = constraintTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetConstraintCN() throws Exception {
+ View targetView = constraintCNTargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ // deep nested tests
+ @Test
+ public void createLinkWithTargetSubNestedPartContainer_1_1_1() throws Exception {
+ View targetView = subNestedPartContainer1_1_1TargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetSubNestedPartContainer_1_2_1() throws Exception {
+ View targetView = subNestedPartContainer1_2_1TargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+ @Test
+ public void createLinkWithTargetSubNestedPartContainer_1_1_2() throws Exception {
+ View targetView = subNestedPartContainer1_1_2TargetView;
+ createEdgeConnectorFromPalette(toolID, sourceView, targetView, isCreationAllowed.get(targetView), expectedSourceNestedPath.get(targetView), expectedTargetNestedPath.get(targetView));
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkPrepareTest.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkPrepareTest.java
new file mode 100644
index 00000000000..caadfbcf640
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkPrepareTest.java
@@ -0,0 +1,173 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.link;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.junit.BeforeClass;
+
+/**
+ * JUnit tests for link creation test (via palette tools).
+ */
+public class AbstractLinkPrepareTest extends AbstractTest4B {
+
+ public static String toolID;
+
+ // Custom nodes
+ public static View diagramContainerSourceView, diagramContainerTargetView;
+
+ // Custom child label nodes
+ public static View constraintPropertySourceView, constraintPropertyTargetView;
+ public static View constraintParameterSourceView, constraintParameterTargetView;
+ public static View nestedConstraintPropertySourceView, nestedConstraintPropertyTargetView;
+ public static View nestedConstraintParameterSourceView, nestedConstraintParameterTargetView;
+ public static View partSourceView, partTargetView;
+ public static View nestedPartSourceView, nestedPartTargetView;
+ public static View referenceSourceView, referenceTargetView;
+ public static View nestedReferenceSourceView, nestedReferenceTargetView;
+ public static View valueSourceView, valueTargetView;
+ public static View nestedValueSourceView, nestedValueTargetView;
+
+ // Inherited nodes
+ public static View commentSourceView, commentTargetView, commentCNSourceView, commentCNTargetView;
+ public static View constraintSourceView, constraintTargetView, constraintCNSourceView, constraintCNTargetView;
+
+ public static View partContainer1; // Its type block may be set encapsulated for testing purpose.
+ public static View partContainer2; // Its type block may be set encapsulated for testing purpose.
+
+ public static Map<View, Boolean> isCreationAllowed = new HashMap<View, Boolean>();
+
+ public static View subNestedPartContainer1_1_1SourceView;
+
+ public static View subNestedPartContainer1_2_1TargetView;
+
+ public static View subNestedPartContainer1_1_1TargetView;
+
+ public static View subNestedPartContainer1_1_2TargetView;
+
+ public static View subNestedPropertyContainer1_1_1SourceView;
+
+ public static View subNestedPropertyContainer1_1_1TargetView;
+
+ public static View subNestedPropertyContainer1_2_1TargetView;
+
+ public static View subNestedPropertyContainer1_1_2TargetView;
+
+ public static View subNestedReferenceContainer1_1_1SourceView;
+
+ public static View subNestedReferenceContainer1_1_1TargetView;
+
+ public static View subNestedReferenceContainer1_2_1TargetView;
+
+ public static View subNestedReferenceContainer1_1_2TargetView;
+
+ public static View subNestedValueContainer1_1_1SourceView;
+
+ public static View subNestedValueContainer1_1_1TargetView, subNestedValueContainer1_2_1TargetView, subNestedValueContainer1_1_2TargetView;
+
+ public static View nestedPartContainer1_1;
+
+ public static View nestedPartContainer2_1;
+
+ public static View nestedPartContainer1_2;
+
+ @BeforeClass
+ public static void prepareInheritedNodes() throws Exception {
+ View container = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View containerCpt = ViewUtil.getChildBySemanticHint(container, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+
+ // Prepare elements for link creation tests
+ commentSourceView = createGraphicalNode(UMLElementTypes.COMMENT, ElementTypes.COMMENT.getSemanticHint(), getDiagramView());
+ commentTargetView = createGraphicalNode(UMLElementTypes.COMMENT, ElementTypes.COMMENT.getSemanticHint(), getDiagramView());
+ commentCNSourceView = createGraphicalNode(UMLElementTypes.COMMENT, ElementTypes.COMMENT_CN.getSemanticHint(), containerCpt);
+ commentCNTargetView = createGraphicalNode(UMLElementTypes.COMMENT, ElementTypes.COMMENT_CN.getSemanticHint(), containerCpt);
+
+ constraintSourceView = createGraphicalNode(UMLElementTypes.CONSTRAINT, ElementTypes.CONSTRAINT.getSemanticHint(), getDiagramView());
+ constraintTargetView = createGraphicalNode(UMLElementTypes.CONSTRAINT, ElementTypes.CONSTRAINT.getSemanticHint(), getDiagramView());
+ constraintCNSourceView = createGraphicalNode(UMLElementTypes.CONSTRAINT, ElementTypes.CONSTRAINT_CN.getSemanticHint(), containerCpt);
+ constraintCNTargetView = createGraphicalNode(UMLElementTypes.CONSTRAINT, ElementTypes.CONSTRAINT_CN.getSemanticHint(), containerCpt);
+ }
+
+ @BeforeClass
+ public static void prepareCustomNodes() throws Exception {
+ View container = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View constainerStructureView = ViewUtil.getChildBySemanticHint(container, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+ // part in block (level = 1)
+ partContainer1 = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ View partContainer1StructureView = ViewUtil.getChildBySemanticHint(partContainer1, SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID);
+ partContainer2 = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ View partContainer2StructureView = ViewUtil.getChildBySemanticHint(partContainer2, SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID);
+
+
+ nestedPartContainer1_1 = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ nestedPartContainer2_1 = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ nestedPartContainer1_2 = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer2StructureView);
+
+ // Prepare elements for link creation tests
+ diagramContainerSourceView = container;
+ diagramContainerTargetView = container;
+
+ // Prepare child nodes
+
+ constraintPropertySourceView = createGraphicalNode(SysMLElementTypes.CONSTRAINT_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ constraintParameterSourceView = createGraphicalNode(UMLElementTypes.PROPERTY, UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID, constraintPropertySourceView);
+
+ constraintPropertyTargetView = createGraphicalNode(SysMLElementTypes.CONSTRAINT_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ constraintParameterTargetView = createGraphicalNode(UMLElementTypes.PROPERTY, UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID, constraintPropertyTargetView);
+
+ partSourceView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ partTargetView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ nestedPartSourceView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ nestedPartTargetView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ subNestedPartContainer1_1_1SourceView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_1);
+ subNestedPartContainer1_1_1TargetView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_1);
+ subNestedPartContainer1_2_1TargetView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer2_1);
+ subNestedPartContainer1_1_2TargetView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_2);
+
+ nestedConstraintPropertySourceView = createGraphicalNode(SysMLElementTypes.CONSTRAINT_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ nestedConstraintParameterSourceView = createGraphicalNode(UMLElementTypes.PROPERTY, UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID, nestedConstraintPropertySourceView);
+ nestedConstraintPropertyTargetView = createGraphicalNode(SysMLElementTypes.CONSTRAINT_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID, partContainer2StructureView);
+ nestedConstraintParameterTargetView = createGraphicalNode(UMLElementTypes.PROPERTY, UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID, nestedConstraintPropertyTargetView);
+
+ referenceSourceView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ referenceTargetView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ nestedReferenceSourceView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ nestedReferenceTargetView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ subNestedReferenceContainer1_1_1SourceView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_1);
+ subNestedReferenceContainer1_1_1TargetView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_1);
+ subNestedReferenceContainer1_2_1TargetView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer2_1);
+ subNestedReferenceContainer1_1_2TargetView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_2);
+
+ valueSourceView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ valueTargetView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ nestedValueSourceView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ nestedValueTargetView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ subNestedValueContainer1_1_1SourceView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_1);
+ subNestedValueContainer1_1_1TargetView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_1);
+ subNestedValueContainer1_2_1TargetView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer2_1);
+ subNestedValueContainer1_1_2TargetView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_2);
+ }
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkPrepareTest4CB.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkPrepareTest4CB.java
new file mode 100644
index 00000000000..6d4b4d79020
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/AbstractLinkPrepareTest4CB.java
@@ -0,0 +1,174 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.link;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4CB;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.junit.BeforeClass;
+
+/**
+ * JUnit tests for link creation test (via palette tools).
+ */
+public class AbstractLinkPrepareTest4CB extends AbstractTest4CB {
+
+ public static String toolID;
+
+ // Custom nodes
+ public static View diagramContainerSourceView, diagramContainerTargetView;
+
+ // Custom child label nodes
+ public static View constraintPropertySourceView, constraintPropertyTargetView;
+ public static View constraintParameterSourceView, constraintParameterTargetView;
+ public static View nestedConstraintPropertySourceView, nestedConstraintPropertyTargetView;
+ public static View nestedConstraintParameterSourceView, nestedConstraintParameterTargetView;
+ public static View partSourceView, partTargetView;
+ public static View nestedPartSourceView, nestedPartTargetView;
+ public static View referenceSourceView, referenceTargetView;
+ public static View nestedReferenceSourceView, nestedReferenceTargetView;
+ public static View valueSourceView, valueTargetView;
+ public static View nestedValueSourceView, nestedValueTargetView;
+
+ // Inherited nodes
+ public static View commentSourceView, commentTargetView, commentCNSourceView, commentCNTargetView;
+ public static View constraintSourceView, constraintTargetView, constraintCNSourceView, constraintCNTargetView;
+
+ public static View partContainer1; // Its type block may be set encapsulated for testing purpose.
+ public static View partContainer2; // Its type block may be set encapsulated for testing purpose.
+
+ public static Map<View, Boolean> isCreationAllowed = new HashMap<View, Boolean>();
+
+ public static View subNestedPartContainer1_1_1SourceView;
+
+ public static View subNestedPartContainer1_2_1TargetView;
+
+ public static View subNestedPartContainer1_1_1TargetView;
+
+ public static View subNestedPartContainer1_1_2TargetView;
+
+ public static View subNestedPropertyContainer1_1_1SourceView;
+
+ public static View subNestedPropertyContainer1_1_1TargetView;
+
+ public static View subNestedPropertyContainer1_2_1TargetView;
+
+ public static View subNestedPropertyContainer1_1_2TargetView;
+
+ public static View subNestedReferenceContainer1_1_1SourceView;
+
+ public static View subNestedReferenceContainer1_1_1TargetView;
+
+ public static View subNestedReferenceContainer1_2_1TargetView;
+
+ public static View subNestedReferenceContainer1_1_2TargetView;
+
+ public static View subNestedValueContainer1_1_1SourceView;
+
+ public static View subNestedValueContainer1_1_1TargetView, subNestedValueContainer1_2_1TargetView, subNestedValueContainer1_1_2TargetView;
+
+ public static View nestedPartContainer1_1;
+
+ public static View nestedPartContainer2_1;
+
+ public static View nestedPartContainer1_2;
+
+ @BeforeClass
+ public static void prepareInheritedNodes() throws Exception {
+ View container = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View containerCpt = ViewUtil.getChildBySemanticHint(container, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+
+ // Prepare elements for link creation tests
+ commentSourceView = createGraphicalNode(UMLElementTypes.COMMENT, ElementTypes.COMMENT.getSemanticHint(), getDiagramView());
+ commentTargetView = createGraphicalNode(UMLElementTypes.COMMENT, ElementTypes.COMMENT.getSemanticHint(), getDiagramView());
+ commentCNSourceView = createGraphicalNode(UMLElementTypes.COMMENT, ElementTypes.COMMENT_CN.getSemanticHint(), containerCpt);
+ commentCNTargetView = createGraphicalNode(UMLElementTypes.COMMENT, ElementTypes.COMMENT_CN.getSemanticHint(), containerCpt);
+
+ constraintSourceView = createGraphicalNode(UMLElementTypes.CONSTRAINT, ElementTypes.CONSTRAINT.getSemanticHint(), getDiagramView());
+ constraintTargetView = createGraphicalNode(UMLElementTypes.CONSTRAINT, ElementTypes.CONSTRAINT.getSemanticHint(), getDiagramView());
+ constraintCNSourceView = createGraphicalNode(UMLElementTypes.CONSTRAINT, ElementTypes.CONSTRAINT_CN.getSemanticHint(), containerCpt);
+ constraintCNTargetView = createGraphicalNode(UMLElementTypes.CONSTRAINT, ElementTypes.CONSTRAINT_CN.getSemanticHint(), containerCpt);
+ }
+
+ @BeforeClass
+ public static void prepareCustomNodes() throws Exception {
+ View container = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View constainerStructureView = ViewUtil.getChildBySemanticHint(container, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+ // part in block (level = 1)
+ partContainer1 = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ View partContainer1StructureView = ViewUtil.getChildBySemanticHint(partContainer1, SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID);
+ partContainer2 = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ View partContainer2StructureView = ViewUtil.getChildBySemanticHint(partContainer2, SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID);
+
+
+ nestedPartContainer1_1 = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ nestedPartContainer2_1 = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ nestedPartContainer1_2 = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer2StructureView);
+
+ // Prepare elements for link creation tests
+ diagramContainerSourceView = container;
+ diagramContainerTargetView = container;
+
+ // Prepare child nodes
+
+ constraintPropertySourceView = createGraphicalNode(SysMLElementTypes.CONSTRAINT_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ constraintParameterSourceView = createGraphicalNode(UMLElementTypes.PROPERTY, UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID, constraintPropertySourceView);
+
+ constraintPropertyTargetView = createGraphicalNode(SysMLElementTypes.CONSTRAINT_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ constraintParameterTargetView = createGraphicalNode(UMLElementTypes.PROPERTY, UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID, constraintPropertyTargetView);
+
+
+ partSourceView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ partTargetView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ nestedPartSourceView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ nestedPartTargetView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ subNestedPartContainer1_1_1SourceView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_1);
+ subNestedPartContainer1_1_1TargetView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_1);
+ subNestedPartContainer1_2_1TargetView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer2_1);
+ subNestedPartContainer1_1_2TargetView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_2);
+
+ nestedConstraintPropertySourceView = createGraphicalNode(SysMLElementTypes.CONSTRAINT_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ nestedConstraintParameterSourceView = createGraphicalNode(UMLElementTypes.PROPERTY, UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID, nestedConstraintPropertySourceView);
+ nestedConstraintPropertyTargetView = createGraphicalNode(SysMLElementTypes.CONSTRAINT_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID, partContainer2StructureView);
+ nestedConstraintParameterTargetView = createGraphicalNode(UMLElementTypes.PROPERTY, UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID, nestedConstraintPropertyTargetView);
+
+ referenceSourceView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ referenceTargetView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ nestedReferenceSourceView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ nestedReferenceTargetView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ subNestedReferenceContainer1_1_1SourceView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_1);
+ subNestedReferenceContainer1_1_1TargetView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_1);
+ subNestedReferenceContainer1_2_1TargetView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer2_1);
+ subNestedReferenceContainer1_1_2TargetView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_2);
+
+ valueSourceView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ valueTargetView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, constainerStructureView);
+ nestedValueSourceView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ nestedValueTargetView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, partContainer1StructureView);
+ subNestedValueContainer1_1_1SourceView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_1);
+ subNestedValueContainer1_1_1TargetView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_1);
+ subNestedValueContainer1_2_1TargetView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer2_1);
+ subNestedValueContainer1_1_2TargetView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, nestedPartContainer1_2);
+ }
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromConstraintParameter.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromConstraintParameter.java
new file mode 100644
index 00000000000..7de8fdfbc72
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromConstraintParameter.java
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.link.connector;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.AbstractLinkCreationFromElementTest;
+import org.eclipse.uml2.uml.Property;
+import org.junit.BeforeClass;
+
+/**
+ * JUnit tests for Connector link creation test (via palette tools).
+ */
+public class TestLinkCreationConnectorFromConstraintParameter extends AbstractLinkCreationFromElementTest {
+
+ @BeforeClass
+ public static void initSource() throws Exception {
+ sourceView = constraintParameterSourceView;
+ }
+
+ @BeforeClass
+ public static void initToolID() throws Exception {
+ toolID = "parametric.tool.connector";
+ }
+
+ @BeforeClass
+ public static void initExpectedResults() throws Exception {
+
+ // Initialize source creation results
+ isCreationAllowed = new HashMap<View, Boolean>();
+
+ isCreationAllowed.put(diagramContainerTargetView, false);
+
+ isCreationAllowed.put(constraintPropertyTargetView, false);
+ isCreationAllowed.put(constraintParameterTargetView, true);
+ isCreationAllowed.put(nestedConstraintPropertyTargetView, false);
+ isCreationAllowed.put(nestedConstraintParameterTargetView, true);
+
+ isCreationAllowed.put(partTargetView, true);
+ isCreationAllowed.put(nestedPartTargetView, true);
+ isCreationAllowed.put(subNestedPartContainer1_1_1TargetView, true);
+ isCreationAllowed.put(subNestedPartContainer1_2_1TargetView, true);
+ isCreationAllowed.put(subNestedPartContainer1_1_2TargetView, true);
+
+ isCreationAllowed.put(referenceTargetView, true);
+ isCreationAllowed.put(nestedReferenceTargetView, true);
+
+ isCreationAllowed.put(valueTargetView, true);
+ isCreationAllowed.put(nestedValueTargetView, true);
+
+ isCreationAllowed.put(commentTargetView, false);
+ isCreationAllowed.put(commentCNTargetView, false);
+ isCreationAllowed.put(constraintTargetView, false);
+ isCreationAllowed.put(constraintCNTargetView, false);
+
+ // Initialize nested property path for tests
+ expectedSourceNestedPath = new HashMap<View, List<Property>>();
+ expectedTargetNestedPath = new HashMap<View, List<Property>>();
+
+ List<Property> nestedPath = Arrays.asList(new Property[]{ (Property)constraintPropertySourceView.getElement() });
+ List<Property> emptyPath = Collections.emptyList();
+ for(View view : isCreationAllowed.keySet()) {
+ expectedSourceNestedPath.put(view, nestedPath);
+ expectedTargetNestedPath.put(view, emptyPath);
+ }
+
+ nestedPath = Arrays.asList(new Property[]{ (Property)constraintPropertyTargetView.getElement() });
+ expectedTargetNestedPath.put(constraintParameterTargetView, nestedPath);
+
+ nestedPath = Arrays.asList(new Property[]{ (Property)partContainer2.getElement(), (Property)nestedConstraintPropertyTargetView.getElement()});
+ expectedTargetNestedPath.put(nestedConstraintParameterTargetView, nestedPath);
+
+ nestedPath = Arrays.asList(new Property[]{ (Property)partContainer1.getElement()});
+ expectedTargetNestedPath.put(nestedPartTargetView, nestedPath);
+
+ nestedPath = Arrays.asList(new Property[]{ (Property)partContainer1.getElement()});
+ expectedTargetNestedPath.put(nestedValueTargetView, nestedPath);
+
+ nestedPath = Arrays.asList(new Property[]{ (Property)partContainer1.getElement()});
+ expectedTargetNestedPath.put(nestedReferenceTargetView, nestedPath);
+
+ nestedPath = Arrays.asList(new Property[]{ (Property)partContainer1.getElement(), (Property)nestedPartContainer1_1.getElement()});
+ expectedTargetNestedPath.put(subNestedPartContainer1_1_1TargetView, nestedPath);
+
+ nestedPath = Arrays.asList(new Property[]{ (Property)partContainer1.getElement(), (Property)nestedPartContainer2_1.getElement()});
+ expectedTargetNestedPath.put(subNestedPartContainer1_2_1TargetView, nestedPath);
+
+ nestedPath = Arrays.asList(new Property[]{ (Property)partContainer2.getElement(), (Property)nestedPartContainer1_2.getElement()});
+ expectedTargetNestedPath.put(subNestedPartContainer1_1_2TargetView, nestedPath);
+
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromPart.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromPart.java
new file mode 100644
index 00000000000..7ffb4c67299
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromPart.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.link.connector;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.AbstractLinkCreationFromElementTest;
+import org.eclipse.uml2.uml.Property;
+import org.junit.BeforeClass;
+
+/**
+ * JUnit tests for Connector link creation test (via palette tools).
+ */
+public class TestLinkCreationConnectorFromPart extends AbstractLinkCreationFromElementTest {
+
+ @BeforeClass
+ public static void initSource() throws Exception {
+ sourceView = partSourceView;
+ }
+
+ @BeforeClass
+ public static void initToolID() throws Exception {
+ toolID = "parametric.tool.connector";
+ }
+
+ @BeforeClass
+ public static void initExpectedResults() throws Exception {
+
+ // Initialize source creation results
+ isCreationAllowed = new HashMap<View, Boolean>();
+
+ isCreationAllowed.put(diagramContainerTargetView, false);
+
+ isCreationAllowed.put(constraintPropertyTargetView, false);
+ isCreationAllowed.put(constraintParameterTargetView, true);
+ isCreationAllowed.put(nestedConstraintPropertyTargetView, false);
+ isCreationAllowed.put(nestedConstraintParameterTargetView, true);
+
+ isCreationAllowed.put(partTargetView, false);
+ isCreationAllowed.put(nestedPartTargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_1_1TargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_2_1TargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_1_2TargetView, false);
+
+ isCreationAllowed.put(referenceTargetView, false);
+ isCreationAllowed.put(nestedReferenceTargetView, false);
+
+ isCreationAllowed.put(valueTargetView, false);
+ isCreationAllowed.put(nestedValueTargetView, false);
+
+ isCreationAllowed.put(commentTargetView, false);
+ isCreationAllowed.put(commentCNTargetView, false);
+ isCreationAllowed.put(constraintTargetView, false);
+ isCreationAllowed.put(constraintCNTargetView, false);
+
+ // Initialize nested property path for tests
+ expectedSourceNestedPath = new HashMap<View, List<Property>>();
+ expectedTargetNestedPath = new HashMap<View, List<Property>>();
+
+ List<Property> emptyPath = Collections.emptyList();
+ for(View view : isCreationAllowed.keySet()) {
+ expectedSourceNestedPath.put(view, emptyPath);
+ expectedTargetNestedPath.put(view, emptyPath);
+ }
+
+ List<Property> nestedPath = Arrays.asList(new Property[]{ (Property)constraintPropertyTargetView.getElement() });
+ expectedTargetNestedPath.put(constraintParameterTargetView, nestedPath);
+ nestedPath = Arrays.asList(new Property[]{ (Property)partContainer2.getElement(), (Property)nestedConstraintPropertyTargetView.getElement()});
+ expectedTargetNestedPath.put(nestedConstraintParameterTargetView, nestedPath);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromPart4CB.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromPart4CB.java
new file mode 100644
index 00000000000..d09f92fd9ad
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromPart4CB.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.link.connector;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.AbstractLinkCreationFromElementTest4CB;
+import org.eclipse.uml2.uml.Property;
+import org.junit.BeforeClass;
+
+/**
+ * JUnit tests for Connector link creation test (via palette tools).
+ */
+public class TestLinkCreationConnectorFromPart4CB extends AbstractLinkCreationFromElementTest4CB {
+
+ @BeforeClass
+ public static void initSource() throws Exception {
+ sourceView = partSourceView;
+ }
+
+ @BeforeClass
+ public static void initToolID() throws Exception {
+ toolID = "parametric.tool.connector";
+ }
+
+ @BeforeClass
+ public static void initExpectedResults() throws Exception {
+
+ // Initialize source creation results
+ isCreationAllowed = new HashMap<View, Boolean>();
+
+ isCreationAllowed.put(diagramContainerTargetView, false);
+
+ isCreationAllowed.put(constraintPropertyTargetView, false);
+ isCreationAllowed.put(constraintParameterTargetView, true);
+ isCreationAllowed.put(nestedConstraintPropertyTargetView, false);
+ isCreationAllowed.put(nestedConstraintParameterTargetView, true);
+
+ isCreationAllowed.put(partTargetView, false);
+ isCreationAllowed.put(nestedPartTargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_1_1TargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_2_1TargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_1_2TargetView, false);
+
+ isCreationAllowed.put(referenceTargetView, false);
+ isCreationAllowed.put(nestedReferenceTargetView, false);
+
+ isCreationAllowed.put(valueTargetView, false);
+ isCreationAllowed.put(nestedValueTargetView, false);
+
+ isCreationAllowed.put(commentTargetView, false);
+ isCreationAllowed.put(commentCNTargetView, false);
+ isCreationAllowed.put(constraintTargetView, false);
+ isCreationAllowed.put(constraintCNTargetView, false);
+
+ // Initialize nested property path for tests
+ expectedSourceNestedPath = new HashMap<View, List<Property>>();
+ expectedTargetNestedPath = new HashMap<View, List<Property>>();
+
+ List<Property> emptyPath = Collections.emptyList();
+ for(View view : isCreationAllowed.keySet()) {
+ expectedSourceNestedPath.put(view, emptyPath);
+ expectedTargetNestedPath.put(view, emptyPath);
+ }
+
+ List<Property> nestedPath = Arrays.asList(new Property[]{ (Property)constraintPropertyTargetView.getElement() });
+ expectedTargetNestedPath.put(constraintParameterTargetView, nestedPath);
+ nestedPath = Arrays.asList(new Property[]{ (Property)partContainer2.getElement(), (Property)nestedConstraintPropertyTargetView.getElement()});
+ expectedTargetNestedPath.put(nestedConstraintParameterTargetView, nestedPath);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromReference.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromReference.java
new file mode 100644
index 00000000000..9132831b0a7
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromReference.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.link.connector;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.AbstractLinkCreationFromElementTest;
+import org.eclipse.uml2.uml.Property;
+import org.junit.BeforeClass;
+
+/**
+ * JUnit tests for Connector link creation test (via palette tools).
+ */
+public class TestLinkCreationConnectorFromReference extends AbstractLinkCreationFromElementTest {
+
+ @BeforeClass
+ public static void initSource() throws Exception {
+ sourceView = referenceSourceView;
+ }
+
+ @BeforeClass
+ public static void initToolID() throws Exception {
+ toolID = "parametric.tool.connector";
+ }
+
+ @BeforeClass
+ public static void initExpectedResults() throws Exception {
+
+ // Initialize source creation results
+ isCreationAllowed = new HashMap<View, Boolean>();
+
+ isCreationAllowed.put(diagramContainerTargetView, false);
+
+ isCreationAllowed.put(constraintPropertyTargetView, false);
+ isCreationAllowed.put(constraintParameterTargetView, true);
+ isCreationAllowed.put(nestedConstraintPropertyTargetView, false);
+ isCreationAllowed.put(nestedConstraintParameterTargetView, true);
+
+ isCreationAllowed.put(partTargetView, false);
+ isCreationAllowed.put(nestedPartTargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_1_1TargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_2_1TargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_1_2TargetView, false);
+
+ isCreationAllowed.put(referenceTargetView, false);
+ isCreationAllowed.put(nestedReferenceTargetView, false);
+
+ isCreationAllowed.put(valueTargetView, false);
+ isCreationAllowed.put(nestedValueTargetView, false);
+
+ isCreationAllowed.put(commentTargetView, false);
+ isCreationAllowed.put(commentCNTargetView, false);
+ isCreationAllowed.put(constraintTargetView, false);
+ isCreationAllowed.put(constraintCNTargetView, false);
+
+ // Initialize nested property path for tests
+ expectedSourceNestedPath = new HashMap<View, List<Property>>();
+ expectedTargetNestedPath = new HashMap<View, List<Property>>();
+
+ List<Property> emptyPath = Collections.emptyList();
+ for(View view : isCreationAllowed.keySet()) {
+ expectedSourceNestedPath.put(view, emptyPath);
+ expectedTargetNestedPath.put(view, emptyPath);
+ }
+
+ List<Property> nestedPath = Arrays.asList(new Property[]{ (Property)constraintPropertyTargetView.getElement() });
+ expectedTargetNestedPath.put(constraintParameterTargetView, nestedPath);
+ nestedPath = Arrays.asList(new Property[]{ (Property)partContainer2.getElement(), (Property)nestedConstraintPropertyTargetView.getElement()});
+ expectedTargetNestedPath.put(nestedConstraintParameterTargetView, nestedPath);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromReference4CB.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromReference4CB.java
new file mode 100644
index 00000000000..3c7ccb51303
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromReference4CB.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.link.connector;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.AbstractLinkCreationFromElementTest4CB;
+import org.eclipse.uml2.uml.Property;
+import org.junit.BeforeClass;
+
+/**
+ * JUnit tests for Connector link creation test (via palette tools).
+ */
+public class TestLinkCreationConnectorFromReference4CB extends AbstractLinkCreationFromElementTest4CB {
+
+ @BeforeClass
+ public static void initSource() throws Exception {
+ sourceView = referenceSourceView;
+ }
+
+ @BeforeClass
+ public static void initToolID() throws Exception {
+ toolID = "parametric.tool.connector";
+ }
+
+ @BeforeClass
+ public static void initExpectedResults() throws Exception {
+
+ // Initialize source creation results
+ isCreationAllowed = new HashMap<View, Boolean>();
+
+ isCreationAllowed.put(diagramContainerTargetView, false);
+
+ isCreationAllowed.put(constraintPropertyTargetView, false);
+ isCreationAllowed.put(constraintParameterTargetView, true);
+ isCreationAllowed.put(nestedConstraintPropertyTargetView, false);
+ isCreationAllowed.put(nestedConstraintParameterTargetView, true);
+
+ isCreationAllowed.put(partTargetView, false);
+ isCreationAllowed.put(nestedPartTargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_1_1TargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_2_1TargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_1_2TargetView, false);
+
+ isCreationAllowed.put(referenceTargetView, false);
+ isCreationAllowed.put(nestedReferenceTargetView, false);
+
+ isCreationAllowed.put(valueTargetView, false);
+ isCreationAllowed.put(nestedValueTargetView, false);
+
+ isCreationAllowed.put(commentTargetView, false);
+ isCreationAllowed.put(commentCNTargetView, false);
+ isCreationAllowed.put(constraintTargetView, false);
+ isCreationAllowed.put(constraintCNTargetView, false);
+
+ // Initialize nested property path for tests
+ expectedSourceNestedPath = new HashMap<View, List<Property>>();
+ expectedTargetNestedPath = new HashMap<View, List<Property>>();
+
+ List<Property> emptyPath = Collections.emptyList();
+ for(View view : isCreationAllowed.keySet()) {
+ expectedSourceNestedPath.put(view, emptyPath);
+ expectedTargetNestedPath.put(view, emptyPath);
+ }
+
+ List<Property> nestedPath = Arrays.asList(new Property[]{ (Property)constraintPropertyTargetView.getElement() });
+ expectedTargetNestedPath.put(constraintParameterTargetView, nestedPath);
+ nestedPath = Arrays.asList(new Property[]{ (Property)partContainer2.getElement(), (Property)nestedConstraintPropertyTargetView.getElement()});
+ expectedTargetNestedPath.put(nestedConstraintParameterTargetView, nestedPath);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromValue.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromValue.java
new file mode 100644
index 00000000000..926c08ea1ee
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromValue.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.link.connector;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.AbstractLinkCreationFromElementTest;
+import org.eclipse.uml2.uml.Property;
+import org.junit.BeforeClass;
+
+/**
+ * JUnit tests for Connector link creation test (via palette tools).
+ */
+public class TestLinkCreationConnectorFromValue extends AbstractLinkCreationFromElementTest {
+
+ @BeforeClass
+ public static void initSource() throws Exception {
+ sourceView = valueSourceView;
+ }
+
+ @BeforeClass
+ public static void initToolID() throws Exception {
+ toolID = "parametric.tool.connector";
+ }
+
+ @BeforeClass
+ public static void initExpectedResults() throws Exception {
+
+ // Initialize source creation results
+ isCreationAllowed = new HashMap<View, Boolean>();
+
+ isCreationAllowed.put(diagramContainerTargetView, false);
+
+ isCreationAllowed.put(constraintPropertyTargetView, false);
+ isCreationAllowed.put(constraintParameterTargetView, true);
+ isCreationAllowed.put(nestedConstraintPropertyTargetView, false);
+ isCreationAllowed.put(nestedConstraintParameterTargetView, true);
+
+ isCreationAllowed.put(partTargetView, false);
+ isCreationAllowed.put(nestedPartTargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_1_1TargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_2_1TargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_1_2TargetView, false);
+
+ isCreationAllowed.put(referenceTargetView, false);
+ isCreationAllowed.put(nestedReferenceTargetView, false);
+
+ isCreationAllowed.put(valueTargetView, false);
+ isCreationAllowed.put(nestedValueTargetView, false);
+
+ isCreationAllowed.put(commentTargetView, false);
+ isCreationAllowed.put(commentCNTargetView, false);
+ isCreationAllowed.put(constraintTargetView, false);
+ isCreationAllowed.put(constraintCNTargetView, false);
+
+ // Initialize nested property path for tests
+ expectedSourceNestedPath = new HashMap<View, List<Property>>();
+ expectedTargetNestedPath = new HashMap<View, List<Property>>();
+
+ List<Property> emptyPath = Collections.emptyList();
+ for(View view : isCreationAllowed.keySet()) {
+ expectedSourceNestedPath.put(view, emptyPath);
+ expectedTargetNestedPath.put(view, emptyPath);
+ }
+
+ List<Property> nestedPath = Arrays.asList(new Property[]{ (Property)constraintPropertyTargetView.getElement() });
+ expectedTargetNestedPath.put(constraintParameterTargetView, nestedPath);
+ nestedPath = Arrays.asList(new Property[]{ (Property)partContainer2.getElement(), (Property)nestedConstraintPropertyTargetView.getElement()});
+ expectedTargetNestedPath.put(nestedConstraintParameterTargetView, nestedPath);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromValue4CB.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromValue4CB.java
new file mode 100644
index 00000000000..080d99bd630
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/link/connector/TestLinkCreationConnectorFromValue4CB.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.link.connector;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.AbstractLinkCreationFromElementTest4CB;
+import org.eclipse.uml2.uml.Property;
+import org.junit.BeforeClass;
+
+/**
+ * JUnit tests for Connector link creation test (via palette tools).
+ */
+public class TestLinkCreationConnectorFromValue4CB extends AbstractLinkCreationFromElementTest4CB {
+
+ @BeforeClass
+ public static void initSource() throws Exception {
+ sourceView = valueSourceView;
+ }
+
+ @BeforeClass
+ public static void initToolID() throws Exception {
+ toolID = "parametric.tool.connector";
+ }
+
+ @BeforeClass
+ public static void initExpectedResults() throws Exception {
+
+ // Initialize source creation results
+ isCreationAllowed = new HashMap<View, Boolean>();
+
+ isCreationAllowed.put(diagramContainerTargetView, false);
+
+ isCreationAllowed.put(constraintPropertyTargetView, false);
+ isCreationAllowed.put(constraintParameterTargetView, true);
+ isCreationAllowed.put(nestedConstraintPropertyTargetView, false);
+ isCreationAllowed.put(nestedConstraintParameterTargetView, true);
+
+ isCreationAllowed.put(partTargetView, false);
+ isCreationAllowed.put(nestedPartTargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_1_1TargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_2_1TargetView, false);
+ isCreationAllowed.put(subNestedPartContainer1_1_2TargetView, false);
+
+ isCreationAllowed.put(referenceTargetView, false);
+ isCreationAllowed.put(nestedReferenceTargetView, false);
+
+ isCreationAllowed.put(valueTargetView, false);
+ isCreationAllowed.put(nestedValueTargetView, false);
+
+ isCreationAllowed.put(commentTargetView, false);
+ isCreationAllowed.put(commentCNTargetView, false);
+ isCreationAllowed.put(constraintTargetView, false);
+ isCreationAllowed.put(constraintCNTargetView, false);
+
+ // Initialize nested property path for tests
+ expectedSourceNestedPath = new HashMap<View, List<Property>>();
+ expectedTargetNestedPath = new HashMap<View, List<Property>>();
+
+ List<Property> emptyPath = Collections.emptyList();
+ for(View view : isCreationAllowed.keySet()) {
+ expectedSourceNestedPath.put(view, emptyPath);
+ expectedTargetNestedPath.put(view, emptyPath);
+ }
+
+ List<Property> nestedPath = Arrays.asList(new Property[]{ (Property)constraintPropertyTargetView.getElement() });
+ expectedTargetNestedPath.put(constraintParameterTargetView, nestedPath);
+ nestedPath = Arrays.asList(new Property[]{ (Property)partContainer2.getElement(), (Property)nestedConstraintPropertyTargetView.getElement()});
+ expectedTargetNestedPath.put(nestedConstraintParameterTargetView, nestedPath);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnBlock.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnBlock.java
new file mode 100644
index 00000000000..f4c707ea4e4
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnBlock.java
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnBlock extends AbstractTest4B {
+
+ public static View blockView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+
+ if(blockView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", blockView, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", blockView, false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", blockView, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", blockView, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", blockView, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", blockView, false);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", blockView, false);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnBlockStructureCompartment.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnBlockStructureCompartment.java
new file mode 100644
index 00000000000..40cf7aa3958
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnBlockStructureCompartment.java
@@ -0,0 +1,82 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnBlockStructureCompartment extends AbstractTest4B {
+
+ public static View blockContainerView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ blockContainerView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+
+ if(blockContainerView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", blockContainerView, true, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", blockContainerView, false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", blockContainerView, true, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", blockContainerView, true, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", blockContainerView, true, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", blockContainerView, true);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", blockContainerView, true);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnComment.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnComment.java
new file mode 100644
index 00000000000..d247524e468
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnComment.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.internalblock.provider.ElementTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnComment extends AbstractTest4B {
+
+ public static View commentView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View blockStructureView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+
+ commentView = createGraphicalNode(UMLElementTypes.COMMENT, ElementTypes.COMMENT.getSemanticHint(), blockStructureView);
+
+ if(commentView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", commentView, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", commentView, false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", commentView, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", commentView, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", commentView, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", commentView, false);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", commentView, false);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnComment4CB.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnComment4CB.java
new file mode 100644
index 00000000000..5eae4aa86c5
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnComment4CB.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.internalblock.provider.ElementTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnComment4CB extends AbstractTest4B {
+
+ public static View commentView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View blockStructureView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+
+ commentView = createGraphicalNode(UMLElementTypes.COMMENT, ElementTypes.COMMENT.getSemanticHint(), blockStructureView);
+
+ if(commentView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", commentView, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", commentView, false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", commentView, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", commentView, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", commentView, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", commentView, false);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", commentView, false);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraint.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraint.java
new file mode 100644
index 00000000000..ccfa74442b9
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraint.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.internalblock.provider.ElementTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnConstraint extends AbstractTest4B {
+
+ public static View commentView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View blockStructureView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+
+ commentView = createGraphicalNode(UMLElementTypes.CONSTRAINT, ElementTypes.CONSTRAINT.getSemanticHint(), blockStructureView);
+
+ if(commentView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", commentView, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", commentView, false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", commentView, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", commentView, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", commentView, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", commentView, false);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", commentView, false);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraint4CB.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraint4CB.java
new file mode 100644
index 00000000000..35555cc02da
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraint4CB.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.internalblock.provider.ElementTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnConstraint4CB extends AbstractTest4B {
+
+ public static View commentView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View blockStructureView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+
+ commentView = createGraphicalNode(UMLElementTypes.CONSTRAINT, ElementTypes.CONSTRAINT.getSemanticHint(), blockStructureView);
+
+ if(commentView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", commentView, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", commentView, false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", commentView, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", commentView, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", commentView, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", commentView, false);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", commentView, false);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintBlock4CB.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintBlock4CB.java
new file mode 100644
index 00000000000..f396a58c88a
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintBlock4CB.java
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4CB;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnConstraintBlock4CB extends AbstractTest4CB {
+
+ public static View constraintBlockView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ constraintBlockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ if(constraintBlockView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", constraintBlockView, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", constraintBlockView, true);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", constraintBlockView, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", constraintBlockView, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", constraintBlockView, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", constraintBlockView, false);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", constraintBlockView, false);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintBlockStructureCompartment4CB.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintBlockStructureCompartment4CB.java
new file mode 100644
index 00000000000..00b11fa93d4
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintBlockStructureCompartment4CB.java
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4CB;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnConstraintBlockStructureCompartment4CB extends AbstractTest4CB {
+
+ public static View constraintBlockStructureView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ View constraintBlockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ constraintBlockStructureView = ViewUtil.getChildBySemanticHint(constraintBlockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+ if(constraintBlockStructureView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", constraintBlockStructureView, true, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", constraintBlockStructureView, false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", constraintBlockStructureView, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", constraintBlockStructureView, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", constraintBlockStructureView, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", constraintBlockStructureView, true);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", constraintBlockStructureView, true);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintProperty.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintProperty.java
new file mode 100644
index 00000000000..fc57df12bed
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintProperty.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnConstraintProperty extends AbstractTest4B {
+
+ public static View constraintPropertyView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View blockStructureView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+ if(blockStructureView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ constraintPropertyView = createGraphicalNode(SysMLElementTypes.CONSTRAINT_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID, blockStructureView);
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", constraintPropertyView, true);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", constraintPropertyView, false);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintProperty4CB.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintProperty4CB.java
new file mode 100644
index 00000000000..9587dd1c7c8
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnConstraintProperty4CB.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4CB;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnConstraintProperty4CB extends AbstractTest4CB {
+
+ public static View constraintPropertyView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View blockStructureView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+ if(blockStructureView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ constraintPropertyView = createGraphicalNode(SysMLElementTypes.CONSTRAINT_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID, blockStructureView);
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", constraintPropertyView, true);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", constraintPropertyView, false);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnDiagram.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnDiagram.java
new file mode 100644
index 00000000000..d4bb9950d0e
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnDiagram.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnDiagram extends AbstractTest4B {
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", getDiagramView(), false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", getDiagramView(), false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", getDiagramView(), false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", getDiagramView(), false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", getDiagramView(), false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", getDiagramView(), true);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", getDiagramView(), true);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnDiagram4CB.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnDiagram4CB.java
new file mode 100644
index 00000000000..9b96cb4edad
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnDiagram4CB.java
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4CB;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnDiagram4CB extends AbstractTest4CB {
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", getDiagramView(), false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", getDiagramView(), false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", getDiagramView(), false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", getDiagramView(), false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", getDiagramView(), false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", getDiagramView(), true);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", getDiagramView(), true);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnPart.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnPart.java
new file mode 100644
index 00000000000..3e6a2b3a076
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnPart.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnPart extends AbstractTest4B {
+
+ public static View partView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View blockStructureView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+ if(blockStructureView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ partView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, blockStructureView);
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", partView, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", partView, false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", partView, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", partView, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", partView, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", partView, false);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", partView, false);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnPartStructureCompartement.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnPartStructureCompartement.java
new file mode 100644
index 00000000000..687e7a14b4f
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnPartStructureCompartement.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnPartStructureCompartement extends AbstractTest4B {
+
+ public static View partViewStructureView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View blockStructureView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+ if(blockStructureView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ View partView = createGraphicalNode(SysMLElementTypes.PART_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, blockStructureView);
+ partViewStructureView = ViewUtil.getChildBySemanticHint(partView, SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID);
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", partViewStructureView, true, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", partViewStructureView, false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", partViewStructureView, true, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", partViewStructureView, true, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", partViewStructureView, true, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", partViewStructureView, true);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", partViewStructureView, false);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnReference.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnReference.java
new file mode 100644
index 00000000000..699ff21a0e6
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnReference.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnReference extends AbstractTest4B {
+
+ public static View constraintPropertyView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View blockStructureView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+ if(blockStructureView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ constraintPropertyView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, blockStructureView);
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", constraintPropertyView, false);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", constraintPropertyView, false);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnReferenceStructureCompartment.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnReferenceStructureCompartment.java
new file mode 100644
index 00000000000..7832d695d9c
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnReferenceStructureCompartment.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnReferenceStructureCompartment extends AbstractTest4B {
+
+ public static View constraintPropertyStructureView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View blockStructureView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+ if(blockStructureView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ View constraintPropertyView = createGraphicalNode(SysMLElementTypes.REFERENCE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, blockStructureView);
+ constraintPropertyStructureView = ViewUtil.getChildBySemanticHint(constraintPropertyView, SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID);
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", constraintPropertyStructureView, true, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", constraintPropertyStructureView, false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", constraintPropertyStructureView, true, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", constraintPropertyStructureView, true, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", constraintPropertyStructureView, true, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", constraintPropertyStructureView, true);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", constraintPropertyStructureView, false);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnValue.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnValue.java
new file mode 100644
index 00000000000..3d504d2c2df
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnValue.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnValue extends AbstractTest4B {
+
+ public static View valueView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View blockStructureView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+ if(blockStructureView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ valueView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, blockStructureView);
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", valueView, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", valueView, false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", valueView, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", valueView, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", valueView, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", valueView, false);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", valueView, false);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnValueStructureCompartment.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnValueStructureCompartment.java
new file mode 100644
index 00000000000..51c87864575
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/creation/node/TestNodeCreationOnValueStructureCompartment.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.creation.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
+
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element creation test (via palette tools) in diagram.
+ */
+public class TestNodeCreationOnValueStructureCompartment extends AbstractTest4B {
+
+ public static View valueStructureView;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ View blockStructureView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+ if(blockStructureView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+ View valueView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, blockStructureView);
+ valueStructureView = ViewUtil.getChildBySemanticHint(valueView, SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID);
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testCreationConstraintProperty() throws Exception {
+ createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", valueStructureView, false);
+ }
+
+ @Test
+ public void testCreationConstraintParameter() throws Exception {
+ createNodeFromPalette("parametric.tool.parameter", valueStructureView, false);
+ }
+
+ @Test
+ public void testCreationPart() throws Exception {
+ createNodeFromPalette("parametric.tool.blockpropertycomposite", valueStructureView, false);
+ }
+
+ @Test
+ public void testCreationReference() throws Exception {
+ createNodeFromPalette("parametric.tool.reference", valueStructureView, false);
+ }
+
+ @Test
+ public void testCreationValue() throws Exception {
+ createNodeFromPalette("parametric.tool.value", valueStructureView, false);
+ }
+
+ @Test
+ public void testCreationComment() throws Exception {
+ createNodeFromPalette("parametric.tool.comment", valueStructureView, true);
+ }
+
+ @Test
+ public void testCreationConstraint() throws Exception {
+ createNodeFromPalette("parametric.tool.constraint", valueStructureView, false);
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/dnd/node/TestNodeDropOnBlockStructureCompartment.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/dnd/node/TestNodeDropOnBlockStructureCompartment.java
new file mode 100644
index 00000000000..d7685379c84
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/dnd/node/TestNodeDropOnBlockStructureCompartment.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.dnd.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createElement;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.dropFromModelExplorer;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element Drop test (via palette tools) on Block structure compartment.
+ */
+public class TestNodeDropOnBlockStructureCompartment extends AbstractTest4B {
+
+ public static View containerView;
+
+ public static EObject containerPackage;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ // prepare container
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ containerView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+ if(containerView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+
+ // prepare container package (getDiagramView references the shown Block).
+ containerPackage = EMFCoreUtil.getContainer(getDiagramView().getElement(), UMLPackage.eINSTANCE.getPackage());
+
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testDropBlock() throws Exception {
+ EObject droppedElement = createElement(SysMLElementTypes.BLOCK, containerPackage);
+ dropFromModelExplorer(droppedElement, containerView, true, false, 2); // 2 = Part / Reference
+ }
+
+ @Test
+ public void testDropConstraintBlock() throws Exception {
+ EObject droppedElement = createElement(SysMLElementTypes.CONSTRAINT_BLOCK, containerPackage);
+ dropFromModelExplorer(droppedElement, containerView, true, false, 1); // 1 = ConstraintProperty
+ }
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/dnd/node/TestNodeDropOnBlockStructureCompartment4CB.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/dnd/node/TestNodeDropOnBlockStructureCompartment4CB.java
new file mode 100644
index 00000000000..41e83df498c
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/dnd/node/TestNodeDropOnBlockStructureCompartment4CB.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.dnd.node;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createElement;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.dropFromModelExplorer;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4CB;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * JUnit tests for element Drop test (via palette tools) on Block structure compartment.
+ */
+public class TestNodeDropOnBlockStructureCompartment4CB extends AbstractTest4CB {
+
+ public static View containerView;
+
+ public static EObject containerPackage;
+
+ @BeforeClass
+ public static void prepareContainerForTest() throws Exception {
+ try {
+ // prepare container
+ View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
+ containerView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
+ if(containerView == null) {
+ throw new Exception("Unable to prepare container for test.");
+ }
+
+ // prepare container package (getDiagramView references the shown Block).
+ containerPackage = EMFCoreUtil.getContainer(getDiagramView().getElement(), UMLPackage.eINSTANCE.getPackage());
+
+ } catch (Exception e) {
+ throw new Exception("Unable to prepare container for test.", e);
+ }
+ }
+
+ @Test
+ public void testDropBlock() throws Exception {
+ EObject droppedElement = createElement(SysMLElementTypes.BLOCK, containerPackage);
+ dropFromModelExplorer(droppedElement, containerView, false, false, 2); // 2 = Part / Reference
+ }
+
+ @Test
+ public void testDropConstraintBlock() throws Exception {
+ EObject droppedElement = createElement(SysMLElementTypes.CONSTRAINT_BLOCK, containerPackage);
+ dropFromModelExplorer(droppedElement, containerView, true, false, 1); // 1 = ConstraintProperty
+ }
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationLinkTestsOnParametricOwnedByBlock.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationLinkTestsOnParametricOwnedByBlock.java
new file mode 100644
index 00000000000..49018f62915
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationLinkTestsOnParametricOwnedByBlock.java
@@ -0,0 +1,22 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.tests.suites;
+
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.connector.TestLinkCreationConnectorFromConstraintParameter;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.connector.TestLinkCreationConnectorFromPart;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.connector.TestLinkCreationConnectorFromReference;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.connector.TestLinkCreationConnectorFromValue;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({
+ TestLinkCreationConnectorFromPart.class,
+ TestLinkCreationConnectorFromReference.class,
+ TestLinkCreationConnectorFromValue.class,
+ TestLinkCreationConnectorFromConstraintParameter.class,
+
+})
+
+public class AllCreationLinkTestsOnParametricOwnedByBlock {
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationLinkTestsOnParametricOwnedByConstraintBlock.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationLinkTestsOnParametricOwnedByConstraintBlock.java
new file mode 100644
index 00000000000..c2dca2430f7
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationLinkTestsOnParametricOwnedByConstraintBlock.java
@@ -0,0 +1,19 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.tests.suites;
+
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.connector.TestLinkCreationConnectorFromPart4CB;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.connector.TestLinkCreationConnectorFromReference4CB;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.connector.TestLinkCreationConnectorFromValue4CB;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({
+ TestLinkCreationConnectorFromPart4CB.class,
+ TestLinkCreationConnectorFromReference4CB.class,
+ TestLinkCreationConnectorFromValue4CB.class,
+})
+
+public class AllCreationLinkTestsOnParametricOwnedByConstraintBlock {
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationNodeTestsOnParametricOwnedByBlock.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationNodeTestsOnParametricOwnedByBlock.java
new file mode 100644
index 00000000000..8525ed1d311
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationNodeTestsOnParametricOwnedByBlock.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.suites;
+
+
+import junit.framework.TestSuite;
+
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnBlock;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnBlockStructureCompartment;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnComment;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnConstraint;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnConstraintProperty;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnDiagram;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnPart;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnPartStructureCompartement;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnReference;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnReferenceStructureCompartment;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnValue;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnValueStructureCompartment;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+
+@RunWith(Suite.class)
+@SuiteClasses({
+ TestNodeCreationOnBlock.class,
+ TestNodeCreationOnBlockStructureCompartment.class,
+ TestNodeCreationOnComment.class,
+ TestNodeCreationOnConstraint.class,
+ TestNodeCreationOnConstraintProperty.class,
+ TestNodeCreationOnDiagram.class,
+ TestNodeCreationOnPart.class,
+ TestNodeCreationOnPartStructureCompartement.class,
+ TestNodeCreationOnReference.class,
+ TestNodeCreationOnReferenceStructureCompartment.class,
+ TestNodeCreationOnValue.class,
+ TestNodeCreationOnValueStructureCompartment.class
+})
+
+public class AllCreationNodeTestsOnParametricOwnedByBlock extends TestSuite {
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationNodeTestsOnParametricOwnedByConstraintBlock.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationNodeTestsOnParametricOwnedByConstraintBlock.java
new file mode 100644
index 00000000000..d401852815f
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllCreationNodeTestsOnParametricOwnedByConstraintBlock.java
@@ -0,0 +1,41 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.suites;
+
+
+import junit.framework.TestCase;
+
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnComment4CB;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnConstraint4CB;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnConstraintBlock4CB;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnConstraintBlockStructureCompartment4CB;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnConstraintProperty4CB;
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node.TestNodeCreationOnDiagram4CB;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+
+@RunWith(Suite.class)
+@SuiteClasses({
+ TestNodeCreationOnComment4CB.class,
+ TestNodeCreationOnConstraint4CB.class,
+ TestNodeCreationOnConstraintBlock4CB.class,
+ TestNodeCreationOnConstraintBlockStructureCompartment4CB.class,
+ TestNodeCreationOnConstraintProperty4CB.class,
+ TestNodeCreationOnDiagram4CB.class
+})
+
+public class AllCreationNodeTestsOnParametricOwnedByConstraintBlock extends TestCase {
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllNodeDndTestsOnParametricOwnedByBlock.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllNodeDndTestsOnParametricOwnedByBlock.java
new file mode 100644
index 00000000000..6851fd175ee
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllNodeDndTestsOnParametricOwnedByBlock.java
@@ -0,0 +1,15 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.tests.suites;
+
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.dnd.node.TestNodeDropOnBlockStructureCompartment;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({
+ TestNodeDropOnBlockStructureCompartment.class,
+})
+
+public class AllNodeDndTestsOnParametricOwnedByBlock {
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllNodeDndTestsOnParametricOwnedByConstraintBlock.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllNodeDndTestsOnParametricOwnedByConstraintBlock.java
new file mode 100644
index 00000000000..b7f8c75cd9f
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllNodeDndTestsOnParametricOwnedByConstraintBlock.java
@@ -0,0 +1,15 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.tests.suites;
+
+import org.eclipse.papyrus.sysml.diagram.parametric.tests.dnd.node.TestNodeDropOnBlockStructureCompartment4CB;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({
+ TestNodeDropOnBlockStructureCompartment4CB.class,
+})
+
+public class AllNodeDndTestsOnParametricOwnedByConstraintBlock {
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllTests.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllTests.java
new file mode 100644
index 00000000000..b11d9fd53b0
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/suites/AllTests.java
@@ -0,0 +1,31 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.suites;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({
+ AllCreationNodeTestsOnParametricOwnedByBlock.class,
+ AllCreationNodeTestsOnParametricOwnedByConstraintBlock.class,
+ AllCreationLinkTestsOnParametricOwnedByBlock.class,
+ AllCreationLinkTestsOnParametricOwnedByBlock.class,
+ AllNodeDndTestsOnParametricOwnedByBlock.class,
+ AllNodeDndTestsOnParametricOwnedByConstraintBlock.class,
+})
+
+public class AllTests {
+} \ No newline at end of file
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/Constants.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/Constants.java
new file mode 100644
index 00000000000..0f6c176e421
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/Constants.java
@@ -0,0 +1,7 @@
+package org.eclipse.papyrus.sysml.diagram.parametric.tests.utils;
+
+public class Constants {
+
+ public static final String PARAMETRIC_OWNED_BY_BLOCK_DIAGRAM_NAME = "BlockParametricDiagram";
+ public static final String PARAMETRIC_OWNED_BY_CONSTRAINTBLOCK_DIAGRAM_NAME = "ConstrainBlockParametricDiagram";
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/EditorUtils.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/EditorUtils.java
new file mode 100644
index 00000000000..097a9f9a029
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/EditorUtils.java
@@ -0,0 +1,143 @@
+/*****************************************************************************
+ * 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.sysml.diagram.parametric.tests.utils;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Tool;
+import org.eclipse.gef.util.EditPartUtilities;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramEditDomain;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.sysml.diagram.parametric.ParametricDiagramForMultiEditor;
+import org.eclipse.papyrus.sysml.diagram.parametric.factory.DiagramPaletteFactory;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+
+
+public class EditorUtils {
+
+ public static ParametricDiagramForMultiEditor getDiagramEditor() throws Exception {
+
+ ServicesRegistry serviceRegistry = (ServicesRegistry)getEditor().getAdapter(ServicesRegistry.class);
+ try {
+ return (ParametricDiagramForMultiEditor)ServiceUtils.getInstance().getNestedActiveIEditorPart(serviceRegistry);
+
+ } catch (ServiceException e) {
+ throw new Exception("Unable to retrieve service.", e);
+ } catch (ClassCastException e) {
+ throw new Exception("Active diagram is not an IBD.", e);
+ }
+ }
+
+ public static DiagramEditPart getDiagramEditPart() throws Exception {
+
+ try {
+ return getDiagramEditor().getDiagramEditPart();
+
+ } catch (NullPointerException e) {
+ throw new Exception("Could not find diagram edit part.", e);
+ }
+ }
+
+ public static Diagram getDiagramView() throws Exception {
+
+ try {
+ return getDiagramEditor().getDiagram();
+
+ } catch (NullPointerException e) {
+ throw new Exception("Could not find diagram view.", e);
+ }
+ }
+
+ public static EditPart getEditPart(View view) throws Exception {
+
+ // Test if the container is the diagram itself first
+ if(getDiagramEditPart().getModel() == view) {
+ return getDiagramEditPart();
+ }
+
+ // Test diagram children and look for the view
+ @SuppressWarnings("unchecked")
+ Iterator<EditPart> it = EditPartUtilities.getAllChildren(getDiagramEditPart()).iterator();
+ while(it.hasNext()) {
+ EditPart editPart = it.next();
+ if(editPart.getModel() == view) {
+ return editPart;
+ }
+ }
+
+ // Test diagram nested connections and look for the view
+ @SuppressWarnings("unchecked")
+ Iterator<EditPart> itLinks = EditPartUtilities.getAllNestedConnectionEditParts(getDiagramEditPart()).iterator();
+ while(itLinks.hasNext()) {
+ EditPart editPart = itLinks.next();
+ if(editPart.getModel() == view) {
+ return editPart;
+ }
+ }
+
+ throw new Exception("Unable to find edit part for the given view.");
+ }
+
+ public static Tool getPaletteTool(String toolId) throws Exception {
+ DiagramPaletteFactory factory = new DiagramPaletteFactory();
+ return factory.createTool(toolId);
+ }
+
+ public static IDiagramEditDomain getDiagramEditingDomain() throws Exception {
+ return getDiagramEditor().getDiagramEditDomain();
+ }
+
+ public static DiagramCommandStack getDiagramCommandStack() throws Exception {
+ return getDiagramEditingDomain().getDiagramCommandStack();
+ }
+
+ public static CommandStack getCommandStack() throws Exception {
+ return getTransactionalEditingDomain().getCommandStack();
+ }
+
+ public static TransactionalEditingDomain getTransactionalEditingDomain() throws Exception {
+
+ ServicesRegistry serviceRegistry = (ServicesRegistry)getEditor().getAdapter(ServicesRegistry.class);
+ try {
+ return ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry);
+
+ } catch (ServiceException e) {
+ throw new Exception("Unable to retrieve service.", e);
+ }
+ }
+
+ public static IEditorPart getEditor() throws Exception {
+ RunnableWithResult<IEditorPart> getEditorRunnable = new RunnableWithResult.Impl<IEditorPart>() {
+
+ public void run() {
+ setResult(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor());
+ }
+ };
+ Display.getDefault().syncExec(getEditorRunnable);
+ return getEditorRunnable.getResult();
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/TestPrepareUtils.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/TestPrepareUtils.java
new file mode 100644
index 00000000000..e21ba1e35d4
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/TestPrepareUtils.java
@@ -0,0 +1,296 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.utils;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getEditPart;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getTransactionalEditingDomain;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.junit.Assert;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
+import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.services.edit.commands.ConfigureFeatureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils;
+import org.eclipse.papyrus.sysml.blocks.Block;
+import org.eclipse.papyrus.sysml.diagram.parametric.Activator;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.uml2.uml.ConnectableElement;
+import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.ConnectorEnd;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.EncapsulatedClassifier;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+
+public class TestPrepareUtils {
+
+ public static void changeVisibility(View view) throws Exception {
+ SetCommand changeVisibilityCommand = new SetCommand(getTransactionalEditingDomain(), view, NotationPackage.eINSTANCE.getView_Visible(), !view.isVisible());
+ getTransactionalEditingDomain().getCommandStack().execute(changeVisibilityCommand);
+ }
+
+ public static EObject createElement(IElementType elementType, View containerView) throws Exception {
+ return createElement(elementType, containerView.getElement());
+ }
+
+ @SuppressWarnings("unchecked")
+ public static EObject createElement(IElementType elementType, EObject container) throws Exception {
+ CreateElementRequest createElementRequest = new CreateElementRequest(getTransactionalEditingDomain(), container, elementType);
+
+ EObject typeOwner = EMFCoreUtil.getContainer(container, UMLPackage.eINSTANCE.getPackage());
+
+ if(elementType == SysMLElementTypes.CONSTRAINT_PROPERTY) {
+ // Create type
+ CreateElementRequest createTypeRequest = new CreateElementRequest(getTransactionalEditingDomain(), typeOwner, SysMLElementTypes.CONSTRAINT_BLOCK);
+ ICommand createTypeCommand = ElementEditServiceUtils.getCommandProvider(typeOwner).getEditCommand(createTypeRequest);
+ getTransactionalEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(createTypeCommand));
+
+ // If container is a Property, substitute container by the Property type
+ if(container instanceof Property) {
+ container = ((Property)container).getType();
+ createElementRequest.setContainer(container);
+ }
+ createElementRequest.getParameters().put(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getTypedElement_Type(), GMFCommandUtils.getCommandEObjectResult(createTypeCommand)));
+
+ } else if(elementType == SysMLElementTypes.PART_PROPERTY) {
+ // Create type
+ CreateElementRequest createTypeRequest = new CreateElementRequest(getTransactionalEditingDomain(), typeOwner, SysMLElementTypes.BLOCK);
+ ICommand createTypeCommand = ElementEditServiceUtils.getCommandProvider(typeOwner).getEditCommand(createTypeRequest);
+ getTransactionalEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(createTypeCommand));
+
+ // If container is a Property, substitute container by the Property type
+ if(container instanceof Property) {
+ container = ((Property)container).getType();
+ createElementRequest.setContainer(container);
+ }
+ createElementRequest.getParameters().put(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getTypedElement_Type(), GMFCommandUtils.getCommandEObjectResult(createTypeCommand)));
+
+ } else if(elementType == SysMLElementTypes.REFERENCE_PROPERTY) {
+ // Create type
+ CreateElementRequest createTypeRequest = new CreateElementRequest(getTransactionalEditingDomain(), typeOwner, SysMLElementTypes.BLOCK);
+ ICommand createTypeCommand = ElementEditServiceUtils.getCommandProvider(typeOwner).getEditCommand(createTypeRequest);
+ getTransactionalEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(createTypeCommand));
+
+ // If container is a Property, substitute container by the Property type
+ if(container instanceof Property) {
+ container = ((Property)container).getType();
+ createElementRequest.setContainer(container);
+ }
+ createElementRequest.getParameters().put(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getTypedElement_Type(), GMFCommandUtils.getCommandEObjectResult(createTypeCommand)));
+
+ } else if(elementType == SysMLElementTypes.VALUE_PROPERTY) {
+ // Create type
+ CreateElementRequest createTypeRequest = new CreateElementRequest(getTransactionalEditingDomain(), typeOwner, UMLElementTypes.DATA_TYPE);
+ ICommand createTypeCommand = ElementEditServiceUtils.getCommandProvider(typeOwner).getEditCommand(createTypeRequest);
+ getTransactionalEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(createTypeCommand));
+
+ // If container is a Property, substitute container by the Property type
+ if(container instanceof Property) {
+ container = ((Property)container).getType();
+ createElementRequest.setContainer(container);
+ }
+ createElementRequest.getParameters().put(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getTypedElement_Type(), GMFCommandUtils.getCommandEObjectResult(createTypeCommand)));
+
+ } else if(elementType == UMLElementTypes.PROPERTY) {
+
+ // If container is a Property, substitute container by the Property type
+ if(container instanceof Property) {
+ container = ((Property)container).getType();
+ createElementRequest.setContainer(container);
+ }
+ }
+
+ ICommand createElementCommand = ElementEditServiceUtils.getCommandProvider(container).getEditCommand(createElementRequest);
+ getTransactionalEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(createElementCommand));
+
+ return GMFCommandUtils.getCommandEObjectResult(createElementCommand);
+ }
+
+ public static void setBlockIsEncapsulated(final Element block, final boolean isEncapsulated) throws Exception {
+ AbstractTransactionalCommand setCommand = new AbstractTransactionalCommand(getTransactionalEditingDomain(), "Set Block isEncapsulated", null) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Block blockApp = UMLUtil.getStereotypeApplication(block, Block.class);
+ blockApp.setIsEncapsulated(isEncapsulated);
+ return CommandResult.newOKCommandResult(block);
+ }
+ };
+ getTransactionalEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(setCommand));
+ }
+
+ public static EObject createLink(IElementType elementType, EObject source, EObject target) throws Exception {
+ CreateRelationshipRequest createRelationshipRequest = new CreateRelationshipRequest(getTransactionalEditingDomain(), source, target, elementType);
+
+ ICommand createRelationshipCommand = ElementEditServiceUtils.getCommandProvider(elementType).getEditCommand(createRelationshipRequest);
+ getTransactionalEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(createRelationshipCommand));
+
+ return GMFCommandUtils.getCommandEObjectResult(createRelationshipCommand);
+ }
+
+ public static EObject createConnectorLink(final EncapsulatedClassifier container, final ConnectableElement sourceRole, final Property sourcePartWithPort, final ConnectableElement targetRole, final Property targetPartWithPort) throws Exception {
+
+ AbstractTransactionalCommand createConnectorCommand = new AbstractTransactionalCommand(getTransactionalEditingDomain(), "Create connector", null) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Connector connector = container.createOwnedConnector("ConnectorTest");
+
+ ConnectorEnd connectorEndSrc = connector.createEnd();
+ connectorEndSrc.setRole(sourceRole);
+ connectorEndSrc.setPartWithPort(sourcePartWithPort);
+
+ ConnectorEnd connectorEndTgt = connector.createEnd();
+ connectorEndTgt.setRole(targetRole);
+ connectorEndTgt.setPartWithPort(targetPartWithPort);
+
+ return CommandResult.newOKCommandResult(connector);
+ }
+
+ };
+
+ getTransactionalEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(createConnectorCommand));
+
+ return GMFCommandUtils.getCommandEObjectResult(createConnectorCommand);
+ }
+
+ public static View createGraphicalNode(IElementType elementType, String graphicalType, View containerView) throws Exception {
+ EObject newObject = createElement(elementType, containerView);
+
+ // Add view
+ ViewDescriptor viewDescriptor = new ViewDescriptor(new SemanticAdapter(newObject, null), Node.class, graphicalType, ViewUtil.APPEND, true, Activator.DIAGRAM_PREFERENCES_HINT);
+ CreateCommand createViewCommand = new CreateCommand(getTransactionalEditingDomain(), viewDescriptor, containerView);
+ Assert.assertTrue("Command should be executable", createViewCommand.canExecute());
+ EditorUtils.getDiagramCommandStack().execute(new ICommandProxy(createViewCommand));
+
+ EReference[] erefs = new EReference[]{ NotationPackage.eINSTANCE.getView_Element() };
+ @SuppressWarnings("unchecked")
+ Collection<View> views = EMFCoreUtil.getReferencers(newObject, erefs);
+
+ return (View)views.toArray()[0];
+ }
+
+ public static View createGraphicalNode(IElementType elementType, EObject semanticContainer, String graphicalType, View containerView) throws Exception {
+
+ EObject newObject = createElement(elementType, semanticContainer);
+
+ // Add view
+ ViewDescriptor viewDescriptor = new ViewDescriptor(new SemanticAdapter(newObject, null), Node.class, graphicalType, ViewUtil.APPEND, true, Activator.DIAGRAM_PREFERENCES_HINT);
+ CreateCommand createViewCommand = new CreateCommand(getTransactionalEditingDomain(), viewDescriptor, containerView);
+ EditorUtils.getDiagramCommandStack().execute(new ICommandProxy(createViewCommand));
+
+ EReference[] erefs = new EReference[]{ NotationPackage.eINSTANCE.getView_Element() };
+ @SuppressWarnings("unchecked")
+ Collection<View> views = EMFCoreUtil.getReferencers(newObject, erefs);
+
+ return (View)views.toArray()[0];
+ }
+
+ public static View createGraphicalLink(IElementType elementType, String graphicalType, View containerView, EditPart sourceEP, EditPart targetEP) throws Exception {
+ CreateConnectionViewRequest request = createConnectionRequest(elementType, sourceEP, targetEP);
+
+ Command command = targetEP.getCommand(request);
+ Assert.assertNotNull("Command to create graphical link should not be null", command);
+ Assert.assertTrue("Command should be executable", command.canExecute());
+
+ EditorUtils.getDiagramCommandStack().execute(command);
+
+ IAdaptable viewAdapter = (IAdaptable)request.getNewObject();
+ View newView = (View)viewAdapter.getAdapter(View.class);
+ Assert.assertNotNull("View should not be null", newView);
+
+ return newView;
+ }
+
+ public static CreateConnectionViewRequest createConnectionRequest(IElementType type, EditPart source, EditPart target) {
+ CreateConnectionViewRequest connectionRequest = CreateViewRequestFactory.getCreateConnectionRequest(type, Activator.DIAGRAM_PREFERENCES_HINT);
+
+ 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.
+ connectionRequest.setSourceEditPart(source);
+ connectionRequest.setTargetEditPart(target);
+ connectionRequest.setType(RequestConstants.REQ_CONNECTION_END);
+ return connectionRequest;
+ }
+
+
+ public static View dropFromModelExplorer(IElementType elementType, View containerView) throws Exception {
+ EObject newObject = createElement(elementType, containerView);
+ return dropFromModelExplorer(newObject, containerView);
+ }
+
+ public static View dropFromModelExplorer(EObject eObject, View containerView) throws Exception {
+
+ // Find container EditPart (for command creation)
+ EditPart containerEditPart = getEditPart(containerView);
+
+ // Prepare drop request
+ DropObjectsRequest dropRequest = new DropObjectsRequest();
+ ArrayList<EObject> list = new ArrayList<EObject>();
+ list.add(eObject);
+ dropRequest.setObjects(list);
+ dropRequest.setLocation(new Point(20, 20));
+
+ // Get drop command
+ Command command = containerEditPart.getCommand(dropRequest);
+ EditorUtils.getDiagramCommandStack().execute(command);
+
+ EReference[] erefs = new EReference[]{ NotationPackage.eINSTANCE.getView_Element() };
+ @SuppressWarnings("unchecked")
+ Collection<View> views = EMFCoreUtil.getReferencers(eObject, erefs);
+
+ return (View)views.toArray()[0];
+ }
+}
diff --git a/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/TestUtils.java b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/TestUtils.java
new file mode 100644
index 00000000000..60b2279bdb4
--- /dev/null
+++ b/tests/junit/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric.tests/src/org/eclipse/papyrus/sysml/diagram/parametric/tests/utils/TestUtils.java
@@ -0,0 +1,773 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.sysml.diagram.parametric.tests.utils;
+
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramEditor;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getEditPart;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getPaletteTool;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getTransactionalEditingDomain;
+import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createElement;
+import static org.junit.Assert.fail;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.core.commands.operations.IOperationHistoryListener;
+import org.eclipse.core.commands.operations.OperationHistoryEvent;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.Tool;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.requests.GroupRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.ui.action.global.GlobalAction;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.PopupMenuCommand;
+import org.eclipse.gmf.runtime.diagram.ui.menus.PopupMenu;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
+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.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.gmf.runtime.notation.Connector;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.commands.ActionHandler;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.gmfdiag.common.commands.SelectAndExecuteCommand;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.sysml.blocks.Block;
+import org.eclipse.papyrus.sysml.blocks.BlocksPackage;
+import org.eclipse.papyrus.sysml.blocks.NestedConnectorEnd;
+import org.eclipse.papyrus.sysml.diagram.parametric.Activator;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool.CreateAspectUnspecifiedTypeConnectionRequest;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeCreationTool;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchCommandConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.uml2.uml.ConnectableElement;
+import org.eclipse.uml2.uml.ConnectorEnd;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.util.UMLUtil;
+import org.junit.Assert;
+
+public class TestUtils {
+
+ public static void deleteView(IElementType elementType, View containerView, boolean isAllowed) throws Exception {
+ View view = TestPrepareUtils.dropFromModelExplorer(elementType, getDiagramView());
+ deleteView(view, isAllowed);
+ }
+
+ public static void deleteView(View view, boolean isAllowed) throws Exception {
+ // Find container EditPart (for command creation)
+ EditPart containerEditPart = getEditPart(view);
+ // Get delete view command
+ Command command = containerEditPart.getCommand(new GroupRequest(RequestConstants.REQ_DELETE));
+ // if the view deletion is not allowed the command should not be executable
+ if(!isAllowed) {
+ if((command == null) || (!command.canExecute())) {
+ // Ok the command cannot be executed.
+ } else {
+ fail("The command should not be executable.");
+ }
+ } else {
+ if((command == null) || (!command.canExecute())) {
+ fail("The command should be executable.");
+ } else {
+ // Ok the command can be executed.
+ defaultExecutionTest(command);
+ // Test the results then
+ // fail("Result tests not implemented.");
+ }
+ }
+ }
+
+ public static void deleteElement(IElementType elementType, View containerView, boolean isAllowed) throws Exception {
+ View view = TestPrepareUtils.dropFromModelExplorer(elementType, getDiagramView());
+ deleteElement(view, isAllowed);
+ }
+
+ public static void deleteElement(View view, boolean isAllowed) throws Exception {
+ // Find container EditPart (for command creation)
+ EditPart containerEditPart = getEditPart(view);
+ // Prepare request
+ DestroyElementRequest destroyRequest = new DestroyElementRequest(getTransactionalEditingDomain(), false);
+ // Get delete command
+ Command command = containerEditPart.getCommand(new EditCommandRequestWrapper(destroyRequest));
+ // if the deletion is not allowed the command should not be executable
+ if(!isAllowed) {
+ if((command == null) || (!command.canExecute())) {
+ // Ok the command cannot be executed.
+ } else {
+ fail("The command should not be executable.");
+ }
+ } else {
+ if((command == null) || (!command.canExecute())) {
+ fail("The command should be executable.");
+ } else {
+ // Ok the command can be executed.
+ defaultExecutionTest(command);
+ // Test the results then
+ // fail("Result tests not implemented.");
+ }
+ }
+ }
+
+ public static void dropFromModelExplorer(IElementType elementType, View containerView, boolean isAllowed) throws Exception {
+ EObject newObject = createElement(elementType, containerView);
+ dropFromModelExplorer(newObject, containerView, isAllowed);
+ }
+
+ public static void dropFromModelExplorer(EObject eObject, View containerView, boolean isAllowed) throws Exception {
+ dropFromModelExplorer(eObject, containerView, isAllowed, true);
+ }
+
+ public static void dropFromModelExplorer(EObject eObject, View containerView, boolean isAllowed, boolean execute) throws Exception {
+ dropFromModelExplorer(eObject, containerView, isAllowed, execute, 0);
+ }
+
+ public static void dropFromModelExplorer(EObject eObject, View containerView, boolean isAllowed, boolean execute, int expectedNumberOfCommand) throws Exception {
+ // Find container EditPart (for command creation)
+ EditPart containerEditPart = getEditPart(containerView);
+ // Prepare drop request
+ DropObjectsRequest dropRequest = new DropObjectsRequest();
+ ArrayList<EObject> list = new ArrayList<EObject>();
+ list.add(eObject);
+ dropRequest.setObjects(list);
+ dropRequest.setLocation(new Point(200, 200));
+ // Get drop command
+ Command command = containerEditPart.getCommand(dropRequest);
+ // if the drop is not allowed the command should not be executable
+ if(!isAllowed) {
+ if((command == null) || (!command.canExecute())) {
+ // Ok the command cannot be executed.
+ } else {
+ fail("The command should not be executable.");
+ }
+ } else {
+ if((command == null) || (!command.canExecute())) {
+ fail("The command should be executable.");
+ } else {
+ if (expectedNumberOfCommand > 0) {
+ if (command instanceof ICommandProxy) {
+ ICommand iCommand = ((ICommandProxy) command).getICommand();
+ if (iCommand instanceof SelectAndExecuteCommand) {
+ SelectAndExecuteCommand selectCommand = (SelectAndExecuteCommand)iCommand;
+ Field popupField = PopupMenuCommand.class.getDeclaredField("popupMenu");
+ popupField.setAccessible(true);
+ PopupMenu menu = (PopupMenu)popupField.get(selectCommand);
+ Field content = PopupMenu.class.getDeclaredField("content");
+ content.setAccessible(true);
+ @SuppressWarnings("unchecked")
+ List<CompoundCommand> commandList = (List<CompoundCommand>)content.get(menu);
+ Assert.assertEquals(commandList.size(), expectedNumberOfCommand);
+ }
+ }
+ }
+ if (execute) {
+ // Ok the command can be executed.
+ defaultExecutionTest(command);
+ }
+ // Test the results then
+ // fail("Result tests not implemented.");
+ }
+ }
+ }
+
+ public static void altDropFromModelExplorer(EObject eObject, View containerView, List<String> expectedCommandNames, boolean isAllowed) throws Exception {
+ // Find container EditPart (for command creation)
+ EditPart containerEditPart = getEditPart(containerView);
+ // Prepare drop request
+ DropObjectsRequest dropRequest = new DropObjectsRequest();
+ ArrayList<EObject> list = new ArrayList<EObject>();
+ list.add(eObject);
+ dropRequest.setObjects(list);
+ dropRequest.setLocation(new Point(200, 200));
+ // Get drop command
+ Command command = containerEditPart.getCommand(dropRequest);
+ // if the drop is not allowed the command should not be executable
+ if(!isAllowed) {
+ if((command == null) || (!command.canExecute())) {
+ // Ok the command cannot be executed.
+ } else {
+ fail("The command should not be executable.");
+ }
+ } else {
+ if((command == null) || (!command.canExecute())) {
+ fail("The command should be executable.");
+ } else {
+ // Simple command
+ if(expectedCommandNames.size() == 1) {
+ if(expectedCommandNames.get(0).equals(command.getLabel())) {
+ // Ok the command can be executed.
+ defaultExecutionTest(command);
+ // Test the results then
+ // fail("Result tests not implemented.");
+ EditorUtils.getCommandStack().undo();
+ } else {
+ fail("The expected kind of command was {" + expectedCommandNames.get(0) + "}, but was {" + command.getLabel() + "}");
+ }
+ } else if(expectedCommandNames.size() > 1) {
+ ICommand tmpCommand = (command instanceof ICommandProxy) ? ((ICommandProxy)command).getICommand() : null;
+ if((tmpCommand == null) || !(tmpCommand instanceof SelectAndExecuteCommand)) {
+ fail("The drop command is not a selact and execute command.");
+ }
+ // Field accessibility modification to review elementary drop command available as
+ // SelectAndExecuteCommand choices.
+ SelectAndExecuteCommand selectCommand = (SelectAndExecuteCommand)tmpCommand;
+ Field popupField = PopupMenuCommand.class.getDeclaredField("popupMenu");
+ popupField.setAccessible(true);
+ PopupMenu menu = (PopupMenu)popupField.get(selectCommand);
+ Field content = PopupMenu.class.getDeclaredField("content");
+ content.setAccessible(true);
+ @SuppressWarnings("unchecked")
+ List<CompoundCommand> commandList = (List<CompoundCommand>)content.get(menu);
+ if(commandList.size() != expectedCommandNames.size()) {
+ fail("Unexpected number of possible alternate drop command.");
+ }
+ for(int i = 0; i < commandList.size(); i++) {
+ CompoundCommand subCommand = commandList.get(i);
+ if(expectedCommandNames.get(i).equals(subCommand.getLabel())) {
+ // Ok the command can be executed.
+ defaultExecutionTest(subCommand);
+ // Add one more undo to go back in initial state before testing next command
+ EditorUtils.getCommandStack().undo();;
+ // Test the results then
+ // fail("Result tests not implemented.");
+ } else {
+ fail("The expected kind of command was {" + expectedCommandNames.get(i) + "}.");
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public static void createNodeFromPalette(String toolId, View containerView, boolean isAllowed) throws Exception {
+ if(isAllowed) {
+ createNodeFromPalette(toolId, containerView, isAllowed, true);
+ } else {
+ createNodeFromPalette(toolId, containerView, isAllowed, false);
+ }
+ }
+
+ public static void createNodeFromPalette(String toolId, View containerView, boolean isAllowed, boolean execute) throws Exception {
+ // Find container EditPart (for command creation)
+ EditPart containerEditPart = getEditPart(containerView);
+ // Find palette tool to simulate element creation
+ Tool tool = getPaletteTool(toolId);
+ Request createRequest = getCreateRequest(tool);
+ // Get creation command for request
+ Command command = containerEditPart.getCommand(createRequest);
+ // if the creation is not allowed the command should not be executable
+ if(!isAllowed) {
+ if((command == null) || (!command.canExecute())) {
+ // Ok the command cannot be executed.
+ } else {
+ fail("The command should not be executable.");
+ }
+ } else {
+ if((command == null) || (!command.canExecute())) {
+ fail("The command should be executable.");
+ } else {
+ // Ok the command can be executed.
+ if(execute) {
+ defaultExecutionTest(command);
+ }
+ // Test the results then
+ // fail("Result tests not implemented.");
+ }
+ }
+ }
+
+ public static Request getCreateRequest(final Tool tool) throws Exception {
+
+ // Don't forget to set the diagram viewer (required for preferenceHints to mimic manual creation)
+ final IDiagramGraphicalViewer viewer = getDiagramEditor().getDiagramGraphicalViewer();
+
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ try {
+ tool.setViewer(viewer);
+ } catch (Exception ex) {
+ ex.printStackTrace(System.out);
+ }
+ }
+ });
+
+ if(tool instanceof AspectUnspecifiedTypeCreationTool) {
+ AspectUnspecifiedTypeCreationTool creationTool = (AspectUnspecifiedTypeCreationTool)tool;
+ return creationTool.createCreateRequest();
+ } else if(tool instanceof AspectUnspecifiedTypeConnectionTool) {
+ AspectUnspecifiedTypeConnectionTool connectionTool = (AspectUnspecifiedTypeConnectionTool)tool;
+ return connectionTool.new CreateAspectUnspecifiedTypeConnectionRequest(connectionTool.getElementTypes(), false, Activator.DIAGRAM_PREFERENCES_HINT);
+ }
+
+ throw new Exception("Unexpected kind of creation tool.");
+ }
+
+ public static void createEdgeFromPalette(String toolId, View sourceView, View targetView, boolean isAllowed) throws Exception {
+ // Execute command only when the command is expected to be executable
+ createEdgeFromPalette(toolId, sourceView, targetView, isAllowed, isAllowed);
+ }
+
+ public static EObject createEdgeFromPalette(String toolId, View sourceView, View targetView, boolean isAllowed, boolean execute) throws Exception {
+ // Find palette tool to simulate element creation and prepare request
+ Tool tool = getPaletteTool(toolId);
+ CreateAspectUnspecifiedTypeConnectionRequest createRequest = (CreateAspectUnspecifiedTypeConnectionRequest)getCreateRequest(tool);
+ // Test source creation command
+ createRequest.setSourceEditPart(getEditPart(sourceView));
+ createRequest.setType(RequestConstants.REQ_CONNECTION_START);
+ Command srcCommand = getEditPart(sourceView).getCommand(createRequest);
+ // Test source command
+ if((srcCommand == null) || !(srcCommand.canExecute())) { // Non-executable command
+ if(targetView == null) { // Only test behavior on source
+ if(!isAllowed) {
+ // Current behavior matches the expected results
+ return null;
+ } else {
+ fail("The command should be executable.");
+ }
+ } else { // Test complete creation, the command should necessary be executable
+ fail("The command should be executable.");
+ }
+ } else { // Executable command
+ if(targetView == null) { // Only test behavior on source
+ if(!isAllowed) {
+ fail("The command should not be executable.");
+ } else {
+ // Current behavior matches the expected results - no execution test.
+ return null;
+ }
+ } else { // The command is executable and a target is provided - continue the test
+ // Get target command (complete link creation)
+ createRequest.setSourceEditPart(getEditPart(sourceView));
+ createRequest.setTargetEditPart(getEditPart(targetView));
+ createRequest.setType(RequestConstants.REQ_CONNECTION_END);
+ Command tgtCommand = getEditPart(targetView).getCommand(createRequest);
+ // Test the target command
+ if((tgtCommand == null) || !(tgtCommand.canExecute())) { // Non-executable command
+ if(!isAllowed) {
+ // Current behavior matches the expected results
+ return null;
+ } else {
+ fail("The command should be executable.");
+ }
+ } else { // Executable command
+ if(!isAllowed) {
+ fail("The command should not be executable.");
+ } else {
+ // Current behavior matches the expected results
+ if(execute) { // Test command execution
+ defaultExecutionTest(tgtCommand);
+ // Retrieve created object via nested ElementAndViewCreationRequest.
+ View newView = null;
+ Iterator<?> it = createRequest.getAllRequests().iterator();
+ while(it.hasNext() && newView == null) {
+ CreateConnectionViewAndElementRequest subRequest = (CreateConnectionViewAndElementRequest)it.next();
+ newView = (View)subRequest.getConnectionViewDescriptor().getAdapter(View.class);
+ }
+ if(newView != null) {
+ return newView.getElement();
+ } else {
+ fail("No edge seem to have been created.");
+ }
+ }
+ // Test the results then
+ // fail("Result tests not implemented.");
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public static void createEdgeConnectorFromPalette(String toolId, View sourceView, View targetView, boolean isAllowed, List<Property> nestedSourcePath, List<Property> nestedTargetPath) throws Exception {
+ createEdgeConnectorFromPalette(toolId, sourceView, targetView, isAllowed, isAllowed, nestedSourcePath, nestedTargetPath);
+ }
+
+ public static void createEdgeConnectorFromPalette(String toolId, View sourceView, View targetView, boolean isAllowed, boolean execute, List<Property> nestedSourcePath, List<Property> nestedTargetPath) throws Exception {
+ EObject newLink = createEdgeFromPalette(toolId, sourceView, targetView, isAllowed, execute);
+ // Abort if the command is not supposed to be executable
+ if(!isAllowed) {
+ return;
+ }
+ if((newLink == null) || (!(newLink instanceof org.eclipse.uml2.uml.Connector))) {
+ fail("No edge or unexpected kind of edge created.");
+ }
+ // If previous test have not failed the execution / undo / re-do has been done
+ org.eclipse.uml2.uml.Connector connector = (org.eclipse.uml2.uml.Connector)newLink;
+ // Test source connector end
+ NestedConnectorEnd sourceNestedConnectorEnd = UMLUtil.getStereotypeApplication(connector.getEnds().get(0), NestedConnectorEnd.class);
+ if(nestedSourcePath.isEmpty()) {
+ Assert.assertNull("No nested connector end stereotype should be applied on source.", sourceNestedConnectorEnd);
+ } else {
+ Assert.assertNotNull("Nested connector end stereotype should be applied on source.", sourceNestedConnectorEnd);
+ Assert.assertEquals("Nested property path is incorrect for source", nestedSourcePath, sourceNestedConnectorEnd.getPropertyPath());
+ // if(!sourceNestedConnectorEnd.getPropertyPath().equals(nestedSourcePath)) {
+ // fail("The nested property path is incorrect for source.");
+ // }
+ }
+ // Test target connector end
+ NestedConnectorEnd targetNestedConnectorEnd = UMLUtil.getStereotypeApplication(connector.getEnds().get(1), NestedConnectorEnd.class);
+ if(nestedTargetPath.isEmpty()) {
+ Assert.assertNull("No nested connector end stereotype should be applied on target.", targetNestedConnectorEnd);
+ } else {
+ Assert.assertNotNull("Nested connector end stereotype should be applied on target.", targetNestedConnectorEnd);
+ Assert.assertEquals("Nested property path is incorrect for target", nestedTargetPath, targetNestedConnectorEnd.getPropertyPath());
+ // if(!targetNestedConnectorEnd.getPropertyPath().equals(nestedTargetPath)) {
+ // fail("The nested property path is incorrect for target.");
+ // }
+ }
+ }
+
+ public static void createEdgeConnectorAndTestDelegateFromPalette(String toolId, View sourceView, View targetView, boolean isAllowed, ConnectableElement expectedSourcePartWithPort, ConnectableElement expectedTargetPartWithPort) throws Exception {
+ createEdgeConnectorAndTestDelegateFromPalette(toolId, sourceView, targetView, isAllowed, isAllowed, expectedSourcePartWithPort, expectedTargetPartWithPort);
+ }
+
+ public static void createEdgeConnectorAndTestDelegateFromPalette(String toolId, View sourceView, View targetView, boolean isAllowed, boolean execute, ConnectableElement expectedSourcePartWithPort, ConnectableElement expectedTargetPartWithPort) throws Exception {
+ EObject newLink = createEdgeFromPalette(toolId, sourceView, targetView, isAllowed, execute);
+ // Abort if the command is not supposed to be executable
+ if(!isAllowed) {
+ return;
+ }
+ if((newLink == null) || (!(newLink instanceof org.eclipse.uml2.uml.Connector))) {
+ fail("No edge or unexpected kind of edge created.");
+ }
+ // If previous test have not failed the execution / undo / re-do has been done
+ org.eclipse.uml2.uml.Connector connector = (org.eclipse.uml2.uml.Connector)newLink;
+ // Test source connector end
+ ConnectorEnd sourceConnectorEnd = connector.getEnds().get(0);
+ if(sourceConnectorEnd.getPartWithPort() != expectedSourcePartWithPort) {
+ fail("The partWithPort is incorrect for source.");
+ }
+ // Test target connector end
+ ConnectorEnd targetConnectorEnd = connector.getEnds().get(1);
+ if(targetConnectorEnd.getPartWithPort() != expectedTargetPartWithPort) {
+ fail("The partWithPort is incorrect for target.");
+ }
+ }
+
+ public static void reorientRelationshipSource(View relationshipView, View newSourceView, boolean isAllowed) throws Exception {
+ reorientRelationship((Connector)relationshipView, newSourceView, ReorientRelationshipRequest.REORIENT_SOURCE, isAllowed);
+ }
+
+ public static void reorientRelationshipTarget(View relationshipView, View newTargetView, boolean isAllowed) throws Exception {
+ reorientRelationship((Connector)relationshipView, newTargetView, ReorientRelationshipRequest.REORIENT_TARGET, isAllowed);
+ }
+
+ public static void reorientRelationship(Connector relationshipView, View newEndView, int reorientDirection, boolean isAllowed) throws Exception {
+ // Prepare request and add
+ String reconnectDirection = (ReorientRelationshipRequest.REORIENT_SOURCE == reorientDirection) ? RequestConstants.REQ_RECONNECT_SOURCE : RequestConstants.REQ_RECONNECT_TARGET;
+ ReconnectRequest reconnectRequest = new ReconnectRequest(relationshipView);
+ reconnectRequest.setTargetEditPart(getEditPart(newEndView));
+ reconnectRequest.setConnectionEditPart((ConnectionEditPart)getEditPart(relationshipView));
+ reconnectRequest.setType(reconnectDirection);
+ // Get command
+ Command reorientCommand = getEditPart(newEndView).getCommand(reconnectRequest);
+ // Test the target command
+ if((reorientCommand == null) || !(reorientCommand.canExecute())) { // Non-executable command
+ if(!isAllowed) {
+ // Current behavior matches the expected results
+ return;
+ } else {
+ fail("The command should be executable.");
+ }
+ } else { // Executable command
+ if(!isAllowed) {
+ fail("The command should not be executable.");
+ } else {
+ defaultExecutionTest(reorientCommand);
+ // Test the results then
+ // fail("Result tests not implemented.");
+ }
+ }
+ }
+
+ public static void reorientConnectorSource(View relationshipView, View newSourceView, boolean isAllowed) throws Exception {
+ List<Property> nestedPath = Collections.emptyList();
+ reorientConnectorSource(relationshipView, newSourceView, isAllowed, nestedPath);
+ }
+
+ public static void reorientConnectorTarget(View relationshipView, View newTargetView, boolean isAllowed) throws Exception {
+ List<Property> nestedPath = Collections.emptyList();
+ reorientConnectorTarget(relationshipView, newTargetView, isAllowed, nestedPath);
+ }
+
+ public static void reorientConnectorSource(View relationshipView, View newSourceView, boolean isAllowed, List<Property> nestedPath) throws Exception {
+ reorientConnector((Connector)relationshipView, newSourceView, ReorientRelationshipRequest.REORIENT_SOURCE, isAllowed, nestedPath);
+ }
+
+ public static void reorientConnectorTarget(View relationshipView, View newTargetView, boolean isAllowed, List<Property> nestedPath) throws Exception {
+ reorientConnector((Connector)relationshipView, newTargetView, ReorientRelationshipRequest.REORIENT_TARGET, isAllowed, nestedPath);
+ }
+
+ public static void reorientConnector(Connector relationshipView, View newEndView, int reorientDirection, boolean isAllowed, List<Property> nestedPath) throws Exception {
+ reorientRelationship(relationshipView, newEndView, reorientDirection, isAllowed);
+ // Abort if the command is not supposed to be executable
+ if(!isAllowed) {
+ return;
+ }
+ // If previous test have not failed the execution / undo / re-do has been done
+ org.eclipse.uml2.uml.Connector connector = (org.eclipse.uml2.uml.Connector)relationshipView.getElement();
+ ConnectorEnd modifiedConnectorEnd = (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) ? connector.getEnds().get(0) : connector.getEnds().get(1);
+ NestedConnectorEnd nestedConnectorEnd = UMLUtil.getStereotypeApplication(modifiedConnectorEnd, NestedConnectorEnd.class);
+ if(nestedPath.isEmpty()) {
+ Assert.assertNull("No nested connector end stereotype should be applied.", nestedConnectorEnd);
+ } else {
+ Assert.assertNotNull("Nested connector end stereotype should be applied.", nestedConnectorEnd);
+ Assert.assertEquals("Invalid nested path", nestedPath, nestedConnectorEnd.getPropertyPath());
+ }
+ }
+
+ public static void reorientConnectorSourceAndTestDelegate(View relationshipView, View newSourceView, boolean isAllowed, ConnectableElement expectedSourcePartWithPort, ConnectableElement expectedTargetPartWithPort) throws Exception {
+ reorientConnectorAndTestDelegate((Connector)relationshipView, newSourceView, ReorientRelationshipRequest.REORIENT_SOURCE, isAllowed, expectedSourcePartWithPort, expectedTargetPartWithPort);
+ }
+
+ public static void reorientConnectorTargetAndTestDelegate(View relationshipView, View newTargetView, boolean isAllowed, ConnectableElement expectedSourcePartWithPort, ConnectableElement expectedTargetPartWithPort) throws Exception {
+ reorientConnectorAndTestDelegate((Connector)relationshipView, newTargetView, ReorientRelationshipRequest.REORIENT_TARGET, isAllowed, expectedSourcePartWithPort, expectedTargetPartWithPort);
+ }
+
+ public static void reorientConnectorAndTestDelegate(Connector relationshipView, View newEndView, int reorientDirection, boolean isAllowed, ConnectableElement expectedSourcePartWithPort, ConnectableElement expectedTargetPartWithPort) throws Exception {
+ reorientRelationship(relationshipView, newEndView, reorientDirection, isAllowed);
+ // Abort if the command is not supposed to be executable
+ if(!isAllowed) {
+ return;
+ }
+ // If previous test have not failed the execution / undo / re-do has been done
+ org.eclipse.uml2.uml.Connector connector = (org.eclipse.uml2.uml.Connector)relationshipView.getElement();
+ ConnectorEnd modifiedConnectorEnd = (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) ? connector.getEnds().get(0) : connector.getEnds().get(1);
+ ConnectorEnd oppositeConnectorEnd = (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) ? connector.getEnds().get(1) : connector.getEnds().get(0);
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) { // re-orient source
+ // Test source connector end
+ Assert.assertEquals("The partWithPort is incorrect for source (re-oriented).", expectedSourcePartWithPort, modifiedConnectorEnd.getPartWithPort());
+ // if(modifiedConnectorEnd.getPartWithPort() != expectedSourcePartWithPort) {
+ // fail("The partWithPort is incorrect for source (re-oriented).");
+ // }
+ // Test target connector end
+ Assert.assertEquals("The partWithPort is incorrect for target (opposite end).", expectedTargetPartWithPort, oppositeConnectorEnd.getPartWithPort());
+ // if(oppositeConnectorEnd.getPartWithPort() != expectedTargetPartWithPort) {
+ // fail("The partWithPort is incorrect for target (opposite end).");
+ // }
+ } else { // re-orient target
+ // Test source connector end
+ Assert.assertEquals("The partWithPort is incorrect for target (re-oriented).", expectedTargetPartWithPort, modifiedConnectorEnd.getPartWithPort());
+ // if(modifiedConnectorEnd.getPartWithPort() != expectedTargetPartWithPort) {
+ // fail("The partWithPort is incorrect for target .");
+ // }
+ // Test target connector end
+ Assert.assertEquals("The partWithPort is incorrect for source (opposite end).", expectedSourcePartWithPort, oppositeConnectorEnd.getPartWithPort());
+ // if(oppositeConnectorEnd.getPartWithPort() != expectedSourcePartWithPort) {
+ // fail("The partWithPort is incorrect for source (opposite end).");
+ // }
+ }
+ }
+
+ public static void setEncapsulationDeleteConnectorTest(Element block, View sourceView, View targetView, boolean canCreateConnector, boolean isConnectorDestroyExpected) throws Exception {
+ if(!canCreateConnector) {
+ return; // abort
+ }
+ // Make sure the block is not encapsulated before Connector creation.
+ TestPrepareUtils.setBlockIsEncapsulated(block, false);
+ // Create connector
+ org.eclipse.uml2.uml.Connector connector = (org.eclipse.uml2.uml.Connector)createEdgeFromPalette("internalblock.tool.connector", sourceView, targetView, true, true);
+ // Prepare set encapsulated command and execute (with undo, re-do).
+ Block blockApp = UMLUtil.getStereotypeApplication(block, Block.class);
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(blockApp);
+ if(provider == null) {
+ fail("Could not get IElementEditService for Block stereotype application.");
+ }
+ IEditCommandRequest setEncapsulationRequest = new SetRequest(getTransactionalEditingDomain(), blockApp, BlocksPackage.eINSTANCE.getBlock_IsEncapsulated(), true);
+ ICommand setEncapsulationCommand = provider.getEditCommand(setEncapsulationRequest);
+ defaultExecutionTest(new ICommandProxy(setEncapsulationCommand));
+ // Test if the Connector have been destroyed
+ if(isConnectorDestroyExpected) {
+ if(connector.eResource() != null) { // connector destroyed has no container
+ fail("Connector was expected to be destroyed.");
+ }
+ } else {
+ if(connector.eResource() == null) { // connector destroyed has no container
+ fail("Connector was not expected to be destroyed.");
+ }
+ }
+ }
+
+ /**
+ * Copy the list of objects into the Clipboard
+ *
+ * @param objectsToCopy
+ * the list of objects to copy. should not be <code>null</code>, at least an empty list
+ * @throws Exception
+ * exception thrown in case of problems
+ */
+ public static void copyEditParts(List<Object> objectsToCopy) throws Exception {
+ // select elements to copy
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(EditorUtils.getEditor());
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().bringToTop(EditorUtils.getEditor());
+ EditorUtils.getDiagramEditor().getEditorSite().getSelectionProvider().setSelection(new StructuredSelection(objectsToCopy));
+ ISelection selection = EditorUtils.getEditor().getSite().getSelectionProvider().getSelection();
+ Assert.assertEquals("Selection size should be " + objectsToCopy.size(), objectsToCopy.size(), ((IStructuredSelection)selection).size());
+ // retrieve the command for copy
+ ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
+ commandService.refreshElements(IWorkbenchCommandConstants.EDIT_COPY, null);
+ org.eclipse.core.commands.Command copyCommand = commandService.getCommand(IWorkbenchCommandConstants.EDIT_COPY);
+ ((GlobalAction)((ActionHandler)copyCommand.getHandler()).getAction()).setEnabled(true);
+ Assert.assertNotNull("Impossible to find copy command", copyCommand);
+ //EditorUtils.getDiagramEditor().getEditingDomain().setClipboard(objectsToCopy);
+ // retrieve handler service for the copy command
+ IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
+ Assert.assertNotNull("Impossible to find handler service", handlerService);
+ final ParameterizedCommand parameterizedCommand = new ParameterizedCommand(copyCommand, null);
+ // retrieve the command and set some parameters on it
+ copyCommand.setEnabled(handlerService.getCurrentState());
+ final boolean commandEnabled = copyCommand.isEnabled();
+ Assert.assertTrue("Command should be enabled", commandEnabled);
+ // execute the copy command
+ handlerService.executeCommand(parameterizedCommand, null);
+ }
+
+ /**
+ * paste the list of objects into the Clipboard into the current diagram
+ *
+ * @param target
+ * object on which content of the clipboard should be added
+ * @param executable
+ * indicates if the paste command should be executable.
+ *
+ * @throws Exception
+ * exception thrown in case of problems
+ */
+ public static void pasteEditParts(Object target, boolean executable) throws Exception {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(EditorUtils.getEditor());
+ EditorUtils.getDiagramEditor().getEditorSite().getSelectionProvider().setSelection(new StructuredSelection(target));
+ // retrieve the command for copy
+ ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
+ commandService.refreshElements(IWorkbenchCommandConstants.EDIT_PASTE, null);
+ org.eclipse.core.commands.Command pasteCommand = commandService.getCommand(IWorkbenchCommandConstants.EDIT_PASTE);
+ Assert.assertNotNull("Impossible to find paste command", pasteCommand);
+ ((GlobalAction)((ActionHandler)pasteCommand.getHandler()).getAction()).refresh();
+ IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
+ Assert.assertNotNull("Impossible to find handler service", handlerService);
+ final ParameterizedCommand parameterizedCommand = new ParameterizedCommand(pasteCommand, null);
+ Assert.assertEquals("Command is not executable as expected", pasteCommand.isEnabled(), executable);
+ if(executable) {
+ // execute the copy command
+ handlerService.executeCommand(parameterizedCommand, null);
+ }
+ }
+
+ /**
+ * paste with model element the list of objects into the Clipboard into the current diagram
+ *
+ * @param target
+ * object on which content of the clipboard should be added
+ * @param executable
+ * indicates if the paste command should be executable.
+ *
+ * @throws Exception
+ * exception thrown in case of problems
+ */
+ public static void pasteWithModelEditParts(Object target, boolean executable) throws Exception {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(EditorUtils.getEditor());
+ EditorUtils.getDiagramEditor().getEditorSite().getSelectionProvider().setSelection(new StructuredSelection(target));
+ // retrieve the command for copy
+ ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
+ commandService.refreshElements(IWorkbenchCommandConstants.EDIT_PASTE, null);
+ org.eclipse.core.commands.Command pasteWithModelCommand = commandService.getCommand("org.eclipse.papyrus.uml.diagram.common.commands.PasteWithModelCommand");
+ Assert.assertNotNull("Impossible to find paste command", pasteWithModelCommand);
+ // ((GlobalAction)((AbstractHandlerWithState)pasteWithModelCommand.getHandler()).getAction()).refresh();
+ IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
+ Assert.assertNotNull("Impossible to find handler service", handlerService);
+ final ParameterizedCommand parameterizedCommand = new ParameterizedCommand(pasteWithModelCommand, null);
+ Assert.assertEquals("Command is not executable as expected", pasteWithModelCommand.isEnabled(), executable);
+ if(executable) {
+ // execute the copy command
+ handlerService.executeCommand(parameterizedCommand, null);
+ }
+ }
+
+ // History event type variable to store history error events.
+ public static int historyEventType = OperationHistoryEvent.DONE;
+
+ /**
+ * Test execution, undo, redo of the given command.
+ *
+ * @param command
+ * the command to test.
+ * @throws Exception
+ */
+ public static void defaultExecutionTest(Command command) throws Exception {
+ // Execution in the diagram command stack (like Papyrus usual execution for GEF commands). This is important especially for
+ // composed command like Drop links which create intermediate view during execution. With EMF command stack, the whole command
+ // tries to execute and the edit part of the intermediate created views are not created before the command ends.
+ // The diagram command stack let edit part being created after each view creation.
+ // The problem in using the DiagramCommandStack (vs EMF CommandStack) is that it hides any exception that can possibly occur during
+ // command execution. This would let the test finish without error (the command result is not tested currently) while the execution failed.
+ // For this matter the DiagramCommandStack history is observed to detect execution issues.
+ // Add diagram command stack operation history listener
+ IOperationHistory history = EditorUtils.getDiagramEditingDomain().getActionManager().getOperationHistory();
+ IOperationHistoryListener historyChange = new IOperationHistoryListener() {
+
+ public void historyNotification(OperationHistoryEvent event) {
+ // Store history events
+ historyEventType = event.getEventType();
+ }
+ };
+ history.addOperationHistoryListener(historyChange);
+ // Test execution
+ historyEventType = OperationHistoryEvent.DONE;
+ EditorUtils.getCommandStack().execute(new GEFtoEMFCommandWrapper(command));
+ if(historyEventType == OperationHistoryEvent.OPERATION_NOT_OK) {
+ fail("Command execution failed ()");
+ }
+ // Test undo
+ historyEventType = OperationHistoryEvent.DONE;
+ EditorUtils.getCommandStack().undo();
+ if(historyEventType == OperationHistoryEvent.OPERATION_NOT_OK) {
+ fail("Command undo failed ()");
+ }
+ // Test redo
+ historyEventType = OperationHistoryEvent.DONE;
+ EditorUtils.getCommandStack().redo();
+ if(historyEventType == OperationHistoryEvent.OPERATION_NOT_OK) {
+ fail("Command redo failed ()");
+ }
+ // Remove listener.
+ history.removeOperationHistoryListener(historyChange);
+ }
+}

Back to the top