Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorrschnekenbu2013-07-17 14:46:46 +0000
committerrschnekenbu2013-07-17 14:46:46 +0000
commit7169003f932e436e57b10701911b07832459caab (patch)
tree5c10278aa4d4dd0db539b7cfcc62e8b3cfb68572 /tests
parent93cf4406b7d8ddf02b3840526ddf72f613bed8fa (diff)
downloadorg.eclipse.papyrus-7169003f932e436e57b10701911b07832459caab.tar.gz
org.eclipse.papyrus-7169003f932e436e57b10701911b07832459caab.tar.xz
org.eclipse.papyrus-7169003f932e436e57b10701911b07832459caab.zip
412300: [Refactoring Tests] The InteractionOverView diagram tests should
be refactored https://bugs.eclipse.org/bugs/show_bug.cgi?id=412300
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.classpath14
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.project56
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/META-INF/MANIFEST.MF54
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/about.html54
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/build.properties12
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/org.eclipse.papyrus.uml.diagram.interactionoverview.tests.launch90
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/Activator.java124
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/AllTests.java52
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/IInteractionoverviewDiagramTestsConstants.java22
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AbstractInteractionOverviewDiagramTestCase.java1171
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AllCanonicalTests.java48
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionOverviewDiagramActivityTN.java178
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionOverviewDiagramChildNode.java218
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionUse.java144
15 files changed, 1142 insertions, 1109 deletions
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.classpath b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.classpath
index 2d1a4302f04..64c5e31b7a2 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.classpath
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.classpath
@@ -1,7 +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>
+<?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/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.project b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.project
index 320a8dc3ba1..80f503cecfb 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.project
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.uml.diagram.interactionoverview.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>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.diagram.interactionoverview.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/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.settings/org.eclipse.jdt.core.prefs
index 44217f8c068..af0f20f97a5 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +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
+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/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/META-INF/MANIFEST.MF
index 6a0aa19b140..78565582c01 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/META-INF/MANIFEST.MF
@@ -1,27 +1,27 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.uml.diagram.interactionoverview;bundle-version="0.10.1",
- org.eclipse.papyrus.diagram.tests;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.1",
- org.eclipse.papyrus.uml.diagram.activity;bundle-version="0.10.1",
- org.eclipse.papyrus.uml.diagram.timing;bundle-version="0.10.1",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="0.10.1",
- org.eclipse.uml2.uml;bundle-version="4.0.2",
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.gmf.runtime.diagram.ui,
- org.junit;bundle-version="4.10.0"
-Export-Package: org.eclipse.papyrus.uml.diagram.interactionoverview.te
- sts
-Bundle-Vendor: Eclipse Modeling Project
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 0.10.1.qualifier
-Bundle-Name: IODiagram Tests (Incubation)
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.interactionoverview.
- tests.Activator
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.interactionovervi
- ew.tests
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.uml.diagram.interactionoverview;bundle-version="0.10.1",
+ org.eclipse.papyrus.diagram.tests;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.1",
+ org.eclipse.papyrus.uml.diagram.activity;bundle-version="0.10.1",
+ org.eclipse.papyrus.uml.diagram.timing;bundle-version="0.10.1",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="0.10.1",
+ org.eclipse.uml2.uml;bundle-version="4.0.2",
+ org.eclipse.gmf.runtime.diagram.ui,
+ org.eclipse.gmf.runtime.diagram.ui,
+ org.junit;bundle-version="4.10.0"
+Export-Package: org.eclipse.papyrus.uml.diagram.interactionoverview.te
+ sts
+Bundle-Vendor: Eclipse Modeling Project
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.1.qualifier
+Bundle-Name: IODiagram Tests (Incubation)
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.interactionoverview.
+ tests.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.interactionovervi
+ ew.tests
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/about.html b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/about.html
index 209103075a7..dd3c089a94c 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/about.html
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/about.html
@@ -1,28 +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>November 14, 2008</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>
+<!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>November 14, 2008</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> \ No newline at end of file
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/build.properties b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/build.properties
index 785a40c0ec7..9cbab3c135e 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/build.properties
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/build.properties
@@ -1,6 +1,6 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html
-src.includes = about.html
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
+src.includes = about.html
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/org.eclipse.papyrus.uml.diagram.interactionoverview.tests.launch b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/org.eclipse.papyrus.uml.diagram.interactionoverview.tests.launch
index 911e0957e10..df3216ac3e8 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/org.eclipse.papyrus.uml.diagram.interactionoverview.tests.launch
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/org.eclipse.papyrus.uml.diagram.interactionoverview.tests.launch
@@ -1,45 +1,45 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
-<booleanAttribute key="append.args" value="true"/>
-<booleanAttribute key="askclear" value="false"/>
-<booleanAttribute key="automaticAdd" value="true"/>
-<booleanAttribute key="automaticValidate" value="false"/>
-<stringAttribute key="bootstrap" value=""/>
-<stringAttribute key="checked" value="[NONE]"/>
-<booleanAttribute key="clearConfig" value="true"/>
-<booleanAttribute key="clearws" value="true"/>
-<booleanAttribute key="clearwslog" value="false"/>
-<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
-<booleanAttribute key="default" value="true"/>
-<booleanAttribute key="includeOptional" value="true"/>
-<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/AllTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.JAVA_COMMAND" value="java"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.uml.diagram.interactionoverview.tests.AllTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.uml.diagram.interactionoverview.tests"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -XX:PermSize=512M -XX:MaxPermSize=512M -Xms40m -Xmx1024m&#13;&#10;-XX:+CMSClassUnloadingEnabled"/>
-<stringAttribute key="pde.version" value="3.3"/>
-<stringAttribute key="product" value="org.eclipse.platform.ide"/>
-<booleanAttribute key="run_in_ui_thread" value="false"/>
-<booleanAttribute key="show_selected_only" value="false"/>
-<booleanAttribute key="tracing" value="false"/>
-<booleanAttribute key="useCustomFeatures" value="false"/>
-<booleanAttribute key="useDefaultConfig" value="true"/>
-<booleanAttribute key="useDefaultConfigArea" value="false"/>
-<booleanAttribute key="useProduct" value="true"/>
-</launchConfiguration>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/AllTests.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.JAVA_COMMAND" value="java"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.uml.diagram.interactionoverview.tests.AllTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.uml.diagram.interactionoverview.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -XX:PermSize=512M -XX:MaxPermSize=512M -Xms40m -Xmx1024m&#13;&#10;-XX:+CMSClassUnloadingEnabled"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="run_in_ui_thread" value="false"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/Activator.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/Activator.java
index 1a8b47e890a..0615c22da63 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/Activator.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/Activator.java
@@ -1,62 +1,62 @@
-/*****************************************************************************
- * 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.interactionoverview.tests;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.diagram.interactionoverview.tests"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
+/*****************************************************************************
+ * 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
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.interactionoverview.tests;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.diagram.interactionoverview.tests"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/AllTests.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/AllTests.java
index 72ed76922e8..1bcc707a82d 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/AllTests.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/AllTests.java
@@ -1,26 +1,26 @@
-/*****************************************************************************
- * 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.interactionoverview.tests;
-
-import org.eclipse.papyrus.uml.diagram.interactionoverview.tests.canonical.AllCanonicalTests;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-//@formatter:off
-@RunWith(Suite.class)
-@SuiteClasses({
-// canonical
-AllCanonicalTests.class, })
-//@formatter:on
-public class AllTests {
- // Junit 4 test case
-}
+/*****************************************************************************
+ * 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
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.interactionoverview.tests;
+
+import org.eclipse.papyrus.uml.diagram.interactionoverview.tests.canonical.AllCanonicalTests;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+//@formatter:off
+@RunWith(Suite.class)
+@SuiteClasses({
+// canonical
+AllCanonicalTests.class, })
+//@formatter:on
+public class AllTests {
+ // Junit 4 test case
+}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/IInteractionoverviewDiagramTestsConstants.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/IInteractionoverviewDiagramTestsConstants.java
new file mode 100644
index 00000000000..55fc420d489
--- /dev/null
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/IInteractionoverviewDiagramTestsConstants.java
@@ -0,0 +1,22 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nizar GUEDIDI (CEA LIST) - Initial API and implementation
+ /*****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.interactionoverview.tests;
+
+public interface IInteractionoverviewDiagramTestsConstants {
+
+ /** name of the test project */
+ public final String PROJECT_NAME = "InteractionoverviewDiagramTestProject";
+
+ /** name of the test model */
+ public final String FILE_NAME = "InteractionoverviewDiagramTest.di";
+} \ No newline at end of file
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AbstractInteractionOverviewDiagramTestCase.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AbstractInteractionOverviewDiagramTestCase.java
index f0fbb542387..da5da14147c 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AbstractInteractionOverviewDiagramTestCase.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AbstractInteractionOverviewDiagramTestCase.java
@@ -1,580 +1,591 @@
-/*****************************************************************************
- * 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.interactionoverview.tests.canonical;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.commands.operations.IOperationHistory;
-import org.eclipse.core.commands.operations.OperationHistoryEvent;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.FigureCanvas;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.requests.GroupRequest;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
-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.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
-import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
-import org.eclipse.gmf.runtime.diagram.ui.util.INotationType;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.ICreationCommand;
-import org.eclipse.papyrus.diagram.tests.canonical.AbstractPapyrusTestCase;
-import org.eclipse.papyrus.diagram.tests.canonical.TestChildNode;
-import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActivityActivityContentCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.common.command.wrappers.GEFtoEMFCommandWrapper;
-import org.eclipse.papyrus.uml.diagram.common.editparts.UMLNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.common.part.UmlGmfDiagramEditor;
-import org.eclipse.papyrus.uml.diagram.interactionoverview.InteractionOverviewDiagramCreateCommand;
-import org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CustomActivityEditPartTN;
-import org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CustomInteractionUseEditPartCN;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.uml2.uml.Model;
-import org.eclipse.uml2.uml.NamedElement;
-
-public class AbstractInteractionOverviewDiagramTestCase extends TestChildNode {
-
- private CustomActivityEditPartTN activityEditPartTN;
-
- private ActivityActivityContentCompartmentEditPart activityCompartmentEditPart;
-
- protected boolean operationFailed = false;
-
- protected ICreationCommand getDiagramCommandCreation() {
- return new InteractionOverviewDiagramCreateCommand();
- }
-
- /**
- * Create a view for the given type, plus the associated semantic element unless the given type is a notation-only
- * type.
- *
- * <ul>
- * <li>if type is an {@link INotationType}, then create a view using a {@link CreateViewRequest}
- * <li>otherwise, create a view and the corresponding semantic element using a CreateViewAndElementRequest
- * </ul>
- *
- * @param elementType
- * the type for which to create a view (and possibly a model element)
- * @param parentEditPart
- * the edit part to which the creation request must be sent
- * @return the created View
- */
- protected View createView(final IElementType elementType, final EditPart parentEditPart) {
- return createView(elementType, null, null, parentEditPart);
- }
-
- /**
- * Create a view for the given type, plus the associated semantic element unless the given type is a notation-only
- * type.
- *
- * <ul>
- * <li>if type is an {@link INotationType}, then create a view using a {@link CreateViewRequest}
- * <li>otherwise, create a view and the corresponding semantic element using a CreateViewAndElementRequest
- * </ul>
- *
- * @param elementType
- * the type for which to create a view (and possibly a model element)
- * @param location
- * the position of the new view (may be <code>null</code>)
- * @param size
- * the size of the new view (may be <code>null</code>)
- * @param parentEditPart
- * the edit part to which the creation request must be sent
- * @return the created View
- */
- protected View createView(final IElementType elementType, final Point location, final Dimension size, final EditPart parentEditPart) {
- final View[] result = new View[1];
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- final CreateViewRequest createRequest = CreateViewRequestFactory.getCreateShapeRequest(elementType, getDiagramEditPart().getDiagramPreferencesHint());
- if(size != null) {
- createRequest.setSize(size);
- }
- if(location != null) {
- createRequest.setLocation(location);
- }
- final Command command = parentEditPart.getCommand(createRequest);
- checkCommand(command);
- execute(command);
-
- result[0] = getCreatedViewFromCommand(command);
- }
- });
- return result[0];
- }
-
- protected static View getCreatedViewFromCommand(final Command command) {
- final List<CreateCommand> createCommands = new ArrayList<CreateCommand>();
- findNestedCreateCommands(command, createCommands);
- assertEquals("There should be one CreateCommand inside the command", 1, createCommands.size());
- final Object returnValue = createCommands.get(0).getCommandResult().getReturnValue();
- if(returnValue instanceof IAdaptable) {
- final IAdaptable adaptableResult = (IAdaptable)returnValue;
- final View view = (View)adaptableResult.getAdapter(View.class);
- if(view != null) {
- return view;
- }
- }
- fail("CreateView command result not found");
- return null;
- }
-
- private static void findNestedCreateCommands(final Command gefCommand, final List<CreateCommand> createCommands) {
- if(gefCommand instanceof CompoundCommand) {
- final CompoundCommand compoundCommand = (CompoundCommand)gefCommand;
- @SuppressWarnings("unchecked")
- final List<Command> commands = compoundCommand.getCommands();
- for(final Command childCommand : commands) {
- findNestedCreateCommands(childCommand, createCommands);
- }
- } else if(gefCommand instanceof ICommandProxy) {
- final ICommandProxy commandProxy = (ICommandProxy)gefCommand;
- final ICommand iCommand = commandProxy.getICommand();
- findNestedCreateCommands(iCommand, createCommands);
- }
- }
-
- private static void findNestedCreateCommands(final ICommand gmfCommand, final List<CreateCommand> createCommands) {
- if(gmfCommand instanceof CompositeCommand) {
- final CompositeCommand compositeCommand = (CompositeCommand)gmfCommand;
- final Iterator<?> iterator = compositeCommand.iterator();
- while(iterator.hasNext()) {
- final Object element = iterator.next();
- if(element instanceof ICommand) {
- final ICommand subCommand = (ICommand)element;
- findNestedCreateCommands(subCommand, createCommands);
- } else {
- fail("error");
- }
- }
- } else if(gmfCommand instanceof CreateCommand) {
- createCommands.add((CreateCommand)gmfCommand);
- } else if(gmfCommand instanceof CommandProxy) {
- final CommandProxy commandProxy = (CommandProxy)gmfCommand;
- findNestedCreateCommands(commandProxy.getCommand(), createCommands);
- }
- }
-
- protected CustomActivityEditPartTN createActivity() {
- return createActivity(new Point(0, 0), new Dimension(800, 400));
- }
-
- protected CustomActivityEditPartTN createActivity(final Point location, final Dimension dimension) {
- createView(UMLElementTypes.Activity_2001, location, dimension, getDiagramEditPart());
- activityEditPartTN = (CustomActivityEditPartTN)EditPartUtils.findFirstChildEditPartWithId(getDiagramEditPart(), CustomActivityEditPartTN.VISUAL_ID);
- activityCompartmentEditPart = (ActivityActivityContentCompartmentEditPart)EditPartUtils.findFirstChildEditPartWithId(activityEditPartTN, ActivityActivityContentCompartmentEditPart.VISUAL_ID);
- assertNotNull("The interaction EditPart was not found under the diagram EditPart", activityEditPartTN);
- final ActivityActivityContentCompartmentEditPart interactionCompartment = (ActivityActivityContentCompartmentEditPart)EditPartUtils.findFirstChildEditPartWithId(activityEditPartTN, ActivityActivityContentCompartmentEditPart.VISUAL_ID);
- assertNotNull("The interaction compartment was not found", interactionCompartment);
- return activityEditPartTN;
- }
-
- /** Execute the given command in the diagram editor. */
- protected void execute(final Command command) {
- resetLastOperationFailedState();
- getCommandStack().execute(new GEFtoEMFCommandWrapper(command));
- assertLastOperationSuccessful();
- }
-
- /** Undo the last command done in the diagram editor. */
- protected void undo() {
- resetLastOperationFailedState();
- final CommandStack commandStack = getCommandStack();
- assertTrue("We should be able to undo", commandStack.canUndo());
- commandStack.undo();
- assertLastOperationSuccessful();
- }
-
- /** Redo the last command undone in the diagram editor. */
- protected void redo() {
- resetLastOperationFailedState();
- final CommandStack commandStack = getCommandStack();
- assertTrue("We should be able to redo", commandStack.canRedo());
- commandStack.redo();
- assertLastOperationSuccessful();
- }
-
- /** Call {@link AbstractPapyrusTestCase#execute(Command) execute} on the UI thread. */
- protected void executeOnUIThread(final Command command) {
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- execute(command);
- }
- });
- }
-
- /** Call {@link AbstractPapyrusTestCase#undo() undo} on the UI thread. */
- protected void undoOnUIThread() {
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- undo();
- }
- });
- }
-
- /** Call {@link AbstractPapyrusTestCase#redo() redo} on the UI thread. */
- protected void redoOnUIThread() {
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- redo();
- }
- });
- }
-
- /**
- * Delete the View associated with the given EditPart, so that it is effectively hidden from the diagram without
- * removing the corresponding semantic element.
- */
- protected void hide(final GraphicalEditPart editPart) {
- final Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
- final Command command = editPart.getCommand(deleteViewRequest);
- execute(command);
- }
-
- /**
- * Reset the "operation failed" state. Call this before executing each operation for which you want to test whether
- * if failed with {@link AbstractPapyrusTestCase#assertLastOperationSuccessful()}.
- */
- protected void resetLastOperationFailedState() {
- this.operationFailed = false;
- }
-
- /**
- * Asserts that no Command executed on the {@link IOperationHistory} since the last call to
- * {@link AbstractPapyrusTestCase#resetLastOperationFailedState resetLastOperationFailedState} returned
- * {@link OperationHistoryEvent#OPERATION_NOT_OK}.
- *
- */
- protected void assertLastOperationSuccessful() {
- assertFalse("The operation failed. Look at the log, or put a breakpoint on ExecutionException or DefaultOperationHistory#notifyNotOK to find the cause.", this.operationFailed);
- }
-
- /** The command stack to use to execute commands on the diagram. */
- protected CommandStack getCommandStack() {
- // not "diagramEditor.getDiagramEditDomain().getDiagramCommandStack()" because it messes up undo contexts
- return this.diagramEditor.getEditingDomain().getCommandStack();
- }
-
- /** Check that the given command is executable. */
- protected static void checkCommand(final Command command) {
- assertNotNull("The command must not be null", command);
- assertTrue("The command must be executable", command.canExecute());
- }
-
- /**
- * This tests the deletion of the View for the given GraphicalEditPart (this checks that the View is removed, but
- * the semantic model is untouched).
- */
- protected void testHide(final GraphicalEditPart editPart) {
- final EditPart parent = editPart.getParent();
- final int sizeBefore = parent.getChildren().size();
- final EObject semanticElement = ((View)editPart.getModel()).getElement();
- assertTrue("The semantic element should be in a Model", isInModel(semanticElement));
-
- executeHideCommand(editPart);
- assertEquals("The parent edit part should now contain one less child", sizeBefore - 1, parent.getChildren().size());
- assertTrue("The semantic element should still be in the Model after deleting the View", isInModel(semanticElement));
- undo();
- assertEquals("The child should be back after the undo", sizeBefore, parent.getChildren().size());
- assertTrue("The semantic element should still be in the Model after undoing the View deletion", isInModel(semanticElement));
- redo();
- assertEquals("The child should be removed after the redo", sizeBefore - 1, parent.getChildren().size());
- assertTrue("The semantic element should still be in the Model after redoing the View deletion", isInModel(semanticElement));
- }
-
- /**
- * Return whether the given model element is contained by a UML {@link Model}. This is useful in order to determine
- * if an element was deleted (removed from the Model).
- */
- protected static boolean isInModel(final EObject semanticElement) {
- EObject parent = semanticElement.eContainer();
- while(parent != null) {
- if(parent instanceof Model) {
- return true;
- }
- parent = parent.eContainer();
- }
- return false;
- }
-
- /**
- * Send the given EditPart a "delete" request (which only deletes the View), and execute the returned command.
- *
- * @param editPart
- * the EditPart to hide
- */
- protected void executeHideCommand(final GraphicalEditPart editPart) {
- final GroupRequest deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
- deleteViewRequest.setEditParts(editPart);
- final Command command = editPart.getCommand(deleteViewRequest);
- checkCommand(command);
- execute(command);
- }
-
- /** This tests the destruction of both the model and View for the given GraphicalEditPart. */
- protected void testDelete(final GraphicalEditPart editPart) {
- final EditPart parent = editPart.getParent();
- final int sizeBefore = parent.getChildren().size();
- final EObject semanticElement = ((View)editPart.getModel()).getElement();
- assertTrue("The semantic element should be in a Model", isInModel(semanticElement));
-
- executeDestroyCommand(editPart);
- assertEquals("The parent edit part should now contain one less child", sizeBefore - 1, parent.getChildren().size());
- assertFalse("The semantic element should not be in the Model any more after deleting it", isInModel(semanticElement));
- undo();
- assertEquals("The child should be back after the undo", sizeBefore, parent.getChildren().size());
- assertTrue("The semantic element should be back in the Model after undoing the deletion", isInModel(semanticElement));
- redo();
- assertEquals("The child should be removed after the redo", sizeBefore - 1, parent.getChildren().size());
- assertFalse("The semantic element should not be in the Model after redoing the deletion", isInModel(semanticElement));
- }
-
- /**
- * Send the given EditPart a {@link DestroyElementRequest}, and execute the returned command.
- *
- * @param editPart
- * the EditPart to destroy
- */
- protected void executeDestroyCommand(final GraphicalEditPart editPart) {
- final Request destroyElementRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
- final Command command = editPart.getCommand(destroyElementRequest);
- checkCommand(command);
- execute(command);
- }
-
- /**
- * @param targetEditPart
- * the EditPart on top of which the drop will happen. This will determine the coordinates of the drop.
- * @param parentEditPart
- * the EditPart in which the element will really be added. Often the same EditPart as targetEditPart,
- * unless dropping on top of the first EditPart puts the element in another edit part.
- * @param droppedElement
- * the element to drop
- */
- public void testDrop(final GraphicalEditPart targetEditPart, final GraphicalEditPart parentEditPart, final EObject droppedElement) {
- final int sizeBefore = parentEditPart.getChildren().size();
- final DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
- final ArrayList<EObject> list = new ArrayList<EObject>();
- list.add(droppedElement);
- dropObjectsRequest.setObjects(list);
- dropObjectsRequest.setLocation(new Point(1, 1));
- final Command command = targetEditPart.getCommand(dropObjectsRequest);
- checkCommand(command);
- execute(command);
- assertEquals("The parent edit part should now contain one more child", sizeBefore + 1, parentEditPart.getChildren().size());
- assertTrue("The dropped element should now be in the Model", isInModel(droppedElement));
- undo();
- assertEquals("The editpart should be removed after undo", sizeBefore, parentEditPart.getChildren().size());
- assertTrue("The semantic element should still be in the Model after undoing the drop", isInModel(droppedElement));
- redo();
- assertEquals("The parent edit part should contain one more child after redo", sizeBefore + 1, parentEditPart.getChildren().size());
- assertTrue("The dropped element should be in the Model after redo", isInModel(droppedElement));
- }
-
- /**
- * Test setting the name on the given editPart, using a DirectEditRequest. Check that the name is set on the given
- * named element. Also test undo and redo.
- */
- protected <T extends EObject> void testSetNameWithDirectEditRequest(final GraphicalEditPart editPart, final T element, final INameProvider<T> nameProvider) {
- // set first name
- final String name1 = "test name 1 " + System.currentTimeMillis();
- setNameWithDirectEditRequest(editPart, name1);
- assertEquals("The element should have the first name", name1, nameProvider.getName(element));
- // set second name
- final String name2 = "test name 2 " + System.currentTimeMillis();
- setNameWithDirectEditRequest(editPart, name2);
- assertEquals("The element should have the second name", name2, nameProvider.getName(element));
- // test undo
- undo();
- assertEquals("The element name should be reset to the first name after undo", name1, nameProvider.getName(element));
- // test redo
- redo();
- assertEquals("The element name should be reset to the second name after redo", name2, nameProvider.getName(element));
- }
-
- /**
- * Test setting the name on the given editPart, using a DirectEditRequest. Check that the name is set on the given
- * named element. Also test undo and redo.
- */
- protected void testSetNameWithDirectEditRequest(final GraphicalEditPart editPart, final NamedElement namedElement) {
- testSetNameWithDirectEditRequest(editPart, namedElement, new INameProvider<NamedElement>() {
-
- public String getName(final NamedElement element) {
- return element.getName();
- }
- });
- }
-
- /**
- * Set the name of the given GraphicalEditPart (which must be a name edit part) using a DirectEditRequest. This sets
- * the name in the Text widget that appears as a result of the DirectEditRequest, and then closes the Text widget to
- * accept the changes.
- *
- * @param editPart
- * the edit part on which to perform the DirectEditRequest.
- * @param newName
- * the name to set
- */
- protected void setNameWithDirectEditRequest(final GraphicalEditPart editPart, final String newName) {
- final IFigure nameFigure = editPart.getFigure();
- final Rectangle bounds = nameFigure.getBounds();
- final Point center = bounds.getCenter();
- final DirectEditRequest directEditRequest = new DirectEditRequest();
- directEditRequest.setLocation(center);
- final Text textWidget = performDirectEditRequest(editPart, directEditRequest);
- setText(textWidget, newName);
- }
-
- protected interface INameProvider<T extends EObject> {
-
- String getName(T element);
- }
-
- /**
- * Performs the given DirectEditRequest on the given EditPart, and returns the Text widget that appears to let the
- * user edit the label.
- */
- protected Text performDirectEditRequest(final EditPart editPart, final DirectEditRequest directEditRequest) {
- final Text[] result = new Text[1];
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- // note: both operations need to be performed in the same display runnable
- editPart.performRequest(directEditRequest);
- result[0] = findVisibleTextWidgetOnDiagram();
- }
- });
- assertNotNull("The DirectEditRequest should open a Text field", result[0]);
- return result[0];
- }
-
- /** Finds a {@link Text} widget inside the diagram control ({@link FigureCanvas}). */
- protected Text findVisibleTextWidgetOnDiagram() {
- final Text[] result = new Text[1];
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- final Composite composite = (Composite)getDiagramEditor().getDiagramGraphicalViewer().getControl();
- result[0] = findVisibleTextWidget(composite);
- }
- });
- return result[0];
- }
-
- /** Finds a {@link Text} widget inside the given composite, recursively. */
- protected Text findVisibleTextWidget(final Composite composite) {
- final Control[] children = composite.getChildren();
- for(final Control child : children) {
- if(child instanceof Text) {
- final Text text = (Text)child;
- if(text.isVisible()) {
- return text;
- }
- } else if(child instanceof Composite) {
- final Composite childComposite = (Composite)child;
- final Text subresult = findVisibleTextWidget(childComposite);
- if(subresult != null) {
- return subresult;
- }
- }
- }
- return null;
- }
-
- protected UmlGmfDiagramEditor getDiagramEditor() {
- return this.diagramEditor;
- }
-
- /** Changes the text of the given Text widget, and then removes the focus from this text in order to commit changes. */
- protected static void setText(final Text textWidget, final String newName) {
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- textWidget.setText(newName);
- // change the focus in order to accept the text
- textWidget.getShell().setFocus();
- }
- });
- }
-
- protected EditPart getTopNodeCompartment() {
- return getDefaultActivityCompartment();
- }
-
- protected UMLNodeEditPart createChildNodeInTopNode(IElementType type) {
- return createChildNode(type, getDefaultActivityEditPart());
- }
-
- protected UMLNodeEditPart createChildNode(IElementType type, EditPart containerEditPart) {
- final EditPart compartment = getTopNodeCompartment();
- assertNotNull("The compartment must not be null", compartment);
- final View view = createView(type, compartment);
- assertNotNull("The InteractionUse View should be created", view);
- return (CustomInteractionUseEditPartCN)findChildEditPartAssociatedToView(compartment, view);
- }
-
- protected CustomActivityEditPartTN getDefaultActivityEditPart() {
- return this.activityEditPartTN;
- }
-
- protected ActivityActivityContentCompartmentEditPart getDefaultActivityCompartment() {
- return this.activityCompartmentEditPart;
- }
-
-
- protected static EditPart findChildEditPartAssociatedToView(final EditPart parentEditPart, final View view) {
- EditPart result = null;
- @SuppressWarnings("unchecked")
- final List<EditPart> children = parentEditPart.getChildren();
- for(final EditPart editPart : children) {
- if(view == editPart.getModel()) {
- result = editPart;
- }
- }
- assertNotNull("There should be an EditPart corresponding to the View", result);
- return result;
-
- }
-
- @Override
- protected CreateViewRequest createViewRequestShapeContainer() {
- // TODO Auto-generated method stub
- return null;
- }
-}
+/*****************************************************************************
+ * 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
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.interactionoverview.tests.canonical;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.core.commands.operations.OperationHistoryEvent;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.GroupRequest;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+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.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
+import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
+import org.eclipse.gmf.runtime.diagram.ui.util.INotationType;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.commands.ICreationCommand;
+import org.eclipse.papyrus.diagram.tests.canonical.AbstractPapyrusTestCase;
+import org.eclipse.papyrus.diagram.tests.canonical.TestChildNode;
+import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActivityActivityContentCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.command.wrappers.GEFtoEMFCommandWrapper;
+import org.eclipse.papyrus.uml.diagram.common.editparts.UMLNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.part.UmlGmfDiagramEditor;
+import org.eclipse.papyrus.uml.diagram.interactionoverview.InteractionOverviewDiagramCreateCommand;
+import org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CustomActivityEditPartTN;
+import org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CustomInteractionUseEditPartCN;
+import org.eclipse.papyrus.uml.diagram.interactionoverview.tests.IInteractionoverviewDiagramTestsConstants;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.NamedElement;
+
+public class AbstractInteractionOverviewDiagramTestCase extends TestChildNode {
+
+ private CustomActivityEditPartTN activityEditPartTN;
+
+ private ActivityActivityContentCompartmentEditPart activityCompartmentEditPart;
+
+ protected boolean operationFailed = false;
+
+ protected ICreationCommand getDiagramCommandCreation() {
+ return new InteractionOverviewDiagramCreateCommand();
+ }
+
+ @Override
+ protected String getProjectName() {
+ return IInteractionoverviewDiagramTestsConstants.PROJECT_NAME;
+ }
+
+ @Override
+ protected String getFileName() {
+ return IInteractionoverviewDiagramTestsConstants.FILE_NAME;
+ }
+
+ /**
+ * Create a view for the given type, plus the associated semantic element unless the given type is a notation-only
+ * type.
+ *
+ * <ul>
+ * <li>if type is an {@link INotationType}, then create a view using a {@link CreateViewRequest}
+ * <li>otherwise, create a view and the corresponding semantic element using a CreateViewAndElementRequest
+ * </ul>
+ *
+ * @param elementType
+ * the type for which to create a view (and possibly a model element)
+ * @param parentEditPart
+ * the edit part to which the creation request must be sent
+ * @return the created View
+ */
+ protected View createView(final IElementType elementType, final EditPart parentEditPart) {
+ return createView(elementType, null, null, parentEditPart);
+ }
+
+ /**
+ * Create a view for the given type, plus the associated semantic element unless the given type is a notation-only
+ * type.
+ *
+ * <ul>
+ * <li>if type is an {@link INotationType}, then create a view using a {@link CreateViewRequest}
+ * <li>otherwise, create a view and the corresponding semantic element using a CreateViewAndElementRequest
+ * </ul>
+ *
+ * @param elementType
+ * the type for which to create a view (and possibly a model element)
+ * @param location
+ * the position of the new view (may be <code>null</code>)
+ * @param size
+ * the size of the new view (may be <code>null</code>)
+ * @param parentEditPart
+ * the edit part to which the creation request must be sent
+ * @return the created View
+ */
+ protected View createView(final IElementType elementType, final Point location, final Dimension size, final EditPart parentEditPart) {
+ final View[] result = new View[1];
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ final CreateViewRequest createRequest = CreateViewRequestFactory.getCreateShapeRequest(elementType, getDiagramEditPart().getDiagramPreferencesHint());
+ if(size != null) {
+ createRequest.setSize(size);
+ }
+ if(location != null) {
+ createRequest.setLocation(location);
+ }
+ final Command command = parentEditPart.getCommand(createRequest);
+ checkCommand(command);
+ execute(command);
+
+ result[0] = getCreatedViewFromCommand(command);
+ }
+ });
+ return result[0];
+ }
+
+ protected static View getCreatedViewFromCommand(final Command command) {
+ final List<CreateCommand> createCommands = new ArrayList<CreateCommand>();
+ findNestedCreateCommands(command, createCommands);
+ assertEquals("There should be one CreateCommand inside the command", 1, createCommands.size());
+ final Object returnValue = createCommands.get(0).getCommandResult().getReturnValue();
+ if(returnValue instanceof IAdaptable) {
+ final IAdaptable adaptableResult = (IAdaptable)returnValue;
+ final View view = (View)adaptableResult.getAdapter(View.class);
+ if(view != null) {
+ return view;
+ }
+ }
+ fail("CreateView command result not found");
+ return null;
+ }
+
+ private static void findNestedCreateCommands(final Command gefCommand, final List<CreateCommand> createCommands) {
+ if(gefCommand instanceof CompoundCommand) {
+ final CompoundCommand compoundCommand = (CompoundCommand)gefCommand;
+ @SuppressWarnings("unchecked")
+ final List<Command> commands = compoundCommand.getCommands();
+ for(final Command childCommand : commands) {
+ findNestedCreateCommands(childCommand, createCommands);
+ }
+ } else if(gefCommand instanceof ICommandProxy) {
+ final ICommandProxy commandProxy = (ICommandProxy)gefCommand;
+ final ICommand iCommand = commandProxy.getICommand();
+ findNestedCreateCommands(iCommand, createCommands);
+ }
+ }
+
+ private static void findNestedCreateCommands(final ICommand gmfCommand, final List<CreateCommand> createCommands) {
+ if(gmfCommand instanceof CompositeCommand) {
+ final CompositeCommand compositeCommand = (CompositeCommand)gmfCommand;
+ final Iterator<?> iterator = compositeCommand.iterator();
+ while(iterator.hasNext()) {
+ final Object element = iterator.next();
+ if(element instanceof ICommand) {
+ final ICommand subCommand = (ICommand)element;
+ findNestedCreateCommands(subCommand, createCommands);
+ } else {
+ fail("error");
+ }
+ }
+ } else if(gmfCommand instanceof CreateCommand) {
+ createCommands.add((CreateCommand)gmfCommand);
+ } else if(gmfCommand instanceof CommandProxy) {
+ final CommandProxy commandProxy = (CommandProxy)gmfCommand;
+ findNestedCreateCommands(commandProxy.getCommand(), createCommands);
+ }
+ }
+
+ protected CustomActivityEditPartTN createActivity() {
+ return createActivity(new Point(0, 0), new Dimension(800, 400));
+ }
+
+ protected CustomActivityEditPartTN createActivity(final Point location, final Dimension dimension) {
+ createView(UMLElementTypes.Activity_2001, location, dimension, getDiagramEditPart());
+ activityEditPartTN = (CustomActivityEditPartTN)EditPartUtils.findFirstChildEditPartWithId(getDiagramEditPart(), CustomActivityEditPartTN.VISUAL_ID);
+ activityCompartmentEditPart = (ActivityActivityContentCompartmentEditPart)EditPartUtils.findFirstChildEditPartWithId(activityEditPartTN, ActivityActivityContentCompartmentEditPart.VISUAL_ID);
+ assertNotNull("The interaction EditPart was not found under the diagram EditPart", activityEditPartTN);
+ final ActivityActivityContentCompartmentEditPart interactionCompartment = (ActivityActivityContentCompartmentEditPart)EditPartUtils.findFirstChildEditPartWithId(activityEditPartTN, ActivityActivityContentCompartmentEditPart.VISUAL_ID);
+ assertNotNull("The interaction compartment was not found", interactionCompartment);
+ return activityEditPartTN;
+ }
+
+ /** Execute the given command in the diagram editor. */
+ protected void execute(final Command command) {
+ resetLastOperationFailedState();
+ getCommandStack().execute(new GEFtoEMFCommandWrapper(command));
+ assertLastOperationSuccessful();
+ }
+
+ /** Undo the last command done in the diagram editor. */
+ protected void undo() {
+ resetLastOperationFailedState();
+ final CommandStack commandStack = getCommandStack();
+ assertTrue("We should be able to undo", commandStack.canUndo());
+ commandStack.undo();
+ assertLastOperationSuccessful();
+ }
+
+ /** Redo the last command undone in the diagram editor. */
+ protected void redo() {
+ resetLastOperationFailedState();
+ final CommandStack commandStack = getCommandStack();
+ assertTrue("We should be able to redo", commandStack.canRedo());
+ commandStack.redo();
+ assertLastOperationSuccessful();
+ }
+
+ /** Call {@link AbstractPapyrusTestCase#execute(Command) execute} on the UI thread. */
+ protected void executeOnUIThread(final Command command) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ execute(command);
+ }
+ });
+ }
+
+ /** Call {@link AbstractPapyrusTestCase#undo() undo} on the UI thread. */
+ protected void undoOnUIThread() {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ undo();
+ }
+ });
+ }
+
+ /** Call {@link AbstractPapyrusTestCase#redo() redo} on the UI thread. */
+ protected void redoOnUIThread() {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ redo();
+ }
+ });
+ }
+
+ /**
+ * Delete the View associated with the given EditPart, so that it is effectively hidden from the diagram without
+ * removing the corresponding semantic element.
+ */
+ protected void hide(final GraphicalEditPart editPart) {
+ final Request deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
+ final Command command = editPart.getCommand(deleteViewRequest);
+ execute(command);
+ }
+
+ /**
+ * Reset the "operation failed" state. Call this before executing each operation for which you want to test whether
+ * if failed with {@link AbstractPapyrusTestCase#assertLastOperationSuccessful()}.
+ */
+ protected void resetLastOperationFailedState() {
+ this.operationFailed = false;
+ }
+
+ /**
+ * Asserts that no Command executed on the {@link IOperationHistory} since the last call to
+ * {@link AbstractPapyrusTestCase#resetLastOperationFailedState resetLastOperationFailedState} returned
+ * {@link OperationHistoryEvent#OPERATION_NOT_OK}.
+ *
+ */
+ protected void assertLastOperationSuccessful() {
+ assertFalse("The operation failed. Look at the log, or put a breakpoint on ExecutionException or DefaultOperationHistory#notifyNotOK to find the cause.", this.operationFailed);
+ }
+
+ /** The command stack to use to execute commands on the diagram. */
+ protected CommandStack getCommandStack() {
+ // not "diagramEditor.getDiagramEditDomain().getDiagramCommandStack()" because it messes up undo contexts
+ return this.diagramEditor.getEditingDomain().getCommandStack();
+ }
+
+ /** Check that the given command is executable. */
+ protected static void checkCommand(final Command command) {
+ assertNotNull("The command must not be null", command);
+ assertTrue("The command must be executable", command.canExecute());
+ }
+
+ /**
+ * This tests the deletion of the View for the given GraphicalEditPart (this checks that the View is removed, but
+ * the semantic model is untouched).
+ */
+ protected void testHide(final GraphicalEditPart editPart) {
+ final EditPart parent = editPart.getParent();
+ final int sizeBefore = parent.getChildren().size();
+ final EObject semanticElement = ((View)editPart.getModel()).getElement();
+ assertTrue("The semantic element should be in a Model", isInModel(semanticElement));
+
+ executeHideCommand(editPart);
+ assertEquals("The parent edit part should now contain one less child", sizeBefore - 1, parent.getChildren().size());
+ assertTrue("The semantic element should still be in the Model after deleting the View", isInModel(semanticElement));
+ undo();
+ assertEquals("The child should be back after the undo", sizeBefore, parent.getChildren().size());
+ assertTrue("The semantic element should still be in the Model after undoing the View deletion", isInModel(semanticElement));
+ redo();
+ assertEquals("The child should be removed after the redo", sizeBefore - 1, parent.getChildren().size());
+ assertTrue("The semantic element should still be in the Model after redoing the View deletion", isInModel(semanticElement));
+ }
+
+ /**
+ * Return whether the given model element is contained by a UML {@link Model}. This is useful in order to determine
+ * if an element was deleted (removed from the Model).
+ */
+ protected static boolean isInModel(final EObject semanticElement) {
+ EObject parent = semanticElement.eContainer();
+ while(parent != null) {
+ if(parent instanceof Model) {
+ return true;
+ }
+ parent = parent.eContainer();
+ }
+ return false;
+ }
+
+ /**
+ * Send the given EditPart a "delete" request (which only deletes the View), and execute the returned command.
+ *
+ * @param editPart
+ * the EditPart to hide
+ */
+ protected void executeHideCommand(final GraphicalEditPart editPart) {
+ final GroupRequest deleteViewRequest = new GroupRequest(RequestConstants.REQ_DELETE);
+ deleteViewRequest.setEditParts(editPart);
+ final Command command = editPart.getCommand(deleteViewRequest);
+ checkCommand(command);
+ execute(command);
+ }
+
+ /** This tests the destruction of both the model and View for the given GraphicalEditPart. */
+ protected void testDelete(final GraphicalEditPart editPart) {
+ final EditPart parent = editPart.getParent();
+ final int sizeBefore = parent.getChildren().size();
+ final EObject semanticElement = ((View)editPart.getModel()).getElement();
+ assertTrue("The semantic element should be in a Model", isInModel(semanticElement));
+
+ executeDestroyCommand(editPart);
+ assertEquals("The parent edit part should now contain one less child", sizeBefore - 1, parent.getChildren().size());
+ assertFalse("The semantic element should not be in the Model any more after deleting it", isInModel(semanticElement));
+ undo();
+ assertEquals("The child should be back after the undo", sizeBefore, parent.getChildren().size());
+ assertTrue("The semantic element should be back in the Model after undoing the deletion", isInModel(semanticElement));
+ redo();
+ assertEquals("The child should be removed after the redo", sizeBefore - 1, parent.getChildren().size());
+ assertFalse("The semantic element should not be in the Model after redoing the deletion", isInModel(semanticElement));
+ }
+
+ /**
+ * Send the given EditPart a {@link DestroyElementRequest}, and execute the returned command.
+ *
+ * @param editPart
+ * the EditPart to destroy
+ */
+ protected void executeDestroyCommand(final GraphicalEditPart editPart) {
+ final Request destroyElementRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
+ final Command command = editPart.getCommand(destroyElementRequest);
+ checkCommand(command);
+ execute(command);
+ }
+
+ /**
+ * @param targetEditPart
+ * the EditPart on top of which the drop will happen. This will determine the coordinates of the drop.
+ * @param parentEditPart
+ * the EditPart in which the element will really be added. Often the same EditPart as targetEditPart,
+ * unless dropping on top of the first EditPart puts the element in another edit part.
+ * @param droppedElement
+ * the element to drop
+ */
+ public void testDrop(final GraphicalEditPart targetEditPart, final GraphicalEditPart parentEditPart, final EObject droppedElement) {
+ final int sizeBefore = parentEditPart.getChildren().size();
+ final DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
+ final ArrayList<EObject> list = new ArrayList<EObject>();
+ list.add(droppedElement);
+ dropObjectsRequest.setObjects(list);
+ dropObjectsRequest.setLocation(new Point(1, 1));
+ final Command command = targetEditPart.getCommand(dropObjectsRequest);
+ checkCommand(command);
+ execute(command);
+ assertEquals("The parent edit part should now contain one more child", sizeBefore + 1, parentEditPart.getChildren().size());
+ assertTrue("The dropped element should now be in the Model", isInModel(droppedElement));
+ undo();
+ assertEquals("The editpart should be removed after undo", sizeBefore, parentEditPart.getChildren().size());
+ assertTrue("The semantic element should still be in the Model after undoing the drop", isInModel(droppedElement));
+ redo();
+ assertEquals("The parent edit part should contain one more child after redo", sizeBefore + 1, parentEditPart.getChildren().size());
+ assertTrue("The dropped element should be in the Model after redo", isInModel(droppedElement));
+ }
+
+ /**
+ * Test setting the name on the given editPart, using a DirectEditRequest. Check that the name is set on the given
+ * named element. Also test undo and redo.
+ */
+ protected <T extends EObject> void testSetNameWithDirectEditRequest(final GraphicalEditPart editPart, final T element, final INameProvider<T> nameProvider) {
+ // set first name
+ final String name1 = "test name 1 " + System.currentTimeMillis();
+ setNameWithDirectEditRequest(editPart, name1);
+ assertEquals("The element should have the first name", name1, nameProvider.getName(element));
+ // set second name
+ final String name2 = "test name 2 " + System.currentTimeMillis();
+ setNameWithDirectEditRequest(editPart, name2);
+ assertEquals("The element should have the second name", name2, nameProvider.getName(element));
+ // test undo
+ undo();
+ assertEquals("The element name should be reset to the first name after undo", name1, nameProvider.getName(element));
+ // test redo
+ redo();
+ assertEquals("The element name should be reset to the second name after redo", name2, nameProvider.getName(element));
+ }
+
+ /**
+ * Test setting the name on the given editPart, using a DirectEditRequest. Check that the name is set on the given
+ * named element. Also test undo and redo.
+ */
+ protected void testSetNameWithDirectEditRequest(final GraphicalEditPart editPart, final NamedElement namedElement) {
+ testSetNameWithDirectEditRequest(editPart, namedElement, new INameProvider<NamedElement>() {
+
+ public String getName(final NamedElement element) {
+ return element.getName();
+ }
+ });
+ }
+
+ /**
+ * Set the name of the given GraphicalEditPart (which must be a name edit part) using a DirectEditRequest. This sets
+ * the name in the Text widget that appears as a result of the DirectEditRequest, and then closes the Text widget to
+ * accept the changes.
+ *
+ * @param editPart
+ * the edit part on which to perform the DirectEditRequest.
+ * @param newName
+ * the name to set
+ */
+ protected void setNameWithDirectEditRequest(final GraphicalEditPart editPart, final String newName) {
+ final IFigure nameFigure = editPart.getFigure();
+ final Rectangle bounds = nameFigure.getBounds();
+ final Point center = bounds.getCenter();
+ final DirectEditRequest directEditRequest = new DirectEditRequest();
+ directEditRequest.setLocation(center);
+ final Text textWidget = performDirectEditRequest(editPart, directEditRequest);
+ setText(textWidget, newName);
+ }
+
+ protected interface INameProvider<T extends EObject> {
+
+ String getName(T element);
+ }
+
+ /**
+ * Performs the given DirectEditRequest on the given EditPart, and returns the Text widget that appears to let the
+ * user edit the label.
+ */
+ protected Text performDirectEditRequest(final EditPart editPart, final DirectEditRequest directEditRequest) {
+ final Text[] result = new Text[1];
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ // note: both operations need to be performed in the same display runnable
+ editPart.performRequest(directEditRequest);
+ result[0] = findVisibleTextWidgetOnDiagram();
+ }
+ });
+ assertNotNull("The DirectEditRequest should open a Text field", result[0]);
+ return result[0];
+ }
+
+ /** Finds a {@link Text} widget inside the diagram control ({@link FigureCanvas}). */
+ protected Text findVisibleTextWidgetOnDiagram() {
+ final Text[] result = new Text[1];
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ final Composite composite = (Composite)getDiagramEditor().getDiagramGraphicalViewer().getControl();
+ result[0] = findVisibleTextWidget(composite);
+ }
+ });
+ return result[0];
+ }
+
+ /** Finds a {@link Text} widget inside the given composite, recursively. */
+ protected Text findVisibleTextWidget(final Composite composite) {
+ final Control[] children = composite.getChildren();
+ for(final Control child : children) {
+ if(child instanceof Text) {
+ final Text text = (Text)child;
+ if(text.isVisible()) {
+ return text;
+ }
+ } else if(child instanceof Composite) {
+ final Composite childComposite = (Composite)child;
+ final Text subresult = findVisibleTextWidget(childComposite);
+ if(subresult != null) {
+ return subresult;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected UmlGmfDiagramEditor getDiagramEditor() {
+ return this.diagramEditor;
+ }
+
+ /** Changes the text of the given Text widget, and then removes the focus from this text in order to commit changes. */
+ protected static void setText(final Text textWidget, final String newName) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ textWidget.setText(newName);
+ // change the focus in order to accept the text
+ textWidget.getShell().setFocus();
+ }
+ });
+ }
+
+ protected EditPart getTopNodeCompartment() {
+ return getDefaultActivityCompartment();
+ }
+
+ protected UMLNodeEditPart createChildNodeInTopNode(IElementType type) {
+ return createChildNode(type, getDefaultActivityEditPart());
+ }
+
+ protected UMLNodeEditPart createChildNode(IElementType type, EditPart containerEditPart) {
+ final EditPart compartment = getTopNodeCompartment();
+ assertNotNull("The compartment must not be null", compartment);
+ final View view = createView(type, compartment);
+ assertNotNull("The InteractionUse View should be created", view);
+ return (CustomInteractionUseEditPartCN)findChildEditPartAssociatedToView(compartment, view);
+ }
+
+ protected CustomActivityEditPartTN getDefaultActivityEditPart() {
+ return this.activityEditPartTN;
+ }
+
+ protected ActivityActivityContentCompartmentEditPart getDefaultActivityCompartment() {
+ return this.activityCompartmentEditPart;
+ }
+
+
+ protected static EditPart findChildEditPartAssociatedToView(final EditPart parentEditPart, final View view) {
+ EditPart result = null;
+ @SuppressWarnings("unchecked")
+ final List<EditPart> children = parentEditPart.getChildren();
+ for(final EditPart editPart : children) {
+ if(view == editPart.getModel()) {
+ result = editPart;
+ }
+ }
+ assertNotNull("There should be an EditPart corresponding to the View", result);
+ return result;
+
+ }
+
+ @Override
+ protected CreateViewRequest createViewRequestShapeContainer() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AllCanonicalTests.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AllCanonicalTests.java
index aa7d8815158..49e53adcd25 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AllCanonicalTests.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AllCanonicalTests.java
@@ -1,24 +1,24 @@
-/*****************************************************************************
- * 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.interactionoverview.tests.canonical;
-
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-//@formatter:off
-@RunWith(Suite.class)
-@SuiteClasses({ TestInteractionOverviewDiagramActivityTN.class, TestInteractionOverviewDiagramChildNode.class, })
-//@formatter:on
-public class AllCanonicalTests {
- // Junit 4 test case
-}
+/*****************************************************************************
+ * 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
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.interactionoverview.tests.canonical;
+
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+//@formatter:off
+@RunWith(Suite.class)
+@SuiteClasses({ TestInteractionOverviewDiagramActivityTN.class, TestInteractionOverviewDiagramChildNode.class, })
+//@formatter:on
+public class AllCanonicalTests {
+ // Junit 4 test case
+}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionOverviewDiagramActivityTN.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionOverviewDiagramActivityTN.java
index eaa257f9de9..c81098c2fde 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionOverviewDiagramActivityTN.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionOverviewDiagramActivityTN.java
@@ -1,89 +1,89 @@
-/*****************************************************************************
- * 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.interactionoverview.tests.canonical;
-
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActivityNameEditPart;
-import org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CustomActivityEditPartTN;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.intro.IIntroManager;
-import org.eclipse.ui.intro.IIntroPart;
-import org.eclipse.uml2.uml.Activity;
-import org.eclipse.uml2.uml.NamedElement;
-import org.junit.Test;
-
-
-public class TestInteractionOverviewDiagramActivityTN extends AbstractInteractionOverviewDiagramTestCase {
-
- @Override
- public void setUp() throws Exception {
-
- removeWelcomeScreen();
- projectCreation();
- createActivity();
-
- assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 1);
- GraphicalEditPart containerEditPart = (GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
- rootCompartment = null;
- int index = 0;
- while(rootCompartment == null && index < containerEditPart.getChildren().size()) {
- if((containerEditPart.getChildren().get(index)) instanceof ShapeCompartmentEditPart) {
- rootCompartment = (ShapeCompartmentEditPart)(containerEditPart.getChildren().get(index));
- }
- index++;
- }
- }
-
- protected void removeWelcomeScreen() {
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- IIntroManager introManager = PlatformUI.getWorkbench().getIntroManager();
- IIntroPart intro = introManager.getIntro();
- introManager.closeIntro(intro);
- }
- });
- }
-
- @Test
- public void testCreateInteraction() {
- createActivity();
- }
-
- @Test
- public void testDeleteActivity() {
- final CustomActivityEditPartTN activity = createActivity();
- testDelete(activity);
- }
-
- @Test
- public void testCreateThreeInteractions() {
- final CustomActivityEditPartTN activity1 = createActivity();
- final CustomActivityEditPartTN activity2 = createActivity();
- final CustomActivityEditPartTN activity3 = createActivity();
- // 4 activity as setup create one already
- assertEquals("The diagram should only contain the 3 interactions", 4, getDiagramEditPart().getChildren().size());
- assertTrue("The first interaction should be found in the diagram", getDiagramEditPart().getChildren().contains(activity1));
- assertTrue("The second interaction should be found in the diagram", getDiagramEditPart().getChildren().contains(activity2));
- assertTrue("The third interaction should be found in the diagram", getDiagramEditPart().getChildren().contains(activity3));
- }
-
- @Test
- public void testEditInteractionName() {
- final CustomActivityEditPartTN activityEditPart = createActivity();
- final ActivityNameEditPart activityNameEditPart = (ActivityNameEditPart)EditPartUtils.findFirstChildEditPartWithId(activityEditPart, ActivityNameEditPart.VISUAL_ID);
- final NamedElement namedElement = (Activity)activityEditPart.getUMLElement();
- testSetNameWithDirectEditRequest(activityNameEditPart, namedElement);
- }
-}
+/*****************************************************************************
+ * 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
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.interactionoverview.tests.canonical;
+
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActivityNameEditPart;
+import org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CustomActivityEditPartTN;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.intro.IIntroManager;
+import org.eclipse.ui.intro.IIntroPart;
+import org.eclipse.uml2.uml.Activity;
+import org.eclipse.uml2.uml.NamedElement;
+import org.junit.Test;
+
+
+public class TestInteractionOverviewDiagramActivityTN extends AbstractInteractionOverviewDiagramTestCase {
+
+ @Override
+ public void setUp() throws Exception {
+
+ removeWelcomeScreen();
+ projectCreation();
+ createActivity();
+
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 1);
+ GraphicalEditPart containerEditPart = (GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
+ rootCompartment = null;
+ int index = 0;
+ while(rootCompartment == null && index < containerEditPart.getChildren().size()) {
+ if((containerEditPart.getChildren().get(index)) instanceof ShapeCompartmentEditPart) {
+ rootCompartment = (ShapeCompartmentEditPart)(containerEditPart.getChildren().get(index));
+ }
+ index++;
+ }
+ }
+
+ protected void removeWelcomeScreen() {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ IIntroManager introManager = PlatformUI.getWorkbench().getIntroManager();
+ IIntroPart intro = introManager.getIntro();
+ introManager.closeIntro(intro);
+ }
+ });
+ }
+
+ @Test
+ public void testCreateInteraction() {
+ createActivity();
+ }
+
+ @Test
+ public void testDeleteActivity() {
+ final CustomActivityEditPartTN activity = createActivity();
+ testDelete(activity);
+ }
+
+ @Test
+ public void testCreateThreeInteractions() {
+ final CustomActivityEditPartTN activity1 = createActivity();
+ final CustomActivityEditPartTN activity2 = createActivity();
+ final CustomActivityEditPartTN activity3 = createActivity();
+ // 4 activity as setup create one already
+ assertEquals("The diagram should only contain the 3 interactions", 4, getDiagramEditPart().getChildren().size());
+ assertTrue("The first interaction should be found in the diagram", getDiagramEditPart().getChildren().contains(activity1));
+ assertTrue("The second interaction should be found in the diagram", getDiagramEditPart().getChildren().contains(activity2));
+ assertTrue("The third interaction should be found in the diagram", getDiagramEditPart().getChildren().contains(activity3));
+ }
+
+ @Test
+ public void testEditInteractionName() {
+ final CustomActivityEditPartTN activityEditPart = createActivity();
+ final ActivityNameEditPart activityNameEditPart = (ActivityNameEditPart)EditPartUtils.findFirstChildEditPartWithId(activityEditPart, ActivityNameEditPart.VISUAL_ID);
+ final NamedElement namedElement = (Activity)activityEditPart.getUMLElement();
+ testSetNameWithDirectEditRequest(activityNameEditPart, namedElement);
+ }
+}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionOverviewDiagramChildNode.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionOverviewDiagramChildNode.java
index dc0d857b9a0..58a43e2b4c9 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionOverviewDiagramChildNode.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionOverviewDiagramChildNode.java
@@ -1,109 +1,109 @@
-/*****************************************************************************
- * 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.interactionoverview.tests.canonical;
-
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.papyrus.commands.ICreationCommand;
-import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.interactionoverview.InteractionOverviewDiagramCreateCommand;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestInteractionOverviewDiagramChildNode extends AbstractInteractionOverviewDiagramTestCase {
-
- @Before
- @Override
- protected void setUp() throws Exception {
- projectCreation();
- createActivity();
-
- assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 1);
- GraphicalEditPart containerEditPart = (GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
- rootCompartment = null;
- int index = 0;
- while(rootCompartment == null && index < containerEditPart.getChildren().size()) {
- if((containerEditPart.getChildren().get(index)) instanceof ShapeCompartmentEditPart) {
- rootCompartment = (ShapeCompartmentEditPart)(containerEditPart.getChildren().get(index));
- }
- index++;
- }
-
- }
-
- @Override
- protected CreateViewRequest createViewRequestShapeContainer() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected ICreationCommand getDiagramCommandCreation() {
- return new InteractionOverviewDiagramCreateCommand();
- }
-
- @Test
- public void testToManageCallBehaviorAction() {
- testToManageNode(UMLElementTypes.CallBehaviorAction_3008, UMLPackage.eINSTANCE.getCallBehaviorAction(), UMLElementTypes.StructuredActivityNode_3065, false);
- }
-
- @Test
- public void testToManageInitialNode() {
- testToManageNode(UMLElementTypes.InitialNode_3004, UMLPackage.eINSTANCE.getInitialNode(), UMLElementTypes.StructuredActivityNode_3065, false);
- }
-
- @Test
- public void testToManageActivityFinalNode() {
- testToManageNode(UMLElementTypes.ActivityFinalNode_3005, UMLPackage.eINSTANCE.getActivityFinalNode(), UMLElementTypes.StructuredActivityNode_3065, false);
- }
-
- @Test
- public void testToManageDecisionNode() {
- testToManageNode(UMLElementTypes.DecisionNode_3038, UMLPackage.eINSTANCE.getDecisionNode(), UMLElementTypes.StructuredActivityNode_3065, false);
- }
-
- @Test
- public void testToManageFlowFinalNode() {
- testToManageNode(UMLElementTypes.FlowFinalNode_3006, UMLPackage.eINSTANCE.getFlowFinalNode(), UMLElementTypes.StructuredActivityNode_3065, false);
- }
-
- @Test
- public void testToManageForkNode() {
- testToManageNode(UMLElementTypes.ForkNode_3040, UMLPackage.eINSTANCE.getForkNode(), UMLElementTypes.StructuredActivityNode_3065, false);
- }
-
- @Test
- public void testToManageJoinNode() {
- testToManageNode(UMLElementTypes.JoinNode_3041, UMLPackage.eINSTANCE.getJoinNode(), UMLElementTypes.StructuredActivityNode_3065, false);
- }
-
- @Test
- public void testToManageMergeNode() {
- testToManageNode(UMLElementTypes.MergeNode_3039, UMLPackage.eINSTANCE.getMergeNode(), UMLElementTypes.StructuredActivityNode_3065, false);
- }
-
- @Test
- public void testToManageConditionalNode() {
- testToManageNode(UMLElementTypes.ConditionalNode_3069, UMLPackage.eINSTANCE.getConditionalNode(), UMLElementTypes.StructuredActivityNode_3065, false);
- }
-
- @Test
- public void testToManageLoopNode() {
- testToManageNode(UMLElementTypes.LoopNode_3071, UMLPackage.eINSTANCE.getLoopNode(), UMLElementTypes.StructuredActivityNode_3065, false);
- }
-
- @Test
- public void testToManageSequenceNode() {
- testToManageNode(UMLElementTypes.SequenceNode_3073, UMLPackage.eINSTANCE.getSequenceNode(), UMLElementTypes.StructuredActivityNode_3065, false);
- }
-}
+/*****************************************************************************
+ * 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
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.interactionoverview.tests.canonical;
+
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.papyrus.commands.ICreationCommand;
+import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.interactionoverview.InteractionOverviewDiagramCreateCommand;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestInteractionOverviewDiagramChildNode extends AbstractInteractionOverviewDiagramTestCase {
+
+ @Before
+ @Override
+ protected void setUp() throws Exception {
+ projectCreation();
+ createActivity();
+
+ assertTrue(CREATION + INITIALIZATION_TEST, getDiagramEditPart().getChildren().size() == 1);
+ GraphicalEditPart containerEditPart = (GraphicalEditPart)getDiagramEditPart().getChildren().get(0);
+ rootCompartment = null;
+ int index = 0;
+ while(rootCompartment == null && index < containerEditPart.getChildren().size()) {
+ if((containerEditPart.getChildren().get(index)) instanceof ShapeCompartmentEditPart) {
+ rootCompartment = (ShapeCompartmentEditPart)(containerEditPart.getChildren().get(index));
+ }
+ index++;
+ }
+
+ }
+
+ @Override
+ protected CreateViewRequest createViewRequestShapeContainer() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected ICreationCommand getDiagramCommandCreation() {
+ return new InteractionOverviewDiagramCreateCommand();
+ }
+
+ @Test
+ public void testToManageCallBehaviorAction() {
+ testToManageNode(UMLElementTypes.CallBehaviorAction_3008, UMLPackage.eINSTANCE.getCallBehaviorAction(), UMLElementTypes.StructuredActivityNode_3065, false);
+ }
+
+ @Test
+ public void testToManageInitialNode() {
+ testToManageNode(UMLElementTypes.InitialNode_3004, UMLPackage.eINSTANCE.getInitialNode(), UMLElementTypes.StructuredActivityNode_3065, false);
+ }
+
+ @Test
+ public void testToManageActivityFinalNode() {
+ testToManageNode(UMLElementTypes.ActivityFinalNode_3005, UMLPackage.eINSTANCE.getActivityFinalNode(), UMLElementTypes.StructuredActivityNode_3065, false);
+ }
+
+ @Test
+ public void testToManageDecisionNode() {
+ testToManageNode(UMLElementTypes.DecisionNode_3038, UMLPackage.eINSTANCE.getDecisionNode(), UMLElementTypes.StructuredActivityNode_3065, false);
+ }
+
+ @Test
+ public void testToManageFlowFinalNode() {
+ testToManageNode(UMLElementTypes.FlowFinalNode_3006, UMLPackage.eINSTANCE.getFlowFinalNode(), UMLElementTypes.StructuredActivityNode_3065, false);
+ }
+
+ @Test
+ public void testToManageForkNode() {
+ testToManageNode(UMLElementTypes.ForkNode_3040, UMLPackage.eINSTANCE.getForkNode(), UMLElementTypes.StructuredActivityNode_3065, false);
+ }
+
+ @Test
+ public void testToManageJoinNode() {
+ testToManageNode(UMLElementTypes.JoinNode_3041, UMLPackage.eINSTANCE.getJoinNode(), UMLElementTypes.StructuredActivityNode_3065, false);
+ }
+
+ @Test
+ public void testToManageMergeNode() {
+ testToManageNode(UMLElementTypes.MergeNode_3039, UMLPackage.eINSTANCE.getMergeNode(), UMLElementTypes.StructuredActivityNode_3065, false);
+ }
+
+ @Test
+ public void testToManageConditionalNode() {
+ testToManageNode(UMLElementTypes.ConditionalNode_3069, UMLPackage.eINSTANCE.getConditionalNode(), UMLElementTypes.StructuredActivityNode_3065, false);
+ }
+
+ @Test
+ public void testToManageLoopNode() {
+ testToManageNode(UMLElementTypes.LoopNode_3071, UMLPackage.eINSTANCE.getLoopNode(), UMLElementTypes.StructuredActivityNode_3065, false);
+ }
+
+ @Test
+ public void testToManageSequenceNode() {
+ testToManageNode(UMLElementTypes.SequenceNode_3073, UMLPackage.eINSTANCE.getSequenceNode(), UMLElementTypes.StructuredActivityNode_3065, false);
+ }
+}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionUse.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionUse.java
index cd28c9ff460..702d44f3839 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionUse.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/TestInteractionUse.java
@@ -1,72 +1,72 @@
-/*****************************************************************************
- * 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.interactionoverview.tests.canonical;
-
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.common.editparts.UMLNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CustomInteractionUseEditPartCN;
-import org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CustomInteractionUseNameEditPart;
-import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
-import org.eclipse.uml2.uml.CallBehaviorAction;
-import org.eclipse.uml2.uml.NamedElement;
-import org.junit.Test;
-
-public class TestInteractionUse extends AbstractInteractionOverviewDiagramTestCase {
-
- @Override
- public void setUp() throws Exception {
- // create the project, model and diagram
- super.setUp();
- createActivity();
- }
-
- @Test
- public void testCreateInteractionUse() {
- createChildNodeInTopNode(UMLElementTypes.CallBehaviorAction_3008);
- }
-
- @Test
- public void testDeleteInteractionUse() {
- final CustomInteractionUseEditPartCN interactionUse = (CustomInteractionUseEditPartCN)createChildNodeInTopNode(UMLElementTypes.CallBehaviorAction_3008);
- testDelete(interactionUse);
- }
-
- @Test
- public void testDropLifeline() {
- // create a Lifeline and hide its View, so as to be able to drop it after that
- final UMLNodeEditPart interactionUseEditPart = createChildNodeInTopNode(UMLElementTypes.CallBehaviorAction_3008);
- final CallBehaviorAction callBehaviorAction = (CallBehaviorAction)((View)interactionUseEditPart.getModel()).getElement();
- assertNotNull("The CallBehavior should not be null", callBehaviorAction);
- testHide(interactionUseEditPart);
- testDrop(getDefaultActivityCompartment(), getDefaultActivityCompartment(), callBehaviorAction);
- }
-
-
- @Test
- public void testCreateThreeInteractions() {
- final UMLNodeEditPart interactionUse1 = createChildNodeInTopNode(UMLElementTypes.CallBehaviorAction_3008);
- final UMLNodeEditPart interactionUse2 = createChildNodeInTopNode(UMLElementTypes.CallBehaviorAction_3008);
- final UMLNodeEditPart interactionUse3 = createChildNodeInTopNode(UMLElementTypes.CallBehaviorAction_3008);
- assertEquals("The diagram should only contain the 3 interactionUse", 3, getDefaultActivityCompartment().getChildren().size());
- assertTrue("The first interaction should be found in the diagram", getDefaultActivityCompartment().getChildren().contains(interactionUse1));
- assertTrue("The second interaction should be found in the diagram", getDefaultActivityCompartment().getChildren().contains(interactionUse2));
- assertTrue("The third interaction should be found in the diagram", getDefaultActivityCompartment().getChildren().contains(interactionUse3));
- }
-
- @Test
- public void testEditInteractionName() {
- final UMLNodeEditPart interactionUse = createChildNodeInTopNode(UMLElementTypes.CallBehaviorAction_3008);
- final CustomInteractionUseNameEditPart callBehaviorNameEditPart = (CustomInteractionUseNameEditPart)EditPartUtils.findFirstChildEditPartWithId(interactionUse, CustomInteractionUseNameEditPart.VISUAL_ID);
- final NamedElement namedElement = ((CallBehaviorAction)interactionUse.getUMLElement()).getBehavior();
- testSetNameWithDirectEditRequest(callBehaviorNameEditPart, namedElement);
- }
-}
+/*****************************************************************************
+ * 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
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.interactionoverview.tests.canonical;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.editparts.UMLNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CustomInteractionUseEditPartCN;
+import org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CustomInteractionUseNameEditPart;
+import org.eclipse.papyrus.uml.diagram.timing.custom.utils.EditPartUtils;
+import org.eclipse.uml2.uml.CallBehaviorAction;
+import org.eclipse.uml2.uml.NamedElement;
+import org.junit.Test;
+
+public class TestInteractionUse extends AbstractInteractionOverviewDiagramTestCase {
+
+ @Override
+ public void setUp() throws Exception {
+ // create the project, model and diagram
+ super.setUp();
+ createActivity();
+ }
+
+ @Test
+ public void testCreateInteractionUse() {
+ createChildNodeInTopNode(UMLElementTypes.CallBehaviorAction_3008);
+ }
+
+ @Test
+ public void testDeleteInteractionUse() {
+ final CustomInteractionUseEditPartCN interactionUse = (CustomInteractionUseEditPartCN)createChildNodeInTopNode(UMLElementTypes.CallBehaviorAction_3008);
+ testDelete(interactionUse);
+ }
+
+ @Test
+ public void testDropLifeline() {
+ // create a Lifeline and hide its View, so as to be able to drop it after that
+ final UMLNodeEditPart interactionUseEditPart = createChildNodeInTopNode(UMLElementTypes.CallBehaviorAction_3008);
+ final CallBehaviorAction callBehaviorAction = (CallBehaviorAction)((View)interactionUseEditPart.getModel()).getElement();
+ assertNotNull("The CallBehavior should not be null", callBehaviorAction);
+ testHide(interactionUseEditPart);
+ testDrop(getDefaultActivityCompartment(), getDefaultActivityCompartment(), callBehaviorAction);
+ }
+
+
+ @Test
+ public void testCreateThreeInteractions() {
+ final UMLNodeEditPart interactionUse1 = createChildNodeInTopNode(UMLElementTypes.CallBehaviorAction_3008);
+ final UMLNodeEditPart interactionUse2 = createChildNodeInTopNode(UMLElementTypes.CallBehaviorAction_3008);
+ final UMLNodeEditPart interactionUse3 = createChildNodeInTopNode(UMLElementTypes.CallBehaviorAction_3008);
+ assertEquals("The diagram should only contain the 3 interactionUse", 3, getDefaultActivityCompartment().getChildren().size());
+ assertTrue("The first interaction should be found in the diagram", getDefaultActivityCompartment().getChildren().contains(interactionUse1));
+ assertTrue("The second interaction should be found in the diagram", getDefaultActivityCompartment().getChildren().contains(interactionUse2));
+ assertTrue("The third interaction should be found in the diagram", getDefaultActivityCompartment().getChildren().contains(interactionUse3));
+ }
+
+ @Test
+ public void testEditInteractionName() {
+ final UMLNodeEditPart interactionUse = createChildNodeInTopNode(UMLElementTypes.CallBehaviorAction_3008);
+ final CustomInteractionUseNameEditPart callBehaviorNameEditPart = (CustomInteractionUseNameEditPart)EditPartUtils.findFirstChildEditPartWithId(interactionUse, CustomInteractionUseNameEditPart.VISUAL_ID);
+ final NamedElement namedElement = ((CallBehaviorAction)interactionUse.getUMLElement()).getBehavior();
+ testSetNameWithDirectEditRequest(callBehaviorNameEditPart, namedElement);
+ }
+}

Back to the top