Esempio n. 1
0
        /// <summary>
        ///     Copy traceability information from the element provided in parameter (source) to the current one (target)
        ///     Do the union between traceability information
        /// </summary>
        /// <param name="source"></param>
        protected void KeepTraceability(ModelElement source)
        {
            ReqRelated reqSource = source as ReqRelated;

            if (reqSource != null)
            {
                foreach (ReqRef sourceReqRef in reqSource.Requirements)
                {
                    bool isPresent = false;
                    foreach (ReqRef reqRef in Requirements)
                    {
                        if (sourceReqRef.Paragraph.SourceOfUpdateChain == reqRef.Paragraph.SourceOfUpdateChain)
                        {
                            isPresent = true;
                            break;
                        }
                    }

                    if (!isPresent)
                    {
                        Requirements.Add(sourceReqRef.Duplicate());
                    }
                }
            }
        }
        public override void visit(Generated.ReqRelated obj, bool visitSubNodes)
        {
            ReqRelated init       = obj as ReqRelated;
            ReqRelated reqRelated = obj as ReqRelated;

            if (init != null && init.NeedsRequirement) // the object must be associated to a requirement
            {
                bool noReq = true;                     // no requirement found for this object
                while (noReq && reqRelated != null)
                {
                    for (int i = 0; i < reqRelated.Requirements.Count; i++)
                    {
                        ReqRef reqRef = reqRelated.Requirements[i] as ReqRef;
                        if (reqRef.Paragraph == null)
                        {
                            reqRef.AddError("Cannot find paragraph corresponding to " + reqRef.getId());
                        }
                        else if (reqRef.Paragraph.getType() == Generated.acceptor.Paragraph_type.aREQUIREMENT)
                        {
                            noReq = false;  // found a requirement
                        }
                    }
                    if (noReq)  // if no requirement found, we explore the requirements of the enclosing element
                    {
                        reqRelated = Utils.EnclosingFinder <DataDictionary.ReqRelated> .find(reqRelated);
                    }
                }
                if (noReq)
                {
                    init.AddInfo("No requirement found for element");
                }
            }

            base.visit(obj, visitSubNodes);
        }
Esempio n. 3
0
        /// <summary>
        ///     Provides the set of covered requirements by the tests
        /// </summary>
        /// <returns></returns>
        public HashSet <Specification.Paragraph> CoveredRequirements()
        {
            HashSet <Specification.Paragraph>     retVal = new HashSet <Specification.Paragraph>();
            ICollection <Specification.Paragraph> applicableParagraphs = ApplicableParagraphs;
            Dictionary <Specification.Paragraph, List <ReqRef> > paragraphsReqRefDictionary = ParagraphsReqRefs;

            foreach (Specification.Paragraph paragraph in applicableParagraphs)
            {
                bool implemented = paragraph.getImplementationStatus() ==
                                   acceptor.SPEC_IMPLEMENTED_ENUM.Impl_Implemented;
                bool tested = false;
                if (implemented)
                {
                    if (paragraphsReqRefDictionary.ContainsKey(paragraph))
                    {
                        List <ReqRef> implementations = paragraphsReqRefDictionary[paragraph];
                        foreach (ReqRef reqRef in implementations)
                        {
                            ReqRelated reqRelated = reqRef.Enclosing as ReqRelated;
                            if (reqRelated is TestCase && reqRelated.ImplementationCompleted)
                            {
                                tested = true;
                            }
                        }
                    }
                }

                if (implemented && tested)
                {
                    retVal.Add(paragraph);
                }
            }

            return(retVal);
        }
