예제 #1
0
        public static StackHashEventCollection GetEventsApi(ref Login login, ApplicationFile file, out List <Event> rawEvents, DateTime startTime)
        {
            EventPageReader          eventPageReader    = file.GetEvents(startTime); // Get all events.
            StackHashEventCollection apiStackHashEvents = new StackHashEventCollection();

            rawEvents = new List <Event>();

            // Read each page of new events.
            while (eventPageReader.Read(ref login) == true)
            {
                // Get the events for the page.
                EventReader events = eventPageReader.Events;

                while (events.Read() == true)
                {
                    // Get the event
                    Event dpEvent = events.Event;
                    rawEvents.Add(dpEvent);
                    StackHashEvent stackHashEvent = ObjectConversion.ConvertEvent(dpEvent, file.ID);


                    apiStackHashEvents.Add(stackHashEvent);
                }
            }
            return(apiStackHashEvents);
        }
예제 #2
0
        public static StackHashEventCollection GetEventsAtom(AtomFeed feed, AtomFile file, DateTime startTime)
        {
            // Get the list of events.
            AtomEventCollection atomEvents = feed.GetEvents(file, startTime);

            // Convert to a StackHashEventCollection.
            StackHashEventCollection atomStackHashEvents = new StackHashEventCollection();

            foreach (AtomEvent atomEvent in atomEvents)
            {
                atomStackHashEvents.Add(atomEvent.Event);
            }

            return(atomStackHashEvents);
        }
예제 #3
0
        /// <summary>
        /// Gets the File event data associated with a particular product file.
        /// </summary>
        /// <returns>Response result code.</returns>
        public GetEventsResponse GetEvents(GetEventsRequest requestData)
        {
            if (requestData == null)
            {
                throw new ArgumentNullException("requestData");
            }

            GetEventsResponse resp = new GetEventsResponse();

            StackHashEventCollection events =
                StaticObjects.TheStaticObjects.TheController.GetEvents(
                    requestData.ContextId, requestData.Product, requestData.File);

            resp.Events = events;

            resp.ResultData = new StackHashServiceResultData(
                StackHashServiceResult.Success, s_OperationSuccessful, null);

            return(resp);
        }
예제 #4
0
        /// <summary>
        /// Parses the database looking for cabs to unwrap.
        /// </summary>
        private void analyzeAllCabs()
        {
            IErrorIndex index = m_TaskParameters.ErrorIndex;

            // Get a list of products.
            StackHashProductCollection products = index.LoadProductList();

            foreach (StackHashProduct product in products)
            {
                if (CurrentTaskState.AbortRequested)
                {
                    throw new OperationCanceledException("Task aborted");
                }

                if (!shouldProcessProduct(product))
                {
                    continue;
                }

                // Get the file list.
                StackHashFileCollection files = index.LoadFileList(product);

                foreach (StackHashFile file in files)
                {
                    if (CurrentTaskState.AbortRequested)
                    {
                        throw new OperationCanceledException("Task aborted");
                    }

                    if (!shouldProcessFile(product, file))
                    {
                        continue;
                    }

                    // Get the event data.
                    StackHashEventCollection events = index.LoadEventList(product, file);

                    foreach (StackHashEvent theEvent in events)
                    {
                        if (CurrentTaskState.AbortRequested)
                        {
                            throw new OperationCanceledException("Task aborted");
                        }

                        if (!shouldProcessEvent(product, file, theEvent))
                        {
                            continue;
                        }

                        StackHashCabCollection cabs = index.LoadCabList(product, file, theEvent);

                        // Process each cab.
                        foreach (StackHashCab cab in cabs)
                        {
                            if (CurrentTaskState.AbortRequested)
                            {
                                throw new OperationCanceledException("Task aborted");
                            }

                            if (!shouldProcessCab(product, file, theEvent, cab))
                            {
                                continue;
                            }

                            processCab(product, file, theEvent, cab);
                        }
                    }
                }
            }
        }
