Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2018-06-19 12:25:45 +0000
committerCamille Letavernier2018-09-24 10:48:08 +0000
commite0ce141f38da797f7fce0c6f8234953b10d272a2 (patch)
tree1928c82510d74d2e1c8b2bec906a99e60cbc5b69 /tests/junit/plugins
parent25c4a7bf6631eb1bd658d92ee035610811e326d9 (diff)
downloadorg.eclipse.papyrus-e0ce141f38da797f7fce0c6f8234953b10d272a2.tar.gz
org.eclipse.papyrus-e0ce141f38da797f7fce0c6f8234953b10d272a2.tar.xz
org.eclipse.papyrus-e0ce141f38da797f7fce0c6f8234953b10d272a2.zip
Bug 536632: [Sequence Diagram] Create the edit parts & basic figure for
DurationConstraint/DurationObservation https://bugs.eclipse.org/bugs/show_bug.cgi?id=536632 - Remove DurationObservation/Constraint & regenerate Change-Id: I56d75d84f48578ca602cf8ab3c25d03395b650a0 Signed-off-by: Camille Letavernier <cletavernier@eclipsesource.com>
Diffstat (limited to 'tests/junit/plugins')
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/BugTests2.java21
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDurationConstraints_384596.java228
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestSequenceDiagramInsideInteraction.java19
3 files changed, 17 insertions, 251 deletions
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/BugTests2.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/BugTests2.java
index 7234aa803a0..ac539452195 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/BugTests2.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/BugTests2.java
@@ -1,21 +1,20 @@
package org.eclipse.papyrus.uml.diagram.sequence.tests.bug;
-import org.junit.runner.RunWith;
import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite;
+import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(ClassificationSuite.class)
/* TestLifelineAutoResize_383723.class, TestLifelineLabelCustomize_383722.class */
-@SuiteClasses({
- TestCombinedFragmentName_382951.class,
- TestCreationUndo_384618.class,
- TestDestructionNode_384201.class,
- TestDurationConstraints_384596.class,
- TestExecutionSpecificationDimension_384572.class,
- TestInteractionConstraint_382966.class,
- TestMessageCreate_379661.class,
- TestMessageLostFound_384202.class,
- TestNestedExecution_384616.class
+@SuiteClasses({
+ TestCombinedFragmentName_382951.class,
+ TestCreationUndo_384618.class,
+ TestDestructionNode_384201.class,
+ TestExecutionSpecificationDimension_384572.class,
+ TestInteractionConstraint_382966.class,
+ TestMessageCreate_379661.class,
+ TestMessageLostFound_384202.class,
+ TestNestedExecution_384616.class
})
public class BugTests2 {
}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDurationConstraints_384596.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDurationConstraints_384596.java
deleted file mode 100644
index 997b94307f5..00000000000
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDurationConstraints_384596.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.tests.bug;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.papyrus.commands.ICreationCommand;
-import org.eclipse.papyrus.junit.framework.classification.FailingTest;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ActionExecutionSpecificationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.sequence.tests.ISequenceDiagramTestsConstants;
-import org.eclipse.papyrus.uml.diagram.sequence.tests.canonical.CreateSequenceDiagramCommand;
-import org.eclipse.papyrus.uml.diagram.sequence.tests.canonical.TestTopNode;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.uml2.uml.ActionExecutionSpecification;
-import org.eclipse.uml2.uml.DurationConstraint;
-import org.eclipse.uml2.uml.Interval;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.ValueSpecification;
-import org.junit.Test;
-
-/**
- * An embedded textuel editor shall allow editing duration constraints. This editor shall be accessible on the diagram.
- * When the two values of the interval are equal, the value shall be displayed only once.
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=384596
- *
- */
-public class TestDurationConstraints_384596 extends TestTopNode {
-
- private static final String SEP = "..";
-
- /** The occurrence specification(s) which are the nearest from a creation request */
- public static final String NEAREST_OCCURRENCE_SPECIFICATION = "Nearest occurrence specification"; //$NON-NLS-1$
-
- /** The occurrence specification(s) which are the nearest from a creation request (2nd end of creation) */
- public static final String NEAREST_OCCURRENCE_SPECIFICATION_2 = "Nearest occurrence specification (end)"; //$NON-NLS-1$
-
- private static final String EDIT = "Edit: ";
-
- @Override
- protected ICreationCommand getDiagramCommandCreation() {
- return new CreateSequenceDiagramCommand();
- }
-
- @Override
- protected String getProjectName() {
- return ISequenceDiagramTestsConstants.PROJECT_NAME;
- }
-
- @Override
- protected String getFileName() {
- return ISequenceDiagramTestsConstants.FILE_NAME;
- }
-
- @FailingTest ("To be erased or rewritten to take new architecture into account")
- @Test
- public void testDurationEdition() {
- createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200), null);
- final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0);
- waitForComplete();
-
- createNode(UMLElementTypes.ActionExecutionSpecification_Shape, lifeline1, new Point(131, 200), new Dimension(20, 40), null);
- waitForComplete();
-
- ActionExecutionSpecificationEditPart esp = (ActionExecutionSpecificationEditPart)lifeline1.getChildren().get(1);
- createDuraitonConstraint(lifeline1, esp);
-
- DurationConstraintEditPart dp = (DurationConstraintEditPart)lifeline1.getChildren().get(2);
-
- // edit text
- WrappingLabel label = verifyEditText(dp, "1s", "2s");
- assertTrue(EDIT + TEST_THE_EXECUTION, label.getText().contains("1s..2s"));
-
- label = verifyEditText(dp, "d", "d+3");
- assertTrue(EDIT + TEST_THE_EXECUTION, label.getText().contains("d..d+3"));
-
- getEMFCommandStack().undo();
- assertTrue(EDIT + TEST_THE_UNDO, label.getText().contains("1s..2s"));
-
- label = verifyEditText(dp, "1", "1");
- assertTrue(EDIT + TEST_THE_EXECUTION, label.getText().contains("1") && !label.getText().contains(SEP));
-
- }
-
- protected WrappingLabel verifyEditText(DurationConstraintEditPart dp, String min, String max) {
- DurationConstraintLabelEditPart lp = (DurationConstraintLabelEditPart)dp.getChildren().get(0);
- WrappingLabel label = performEditRequest(lp);
-
- Composite composite = (Composite)lp.getViewer().getControl();
- Text editor = findEditor(composite, label);
-
- editor.setText(min + SEP + max);
- input(editor, SWT.CR);
-
- DurationConstraint constraint = (DurationConstraint)dp.resolveSemanticElement();
- ValueSpecification spec = constraint.getSpecification();
- assertTrue(EDIT + TEST_THE_EXECUTION, min.equals(ValueSpecificationUtil.getSpecificationValue(((Interval)spec).getMin())));
- assertTrue(EDIT + TEST_THE_EXECUTION, max.equals(ValueSpecificationUtil.getSpecificationValue(((Interval)spec).getMax())));
-
- waitForComplete();
- return label;
- }
-
- protected void createDuraitonConstraint(final LifelineEditPart lifeline1, ActionExecutionSpecificationEditPart esp) {
- ActionExecutionSpecification aes = (ActionExecutionSpecification)esp.resolveSemanticElement();
-
- Map<String, Object> extendedData = new HashMap<String, Object>();
- List<OccurrenceSpecification> events = new ArrayList<OccurrenceSpecification>(2);
- events.add(aes.getStart());
- extendedData.put(NEAREST_OCCURRENCE_SPECIFICATION, events);
-
- events = new ArrayList<OccurrenceSpecification>(2);
- events.add(aes.getFinish());
- extendedData.put(NEAREST_OCCURRENCE_SPECIFICATION_2, events);
-
- createNode(UMLElementTypes.DurationConstraint_Shape, lifeline1, getAbsoluteBounds(esp).getBottom(), new Dimension(20, 40), extendedData);
- waitForComplete();
- }
-
- public void input(Widget widget, char... character) {
- if(widget.isDisposed()) {
- return;
- }
-
- for(char c : character) {
- Event e = createKeyEvent(widget, 0, c);
- e.type = SWT.KeyDown;
- widget.notifyListeners(SWT.KeyDown, e);
-
- e = createKeyEvent(widget, 0, c);
- e.type = SWT.KeyUp;
- widget.notifyListeners(SWT.KeyUp, e);
- }
- waitForComplete();
-
- Event e = new Event();
- e.type = SWT.DefaultSelection;
- widget.notifyListeners(SWT.DefaultSelection, e);
- }
-
- private Event createKeyEvent(Widget widget, int keyCode, char character) {
- Event event = new Event();
- event.time = (int)System.currentTimeMillis();
- event.widget = widget;
- event.display = Display.getDefault();
- event.keyCode = keyCode;
- event.character = character;
- return event;
- }
-
- private Text findEditor(Composite composite, WrappingLabel label) {
- for(Control c : composite.getChildren()) {
- if(c instanceof Text) {
- if(label.getText().equals(((Text)c).getText())) {
- return (Text)c;
- }
- }
- }
- return null;
- }
-
- protected WrappingLabel performEditRequest(DurationConstraintLabelEditPart lp) {
- WrappingLabel label = (WrappingLabel)lp.getFigure();
- Rectangle b = label.getBounds().getCopy();
- label.translateToAbsolute(b);
- DirectEditRequest req = new DirectEditRequest();
- req.setLocation(b.getCenter());
- lp.performRequest(req);
- return label;
- }
-
- public void createNode(IElementType type, EditPart parentPart, Point location, Dimension size, Map<String, Object> extendedData) {
- //CREATION
- CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getRootEditPart().getDiagramPreferencesHint());
- requestcreation.setLocation(location);
- requestcreation.setSize(size);
- if(extendedData != null) {
- requestcreation.getExtendedData().putAll(extendedData);
- }
- Command command = parentPart.getCommand(requestcreation);
- assertNotNull(CREATION + COMMAND_NULL, command);
- assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
- assertTrue(CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
-
- getDiagramCommandStack().execute(command);
- }
-
-}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestSequenceDiagramInsideInteraction.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestSequenceDiagramInsideInteraction.java
index 9047b6bed50..ce98612832f 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestSequenceDiagramInsideInteraction.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestSequenceDiagramInsideInteraction.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -66,11 +66,11 @@ public class TestSequenceDiagramInsideInteraction extends AbstractTestSequenceCh
if (name.length() < ((ITextAwareEditPart) namedEditPart).getEditText().length()) {
Assert.assertEquals(" the name must contain the name of the metaclass", name, ((ITextAwareEditPart) namedEditPart).getEditText().substring(0, name.length())); //$NON-NLS-1$
} else {
-
+
if(createdEditPart instanceof InteractionUseEditPart){
//this is a particularity of interactionUse
Assert.assertEquals(" the name must contain the name of the metaclass", "Ref", ((ITextAwareEditPart) namedEditPart).getEditText()); //$NON-NLS-1$
-
+
}
else{
// not the same it sure but display the mistake is important
@@ -110,7 +110,7 @@ public class TestSequenceDiagramInsideInteraction extends AbstractTestSequenceCh
@Override
protected boolean isSemanticTest() {
-
+
return false;
}
@@ -142,11 +142,6 @@ public class TestSequenceDiagramInsideInteraction extends AbstractTestSequenceCh
testToManageNode(UMLElementTypes.ConsiderIgnoreFragment_Shape, UMLPackage.eINSTANCE.getConsiderIgnoreFragment(),UMLElementTypes.Interaction_Shape, false);
}
- @Test
- public void testToManageDurationObservation() {
-
- testToManageNode(UMLElementTypes.DurationObservation_Shape,UMLPackage.eINSTANCE.getDurationObservation(),UMLElementTypes.Interaction_Shape ,false);
- }
/**
* Test to manage comment.
*/
@@ -159,7 +154,7 @@ public class TestSequenceDiagramInsideInteraction extends AbstractTestSequenceCh
public void testToManageInteractionUse() {
testToManageNode(UMLElementTypes.InteractionUse_Shape, UMLPackage.eINSTANCE.getInteractionUse(),UMLElementTypes.Interaction_Shape, false);
}
-
+
/**
* @see org.eclipse.papyrus.uml.diagram.tests.canonical.AbstractTestNode#testDrop(org.eclipse.gmf.runtime.emf.type.core.IElementType, org.eclipse.emf.ecore.EClass, int, int, int)
*
@@ -175,7 +170,7 @@ public class TestSequenceDiagramInsideInteraction extends AbstractTestSequenceCh
// DROP
assertEquals(DROP + INITIALIZATION_TEST, expectedGraphicalChildren, getRootView().getChildren().size());
DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
- ArrayList<Element> list = new ArrayList<Element>();
+ ArrayList<Element> list = new ArrayList<>();
for (Element element : getRootSemanticModel().getModel().getOwnedElements()) {
if (element != null && element.eClass().equals(eClass)) {
list.add(element);
@@ -201,7 +196,7 @@ public class TestSequenceDiagramInsideInteraction extends AbstractTestSequenceCh
super.testDrop(type, eClass, expectedGraphicalChildren, expectedSemanticChildren, addedGraphicalChildren);
}
}
-
+
/**
* @see org.eclipse.papyrus.uml.diagram.tests.canonical.AbstractTestNode#createViewRequestShapeContainer()
*

Back to the top