diff options
author | Christian W. Damus | 2018-04-25 18:30:37 +0000 |
---|---|---|
committer | Nicolas FAUVERGUE | 2018-05-14 15:15:01 +0000 |
commit | ffad788980af9a4d5dc533f283a29915cc13a786 (patch) | |
tree | 31a0f5f70d0ee35ed2db8d77449dda797eeb806b /tests/junit/plugins | |
parent | 6ba0f3d2f43bae21f387ac58ec5a357767620115 (diff) | |
download | org.eclipse.papyrus-ffad788980af9a4d5dc533f283a29915cc13a786.tar.gz org.eclipse.papyrus-ffad788980af9a4d5dc533f283a29915cc13a786.tar.xz org.eclipse.papyrus-ffad788980af9a4d5dc533f283a29915cc13a786.zip |
Bug 533681: [Sequence Diagram] Suppression of the CombinedFragment
Add test case for deletion of combined fragment containing multiple
operands with various kinds of content within each.
Change-Id: I838c106d4505d0bca8f0f293907f3840db2ad144
Signed-off-by: Christian W. Damus <give.a.damus@gmail.com>
Diffstat (limited to 'tests/junit/plugins')
4 files changed, 229 insertions, 0 deletions
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533681.di b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533681.di new file mode 100644 index 00000000000..8c549eecdc6 --- /dev/null +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533681.di @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<architecture:ArchitectureDescription xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:architecture="http://www.eclipse.org/papyrus/infra/core/architecture" contextId="org.eclipse.papyrus.infra.services.edit.TypeContext"/> diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533681.notation b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533681.notation new file mode 100644 index 00000000000..ccabfd4bf5f --- /dev/null +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533681.notation @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding="UTF-8"?> +<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_QKU0YEMwEeiEZ5Jtfh6-KA" type="PapyrusUMLSequenceDiagram" name="sequence" measurementUnit="Pixel"> + <children xmi:type="notation:Shape" xmi:id="_QKU0YUMwEeiEZ5Jtfh6-KA" type="Interaction_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_QKU0YkMwEeiEZ5Jtfh6-KA" type="Interaction_NameLabel"> + <element xmi:type="uml:Interaction" href="bug533681.uml#_POkWwEMwEeiEZ5Jtfh6-KA"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_QKU0Y0MwEeiEZ5Jtfh6-KA" type="Interaction_SubfragmentCompartment"> + <children xmi:type="notation:Shape" xmi:id="_FQ-74ESnEeilLIdbxjHAOw" type="CombinedFragment_Shape"> + <children xmi:type="notation:BasicCompartment" xmi:id="_FRAKAESnEeilLIdbxjHAOw" type="CombinedFragment_SubfragmentCompartment"> + <children xmi:type="notation:Shape" xmi:id="_FRAKBESnEeilLIdbxjHAOw" type="InteractionOperand_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_FRAKBkSnEeilLIdbxjHAOw" type="InteractionOperand_Guard"> + <element xmi:type="uml:InteractionConstraint" href="bug533681.uml#_FQ3nIUSnEeilLIdbxjHAOw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_FRAKB0SnEeilLIdbxjHAOw" x="5" y="5"/> + </children> + <element xmi:type="uml:InteractionOperand" href="bug533681.uml#_FQ3nIESnEeilLIdbxjHAOw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_FRAKBUSnEeilLIdbxjHAOw" width="100" height="202"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_kZ88METtEei8-Im8RTxj4A" type="InteractionOperand_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_kZ-KUETtEei8-Im8RTxj4A" type="InteractionOperand_Guard"> + <element xmi:type="uml:InteractionConstraint" href="bug533681.uml#_kZ1AYETtEei8-Im8RTxj4A"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kZ-xYETtEei8-Im8RTxj4A" x="5" y="5"/> + </children> + <element xmi:type="uml:InteractionOperand" href="bug533681.uml#_kZsdgETtEei8-Im8RTxj4A"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_kZ88MUTtEei8-Im8RTxj4A" y="202" width="100" height="74"/> + </children> + <styles xmi:type="notation:SortingStyle" xmi:id="_FRAKAUSnEeilLIdbxjHAOw"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_FRAKAkSnEeilLIdbxjHAOw"/> + <element xmi:type="uml:CombinedFragment" href="bug533681.uml#_FQ2ZAESnEeilLIdbxjHAOw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_FRAKA0SnEeilLIdbxjHAOw"/> + </children> + <element xmi:type="uml:CombinedFragment" href="bug533681.uml#_FQ2ZAESnEeilLIdbxjHAOw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_FQ-74USnEeilLIdbxjHAOw" x="14" y="40" width="381" height="296"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_RZ4XwEMwEeiEZ5Jtfh6-KA" type="Lifeline_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_RZ4-0EMwEeiEZ5Jtfh6-KA" type="Lifeline_NameLabel"> + <element xmi:type="uml:Lifeline" href="bug533681.uml#_RZwb8EMwEeiEZ5Jtfh6-KA"/> + </children> + <element xmi:type="uml:Lifeline" href="bug533681.uml#_RZwb8EMwEeiEZ5Jtfh6-KA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_RZ4XwUMwEeiEZ5Jtfh6-KA" x="58" y="10"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_R0X7YEMwEeiEZ5Jtfh6-KA" type="Lifeline_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_R0X7YkMwEeiEZ5Jtfh6-KA" type="Lifeline_NameLabel"> + <element xmi:type="uml:Lifeline" href="bug533681.uml#_R0URAEMwEeiEZ5Jtfh6-KA"/> + </children> + <children xmi:type="notation:BasicCompartment" xmi:id="_R0cM0EMwEeiEZ5Jtfh6-KA" type="compartment_shape_display"> + <styles xmi:type="notation:TitleStyle" xmi:id="_R0cM0UMwEeiEZ5Jtfh6-KA"/> + <element xmi:type="uml:Lifeline" href="bug533681.uml#_R0URAEMwEeiEZ5Jtfh6-KA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_R0cM0kMwEeiEZ5Jtfh6-KA"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_XgABcEMwEeiEZ5Jtfh6-KA" type="BehaviorExecutionSpecification_Shape"> + <children xmi:type="notation:DecorationNode" xmi:id="_XgABckMwEeiEZ5Jtfh6-KA" type="BehaviorExecutionSpecification_Behavior"> + <element xmi:type="uml:BehaviorExecutionSpecification" href="bug533681.uml#_Xf7wAEMwEeiEZ5Jtfh6-KA"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_XgAogEMwEeiEZ5Jtfh6-KA" x="18" y="18"/> + </children> + <element xmi:type="uml:BehaviorExecutionSpecification" href="bug533681.uml#_Xf7wAEMwEeiEZ5Jtfh6-KA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_XgABcUMwEeiEZ5Jtfh6-KA" x="40" y="90" width="20" height="100"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_n0MOcETtEei8-Im8RTxj4A" type="DestructionOccurrenceSpecification_Shape"> + <element xmi:type="uml:DestructionOccurrenceSpecification" href="bug533681.uml#_nzCX4ETtEei8-Im8RTxj4A"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_n0MOcUTtEei8-Im8RTxj4A" x="57" y="310"/> + </children> + <element xmi:type="uml:Lifeline" href="bug533681.uml#_R0URAEMwEeiEZ5Jtfh6-KA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_R0X7YUMwEeiEZ5Jtfh6-KA" x="237" y="10" height="290"/> + </children> + <element xmi:type="uml:Interaction" href="bug533681.uml#_POkWwEMwEeiEZ5Jtfh6-KA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_QKU0ZEMwEeiEZ5Jtfh6-KA"/> + </children> + <element xmi:type="uml:Interaction" href="bug533681.uml#_POkWwEMwEeiEZ5Jtfh6-KA"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_QKU0ZUMwEeiEZ5Jtfh6-KA"/> + </children> + <styles xmi:type="notation:StringValueStyle" xmi:id="_QKU0ZkMwEeiEZ5Jtfh6-KA" name="diagram_compatibility_version" stringValue="1.4.0"/> + <styles xmi:type="notation:DiagramStyle" xmi:id="_QKU0Z0MwEeiEZ5Jtfh6-KA"/> + <styles xmi:type="style:PapyrusDiagramStyle" xmi:id="_QKU0aEMwEeiEZ5Jtfh6-KA" diagramKindId="org.eclipse.papyrus.uml.diagram.sequence"> + <owner xmi:type="uml:Class" href="bug533681.uml#_Jqu6wEMwEeiEZ5Jtfh6-KA"/> + </styles> + <element xmi:type="uml:Interaction" href="bug533681.uml#_POkWwEMwEeiEZ5Jtfh6-KA"/> + <edges xmi:type="notation:Connector" xmi:id="_Xfg5QEMwEeiEZ5Jtfh6-KA" type="Message_SynchEdge" source="_RZ4XwEMwEeiEZ5Jtfh6-KA" target="_R0X7YEMwEeiEZ5Jtfh6-KA"> + <children xmi:type="notation:DecorationNode" xmi:id="_Xfg5Q0MwEeiEZ5Jtfh6-KA" type="Message_SynchNameLabel"> + <element xmi:type="uml:Message" href="bug533681.uml#_XfUsAEMwEeiEZ5Jtfh6-KA"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_Xfg5REMwEeiEZ5Jtfh6-KA" x="1" y="-13"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_XfhgUEMwEeiEZ5Jtfh6-KA" type="Message_SynchStereotypeLabel"> + <element xmi:type="uml:Message" href="bug533681.uml#_XfUsAEMwEeiEZ5Jtfh6-KA"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_XfhgUUMwEeiEZ5Jtfh6-KA" x="1" y="-33"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="_Xfg5QUMwEeiEZ5Jtfh6-KA"/> + <styles xmi:type="notation:LineStyle" xmi:id="_XfhgUkMwEeiEZ5Jtfh6-KA"/> + <element xmi:type="uml:Message" href="bug533681.uml#_XfUsAEMwEeiEZ5Jtfh6-KA"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_Xfg5QkMwEeiEZ5Jtfh6-KA" points="[0, 0, -179, 0]$[179, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_XftGgEMwEeiEZ5Jtfh6-KA" id="(0.5,0.12857142857142856)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_XfttkEMwEeiEZ5Jtfh6-KA" id="(0.5,0.3103448275862069)"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_XgIkUEMwEeiEZ5Jtfh6-KA" type="Message_ReplyEdge" source="_R0X7YEMwEeiEZ5Jtfh6-KA" target="_RZ4XwEMwEeiEZ5Jtfh6-KA"> + <children xmi:type="notation:DecorationNode" xmi:id="_XgIkU0MwEeiEZ5Jtfh6-KA" type="Message_ReplyNameLabel"> + <element xmi:type="uml:Message" href="bug533681.uml#_XgGvIEMwEeiEZ5Jtfh6-KA"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_XgIkVEMwEeiEZ5Jtfh6-KA" x="1" y="-13"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_XgIkVUMwEeiEZ5Jtfh6-KA" type="Message_ReplyStereotypeLabel"> + <element xmi:type="uml:Message" href="bug533681.uml#_XgGvIEMwEeiEZ5Jtfh6-KA"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_XgIkVkMwEeiEZ5Jtfh6-KA" x="1" y="-33"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="_XgIkUUMwEeiEZ5Jtfh6-KA"/> + <styles xmi:type="notation:LineStyle" xmi:id="_XgIkV0MwEeiEZ5Jtfh6-KA"/> + <element xmi:type="uml:Message" href="bug533681.uml#_XgGvIEMwEeiEZ5Jtfh6-KA"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_XgIkUkMwEeiEZ5Jtfh6-KA" points="[0, 0, 179, 0]$[-179, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_XgJycEMwEeiEZ5Jtfh6-KA" id="(0.5,0.6551724137931033)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_XgJycUMwEeiEZ5Jtfh6-KA" id="(0.5,0.2714285714285714)"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_nzN-EETtEei8-Im8RTxj4A" type="Message_DeleteEdge" source="_RZ4XwEMwEeiEZ5Jtfh6-KA" target="_R0X7YEMwEeiEZ5Jtfh6-KA"> + <children xmi:type="notation:DecorationNode" xmi:id="_nzOlIkTtEei8-Im8RTxj4A" type="Message_DeleteNameLabel"> + <element xmi:type="uml:Message" href="bug533681.uml#_ny3_0ETtEei8-Im8RTxj4A"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_nzOlI0TtEei8-Im8RTxj4A" x="1" y="-13"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_nzOlJETtEei8-Im8RTxj4A" type="Message_DeleteStereotypeLabel"> + <element xmi:type="uml:Message" href="bug533681.uml#_ny3_0ETtEei8-Im8RTxj4A"/> + <layoutConstraint xmi:type="notation:Location" xmi:id="_nzOlJUTtEei8-Im8RTxj4A" x="1" y="-33"/> + </children> + <styles xmi:type="notation:FontStyle" xmi:id="_nzOlIETtEei8-Im8RTxj4A"/> + <styles xmi:type="notation:LineStyle" xmi:id="_nzOlJkTtEei8-Im8RTxj4A"/> + <element xmi:type="uml:Message" href="bug533681.uml#_ny3_0ETtEei8-Im8RTxj4A"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_nzOlIUTtEei8-Im8RTxj4A" points="[0, 0, -179, 0]$[179, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_nztGQETtEei8-Im8RTxj4A" id="(0.5,0.4142857142857143)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_nztGQUTtEei8-Im8RTxj4A" id="(0.5,1.0)"/> + </edges> +</notation:Diagram> diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533681.uml b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533681.uml new file mode 100644 index 00000000000..16ad215666e --- /dev/null +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/resource/bugs/bug533681.uml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_HWN6cEMwEeiEZ5Jtfh6-KA" name="bug533681"> + <packageImport xmi:type="uml:PackageImport" xmi:id="_HeHSMEMwEeiEZ5Jtfh6-KA"> + <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> + </packageImport> + <packagedElement xmi:type="uml:Class" xmi:id="_Jqu6wEMwEeiEZ5Jtfh6-KA" name="Foo" classifierBehavior="_POkWwEMwEeiEZ5Jtfh6-KA"> + <ownedAttribute xmi:type="uml:Property" xmi:id="_LwEPkEMwEeiEZ5Jtfh6-KA" name="a"/> + <ownedAttribute xmi:type="uml:Property" xmi:id="_M6OVkEMwEeiEZ5Jtfh6-KA" name="b"/> + <ownedBehavior xmi:type="uml:Interaction" xmi:id="_POkWwEMwEeiEZ5Jtfh6-KA" name="DoIt"> + <lifeline xmi:type="uml:Lifeline" xmi:id="_RZwb8EMwEeiEZ5Jtfh6-KA" name="a" represents="_LwEPkEMwEeiEZ5Jtfh6-KA" coveredBy="_FQ3nIESnEeilLIdbxjHAOw _kZsdgETtEei8-Im8RTxj4A _XfZkgEMwEeiEZ5Jtfh6-KA _XgH9QEMwEeiEZ5Jtfh6-KA _ny_UkETtEei8-Im8RTxj4A _FQ2ZAESnEeilLIdbxjHAOw"/> + <lifeline xmi:type="uml:Lifeline" xmi:id="_R0URAEMwEeiEZ5Jtfh6-KA" name="b" represents="_M6OVkEMwEeiEZ5Jtfh6-KA" coveredBy="_FQ3nIESnEeilLIdbxjHAOw _kZsdgETtEei8-Im8RTxj4A _XfaLkEMwEeiEZ5Jtfh6-KA _XgHWMEMwEeiEZ5Jtfh6-KA _nzCX4ETtEei8-Im8RTxj4A _Xf7wAEMwEeiEZ5Jtfh6-KA _FQ2ZAESnEeilLIdbxjHAOw"/> + <fragment xmi:type="uml:CombinedFragment" xmi:id="_FQ2ZAESnEeilLIdbxjHAOw" name="cfrag" covered="_RZwb8EMwEeiEZ5Jtfh6-KA _R0URAEMwEeiEZ5Jtfh6-KA" interactionOperator="alt"> + <operand xmi:type="uml:InteractionOperand" xmi:id="_FQ3nIESnEeilLIdbxjHAOw" name="alt1" covered="_RZwb8EMwEeiEZ5Jtfh6-KA _R0URAEMwEeiEZ5Jtfh6-KA"> + <ownedComment xmi:type="uml:Comment" xmi:id="_WhxXAEi0EeiqJbu8mwQLKA"> + <body>This branch will never happen.</body> + </ownedComment> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_XfZkgEMwEeiEZ5Jtfh6-KA" name="request-send" covered="_RZwb8EMwEeiEZ5Jtfh6-KA" message="_XfUsAEMwEeiEZ5Jtfh6-KA"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_XfaLkEMwEeiEZ5Jtfh6-KA" name="request-recv" covered="_R0URAEMwEeiEZ5Jtfh6-KA" message="_XfUsAEMwEeiEZ5Jtfh6-KA"/> + <fragment xmi:type="uml:BehaviorExecutionSpecification" xmi:id="_Xf7wAEMwEeiEZ5Jtfh6-KA" name="exec" covered="_R0URAEMwEeiEZ5Jtfh6-KA" finish="_XgHWMEMwEeiEZ5Jtfh6-KA" start="_XfaLkEMwEeiEZ5Jtfh6-KA"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_XgHWMEMwEeiEZ5Jtfh6-KA" name="reply-send" covered="_R0URAEMwEeiEZ5Jtfh6-KA" message="_XgGvIEMwEeiEZ5Jtfh6-KA"/> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_XgH9QEMwEeiEZ5Jtfh6-KA" name="reply-recv" covered="_RZwb8EMwEeiEZ5Jtfh6-KA" message="_XgGvIEMwEeiEZ5Jtfh6-KA"/> + <guard xmi:type="uml:InteractionConstraint" xmi:id="_FQ3nIUSnEeilLIdbxjHAOw" name="guard"> + <specification xmi:type="uml:LiteralBoolean" xmi:id="_MNfq0Ei0EeiqJbu8mwQLKA"/> + </guard> + </operand> + <operand xmi:type="uml:InteractionOperand" xmi:id="_kZsdgETtEei8-Im8RTxj4A" name="alt2" covered="_RZwb8EMwEeiEZ5Jtfh6-KA _R0URAEMwEeiEZ5Jtfh6-KA"> + <ownedComment xmi:type="uml:Comment" xmi:id="_ZsEIwEi0EeiqJbu8mwQLKA"> + <body>This branch will always happen.</body> + </ownedComment> + <fragment xmi:type="uml:MessageOccurrenceSpecification" xmi:id="_ny_UkETtEei8-Im8RTxj4A" name="delete-send" covered="_RZwb8EMwEeiEZ5Jtfh6-KA" message="_ny3_0ETtEei8-Im8RTxj4A"/> + <fragment xmi:type="uml:DestructionOccurrenceSpecification" xmi:id="_nzCX4ETtEei8-Im8RTxj4A" name="deleted" covered="_R0URAEMwEeiEZ5Jtfh6-KA" message="_ny3_0ETtEei8-Im8RTxj4A"/> + <guard xmi:type="uml:InteractionConstraint" xmi:id="_kZ1AYETtEei8-Im8RTxj4A" name="guard"/> + </operand> + </fragment> + <message xmi:type="uml:Message" xmi:id="_XfUsAEMwEeiEZ5Jtfh6-KA" name="request" receiveEvent="_XfaLkEMwEeiEZ5Jtfh6-KA" sendEvent="_XfZkgEMwEeiEZ5Jtfh6-KA"/> + <message xmi:type="uml:Message" xmi:id="_XgGvIEMwEeiEZ5Jtfh6-KA" messageSort="reply" receiveEvent="_XgH9QEMwEeiEZ5Jtfh6-KA" sendEvent="_XgHWMEMwEeiEZ5Jtfh6-KA"/> + <message xmi:type="uml:Message" xmi:id="_ny3_0ETtEei8-Im8RTxj4A" name="delete" messageSort="deleteMessage" receiveEvent="_nzCX4ETtEei8-Im8RTxj4A" sendEvent="_ny_UkETtEei8-Im8RTxj4A"/> + </ownedBehavior> + </packagedElement> +</uml:Model> 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 6b1249663f8..83a0afbdb6f 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 @@ -19,6 +19,8 @@ import static org.eclipse.papyrus.junit.matchers.MoreMatchers.isEmpty; import static org.eclipse.papyrus.junit.matchers.MoreMatchers.lessThan; import static org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture.at; import static org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture.sized; +import static org.hamcrest.CoreMatchers.either; +import static org.hamcrest.CoreMatchers.everyItem; import static org.hamcrest.CoreMatchers.hasItem; import static org.hamcrest.CoreMatchers.hasItems; import static org.hamcrest.CoreMatchers.instanceOf; @@ -29,6 +31,8 @@ import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assume.assumeThat; +import java.util.Arrays; +import java.util.List; import java.util.function.Consumer; import org.eclipse.draw2d.IFigure; @@ -48,11 +52,19 @@ import org.eclipse.papyrus.junit.utils.rules.PluginResource; import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil; import org.eclipse.uml2.uml.CombinedFragment; +import org.eclipse.uml2.uml.Comment; +import org.eclipse.uml2.uml.Constraint; +import org.eclipse.uml2.uml.DestructionOccurrenceSpecification; +import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.ExecutionSpecification; import org.eclipse.uml2.uml.Interaction; 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.hamcrest.CoreMatchers; +import org.hamcrest.CustomTypeSafeMatcher; +import org.hamcrest.Matcher; import org.junit.Rule; import org.junit.Test; @@ -473,4 +485,54 @@ public class CombinedFragmentRegressionTest extends AbstractPapyrusTest { org.eclipse.gef.commands.Command command = target.getCommand(request); assertThat("Should not be able to create", command, not(CommandMatchers.GEF.canExecute())); } + + /** + * Verify that the deletion of a combined fragment deletes all of the interaction + * operands within it (this is different to {@link #deleteCombinedFragment()} which + * tests a combined fragment having only one operand). + */ + @Test + @PluginResource("resource/bugs/bug533681.di") + public void deleteCombinedFragmentMultipleOperands_533681() { + EditPart combinedFragmentEP = editor.findEditPart("cfrag", CombinedFragment.class); + + CombinedFragment cfrag = (CombinedFragment) combinedFragmentEP.getAdapter(EObject.class); + Interaction interaction = cfrag.getEnclosingInteraction(); + assumeThat("No interaction", interaction, notNullValue()); + + InteractionOperand alt1 = cfrag.getOperand("alt1"); + InteractionOperand alt2 = cfrag.getOperand("alt2"); + + editor.delete(combinedFragmentEP); + + assertThat("Operands not deleted", Arrays.asList(alt1, alt2), everyItem(isDeleted())); + assertThat("Combined fragment not deleted", cfrag, isDeleted()); + + // Key interaction fragments still exist and are shown, and messages + EditPart requestMessage = editor.findEditPart("request", Message.class); + assertThat("Message went missing", requestMessage, notNullValue()); + EditPart execSpec = editor.findEditPart("exec", ExecutionSpecification.class); + assertThat("Execution went missing", execSpec, notNullValue()); + EditPart destruction = editor.findEditPart("deleted", DestructionOccurrenceSpecification.class); + assertThat("Destruction went missing", destruction, notNullValue()); + + // But other contents of the interaction operands are, of course, gone + List<Element> allInteractionContents = interaction.allOwnedElements(); + assertThat(allInteractionContents, everyItem(not( + either(CoreMatchers.<Element> instanceOf(Constraint.class)) + .or(instanceOf(Comment.class))))); + } + + // + // Test framework + // + + static Matcher<EObject> isDeleted() { + return new CustomTypeSafeMatcher<EObject>("is deleted") { + @Override + protected boolean matchesSafely(EObject item) { + return item.eResource() == null; + } + }; + } } |