Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2019-05-24 14:20:37 +0000
committerNicolas FAUVERGUE2019-06-17 13:39:19 +0000
commitd756c26b0f0fc8cd947cad71e19419aa8a8ced64 (patch)
treedfda5ea5256d764391f758fa1991dc07dafe5591 /tests
parente47cce9fbe7fc51056abdf4625f71164fbdd97b9 (diff)
downloadorg.eclipse.papyrus-d756c26b0f0fc8cd947cad71e19419aa8a8ced64.tar.gz
org.eclipse.papyrus-d756c26b0f0fc8cd947cad71e19419aa8a8ced64.tar.xz
org.eclipse.papyrus-d756c26b0f0fc8cd947cad71e19419aa8a8ced64.zip
Bug 547864 - [SequenceDiagram] Undo/Redo problem with CombinedFragment
Failing tests : - Some tests are failing due to incorrect tests (validation tests are no more needed because the covering is automatically recalculated) - Other tests are failing due to undo/redo problem of CombinedFragment creation. The undo creation when something is contained into the created CombinedFragment crash with exception (The undo of creation is no more possible because the elements positions changed). In this patch: I manage undo/redo of creation differently (manually) to move needed contained elements before to remove CombinedFragment. In this case, i have to cut the undo/redo of the SemanticCreationCommand. With this patch, all JUnit tests of sequence diagram works fine. Change-Id: Ib1ed2df10404763ca79e5a2c5c62bf4c52600657 Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr>
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/CombinedFragmentRegressionTest.java121
1 files changed, 3 insertions, 118 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/CombinedFragmentRegressionTest.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/CombinedFragmentRegressionTest.java
index 6407128da2d..2f3ffa930b0 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/CombinedFragmentRegressionTest.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/CombinedFragmentRegressionTest.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2018 Christian W. Damus and others.
+ * Copyright (c) 2018-2019 Christian W. Damus and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,13 +10,13 @@
*
* Contributors:
* Christian W. Damus - Initial API and implementation
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 547864 (Remove useless tests)
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.tests.bug;
import static org.eclipse.papyrus.junit.matchers.DiagramMatchers.hasErrorDecorationThat;
-import static org.eclipse.papyrus.junit.matchers.DiagramMatchers.hasWarningDecorationThat;
import static org.eclipse.papyrus.junit.matchers.MoreMatchers.greaterThan;
import static org.eclipse.papyrus.junit.matchers.MoreMatchers.greaterThanOrEqual;
import static org.eclipse.papyrus.junit.matchers.MoreMatchers.isEmpty;
@@ -54,8 +54,6 @@ import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.validation.model.EvaluationMode;
import org.eclipse.emf.validation.service.IValidationListener;
import org.eclipse.emf.validation.service.ModelValidationService;
@@ -90,7 +88,6 @@ import org.eclipse.uml2.uml.InteractionFragment;
import org.eclipse.uml2.uml.InteractionOperand;
import org.eclipse.uml2.uml.Lifeline;
import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.UMLPackage;
import org.hamcrest.CoreMatchers;
import org.hamcrest.CustomTypeSafeMatcher;
import org.hamcrest.Matcher;
@@ -109,6 +106,7 @@ import org.junit.rules.TestRule;
* @see <a href="http://eclip.se/533670">bug 533670</a>
*/
@ActiveDiagram("sequence")
+@SuppressWarnings("nls")
public class CombinedFragmentRegressionTest extends AbstractPapyrusTest {
// this needs to be a sequenceable rule so that it can be run before the editor
@@ -782,119 +780,6 @@ public class CombinedFragmentRegressionTest extends AbstractPapyrusTest {
}
/**
- * Verify the validation of a combined fragment that has multiple lifelines
- * uncovered that are covered by fragments of its operands.
- */
- @Test
- @PluginResource("resource/bugs/bug533676.di")
- public void validateCFragCoverage_multipleUncovered() {
- // It's validated on open of the diagram editor
- EditPart cfragEP = editor.findEditPart("cfrag", CombinedFragment.class);
-
- assertThat(cfragEP, hasWarningDecorationThat(startsWith("Lifelines 'a', 'b' not covered")));
- }
-
- /**
- * Verify the validation of a combined fragment that has a single lifeline
- * uncovered that is covered by fragments of its operands.
- */
- @Test
- @PluginResource("resource/bugs/bug533676.di")
- public void validateCFragCoverage_singleUncovered() {
- EditPart cfragEP = editor.findEditPart("cfrag", CombinedFragment.class);
- CombinedFragment cfrag = cfragEP.getAdapter(CombinedFragment.class);
- Interaction interaction = cfrag.getEnclosingInteraction();
- Lifeline a = interaction.getLifeline("a");
-
- // Add lifeline 'a' to the coverage of the combined fragment
- org.eclipse.emf.common.command.Command addCoverage = AddCommand.create(
- editor.getEditingDomain(), cfrag, UMLPackage.Literals.INTERACTION_FRAGMENT__COVERED, a);
- editor.execute(addCoverage);
-
- assertThat(cfragEP, hasWarningDecorationThat(startsWith("Lifeline 'b' not covered")));
- }
-
- /**
- * Verify the validation of a combined fragment that has all lifelines
- * covered that are covered by fragments of its operands.
- */
- @Test
- @PluginResource("resource/bugs/bug533676.di")
- public void validateCFragCoverage_noneUncovered() {
- EditPart cfragEP = editor.findEditPart("cfrag", CombinedFragment.class);
- CombinedFragment cfrag = cfragEP.getAdapter(CombinedFragment.class);
- Interaction interaction = cfrag.getEnclosingInteraction();
- Lifeline a = interaction.getLifeline("a");
- Lifeline b = interaction.getLifeline("b");
-
- // Add the lifelines to the coverage of the combined fragment
- org.eclipse.emf.common.command.Command addCoverage = AddCommand.create(
- editor.getEditingDomain(), cfrag, UMLPackage.Literals.INTERACTION_FRAGMENT__COVERED,
- Arrays.asList(a, b));
- editor.execute(addCoverage);
-
- assertThat(cfragEP, not(hasWarningDecorationThat(startsWith("Lifeline"))));
- }
-
- /**
- * Verify the validation of an interaction operand that has multiple lifelines
- * uncovered that are covered by fragments that it owns.
- */
- @Test
- @PluginResource("resource/bugs/bug533676.di")
- public void validateOperandCoverage_multipleUncovered() {
- // It's validated on open of the diagram editor
- EditPart operandEP = editor.findEditPart("opt", InteractionOperand.class);
- InteractionOperand operand = operandEP.getAdapter(InteractionOperand.class);
- CombinedFragment cfrag = (CombinedFragment) operand.getOwner();
- Interaction interaction = cfrag.getEnclosingInteraction();
- Lifeline a = interaction.getLifeline("a");
- Lifeline b = interaction.getLifeline("b");
-
- // Remove the lifelines from the coverage of the combined fragment
- org.eclipse.emf.common.command.Command removeCoverage = RemoveCommand.create(
- editor.getEditingDomain(), operand, UMLPackage.Literals.INTERACTION_FRAGMENT__COVERED,
- Arrays.asList(a, b));
- editor.execute(removeCoverage);
-
- assertThat(operandEP, hasWarningDecorationThat(startsWith("Lifelines 'a', 'b' not covered")));
- }
-
- /**
- * Verify the validation of an interaction operand that has a single lifeline
- * uncovered that is covered by fragments that it owns.
- */
- @Test
- @PluginResource("resource/bugs/bug533676.di")
- public void validateOperandCoverage_singleUncovered() {
- EditPart operandEP = editor.findEditPart("opt", InteractionOperand.class);
- InteractionOperand operand = operandEP.getAdapter(InteractionOperand.class);
- CombinedFragment cfrag = (CombinedFragment) operand.getOwner();
- Interaction interaction = cfrag.getEnclosingInteraction();
- Lifeline a = interaction.getLifeline("a");
-
- // Remove lifeline 'a' from the coverage of the operand
- org.eclipse.emf.common.command.Command removeCoverage = RemoveCommand.create(
- editor.getEditingDomain(), operand, UMLPackage.Literals.INTERACTION_FRAGMENT__COVERED, a);
- editor.execute(removeCoverage);
-
- assertThat(operandEP, hasWarningDecorationThat(startsWith("Lifeline 'a' not covered")));
- }
-
- /**
- * Verify the validation of an interaction operand that has all lifelines
- * covered that are covered by fragments that it owns.
- */
- @Test
- @PluginResource("resource/bugs/bug533676.di")
- public void validateOperandCoverage_noneUncovered() {
- // It's validated on open of the diagram editor
- EditPart operandEP = editor.findEditPart("opt", InteractionOperand.class);
-
- assertThat(operandEP, not(hasWarningDecorationThat(startsWith("Lifeline"))));
- }
-
- /**
* Verify the creation of a combined fragment that covers nothing at all.
*/
@Test

Back to the top