Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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);
            }
        }