예제 #1
0
 public void Init()
 {
     list       = new BugDictionary();
     bugFactory = new XMLBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\BugFactoryBugs.xml");
     bug        = list[71];
 }
예제 #2
0
 public void HardData()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\HardCSV.csv");
     bug        = list[9];
     Assert.AreEqual(bug.Id, 9);
     Assert.AreEqual(bug.Version, "1.0.0");
     Assert.AreEqual(bug.Keywords, "Keyword1, Keyword2");
     Assert.AreEqual(bug.Component, "AComponent");
     Assert.AreEqual(bug.Product, "MyProduct");
     Assert.AreEqual(bug.Reporter, "*****@*****.**");
     Assert.AreEqual(bug.Platform, "Other");
     Assert.AreEqual(bug.CreationDate, "2009-10-26 10:32:22");
     Assert.AreEqual(bug.Milestone, "M1");
     Assert.AreEqual(bug.ActualTime, 0);
     Assert.AreEqual(bug.RemainingTime, 0);
     Assert.AreEqual(bug.OriginalTimeEstimate, 0);
     Assert.AreEqual(bug.Summary, "A bad summary, \"\" containing, \" \".");
     Assert.AreEqual(bug.Status, "NEW");
     Assert.AreEqual(bug.Owner, "Donald E. Knuth");
     Assert.AreEqual(bug.OS, "Mac OS");
     Assert.AreEqual(bug.Priority, "P2");
     Assert.AreEqual(bug.Severity, "normal");
 }
예제 #3
0
 public void OriginalTimeEstimate()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\SimpleCSV.csv");
     bug        = list[3];
     Assert.AreEqual(bug.OriginalTimeEstimate, 4.00);
 }
예제 #4
0
 public void Summary()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\SimpleCSV.csv");
     bug        = list[3];
     Assert.AreEqual(bug.Summary, "Missing period in dialog.");
 }
예제 #5
0
 public void Status()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\SimpleCSV.csv");
     bug        = list[3];
     Assert.AreEqual(bug.Status, "NEW");
 }
예제 #6
0
 public void Owner()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\SimpleCSV.csv");
     bug        = list[3];
     Assert.AreEqual(bug.Owner, "Fred Brooks");
 }
예제 #7
0
 public void Priority()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\SimpleCSV.csv");
     bug        = list[3];
     Assert.AreEqual(bug.Priority, "P5");
 }
예제 #8
0
 public void ActualTime()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\SimpleCSV.csv");
     bug        = list[3];
     Assert.AreEqual(bug.ActualTime, 1.00);
 }
예제 #9
0
 public void Keywords()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\SimpleCSV.csv");
     bug        = list[3];
     Assert.AreEqual(bug.Keywords, "Keyword1");
 }
예제 #10
0
 public void Version()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\SimpleCSV.csv");
     bug        = list[3];
     Assert.AreEqual(bug.Version, "1.0.0");
 }
예제 #11
0
 public void Component()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\SimpleCSV.csv");
     bug        = list[3];
     Assert.AreEqual(bug.Component, "BComponent");
 }
예제 #12
0
 public void Reporter()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\SimpleCSV.csv");
     bug        = list[3];
     Assert.AreEqual(bug.Reporter, "*****@*****.**");
 }
예제 #13
0
 public void Platform()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\SimpleCSV.csv");
     bug        = list[3];
     Assert.AreEqual(bug.Platform, "All");
 }
예제 #14
0
 public void CreationTime()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\SimpleCSV.csv");
     bug        = list[3];
     Assert.AreEqual(bug.CreationDate, "2009-09-08 20:44:04");
 }
예제 #15
0
 public void Milestone()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\SimpleCSV.csv");
     bug        = list[3];
     Assert.AreEqual(bug.Milestone, "M1");
 }