예제 #5
0
        public void runAnalyzeJustAutoScripts(ErrorIndexType indexType, int numberOfProducts, int numberOfFiles, int numberOfEvents, int numberOfCabs,
                                              int numberOfAutoUnmanagedAndManagedScripts, int numberOfManualUnmanagedAndManagedScripts,
                                              bool useUnmanagedCabs, int numberOfAutoManagedScripts, int numberOfManualManagedScripts,
                                              int numberOfAutoUnmanagedScripts, int numberOfManualUnmanagedScripts)
        {
            int numberOfEventInfos = 1;

            // Use the dummy winqual.

            StackHashTestData testData = new StackHashTestData();

            testData.DummyWinQualSettings = new StackHashTestDummyWinQualSettings();
            testData.DummyWinQualSettings.UseDummyWinQual                    = true;
            testData.DummyWinQualSettings.ObjectsToCreate                    = new StackHashTestIndexData();
            testData.DummyWinQualSettings.ObjectsToCreate.UseLargeCab        = false;
            testData.DummyWinQualSettings.ObjectsToCreate.NumberOfProducts   = numberOfProducts;
            testData.DummyWinQualSettings.ObjectsToCreate.NumberOfFiles      = numberOfFiles;
            testData.DummyWinQualSettings.ObjectsToCreate.NumberOfEvents     = numberOfEvents;
            testData.DummyWinQualSettings.ObjectsToCreate.NumberOfEventInfos = numberOfEventInfos;
            testData.DummyWinQualSettings.ObjectsToCreate.NumberOfCabs       = numberOfCabs;
            testData.DummyWinQualSettings.ObjectsToCreate.UseUnmanagedCab    = useUnmanagedCabs;

            m_Utils.SetTestData(testData);

            m_Utils.RegisterForNotifications(true, m_Utils.ApplicationGuid);
            m_Utils.CreateNewContext(indexType);

            // Set the username and password to something valid.
            GetStackHashPropertiesResponse settings = m_Utils.GetContextSettings();

            String testPath = "c:\\stackhashunittest\\testindex\\";

            settings.Settings.ContextCollection[0].ErrorIndexSettings.Folder = testPath;
            settings.Settings.ContextCollection[0].ErrorIndexSettings.Name   = "TestIndex";
            settings.Settings.ContextCollection[0].WinQualSettings.UserName  = m_UserName;
            settings.Settings.ContextCollection[0].WinQualSettings.Password  = m_Password;
            m_Utils.SetContextSettings(settings.Settings.ContextCollection[0]);

            // Make sure the index starts off empty.
            m_Utils.DeleteIndex(0);

            m_Utils.ActivateContext(0);

            for (int i = 0; i < numberOfAutoUnmanagedAndManagedScripts; i++)
            {
                StackHashScriptSettings scriptSettings = m_Utils.MakeScriptSettings(i, true, StackHashScriptDumpType.UnmanagedAndManaged, true);
                m_Utils.AddDebuggerScript(scriptSettings, false);
            }

            for (int i = 0; i < numberOfManualUnmanagedAndManagedScripts; i++)
            {
                StackHashScriptSettings scriptSettings = m_Utils.MakeScriptSettings(i + 100, true, StackHashScriptDumpType.UnmanagedAndManaged, false);
                m_Utils.AddDebuggerScript(scriptSettings, false);
            }

            for (int i = 0; i < numberOfAutoManagedScripts; i++)
            {
                StackHashScriptSettings scriptSettings = m_Utils.MakeScriptSettings(i + 200, true, StackHashScriptDumpType.ManagedOnly, true);
                m_Utils.AddDebuggerScript(scriptSettings, false);
            }

            for (int i = 0; i < numberOfManualManagedScripts; i++)
            {
                StackHashScriptSettings scriptSettings = m_Utils.MakeScriptSettings(i + 300, true, StackHashScriptDumpType.ManagedOnly, false);
                m_Utils.AddDebuggerScript(scriptSettings, false);
            }

            for (int i = 0; i < numberOfAutoUnmanagedScripts; i++)
            {
                StackHashScriptSettings scriptSettings = m_Utils.MakeScriptSettings(i + 400, true, StackHashScriptDumpType.UnmanagedOnly, true);
                m_Utils.AddDebuggerScript(scriptSettings, false);
            }

            for (int i = 0; i < numberOfManualUnmanagedScripts; i++)
            {
                StackHashScriptSettings scriptSettings = m_Utils.MakeScriptSettings(i + 500, true, StackHashScriptDumpType.UnmanagedOnly, false);
                m_Utils.AddDebuggerScript(scriptSettings, false);
            }

            try
            {
                // Synchronize so we have a copy of just the product list.
                StartSynchronizationResponse resp = m_Utils.StartSynchronization(0, 60000);

                StackHashClientData clientData = m_Utils.LastClientData;

                StackHashWinQualSyncCompleteAdminReport adminReport = m_Utils.WinQualSyncAdminReport as StackHashWinQualSyncCompleteAdminReport;
                Assert.AreNotEqual(null, adminReport);
                Assert.AreEqual(clientData.ApplicationGuid, adminReport.ClientData.ApplicationGuid);
                Assert.AreEqual(clientData.ClientId, adminReport.ClientData.ClientId);
                Assert.AreEqual(clientData.ClientName, adminReport.ClientData.ClientName);
                Assert.AreEqual(clientData.ClientRequestId, adminReport.ClientData.ClientRequestId);
                Assert.AreEqual(0, adminReport.ContextId);
                Assert.AreEqual(null, adminReport.LastException);
                Assert.AreEqual(StackHashAdminOperation.WinQualSyncCompleted, adminReport.Operation);
                Assert.AreEqual(StackHashAsyncOperationResult.Success, adminReport.ResultData);
                Assert.AreEqual(numberOfProducts, adminReport.ErrorIndexStatistics.Products);
                Assert.AreEqual(0, adminReport.ErrorIndexStatistics.Files);
                Assert.AreEqual(0, adminReport.ErrorIndexStatistics.Events);
                Assert.AreEqual(0, adminReport.ErrorIndexStatistics.Cabs);
                Assert.AreEqual(0, adminReport.ErrorIndexStatistics.EventInfos);


                // Enable sync for all the products.
                GetProductsResponse getProducts = m_Utils.GetProducts(0);


                foreach (StackHashProductInfo productInfo in getProducts.Products)
                {
                    Assert.AreEqual(false, productInfo.SynchronizeEnabled);
                    m_Utils.SetProductSynchronizationState(0, productInfo.Product.Id, true);

                    // Make sure there are no files for this product yet.
                    GetFilesResponse getFiles = m_Utils.GetFiles(0, productInfo.Product);

                    Assert.AreEqual(0, getFiles.Files.Count);
                }

                // Start the sync and wait for the sync and analyze to complete.
                resp = m_Utils.StartSynchronization(0, 120000, false, false, null);

                clientData = m_Utils.LastClientData;

                adminReport = m_Utils.WinQualSyncAdminReport as StackHashWinQualSyncCompleteAdminReport;
                Assert.AreNotEqual(null, adminReport);
                Assert.AreEqual(clientData.ApplicationGuid, adminReport.ClientData.ApplicationGuid);
                Assert.AreEqual(clientData.ClientId, adminReport.ClientData.ClientId);
                Assert.AreEqual(clientData.ClientName, adminReport.ClientData.ClientName);
                Assert.AreEqual(clientData.ClientRequestId, adminReport.ClientData.ClientRequestId);
                Assert.AreEqual(0, adminReport.ContextId);
                Assert.AreEqual(null, adminReport.LastException);
                Assert.AreEqual(StackHashAdminOperation.WinQualSyncCompleted, adminReport.Operation);
                Assert.AreEqual(StackHashAsyncOperationResult.Success, adminReport.ResultData);
                Assert.AreEqual(0, adminReport.ErrorIndexStatistics.Products); // Should have already added the product.
                Assert.AreEqual(numberOfFiles * numberOfProducts, adminReport.ErrorIndexStatistics.Files);
                Assert.AreEqual(numberOfEvents * numberOfFiles * numberOfProducts, adminReport.ErrorIndexStatistics.Events);
                Assert.AreEqual(numberOfCabs * numberOfEvents * numberOfFiles * numberOfProducts, adminReport.ErrorIndexStatistics.Cabs);
                Assert.AreEqual(numberOfEventInfos * numberOfEvents * numberOfFiles * numberOfProducts, adminReport.ErrorIndexStatistics.EventInfos);

                // Make sure the task is no longer running.
                GetStackHashServiceStatusResponse statusResp = m_Utils.GetServiceStatus();

                Assert.AreEqual(false, m_Utils.IsTaskRunning(statusResp.Status.ContextStatusCollection[0].TaskStatusCollection, StackHashTaskType.WinQualSynchronizeTask));
                Assert.AreEqual(false, m_Utils.IsTaskRunning(statusResp.Status.ContextStatusCollection[0].TaskStatusCollection, StackHashTaskType.AnalyzeTask));


                // Check that the scripts have been run ok. Both auto scripts should be run.
                StackHashProductInfoCollection products = m_Utils.GetProducts(0).Products;
                foreach (StackHashProductInfo product in products)
                {
                    StackHashFileCollection files = m_Utils.GetFiles(0, product.Product).Files;

                    foreach (StackHashFile file in files)
                    {
                        StackHashEventCollection events = m_Utils.GetEvents(0, product.Product, file).Events;

                        foreach (StackHashEvent currentEvent in events)
                        {
                            StackHashEventPackage eventPackage = m_Utils.GetEventPackage(0, product.Product, file, currentEvent).EventPackage;

                            foreach (StackHashCabPackage cab in eventPackage.Cabs)
                            {
                                StackHashScriptResultFiles scriptResults = m_Utils.GetDebugResultFiles(0, product.Product, file, currentEvent, cab.Cab).ResultFiles;

                                int numberOfAutoScripts = 2;
                                int expectedResults     = numberOfAutoScripts + numberOfAutoUnmanagedAndManagedScripts;

                                if (!useUnmanagedCabs)
                                {
                                    expectedResults += numberOfAutoManagedScripts;
                                }
                                else
                                {
                                    expectedResults += numberOfAutoUnmanagedScripts;
                                }

                                Assert.AreEqual(expectedResults, scriptResults.Count);
                            }
                        }
                    }
                }
            }
            finally
            {
                m_Utils.DeactivateContext(0);
                m_Utils.DeleteIndex(0);
            }
        }
