public Build(TeamCityApi api, XElement xml) : base(api, xml) { Succeeded = xml.Attribute("status").Value == "SUCCESS"; LogHtmlHRef = (string)xml.Attribute("webUrl"); BuildTypeId = (string)xml.Attribute("buildTypeId"); PercentageComplete = xml.Attribute("percentageComplete") != null ? (int)xml.Attribute("percentageComplete") : 0; if (xml.Attribute ("startDate") != null) { var startDate = xml.Attribute ("startDate").Value; StartTime = TeamCityUtils.ParseTime (startDate); } else if (xml.Element ("startDate") != null) { var startDate = xml.Element ("startDate").Value; StartTime = TeamCityUtils.ParseTime (startDate); } if(xml.Element ("finishDate") != null) { var endDate = xml.Element ("finishDate").Value; EndTime = TeamCityUtils.ParseTime (endDate); } if(xml.Element ("statusText") != null) { StatusText = xml.Element ("statusText").Value; } if (xml.Attribute ("running") != null) { IsRunning = bool.Parse (xml.Attribute ("running").Value); } }
public ProjectDetails(TeamCityApi api, XElement xml) : base(api, xml) { BuildTypes = Xml.Descendants("buildTypes") .Elements("buildType") .Select(x => new BuildType(this.Api, x)) .ToList(); }
public Project(TeamCityApi api, XElement xml) : base(api, xml) { if (xml.Attribute ("parentProjectId") != null) { ParentProjectId = xml.Attribute ("parentProjectId").Value; } if (xml.Attribute ("description") != null) { Description = xml.Attribute ("description").Value; } }
public BuildTypeDetails(TeamCityApi api, XElement xml) : base(api, xml) { BuildParameters = new Dictionary<string, string> (); if (xml.Element ("parameters") != null) { var buildParams = xml.Element ("parameters").Elements ("property"); foreach (var bp in buildParams) { BuildParameters.Add ((string)bp.Attribute ("name"), (string)bp.Attribute ("value")); } } }
public ChangeDetail(TeamCityApi api, XElement xml) : base(api, xml) { if(xml.Element("comment")!=null) { Comment = (string)xml.Element ("comment"); } UserName = (string) xml.Attribute ("username"); Date = TeamCityUtils.ParseTime (xml.Attribute ("date").Value); WebLink = (string)xml.Attribute ("webLink") ?? (string)xml.Attribute ("webUrl"); Files = xml.Descendants ("file").Select (x => (string)x.Attribute ("file")).ToList (); if (xml.Element ("vcsRootInstance") != null) { Repository = (string)xml.Element ("vcsRootInstance").Attribute("name"); } }
public BuildType(TeamCityApi api, XElement xml) : base(api, xml) { ProjectName = (string)xml.Attribute ("projectName"); ProjectId = (string)xml.Attribute ("projectId"); }
public BuildDetails(TeamCityApi api, XElement xml) : base(api, xml) { var statusTextElement = xml.Descendants("statusText").FirstOrDefault(); if (statusTextElement != null) { StatusText = statusTextElement.Value; } var runningInfo = xml.Descendants("running-info").FirstOrDefault(); if (runningInfo != null) { RunInfo = new RunningInfo (runningInfo); } var snapshotDependencies = xml.Descendants("snapshot-dependencies").FirstOrDefault(); if (snapshotDependencies != null) { SnapshotDependencies = snapshotDependencies.Descendants ("build") .Select (b => new Build (api, b)) .ToList (); } else { SnapshotDependencies = new List<Build> (); } var startTimeNode = xml.Descendants("startDate").FirstOrDefault(); if (startTimeNode != null) { StartTime = TeamCityUtils.ParseTime(startTimeNode.Value); } var endTimeNode = xml.Descendants("finishDate").FirstOrDefault(); if (endTimeNode != null) { EndTime = TeamCityUtils.ParseTime(endTimeNode.Value); } var triggeredNode = xml.Descendants("triggered").FirstOrDefault(); if (triggeredNode != null) { var userNode = triggeredNode.Element ("user"); if (userNode != null) { TriggeredBy = userNode.Attribute ("username").Value; } } var buildTypeNode = xml.Descendants("buildType").First(); if (xml.Attribute ("number") != null) { long number = 0; long.TryParse (xml.Attribute ("number").Value, out number); Number = number; } BuildTypeId = (string)buildTypeNode.Attribute("id"); Name = (string)buildTypeNode.Attribute("name"); ProjectName = (string)buildTypeNode.Attribute("projectName"); }
public static List<Change> Parse(TeamCityApi api, XElement xml) { var changes = xml.Descendants ("change"); return changes.Select (x => new Change (api, x)).ToList (); }
public Change(TeamCityApi api, XElement xml) : base(api, xml) { Version = (string) xml.Attribute ("version"); }
public static List<BuildArtifact> Parse(TeamCityApi api, XElement xml) { var files = xml.Descendants ("file").Where(x=> x.Element("content")!=null); return files.Select (x => new BuildArtifact (x)).ToList (); }
public TeamCityApiResult(TeamCityApi api, XElement xml) { Api = api; Xml = xml; ParseBaseInfo(); }
public void Setup() { api = new TeamCityApi("http://localhost:88", "admin", "test"); }