Esempio n. 1
0
        /// <summary>
        /// Accepts drop of a tree node, in a drag & drop operation
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is StructureElementTreeNode)
            {
                StructureElementTreeNode structureElementTreeNode = SourceNode as StructureElementTreeNode;
                DataDictionary.Types.StructureElement element     = structureElementTreeNode.Item;

                structureElementTreeNode.Delete();
                AddElement(element);
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Types.StructureElement element = (DataDictionary.Types.StructureElement)DataDictionary.Generated.acceptor.getFactory().createStructureElement();
                element.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                element.appendRequirements(reqRef);
                AddElement(element);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Create structure based on the subsystem structure
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is RuleConditionTreeNode)
            {
                RuleConditionTreeNode node = SourceNode as RuleConditionTreeNode;
                DataDictionary.Rules.RuleCondition ruleCondition = node.Item;
                node.Delete();
                AddRuleCondition(ruleCondition);
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Rules.RuleCondition ruleCondition = (DataDictionary.Rules.RuleCondition)DataDictionary.Generated.acceptor.getFactory().createRuleCondition();
                ruleCondition.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                ruleCondition.appendRequirements(reqRef);
                AddRuleCondition(ruleCondition);
            }
        }
        /// <summary>
        /// Accepts a new procedure
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is ProcedureTreeNode)
            {
                ProcedureTreeNode procedureTreeNode          = SourceNode as ProcedureTreeNode;
                DataDictionary.Functions.Procedure procedure = procedureTreeNode.Item;

                procedureTreeNode.Delete();
                AddProcedure(procedure);
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Functions.Procedure procedure = (DataDictionary.Functions.Procedure)DataDictionary.Generated.acceptor.getFactory().createProcedure();
                procedure.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                procedure.appendRequirements(reqRef);
                AddProcedure(procedure);
            }
        }
Esempio n. 4
0
 public void AddParagraphHandler(object sender, EventArgs args)
 {
     DataDictionary.Specification.Paragraph paragraph = (DataDictionary.Specification.Paragraph)DataDictionary.Generated.acceptor.getFactory().createParagraph();
     paragraph.FullId = Item.getId() + "." + (Item.countParagraphs() + 1);
     paragraph.Text   = "";
     AddParagraph(paragraph);
 }
Esempio n. 5
0
        /// <summary>
        /// Accepts drop of a tree node, in a drag & drop operation
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is RangeTreeNode)
            {
                RangeTreeNode rangeTreeNode      = SourceNode as RangeTreeNode;
                DataDictionary.Types.Range range = rangeTreeNode.Item;

                rangeTreeNode.Delete();
                AddRange(range);
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Types.Range range = (DataDictionary.Types.Range)DataDictionary.Generated.acceptor.getFactory().createRange();
                range.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                range.appendRequirements(reqRef);
                AddRange(range);
            }
        }
        /// <summary>
        /// Accepts drop of a tree node, in a drag & drop operation
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is EnumerationTreeNode)
            {
                EnumerationTreeNode       enumerationTreeNode = SourceNode as EnumerationTreeNode;
                DataDictionary.Types.Enum enumeration         = enumerationTreeNode.Item;

                enumerationTreeNode.Delete();
                AddEnum(enumeration);
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Types.Enum enumeration = (DataDictionary.Types.Enum)DataDictionary.Generated.acceptor.getFactory().createEnum();
                enumeration.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                enumeration.appendRequirements(reqRef);
                AddEnum(enumeration);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Accepts drop of a tree node, in a drag & drop operation
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is VariableTreeNode)
            {
                VariableTreeNode variableTreeNode          = SourceNode as VariableTreeNode;
                DataDictionary.Variables.Variable variable = variableTreeNode.Item;

                variableTreeNode.Delete();
                AddVariable(variable);
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Variables.Variable variable = (DataDictionary.Variables.Variable)DataDictionary.Generated.acceptor.getFactory().createVariable();
                variable.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                variable.appendRequirements(reqRef);
                AddVariable(variable);
            }
        }
            public override void visit(Generated.Paragraph obj, bool visitSubNodes)
            {
                DataDictionary.Specification.Paragraph paragraph = (DataDictionary.Specification.Paragraph)obj;

                if (paragraph.getSpecIssue())
                {
                    paragraph.AddInfo("This paragraph has an issue");
                }

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

                if (paragraph.getMoreInfoRequired())
                {
                    paragraph.AddInfo("More info is required");
                }

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

                if (!paragraph.isApplicable())
                {
                    paragraph.AddInfo("Non applicable paragraph");
                }

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

                if (paragraph.getImplementationStatus() == Generated.acceptor.SPEC_IMPLEMENTED_ENUM.Impl_NewRevisionAvailable)
                {
                    paragraph.AddInfo("New revision");
                }

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

                if (!paragraph.getReviewed())
                {
                    paragraph.AddInfo("Not reviewed");
                }

                base.visit(obj, visitSubNodes);
            }