예제 #6
0
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        public void addRemoveEventNotes(int numberOfNotes)
        {
            StackHashTestIndexData testIndexData = new StackHashTestIndexData();

            testIndexData.NumberOfProducts   = 1;
            testIndexData.NumberOfFiles      = 1;
            testIndexData.NumberOfEvents     = 1;
            testIndexData.NumberOfEventInfos = 0;
            testIndexData.NumberOfCabs       = 0;

            // Add a context.
            CreateNewStackHashContextResponse resp = m_Utils.CreateNewContext(ErrorIndexType.SqlExpress);

            String testPath = "c:\\stackhashunittests\\testindex\\";

            resp.Settings.ErrorIndexSettings.Folder = testPath;
            resp.Settings.ErrorIndexSettings.Name   = "TestIndex";
            resp.Settings.ErrorIndexSettings.Type   = ErrorIndexType.SqlExpress;
            m_Utils.SetContextSettings(resp.Settings);
            m_Utils.DeleteIndex(0);
            m_Utils.ActivateContext(0);

            m_Utils.CreateTestIndex(0, testIndexData);

            try
            {
                // Enable all products so that they appear in searchs.
                StackHashProductInfoCollection products = m_Utils.GetProducts(0).Products;
                StackHashProduct         product        = products[0].Product;
                StackHashFileCollection  files          = m_Utils.GetFiles(0, product).Files;
                StackHashEventCollection events         = m_Utils.GetEvents(0, product, files[0]).Events;


                // Add the specified number of event notes.
                for (int eventCount = 0; eventCount < numberOfNotes; eventCount++)
                {
                    StackHashNoteEntry note = new StackHashNoteEntry();
                    note.Note        = "Note" + (eventCount + 1).ToString();
                    note.Source      = "USER";
                    note.User        = "******";
                    note.TimeOfEntry = DateTime.Now.AddDays(-1);

                    m_Utils.AddEventNote(0, product, files[0], events[0], note);

                    StackHashNotes notes = m_Utils.GetEventNotes(0, product, files[0], events[0]).Notes;

                    Assert.AreEqual(eventCount + 1, notes.Count);
                    bool found = false;
                    foreach (StackHashNoteEntry noteEntry in notes)
                    {
                        if (noteEntry.NoteId == eventCount + 1)
                        {
                            Assert.AreEqual(note.Note, noteEntry.Note);
                            Assert.AreEqual(note.Source, noteEntry.Source);
                            Assert.AreEqual(note.User, noteEntry.User);
                            Assert.AreEqual(DateTime.UtcNow.Date, noteEntry.TimeOfEntry.Date);
                            found = true;
                            break;
                        }
                    }

                    Assert.AreEqual(true, found);
                }

                // Now delete the event notes.
                int expectedEventNotes = numberOfNotes;

                for (int eventCount = 0; eventCount < numberOfNotes; eventCount++)
                {
                    m_Utils.DeleteEventNote(0, product, files[0], events[0], eventCount + 1);

                    expectedEventNotes--;

                    StackHashNotes notes = m_Utils.GetEventNotes(0, product, files[0], events[0]).Notes;

                    Assert.AreEqual(expectedEventNotes, notes.Count);

                    bool found = false;
                    foreach (StackHashNoteEntry noteEntry in notes)
                    {
                        if (noteEntry.NoteId == eventCount + 1)
                        {
                            found = true;
                            break;
                        }
                    }

                    Assert.AreEqual(false, found);
                }
            }
            finally
            {
                m_Utils.DeactivateContext(0);
                m_Utils.DeleteIndex(0);
            }
        }
