Пример #1
0
		public void Init()
		{
			message=new Message(dummyPoint,"",null);
			sourceMessageEnd=new MessageEnd(dummyPoint,"",null);
			destinationMessageEnd=new MessageEnd(dummyPoint,"",null);
			message.SourceMessageEnd=sourceMessageEnd;
			message.DestinationMessageEnd=destinationMessageEnd;
			sourceMessageEnd.CorrespondingMessage=message;
			destinationMessageEnd.CorrespondingMessage=message;
		}
        //kann eigentlich weg
        /*protected internal void InterpretMessageSourceEnd(MessageEnd relevantMessageEnd,Lifeline relevantLifeline)
        {
            ArrayList messageEnds=relevantLifeline.MessageEnds;
            IEnumerator itrMessageEnds=messageEnds.GetEnumerator();
            BehaviorExecutionSpecification currentCoveringExecution;
            Message correspondingMessage;
            MessageEndKind relevantMessageEndKind;
            bool messageEndIsWorked;
            bool executionSpecIsWorked;

            messageEndIsWorked=this.workedMessageEnds.Contains(relevantMessageEnd);
            relevantMessageEndKind=relevantMessageEnd.MessageEndKind;

            if((relevantMessageEndKind.Equals(MessageEndKind.sourceEnd))&&(!messageEndIsWorked))
            {
                currentCoveringExecution=relevantMessageEnd.GetExecutionForMessageEnd();

                if(currentCoveringExecution==null)
                {
                    correspondingMessage=relevantMessageEnd.CorrespondingMessage;
                    InterpretDestinationMessageEnd(relevantMessageEnd,correspondingMessage,currentCoveringExecution);
                    this.workedMessageEnds.Add(relevantMessageEnd);
                }
                else
                {
                    executionSpecIsWorked=this.workedExecutionSpecs.Contains(currentCoveringExecution);

                    if(!executionSpecIsWorked)
                    {
                        InterpretSourceMessageEndsOfExecution(currentCoveringExecution,relevantLifeline);
                    }
                    this.workedExecutionSpecs.Add(currentCoveringExecution);
                }
            }
        }

        //kann eigentlich weg
        protected internal void InterpretSourceMessageEndsOfExecution(BehaviorExecutionSpecification coveringExecution,
                                                                      Lifeline lifeline)
        {
            MessageEnd currentSourceMessageEnd;
            Message correspondingMessage;
            string lifelineId=lifeline.XmiId;
            string processEntryId=this.GetProcessEntryIdForLifelineId(lifelineId);
            ArrayList coveredSourceMessageEnds=coveringExecution.CoveredSourceMessageEnds();
            IEnumerator itrCoveredSourceMessageEnds=coveredSourceMessageEnds.GetEnumerator();
            this.entryCreator.CreateRegionBeginEditorEntry(processEntryId,ACTIVATION);
            coveringExecution.ProcessingStarted=true;

            while(itrCoveredSourceMessageEnds.MoveNext())
            {
                currentSourceMessageEnd=(MessageEnd)itrCoveredSourceMessageEnds.Current;

                correspondingMessage=currentSourceMessageEnd.CorrespondingMessage;

                InterpretDestinationMessageEnd(currentSourceMessageEnd,correspondingMessage,coveringExecution);
            }

            this.entryCreator.CreateRegionEndEditorEntry(processEntryId);
            this.workedExecutionSpecs.Add(coveringExecution);
        }

        // kann eigentlich weg
        protected internal void InterpretSourceMessageEndsOfExecutionWithoutRegionEntries(BehaviorExecutionSpecification coveringExecution,
                                                                                          Lifeline sourceLifeline)
        {
            MessageEnd currentSourceMessageEnd;
            MessageEnd currentDestinationMessageEnd;
            Lifeline  destinationLifeline;
            Message correspondingMessage;
            BehaviorExecutionSpecification destinationExecutionSpec=null;
            bool processingStartedDestinationExecutionSpec=false;
            int destinationLifelineIndex;
            int sourceLifelineIndex;
            string destinationProcessEntryId;
            string destinationLifelineId;
            MessageSort correspondingMessageSort;
            string sourceLifelineId=sourceLifeline.XmiId;
            string sourceProcessEntryId=this.GetProcessEntryIdForLifelineId(sourceLifelineId);
            ArrayList coveredSourceMessageEnds=coveringExecution.CoveredSourceMessageEnds();
            IEnumerator itrCoveredSourceMessageEnds=coveredSourceMessageEnds.GetEnumerator();
            coveringExecution.ProcessingStarted=true;

            while(itrCoveredSourceMessageEnds.MoveNext())
            {
                currentSourceMessageEnd=(MessageEnd)itrCoveredSourceMessageEnds.Current;
                correspondingMessage=currentSourceMessageEnd.CorrespondingMessage;
                currentDestinationMessageEnd=correspondingMessage.DestinationMessageEnd;
                destinationLifeline=currentDestinationMessageEnd.CoveredLifeline;
                //sourceLifelineIndex=toInterpretInteraction.Lifelines.IndexOf(sourceLifeline);
                //destinationLifelineIndex=toInterpretInteraction.Lifelines.IndexOf(destinationLifeline);
                destinationExecutionSpec=currentDestinationMessageEnd.GetExecutionForMessageEnd();

                if(destinationExecutionSpec!=null)
                {
                    processingStartedDestinationExecutionSpec=destinationExecutionSpec.ProcessingStarted;
                }

                if((!processingStartedDestinationExecutionSpec)&&(destinationExecutionSpec!=null))
                {
                    InterpretDestinationMessageEnd(currentSourceMessageEnd,correspondingMessage,coveringExecution);
                }
                else
                {
                    destinationLifelineId=destinationLifeline.XmiId;
                    destinationProcessEntryId=this.GetProcessEntryIdForLifelineId(destinationLifelineId);
                    correspondingMessageSort=correspondingMessage.MessageSort;
                    CreateMessageEditorEntry(correspondingMessage,sourceProcessEntryId,destinationProcessEntryId);
                    this.workedMessageEnds.Add(currentSourceMessageEnd);
                }

                this.workedExecutionSpecs.Add(coveringExecution);
            }
        }

        //kann eigentlich weg
        protected internal void InterpretDestinationMessageEnd(MessageEnd sourceMessageEnd,Message relevantMessage,BehaviorExecutionSpecification sourceExecution)
        {
            bool destinationMessageEndIsLastEndOfExecution=false;
            MessageEnd destinationMessageEnd=relevantMessage.GetOppositeMessageEnd(sourceMessageEnd);

            Lifeline destinationLifeline=destinationMessageEnd.CoveredLifeline;
            string destinationLifelineId=destinationLifeline.XmiId;
            string destinationProcessEntryId=GetProcessEntryIdForLifelineId(destinationLifelineId);
            Lifeline sourceLifeline=sourceMessageEnd.CoveredLifeline;
            string sourceLifelineId=sourceLifeline.XmiId;
            string sourceProcessEntryId=GetProcessEntryIdForLifelineId(sourceLifelineId);
            string relevantMessageName=relevantMessage.Name;
            BehaviorExecutionSpecification destinationExecution=destinationMessageEnd.GetExecutionForMessageEnd();

            if(destinationExecution==null)
            {
                CreateMessageEditorEntry(relevantMessage,sourceProcessEntryId,destinationProcessEntryId);
            }
            else
            {
                ArrayList sourceEndsDestinationExecution=destinationExecution.CoveredSourceMessageEnds();
                int positionOfDestinationMessageEnd=destinationExecution.MessageEnds.IndexOf(destinationMessageEnd);
                int positionOfLastMessageEnd=destinationExecution.MessageEnds.Count-1;
                ArrayList messageEndsDestinationExecution=destinationExecution.MessageEnds;
                MessageEnd lastMessageEndOfDestinationExecution=(MessageEnd)
                                            messageEndsDestinationExecution[messageEndsDestinationExecution.Count-1];

                if(positionOfDestinationMessageEnd==positionOfLastMessageEnd)
                {
                    destinationMessageEndIsLastEndOfExecution=true;
                }

                if((sourceEndsDestinationExecution.Count==0)||(destinationExecution.ProcessingStarted&&destinationMessageEndIsLastEndOfExecution))
                {
                    entryCreator.CreateRegionBeginEditorEntryNoWordWrap(destinationProcessEntryId,ACTIVATION);
                    CreateMessageEditorEntry(relevantMessage,sourceProcessEntryId,destinationProcessEntryId);
                    entryCreator.CreateRegionEndEditorEntry(destinationProcessEntryId);

                }
                else if(destinationExecution.ProcessingStarted&&(!destinationMessageEndIsLastEndOfExecution))
                {
                    CreateMessageEditorEntry(relevantMessage,sourceProcessEntryId,destinationProcessEntryId);
                }
                else if((sourceEndsDestinationExecution.Count>0)&&(!destinationExecution.ProcessingStarted))
                {
                    entryCreator.CreateRegionBeginEditorEntryNoWordWrap(destinationProcessEntryId,ACTIVATION);

                    CreateMessageEditorEntry(relevantMessage,sourceProcessEntryId,destinationProcessEntryId);
                    InterpretSourceMessageEndsOfExecutionWithoutRegionEntries(destinationExecution,destinationLifeline);

                    if(lastMessageEndOfDestinationExecution.MessageEndKind == MessageEndKind.sourceEnd)
                    {
                        entryCreator.CreateRegionEndEditorEntry(destinationProcessEntryId);
                    }
                }
                this.workedMessageEnds.Add(sourceMessageEnd);
                this.workedExecutionSpecs.Add(destinationExecution);
            }
        }*/
        protected internal string CreateMessageEditorEntry(Message message, string sourceProcessEntryId,string destinationProcessEntryId, bool isWordWrap)
        {
            MessageSort messageSort=message.MessageSort;
            string messageName=message.Name;
            string createdEditorEntry="";

            if(messageSort==MessageSort.synchCall)
            {
                if(isWordWrap==true)
                {
                    createdEditorEntry=entryCreator.CreateSynchronCallEditorEntry(messageName,sourceProcessEntryId,destinationProcessEntryId);
                }
                else
                {
                    createdEditorEntry=entryCreator.CreateSynchronCallEditorEntryNoWordWrap(messageName,sourceProcessEntryId,destinationProcessEntryId);
                }
            }
            else if(messageSort==MessageSort.asynchCall)
            {
                if(isWordWrap==true)
                {
                    createdEditorEntry=entryCreator.CreateAsynchronCallEditorEntry(messageName,sourceProcessEntryId,destinationProcessEntryId);
                }
                else
                {
                    createdEditorEntry=entryCreator.CreateAsynchronCallEditorEntryNoWordWrap(messageName,sourceProcessEntryId,destinationProcessEntryId);
                }
            }
            else if(messageSort==MessageSort.reply)
            {
                if(isWordWrap==true)
                {
                    createdEditorEntry=entryCreator.CreateReplyMessageEditorEntry(messageName,sourceProcessEntryId,destinationProcessEntryId);
                }
                else
                {
                    createdEditorEntry=entryCreator.CreateReplyMessageEditorEntryNoWordWrap(messageName,sourceProcessEntryId,destinationProcessEntryId);
                }
            }
            else if (messageSort==MessageSort.asynchSignal)
            {
                if(isWordWrap==true)
                {
                    createdEditorEntry=entryCreator.CreateAsynchronCallEditorEntry(SIGNAL_STEREO_TYPE+SPACE_STRING+messageName,sourceProcessEntryId,destinationProcessEntryId);
                }
                else
                {
                    createdEditorEntry=entryCreator.CreateAsynchronCallEditorEntryNoWordWrap(SIGNAL_STEREO_TYPE+SPACE_STRING+messageName,sourceProcessEntryId,destinationProcessEntryId);
                }
            }
            else if(messageSort==MessageSort.createMessage)
            {
                MessageEnd destinationEnd=message.DestinationMessageEnd;
                Lifeline tiedLifeline=destinationEnd.CoveredLifeline;
                string processName=tiedLifeline.Name;
                createdEditorEntry=
                            entryCreator.CreateCreateMessageEditorEntry(sourceProcessEntryId,destinationProcessEntryId,messageName,processName);
            }
            return createdEditorEntry;
        }
        protected internal void CreateMessages(Interaction interaction,XmlElement diagramElement)
        {
            XmlElement currentMessageElement;
            Message currentMessage;
            Point currentMessagePosition;
            string currentMessageName;
            string currentMessageId;
            string currentMessageSort;
            ArrayList messages=new ArrayList();
            XmlElement interactionElement=interaction.XmlRepresentation;
            XmlNodeList messageElements=modelDocumentInterpreter.GetMessageElements(interactionElement);
            IEnumerator itrMessageElements=messageElements.GetEnumerator();

            while(itrMessageElements.MoveNext())
            {
                currentMessageElement=(XmlElement)itrMessageElements.Current;
                currentMessagePosition=diDocumentInterpreter.GetMessageGraphNodePosition(diagramElement,currentMessageElement);
                currentMessageId=currentMessageElement.GetAttribute(UmlModel.XMI_ID_ATTR_COMPLETE_NAME);
                currentMessageName=currentMessageElement.GetAttribute(UmlModel.NAME_ATTR_NAME);
                currentMessageSort=currentMessageElement.GetAttribute(UmlModel.MESSAGE_SORT_ATTR_NAME);
                currentMessage=new Message(currentMessagePosition,currentMessageId,currentMessageElement);
                currentMessage.Name=currentMessageName;
                AddMessageSort(currentMessage, currentMessageSort);
                messages.Add(currentMessage);
            }

            messages=SortListForVerticalPosition(messages);
            interaction.Messages=messages;
        }
 protected internal void AddMessageSort(Message message, string messageSort)
 {
     if(messageSort==null)
     {
         message.MessageSort= MessageSort.synchCall;
     }
     else if(messageSort.Equals(UmlModel.MESSAGE_SORT_ASYNCH_CALL))
     {
         message.MessageSort= MessageSort.asynchCall;
     }
     else if (messageSort.Equals(UmlModel.MESSAGE_SORT_ASYNCH_SIGNAL))
     {
         message.MessageSort= MessageSort.asynchSignal;
     }
     else if(messageSort.Equals(UmlModel.REPLY))
     {
         message.MessageSort= MessageSort.reply;
     }
     else if(messageSort.Equals(UmlModel.MESSAGE_SORT_CREATE_MESSAGE))
     {
         message.MessageSort=MessageSort.createMessage;
     }
 }
        protected internal void ConnectMessageEndToMessage(MessageEnd messageEnd,Message message)
        {
            XmlElement messageElement=message.XmlRepresentation;
            XmlElement messageEndElement=messageEnd.XmlRepresentation;
            string messageReceiveEventId=messageElement.GetAttribute(UmlModel.RECEIVE_EVENT_ATTR_NAME);
            string messageSendEventId=messageElement.GetAttribute(UmlModel.SEND_EVENT_ATTR_NAME);
            string messageEndElementId=messageEndElement.GetAttribute(UmlModel.XMI_ID_ATTR_COMPLETE_NAME);

            messageEnd.CorrespondingMessage=message;

            if(messageEndElementId.Equals(messageReceiveEventId))
            {
               message.DestinationMessageEnd=messageEnd;
               messageEnd.MessageEndKind= MessageEndKind.destinationEnd;
            }
            else if(messageEndElementId.Equals(messageSendEventId))
            {
                message.SourceMessageEnd=messageEnd;
                messageEnd.MessageEndKind= MessageEndKind.sourceEnd;
            }
        }
        public void ConnectMessageEndToMessageTest()
        {
            XmlElement messageElement =MessageElementStub.CreateMessageElementStub(xmiDocument,FIRST_MESSAGE_ELEMENT_ID);
            messageElement.SetAttribute(UmlModelElements.SEND_EVENT_ATTR_NAME,FIRST_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID);
            messageElement.SetAttribute(UmlModelElements.RECEIVE_EVENT_ATTR_NAME,FOURTH_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID);
            Message message =new Message(ZERO_POSITION,FIRST_MESSAGE_ELEMENT_ID,messageElement);

            XmlElement sourceMessageEndElement=
                MessageOccurrenceSpecElementStub.CreateMessageOccurrenceSpecElementStub(xmiDocument,FIRST_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID);
            sourceMessageEndElement.SetAttribute(UmlModelElements.MESSAGE,FIRST_MESSAGE_ELEMENT_ID);
            MessageEnd sourceMessageEnd=new MessageEnd(ZERO_POSITION,FIRST_MESSAGE_ELEMENT_ID,sourceMessageEndElement);

            XmlElement destinationMessageEndElement=
                    MessageOccurrenceSpecElementStub.CreateMessageOccurrenceSpecElementStub(xmiDocument,FOURTH_MESSAGE_OCCURRENCE_SPEC_ELEMENT_ID);
            destinationMessageEndElement.SetAttribute(UmlModelElements.MESSAGE,FIRST_MESSAGE_ELEMENT_ID);
            MessageEnd destinationMessageEnd=new MessageEnd(ZERO_POSITION,FOURTH_MESSAGE_ELEMENT_ID,destinationMessageEndElement);

            sequenceChartModelCreator.ConnectMessageEndToMessage(sourceMessageEnd,message);
            MessageEnd actualSoureMessageEnd=message.SourceMessageEnd;
            Assert.IsNotNull(actualSoureMessageEnd);
            Assert.AreEqual(sourceMessageEnd,actualSoureMessageEnd);
            MessageEnd actualDestinationMessageEnd=message.DestinationMessageEnd;
            Assert.IsNull(actualDestinationMessageEnd);

            message.SourceMessageEnd=null;
            sequenceChartModelCreator.ConnectMessageEndToMessage(destinationMessageEnd,message);
            actualDestinationMessageEnd=message.DestinationMessageEnd;
            Assert.IsNotNull(actualDestinationMessageEnd);
            Assert.AreEqual(destinationMessageEnd,actualDestinationMessageEnd);
            MessageEnd actualSourceElement=message.SourceMessageEnd;
            Assert.IsNull(actualSourceElement);
        }
        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);
        }
        public void GetMessageForMessageElementThreeElementsTest()
        {
            XmlElement firstMessageElement=MessageElementStub.CreateMessageElementStub(xmiDocument);
            XmlElement secondMessageElement=MessageElementStub.CreateMessageElementStub(xmiDocument);
            XmlElement thirdMessageElement=MessageElementStub.CreateMessageElementStub(xmiDocument);
            Message firstMessage=new Message(ZERO_POSITION,"",firstMessageElement);
            Message secondMessage=new Message(ZERO_POSITION,"",secondMessageElement);
            Message thirdMessage=new Message(ZERO_POSITION,"",thirdMessageElement);
            Interaction interaction=new Interaction(ZERO_POSITION,"",null);
            interaction.Messages.Add(firstMessage);
            interaction.Messages.Add(secondMessage);
            interaction.Messages.Add(thirdMessage);

            Message actualFirstMessage=sequenceChartModelCreator.GetMessageForMessageElement(firstMessageElement,interaction);
            Assert.IsNotNull(actualFirstMessage);
            Assert.AreEqual(firstMessage,actualFirstMessage);

            Message actualSecondMessage=sequenceChartModelCreator.GetMessageForMessageElement(secondMessageElement,interaction);
            Assert.IsNotNull(actualFirstMessage);
            Assert.AreEqual(secondMessage,actualSecondMessage);

            Message actualThirdMessage=sequenceChartModelCreator.GetMessageForMessageElement(thirdMessageElement,interaction);
            Assert.IsNotNull(actualThirdMessage);
            Assert.AreEqual(thirdMessage,actualThirdMessage);
        }
        public void Init()
        {
            firstCoveredMessageEndSource=new MessageEnd(firstCoveredMessageEndSourcePosition,"",null);
            firstCoveredMessageEndSource.MessageEndKind=MessageEndKind.sourceEnd;
            secondCoveredMessageEndSource=new MessageEnd(secondCoveredMessageEndSourcePosition,"",null);
            secondCoveredMessageEndSource.MessageEndKind=MessageEndKind.sourceEnd;
            thirdCoveredMessageEndSource=new MessageEnd(thirdCoveredMessageEndSourcePosition,"",null);
            thirdCoveredMessageEndSource.MessageEndKind=MessageEndKind.sourceEnd;
            fourthCoveredMessageEndSource=new MessageEnd(fourthCoveredMessageEndSourcePosition,"",null);
            fourthCoveredMessageEndSource.MessageEndKind=MessageEndKind.sourceEnd;
            fifthCoveredMessageEndDestination=new MessageEnd(fifthCoveredMessageEndDestinationPosition,"",null);
            fifthCoveredMessageEndDestination.MessageEndKind=MessageEndKind.destinationEnd;
            uncoveredMessageEndDestination=new MessageEnd(uncoveredMessageEndDestinationPosition,"",null);
            uncoveredMessageEndDestination.MessageEndKind=MessageEndKind.destinationEnd;
            executionSpecificationCoveringOneEnd=new ExecutionSpecification (executionSpecificationCoveringOneEndPosition,"",null);
            executionSpecificationCoveringOneEnd.Dimension=executionSpecificationCoveringOneEndSize;
            executionSpecificationCoveringOneEnd.MessageSourceEnds.Add(firstCoveredMessageEndSource);
            executionSpecificationCoveringFourEnds=new ExecutionSpecification (executionSpecificationCoveringFourEndsPosition,"",null);
            executionSpecificationCoveringFourEnds.Dimension=executionSpecificationCoveringFourEndsSize;
            executionSpecificationCoveringFourEnds.MessageSourceEnds.Add(secondCoveredMessageEndSource);
            executionSpecificationCoveringFourEnds.MessageSourceEnds.Add(thirdCoveredMessageEndSource);
            executionSpecificationCoveringFourEnds.MessageSourceEnds.Add(fourthCoveredMessageEndSource);
            executionSpecificationCoveringFourEnds.MessageSourceEnds.Add(fifthCoveredMessageEndDestination);
            executionSpecificationCoveringNoEnd=new ExecutionSpecification (executionSpecificationCoveringNoEndPosition,"",null);
            executionSpecificationCoveringNoEnd.Dimension=executionSpecificationCoveringNoEndSize;

            oppositeExecutionSpecificationReply=new ExecutionSpecification(dummyPosition,"",null);
            replyMessage=new Message(dummyPosition,"",null);
            replyMessageSourceEnd=new MessageEnd(dummyPosition,"",null);
            replyMessageSourceEnd.CorrespondingMessage=replyMessage;
            replyMessageDestinationEnd=new MessageEnd(replyMessageDestinationEndPosition,"",null);
            replyMessageDestinationEnd.CorrespondingMessage=replyMessage;
            replyMessage.SourceMessageEnd=replyMessageSourceEnd;
            replyMessage.DestinationMessageEnd=replyMessageDestinationEnd;
        }