Пример #1
0
        /// <summary>
        /// Maps the specified XML.
        /// </summary>
        /// <param name="xml">The XML.</param>
        /// <returns></returns>
        public Job Map(XmlDocument xml)
        {
            Job job = null;

            if (xml != null)
            {
                job = new Job
                {
                    Name = xml.Find("//name"),
                    Description = xml.Find("//description"),
                    DisplayName = xml.Find("//displayName"),
                    Url = xml.FindUri("//url"),
                    Buildable = bool.Parse(xml.Find("//buildable")),
                    BuildStatus = BuildStatusParser.Parse(xml.Find("//color")),
                    HealthReport = xml.Find("//healthReport/description"),
                    IconUrl = xml.Find("//healthReport/iconUrl"),
                    Score = xml.FindInteger("//healthReport/score"),
                    InQueue = bool.Parse(xml.Find("//inQueue")),
                    KeepDependencies = bool.Parse(xml.Find("//keepDependencies")),
                    NextBuildNumber = xml.FindInteger("//nextBuildNumber")
                };
            }

            return job;
        }
Пример #2
0
        /// <summary>
        /// Maps the specified XML into a <see cref="Build"/> object.
        /// </summary>
        /// <param name="xml">The XML.</param>
        /// <returns></returns>
        public Build Map(XmlDocument xml)
        {
            Build build = null;

            if (xml != null)
            {
                build = new Build();

                // Hudson Properties
                build.Description = xml.Find("//shortDescription");
                build.Building = bool.Parse(xml.Find("//building"));
                build.Duration = xml.FindInteger("//duration");
                build.FullDisplayName = xml.Find("//fullDisplayName");
                build.KeepLog = bool.Parse(xml.Find("//keepLog"));
                build.Number = xml.FindInteger("//number");
                build.Success = xml.Find("//result") == "SUCCESS";
                build.Url = new Uri(xml.Find("//url"));
                build.User = xml.Find("//user");
                


                DateTime created;

                if (DateTime.TryParse(xml.Find("//date"), out created))
                {
                    build.Created = created;    
                }

                var seconds = Convert.ToDouble(xml.Find("//timestamp"));

                build.Created = JavaTimeStampToDateTime(seconds);

                // SVN Properties
                build.Revision = xml.FindInteger("//revision");
                build.Comments = xml.Find("//msg");
            }

            return build;
        }
Пример #3
0
        /// <summary>
        /// Maps the specified XML to a <see cref="Server"/> object.
        /// </summary>
        /// <param name="xml">The XML.</param>
        /// <returns></returns>
        public Server Map(XmlDocument xml)
        {
            Server server = null;

            if (xml != null)
            {
                server = new Server
                {
                    Description = xml.Find("//description"), 
                    Url = xml.FindUri("//url")
                };
            }

            return server;
        }
Пример #4
0
        /// <summary>
        /// Maps the specified XML into a <see cref="Build"/> object.
        /// </summary>
        /// <param name="xml">The XML.</param>
        /// <returns></returns>
        public Build Map(XmlDocument xml)
        {
            Build build = null;

            if (xml != null)
            {
                build = new Build
                {
                    Description = xml.Find("//shortDescription"),
                    Building = bool.Parse(xml.Find("//building")),
                    Duration = xml.FindInteger("//duration"),
                    FullDisplayName = xml.Find("//fullDisplayName"),
                    KeepLog = bool.Parse(xml.Find("//keepLog")),
                    Number = xml.FindInteger("//number"),
                    Success = xml.Find("//result") == "SUCCESS",
                    Url = new Uri(xml.Find("//url")),
                    User = xml.FindLast("//author//fullName")
                };

                // Hudson Properties

                DateTime created;

                if (DateTime.TryParse(xml.Find("//date"), out created))
                {
                    build.Created = created;    
                }

                var seconds = Convert.ToDouble(xml.Find("//timestamp"));

                build.Created = JavaTimeStampToDateTime(seconds);

                // GIT Properties
                var rev = xml.Find("//lastBuiltRevision//SHA1");
                build.Revision =  rev.Length > 5 ? rev.Substring(0, 5) : rev;
                build.Comments = xml.FindLast("//msg");
            }

            return build;
        }