Example #1
0
        public void Conflict2EventsAndEventSameAsSecondDifferentProductAndFile()
        {
            StackHashProduct product1 = new StackHashProduct(DateTime.Now, DateTime.Now, null, 1, "StackHash", 0, 0, "1.2.3.4");
            StackHashFile    file1    = new StackHashFile(DateTime.Now, DateTime.Now, 1, DateTime.Now, "File1", "1.2.3.4");
            StackHashEvent   event1   = new StackHashEvent(1, "EventTypeName1");
            StackHashEvent   event2   = new StackHashEvent(2, "EventTypeName1");

            StackHashBugReportData           data1    = new StackHashBugReportData(product1, file1, event1, null, null, StackHashReportOptions.IncludeAllObjects);
            StackHashBugReportData           data2    = new StackHashBugReportData(product1, file1, event2, null, null, StackHashReportOptions.IncludeAllObjects);
            StackHashBugReportDataCollection allData1 = new StackHashBugReportDataCollection()
            {
                data1,
                data2,
            };

            StackHashProduct product2 = new StackHashProduct(DateTime.Now, DateTime.Now, null, 1, "StackHash", 0, 0, "1.2.3.4");
            StackHashFile    file2    = new StackHashFile(DateTime.Now, DateTime.Now, 1, DateTime.Now, "File1", "1.2.3.4");

            StackHashBugReportData           data3    = new StackHashBugReportData(product2, file2, event2, null, null, StackHashReportOptions.IncludeAllObjects);
            StackHashBugReportDataCollection allData2 = new StackHashBugReportDataCollection()
            {
                data3
            };

            Assert.AreEqual(true, allData1.IsConflicting(allData2));
        }
Example #2
0
        /// <summary>
        /// Processes each report request in turn.
        /// </summary>
        private void processAllReportRequests()
        {
            StackHashBugReportDataCollection allRequests = m_TaskParameters.ReportRequest;

            m_TotalEvents = getNumberOfEvents(allRequests);

            foreach (StackHashBugReportData request in allRequests)
            {
                processReportRequest(request);
            }
        }
Example #3
0
        /// <summary>
        /// Get the number of events to be reported across all requests.
        /// </summary>
        /// <param name="requests">All requests.</param>
        /// <returns>Number of events.</returns>
        private long getNumberOfEvents(StackHashBugReportDataCollection requests)
        {
            long totalEvents = 0;

            foreach (StackHashBugReportData request in requests)
            {
                totalEvents += getNumberOfEvents(request, getReportType(request));
            }

            return(totalEvents);
        }
Example #4
0
        /// <summary>
        /// Get the highest level report in the set of requests.
        /// </summary>
        /// <param name="requests">All requests.</param>
        /// <returns>Highest level report.</returns>
        private BugTrackerReportType getHighestLevelReport(StackHashBugReportDataCollection requests)
        {
            BugTrackerReportType highestReportType = BugTrackerReportType.Automatic;

            foreach (StackHashBugReportData request in requests)
            {
                BugTrackerReportType reportType = getReportType(request);

                highestReportType = getHigherLevelReport(reportType, highestReportType);
            }

            return(highestReportType);
        }
Example #5
0
        public void ConflictBothFull()
        {
            StackHashBugReportData           data1    = new StackHashBugReportData(null, null, null, null, null, StackHashReportOptions.IncludeAllObjects);
            StackHashBugReportDataCollection allData1 = new StackHashBugReportDataCollection()
            {
                data1
            };

            StackHashBugReportData           data2    = new StackHashBugReportData(null, null, null, null, null, StackHashReportOptions.IncludeAllObjects);
            StackHashBugReportDataCollection allData2 = new StackHashBugReportDataCollection()
            {
                data2
            };

            Assert.AreEqual(true, allData1.IsConflicting(allData2));
            Assert.AreEqual(true, allData2.IsConflicting(allData1));
        }
Example #6
0
        public void ConflictFullAndProduct()
        {
            StackHashBugReportData           data1    = new StackHashBugReportData(null, null, null, null, null, StackHashReportOptions.IncludeAllObjects);
            StackHashBugReportDataCollection allData1 = new StackHashBugReportDataCollection()
            {
                data1
            };

            StackHashProduct       product2 = new StackHashProduct(DateTime.Now, DateTime.Now, null, 1, "StackHash", 0, 0, "1.2.3.4");
            StackHashBugReportData data2    = new StackHashBugReportData(product2, null, null, null, null, StackHashReportOptions.IncludeAllObjects);

            StackHashBugReportDataCollection allData2 = new StackHashBugReportDataCollection()
            {
                data2
            };

            Assert.AreEqual(true, allData1.IsConflicting(allData2));
        }
