Esempio n. 1
0
        /// <summary>
        /// Process a file table update. This may indicate a new item or the change to an existing item.
        /// </summary>
        private bool processFileUpdate(StackHashBugTrackerUpdate update)
        {
            // Get the associated product and file information.
            StackHashProduct product = m_Index.GetProduct((int)update.ProductId);
            StackHashFile    file    = m_Index.GetFile(product, (int)update.FileId);

            if (product == null)
            {
                DiagnosticsHelper.LogMessage(DiagSeverity.Warning, "Processing File: Inconsistent Update Table Entry = product not found: " + update.ProductId.ToString(CultureInfo.InvariantCulture));
                return(false);
            }
            if (file == null)
            {
                DiagnosticsHelper.LogMessage(DiagSeverity.Warning, "Processing File: Inconsistent Update Table Entry = file not found: " + update.FileId.ToString(CultureInfo.InvariantCulture));

                return(false);
            }

            BugTrackerProduct btProduct = new BugTrackerProduct(product.Name, product.Version, product.Id);
            BugTrackerFile    btFile    = new BugTrackerFile(file.Name, file.Version, file.Id);

            if (update.TypeOfChange == StackHashChangeType.NewEntry)
            {
                m_TaskParameters.PlugInContext.FileAdded(null, BugTrackerReportType.Automatic, btProduct, btFile);
            }
            else
            {
                m_TaskParameters.PlugInContext.FileUpdated(null, BugTrackerReportType.Automatic, btProduct, btFile);
            }

            return(true);
        }
Esempio n. 2
0
 /// <summary>
 /// Process a hit table update. This may indicate a new item or the change to an existing item.
 /// Not reported at present.
 /// </summary>
 private bool processHitUpdate(StackHashBugTrackerUpdate update)
 {
     if (update == null)
     {
         throw new ArgumentNullException("update");
     }
     return(true);
 }
Esempio n. 3
0
        /// <summary>
        /// Adds the specified number of Updates to the UpdateTable and then CLEARS them.
        /// </summary>
        public void addAndClearAllUpdates(int numUpdates, bool incrementIds)
        {
            // Create a clean index.
            m_Index = new SqlErrorIndex(StackHashSqlConfiguration.Default, SqlUtils.UnitTestDatabase, m_RootCabFolder);
            m_Index.DeleteIndex();
            m_Index.Activate();
            m_Index.UpdateTableActive = true;

            int    productId     = 11111111;
            int    fileId        = 22222222;
            int    eventId       = 33333333;
            String eventTypeName = "EventTypeName";
            int    componentId   = 44444444;

            // Check that no update exists.
            StackHashBugTrackerUpdate update = m_Index.GetFirstUpdate();

            Assert.AreEqual(null, update);

            List <StackHashBugTrackerUpdate> allUpdates = new List <StackHashBugTrackerUpdate>();

            for (int updateCount = 0; updateCount < numUpdates; updateCount++)
            {
                StackHashBugTrackerUpdate newUpdate = new StackHashBugTrackerUpdate()
                {
                    EntryId         = updateCount + 1,                  // This will be the expected entryid - this is an automatic update field in the database.
                    DateChanged     = DateTime.Now.RoundToNextSecond(), // Database dates are not as accurate as .NET dates.
                    DataThatChanged = StackHashDataChanged.Event,
                    TypeOfChange    = StackHashChangeType.NewEntry,
                    ProductId       = productId,
                    FileId          = fileId,
                    EventId         = eventId,
                    EventTypeName   = eventTypeName,
                    ChangedObjectId = componentId,
                };

                if (incrementIds)
                {
                    productId++;
                    fileId++;
                    eventId++;
                    componentId++;
                }


                m_Index.AddUpdate(newUpdate);

                allUpdates.Add(newUpdate);
            }

            m_Index.ClearAllUpdates();

            Assert.AreEqual(null, m_Index.GetFirstUpdate());
        }