예제 #7
0
        public void AutoScriptOnOneCabAlreadyRunButNewerVersion()
        {
            // If the auto task sees the AutoScript.log file exists and has the same
            // version as the current AutoScript.xml then it shouldn't run it again.
            // Determine this by checking the file time after a second run.

            // Create an index with 1 cab file.
            XmlErrorIndex errorIndex = new XmlErrorIndex(m_TempPath, "ErrorIndex");

            errorIndex.Activate();

            StackHashTestIndexData testData = new StackHashTestIndexData();

            testData.NumberOfProducts   = 1;
            testData.NumberOfFiles      = 1;
            testData.NumberOfEvents     = 1;
            testData.NumberOfEventInfos = 1;
            testData.NumberOfCabs       = 1;
            testData.UseLargeCab        = false;
            TestManager.CreateTestIndex(errorIndex, testData);



            ScriptManager scriptManager = new ScriptManager(m_TempPath + "Scripts");

            Assert.AreEqual(scriptManager.NumberOfAutoScripts, scriptManager.ScriptNames.Count);

            ScriptResultsManager scriptResultsManager = new ScriptResultsManager(errorIndex, scriptManager, m_Debugger, m_DebuggerSettings);

            // Set up parameters for the task.
            AnalyzeTaskParameters analyzeParams = new AnalyzeTaskParameters();

            // Standard task parameters.
            analyzeParams.IsBackgroundTask            = true;
            analyzeParams.Name                        = "TestRunOneTask";
            analyzeParams.RunInParallel               = false;
            analyzeParams.UseSeparateThread           = true;
            analyzeParams.AnalysisSettings            = new StackHashAnalysisSettings();
            analyzeParams.AnalysisSettings.ForceRerun = true;
            analyzeParams.ContextId                   = 0;
            analyzeParams.ClientData                  = new StackHashClientData(Guid.NewGuid(), "MarkJ", 1);
            analyzeParams.Debugger                    = m_Debugger;
            analyzeParams.DebuggerSettings            = m_DebuggerSettings;
            analyzeParams.TheScriptManager            = scriptManager;
            analyzeParams.TheScriptResultsManager     = scriptResultsManager;
            int productId = 1;

            analyzeParams.ProductsToSynchronize = new StackHashProductSyncDataCollection();
            analyzeParams.ProductsToSynchronize.Add(new StackHashProductSyncData(productId));

            analyzeParams.ErrorIndex = errorIndex;

            // Create the task and run it.
            AnalyzeTask analyzeTask = new AnalyzeTask(analyzeParams);
            TaskManager taskManager = new TaskManager("Test");

            taskManager.Enqueue(analyzeTask);
            taskManager.WaitForTaskCompletion(analyzeTask, s_TaskTimeout);


            StackHashProductCollection products = errorIndex.LoadProductList();
            StackHashFileCollection    files    = errorIndex.LoadFileList(products[0]);
            StackHashEventCollection   events   = errorIndex.LoadEventList(products[0], files[0]);
            StackHashCabCollection     cabs     = errorIndex.LoadCabList(products[0], files[0], events[0]);

            StackHashScriptResult script1 = scriptResultsManager.GetResultFileData(products[0], files[0], events[0], cabs[0], "AutoScript");

            // Wait for 1 second - so file time granularity exceeded.
            Thread.Sleep(1000);

            // Change the version on the autoscript.
            StackHashScriptSettings settings = scriptManager.LoadScript("AutoScript");

            settings.LastModifiedDate = DateTime.Now;
            scriptManager.AddScript(settings, true, true);

            // Now run the task again.
            analyzeTask = new AnalyzeTask(analyzeParams);
            taskManager.Enqueue(analyzeTask);
            taskManager.WaitForTaskCompletion(analyzeTask, s_TaskTimeout);


            Assert.AreEqual(true, analyzeTask.CurrentTaskState.TaskCompleted);

            // Refresh the cab list data.
            cabs = errorIndex.LoadCabList(products[0], files[0], events[0]);

            StackHashDumpAnalysis analysis = cabs[0].DumpAnalysis;

            Assert.AreEqual("not available", analysis.SystemUpTime);
            Assert.AreEqual("0 days 0:00:15.000", analysis.ProcessUpTime);
            Assert.AreEqual("2.0.50727.3603", analysis.DotNetVersion);


            StackHashScriptResult script2 = scriptResultsManager.GetResultFileData(products[0], files[0], events[0], cabs[0], "AutoScript");

            Assert.AreEqual(true, script2.RunDate > script1.RunDate);
        }
