/// <summary>
        /// Gets the full <see cref="Job"/> from the given <see cref="JobDescriptor"/>.
        /// </summary>
        /// <param name="jobDescriptor">The job descriptor.</param>
        /// <returns></returns>
        public Job GetJob(JobDescriptor jobDescriptor)
        {
            Job job = new NullJob(jobDescriptor);

            var url = new XmlApiPrepender().Prepend(jobDescriptor.Url);

            var xml = XmlService.GetPage(url);

            if (xml.IsValid)
            {
                job = new JobMapper().Map(xml.Contents);

                /* Get Builds (takes a while...)
                var descriptors = mapper.MapMany(xml.Contents, "//build");
                job.Builds = BuildService.GetBuilds(descriptors); */

                // Get Last Build
                var firstBuild = mapper.Map(xml.Contents, "//firstBuild");
                job.FirstBuild = BuildService.GetBuild(firstBuild);

                // Get Last Build
                var lastBuild = mapper.Map(xml.Contents, "//lastBuild");
                job.LastBuild = BuildService.GetBuild(lastBuild);

                // Get Last Failed Build
                var lastFailedBuild = mapper.Map(xml.Contents, "//lastFailedBuild");
                job.LastFailedBuild = BuildService.GetBuild(lastFailedBuild);

                // Get Last Stable Build
                var lastStableBuild = mapper.Map(xml.Contents, "//lastStableBuild");
                job.LastStableBuild = BuildService.GetBuild(lastStableBuild);

                // Get Last Successful Build
                var lastSuccessfulBuild = mapper.Map(xml.Contents, "//lastSuccessfulBuild");
                job.LastSuccessfulBuild = BuildService.GetBuild(lastSuccessfulBuild);
            }

            return job;
        }
Beispiel #2
0
 public void SetUp()
 {
     mapper = new JobMapper();
 }