Esempio n. 4
0
        /// <summary>
        /// Process a cab note table update. This may indicate a new item or the change to an existing item.
        /// </summary>
        private bool processCabNoteUpdate(StackHashBugTrackerUpdate update)
        {
            // Get the associated product and file information.
            StackHashProduct   product  = m_Index.GetProduct((int)update.ProductId);
            StackHashFile      file     = m_Index.GetFile(product, (int)update.FileId);
            StackHashEvent     theEvent = m_Index.GetEvent(product, file, new StackHashEvent((int)update.EventId, update.EventTypeName));
            StackHashCab       cab      = m_Index.GetCab(product, file, theEvent, (int)update.CabId);
            StackHashNoteEntry note     = m_Index.GetCabNote((int)update.ChangedObjectId);

            if ((product == null) || (file == null) || (theEvent == null) || (cab == null) || (note == null))
            {
                DiagnosticsHelper.LogMessage(DiagSeverity.Warning, "Processing Cab Note: Inconsistent Update Table Entry");
                return(false);
            }

            BugTrackerProduct   btProduct      = new BugTrackerProduct(product.Name, product.Version, product.Id);
            BugTrackerFile      btFile         = new BugTrackerFile(file.Name, file.Version, file.Id);
            NameValueCollection eventSignature = new NameValueCollection();

            foreach (StackHashParameter param in theEvent.EventSignature.Parameters)
            {
                eventSignature.Add(param.Name, param.Value);
            }

            BugTrackerEvent btEvent = new BugTrackerEvent(theEvent.BugId, theEvent.PlugInBugId, theEvent.Id, theEvent.EventTypeName,
                                                          theEvent.TotalHits, eventSignature);

            NameValueCollection analysis = new NameValueCollection();

            analysis.Add("DotNetVersion", cab.DumpAnalysis.DotNetVersion);
            analysis.Add("MachineArchitecture", cab.DumpAnalysis.MachineArchitecture);
            analysis.Add("OSVersion", cab.DumpAnalysis.OSVersion);
            analysis.Add("ProcessUpTime", cab.DumpAnalysis.ProcessUpTime);
            analysis.Add("SystemUpTime", cab.DumpAnalysis.SystemUpTime);

            String        cabFileName = m_Index.GetCabFileName(product, file, theEvent, cab);
            BugTrackerCab btCab       = new BugTrackerCab(cab.Id, cab.SizeInBytes, cab.CabDownloaded, cab.Purged, analysis, cabFileName);

            BugTrackerNote btCabNote = new BugTrackerNote(note.TimeOfEntry, note.Source, note.User, note.Note);

            String newBugId = null;

            if (update.TypeOfChange == StackHashChangeType.NewEntry)
            {
                newBugId = m_TaskParameters.PlugInContext.CabNoteAdded(null, BugTrackerReportType.Automatic, btProduct, btFile, btEvent, btCab, btCabNote);
            }

            setPlugInBugReference(product, file, theEvent, newBugId);

            return(true);
        }
Esempio n. 5
0
        /// <summary>
        /// Process an event note table update. This may indicate a new item or the change to an existing item.
        /// </summary>
        private bool processEventNoteUpdate(StackHashBugTrackerUpdate update)
        {
            // Get the associated product and file information.
            StackHashProduct   product  = m_Index.GetProduct((int)update.ProductId);
            StackHashFile      file     = m_Index.GetFile(product, (int)update.FileId);
            StackHashEvent     theEvent = m_Index.GetEvent(product, file, new StackHashEvent((int)update.EventId, update.EventTypeName));
            StackHashNoteEntry note     = m_Index.GetEventNote((int)update.ChangedObjectId);

            if ((product == null) || (file == null) || (theEvent == null) || (note == null))
            {
                DiagnosticsHelper.LogMessage(DiagSeverity.Warning, "Processing Event Note: Inconsistent Update Table Entry");
                return(false);
            }

            BugTrackerProduct   btProduct      = new BugTrackerProduct(product.Name, product.Version, product.Id);
            BugTrackerFile      btFile         = new BugTrackerFile(file.Name, file.Version, file.Id);
            NameValueCollection eventSignature = new NameValueCollection();

            foreach (StackHashParameter param in theEvent.EventSignature.Parameters)
            {
                eventSignature.Add(param.Name, param.Value);
            }

            BugTrackerEvent btEvent = new BugTrackerEvent(theEvent.BugId, theEvent.PlugInBugId, theEvent.Id, theEvent.EventTypeName,
                                                          theEvent.TotalHits, eventSignature);


            BugTrackerNote btEventNote = new BugTrackerNote(note.TimeOfEntry, note.Source, note.User, note.Note);

            String newBugId = null;

            if (update.TypeOfChange == StackHashChangeType.NewEntry)
            {
                newBugId = m_TaskParameters.PlugInContext.EventNoteAdded(null, BugTrackerReportType.Automatic, btProduct, btFile, btEvent, btEventNote);
            }

            setPlugInBugReference(product, file, theEvent, newBugId);

            return(true);
        }
Esempio n. 6
0
        /// <summary>
        /// Process a product table update. This may indicate a new item or the change to an existing item.
        /// </summary>
        private bool processProductUpdate(StackHashBugTrackerUpdate update)
        {
            // Get the associated product information.
            StackHashProduct product = m_Index.GetProduct((int)update.ProductId);

            if (product == null)
            {
                DiagnosticsHelper.LogMessage(DiagSeverity.Warning, "Processing Product: Inconsistent Update Table Entry");
                return(false);
            }

            BugTrackerProduct btProduct = new BugTrackerProduct(product.Name, product.Version, product.Id);

            if (update.TypeOfChange == StackHashChangeType.NewEntry)
            {
                m_TaskParameters.PlugInContext.ProductAdded(null, BugTrackerReportType.Automatic, btProduct);
            }
            else
            {
                m_TaskParameters.PlugInContext.ProductUpdated(null, BugTrackerReportType.Automatic, btProduct);
            }

            return(true);
        }