예제 #8
0
        public void AutoScriptOnOneCabProductNotEnabled()
        {
            // Create an index with 1 cab file.
            XmlErrorIndex errorIndex = new XmlErrorIndex(m_TempPath, "ErrorIndex");

            errorIndex.Activate();

            StackHashTestIndexData testData = new StackHashTestIndexData();

            testData.NumberOfProducts   = 1;
            testData.NumberOfFiles      = 1;
            testData.NumberOfEvents     = 1;
            testData.NumberOfEventInfos = 1;
            testData.NumberOfCabs       = 1;
            testData.UseLargeCab        = false;
            TestManager.CreateTestIndex(errorIndex, testData);


            ScriptManager scriptManager = new ScriptManager(m_TempPath + "Scripts");

            Assert.AreEqual(scriptManager.NumberOfAutoScripts, scriptManager.ScriptNames.Count);

            ScriptResultsManager scriptResultsManager = new ScriptResultsManager(errorIndex, scriptManager, m_Debugger, m_DebuggerSettings);

            // Set up parameters for the task.
            AnalyzeTaskParameters analyzeParams = new AnalyzeTaskParameters();

            // Standard task parameters.
            analyzeParams.IsBackgroundTask            = true;
            analyzeParams.Name                        = "TestRunOneTask";
            analyzeParams.RunInParallel               = false;
            analyzeParams.UseSeparateThread           = true;
            analyzeParams.AnalysisSettings            = new StackHashAnalysisSettings();
            analyzeParams.AnalysisSettings.ForceRerun = true;
            analyzeParams.ContextId                   = 0;
            analyzeParams.ClientData                  = new StackHashClientData(Guid.NewGuid(), "MarkJ", 1);
            analyzeParams.Debugger                    = m_Debugger;
            analyzeParams.DebuggerSettings            = m_DebuggerSettings;
            analyzeParams.TheScriptManager            = scriptManager;
            analyzeParams.TheScriptResultsManager     = scriptResultsManager;
            analyzeParams.ProductsToSynchronize       = new StackHashProductSyncDataCollection();

            analyzeParams.ErrorIndex = errorIndex;

            // Create the task and run it.
            AnalyzeTask analyzeTask = new AnalyzeTask(analyzeParams);
            TaskManager taskManager = new TaskManager("Test");

            taskManager.Enqueue(analyzeTask);

            taskManager.WaitForTaskCompletion(analyzeTask, s_TaskTimeout);

            Assert.AreEqual(true, analyzeTask.CurrentTaskState.TaskCompleted);

            StackHashProductCollection products = errorIndex.LoadProductList();
            StackHashFileCollection    files    = errorIndex.LoadFileList(products[0]);
            StackHashEventCollection   events   = errorIndex.LoadEventList(products[0], files[0]);
            StackHashCabCollection     cabs     = errorIndex.LoadCabList(products[0], files[0], events[0]);

            StackHashDumpAnalysis analysis = cabs[0].DumpAnalysis;

            Assert.AreEqual(null, analysis.DotNetVersion);
            Assert.AreEqual(null, analysis.MachineArchitecture);
            Assert.AreEqual(null, analysis.OSVersion);
            Assert.AreEqual(null, analysis.ProcessUpTime);
            Assert.AreEqual(null, analysis.SystemUpTime);
        }