Esempio n. 4
0
            public override void visit(Generated.ReqRelated obj, bool visitSubNodes)
            {
                ReqRelated reqRelated = (ReqRelated)obj;

                if (!reqRelated.getImplemented())
                {
                    reqRelated.AddInfo("Implementation not complete");
                }

                base.visit(obj, visitSubNodes);
            }
        public override void visit(Generated.Paragraph obj, bool visitSubNodes)
        {
            Specification.Paragraph paragraph = obj as Specification.Paragraph;

            if (paragraph != null)
            {
                switch (paragraph.getImplementationStatus())
                {
                case DataDictionary.Generated.acceptor.SPEC_IMPLEMENTED_ENUM.Impl_Implemented:
                    if (!paragraph.isApplicable())
                    {
                        paragraph.AddWarning("Paragraph state does not correspond to implementation status (Implemented but not applicable)");
                    }
                    break;

                case DataDictionary.Generated.acceptor.SPEC_IMPLEMENTED_ENUM.Impl_NA:
                case DataDictionary.Generated.acceptor.SPEC_IMPLEMENTED_ENUM.defaultSPEC_IMPLEMENTED_ENUM:
                    if (!paragraph.isApplicable())
                    {
                        paragraph.AddWarning("Paragraph state does not correspond to implementation status (N/A but not applicable)");
                    }
                    break;

                case DataDictionary.Generated.acceptor.SPEC_IMPLEMENTED_ENUM.Impl_NotImplementable:
                    if (paragraph.isApplicable())
                    {
                        paragraph.AddWarning("Paragraph state does not correspond to implementation status (Not implementable but applicable)");
                    }
                    break;
                }

                if (paragraph.getImplementationStatus() == Generated.acceptor.SPEC_IMPLEMENTED_ENUM.Impl_Implemented)
                {
                    foreach (ReqRef reqRef in ImplementedParagraphsFinder.INSTANCE.findRefs(paragraph))
                    {
                        ReqRelated model = reqRef.Enclosing as ReqRelated;
                        if (!model.ImplementationCompleted)
                        {
                            model.AddError("Requirement implementation is complete, while model element implementation is not");
                            paragraph.AddError("Requirement implementation is complete, while model element implementation is not");
                        }
                    }
                }

                if (paragraph.getScope() != paragraph.SubParagraphsScope && paragraph.getScope() != Generated.acceptor.Paragraph_scope.aOBU_AND_TRACK)
                {
                    paragraph.AddWarning("Paragraph scope does not correspond to the scope of its sub-paragraphs");
                }
            }

            base.visit(obj, visitSubNodes);
        }
Esempio n. 6
0
        /// <summary>
        ///     Provides the description of the requirements related to this model element
        /// </summary>
        /// <returns></returns>
        public virtual string RequirementDescription()
        {
            string retVal = "";

            ReqRelated reqRelated = EnclosingFinder <ReqRelated> .find(this, true);

            if (reqRelated != null)
            {
                retVal = reqRelated.RequirementDescription();
            }

            return(retVal);
        }
Esempio n. 7
0
        /// <summary>
        ///     Creates an update for the reqref. Used to delete references in an update.
        /// </summary>
        /// <param name="modelUpdate"></param>
        /// <returns></returns>
        public ReqRef CreateReqRefUpdate(ModelElement modelUpdate)
        {
            ReqRef retVal = (ReqRef)Duplicate();

            retVal.setUpdates(Guid);
            ReqRelated reqRelatedUpdate = modelUpdate as ReqRelated;

            if (reqRelatedUpdate != null)
            {
                reqRelatedUpdate.appendRequirements(retVal);
            }


            return(retVal);
        }
Esempio n. 8
0
        /// <summary>
        ///     Creates a containing the implementation/verification status and the
        ///     requirements of a ReqRelated element
        /// </summary>
        /// <param name="aReqRelated">The ReqRelated element</param>
        /// <returns></returns>
        private void CreateStatusTable(ReqRelated aReqRelated)
        {
            AddTable(new string[] { "Modeling information" }, new int[] { 40, 30, 70 });

            string implemented = "not implemented";
            string verified    = "not verified";

            if (aReqRelated.getImplemented())
            {
                implemented = "implemented";
            }
            if (aReqRelated.getVerified())
            {
                verified = "verified";
            }

            AddRow("Status", implemented, verified);
            AddRow("Requirements", GetRequirementsAsString(aReqRelated.Requirements));
        }
Esempio n. 9
0
 /// <summary>
 ///     Indicates if a req related should be considered for the report
 /// </summary>
 /// <param name="aReqRelated"></param>
 /// <returns></returns>
 private bool considerReqRelated(ReqRelated aReqRelated)
 {
     return(aReqRelated.ImplementationCompleted || !implementedOnly);
 }
Esempio n. 10
0
        /// <summary>
        ///     Creates a containing the implementation/verification status and the
        ///     requirements of a ReqRelated element
        /// </summary>
        /// <param name="aReqRelated">The ReqRelated element</param>
        /// <returns></returns>
        private void CreateStatusTable(ReqRelated aReqRelated)
        {
            AddTable(new string[] {"Modeling information"}, new int[] {40, 30, 70});

            string implemented = "not implemented";
            string verified = "not verified";
            if (aReqRelated.getImplemented())
            {
                implemented = "implemented";
            }
            if (aReqRelated.getVerified())
            {
                verified = "verified";
            }

            AddRow("Status", implemented, verified);
            AddRow("Requirements", GetRequirementsAsString(aReqRelated.Requirements));
        }
Esempio n. 11
0
 /// <summary>
 ///     Indicates if a req related should be considered for the report
 /// </summary>
 /// <param name="aReqRelated"></param>
 /// <returns></returns>
 private bool considerReqRelated(ReqRelated aReqRelated)
 {
     return aReqRelated.ImplementationCompleted || !implementedOnly;
 }