Esempio n. 7
0
        /// <summary>
        /// Process a debug script change.
        /// </summary>
        private bool processDebugScriptUpdate(StackHashBugTrackerUpdate update)
        {
            // Get the associated product and file information.
            StackHashProduct product  = m_Index.GetProduct((int)update.ProductId);
            StackHashFile    file     = m_Index.GetFile(product, (int)update.FileId);
            StackHashEvent   theEvent = m_Index.GetEvent(product, file, new StackHashEvent((int)update.EventId, update.EventTypeName));

            DiagnosticsHelper.LogMessage(DiagSeverity.Warning, "Processing Debug Script: getting cab data1");
            StackHashCab cab = m_Index.GetCab(product, file, theEvent, (int)update.CabId);

            DiagnosticsHelper.LogMessage(DiagSeverity.Warning, "Processing Debug Script: getting cab data2");
            StackHashNoteEntry note = m_Index.GetCabNote((int)update.ChangedObjectId);

            if ((product == null) || (file == null) || (theEvent == null) || (cab == null) || (note == null))
            {
                if (product == null)
                {
                    DiagnosticsHelper.LogMessage(DiagSeverity.Warning, "Processing Debug Script: Inconsistent Update Table Entry : product");
                }
                if (file == null)
                {
                    DiagnosticsHelper.LogMessage(DiagSeverity.Warning, "Processing Debug Script: Inconsistent Update Table Entry : file");
                }
                if (theEvent == null)
                {
                    DiagnosticsHelper.LogMessage(DiagSeverity.Warning, "Processing Debug Script: Inconsistent Update Table Entry : the Event");
                }
                if (cab == null)
                {
                    DiagnosticsHelper.LogMessage(DiagSeverity.Warning, "Processing Debug Script: Inconsistent Update Table Entry : cab: " + update.CabId.ToString(CultureInfo.InvariantCulture));
                }
                if (note == null)
                {
                    DiagnosticsHelper.LogMessage(DiagSeverity.Warning, "Processing Debug Script: Inconsistent Update Table Entry : note");
                }
                return(false);
            }

            BugTrackerProduct   btProduct      = new BugTrackerProduct(product.Name, product.Version, product.Id);
            BugTrackerFile      btFile         = new BugTrackerFile(file.Name, file.Version, file.Id);
            NameValueCollection eventSignature = new NameValueCollection();

            foreach (StackHashParameter param in theEvent.EventSignature.Parameters)
            {
                eventSignature.Add(param.Name, param.Value);
            }

            BugTrackerEvent btEvent = new BugTrackerEvent(theEvent.BugId, theEvent.PlugInBugId, theEvent.Id, theEvent.EventTypeName,
                                                          theEvent.TotalHits, eventSignature);

            NameValueCollection analysis = new NameValueCollection();

            analysis.Add("DotNetVersion", cab.DumpAnalysis.DotNetVersion);
            analysis.Add("MachineArchitecture", cab.DumpAnalysis.MachineArchitecture);
            analysis.Add("OSVersion", cab.DumpAnalysis.OSVersion);
            analysis.Add("ProcessUpTime", cab.DumpAnalysis.ProcessUpTime);
            analysis.Add("SystemUpTime", cab.DumpAnalysis.SystemUpTime);

            String        cabFileName = m_Index.GetCabFileName(product, file, theEvent, cab);
            BugTrackerCab btCab       = new BugTrackerCab(cab.Id, cab.SizeInBytes, cab.CabDownloaded, cab.Purged, analysis, cabFileName);

            BugTrackerNote btCabNote = new BugTrackerNote(note.TimeOfEntry, note.Source, note.User, note.Note);

            // A note entry will be written when a script is run. Pick out the name of the script.
            // Format is "Script {0} executed".
            int    startIndex = btCabNote.Note.IndexOf("Script ", StringComparison.OrdinalIgnoreCase) + "Script ".Length;
            int    endIndex   = btCabNote.Note.IndexOf("executed", StringComparison.OrdinalIgnoreCase) - 2;
            int    length     = endIndex - startIndex + 1;
            String scriptName = btCabNote.Note.Substring(startIndex, length);

            StackHashScriptResult stackHashScriptResult = m_TaskParameters.TheScriptResultsManager.GetResultFileData(product, file, theEvent, cab, scriptName);

            if (stackHashScriptResult == null)
            {
                return(false);
            }

            BugTrackerScriptResult btScriptResult = new BugTrackerScriptResult(stackHashScriptResult.Name, stackHashScriptResult.ScriptVersion,
                                                                               stackHashScriptResult.LastModifiedDate, stackHashScriptResult.RunDate, stackHashScriptResult.ToString());

            String newBugId = null;

            if (update.TypeOfChange == StackHashChangeType.NewEntry)
            {
                newBugId = m_TaskParameters.PlugInContext.DebugScriptExecuted(null, BugTrackerReportType.Automatic, btProduct, btFile, btEvent, btCab, btScriptResult);
            }
            setPlugInBugReference(product, file, theEvent, newBugId);

            return(true);
        }
Esempio n. 8
0
 public ErrorIndexEventArgs(StackHashBugTrackerUpdate changeInformation)
 {
     m_ChangeInformation = changeInformation;
 }
Esempio n. 9
0
 public void RemoveUpdate(StackHashBugTrackerUpdate update)
 {
     ;
 }
Esempio n. 10
0
 public void AddUpdate(StackHashBugTrackerUpdate update)
 {
     ;
 }