/// <summary> /// /// </summary> public void ProcessXmlFile(object qaSystemMainThread) { try { QASystem qa = new QASystem("TDSQC", "TDSQC"); XmlDocument xml = null; try { xml = new BL.XmlRepository(QASystemConfigSettings.Instance.LongDbCommandTimeout).ProcessXmlFile(xmlRepositoryItem.FileID); } catch (Exception ex) { throw new QAException(String.Format("Error reading XML file for FileID: {0} from XmlRepository: {1}", xmlRepositoryItem.FileID, ex.Message), QAException.ExceptionType.General); } if (xml == null) { // must have been a race condition with another worker thread. // Just log and skip. Utilities.Logger.Log(true, String.Format("FileID: {0} for OppID: {1}, TesteeKey: {2} was not available to be processed. Skipping...", xmlRepositoryItem.FileID, xmlRepositoryItem.OppID, xmlRepositoryItem.TesteeKey), EventLogEntryType.Information, false, true); } else { // Process file... qa.ReceiveTestResult(xml, xmlRepositoryItem); ((QASystemMainThread)qaSystemMainThread).filesPerSecond.Increment(); //((QASystemMainThread)qaSystemMainThread).totalFilesProcessedToday.Increment(); } } catch (QAException ex) { Logger.Log(true, "Processing file " + xmlRepositoryItem.FileID + " failed because " + ex.Message + ex.StackTrace, EventLogEntryType.Error, true, true); } catch (Exception e) { Logger.Log(true, "General Exception for file " + xmlRepositoryItem.FileID + ": " + e.Message + e.StackTrace, EventLogEntryType.Error, true, true); } finally { if (qaSystemMainThread != null) { ((QASystemMainThread)qaSystemMainThread).DecrementCounter(); ((QASystemMainThread)qaSystemMainThread).UnlockOpp(xmlRepositoryItem); } else { throw new QAException(Messages.NullParameterProvided + qaSystemMainThread, QAException.ExceptionType.General); } } }
/// <summary> /// Use this constructor to instantiate from the windows application and to start the multiple threads. /// </summary> /// <param name="startThreads"></param> public QASystemMainThread() { InitializeServices(); Utilities.Logger.Log(true, "Initializing the QASystem", EventLogEntryType.Information, false, true); QASystem qa = new QASystem("TDSQC", "TDSQC"); //TODO: also make QASystemConfigSettings pluggable xmlRepositoryBL = new BL.XmlRepository(QASystemConfigSettings.Instance.LongDbCommandTimeout); Utilities.Logger.Log(true, "Initialized the QASystem", EventLogEntryType.Information, false, true); generalThreadCounter = 0; // Create performance counter category if it doesn't exist and add counters to it... if (!PerformanceCounterCategory.Exists("TDS QA System")) { // Create the collection container CounterCreationDataCollection counters = new CounterCreationDataCollection(); CounterCreationData threadCount = new CounterCreationData(); threadCount.CounterName = "Total Active Thread Count"; threadCount.CounterType = PerformanceCounterType.NumberOfItems32; counters.Add(threadCount); CounterCreationData filesPerSec = new CounterCreationData(); filesPerSec.CounterName = "Files Processed per second"; filesPerSec.CounterType = PerformanceCounterType.RateOfCountsPerSecond32; counters.Add(filesPerSec); CounterCreationData totalFilesProcessedSinceLastRestart = new CounterCreationData(); totalFilesProcessedSinceLastRestart.CounterName = "Total Files Processed Since Last Restart"; totalFilesProcessedSinceLastRestart.CounterType = PerformanceCounterType.NumberOfItems32; counters.Add(totalFilesProcessedSinceLastRestart); // Create the category and all of the counters. PerformanceCounterCategory.Create("TDS QA System", "Measures productivity of the QA System windows service.", PerformanceCounterCategoryType.SingleInstance, counters); } // Initialize performance counters... activeThreadCount = new PerformanceCounter("TDS QA System", "Total Active Thread Count", false); activeThreadCount.MachineName = "."; filesPerSecond = new PerformanceCounter("TDS QA System", "Files Processed per second", false); filesPerSecond.MachineName = "."; //totalFilesProcessedToday = new PerformanceCounter("TDS QA System", "Total Files Processed Since Last Restart", false); //totalFilesProcessedToday.MachineName = "."; //totalFilesProcessedToday.RawValue = 0; DateTime todaysDate = DateTime.Now; string client = QASystemConfigSettings.Instance.Client; string environment = QASystemConfigSettings.Instance.Environment; timeToSendWarnings = TimeSpan.FromHours(QASystemConfigSettings.Instance.HourToSendWarningSummary); sentWarnings = false; Utilities.Logger.Log(true, "Initialized the QASystemMainThread", EventLogEntryType.Information, false, true); }
public void PostSave(QASystem tis, TestResult tr, XmlRepositoryItem xmlRepoItem, ProjectMetaData projectMetaData, ITISExtenderState state) { // do nothing }
public void PreRoute(QASystem tis, XMLAdapter adapter, TestResult tr, XmlRepositoryItem xmlRepoItem, ProjectMetaData projectMetaData, SendToModifiers sendToModifiers, ITISExtenderState state) { // do nothing }
public List <ValidationRecord> Validate(QASystem tis, TestResult tr, XmlRepositoryItem xmlRepoItem, ProjectMetaData projectMetaData, ITISExtenderState state, out bool isFatal, out SendToModifiers sendToModifiers) { isFatal = false; sendToModifiers = new SendToModifiers(); return(new List <ValidationRecord>()); }
public bool ShouldScore(QASystem tis, XMLAdapter adapter, TestResult tr, ProjectMetaData projectMetaData, ITISExtenderState state) { return(true); }