예제 #9
0
        public void GetEventsStartDate()
        {
            DateTime startTime = DateTime.Now.AddMonths(-1);

            AtomFeed atomFeed = new AtomFeed(null, 1, 100000, false, false, null, 11);

            // ATOM LOGIN.
            Assert.AreEqual(true, atomFeed.Login(TestSettings.WinQualUserName, TestSettings.WinQualPassword));

            // ATOM GetProducts.
            AtomProductCollection atomProducts = atomFeed.GetProducts();


            // WERAPI Login.
            Login login = new Login(TestSettings.WinQualUserName, TestSettings.WinQualPassword);

            login.Validate();

            // WERAPI GetProducts.
            ProductCollection apiProducts = Product.GetProducts(ref login);

            Assert.AreEqual(atomProducts.Count, apiProducts.Count);

            bool eventListsDifferent = false;

            foreach (AtomProduct atomProduct in atomProducts)
            {
                // ATOM GetFiles.
                AtomFileCollection atomFiles = atomFeed.GetFiles(atomProduct);

                // API GetFiles
                Product apiProduct = Utils.FindProduct(apiProducts, atomProduct.Product.Id);
                ApplicationFileCollection apiFiles = apiProduct.GetApplicationFiles(ref login);

                Assert.AreEqual(atomFiles.Count, apiFiles.Count);

                foreach (AtomFile atomFile in atomFiles)
                {
                    ApplicationFile apiFile = Utils.FindFile(apiFiles, atomFile.File.Id);

                    // ATOM GetEvents.
                    StackHashEventCollection atomStackHashEvents       = Utils.GetEventsAtom(atomFeed, atomFile, startTime);
                    StackHashEventCollection atomStackHashEventsNoTime = Utils.GetEventsAtom(atomFeed, atomFile);

                    if (atomStackHashEvents.Count != atomStackHashEventsNoTime.Count)
                    {
                        eventListsDifferent = true;
                    }

                    // WERAPI GetEvents.
                    List <Event>             rawApiEvents;
                    StackHashEventCollection apiStackHashEvents = Utils.GetEventsApi(ref login, apiFile, out rawApiEvents, startTime);

                    Assert.AreEqual(apiStackHashEvents.Count, atomStackHashEvents.Count);

                    foreach (StackHashEvent stackHashEvent in atomStackHashEvents)
                    {
                        // Find the equivalent event in the api file list.
                        StackHashEvent apiEvent = apiStackHashEvents.FindEvent(stackHashEvent.Id, stackHashEvent.EventTypeName);

                        Assert.AreNotEqual(null, apiEvent);

                        Assert.AreEqual(true, stackHashEvent.CompareTo(apiEvent) == 0);
                    }
                }
            }

            Assert.AreEqual(true, eventListsDifferent);
        }