Ejemplo n.º 1
0
        public static RunDetails GetRunDetail(Guid maid, int runNumber)
        {
            string query  = $"<execution-history-req ma=\"{maid.ToMmsGuid()}\"><run-number>{runNumber}</run-number></execution-history-req>";
            string result = ws.GetExecutionHistory(query);

            SyncServer.ThrowExceptionOnReturnError(result);

            return(result != null?RunDetails.GetRunDetails(result).FirstOrDefault() : null);
        }
Ejemplo n.º 2
0
        public RunDetails GetLastRun()
        {
            string query = $"<execution-history-req ma=\"{this.ID.ToMmsGuid()}\"><num-req>1</num-req></execution-history-req>";

            string result = this.WebService.GetExecutionHistory(query);

            SyncServer.ThrowExceptionOnReturnError(result);

            if (result != null)
            {
                return(RunDetails.GetRunDetails(result).FirstOrDefault());
            }

            return(null);
        }
Ejemplo n.º 3
0
        public RunDetails GetRunDetail(int runNumber)
        {
            string query  = $"<execution-history-req ma=\"{this.ID.ToMmsGuid()}\"><run-number>{runNumber}</run-number></execution-history-req>";
            string result = this.WebService.GetExecutionHistory(query);

            SyncServer.ThrowExceptionOnReturnError(result);

            if (result != null)
            {
                return(RunDetails.GetRunDetails(result).FirstOrDefault());
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        public IEnumerable <RunDetails> GetRunHistory(int count)
        {
            if (count <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(count), "Run history count must be greater than zero");
            }

            string query = $"<execution-history-req ma=\"{this.ID.ToMmsGuid()}\"><num-req>{count}</num-req></execution-history-req>";

            string result = this.WebService.GetExecutionHistory(query);

            SyncServer.ThrowExceptionOnReturnError(result);

            if (result != null)
            {
                return(RunDetails.GetRunDetails(result));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
        public static void SaveRunHistory(DateTime beforeDate, string filename)
        {
            XmlDocument doc    = new XmlDocument();
            XmlElement  parent = doc.CreateElement("execution-histories");
            int         count  = 0;

            foreach (RunSummary item in SyncServer.GetRunSummary())
            {
                if (!item.StartTime.HasValue || !item.EndTime.HasValue)
                {
                    continue;
                }

                if (item.EndTime < beforeDate)
                {
                    count++;
                    RunDetails d = SyncServer.GetRunDetail(item);
                    parent.AppendChild(doc.ImportNode(d.XmlNode, true));
                }
            }

            doc.AppendChild(parent);

            if (count == 0)
            {
                return;
            }

            using (XmlWriter w = XmlWriter.Create(filename, new XmlWriterSettings()
            {
                Indent = true
            }))
            {
                doc.WriteTo(w);
                w.Close();
            }
        }