Example #7
0
        public void NoConflictProductAndDifferentProduct()
        {
            StackHashProduct                 product1 = new StackHashProduct(DateTime.Now, DateTime.Now, null, 1, "StackHash", 0, 0, "1.2.3.4");
            StackHashBugReportData           data1    = new StackHashBugReportData(product1, null, null, null, null, StackHashReportOptions.IncludeAllObjects);
            StackHashBugReportDataCollection allData1 = new StackHashBugReportDataCollection()
            {
                data1
            };

            StackHashProduct       product2 = new StackHashProduct(DateTime.Now, DateTime.Now, null, 2, "StackHash", 0, 0, "1.2.3.4");
            StackHashBugReportData data2    = new StackHashBugReportData(product2, null, null, null, null, StackHashReportOptions.IncludeAllObjects);

            StackHashBugReportDataCollection allData2 = new StackHashBugReportDataCollection()
            {
                data2
            };

            Assert.AreEqual(false, allData1.IsConflicting(allData2));
            Assert.AreEqual(false, allData2.IsConflicting(allData1));
        }
Example #8
0
        public void ConflictEventAndSameProduct()
        {
            StackHashProduct product1 = new StackHashProduct(DateTime.Now, DateTime.Now, null, 1, "StackHash", 0, 0, "1.2.3.4");

            StackHashBugReportData           data1    = new StackHashBugReportData(product1, null, null, null, null, StackHashReportOptions.IncludeAllObjects);
            StackHashBugReportDataCollection allData1 = new StackHashBugReportDataCollection()
            {
                data1
            };

            StackHashProduct product2 = new StackHashProduct(DateTime.Now, DateTime.Now, null, 1, "StackHash", 0, 0, "1.2.3.4");
            StackHashFile    file2    = new StackHashFile(DateTime.Now, DateTime.Now, 1, DateTime.Now, "File1", "1.2.3.4");
            StackHashEvent   event2   = new StackHashEvent(1, "EventTypeName1");

            StackHashBugReportData           data2    = new StackHashBugReportData(product2, file2, event2, null, null, StackHashReportOptions.IncludeAllObjects);
            StackHashBugReportDataCollection allData2 = new StackHashBugReportDataCollection()
            {
                data2
            };

            Assert.AreEqual(true, allData2.IsConflicting(allData1));
        }
Example #9
0
        public void RunBugReportSpecificEvent()
        {
            m_Utils.RegisterForNotifications(true, m_Utils.ApplicationGuid);
            m_Utils.CreateAndSetNewContext(ErrorIndexType.SqlExpress);

            GetContextBugTrackerPlugInSettingsResponse resp = m_Utils.GetContextBugTrackerPlugInSettings(0);

            Assert.AreNotEqual(null, resp.BugTrackerPlugInSettings);
            Assert.AreNotEqual(null, resp.BugTrackerPlugInSettings.PlugInSettings);
            Assert.AreEqual(0, resp.BugTrackerPlugInSettings.PlugInSettings.Count);

            resp.BugTrackerPlugInSettings.PlugInSettings.Add(new StackHashBugTrackerPlugIn());
            resp.BugTrackerPlugInSettings.PlugInSettings[0].Enabled    = true;
            resp.BugTrackerPlugInSettings.PlugInSettings[0].Name       = "TestPlugIn";
            resp.BugTrackerPlugInSettings.PlugInSettings[0].Properties = new StackHashNameValueCollection();
            resp.BugTrackerPlugInSettings.PlugInSettings[0].Properties.Add(new StackHashNameValuePair()
            {
                Name = "TestParam1", Value = "TestValue1"
            });
            resp.BugTrackerPlugInSettings.PlugInSettings[0].Properties.Add(new StackHashNameValuePair()
            {
                Name = "TestParam2", Value = "TestValue2"
            });

            m_Utils.SetContextBugTrackerPlugInSettings(0, resp.BugTrackerPlugInSettings);

            m_Utils.RestartService();
            m_Utils.ActivateContext(0);

            StackHashTestIndexData indexData = new StackHashTestIndexData();

            indexData.NumberOfProducts   = 1;
            indexData.NumberOfFiles      = 1;
            indexData.NumberOfEvents     = 1;
            indexData.NumberOfCabs       = 1;
            indexData.NumberOfEventInfos = 1;

            m_Utils.CreateTestIndex(0, indexData);

            try
            {
                StackHashProductInfoCollection  products = m_Utils.GetProducts(0).Products;
                StackHashFileCollection         files    = m_Utils.GetFiles(0, products[0].Product).Files;
                StackHashEventPackageCollection events   = m_Utils.GetProductEventPackages(0, products[0].Product).EventPackages;
                StackHashCabPackageCollection   cabs     = events[0].Cabs;

                StackHashBugReportDataCollection bugReportDataCollection = new StackHashBugReportDataCollection();
                bugReportDataCollection.Add(new StackHashBugReportData()
                {
                    Product    = products[0].Product,
                    File       = files[0],
                    TheEvent   = events[0].EventData,
                    Cab        = null,
                    ScriptName = null,
                    Options    = StackHashReportOptions.IncludeAllObjects
                });

                m_Utils.RunBugReportTask(0, bugReportDataCollection, 30000, true);
            }
            finally
            {
                m_Utils.DeactivateContext(0);
                m_Utils.DeleteIndex(0);
            }
        }
