Inheritance: DataDictionary.ReferencesParagraph
 public virtual void visit(Step obj, bool visitSubNodes)
 {
     visit ((ReferencesParagraph) obj, false);
     if (visitSubNodes){
     IXmlBBase[] Subs  = acceptor.subElements((IXmlBBase)obj);
     if (Subs != null){
     for (int i=0; i<Subs.Length; i++) {
       dispatch(Subs[i], true);
     } // If
     } // If
     }
 }
Exemplo n.º 2
0
        public override void visit(Step obj, bool visitSubNodes)
        {
            obj.setTCS_Order(0);
            obj.setDistance(0);
            obj.setIO(acceptor.ST_IO.StIO_NA);
            obj.setLevelIN(acceptor.ST_LEVEL.StLevel_NA);
            obj.setLevelOUT(acceptor.ST_LEVEL.StLevel_NA);
            obj.setModeIN(acceptor.ST_MODE.Mode_NA);
            obj.setModeOUT(acceptor.ST_MODE.Mode_NA);
            obj.setTranslationRequired(false);
            obj.setTranslated(false);

            base.visit(obj, visitSubNodes);
        }
 public void insertSteps(int idx, Step el,Lock aLock)
 {
     __setDirty(true);
       allSteps().Insert (idx, el);
     NotifyControllers(aLock);
 }
 public virtual void visit(Step obj)
 {
     visit(obj, true);
 }
 public void copyTo(Step other)
 {
     base.copyTo(other);
     other.aTCS_Order = aTCS_Order;
     other.aDistance = aDistance;
     other.aDescription = aDescription;
     other.aObsoleteComment = aObsoleteComment;
     other.aUserComment = aUserComment;
     other.aIO = aIO;
     other.aInterface = aInterface;
     other.aLevelIN = aLevelIN;
     other.aLevelOUT = aLevelOUT;
     other.aModeIN = aModeIN;
     other.aModeOUT = aModeOUT;
     other.aTranslationRequired = aTranslationRequired;
     other.aTranslated = aTranslated;
     other.aSubSteps = aSubSteps;
     other.aMessages = aMessages;
 }
 public void appendSteps(Lock aLock,Step el)
 {
     __setDirty(true);
       el.__setDirty(true);
       allSteps().Add(el);
       acceptor.connectSon (this, el);
     NotifyControllers(aLock);
 }
        /// <summary>
        ///     Updates the step according to this translation
        /// </summary>
        /// <param name="step"></param>
        public void UpdateStep(Step step)
        {
            Step previousStep = step.PreviousStep;

            foreach (ReqRef reqRef in Requirements)
            {
                if (!IsRequirementPresent(step, reqRef))
                {
                    step.appendRequirements((ReqRef) reqRef.Duplicate());
                }
            }

            int subStepCounter = 1;
            foreach (SubStep subStep in SubSteps)
            {
                bool addSubStep = true;

                if (subStep.ReferencesMessages())
                {
                    addSubStep = step.Messages.Count > 0;
                }

                if (addSubStep)
                {
                    SubStep newSubStep = (SubStep) acceptor.getFactory().createSubStep();
                    newSubStep.setSkipEngine(subStep.getSkipEngine());
                    newSubStep.Comment = subStep.Comment;
                    newSubStep.Name = subStep.Name;
                    step.appendSubSteps(newSubStep);

                    if (previousStep != null && previousStep.Distance != step.Distance && subStepCounter == 1)
                    {
                        Action newAct = (Action) acceptor.getFactory().createAction();
                        string distance = step.getDistance();
                        if (!distance.Contains("."))
                        {
                            distance = distance + ".0";
                        }
                        newAct.ExpressionText = "OdometryInterface.UpdateDistance ( " + distance + " )";
                        newSubStep.setSkipEngine(false);
                        newSubStep.appendActions(newAct);
                    }

                    foreach (Action action in subStep.Actions)
                    {
                        Action newAct = (Action) action.Duplicate();
                        newSubStep.appendActions(newAct);
                        Review(newAct);
                    }

                    foreach (Expectation expectation in subStep.Expectations)
                    {
                        Expectation newExp = (Expectation) expectation.Duplicate();
                        newSubStep.appendExpectations(newExp);
                        Review(newExp);
                    }
                }
                subStepCounter++;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        ///     Runs the test case until the step provided is encountered
        ///     This does not execute the corresponding step.
        /// </summary>
        /// <param name="target"></param>
        public void RunUntilStep(Step target)
        {
            Util.DontNotify(() =>
            {
                _currentStepIndex = NoMoreStep;
                _currentTestCaseIndex = NoMoreStep;

                if (target != null)
                {
                    RunForBlockingExpectations(false);
                }
                else
                {
                    RunForExpectations(false);
                }

                // Run all following steps until the target step is encountered
                foreach (TestCase testCase in SubSequence.TestCases)
                {
                    foreach (Step step in testCase.Steps)
                    {
                        if (step == target)
                        {
                            _currentStepIndex = RebuildCurrentSubStep;
                            _currentTestCaseIndex = RebuildCurrentSubStep;
                            break;
                        }

                        if (!EventTimeLine.ContainsStep(step))
                        {
                            foreach (SubStep subStep in step.SubSteps)
                            {
                                SetupSubStep(subStep);
                                if (!subStep.getSkipEngine())
                                {
                                    if (target != null)
                                    {
                                        RunForBlockingExpectations(true);
                                    }
                                    else
                                    {
                                        RunForExpectations(true);
                                    }
                                }
                                else
                                {
                                    foreach (acceptor.RulePriority priority in PrioritiesOrder)
                                    {
                                        CheckExpectationsState(priority);
                                    }
                                }
                            }

                            while (EventTimeLine.ActiveBlockingExpectations().Count > 0)
                            {
                                Cycle();
                            }
                        }
                    }

                    if (_currentTestCaseIndex == RebuildCurrentSubStep)
                    {
                        break;
                    }
                }
            });
        }
        /// <summary>
        ///     Updates an expression according to translation rules
        /// </summary>
        /// <param name="step">the step in which the expression occurs</param>
        /// <param name="expression"></param>
        /// <returns>the updated string</returns>
        private string ReviewExpression(Step step, string expression)
        {
            string retVal = expression;

            if (expression.IndexOf('%') >= 0)
            {
                SubSequence subSequence = step.TestCase.SubSequence;

                retVal = retVal.Replace("%D_LRBG", format_decimal_as_str(subSequence.getD_LRBG()));
                retVal = retVal.Replace("%Level", format_level(subSequence.getLevel()));
                retVal = retVal.Replace("%Mode", format_mode(subSequence.getMode()));
                retVal = retVal.Replace("%NID_LRBG", format_decimal_as_str(subSequence.getNID_LRBG()));
                retVal = retVal.Replace("%Q_DIRLRBG", format_decimal_as_str(subSequence.getQ_DIRLRBG()));
                retVal = retVal.Replace("%Q_DIRTRAIN", format_decimal_as_str(subSequence.getQ_DIRTRAIN()));
                retVal = retVal.Replace("%Q_DLRBG", format_decimal_as_str(subSequence.getQ_DLRBG()));
                retVal = retVal.Replace("%RBC_ID", format_decimal_as_str(subSequence.getRBC_ID()));
                retVal = retVal.Replace("%RBCPhone", format_str(subSequence.getRBCPhone()));

                retVal = retVal.Replace("%Step_Distance", step.getDistance() + "");
                retVal = retVal.Replace("%Step_LevelIN", format_level(step.getLevelIN()));
                retVal = retVal.Replace("%Step_LevelOUT", format_level(step.getLevelOUT()));
                retVal = retVal.Replace("%Step_ModeIN", format_mode(step.getModeOUT()));
                retVal = retVal.Replace("%Step_ModeOUT", format_mode(step.getModeOUT()));

                int max_step_messages = 8;
                for (int i = 0; i < max_step_messages; i++)
                {
                    if (retVal.IndexOf("%Step_Messages_" + i) >= 0)
                    {
                        if (step.StepMessages.Count > i)
                        {
                            DBMessage message = step.StepMessages[i] as DBMessage;
                            if (message != null)
                            {
                                retVal = retVal.Replace("%Step_Messages_" + i, format_message(message));
                            }
                        }
                    }
                }

                if (retVal.IndexOf("%") > 0)
                {
                    step.AddError("Cannot completely translate this step");
                }
            }

            return retVal;
        }
Exemplo n.º 10
0
        /// <summary>
        ///     Indicates that the requirement is already present in the step
        /// </summary>
        /// <param name="step"></param>
        /// <param name="reqRef"></param>
        /// <returns></returns>
        private bool IsRequirementPresent(Step step, ReqRef reqRef)
        {
            bool retVal = false;

            foreach (ReqRef stepReqRef in step.Requirements)
            {
                if (reqRef.Paragraph == stepReqRef.Paragraph)
                {
                    retVal = true;
                    break;
                }
            }

            return retVal;
        }
Exemplo n.º 11
0
            /// <summary>
            ///     Removes the actions and expectation from translated steps because they may cause conflicts.
            ///     Remove obsolete comments
            /// </summary>
            /// <param name="obj"></param>
            /// <param name="visitSubNodes"></param>
            public override void visit(Step obj, bool visitSubNodes)
            {
                Tests.Step step = (Tests.Step) obj;

                if (step.getObsoleteComment() == "")
                {
                    step.setObsoleteComment(null);
                }

                base.visit(obj, visitSubNodes);
            }
Exemplo n.º 12
0
 public override void visit(Step obj, bool visitSubNodes)
 {
     Tests.Step step = (Tests.Step) obj;
     if (step.getTranslationRequired() && !step.getTranslated())
     {
         step.AddInfo("Not translated step");
     }
     base.visit(obj, visitSubNodes);
 }
Exemplo n.º 13
0
        /// <summary>
        ///     Ensure that all step that should be automatically translated have a translation
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="visitSubNodes"></param>
        public override void visit(Step obj, bool visitSubNodes)
        {
            Tests.Step step = (Tests.Step) obj;

            if (step.getTranslationRequired())
            {
                Translation translation = null;
                TranslationDictionary translationDictionary = step.Dictionary.TranslationDictionary;
                if (translationDictionary != null)
                {
                    translation = translationDictionary.findTranslation(step.getDescription(), step.Comment);
                }

                if (step.getDescription() != null)
                {
                    // Specific checks for subset-076
                    if ((step.getDescription().IndexOf("balise group", StringComparison.InvariantCultureIgnoreCase) !=
                         -1) && step.getDescription().Contains("is received"))
                    {
                        if (step.StepMessages.Count == 0)
                        {
                            step.AddWarning("Cannot find Balise messages for this step");
                        }
                    }

                    if (
                        (step.getDescription().IndexOf("euroloop message", StringComparison.InvariantCultureIgnoreCase) !=
                         -1) && step.getDescription().Contains("is received"))
                    {
                        if (step.StepMessages.Count == 0)
                        {
                            step.AddWarning("Cannot find Euroloop messages for this step");
                        }
                    }

                    if (step.getDescription().Contains("SA-DATA") && step.getDescription().Contains("is received"))
                    {
                        if (step.StepMessages.Count == 0)
                        {
                            step.AddWarning("Cannot find RBC message for this step");
                        }
                    }
                }
            }

            base.visit(obj, visitSubNodes);
        }