/// <summary>
        /// Provides the set of covered requirements by the tests
        /// </summary>
        /// <param name="aDictionary">The model</param>
        /// <returns></returns>
        public static HashSet <DataDictionary.Specification.Paragraph> CoveredRequirements(DataDictionary.Dictionary aDictionary)
        {
            HashSet <DataDictionary.Specification.Paragraph>     retVal = new HashSet <DataDictionary.Specification.Paragraph>();
            ICollection <DataDictionary.Specification.Paragraph> applicableParagraphs = aDictionary.Specifications.ApplicableParagraphs;
            Dictionary <DataDictionary.Specification.Paragraph, List <DataDictionary.ReqRef> > paragraphsReqRefDictionary = aDictionary.ParagraphsReqRefs;

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

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

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

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

                base.visit(obj, visitSubNodes);
            }
        /// <summary>
        /// Deletes the item modelised by this tree node
        /// </summary>
        public virtual void Delete()
        {
            BaseTreeNode parent = Parent as BaseTreeNode;

            if ((parent != null) && (parent.Nodes != null))
            {
                parent.Nodes.Remove(this);
                Model.Delete();

                if (model is DataDictionary.ReqRelated)
                {
                    DataDictionary.ReqRelated reqRelated = (DataDictionary.ReqRelated)model;
                    reqRelated.setVerified(false);
                }

                DataDictionary.Generated.ControllersManager.NamableController.alertChange(null, null);
            }
        }
Esempio n. 4
0
 /// <summary>
 ///     Indicates that this paragraph is a new revision
 /// </summary>
 /// <param name="par"></param>
 private void NewParagraphRevision(DataDictionary.Specification.Paragraph par)
 {
     if (par.Comment == null)
     {
         par.Comment = "";
     }
     par.Comment = par.Comment + "\nPrevious revision status was " + par.getImplementationStatus_AsString();
     par.setImplementationStatus(acceptor.SPEC_IMPLEMENTED_ENUM.Impl_NewRevisionAvailable);
     par.setReviewed(false);
     par.setBl("3.2.0");
     par.setVersion("3.2.0");
     foreach (ReqRef reqRef in par.Implementations)
     {
         ReqRelated reqRelated = reqRef.Model as ReqRelated;
         if (reqRelated != null)
         {
             reqRelated.setImplemented(false);
             reqRelated.setVerified(false);
         }
     }
 }