Example #10
0
        public void RunBugReportSpecificFileProgressCheckManyEventsAbortTest()
        {
            m_Utils.RegisterForNotifications(true, m_Utils.ApplicationGuid);
            m_Utils.CreateAndSetNewContext(ErrorIndexType.SqlExpress);

            GetContextBugTrackerPlugInSettingsResponse resp = m_Utils.GetContextBugTrackerPlugInSettings(0);

            Assert.AreNotEqual(null, resp.BugTrackerPlugInSettings);
            Assert.AreNotEqual(null, resp.BugTrackerPlugInSettings.PlugInSettings);
            Assert.AreEqual(0, resp.BugTrackerPlugInSettings.PlugInSettings.Count);

            resp.BugTrackerPlugInSettings.PlugInSettings.Add(new StackHashBugTrackerPlugIn());
            resp.BugTrackerPlugInSettings.PlugInSettings[0].Enabled    = true;
            resp.BugTrackerPlugInSettings.PlugInSettings[0].Name       = "TestPlugIn";
            resp.BugTrackerPlugInSettings.PlugInSettings[0].Properties = new StackHashNameValueCollection();
            resp.BugTrackerPlugInSettings.PlugInSettings[0].Properties.Add(new StackHashNameValuePair()
            {
                Name = "TestParam1", Value = "TestValue1"
            });
            resp.BugTrackerPlugInSettings.PlugInSettings[0].Properties.Add(new StackHashNameValuePair()
            {
                Name = "TestParam2", Value = "TestValue2"
            });

            m_Utils.SetContextBugTrackerPlugInSettings(0, resp.BugTrackerPlugInSettings);

            m_Utils.RestartService();
            m_Utils.ActivateContext(0);

            StackHashTestIndexData indexData = new StackHashTestIndexData();

            indexData.NumberOfProducts   = 1;
            indexData.NumberOfFiles      = 1;
            indexData.NumberOfEvents     = 200;
            indexData.NumberOfCabs       = 1;
            indexData.NumberOfEventInfos = 1;

            m_Utils.CreateTestIndex(0, indexData);

            try
            {
                StackHashProductInfoCollection  products = m_Utils.GetProducts(0).Products;
                StackHashFileCollection         files    = m_Utils.GetFiles(0, products[0].Product).Files;
                StackHashEventPackageCollection events   = m_Utils.GetProductEventPackages(0, products[0].Product).EventPackages;
                StackHashCabPackageCollection   cabs     = events[0].Cabs;

                StackHashBugReportDataCollection bugReportDataCollection = new StackHashBugReportDataCollection();
                bugReportDataCollection.Add(new StackHashBugReportData()
                {
                    Product    = products[0].Product,
                    File       = files[0],
                    TheEvent   = null,
                    Cab        = null,
                    ScriptName = null,
                    Options    = StackHashReportOptions.IncludeAllObjects
                });

                m_Utils.RunBugReportTask(0, bugReportDataCollection, 0, false); // Don't wait.
                m_Utils.WaitForBugReportProgress(30000);
                m_Utils.AbortTask(0, StackHashTaskType.BugReportTask);
                m_Utils.WaitForBugReportTaskCompleted(30000);

                // Check the progress reports.
                Assert.AreEqual(true, m_Utils.BugReportProgressReports.Count < 100);

                long lastProgress = -1;
                foreach (StackHashAdminReport report in m_Utils.BugReportProgressReports)
                {
                    StackHashBugReportProgressAdminReport progress = report as StackHashBugReportProgressAdminReport;

                    Assert.AreEqual(true, progress.CurrentEvent > lastProgress);
                    Assert.AreEqual(true, progress.CurrentEvent < progress.TotalEvents);
                    lastProgress = progress.CurrentEvent;
                }
            }
            finally
            {
                m_Utils.DeactivateContext(0);
                m_Utils.DeleteIndex(0);
            }
        }