Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Guilet2018-05-03 14:17:37 +0000
committerPierre Guilet2018-05-15 13:53:58 +0000
commit4eef6e7c96eeea8c93c1f596d7aea109f53207fb (patch)
tree6dd240e01164e5eb28881ec457bc7e8478684b11
parentb00bb1589bae98f71f4325c87a620bf47b917f52 (diff)
downloadorg.eclipse.sirius-4eef6e7c96eeea8c93c1f596d7aea109f53207fb.tar.gz
org.eclipse.sirius-4eef6e7c96eeea8c93c1f596d7aea109f53207fb.tar.xz
org.eclipse.sirius-4eef6e7c96eeea8c93c1f596d7aea109f53207fb.zip
[529977] Test realization
Bug: 529977 Change-Id: I9540a93bfc26ad91149028009e1889d7ff7c5ba8 Signed-off-by: Pierre Guilet <pierre.guilet@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/airdEditor/My.aird116
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/airdEditor/My.ecore10
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/airdEditor/My.odesign35
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionEditorProjectRemovalTest.java140
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java14
5 files changed, 307 insertions, 8 deletions
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/airdEditor/My.aird b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/airdEditor/My.aird
new file mode 100644
index 0000000000..130e964899
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/airdEditor/My.aird
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<viewpoint:DAnalysis xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.obeo.fr/dsl/viewpoint/description/1.1.0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.1/notation" xmlns:style="http://www.obeo.fr/dsl/viewpoint/description/style/1.1.0" xmlns:viewpoint="http://www.obeo.fr/dsl/viewpoint/1.1.0" xsi:schemaLocation="http://www.obeo.fr/dsl/viewpoint/description/1.1.0 http://www.obeo.fr/dsl/viewpoint/1.1.0#//description http://www.obeo.fr/dsl/viewpoint/description/style/1.1.0 http://www.obeo.fr/dsl/viewpoint/1.1.0#//description/style" xmi:id="_b9nr4TqMEeCWa94UuWEtSA" selectedViews="_c5pPQDqMEeCWa94UuWEtSA">
+ <ownedViews xmi:type="viewpoint:DRepresentationContainer" xmi:id="_c5pPQDqMEeCWa94UuWEtSA" initialized="true">
+ <ownedRepresentations xmi:type="viewpoint:DSemanticDiagram" xmi:id="_gvCzgDqMEeCWa94UuWEtSA" name="deleteFromModelDiagram">
+ <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_gvdDMDqMEeCWa94UuWEtSA" source="GMF_DIAGRAMS">
+ <data xmi:type="notation:Diagram" xmi:id="_gvdDMTqMEeCWa94UuWEtSA" type="Viewpoint" element="_gvCzgDqMEeCWa94UuWEtSA" measurementUnit="Pixel">
+ <children xmi:type="notation:Node" xmi:id="_g2gtcDqMEeCWa94UuWEtSA" type="2001" element="_gzywoDqMEeCWa94UuWEtSA">
+ <children xmi:type="notation:Node" xmi:id="_g2jJsDqMEeCWa94UuWEtSA" type="5002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_g2jJsTqMEeCWa94UuWEtSA" y="5"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_g2qecDqMEeCWa94UuWEtSA" type="3003" element="_gzz-wDqMEeCWa94UuWEtSA">
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_g2qecTqMEeCWa94UuWEtSA" fontName="Ubuntu"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g2qecjqMEeCWa94UuWEtSA"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_g2gtcTqMEeCWa94UuWEtSA" fontName="Ubuntu" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g2gtcjqMEeCWa94UuWEtSA" x="120" y="126" width="30" height="30"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_g2kX0DqMEeCWa94UuWEtSA" type="2001" element="_gz1M4DqMEeCWa94UuWEtSA">
+ <children xmi:type="notation:Node" xmi:id="_g2k-4DqMEeCWa94UuWEtSA" type="5002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_g2k-4TqMEeCWa94UuWEtSA" y="5"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_g2rskDqMEeCWa94UuWEtSA" type="3003" element="_gz1M4TqMEeCWa94UuWEtSA">
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_g2rskTqMEeCWa94UuWEtSA" fontName="Ubuntu"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g2rskjqMEeCWa94UuWEtSA"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_g2kX0TqMEeCWa94UuWEtSA" fontName="Ubuntu" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g2kX0jqMEeCWa94UuWEtSA" x="120" y="36" width="30" height="30"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_g2ll8DqMEeCWa94UuWEtSA" type="2001" element="_gz1z8zqMEeCWa94UuWEtSA">
+ <children xmi:type="notation:Node" xmi:id="_g2ll8zqMEeCWa94UuWEtSA" type="5002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_g2ll9DqMEeCWa94UuWEtSA" y="5"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_g2s6sDqMEeCWa94UuWEtSA" type="3003" element="_gz2bADqMEeCWa94UuWEtSA">
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_g2thwDqMEeCWa94UuWEtSA" fontName="Ubuntu"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g2thwTqMEeCWa94UuWEtSA"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_g2ll8TqMEeCWa94UuWEtSA" fontName="Ubuntu" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g2ll8jqMEeCWa94UuWEtSA" x="60" y="36" width="30" height="30"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_gvdDMjqMEeCWa94UuWEtSA"/>
+ <edges xmi:type="notation:Edge" xmi:id="_g2zBUDqMEeCWa94UuWEtSA" type="4001" element="_gz6FYDqMEeCWa94UuWEtSA" source="_g2gtcDqMEeCWa94UuWEtSA" target="_g2kX0DqMEeCWa94UuWEtSA">
+ <children xmi:type="notation:Node" xmi:id="_g202gDqMEeCWa94UuWEtSA" type="6001">
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g202gTqMEeCWa94UuWEtSA" y="-10"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_g2zBUTqMEeCWa94UuWEtSA"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_g2zBUjqMEeCWa94UuWEtSA" fontName="Ubuntu" fontHeight="8"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_g2zBUzqMEeCWa94UuWEtSA" points="[0, -15, 0, 75]$[0, -75, 0, 15]"/>
+ </edges>
+ </data>
+ </ownedAnnotationEntries>
+ <ownedDiagramElements xmi:type="viewpoint:DNode" xmi:id="_gzywoDqMEeCWa94UuWEtSA" name="C1" outgoingEdges="_gz6FYDqMEeCWa94UuWEtSA" width="3" height="3">
+ <target xmi:type="ecore:EClass" href="My.ecore#//C1"/>
+ <semanticElements xmi:type="ecore:EClass" href="My.ecore#//C1"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="viewpoint:Square" xmi:id="_gzz-wDqMEeCWa94UuWEtSA">
+ <labelColor xmi:type="viewpoint:RGBValues" xmi:id="_gz0l0DqMEeCWa94UuWEtSA"/>
+ <description xmi:type="style:SquareDescription" href="My.odesign#//@ownedViewpoints[name='EdgeLabelRefreshPb']/@ownedRepresentations[name='EdgeLabelRefreshPb']/@defaultLayer/@nodeMappings[name='Class']/@style"/>
+ <borderColor xmi:type="viewpoint:RGBValues" xmi:id="_gz0l0TqMEeCWa94UuWEtSA"/>
+ <color xmi:type="viewpoint:RGBValues" xmi:id="_gz0l0jqMEeCWa94UuWEtSA" red="138" green="226" blue="52"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description:NodeMapping" href="My.odesign#//@ownedViewpoints[name='EdgeLabelRefreshPb']/@ownedRepresentations[name='EdgeLabelRefreshPb']/@defaultLayer/@nodeMappings[name='Class']"/>
+ </ownedDiagramElements>
+ <ownedDiagramElements xmi:type="viewpoint:DNode" xmi:id="_gz1M4DqMEeCWa94UuWEtSA" name="C2" incomingEdges="_gz6FYDqMEeCWa94UuWEtSA" width="3" height="3">
+ <target xmi:type="ecore:EClass" href="My.ecore#//C2"/>
+ <semanticElements xmi:type="ecore:EClass" href="My.ecore#//C2"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="viewpoint:Square" xmi:id="_gz1M4TqMEeCWa94UuWEtSA">
+ <labelColor xmi:type="viewpoint:RGBValues" xmi:id="_gz1z8DqMEeCWa94UuWEtSA"/>
+ <description xmi:type="style:SquareDescription" href="My.odesign#//@ownedViewpoints[name='EdgeLabelRefreshPb']/@ownedRepresentations[name='EdgeLabelRefreshPb']/@defaultLayer/@nodeMappings[name='Class']/@style"/>
+ <borderColor xmi:type="viewpoint:RGBValues" xmi:id="_gz1z8TqMEeCWa94UuWEtSA"/>
+ <color xmi:type="viewpoint:RGBValues" xmi:id="_gz1z8jqMEeCWa94UuWEtSA" red="138" green="226" blue="52"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description:NodeMapping" href="My.odesign#//@ownedViewpoints[name='EdgeLabelRefreshPb']/@ownedRepresentations[name='EdgeLabelRefreshPb']/@defaultLayer/@nodeMappings[name='Class']"/>
+ </ownedDiagramElements>
+ <ownedDiagramElements xmi:type="viewpoint:DNode" xmi:id="_gz1z8zqMEeCWa94UuWEtSA" name="C3" width="3" height="3">
+ <target xmi:type="ecore:EClass" href="My.ecore#//C3"/>
+ <semanticElements xmi:type="ecore:EClass" href="My.ecore#//C3"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="viewpoint:Square" xmi:id="_gz2bADqMEeCWa94UuWEtSA">
+ <labelColor xmi:type="viewpoint:RGBValues" xmi:id="_gz2bATqMEeCWa94UuWEtSA"/>
+ <description xmi:type="style:SquareDescription" href="My.odesign#//@ownedViewpoints[name='EdgeLabelRefreshPb']/@ownedRepresentations[name='EdgeLabelRefreshPb']/@defaultLayer/@nodeMappings[name='Class']/@style"/>
+ <borderColor xmi:type="viewpoint:RGBValues" xmi:id="_gz2bAjqMEeCWa94UuWEtSA"/>
+ <color xmi:type="viewpoint:RGBValues" xmi:id="_gz2bAzqMEeCWa94UuWEtSA" red="138" green="226" blue="52"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description:NodeMapping" href="My.odesign#//@ownedViewpoints[name='EdgeLabelRefreshPb']/@ownedRepresentations[name='EdgeLabelRefreshPb']/@defaultLayer/@nodeMappings[name='Class']"/>
+ </ownedDiagramElements>
+ <ownedDiagramElements xmi:type="viewpoint:DEdge" xmi:id="_gz6FYDqMEeCWa94UuWEtSA" sourceNode="_gzywoDqMEeCWa94UuWEtSA" targetNode="_gz1M4DqMEeCWa94UuWEtSA">
+ <target xmi:type="ecore:EReference" href="My.ecore#//C1/@eStructuralFeatures.0"/>
+ <semanticElements xmi:type="ecore:EReference" href="My.ecore#//C1/@eStructuralFeatures.0"/>
+ <ownedStyle xmi:type="viewpoint:EdgeStyle" xmi:id="_gz6FYTqMEeCWa94UuWEtSA" size="2">
+ <labelColor xmi:type="viewpoint:RGBValues" xmi:id="_gz6FYjqMEeCWa94UuWEtSA"/>
+ <description xmi:type="style:EdgeStyleDescription" href="My.odesign#//@ownedViewpoints[name='EdgeLabelRefreshPb']/@ownedRepresentations[name='EdgeLabelRefreshPb']/@defaultLayer/@edgeMappings[name='edge']/@style"/>
+ <strokeColor xmi:type="viewpoint:RGBValues" xmi:id="_gz6FYzqMEeCWa94UuWEtSA" red="136" green="136" blue="136"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description:EdgeMapping" href="My.odesign#//@ownedViewpoints[name='EdgeLabelRefreshPb']/@ownedRepresentations[name='EdgeLabelRefreshPb']/@defaultLayer/@edgeMappings[name='edge']"/>
+ </ownedDiagramElements>
+ <description xmi:type="description:DiagramDescription" href="My.odesign#//@ownedViewpoints[name='EdgeLabelRefreshPb']/@ownedRepresentations[name='EdgeLabelRefreshPb']"/>
+ <filterVariableHistory xmi:type="viewpoint:FilterVariableHistory" xmi:id="_gvDakDqMEeCWa94UuWEtSA"/>
+ <activatedLayers xmi:type="description:Layer" href="My.odesign#//@ownedViewpoints[name='EdgeLabelRefreshPb']/@ownedRepresentations[name='EdgeLabelRefreshPb']/@defaultLayer"/>
+ <target xmi:type="ecore:EPackage" href="My.ecore#/"/>
+ </ownedRepresentations>
+ <viewpoint xmi:type="description:Viewpoint" href="My.odesign#//@ownedViewpoints[name='EdgeLabelRefreshPb']"/>
+ </ownedViews>
+ <models xmi:type="ecore:EPackage" href="My.ecore#/"/>
+ <eAnnotations xmi:type="description:DAnnotationEntry" xmi:id="_b9oS8DqMEeCWa94UuWEtSA" source="Migration">
+ <details>style</details>
+ <details>someViewsAreHiddenDeactivation</details>
+ <details>sequenceAbsoluteBoundsFlag</details>
+ </eAnnotations>
+</viewpoint:DAnalysis>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/airdEditor/My.ecore b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/airdEditor/My.ecore
new file mode 100644
index 0000000000..626c63b9d8
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/airdEditor/My.ecore
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="Root">
+ <eClassifiers xsi:type="ecore:EClass" name="C1">
+ <eStructuralFeatures xsi:type="ecore:EReference" eType="#//C2"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="C2"/>
+ <eClassifiers xsi:type="ecore:EClass" name="C3"/>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/airdEditor/My.odesign b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/airdEditor/My.odesign
new file mode 100644
index 0000000000..89e35b95a3
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/airdEditor/My.odesign
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<description:Group xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.obeo.fr/dsl/viewpoint/description/1.1.0" xmlns:style="http://www.obeo.fr/dsl/viewpoint/description/style/1.1.0" xmlns:tool="http://www.obeo.fr/dsl/viewpoint/description/tool/1.1.0" name="EdgeLabelRefreshPb">
+ <eAnnotations source="Migration">
+ <details key="SemanticCandidatesExpressionBehaviorChange" value=""/>
+ </eAnnotations>
+ <ownedViewpoints name="EdgeLabelRefreshPb" modelFileExtension="ecore">
+ <ownedRepresentations xsi:type="description:DiagramDescription" name="EdgeLabelRefreshPb" domainClass="EPackage">
+ <defaultLayer name="Default">
+ <nodeMappings name="Class" semanticCandidatesExpression="&lt;%eContents.filter(&quot;EClass&quot;)%>" domainClass="EClass">
+ <style xsi:type="style:SquareDescription">
+ <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='green']"/>
+ </style>
+ </nodeMappings>
+ <edgeMappings name="edge" deletionDescription="//@ownedViewpoints[name='EdgeLabelRefreshPb']/@ownedRepresentations[name='EdgeLabelRefreshPb']/@defaultLayer/@toolSections.0/@ownedTools[name='TestDel']" semanticElements="&lt;%self%>" sourceMapping="//@ownedViewpoints[name='EdgeLabelRefreshPb']/@ownedRepresentations[name='EdgeLabelRefreshPb']/@defaultLayer/@nodeMappings[name='Class']" targetMapping="//@ownedViewpoints[name='EdgeLabelRefreshPb']/@ownedRepresentations[name='EdgeLabelRefreshPb']/@defaultLayer/@nodeMappings[name='Class']" targetFinderExpression="&lt;%eType%>" sourceFinderExpression="&lt;%eContainer%>" domainClass="EReference" useDomainElement="true">
+ <style labelExpression="&lt;%name%>" sizeComputationExpression="2">
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
+ </style>
+ </edgeMappings>
+ <toolSections name="Tools">
+ <ownedTools xsi:type="tool:DeleteElementDescription" name="TestDel">
+ <element name="element"/>
+ <elementView name="elementView"/>
+ <containerView name="containerView"/>
+ <initialOperation>
+ <firstModelOperations xsi:type="tool:ExternalJavaAction" name="MyAction" id="my.project.design.javaActions.id"/>
+ </initialOperation>
+ </ownedTools>
+ </toolSections>
+ </defaultLayer>
+ </ownedRepresentations>
+ </ownedViewpoints>
+</description:Group>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionEditorProjectRemovalTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionEditorProjectRemovalTest.java
new file mode 100644
index 0000000000..684a5558a0
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionEditorProjectRemovalTest.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Obeo
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.tests.swtbot;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.sirius.business.api.session.Session;
+import org.eclipse.sirius.diagram.DDiagram;
+import org.eclipse.sirius.tests.support.api.ICondition;
+import org.eclipse.sirius.tests.support.api.TestsUtil;
+import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase;
+import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource;
+import org.eclipse.sirius.ui.editor.SessionEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.junit.Test;
+
+/**
+ * Tests session editor behavior when project containing it are removed.
+ *
+ * @author <a href=mailto:pierre.guilet@obeo.fr>Pierre Guilet</a>
+ *
+ */
+public class SessionEditorProjectRemovalTest extends AbstractSiriusSwtBotGefTestCase {
+
+ private static final String DIAGRAM_REPRESENTATION_NAME = "deleteFromModelDiagram";
+
+ private static final String DIAGRAM_DESCRIPTION_NAME = "EdgeLabelRefreshPb";
+
+ private static final String MODEL = "My.ecore";
+
+ private static final String SESSION_FILE = "My.aird";
+
+ private static final String VSM_FILE = "My.odesign";
+
+ private static final String DATA_UNIT_DIR = "data/unit/airdEditor/";
+
+ private static final String FILE_DIR = "/";
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onSetUpBeforeClosingWelcomePage() throws Exception {
+ copyFileToTestProject(Activator.PLUGIN_ID, DATA_UNIT_DIR, MODEL, VSM_FILE, SESSION_FILE);
+
+ }
+
+ /**
+ * Tests that no problem occurs when: The aird editor is opened as well as a diagram editor and the command stack is
+ * dirty because of an undo from diagram editor.
+ *
+ * @throws Exception
+ * if a problem occurs.
+ */
+ @Test
+ public void testProjectRemovalWithDirtyCommandStack() throws Exception {
+ // open aird editor
+ final UIResource sessionAirdResource = new UIResource(designerProject, FILE_DIR, SESSION_FILE);
+
+ RunnableWithResult<IEditorPart> result = new RunnableWithResult<IEditorPart>() {
+ private IEditorPart resultEditor;
+
+ @Override
+ public void run() {
+ try {
+ final IFile fileToOpen = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(sessionAirdResource.getFullPath()));
+ resultEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(new FileEditorInput(fileToOpen), SessionEditor.EDITOR_ID);
+ } catch (PartInitException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public IEditorPart getResult() {
+ return resultEditor;
+ }
+
+ @Override
+ public void setStatus(IStatus status) {
+ }
+
+ @Override
+ public IStatus getStatus() {
+ return null;
+ }
+ };
+ PlatformUI.getWorkbench().getDisplay().syncExec(result);
+ Session session = ((SessionEditor) result.getResult()).getSession();
+ openRepresentation(session, DIAGRAM_DESCRIPTION_NAME, DIAGRAM_REPRESENTATION_NAME, DDiagram.class);
+ session.getTransactionalEditingDomain().getCommandStack().undo();
+
+ SWTBotView modelExplorerView = bot.viewById("org.eclipse.sirius.ui.tools.views.model.explorer");
+ SWTBotTree tree = modelExplorerView.bot().tree(0);
+ SWTBotTreeItem treeItem = tree.getTreeItem("DesignerTestProject");
+ SWTBotRootMenu contextMenu = treeItem.contextMenu();
+ SWTBotMenu menuDelete = contextMenu.menu("Delete");
+ menuDelete.click();
+
+ TestsUtil.waitUntil(new ICondition() {
+
+ @Override
+ public boolean test() throws Exception {
+ SWTBotShell activeShell = bot.activeShell();
+ return "Delete Resources".equals(activeShell.getText());
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "Delete resource dialog has not opened.";
+ }
+ });
+ SWTBotShell activeShell = bot.activeShell();
+ SWTBot shellBot = activeShell.bot();
+ SWTBotButton button = shellBot.button("OK");
+ button.click();
+
+ }
+}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
index e7a37795e3..67ba4e8112 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
@@ -227,12 +227,12 @@ public class AllTestSuite extends TestCase {
suite.addTest(new JUnit4TestAdapter(DndWorkspaceToAirdEditorTest.class));
suite.addTestSuite(SessionEditorTest.class);
suite.addTestSuite(SessionEditorPageProvidingTest.class);
+ suite.addTestSuite(SessionEditorProjectRemovalTest.class);
}
/**
- * Add the first part of the SWTbot tests to the specified suite. This
- * corresponds roughly to the first half of the execution time of the
- * complete suite.
+ * Add the first part of the SWTbot tests to the specified suite. This corresponds roughly to the first half of the
+ * execution time of the complete suite.
*
* @param suite
* the suite into which to add the tests.
@@ -309,9 +309,8 @@ public class AllTestSuite extends TestCase {
}
/**
- * Add the second part of the SWTbot tests to the specified suite. This
- * corresponds roughly to the second half of the execution time of the
- * complete suite.
+ * Add the second part of the SWTbot tests to the specified suite. This corresponds roughly to the second half of
+ * the execution time of the complete suite.
*
* @param suite
* the suite into which to add the tests.
@@ -441,8 +440,7 @@ public class AllTestSuite extends TestCase {
}
/**
- * Creates the {@link junit.framework.TestSuite TestSuite} for all the
- * disabled test.
+ * Creates the {@link junit.framework.TestSuite TestSuite} for all the disabled test.
*
* @return The test suite containing all the disabled tests.
*/

Back to the top