예제 #16
0
        /// <summary>
        /// Uses the bugzilla XML file and updates the project file with that information.
        /// This also has the interesting side affect of setting the bugzilla file variables
        /// for this class.
        /// </summary>
        /// <param name="bugzilla_xml"></param>
        public void Update(string fileName)
        {
            #region Pre Condition
            Debug.Assert(null != fileName);
            Debug.Assert(fileName == InputPath);
            #endregion

            #region Create Bug Factory
            InputPath = fileName;
            switch (this.InputType)
            {
            case InputDataFormat.BugzillaXML:
                BugFact = new XMLBugFactory();
                break;

            case InputDataFormat.BugzillaCSV:
                BugFact = new CSVBugFactory();
                break;
            }
            BugFact.InputPath = fileName;
            #endregion

            #region Progress
            _progress       = new Progress();
            _progress.Range = NumberOfTicksForGeneration(fileName);
            _progress.Show();
            System.Threading.Thread.Sleep(500);
            _progress.Refresh();
            #endregion

            BugDictionary bugs = BugFact.CreateBugs(InputPath, _progress);
            CreateProjectTasks(bugs, _progress);

            _progress.Refresh();

            _progress.UpdateProgressDone();
            System.Threading.Thread.Sleep(2000);
            _progress.Close();
            _progress = null;

            #region Post Condition
            #endregion
        }
예제 #17
0
 public void NullRows()
 {
     list       = new BugDictionary();
     bugFactory = new CSVBugFactory();
     list       = bugFactory.CreateBugs("..\\..\\artifacts\\nullrows.csv");
     bug        = list[61908];
     Assert.AreEqual(bug.Summary, "One-off full sync requests from tsconsole submit request screen");
     Assert.AreEqual(bug.CreationDate, "10/21/2009 2:56");
     Assert.AreEqual(bug.Id, 61908);
     Assert.AreEqual(bug.Severity, "normal");
     Assert.AreEqual(bug.Priority, "P2");
     Assert.AreEqual(bug.Platform, "enhancement");
     Assert.AreEqual(bug.Owner, "*****@*****.**");
     Assert.AreEqual(bug.Status, "NEW");
     Assert.AreEqual(bug.Product, "Engineering");
     Assert.AreEqual(bug.Component, "Symprod");
     Assert.AreEqual(bug.Milestone, "9.11.1");
     Assert.AreEqual(bug.ActualTime, 0);
     Assert.AreEqual(bug.RemainingTime, 0);
     Assert.AreEqual(bug.OriginalTimeEstimate, 0);
 }