Esempio n. 13
0
        /// <summary>
        /// Generates the code for a single specification paragraph
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="visitSubNodes"></param>
        public override void visit(DataDictionary.Generated.Paragraph obj, bool visitSubNodes)
        {
            DataDictionary.Specification.Paragraph paragraph = (DataDictionary.Specification.Paragraph)obj;

            Writer = new System.IO.StreamWriter(BasePath + System.IO.Path.DirectorySeparatorChar + ValidName(paragraph.getId()) + ".html");
            Writer.WriteLine("Paragraph " + paragraph.Name);
            Writer.WriteLine("Scope = " + paragraph.getScope());
            Writer.Close();

            base.visit(obj, visitSubNodes);
        }
Esempio n. 14
0
        /// <summary>
        /// Creates a table for a given set of paragraphs
        /// </summary>
        /// <param name="title">Title of the table</param>
        /// <param name="paragraphs">The paragraphs to display</param>
        /// <param name="showAssociatedImplementations">Indicates if we need to show the model elements implementing the paragraphs</param>
        /// <returns></returns>
        private void CreateImplementedParagraphsTable(HashSet <DataDictionary.Specification.Paragraph> paragraphs, Dictionary dictionary)
        {
            Dictionary <DataDictionary.Specification.Paragraph, List <ReqRef> > paragraphsReqRefDictionary = dictionary.ParagraphsReqRefs;

            foreach (DataDictionary.Specification.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)
                        {
                            fullName = reqRelated.FullName;
                            comment  = reqRelated.Comment;
                        }
                        else
                        {
                            DataDictionary.Specification.Paragraph par = reqRef.Enclosing as DataDictionary.Specification.Paragraph;
                            if (par != null)
                            {
                                fullName = paragraph.FullName;
                                comment  = paragraph.Comment;
                            }
                        }

                        if (fullName != null && comment != null)
                        {
                            if (previousCell == null)
                            {
                                AddRow("Associated implementation", fullName, comment);
                                previousCell = lastRow.Cells[0];
                            }
                            else
                            {
                                AddRow("", fullName, comment);
                                previousCell.MergeDown += 1;
                            }
                        }
                    }
                    CloseSubParagraph();
                }
            }
        }
            public override void visit(Generated.Paragraph obj, bool visitSubNodes)
            {
                DataDictionary.Specification.Paragraph paragraph = (DataDictionary.Specification.Paragraph)obj;

                if (paragraph.getImplementationStatus() == Generated.acceptor.SPEC_IMPLEMENTED_ENUM.Impl_Implemented)
                {
                    if (!FunctionalTests.TestedParagraphs.Contains(paragraph))
                    {
                        paragraph.AddInfo("Paragraph is implemented but has no associated functional test");
                    }
                }

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

                if (paragraph.getImplementationStatus() != Generated.acceptor.SPEC_IMPLEMENTED_ENUM.Impl_Implemented)
                {
                    if (Implementations.ImplementedParagraphs.Contains(paragraph))
                    {
                        paragraph.AddInfo("Paragraph is not marked as implemented but has implementations related to it");
                    }
                }

                base.visit(obj, visitSubNodes);
            }
Esempio n. 17
0
        /// <summary>
        /// Handles a drop event
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            if (SourceNode is ParagraphTreeNode)
            {
                if (MessageBox.Show("Are you sure you want to move the corresponding paragraph?", "Move paragraph", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ParagraphTreeNode paragraphTreeNode = (ParagraphTreeNode)SourceNode;

                    DataDictionary.Specification.Paragraph paragraph = paragraphTreeNode.Item;
                    paragraphTreeNode.Delete();
                    AddParagraph(paragraph);
                }
            }
        }