Esempio n. 5
0
        /// <summary>
        ///     Provides the set of covered requirements by the model
        /// </summary>
        /// <param name="aDictionary">The model</param>
        /// <param name="covered">Indicates if we need compute covered or non covered requirements</param>
        /// <returns></returns>
        public static HashSet <Paragraph> CoveredRequirements(Dictionary aDictionary, bool covered)
        {
            HashSet <Paragraph> retVal = new HashSet <Paragraph>();

            ICollection <Paragraph> applicableParagraphs = aDictionary.ApplicableParagraphs;
            Dictionary <Paragraph, List <ReqRef> > paragraphsReqRefDictionary = aDictionary.ParagraphsReqRefs;

            foreach (Paragraph paragraph in applicableParagraphs)
            {
                bool implemented = paragraph.getImplementationStatus() ==
                                   acceptor.SPEC_IMPLEMENTED_ENUM.Impl_Implemented;
                if (implemented)
                {
                    if (paragraphsReqRefDictionary.ContainsKey(paragraph))
                    {
                        List <ReqRef> implementations = paragraphsReqRefDictionary[paragraph];
                        for (int i = 0; i < implementations.Count; i++)
                        {
                            // the implementation may be also a ReqRef
                            if (implementations[i].Enclosing is ReqRelated)
                            {
                                ReqRelated reqRelated = implementations[i].Enclosing as ReqRelated;
                                // Do not consider tests
                                if (EnclosingFinder <Frame> .find(reqRelated) == null)
                                {
                                    implemented = implemented && reqRelated.ImplementationCompleted;
                                }
                            }
                        }
                    }
                }
                if (implemented == covered)
                {
                    retVal.Add(paragraph);
                }
            }
            return(retVal);
        }
        /// <summary>
        /// Performs the delta on the specification provided
        /// </summary>
        /// <param name="delta"></param>
        /// <param name="specifications"></param>
        private void PerformDelta(DataDictionary.Specification.Specification specifications)
        {
            foreach (Paragraph p in NewDocument.ChangedParagraphs)
            {
                DataDictionary.Specification.Paragraph par = specifications.FindParagraph(p.Id);

                if (par != null)
                {
                    par.Text = p.Text;
                    par.AddInfo("Paragraph has been changed");
                    par.setImplementationStatus(DataDictionary.Generated.acceptor.SPEC_IMPLEMENTED_ENUM.Impl_NewRevisionAvailable);
                    par.setReviewed(false);
                    foreach (DataDictionary.ReqRef reqRef in par.Implementations)
                    {
                        DataDictionary.ReqRelated reqRelated = reqRef.Model as DataDictionary.ReqRelated;
                        if (reqRelated != null)
                        {
                            reqRelated.setImplemented(false);
                            reqRelated.setVerified(false);
                        }
                    }
                }
                else
                {
                    AddError(specifications, p, "Cannot find paragraph " + p.Id + " for modification");
                }
            }

            foreach (Paragraph p in NewDocument.NewParagraphs)
            {
                DataDictionary.Specification.Paragraph par = specifications.FindParagraph(p.Id);

                if (par != null)
                {
                    AddError(specifications, p, "Paragraph " + p.Id + " already exists, whereas it has been detected as a new paragraph in the release");
                }
                else
                {
                    par = specifications.FindParagraph(p.Id, true);
                    if (par != null)
                    {
                        par.setText(p.Text);
                        par.AddInfo("New paragraph");
                    }
                    else
                    {
                        AddError(specifications, p, "Paragraph " + p.Id + " cannot be found in the specification");
                    }
                }
            }

            foreach (Paragraph p in NewDocument.RemovedParagraphs)
            {
                DataDictionary.Specification.Paragraph par = specifications.FindParagraph(p.Id);

                if (par != null)
                {
                    par.Text = "<Removed in current release>";
                    par.AddInfo("Paragraph has been removed");
                }
                else
                {
                    AddError(specifications, p, "Cannot find paragraph " + p.Id + " for removal");
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        ///     Creates a table for a given set of paragraphs
        /// </summary>
        /// <param name="paragraphs">The paragraphs to display</param>
        /// <param name="dictionary">The dictionary</param>
        /// <returns></returns>
        private void CreateImplementedParagraphsTable(HashSet <Paragraph> paragraphs, Dictionary dictionary)
        {
            Dictionary <Paragraph, List <ReqRef> > paragraphsReqRefDictionary = dictionary.ParagraphsReqRefs;

            foreach (Paragraph paragraph in paragraphs)
            {
                Cell previousCell = null;

                if (paragraphsReqRefDictionary.ContainsKey(paragraph))
                {
                    AddSubParagraph("Requirement " + paragraph.FullId);
                    AddTable(new string[] { "Requirement " + paragraph.FullId }, new int[] { 40, 60, 40 });
                    AddRow(paragraph.Text);

                    foreach (ReqRef reqRef in paragraph.Implementations)
                    {
                        string fullName = null;
                        string comment  = null;

                        ReqRelated reqRelated = reqRef.Enclosing as ReqRelated;
                        if (reqRelated != null)
                        {
                            if (reqRelated is TestCase) /* TODO: review it */
                            {
                                fullName = "TEST CASE " + reqRelated.Name;
                            }
                            else if (reqRelated is StateMachine) /* TODO: review it */
                            {
                                fullName = reqRelated.Name;
                            }
                            else
                            {
                                fullName = reqRelated.FullName;
                            }
                            comment = reqRelated.Comment;
                        }
                        else
                        {
                            Paragraph par = reqRef.Enclosing as Paragraph;
                            if (par != null) /* TODO: review it */
                            {
                                fullName = "PARAGRAPH " + paragraph.FullId;
                                comment  = paragraph.Comment;
                            }
                        }

                        if (fullName != null && comment != null)
                        {
                            if (previousCell == null)
                            {
                                AddRow("Associated implementation", fullName, comment);
                                previousCell = lastRow.Cells[0];
                            }
                            else
                            {
                                if (AddRow("", fullName, comment) != null)
                                {
                                    previousCell.MergeDown += 1;
                                }
                                else
                                {
                                    throw new Exception("Error: tried to add an empty row in the spec coverage report");
                                }
                            }
                        }
                    }
                    CloseSubParagraph();
                }
            }
        }