public void Init() { lifeline=new Lifeline(dummyPosition,"",null); coveredMessageEnd=new MessageEnd(coveredMessageEndPosition,"1",null); uncoveredMessageEnd=new MessageEnd(unCoveredMessageEndPosition,"2",null); coveringExecutionSpecification=new ExecutionSpecification(coveringExecutionSpecificationPosition,"",null); coveringExecutionSpecification.Dimension=coveringExecutionSpecificationSize; coveringExecutionSpecification.MessageSourceEnds.Add(coveredMessageEnd); notCoveringExecutionSpecification=new ExecutionSpecification(coveringExecutionSpecificationPosition,"",null); notCoveringExecutionSpecification.Dimension=notCoveringExecutionSpecificationSize; lifeline.MessageEnds.Add(coveredMessageEnd); lifeline.MessageEnds.Add(uncoveredMessageEnd); lifeline.ExecutionSpecifications.Add(coveringExecutionSpecification); lifeline.ExecutionSpecifications.Add(notCoveringExecutionSpecification); coveredMessageEnd.CoveredLifeline=lifeline; uncoveredMessageEnd.CoveredLifeline=lifeline; }
protected internal string CreateProcessEntryId(Lifeline lifeline) { string newProcessEntryId=""; string lifelineName=lifeline.Name; if(lifelineName==null) { string defaultProjectNumber=Convert.ToString(projectDefaultNameCount); newProcessEntryId=PROJECT_DEFAULT_NAME+defaultProjectNumber; projectDefaultNameCount++; } else { string appearanceNumber=this.AppearanceNumberOfLifelineName(lifelineName); newProcessEntryId=lifelineName+DOWN_SLASH+appearanceNumber; this.lifelineNames.Add(lifelineName); } return newProcessEntryId; }
internal override Pin CreatePin(Row row, Lifeline lifeline) { return(new OpenPin(lifeline, Orientation.None, new Token())); }
private void buttonX1_Click(object sender, EventArgs ea) { if (Events != null && Events.Count > 0) { if (start.Value >= end.Value) { MessageBoxEx.Show("Start event id should always be les than end event id", "Events", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } lifelines.Clear(); GoDocument doc = goView1.Document; doc.AllowLink = false; doc.AllowEdit = false; doc.AllowResize = false; doc.Clear(); for (int i = start.Value; i <= end.Value; i++) { var e = Events[i]; Lifeline lf = null; Lifeline s = null, t = null; if (e.Unknow && !lifelines.ContainsKey("Unknown")) { lf = new Lifeline("Unknown"); doc.Add(lf); lifelines.Add(lf.Text, lf); } if (e.Source != null && !lifelines.ContainsKey(e.Source.Name)) { lf = new Lifeline(e.Source.Name); doc.Add(lf); lifelines.Add(lf.Text, lf); } if (e.Target != null && !lifelines.ContainsKey(e.Target.Name)) { lf = new Lifeline(e.Target.Name); doc.Add(lf); lifelines.Add(lf.Text, lf); } if (e.Unknow) { if (e.Source == null) { s = lifelines["Unknown"]; t = lifelines[e.Target.Name]; } else if (e.Target == null) { t = lifelines["Unknown"]; s = lifelines[e.Source.Name]; } else { continue; } } else { t = lifelines[e.Target.Name]; s = lifelines[e.Source.Name]; } var m = new Message(i - start.Value, s, t, e.Message.GetType().Name, 2, e.Message); m.OnMessageClicked += message => Program.MainInstance.DisplayMessageInfo(message); doc.Add(m); } int margin = integerInput1.Value; foreach (var lifeline in lifelines) { lifeline.Value.Left = margin; margin *= 2; } doc.Bounds = doc.ComputeBounds(); goView1.DocPosition = doc.TopLeft; goView1.GridUnboundedSpots = GoObject.BottomLeft | GoObject.BottomRight; goView1.Grid.Top = Lifeline.LineStart; goView1.GridOriginY = Lifeline.LineStart; goView1.GridCellSizeHeight = Lifeline.MessageSpacing; // support undo/redo doc.UndoManager = new GoUndoManager(); } }
public void Init() { elementListSorter=new SequenceChartElementListSorter(); relevantLifeline=new Lifeline(dummyPosition,"",null); firstExecutionSpecification= new ExecutionSpecification(firstExecutionSpecificationPosition,"",null); firstExecutionSpecification.Dimension=firstExecutionSpecificationDimension; secondExecutionSpecification= new ExecutionSpecification(secondExecutionSpecificationPosition,"",null); secondExecutionSpecification.Dimension=secondExecutionSpecificationDimension; firstSourceEnd=new MessageEnd(firstSourceEndPosition,"",null); firstSourceEnd.MessageEndKind=MessageEndKind.sourceEnd; secondSourceEnd=new MessageEnd(secondSourceEndPosition,"",null); secondSourceEnd.MessageEndKind=MessageEndKind.sourceEnd; thirdSourceEnd=new MessageEnd(thirdSourceEndPosition,"",null); thirdSourceEnd.MessageEndKind=MessageEndKind.sourceEnd; fourthSourceEnd=new MessageEnd(fourthSourceEndPosition,"",null); fourthSourceEnd.MessageEndKind=MessageEndKind.sourceEnd; firstDestinationEnd=new MessageEnd(firstDestinationEndPosition,"",null); firstDestinationEnd.MessageEndKind=MessageEndKind.destinationEnd; secondDestinationEnd=new MessageEnd(secondDestinationEndPosition,"",null); secondDestinationEnd.MessageEndKind=MessageEndKind.destinationEnd; }
/* protected internal void CreateFormalGates(Interaction relevantInteraction,XmlElement diagramElement) { XmlElement currentFormalGateElement; XmlElement currentConnectedMessageElement; string currentConnectedMessageElementId; Point currentFormalGatePosition; MessageEndKind messageEndKind; string strMessageEndKind; string currentFormalGateId; FormalGate currentFormalGate; XmlElement interactionElement=relevantInteraction.XmlRepresentation; XmlNodeList formalGateElements=modelDocumentInterpreter.GetFormalGateElements(interactionElement); IEnumerator itrFormalGateElements=formalGateElements.GetEnumerator(); while(itrFormalGateElements.MoveNext()) { currentFormalGateElement=(XmlElement)itrFormalGateElements.Current; currentFormalGateId=currentFormalGateElement.GetAttribute(UmlModel.XMI_ID_ATTR_COMPLETE_NAME); currentConnectedMessageElementId=currentFormalGateElement.GetAttribute(UmlModel.MESSAGE_ATTR_NAME); currentConnectedMessageElement=modelDocumentInterpreter.GetMessageElementForId(diagramElement,currentConnectedMessageElementId); strMessageEndKind =modelDocumentInterpreter.GetEventKindForFormalGateXmlElement(currentFormalGateElement,currentConnectedMessageElement); if (strMessageEndKind.Equals(MessageEndKind.destinationEnd)) { messageEndKind= MessageEndKind.destinationEnd; currentFormalGatePosition=diDocumentInterpreter.GetFormalGateGraphNodePosition(diagramElement,currentFormalGateElement,messageEndKind); } else if(strMessageEndKind.Equals(MessageEndKind.sourceEnd)) { messageEndKind= MessageEndKind.sourceEnd; currentFormalGatePosition=diDocumentInterpreter.GetFormalGateGraphNodePosition(diagramElement,currentFormalGateElement,messageEndKind); } currentFormalGate= new FormalGate(currentFormalGatePosition,currentFormalGateId ,currentFormalGateElement); currentFormalGate.MessageEndKind=messageEndKind; } }*/ protected internal void CreateMessageEndsForLifeline(Lifeline lifeline,XmlElement diagramElement,Interaction interaction) { ArrayList relevantMessageEnds; XmlElement currentMessageEndElement; MessageEnd currentMessageEnd; ExecutionSpecification currentBehaviorExecutionSpec; string currentMessageEndId; Point currentMessageEndPosition; relevantMessageEnds=new ArrayList(); XmlElement lifelineElement=lifeline.XmlRepresentation; XmlElement interactionElement=(XmlElement)lifelineElement.ParentNode; XmlNodeList messageOccurrenceSpecElements= modelDocumentInterpreter.GetMessageOccurrenceSpecElementsForLifeline(lifelineElement); IEnumerator itrMessageOccurrenceSpecElements=messageOccurrenceSpecElements.GetEnumerator(); while(itrMessageOccurrenceSpecElements.MoveNext()) { currentMessageEndElement=(XmlElement)itrMessageOccurrenceSpecElements.Current; currentMessageEndId=currentMessageEndElement.GetAttribute(UmlModel.XMI_ID_ATTR_COMPLETE_NAME); currentMessageEndPosition= diDocumentInterpreter.GetMessageOccurrenceSpecGraphNodePosition(diagramElement,currentMessageEndElement); currentMessageEnd=new MessageEnd(currentMessageEndPosition,currentMessageEndId,currentMessageEndElement); currentMessageEnd.CoveredLifeline=lifeline; currentBehaviorExecutionSpec=currentMessageEnd.GetExecutionForMessageEnd(); if(currentBehaviorExecutionSpec!=null) { currentBehaviorExecutionSpec.MessageSourceEnds.Add(currentMessageEnd); } relevantMessageEnds.Add(currentMessageEnd); } relevantMessageEnds=SortListForVerticalPosition(relevantMessageEnds); lifeline.MessageEnds=relevantMessageEnds; if(relevantMessageEnds.Count >0) { interaction.MessageOccurrenceSpecs.AddRange(relevantMessageEnds); } }
protected internal ArrayList CreateLifelines(XmlElement interactionElement,XmlElement diagramElement) { XmlElement currentLifelineElement; Lifeline currentLifeline; string currentLifelineName; string currentLifelineId; bool isCurrentLifelineDestructed; Point currentLifelinePosition; XmlNodeList lifelineElements=modelDocumentInterpreter.GetLifelineElements(interactionElement); ArrayList lifelines=new ArrayList(); IEnumerator itrLifelineElements=lifelineElements.GetEnumerator(); while(itrLifelineElements.MoveNext()) { currentLifelineElement=(XmlElement)itrLifelineElements.Current; currentLifelineId=currentLifelineElement.GetAttribute(UmlModel.XMI_ID_ATTR_COMPLETE_NAME); currentLifelineName=currentLifelineElement.GetAttribute(UmlModel.NAME_ATTR_NAME); currentLifelinePosition=diDocumentInterpreter.GetLifelineGraphNodePosition(diagramElement,currentLifelineElement); currentLifeline=new Lifeline(currentLifelinePosition,currentLifelineId,currentLifelineElement); currentLifeline.Name=currentLifelineName; isCurrentLifelineDestructed=this.IsLifelineDestructed(interactionElement,currentLifelineId); currentLifeline.IsDestructed=isCurrentLifelineDestructed; lifelines.Add(currentLifeline); } lifelines=SortListForHorizontalPosition(lifelines); return lifelines; }
public void ConnectMessageEndToMessagesTest() { XmlElement firstMessageElement =MessageElementStub.CreateMessageElementStub(xmiDocument,FIRST_MESSAGE_ELEMENT_ID); firstMessageElement.SetAttribute(UmlModelElements.SEND_EVENT_ATTR_NAME,FIRST_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID); firstMessageElement.SetAttribute(UmlModelElements.RECEIVE_EVENT_ATTR_NAME,FOURTH_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID); Message firstMessage =new Message(ZERO_POSITION,FIRST_MESSAGE_ELEMENT_ID,firstMessageElement); XmlElement firstSourceMessageEndElement= MessageOccurrenceSpecElementStub.CreateMessageOccurrenceSpecElementStub(xmiDocument,FIRST_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID); firstSourceMessageEndElement.SetAttribute(UmlModelElements.MESSAGE_ATTR_NAME,FIRST_MESSAGE_ELEMENT_ID); MessageEnd firstSourceMessageEnd=new MessageEnd(ZERO_POSITION,FIRST_MESSAGE_ELEMENT_ID,firstSourceMessageEndElement); XmlElement firstDestinationMessageEndElement= MessageOccurrenceSpecElementStub.CreateMessageOccurrenceSpecElementStub(xmiDocument,FOURTH_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID); firstDestinationMessageEndElement.SetAttribute(UmlModelElements.MESSAGE_ATTR_NAME,FIRST_MESSAGE_ELEMENT_ID); MessageEnd firstDestinationMessageEnd=new MessageEnd(ZERO_POSITION,FOURTH_MESSAGE_ELEMENT_ID,firstDestinationMessageEndElement); XmlElement secondMessageElement =MessageElementStub.CreateMessageElementStub(xmiDocument,SECOND_MESSAGE_ELEMENT_ID); secondMessageElement.SetAttribute(UmlModelElements.SEND_EVENT_ATTR_NAME,SECOND_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID); secondMessageElement.SetAttribute(UmlModelElements.RECEIVE_EVENT_ATTR_NAME,FIFTH_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID); Message secondMessage =new Message(ZERO_POSITION,SECOND_MESSAGE_ELEMENT_ID,secondMessageElement); XmlElement secondSourceMessageEndElement= MessageOccurrenceSpecElementStub.CreateMessageOccurrenceSpecElementStub(xmiDocument,SECOND_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID); secondSourceMessageEndElement.SetAttribute(UmlModelElements.MESSAGE_ATTR_NAME,SECOND_MESSAGE_ELEMENT_ID); MessageEnd secondSourceMessageEnd=new MessageEnd(ZERO_POSITION,SECOND_MESSAGE_ELEMENT_ID,secondSourceMessageEndElement); XmlElement secondDestinationMessageEndElement= MessageOccurrenceSpecElementStub.CreateMessageOccurrenceSpecElementStub(xmiDocument,FIFTH_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID); secondDestinationMessageEndElement.SetAttribute(UmlModelElements.MESSAGE_ATTR_NAME,SECOND_MESSAGE_ELEMENT_ID); MessageEnd secondDestinationMessageEnd=new MessageEnd(ZERO_POSITION,FIFTH_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID,secondDestinationMessageEndElement); Lifeline firstLifeline=new Lifeline(ZERO_POSITION,"",null); firstLifeline.MessageEnds.Add(firstSourceMessageEnd); firstLifeline.MessageEnds.Add(secondSourceMessageEnd); Lifeline secondLifeline=new Lifeline(ZERO_POSITION,"",null); secondLifeline.MessageEnds.Add(firstDestinationMessageEnd); secondLifeline.MessageEnds.Add(secondDestinationMessageEnd); interactionElement.AppendChild(firstMessageElement); interactionElement.AppendChild(secondMessageElement); interactionElement.AppendChild(firstSourceMessageEndElement); interactionElement.AppendChild(firstDestinationMessageEndElement); interactionElement.AppendChild(secondSourceMessageEndElement); interactionElement.AppendChild(secondDestinationMessageEndElement); Interaction interaction=new Interaction(ZERO_POSITION,"",null); interaction.Messages.Add(firstMessage); interaction.Messages.Add(secondMessage); ArrayList relevantMessageEnds=new ArrayList(); relevantMessageEnds.Add(firstSourceMessageEnd); relevantMessageEnds.Add(firstDestinationMessageEnd); relevantMessageEnds.Add(secondSourceMessageEnd); relevantMessageEnds.Add(secondDestinationMessageEnd); ArrayList relevantLifelines=new ArrayList(); relevantLifelines.Add(firstLifeline); relevantLifelines.Add(secondLifeline); sequenceChartModelCreator.ConnectMessageEndsToMessage(relevantLifelines,interaction); MessageEnd firstActualSoureMessageEnd=firstMessage.SourceMessageEnd; Assert.IsNotNull(firstActualSoureMessageEnd); Assert.AreEqual(firstSourceMessageEnd,firstActualSoureMessageEnd); MessageEnd firstActualDestinationMessageEnd=firstMessage.DestinationMessageEnd; Assert.IsNotNull(firstActualDestinationMessageEnd); Assert.AreEqual(firstActualDestinationMessageEnd,firstActualDestinationMessageEnd); MessageEnd secondActualSoureMessageEnd=secondMessage.SourceMessageEnd; Assert.IsNotNull(secondActualSoureMessageEnd); Assert.AreEqual(secondSourceMessageEnd,secondActualSoureMessageEnd); MessageEnd secondActualDestinationMessageEnd=secondMessage.DestinationMessageEnd; Assert.IsNotNull(secondActualDestinationMessageEnd); Assert.AreEqual(secondActualDestinationMessageEnd,secondActualDestinationMessageEnd); }
internal override Pin CreatePin(Row row, Lifeline lifeline) { return(new RegularPin(row, lifeline)); }
public void CreateMessageEndsForLifelineTwoMessageOccurrenceSpecTest() { string interactionElementContent = "<message xmi:id='1' xmlns:xmi='http://www.omg.org/XMI' />"+ "<lifeline xmi:id='5' xmlns:xmi='http://www.omg.org/XMI' />"+ "<lifeline xmi:id='6' xmlns:xmi='http://www.omg.org/XMI' />"+ "<fragment xmi:type='uml:MessageOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' xmi:id='25' message='1' covered='5' event='42'/>"+ "<fragment xmi:type='uml:MessageOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' xmi:id='26' message='1' covered='6' event='43'/>"; interactionElement.InnerXml=interactionElementContent; string diagramElementContent="<contained>" + "<contained xsi:type='di2:GraphNode' position='650:673' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' >"+ "<semanticModel>"+ "<element xsi:type='uml:Lifeline' href='TheTestModel.uml#5'/>"+ "</semanticModel>"+ "<anchorage position='2608:2793' graphEdge='/0/@contained.1'/>"+ "</contained>"+ "<contained xsi:type='di2:GraphNode' position='703:723' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"+ "<semanticModel>"+ "<element xsi:type='uml:Lifeline' href='TheTestModel.uml#6'/>"+ "</semanticModel>"+ "<anchorage position='2804:2857' graphEdge='/0/@contained.1'/>"+ "</contained>"+ "</contained>"+ "<contained xsi:type='di2:GraphEdge' position='34:97' anchor='/1/@contained.0/@contained.0/@anchorage.0 /1/@contained.0/@contained.1/@anchorage.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"+ "<semanticModel>"+ "<element xsi:type='uml:Message' href='TheTestModel.uml#1'/>"+ "</semanticModel>"+ "</contained>"; diagramElement.InnerXml=diagramElementContent; XmlElement firstSendOperationEventElement= SendOperationEventElementStub.CreateSendOperationEventElementStub(xmiDocument,FIRST_SEND_OPERATION_EVENT_ELEMENT_ID,""); XmlElement firstReceiveOperationEventElement= ReceiveOperationEventElementStub.CreateReceiveOperationEventElementStub(xmiDocument,FIRST_RECEIVE_OPERATION_EVENT_ELEMENT_ID,""); modelElement.AppendChild(interactionElement); modelElement.AppendChild(firstSendOperationEventElement); modelElement.AppendChild(firstReceiveOperationEventElement); Interaction interaction=new Interaction(ZERO_POSITION,"",interactionElement); XmlElement lifelineElement=(XmlElement)interactionElement.SelectSingleNode("//lifeline[@xmi:id='5']",this.namespaceManager);; Lifeline lifeline=new Lifeline(ZERO_POSITION,"",lifelineElement); sequenceChartModelCreator.CreateMessageEndsForLifeline(lifeline,diagramElement,interaction); ArrayList messageOccurrenceSpecs=lifeline.MessageEnds; int messageOccurrenceSpecsCount=messageOccurrenceSpecs.Count; Assert.IsTrue(messageOccurrenceSpecsCount==1); MessageEnd firstActualMessageEnd=(MessageEnd)messageOccurrenceSpecs[0]; this.AssertXmiId(firstActualMessageEnd,FIRST_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID); this.AssertPosition(firstActualMessageEnd,FIRST_MESSAGE_OCCURRENCE_SPEC_ELEMENT_X,FIRST_MESSAGE_OCCURRENCE_SPEC_ELEMENT_Y); this.AssertIdOfXmiRepresentation(firstActualMessageEnd,FIRST_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID); EventKind firstMessageEndEventKind=firstActualMessageEnd.AssociatedEventKind; Assert.IsTrue(firstMessageEndEventKind==EventKind.sendOperationEvent); XmlElement secondLifelineElement=(XmlElement)interactionElement.SelectSingleNode("//lifeline[@xmi:id='6']",this.namespaceManager);; Lifeline secondLifeline=new Lifeline(ZERO_POSITION,"",secondLifelineElement); sequenceChartModelCreator.CreateMessageEndsForLifeline(secondLifeline,diagramElement,interaction); messageOccurrenceSpecs=secondLifeline.MessageEnds; messageOccurrenceSpecsCount=messageOccurrenceSpecs.Count; Assert.IsTrue(messageOccurrenceSpecsCount==1); MessageEnd secondActualMessageEnd=(MessageEnd)messageOccurrenceSpecs[0]; this.AssertXmiId(secondActualMessageEnd,SECOND_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID); this.AssertPosition(secondActualMessageEnd,SECOND_MESSAGE_OCCURRENCE_SPEC_ELEMENT_X,SECOND_MESSAGE_OCCURRENCE_SPEC_ELEMENT_Y); this.AssertIdOfXmiRepresentation(secondActualMessageEnd,SECOND_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID); EventKind secondMessageEndEventKind=secondActualMessageEnd.AssociatedEventKind; Assert.IsTrue(secondMessageEndEventKind==EventKind.receiveOperationEvent); }
public void CreateMessageEndsForLifelineNoMessageOccurrenceSpecTest() { string interactionElementContent = "<lifeline xmi:id='5' xmlns:xmi='http://www.omg.org/XMI' />"; interactionElement.InnerXml=interactionElementContent; string diagramElementContent="<contained>" + "</contained>"; diagramElement.InnerXml=diagramElementContent; XmlElement lifelineElement=(XmlElement)interactionElement.FirstChild; Lifeline lifeline=new Lifeline(ZERO_POSITION,"",lifelineElement); Interaction interaction=new Interaction(ZERO_POSITION,"",interactionElement); sequenceChartModelCreator.CreateMessageEndsForLifeline(lifeline,diagramElement,interaction); ArrayList messageOccurrenceSpecs=lifeline.MessageEnds; int messageOccurrenceSpecsCount=messageOccurrenceSpecs.Count; Assert.IsTrue(messageOccurrenceSpecsCount==0); }
public void CreateExecutionsForLifelineThreeExecutionsTest() { string interactionElementContent = "<lifeline xmi:id='5' xmlns:xmi='http://www.omg.org/XMI' />"+ "<fragment xmi:type='uml:BehaviorExecutionSpecification' xmlns:xmi='http://www.omg.org/XMI' xmi:id='11'/>"+ "<fragment xmi:type='uml:BehaviorExecutionSpecification' xmlns:xmi='http://www.omg.org/XMI' xmi:id='10'/>"+ "<fragment xmi:type='uml:BehaviorExecutionSpecification' xmlns:xmi='http://www.omg.org/XMI' xmi:id='12'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='5' execution='10'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='5' execution='10'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='5' execution='11'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='5' execution='11'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='5' execution='12'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='5' execution='12'/>"; interactionElement.InnerXml=interactionElementContent; string diagramElementContent="<contained>" + "<contained xsi:type='di2:GraphEdge' position='1002:1234' size='1256:1309' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"+ "<semanticModel>"+ "<element xsi:type='uml:BehaviorExecutionSpecification' href='TheTestModel.uml#10'/>"+ "</semanticModel>"+ "</contained>"+ "<contained xsi:type='di2:GraphEdge' position='1345:1431' size='1498:1507' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"+ "<semanticModel>"+ "<element xsi:type='uml:BehaviorExecutionSpecification' href='TheTestModel.uml#11'/>"+ "</semanticModel>"+ "</contained>"+ "<contained xsi:type='di2:GraphEdge' position='1513:1636' size='1647:1692' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"+ "<semanticModel>"+ "<element xsi:type='uml:BehaviorExecutionSpecification' href='TheTestModel.uml#12'/>"+ "</semanticModel>"+ "</contained>"+ "</contained>"; diagramElement.InnerXml=diagramElementContent; XmlElement lifelineElement=(XmlElement)interactionElement.FirstChild; Lifeline lifeline=new Lifeline(ZERO_POSITION,"",lifelineElement); //sequenceChartModelCreator.CreateExecutionsForLifeline(lifeline,diagramElement); ArrayList executions=lifeline.ExecutionSpecifications; int executionsCount=executions.Count; Assert.IsTrue(executionsCount==3); ExecutionSpecification firstActualBehaviorSpec= (ExecutionSpecification)executions[0]; AssertXmiId(firstActualBehaviorSpec,FIRST_EXECUTION_SPEC_ELEMENT_ID); AssertPosition(firstActualBehaviorSpec,FIRST_EXECUTION_SPEC_ELEMENT_X,FIRST_EXECUTION_SPEC_ELEMENT_Y); AssertDimension(firstActualBehaviorSpec,FIRST_EXECUTION_SPEC_ELEMENT_WIDTH,FIRST_EXECUTION_SPEC_ELEMENT_HEIGHT); AssertIdOfXmiRepresentation(firstActualBehaviorSpec,FIRST_EXECUTION_SPEC_ELEMENT_ID); ExecutionSpecification secondActualBehaviorSpec= (ExecutionSpecification)executions[1]; AssertXmiId(secondActualBehaviorSpec,SECOND_EXECUTION_SPEC_ELEMENT_ID); AssertPosition(secondActualBehaviorSpec,SECOND_EXECUTION_SPEC_ELEMENT_X,SECOND_EXECUTION_SPEC_ELEMENT_Y); AssertDimension(secondActualBehaviorSpec,SECOND_EXECUTION_SPEC_ELEMENT_WIDTH,SECOND_EXECUTION_SPEC_ELEMENT_HEIGHT); AssertIdOfXmiRepresentation(secondActualBehaviorSpec,SECOND_EXECUTION_SPEC_ELEMENT_ID); ExecutionSpecification thirdActualBehaviorSpec= (ExecutionSpecification)executions[2]; AssertXmiId(thirdActualBehaviorSpec,THIRD_EXECUTION_SPEC_ELEMENT_ID); AssertPosition(thirdActualBehaviorSpec,THIRD_EXECUTION_SPEC_ELEMENT_X,THIRD_EXECUTION_SPEC_ELEMENT_Y); AssertDimension(thirdActualBehaviorSpec,THIRD_EXECUTION_SPEC_ELEMENT_WIDTH,THIRD_EXECUTION_SPEC_ELEMENT_HEIGHT); AssertIdOfXmiRepresentation(thirdActualBehaviorSpec,THIRD_EXECUTION_SPEC_ELEMENT_ID); }
public void CreateExecutionsForLifelinesThreeElementsTest() { string interactionElementContent = "<lifeline xmi:id='5' xmlns:xmi='http://www.omg.org/XMI' />"+ "<fragment xmi:type='uml:BehaviorExecutionSpecification' xmlns:xmi='http://www.omg.org/XMI' xmi:id='11'/>"+ "<fragment xmi:type='uml:BehaviorExecutionSpecification' xmlns:xmi='http://www.omg.org/XMI' xmi:id='10'/>"+ "<fragment xmi:type='uml:BehaviorExecutionSpecification' xmlns:xmi='http://www.omg.org/XMI' xmi:id='12'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='5' execution='10'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='5' execution='10'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='5' execution='11'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='5' execution='11'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='5' execution='12'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='5' execution='12'/>"+ "<lifeline xmi:id='6' xmlns:xmi='http://www.omg.org/XMI' />"+ "<fragment xmi:type='uml:BehaviorExecutionSpecification' xmlns:xmi='http://www.omg.org/XMI' xmi:id='14'/>"+ "<fragment xmi:type='uml:BehaviorExecutionSpecification' xmlns:xmi='http://www.omg.org/XMI' xmi:id='15'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='6' execution='13'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='6' execution='13'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='6' execution='14'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='6' execution='14'/>"+ "<lifeline xmi:id='7' xmlns:xmi='http://www.omg.org/XMI' />"+ "<fragment xmi:type='uml:BehaviorExecutionSpecification' xmlns:xmi='http://www.omg.org/XMI' xmi:id='13'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='7' execution='15'/>"+ "<fragment xmi:type='uml:ExecutionOccurrenceSpecification' xmlns:xmi='http://www.omg.org/XMI' covered='7' execution='15'/>"; interactionElement.InnerXml=interactionElementContent; XmlElement firstLifelineElement=(XmlElement)interactionElement.SelectSingleNode("//lifeline[@xmi:id='5']",namespaceManager); Lifeline firstLifeline=new Lifeline(ZERO_POSITION,"",firstLifelineElement); XmlElement secondLifelineElement=(XmlElement)interactionElement.SelectSingleNode("//lifeline[@xmi:id='6']",namespaceManager); Lifeline secondLifeline=new Lifeline(ZERO_POSITION,"",secondLifelineElement); XmlElement thirdLifelineElement=(XmlElement)interactionElement.SelectSingleNode("//lifeline[@xmi:id='7']",namespaceManager); Lifeline thirdLifeline=new Lifeline(ZERO_POSITION,"",thirdLifelineElement); ArrayList lifelines=new ArrayList(); lifelines.Add(firstLifeline); lifelines.Add(secondLifeline); lifelines.Add(thirdLifeline); string diagramElementContent="<contained>" + "<contained xsi:type='di2:GraphEdge' position='1002:1234' size='1256:1309' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"+ "<semanticModel>"+ "<element xsi:type='uml:BehaviorExecutionSpecification' href='TheTestModel.uml#10'/>"+ "</semanticModel>"+ "</contained>"+ "<contained xsi:type='di2:GraphEdge' position='1345:1431' size='1498:1507' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"+ "<semanticModel>"+ "<element xsi:type='uml:BehaviorExecutionSpecification' href='TheTestModel.uml#11'/>"+ "</semanticModel>"+ "</contained>"+ "<contained xsi:type='di2:GraphEdge' position='1513:1636' size='1647:1692' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"+ "<semanticModel>"+ "<element xsi:type='uml:BehaviorExecutionSpecification' href='TheTestModel.uml#12'/>"+ "</semanticModel>"+ "</contained>"+ "<contained xsi:type='di2:GraphEdge' position='1699:1734' size='1771:1792' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"+ "<semanticModel>"+ "<element xsi:type='uml:BehaviorExecutionSpecification' href='TheTestModel.uml#13'/>"+ "</semanticModel>"+ "</contained>"+ "<contained xsi:type='di2:GraphEdge' position='1794:1803' size='1827:1831' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"+ "<semanticModel>"+ "<element xsi:type='uml:BehaviorExecutionSpecification' href='TheTestModel.uml#14'/>"+ "</semanticModel>"+ "</contained>"+ "<contained xsi:type='di2:GraphEdge' position='1834:1851' size='1934:1975' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"+ "<semanticModel>"+ "<element xsi:type='uml:BehaviorExecutionSpecification' href='TheTestModel.uml#15'/>"+ "</semanticModel>"+ "</contained>"+ "</contained>"; diagramElement.InnerXml=diagramElementContent; // sequenceChartModelCreator.CreateExecutionsForLifelines(lifelines,diagramElement); ArrayList executionSpecsFirstLifeline=firstLifeline.ExecutionSpecifications; Assert.IsNotNull(executionSpecsFirstLifeline); int executionSpecsFirstLifelineCount=executionSpecsFirstLifeline.Count; Assert.IsTrue(executionSpecsFirstLifelineCount==3); ExecutionSpecification firstExecutionSpecFirstLifeline= (ExecutionSpecification)executionSpecsFirstLifeline[0]; Assert.IsNotNull(firstExecutionSpecFirstLifeline); this.AssertIdOfXmiRepresentation(firstExecutionSpecFirstLifeline,FIRST_EXECUTION_SPEC_ELEMENT_ID); this.AssertXmiId(firstExecutionSpecFirstLifeline,FIRST_EXECUTION_SPEC_ELEMENT_ID); this.AssertPosition(firstExecutionSpecFirstLifeline,FIRST_EXECUTION_SPEC_ELEMENT_X,FIRST_EXECUTION_SPEC_ELEMENT_Y); this.AssertDimension(firstExecutionSpecFirstLifeline,FIRST_EXECUTION_SPEC_ELEMENT_WIDTH,FIRST_EXECUTION_SPEC_ELEMENT_HEIGHT); ExecutionSpecification secondExecutionSpecFirstLifeline= (ExecutionSpecification)executionSpecsFirstLifeline[1]; Assert.IsNotNull(secondExecutionSpecFirstLifeline); this.AssertIdOfXmiRepresentation(secondExecutionSpecFirstLifeline,SECOND_EXECUTION_SPEC_ELEMENT_ID); this.AssertXmiId(secondExecutionSpecFirstLifeline,SECOND_EXECUTION_SPEC_ELEMENT_ID); this.AssertPosition(secondExecutionSpecFirstLifeline,SECOND_EXECUTION_SPEC_ELEMENT_X,SECOND_EXECUTION_SPEC_ELEMENT_Y); this.AssertDimension(secondExecutionSpecFirstLifeline,SECOND_EXECUTION_SPEC_ELEMENT_WIDTH,SECOND_EXECUTION_SPEC_ELEMENT_HEIGHT); ExecutionSpecification thirdExecutionSpecFirstLifeline= (ExecutionSpecification)executionSpecsFirstLifeline[2]; Assert.IsNotNull(secondExecutionSpecFirstLifeline); this.AssertIdOfXmiRepresentation(thirdExecutionSpecFirstLifeline,THIRD_EXECUTION_SPEC_ELEMENT_ID); this.AssertXmiId(thirdExecutionSpecFirstLifeline,THIRD_EXECUTION_SPEC_ELEMENT_ID); this.AssertPosition(thirdExecutionSpecFirstLifeline,THIRD_EXECUTION_SPEC_ELEMENT_X,THIRD_EXECUTION_SPEC_ELEMENT_Y); this.AssertDimension(thirdExecutionSpecFirstLifeline,THIRD_EXECUTION_SPEC_ELEMENT_WIDTH,THIRD_EXECUTION_SPEC_ELEMENT_HEIGHT); ArrayList executionSpecsSecondLifeline=secondLifeline.ExecutionSpecifications; Assert.IsNotNull(executionSpecsSecondLifeline); int executionSpecsSecondLifelineCount=executionSpecsSecondLifeline.Count; Assert.IsTrue(executionSpecsSecondLifelineCount==2); ExecutionSpecification firstExecutionSpecSecondLifeline= (ExecutionSpecification)executionSpecsSecondLifeline[0]; Assert.IsNotNull(firstExecutionSpecSecondLifeline); this.AssertIdOfXmiRepresentation(firstExecutionSpecSecondLifeline,FOURTH_EXECUTION_SPEC_ELEMENT_ID); this.AssertXmiId(firstExecutionSpecSecondLifeline,FOURTH_EXECUTION_SPEC_ELEMENT_ID); this.AssertPosition(firstExecutionSpecSecondLifeline,FOURTH_EXECUTION_SPEC_ELEMENT_X,FOURTH_EXECUTION_SPEC_ELEMENT_Y); this.AssertDimension(firstExecutionSpecSecondLifeline,FOURTH_EXECUTION_SPEC_ELEMENT_WIDTH,FOURTH_EXECUTION_SPEC_ELEMENT_HEIGHT); ExecutionSpecification secondExecutionSpecSecondLifeline= (ExecutionSpecification)executionSpecsSecondLifeline[1]; Assert.IsNotNull(secondExecutionSpecSecondLifeline); this.AssertIdOfXmiRepresentation(secondExecutionSpecSecondLifeline,FIFTH_EXECUTION_SPEC_ELEMENT_ID); this.AssertXmiId(secondExecutionSpecSecondLifeline,FIFTH_EXECUTION_SPEC_ELEMENT_ID); this.AssertPosition(secondExecutionSpecSecondLifeline,FIFTH_EXECUTION_SPEC_ELEMENT_X,FIFTH_EXECUTION_SPEC_ELEMENT_Y); this.AssertDimension(secondExecutionSpecSecondLifeline,FIFTH_EXECUTION_SPEC_ELEMENT_WIDTH,FIFTH_EXECUTION_SPEC_ELEMENT_HEIGHT); ArrayList executionSpecsThirdLifeline=thirdLifeline.ExecutionSpecifications; Assert.IsNotNull(executionSpecsThirdLifeline); int executionSpecsThirdLifelineCount=executionSpecsThirdLifeline.Count; Assert.IsTrue(executionSpecsThirdLifelineCount==1); ExecutionSpecification thirdExecutionSpecThirdLifeline= (ExecutionSpecification)executionSpecsThirdLifeline[0]; Assert.IsNotNull(thirdExecutionSpecThirdLifeline); this.AssertIdOfXmiRepresentation(thirdExecutionSpecThirdLifeline,SIXTH_EXECUTION_SPEC_ELEMENT_ID); this.AssertXmiId(thirdExecutionSpecThirdLifeline,SIXTH_EXECUTION_SPEC_ELEMENT_ID); this.AssertPosition(thirdExecutionSpecThirdLifeline,SIXTH_EXECUTION_SPEC_ELEMENT_X,SIXTH_EXECUTION_SPEC_ELEMENT_Y); this.AssertDimension(thirdExecutionSpecThirdLifeline,SIXTH_EXECUTION_SPEC_ELEMENT_WIDTH,SIXTH_EXECUTION_SPEC_ELEMENT_HEIGHT); }
public void CreateExecutionsForLifelinesOneLifelineNoInteractionsTest() { interactionElement.InnerXml="<lifeline xmi:id='5' xmlns:xmi='http://www.omg.org/XMI' />"; XmlElement lifelineElement= (XmlElement)interactionElement.FirstChild; Lifeline lifeline=new Lifeline(ZERO_POSITION,FIRST_LIFELINE_ELEMENT_ID,lifelineElement); ArrayList lifelines=new ArrayList(); lifelines.Add(lifeline); string diagramElementContent="<contained>" + "</contained>"; diagramElement.InnerXml=diagramElementContent; //sequenceChartModelCreator.CreateExecutionsForLifelines(lifelines,diagramElement); ArrayList executionSpecsLifeline=lifeline.MessageEnds; Assert.IsNotNull(executionSpecsLifeline); int executionSpecsLifelineCount=executionSpecsLifeline.Count; Assert.IsTrue(executionSpecsLifelineCount==0); }
public void CreateExecutionsForLifelineNoExecutionTest() { string interactionElementContent = "<lifeline xmi:id='5' xmlns:xmi='http://www.omg.org/XMI' />"; interactionElement.InnerXml=interactionElementContent; string diagramElementContent="<contained></contained>"; diagramElement.InnerXml=diagramElementContent; XmlElement lifelineElement=(XmlElement)interactionElement.FirstChild; Lifeline lifeline=new Lifeline(ZERO_POSITION,"",lifelineElement); //sequenceChartModelCreator.CreateExecutionsForLifeline(lifeline,diagramElement); ArrayList executions=lifeline.ExecutionSpecifications; int executionsCount=executions.Count; Assert.IsTrue(executionsCount==0); }
protected internal bool IsLifelineCreatedByMessage(Lifeline relevantLifeline) { bool isLifelineCreatedByMessage=false; MessageEnd currentDestinationMessageEnd; Message currentCorrespondingMessage; MessageSort currentCorrespondingMessageSort; ArrayList destinationEndsOfLifeline=relevantLifeline.GetConnectedDestinationMessageEnds(); IEnumerator itrDestinationEndsOfLifeline=destinationEndsOfLifeline.GetEnumerator(); while((itrDestinationEndsOfLifeline.MoveNext())&&(!isLifelineCreatedByMessage)) { currentDestinationMessageEnd=(MessageEnd)itrDestinationEndsOfLifeline.Current; currentCorrespondingMessage=currentDestinationMessageEnd.CorrespondingMessage; currentCorrespondingMessageSort= currentCorrespondingMessage.MessageSort; if(currentCorrespondingMessageSort.Equals(MessageSort.createMessage)) { isLifelineCreatedByMessage=true; } } return isLifelineCreatedByMessage; }
protected internal void CreateExecutionsForLifeline(Lifeline lifeline,Interaction interaction, XmlElement diagramElement) { string lifelineId=lifeline.XmiId; XmlElement lifelineElement=lifeline.XmlRepresentation; XmlElement interactionElement=(XmlElement)lifelineElement.ParentNode; ArrayList executions=new ArrayList(); ArrayList executionElements=modelDocumentInterpreter.GetExecutionSpecElementsForLifeline(lifelineElement); IEnumerator itrExecutionElements=executionElements.GetEnumerator(); XmlElement currentExecutionElement; ExecutionSpecification currentNewExecution; Point currentExecutionPosition; Size currentExecutionDimension; string currentExecutionId; while(itrExecutionElements.MoveNext()) { currentExecutionElement=(XmlElement)itrExecutionElements.Current; currentExecutionPosition=diDocumentInterpreter.GetExecutionSpecPosition(diagramElement,currentExecutionElement); currentExecutionDimension=diDocumentInterpreter.GetExecutionSpecDimension(diagramElement,currentExecutionElement); currentExecutionId=currentExecutionElement.GetAttribute(UmlModel.XMI_ID_ATTR_COMPLETE_NAME); currentNewExecution=new ExecutionSpecification(currentExecutionPosition,currentExecutionId,currentExecutionElement); currentNewExecution.Dimension=currentExecutionDimension; currentNewExecution.CoveredLifeline=lifeline; executions.Add(currentNewExecution); } executions=SortListForVerticalPosition(executions); lifeline.ExecutionSpecifications=executions; if(executions.Count>0) { interaction.ExecutionSpecs.AddRange(executions); } }
public void Init() { xmiDocument= new XmlDocument(); modelDocumentInterpreter=new XmiModelDocumentInterpreter(); dIDocumentInterpreter=new PapyrusXmiDIDocumentInterpreter(MODEL_DOCUMENT_NAME); sequenceChartModelCreator=new SequenceChartModelCreator(modelDocumentInterpreter,dIDocumentInterpreter); namespaceManager=new XmlNamespaceManager(xmiDocument.NameTable); namespaceManager.AddNamespace(XmiElements.UML_NAMESPACE_PREFIX,XmiElements.UML_NAMESPACE_URI); namespaceManager.AddNamespace(XmiElements.XMI_NAMESPACE_PREFIX,XmiElements.XMI_NAMESPACE_URI); firstConsideredLifelineHorizontal= new Lifeline(POSITION_CONSIDERED_FIRST_ELEMENT_HORIZONTAL,EMPTY_STRING,null); secondConsideredLifelineHorizontal= new Lifeline(POSITION_CONSIDERED_SECOND_ELEMENT_HORIZONTAL,EMPTY_STRING,null); thirdConsideredLifelineHorizontal= new Lifeline(POSITION_CONSIDERED_THIRD_ELEMENT_HORIZONTAL,EMPTY_STRING,null); fourthConsideredLifelineHorizontal= new Lifeline(POSITION_CONSIDERED_FOURTH_ELEMENT_HORIZONTAL,EMPTY_STRING,null); fifthConsideredLifelineHorizontal= new Lifeline(POSITION_CONSIDERED_FIFTH_ELEMENT_HORIZONTAL,EMPTY_STRING,null); firstConsideredLifelineVertical= new Lifeline(POSITION_CONSIDERED_FIRST_ELEMENT_VERTICAL,EMPTY_STRING,null); secondConsideredLifelineVertical= new Lifeline(POSITION_CONSIDERED_SECOND_ELEMENT_VERTICAL,EMPTY_STRING,null); thirdConsideredLifelineVertical= new Lifeline(POSITION_CONSIDERED_THIRD_ELEMENT_VERTICAL,EMPTY_STRING,null); fourthConsideredLifelineVertical= new Lifeline(POSITION_CONSIDERED_FOURTH_ELEMENT_VERTICAL,EMPTY_STRING,null); fifthConsideredLifelineVertical= new Lifeline(POSITION_CONSIDERED_FIFTH_ELEMENT_VERTICAL,EMPTY_STRING,null); interactionElement=InteractionElementStub.CreateInteractionElementStub(xmiDocument); modelElement=ModelElementStub.CreateModelElementStub(xmiDocument); interaction= new Interaction(ZERO_POSITION,EMPTY_STRING,interactionElement); diagramElement =DiagramElementStub.CreateDiagramElementStub(xmiDocument); }