// zhiyuan.peng: // add a new reference public void AddReference(string target) { XmlElement e = Xml.CreateElement("reference"); e.SetAttribute("target", target); Xml.DocumentElement.AppendChild(e); }
public BuildConfigXmlGenerator(IBuildConfigXmlClient buildConfigXmlClient = null, bool buildNonStubVersion = false) { _buildConfigXmlClient = buildConfigXmlClient; if (buildNonStubVersion) { BuildConfigXml = new BuildConfigXml(_buildConfigXmlClient, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); } else { BuildConfigXml = Substitute.For <BuildConfigXml>(_buildConfigXmlClient, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); } Xml.AppendChild(Xml.CreateXmlDeclaration("1.0", "UTF-8", null)); BuildTypeElement = (XmlElement)Xml.AppendChild(Xml.CreateElement("build-type")); BuildTypeElement.SetAttribute("uuid", Guid.NewGuid().ToString()); NameElement = (XmlElement)BuildTypeElement.AppendChild(Xml.CreateElement("name")); SettingsElement = (XmlElement)BuildTypeElement.AppendChild(Xml.CreateElement("settings")); SettingsElement.SetAttribute("ref", "CPlusPlusTemplate_v1"); ParametersElement = (XmlElement)SettingsElement.AppendChild(Xml.CreateElement("parameters")); }
private XmlElement CreateSecurity() { var headerXml = GetHeader(); var securityXml = Xml.CreateElement("wsse", "Security", Soap.Namespaces.WebServiceSecurityExtensions); headerXml.AppendChild(securityXml); return(securityXml); }
public BuildConfigXmlGenerator WithParameter(string name, string value) { var paramElement = (XmlElement)ParametersElement.AppendChild(Xml.CreateElement("param")); paramElement.SetAttribute("name", name); paramElement.SetAttribute("value", value); return(this); }
static XmlNode NodeWithValue(string nodeName, string value) { XmlNode node = Xml.CreateElement(nodeName); XmlNode inner = Xml.CreateTextNode(value); node.AppendChild(inner); return(node); }
static XmlNode NodeWithAttribute(string nodeName, string attrName, string attrValue) { XmlNode node = Xml.CreateElement(nodeName); XmlAttribute attr = Xml.CreateAttribute(attrName); attr.Value = attrValue; node.Attributes.Append(attr); return(node); }
static XmlNode NodeWithAttributeValue(string nodeName, string value, string attrName, string attrValue) { XmlNode node = Xml.CreateElement(nodeName); XmlAttribute attr = Xml.CreateAttribute(attrName); attr.Value = attrValue; node.Attributes.Append(attr); XmlNode inner = Xml.CreateTextNode(value); node.AppendChild(inner); return(node); }
public virtual void CreateArtifactDependency(CreateArtifactDependency dependency) { Log.Debug($"XML CreateArtifactDependency for: {BuildConfigId}, to: {dependency.DependencyBuildConfigId}"); var dependencyElement = (XmlElement)ArtifactDependenciesElement.AppendChild(Xml.CreateElement("dependency")); dependencyElement.SetAttribute("sourceBuildTypeId", dependency.DependencyBuildConfigId); dependencyElement.SetAttribute("cleanDestination", dependency.CleanDestinationDirectory.ToString().ToLower()); var revisionRuleElement = (XmlElement)dependencyElement.AppendChild(Xml.CreateElement("revisionRule")); revisionRuleElement.SetAttribute("name", dependency.RevisionName); revisionRuleElement.SetAttribute("revision", dependency.RevisionValue); var artifactElement = (XmlElement)dependencyElement.AppendChild(Xml.CreateElement("artifact")); artifactElement.SetAttribute("sourcePath", dependency.PathRules); _buildConfigXmlClient.Commit(this, $"TCC {BuildConfigId} Create Artifact Dependency to {dependency.DependencyBuildConfigId}"); }
public virtual void CreateSnapshotDependency(CreateSnapshotDependency dependency) { Log.Debug($"XML CreateSnapshotDependency for: {dependency.TargetBuildConfigId}, to: {dependency.DependencyBuildConfigId}"); var dependOnElement = (XmlElement)DependenciesElement.AppendChild(Xml.CreateElement("depend-on")); dependOnElement.SetAttribute("sourceBuildTypeId", dependency.DependencyBuildConfigId); var optionsElement = (XmlElement)dependOnElement.AppendChild(Xml.CreateElement("options")); var option1Element = (XmlElement)optionsElement.AppendChild(Xml.CreateElement("option")); option1Element.SetAttribute("name", "take-started-build-with-same-revisions"); option1Element.SetAttribute("value", dependency.TakeStartedBuildWithSameRevisions.ToString().ToLower()); var option2Element = (XmlElement)optionsElement.AppendChild(Xml.CreateElement("option")); option2Element.SetAttribute("name", "take-successful-builds-only"); option2Element.SetAttribute("value", dependency.TakeSuccessFulBuildsOnly.ToString().ToLower()); _buildConfigXmlClient.Commit(this, $"TCC {BuildConfigId} Create Snapshot Dependency to {dependency.DependencyBuildConfigId}"); }
public virtual void SetParameterValue(string name, string value) { Log.Trace($"XML SetParameterValue for: {BuildConfigId}, {name}: {value}"); var paramElement = (XmlElement)Xml.SelectSingleNode("/build-type/settings/parameters/param[@name='" + name + "']"); if (paramElement == null) { if (ParametersElement == null) { SettingsElement.AppendChild(Xml.CreateElement("parameters")); } var newParamElement = (XmlElement)ParametersElement.AppendChild(Xml.CreateElement("param")); newParamElement.SetAttribute("name", name); newParamElement.SetAttribute("value", value); } else { paramElement.SetAttribute("value", value); } _buildConfigXmlClient.Commit(this, $"TCC {BuildConfigId} Set Parameter {name} = {value}"); }
public XmlElement CreateElement(string name) { return(Xml.CreateElement(name)); }
public BuildConfigXmlGenerator WithTemplateId(string templateId) { SettingsElement = (XmlElement)BuildTypeElement.AppendChild(Xml.CreateElement("settings")); SettingsElement.SetAttribute("ref", templateId); return(this); }