Esempio n. 18
0
 /// <summary>
 ///     Provides all the paragraphs associated to this req related
 /// </summary>
 /// <param name="paragraphs">The list of paragraphs to be filled</param>
 /// <returns></returns>
 public virtual void findRelatedParagraphsRecursively(List <Paragraph> paragraphs)
 {
     // Append the paragraphs related to the req refs of this req related
     foreach (ReqRef reqRef in Requirements)
     {
         Paragraph paragraph = reqRef.Paragraph;
         if (paragraph != null)
         {
             if (!paragraphs.Contains(paragraph))
             {
                 paragraphs.Add(paragraph);
             }
         }
     }
 }
Esempio n. 19
0
        /// <summary>
        ///     Brings the model element from an update dictionary to the updated dictionary
        /// </summary>
        public virtual void Merge()
        {
            ModelElement target = Updates;

            if (target == null)
            {
                // Copy element to parent
                ModelElement parent = Enclosing as ModelElement;
                if (parent != null)
                {
                    NameSpace parentNameSpace = parent.Updates as NameSpace;
                    if (parentNameSpace != null)
                    {
                        parentNameSpace.AddModelElement(Duplicate());
                    }

                    Paragraph parentParagraph = parent.Updates as Paragraph;
                    if (parentParagraph != null)
                    {
                        parentParagraph.AddModelElement(Duplicate());
                    }

                    Structure parentStructure = parent.Updates as Structure;
                    if (parentStructure != null)
                    {
                        parentStructure.AddModelElement(Duplicate());
                    }

                    StateMachine parentStateMachine = parent.Updates as StateMachine;
                    if (parentStateMachine != null)
                    {
                        parentStateMachine.AddModelElement(Duplicate());
                    }
                }
            }
            else
            {
                if (!IsRemoved)
                {
                    target.UpdateModelElementAccordingToSource(this);
                }
                else
                {
                    target.Delete();
                }
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Accepts drop of a tree node, in a drag & drop operation
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is FunctionTreeNode)
            {
                FunctionTreeNode node = SourceNode as FunctionTreeNode;
                DataDictionary.Functions.Function function     = node.Item;
                DataDictionary.Functions.Function duplFunction = DataDictionary.OverallFunctionFinder.INSTANCE.findByName(function.Dictionary, function.Name);
                if (duplFunction != null) // If there is a function with the same name, we must delete it
                {
                    if (MessageBox.Show("Are you sure you want to move the corresponding function?", "Move action", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        for (int i = 0; i < Nodes.Count; i++)
                        {
                            FunctionTreeNode temp = Nodes[i] as FunctionTreeNode;
                            if (temp.Item.Name == function.Name)
                            {
                                temp.Delete();
                            }
                        }
                        node.Delete();
                        AddFunction(function);
                    }
                }
                else
                {
                    node.Delete();
                    AddFunction(function);
                }
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Functions.Function function = (DataDictionary.Functions.Function)DataDictionary.Generated.acceptor.getFactory().createFunction();
                function.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                function.appendRequirements(reqRef);
                AddFunction(function);
            }
        }
Esempio n. 21
0
        /// <summary>
        ///     Handles a drop event
        /// </summary>
        /// <param name="sourceNode"></param>
        public override void AcceptDrop(BaseTreeNode sourceNode)
        {
            ParagraphTreeNode paragraphTreeNode = sourceNode as ParagraphTreeNode;

            if (paragraphTreeNode != null)
            {
                if (
                    MessageBox.Show("Are you sure you want to move the corresponding paragraph?", "Move paragraph",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Paragraph paragraph = paragraphTreeNode.Item;
                    if (paragraph.EnclosingCollection != null)
                    {
                        paragraph.EnclosingCollection.Remove(paragraph);
                    }
                    Item.appendParagraphs(paragraph);
                }
            }
        }
Esempio n. 22
0
        /// <summary>
        ///     Create structure based on the subsystem structure
        /// </summary>
        /// <param name="sourceNode"></param>
        public override void AcceptDrop(BaseTreeNode sourceNode)
        {
            base.AcceptDrop(sourceNode);

            if (sourceNode is RuleConditionTreeNode)
            {
                RuleConditionTreeNode node          = sourceNode as RuleConditionTreeNode;
                RuleCondition         ruleCondition = node.Item;
                node.Delete();
                Item.appendConditions(ruleCondition);
            }
            else if (sourceNode is ParagraphTreeNode)
            {
                ParagraphTreeNode node      = sourceNode as ParagraphTreeNode;
                Paragraph         paragraph = node.Item;

                RuleCondition ruleCondition = RuleCondition.CreateDefault(Item.RuleConditions);
                Item.appendConditions(ruleCondition);
                ruleCondition.FindOrCreateReqRef(paragraph);
            }
        }
Esempio n. 23
0
        /// <summary>
        ///     Accepts drop of a tree node, in a drag & drop operation
        /// </summary>
        /// <param name="sourceNode"></param>
        public override void AcceptDrop(BaseTreeNode sourceNode)
        {
            base.AcceptDrop(sourceNode);

            if (sourceNode is RuleTreeNode)
            {
                RuleTreeNode ruleTreeNode = sourceNode as RuleTreeNode;
                Rule         rule         = ruleTreeNode.Item;

                ruleTreeNode.Delete();
                Item.appendRules(rule);
            }
            else if (sourceNode is ParagraphTreeNode)
            {
                ParagraphTreeNode node      = sourceNode as ParagraphTreeNode;
                Paragraph         paragraph = node.Item;

                Rule rule = Rule.CreateDefault(Item.Rules);
                Item.appendRules(rule);
                rule.FindOrCreateReqRef(paragraph);
            }
        }
        /// <summary>
        ///     Accepts a new procedure
        /// </summary>
        /// <param name="sourceNode"></param>
        public override void AcceptDrop(BaseTreeNode sourceNode)
        {
            base.AcceptDrop(sourceNode);

            if (sourceNode is ProcedureTreeNode)
            {
                ProcedureTreeNode procedureTreeNode = sourceNode as ProcedureTreeNode;
                Procedure         procedure         = procedureTreeNode.Item;

                procedureTreeNode.Delete();
                Item.appendProcedures(procedure);
            }
            else if (sourceNode is ParagraphTreeNode)
            {
                ParagraphTreeNode node      = sourceNode as ParagraphTreeNode;
                Paragraph         paragraph = node.Item;

                Procedure procedure = Procedure.CreateDefault(Item.Procedures);
                Item.appendProcedures(procedure);
                procedure.FindOrCreateReqRef(paragraph);
            }
        }
Esempio n. 25
0
        /// <summary>
        ///     Creates are reference to a requirement. If already exists, returns that reference
        /// </summary>
        /// <param name="paragraph"></param>
        /// <returns>the req ref created</returns>
        public ReqRef FindOrCreateReqRef(Paragraph paragraph)
        {
            ReqRef retVal = null;

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

            if (retVal == null)
            {
                ReqRef req = (ReqRef)acceptor.getFactory().createReqRef();
                req.Paragraph = paragraph;
                appendRequirements(req);
            }

            return(retVal);
        }
Esempio n. 26
0
        /// <summary>
        ///     Accepts drop of a tree node, in a drag & drop operation
        /// </summary>
        /// <param name="sourceNode"></param>
        public override void AcceptDrop(BaseTreeNode sourceNode)
        {
            base.AcceptDrop(sourceNode);

            if (sourceNode is EnumerationTreeNode)
            {
                EnumerationTreeNode enumerationTreeNode = sourceNode as EnumerationTreeNode;
                Enum enumeration = enumerationTreeNode.Item;

                enumerationTreeNode.Delete();
                Item.appendSubEnums(enumeration);
            }
            else if (sourceNode is ParagraphTreeNode)
            {
                ParagraphTreeNode node      = sourceNode as ParagraphTreeNode;
                Paragraph         paragraph = node.Item;

                Enum enumeration = Enum.CreateDefault(Item.SubEnums);
                Item.appendSubEnums(enumeration);
                enumeration.FindOrCreateReqRef(paragraph);
            }
        }
        /// <summary>
        /// Describes a specific Subset-076 specification issue
        /// </summary>
        /// <param name="paragraph"></param>
        private void DescribeSpecIssue(Paragraph paragraph)
        {
            if (paragraph.SubParagraphs.Count > 0)
            {
                Report.AddSubParagraph(paragraph.Name);
                Report.AddTable(new[] { "SubSequence", "Test case", "Step", "Comment" }, new[] { 60, 20, 10, 80 });
                foreach (Paragraph subParagraph in paragraph.SubParagraphs)
                {
                    DescribeSpecIssue(subParagraph);
                }
                Report.CloseSubParagraph();
            }
            else
            {
                Report.AddRow(paragraph.ExpressionText);
                Report.SetLastRowColor(IssueColor(paragraph));

                if (paragraph.Implementations.Count > 0)
                {
                    foreach (ReqRef reqRef in paragraph.Implementations)
                    {
                        SubSequence subSequence = EnclosingFinder <SubSequence> .find(reqRef, true);

                        TestCase testCase = EnclosingFinder <TestCase> .find(reqRef, true);

                        Step step = EnclosingFinder <Step> .find(reqRef, true);

                        Report.AddRow(
                            subSequence != null ? subSequence.Name : "",
                            testCase != null ? testCase.getFeature().ToString(CultureInfo.InvariantCulture) : "",
                            step != null ? step.getTCS_Order().ToString(CultureInfo.InvariantCulture) : "",
                            reqRef.Comment);
                    }
                }
            }
        }
Esempio n. 28
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();
                }
            }
        }
        /// <summary>
        /// Describes a specific Subset-076 specification issue
        /// </summary>
        /// <param name="paragraph"></param>
        private void DescribeSpecIssue(Paragraph paragraph)
        {
            if (paragraph.SubParagraphs.Count > 0)
            {
                Report.AddSubParagraph(paragraph.Name);
                Report.AddTable(new[] { "SubSequence", "Test case", "Step", "Comment" }, new[] { 60, 20, 10, 80 });
                foreach (Paragraph subParagraph in paragraph.SubParagraphs)
                {
                    DescribeSpecIssue(subParagraph);
                }
                Report.CloseSubParagraph();
            }
            else
            {
                Report.AddRow(paragraph.ExpressionText);
                Report.SetLastRowColor(IssueColor(paragraph));

                if (paragraph.Implementations.Count > 0)
                {
                    foreach (ReqRef reqRef in paragraph.Implementations)
                    {
                        SubSequence subSequence = EnclosingFinder<SubSequence>.find(reqRef, true);
                        TestCase testCase = EnclosingFinder<TestCase>.find(reqRef, true);
                        Step step = EnclosingFinder<Step>.find(reqRef, true);

                        Report.AddRow(
                            subSequence != null ? subSequence.Name : "",
                            testCase != null ? testCase.getFeature().ToString(CultureInfo.InvariantCulture) : "",
                            step != null ? step.getTCS_Order().ToString(CultureInfo.InvariantCulture) : "",
                            reqRef.Comment);
                    }
                }
            }
        }