예제 #18
0
        /// <summary>
        /// Takes a listing of bugs delegates the creation of project tasks.
        /// </summary>
        /// <param name="bugs"></param>
        /// <remarks>This makes the assumption that the Task.Number1 field is always avaible for us to use.  This is our bug key.</remarks>
        public void CreateProjectTasks(BugDictionary bugs, Progress progress)
        {
            ArrayList orphanTasks = new ArrayList();
            Dictionary <int, Task> bugzillaTasks = new Dictionary <int, Task>();
            Dictionary <int, Bug>  deepCopyBugs  = new Dictionary <int, Bug>();
            bool foundStartHolder = false;

            #region Create Bugs Deep Copy
            // We need to make a deep copy of the bugs since we need to remove
            // them from the list as we add them to the list, and doing this
            // to the active dictionary would be bad, and adding another
            // variable to the dictionary to indicate what has been removed
            // was going to be a pain.
            foreach (KeyValuePair <int, Bug> kvp in bugs)
            {
                deepCopyBugs.Add(kvp.Key, kvp.Value);
            }
            #endregion

            #region Set Microsoft Project Configuration
            _project = _projectApp.ActiveProject;
            _project.DefaultWorkUnits     = PjUnit.pjHour;
            _project.DefaultDurationUnits = PjUnit.pjHour;

            #region Show Fields in table
            if (ShowAllBugzillaFieldsInProject)
            {
                // THIS IS HARD CODED, it should be made reflective.
                foreach (KeyValuePair <string, string> de in _dataMap.GetEnumerator())
                {
                    if (de.Key != "Owner")
                    {
                        // BUG: Don't just eat the exception.  Figure out how to update the column properly.
                        try
                        {
                            _project.Application.SelectTaskColumn(de.Value, Missing.Value, Missing.Value, Missing.Value);
                            _project.Application.ColumnDelete();
                        }
                        catch (Exception) { }

                        try
                        {
                            _project.Application.TableEdit("&Entry", true, Missing.Value, true, Missing.Value, Missing.Value, de.Value, de.Key, Missing.Value, 0, true, true, 255, Missing.Value, Missing.Value, 1, Missing.Value, Missing.Value);
                            _project.Application.TableApply("&Entry");
                        }
                        catch (Exception) { }
                    }
                }
                try
                {
                    _project.Application.TableEdit("&Entry", true, Missing.Value, true, Missing.Value, Missing.Value, "Remaining Work", "Remaining Work", Missing.Value, 0, true, true, 255, Missing.Value, Missing.Value, 1, Missing.Value, Missing.Value);
                    _project.Application.TableApply("&Entry");
                }
                catch (Exception) { }
                try
                {
                    _project.Application.TableEdit("&Entry", true, Missing.Value, true, Missing.Value, Missing.Value, "Actual Work", "Actual Work", Missing.Value, 0, true, true, 255, Missing.Value, Missing.Value, 1, Missing.Value, Missing.Value);
                    _project.Application.TableApply("&Entry");
                }
                catch (Exception) { }
                try
                {
                    _project.Application.TableEdit("&Entry", true, Missing.Value, true, Missing.Value, Missing.Value, "Priority", "Priority", Missing.Value, 0, true, true, 255, Missing.Value, Missing.Value, 1, Missing.Value, Missing.Value);
                    _project.Application.TableApply("&Entry");
                }
                catch (Exception) { }
            }
            #endregion

            #endregion

            #region Start Task
            foreach (Task task in _project.Tasks)
            {
                if (task.Name == "Today")
                {
                    startHolderId    = task.ID;
                    foundStartHolder = true;
                    break;
                }
            }
            if (false == foundStartHolder)
            {
                Task task = _project.Tasks.Add("Today", 1);
                task.PercentComplete = "100%";
                task.ActualWork      = 0;
                task.Milestone       = true;
                task.RemainingWork   = 0;
                startHolderId        = task.ID;
                foundStartHolder     = true;
                task.Start           = DateTime.Now;
            }
            #endregion

            #region Update Existing Tasks
            Debug.Assert(startHolderId != 0);
            Debug.Assert(foundStartHolder);

            foreach (Task task in _project.Tasks)
            {
                if (deepCopyBugs.ContainsKey((int)task.Number1))
                {
                    Debug.Assert(Program.ASSUMPTION_Task_Number1_to_BugID);
                    Bug bug = deepCopyBugs[(int)task.Number1];
                    deepCopyBugs.Remove(bug.Id);
                    bug.ProjectTaskId = task.ID;
                    if ((null == task.Predecessors) || ("" == task.Predecessors))
                    {
                        task.Predecessors = startHolderId.ToString();
                    }
                    else
                    {
                        task.Predecessors += ", " + startHolderId.ToString();
                    }
                    UpdateProjectTask(bug, task);
                    bugzillaTasks.Add(bug.Id, task);
                }
                else
                {
                    // Probably shoudl do something here...
                    // Debug.Assert(false, "Task \"" + task.Summary + "\" exists in project but not in bugzilla.");
                }
                progress.UpdateProgress(1, "Scanning project task " + task.Name + ".");
            }
            #endregion

            #region Create New Tasks
            foreach (Bug bug in deepCopyBugs.Values)
            {
                Task task = _project.Tasks.Add(bug.Summary, 2);

                Debug.Assert(null != bug);
                Debug.Assert(bug.Id != 0);
                Debug.Assert(null != task);

                UpdateProjectTask(bug, task);
                bug.ProjectTaskId = task.ID;
                bugzillaTasks.Add(bug.Id, task);
                progress.UpdateProgress(1, "Created task from bug " + bug.Id + ".");
            }
            #endregion

            #region Debug Verification
            Debug.Assert(bugs.Count == bugzillaTasks.Count);
            #endregion

            #region Set any Dependencies as defined in bugzilla
            foreach (KeyValuePair <int, Task> obj in bugzillaTasks)
            {
                Task task = (Task)(obj).Value;

                // Set dependency to today.
                if (("" == task.Predecessors) || (null == task.Predecessors))
                {
                    task.Predecessors += startHolderId.ToString();
                }
                else
                {
                    task.Predecessors = task.Predecessors + ", " + startHolderId.ToString();
                }

                // Get the bug for the task
                Debug.Assert(Program.ASSUMPTION_Task_Number1_to_BugID);
                Debug.Assert(bugs.ContainsKey((int)task.Number1));

                Bug bug = bugs[(int)task.Number1];
                Debug.Assert(null != bug);

                // Search for any depends on in the bug
                foreach (int depNum in bug.Blocks)
                {
                    Debug.Assert(0 != bug.ProjectTaskId);
                    if (false == bugzillaTasks.ContainsKey(depNum))
                    {
                        System.Windows.Forms.MessageBox.Show("There is a dependency reference to a bug which is not contained in your search.  Please re-define your search.", "Projzilla Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return;
                    }

                    Task myTask = bugzillaTasks[depNum];
                    if (("" == myTask.Predecessors) || (null == myTask.Predecessors))
                    {
                        myTask.Predecessors = task.ID.ToString();
                    }
                    else
                    {
                        string preds;
                        preds = myTask.Predecessors + ", " + task.ID.ToString();
                        myTask.Predecessors = preds;
                    }
                }
                progress.UpdateProgress(1, "Scanning and updating dependencies.");
            }
            #endregion
        }
예제 #19
0
        public override BugDictionary CreateBugs(string xmlfile, Progress progress)
        {
            #region Pre Condition
            Debug.Assert(xmlfile != null);
            #if DEBUG
            System.Console.WriteLine("CreateBugs(" + xmlfile + ")");
            #endif
            #endregion

            BugDictionary bugs = new BugDictionary();
            XmlDocument   doc  = new XmlDocument();
            doc.XmlResolver = null; // Prevents it from searching for the bugzilla dtd (incase it is not accessible.
            doc.Load(xmlfile);
            foreach (XmlNode node in doc.SelectNodes("/bugzilla/bug"))
            {
                Bug bug = new Bug();
                bug.Id     = int.Parse(node.SelectNodes("bug_id")[0].InnerText);
                bug.Status = node.SelectNodes("bug_status")[0].InnerText;
                if (null != node.SelectNodes("resolution")[0])
                {
                    bug.Resolution = node.SelectNodes("resolution")[0].InnerText;
                }
                if (null != node.SelectNodes("target_milestone")[0])
                {
                    bug.Milestone = node.SelectNodes("target_milestone")[0].InnerText;
                }
                if (null != node.SelectNodes("rep_platform")[0])
                {
                    bug.Platform = node.SelectNodes("rep_platform")[0].InnerText;
                }
                if (null != node.SelectNodes("keywords")[0])
                {
                    bug.Keywords = node.SelectNodes("keywords")[0].InnerText;
                }
                if (null != node.SelectNodes("op_sys")[0])
                {
                    bug.OS = node.SelectNodes("op_sys")[0].InnerText;
                }
                if (null != node.SelectNodes("qa_contact")[0])
                {
                    bug.QAContact = node.SelectNodes("qa_contact")[0].InnerText;
                }
                bug.Summary      = node.SelectNodes("short_desc")[0].InnerText;
                bug.Owner        = node.SelectNodes("assigned_to")[0].Attributes[0].InnerText;
                bug.Priority     = node.SelectNodes("priority")[0].InnerText;
                bug.CreationDate = node.SelectNodes("creation_ts")[0].InnerText;
                bug.Severity     = node.SelectNodes("bug_severity")[0].InnerText;

                bug.Product   = node.SelectNodes("product")[0].InnerText;
                bug.Component = node.SelectNodes("component")[0].InnerText;
                bug.Version   = node.SelectNodes("version")[0].InnerText;
                bug.Reporter  = node.SelectNodes("reporter")[0].InnerText;

                #region Actual Time, Estimated Time, Remaining Time
                if (node.SelectNodes("actual_time").Count > 0)
                {
                    bug.ActualTime = Convert.ToDouble(node.SelectNodes("actual_time")[0].InnerText);
                }
                else
                {
                    bug.ActualTime = Convert.ToDouble(Config.GetSystem("DefaultBugDuration"));
                }
                if (node.SelectNodes("estimated_time").Count > 0)
                {
                    bug.OriginalTimeEstimate = Convert.ToDouble(node.SelectNodes("estimated_time")[0].InnerText);
                }
                else
                {
                    bug.OriginalTimeEstimate = Convert.ToDouble(Config.GetSystem("DefaultBugDuration"));
                }
                if (node.SelectNodes("remaining_time").Count > 0)
                {
                    bug.RemainingTime = Convert.ToDouble(node.SelectNodes("remaining_time")[0].InnerText);
                }
                else
                {
                    bug.RemainingTime = Convert.ToDouble(Config.GetSystem("DefaultBugDuration"));
                }
                #endregion

                foreach (XmlNode depNode in node.SelectNodes("dependson"))
                {
                    bug.DependsOn.Add(Convert.ToInt32(depNode.InnerText));
                }
                foreach (XmlNode depNode in node.SelectNodes("blocked"))
                {
                    bug.Blocks.Add(Convert.ToInt32(depNode.InnerText));
                }
                bugs.Add(bug.Id, bug);
                if (null != progress)
                {
                    progress.UpdateProgress(1, "Reading " + bug.Id + " from " + xmlfile + ".");
                }
            }

            #region Post Condition
            Debug.Assert(bugs != null);
            #endregion

            return(bugs);
        }
예제 #20
0
        public override BugDictionary CreateBugs(string csvfile, Progress progress)
        {
            Dictionary <int, string> Headers;
            DataTable     csvTable;
            BugDictionary bugs;
            Bug           bug;

            #region Pre Condition
            Debug.Assert("" != csvfile);
            #endregion

            Headers  = new Dictionary <int, string>();
            csvTable = CSVParse(csvfile);
            bugs     = new BugDictionary();

            #region Header
            // Use the header row to make a map of where stuff goes
            //string[] csvHeaders = csvTable[0];
            int index = 0;
            foreach (string header in csvTable.Rows[0].ItemArray)
            {
                Headers.Add(index, header);
                index++;
            }
            #endregion

            #region Verification
            // Write code to ensure that we have enough of the fields
            #endregion

            #region Data Row Parse
            DataRow row;

            for (int i = 1; i < csvTable.Rows.Count; i++)
            {
                row = csvTable.Rows[i];
                bug = new Bug();
                for (int j = 0; j < row.ItemArray.Length; j++)
                {
                    if (Headers.ContainsKey(j) && (null != row.ItemArray[j]) && (false == (row.ItemArray[j] is System.DBNull)) && (null != row.ItemArray[j]) && ("" != (string)row.ItemArray[j]))
                    {
                        CSVBugPopulate(bug, Headers[j], (string)row.ItemArray[j]);
                    }
                }

                // This deals with the case of null rows at the end.
                if (0 != bug.Id)
                {
                    bugs.Add(bug.Id, bug);
                }
                if (null != progress)
                {
                    progress.UpdateProgress(1, "Reading " + bug.Id + " from " + csvfile + ".");
                }
            }
            #endregion

            #region Post Condition
            foreach (KeyValuePair <int, Bug> kvp in bugs)
            {
                bug = ((Bug)kvp.Value);
                Debug.Assert(0 != bug.Id);
                Debug.Assert((null != bug.Summary) && ("" != bug.Summary));
            }
            #endregion

            return(bugs);
        }