Esempio n. 30
0
        /// <summary>
        ///     Imports the paragraphs from the provided worksheet to the provided chapter
        /// </summary>
        /// <param name="aChapter"></param>
        /// <param name="aWorksheet"></param>
        private void importParagraphs(Chapter aChapter, string chapterId, Worksheet aWorksheet)
        {
            Range  aRange      = aWorksheet.UsedRange;
            int    paragraphId = 1;
            string text        = "";
            bool   skipRow     = false;

            for (int i = 2; i <= aRange.Rows.Count; i++)
            {
                string specId = (string)(aRange.Cells[i, 1] as Range).Value2;
                if (specId != null)
                {
                    // Create the new paragraph
                    Paragraph aParagraph = (Paragraph)acceptor.getFactory().createParagraph();
                    aParagraph.setId(chapterId + "." + paragraphId.ToString());
                    paragraphId++;
                    aParagraph.setType(acceptor.Paragraph_type.aNOTE);
                    aParagraph.setImplementationStatus(acceptor.SPEC_IMPLEMENTED_ENUM.Impl_NotImplementable);


                    // Add the requirement set "Onboard"
                    aParagraph.setObsoleteScopeOnBoard(false);
                    aParagraph.setObsoleteScopeTrackside(false);
                    RequirementSetReference requirementSetReference =
                        (RequirementSetReference)acceptor.getFactory().createRequirementSetReference();
                    RequirementSet requirementSet = TheDictionary.findRequirementSet("Scope", false);
                    if (requirementSet != null)
                    {
                        requirementSet = requirementSet.findRequirementSet("Onboard", false);
                        if (requirementSet != null)
                        {
                            requirementSetReference.setTarget(requirementSet.Guid);
                            aParagraph.appendRequirementSets(requirementSetReference);
                        }
                        else
                        {
                            throw new Exception("Requirement set Onboard not found");
                        }
                    }
                    else
                    {
                        throw new Exception("Requirement set Scope not found");
                    }

                    // Add the paragraph to the chapter
                    aChapter.appendParagraphs(aParagraph);


                    // Create of the text of paragraph
                    aParagraph.Text = (string)(aRange.Cells[i, 2] as Range).Value2 + "\n"; // description
                    text            = (string)(aRange.Cells[i, 6] as Range).Value2;        // start condition
                    if (text != null)
                    {
                        aParagraph.Text += "START: " + text + "\n";
                        if (specId.Equals((string)(aRange.Cells[i + 1, 1] as Range).Value2))
                        // the following element can give the stop condition for the current element
                        {
                            text = (string)(aRange.Cells[i + 1, 7] as Range).Value2;  // stop condition
                            if (text != null)
                            {
                                aParagraph.Text += "STOP: " + text + "\n";
                                skipRow          = true;
                                // the remaining information of the following document is identical => let's skip it
                            }
                        }
                    }
                    text = (string)(aRange.Cells[i, 7] as Range).Value2;  // stop condition
                    if (text != null)
                    {
                        aParagraph.Text += "STOP: " + text + "\n";
                    }
                    text = (string)(aRange.Cells[i, 8] as Range).Value2;  // comment
                    if (text != null)
                    {
                        aParagraph.Text += "Comment: " + text + "\n";
                    }


                    // Create the reference to a paragraph from Subset-026
                    Specification subset026 = findSubset026Specification();

                    specId = specId.Replace(" ", ".");
                    Paragraph refParagraph = subset026.FindParagraphByNumber(specId);

                    if (refParagraph != null)
                    {
                        ReqRef aReqRef = (ReqRef)acceptor.getFactory().createReqRef();
                        aReqRef.Paragraph = aParagraph;
                        refParagraph.appendRequirements(aReqRef);
                    }
                    else
                    {
                        aParagraph.Text += "SUBSET-026 REFERENCE: " + specId + "\n";
                    }


                    // DMI references
                    text = (string)(aRange.Cells[i, 3] as Range).Value2;  // DMI object
                    if (text != null)
                    {
                        aParagraph.Text += "DMI OBJECT: " + text + "\n";
                        text             = (string)(aRange.Cells[i, 4] as Range).Value2; // DMI area
                        if (text != null)
                        {
                            aParagraph.Text += "DMI AREA: " + text + "\n";
                            object reference = (aRange.Cells[i, 5] as Range).Value2; // DMI reference
                            if (reference != null)
                            {
                                aParagraph.Text += "DMI REFERENCE: " + reference.ToString();
                            }
                        }
                    }

                    if (skipRow)
                    {
                        i++;
                        skipRow = false;
                    }
                }
            }
        }
        /// <summary>
        ///     Creates are reference to a requirement. If already exists, returns that reference
        /// </summary>
        /// <param name="paragraph"></param>
        /// <returns>the req ref created</returns>
        public ReqRef FindOrCreateReqRef(Paragraph paragraph)
        {
            ReqRef retVal = null;

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

            if (retVal == null)
            {
                ReqRef req = (ReqRef) acceptor.getFactory().createReqRef();
                req.Paragraph = paragraph;
                appendRequirements(req);
            }

            return retVal;
        }
 /// <summary>
 /// Provides the color associated to the issue kind
 /// </summary>
 /// <param name="issue"></param>
 /// <returns></returns>
 public static Color IssueColor(Paragraph issue)
 {
     return(IssueColor(IssueKindUtil.GetKind(issue)));
 }
 /// <summary>
 /// Provides the color associated to the issue kind
 /// </summary>
 /// <param name="issue"></param>
 /// <returns></returns>
 public static Color IssueColor(Paragraph issue)
 {
     return IssueColor(IssueKindUtil.GetKind(issue));
 }