public void AddWithValueAdds() { var args = new PrivateArguments(); args.Add("testValue"); Assert.AreEqual(1, args.Count); Assert.AreEqual("testValue", args.ToString()); }
public void AddIfWithValueDoesNotAddOnFalse() { var args = new PrivateArguments(); args.AddIf(false, "testValue"); Assert.AreEqual(0, args.Count); Assert.AreEqual(string.Empty, args.ToString()); }
public void AddQuoteWithPrefixedValueAdds() { var args = new PrivateArguments(); args.AddQuote("pre=", "test Value"); Assert.AreEqual(1, args.Count); Assert.AreEqual("pre=\"test Value\"", args.ToString()); }
public void AddIfWithAutoQuoteValueAddsOnTrue() { var args = new PrivateArguments(); args.AddIf(true, "pre=", "test Value", true); Assert.AreEqual(1, args.Count); Assert.AreEqual("pre=\"test Value\"", args.ToString()); }
public void AddIfWithPrefixedValueAddsOnTrue() { var args = new PrivateArguments(); args.AddIf(true, "pre=", "test Value"); Assert.AreEqual(1, args.Count); Assert.AreEqual("pre=test Value", args.ToString()); }
public ProcessInfo(string filename, PrivateArguments arguments, string workingDirectory, ProcessPriorityClass priority, int[] successExitCodes) { this.arguments = arguments; this.Priority = priority; startInfo.FileName = StringUtil.StripQuotes(filename); startInfo.Arguments = arguments == null ? null : arguments.ToString(SecureDataMode.Private); startInfo.WorkingDirectory = StringUtil.StripQuotes(workingDirectory); startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; startInfo.RedirectStandardInput = false; RepathExecutableIfItIsInWorkingDirectory(); this.successExitCodes = successExitCodes ?? new int[] { 0 }; }
/// <summary> /// Initializes a new instance of the <see cref="ProcessInfo" /> class. /// </summary> /// <param name="filename">The filename.</param> /// <param name="arguments">The arguments.</param> /// <param name="workingDirectory">The working directory.</param> /// <param name="priority">The priority.</param> /// <param name="successExitCodes">The success exit codes.</param> /// <remarks></remarks> public ProcessInfo(string filename, PrivateArguments arguments, string workingDirectory, ProcessPriorityClass priority, int[] successExitCodes) { this.arguments = arguments; this.Priority = priority; startInfo.FileName = StringUtil.StripQuotes(filename); startInfo.Arguments = arguments == null ? null : arguments.ToString(SecureDataMode.Private); startInfo.WorkingDirectory = StringUtil.StripQuotes(workingDirectory); startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; startInfo.RedirectStandardInput = false; RepathExecutableIfItIsInWorkingDirectory(); this.successExitCodes = successExitCodes ?? new int[] { 0 }; }
private ProcessResult ExecuteCommand(IIntegrationResult result, string command, params string[] args) { var buffer = new PrivateArguments(command); buffer.Add(this.Source); foreach (var arg in args) { buffer.Add(string.Empty, arg, true); } var executable = string.IsNullOrEmpty(this.Executable) ? "GetMyCode" : this.Executable; var processInfo = new ProcessInfo( result.BaseFromWorkingDirectory(executable), buffer, result.WorkingDirectory); var processResult = this.Execute(processInfo); return processResult; }
/// <summary> /// Initializes a new instance of the <see cref="ProcessInfo" /> class. /// </summary> /// <param name="filename">The filename.</param> /// <param name="arguments">The arguments.</param> /// <param name="workingDirectory">The working directory.</param> /// <param name="priority">The priority.</param> /// <remarks></remarks> public ProcessInfo(string filename, PrivateArguments arguments, string workingDirectory, ProcessPriorityClass priority) : this(filename, arguments, workingDirectory, priority, null) { }
private ProcessInfo NewGetSourceProcessInfo(IIntegrationResult result) { var buffer = new PrivateArguments("update"); buffer.Add(null, Path.GetFullPath(result.BaseFromWorkingDirectory(WorkingDirectory)), true); // Do not use Modification.GetLastChangeNumber() here directly. AppendRevision(buffer, latestRevision); AppendCommonSwitches(buffer); if (ForceUpdate) buffer.Add("--force"); return NewProcessInfo(buffer, result); }
public void ToStringPrivateGeneratesPublicString() { PrivateString hidden = "private"; var args = new PrivateArguments("public", hidden); Assert.AreEqual("public private", args.ToString(SecureDataMode.Private)); }
private PrivateArguments GetSourceArgs(IIntegrationResult result) { var builder = new PrivateArguments(); builder.Add("get ", Project + "/*?*", true); builder.Add(RecursiveCommandLineOption); builder.AddIf(ApplyLabel, "-VL", tempLabel); builder.AddIf(!AlwaysGetLatest, "-Vd", locale.FormatCommandDate(result.StartTime)); AppendUsernameAndPassword(builder); builder.Add("-I-N -W -GF- -GTM"); builder.AddIf(CleanCopy, "-GWR"); return builder; }
private PrivateArguments LabelProcessInfoArgs(string label, string oldLabel) { var builder = new PrivateArguments(); builder.Add("label ", Project, true); builder.Add("-L", label); builder.AddIf(!string.IsNullOrEmpty(oldLabel), "-VL", oldLabel); AppendUsernameAndPassword(builder); builder.Add("-I-Y"); return builder; }
/// <summary> /// Initializes a new instance of the <see cref="ProcessInfo" /> class. /// </summary> /// <param name="filename">The filename.</param> /// <param name="arguments">The arguments.</param> /// <remarks></remarks> public ProcessInfo(string filename, PrivateArguments arguments) : this(filename, arguments, null){}
/// <summary> /// Initializes a new instance of the <see cref="ProcessInfo" /> class. /// </summary> /// <param name="filename">The filename.</param> /// <param name="arguments">The arguments.</param> /// <param name="workingDirectory">The working directory.</param> /// <param name="priority">The priority.</param> /// <remarks></remarks> public ProcessInfo(string filename, PrivateArguments arguments, string workingDirectory, ProcessPriorityClass priority) : this(filename, arguments, workingDirectory, priority, null){}
private ProcessInfo RevertWorkingCopy(IIntegrationResult result) { var buffer = new PrivateArguments("revert", "--recursive"); buffer.Add(null, Path.GetFullPath(result.BaseFromWorkingDirectory(WorkingDirectory)), true); return NewProcessInfo(buffer, result); }
/// <summary> /// Lists any obstructed files or folders. /// </summary> /// <param name="result">The current result.</param> private IList<string> ListObstructions(IIntegrationResult result) { var args = new PrivateArguments("status", "--xml"); var info = this.NewProcessInfo(args, result); var processResult = Execute(info); var obstructions = new List<string>(); var svnData = new XmlDocument(); svnData.LoadXml(processResult.StandardOutput); var nodes = svnData.SelectNodes("//entry[wc-status/@item=\"obstructed\"]"); foreach (XmlElement node in nodes) { obstructions.Add(node.GetAttribute("path")); } return obstructions; }
private ProcessInfo NewProcessInfo(PrivateArguments args, IIntegrationResult result) { string workingDirectory = Path.GetFullPath(result.BaseFromWorkingDirectory(WorkingDirectory)); if (!Directory.Exists(workingDirectory)) Directory.CreateDirectory(workingDirectory); ProcessInfo processInfo = new ProcessInfo(Executable, args, workingDirectory); processInfo.StreamEncoding = Encoding.UTF8; return processInfo; }
private ProcessInfo PropGetProcessInfo(IIntegrationResult result) { var buffer = new PrivateArguments("propget"); buffer.AddIf(CheckExternalsRecursive, "-R"); AppendCommonSwitches(buffer); buffer.Add("svn:externals"); buffer.Add(TrunkUrl); return NewProcessInfo(buffer, result); }
// TAG_COMMAND_FORMAT = "copy --message "CCNET build label" "trunkUrl" "tagBaseUrl/label" private ProcessInfo NewLabelProcessInfo(IIntegrationResult result) { var buffer = new PrivateArguments("copy"); buffer.Add(null, TagMessage(result.Label), true); buffer.Add(null, TagSource(result), true); buffer.Add(null, TagDestination(result.Label), true); // Do not use Modification.GetLastChangeNumber() here directly. AppendRevision(buffer, latestRevision); AppendCommonSwitches(buffer); return NewProcessInfo(buffer, result); }
// HISTORY_COMMAND_FORMAT = "log url --revision {LastRevision}:HEAD --verbose --xml --non-interactive"; private ProcessInfo NewHistoryProcessInfoFromRevision(string lastRevision, IIntegrationResult to, string url) { var buffer = new PrivateArguments("log"); buffer.Add(null, url, true); buffer.Add(string.Format("-r {0}:HEAD", string.IsNullOrEmpty(lastRevision) ? "0" : lastRevision)); buffer.Add("--verbose --xml"); AppendCommonSwitches(buffer, url != this.TrunkUrl); return NewProcessInfo(buffer, to); }
// HISTORY_COMMAND_FORMAT = "log url --revision \"{{{StartDate}}}:{{{EndDate}}}\" --verbose --xml --non-interactive"; private ProcessInfo NewHistoryProcessInfo(IIntegrationResult from, IIntegrationResult to, string url) { var buffer = new PrivateArguments("log"); buffer.Add(null, url, true); buffer.Add(string.Format("-r \"{{{0}}}:{{{1}}}\"", FormatCommandDate(from.StartTime), FormatCommandDate(to.StartTime))); buffer.Add("--verbose --xml"); AppendCommonSwitches(buffer, url != this.TrunkUrl); return NewProcessInfo(buffer, to); }
/// <summary> /// Initializes a new instance of the <see cref="ProcessInfo" /> class. /// </summary> /// <param name="filename">The filename.</param> /// <param name="arguments">The arguments.</param> /// <param name="workingDirectory">The working directory.</param> /// <remarks></remarks> public ProcessInfo(string filename, PrivateArguments arguments, string workingDirectory) : this(filename, arguments, workingDirectory, DEFAULT_PRIORITY) { }
/// <summary> /// Initializes a new instance of the <see cref="ProcessInfo" /> class. /// </summary> /// <param name="filename">The filename.</param> /// <param name="arguments">The arguments.</param> /// <remarks></remarks> public ProcessInfo(string filename, PrivateArguments arguments) : this(filename, arguments, null) { }
public void ConstructorWithNoArgumentsInitialises() { var args = new PrivateArguments(); Assert.AreEqual(0, args.Count); }
private ProcessInfo CleanupWorkingCopy(IIntegrationResult result) { var buffer = new PrivateArguments("cleanup"); buffer.Add(null, Path.GetFullPath(result.BaseFromWorkingDirectory(WorkingDirectory)), true); return NewProcessInfo(buffer, result); }
/// <summary> /// Initializes a new instance of the <see cref="ProcessInfo" /> class. /// </summary> /// <param name="filename">The filename.</param> /// <param name="arguments">The arguments.</param> /// <param name="workingDirectory">The working directory.</param> /// <remarks></remarks> public ProcessInfo(string filename, PrivateArguments arguments, string workingDirectory) : this(filename, arguments, workingDirectory, DEFAULT_PRIORITY){}
public void ConstructorWithOneArgumentInitialises() { var args = new PrivateArguments("test"); Assert.AreEqual(1, args.Count); Assert.AreEqual("test", args.ToString()); }
private void AppendUsernameAndPassword(PrivateArguments builder) { if (!string.IsNullOrEmpty(Username)) { PrivateString userPlusPass = "******"-Y" + Username + "," + Password.PrivateValue + "\""; builder.Add(userPlusPass); } }
public void ConstructorWithTwoArgumentsInitialises() { var args = new PrivateArguments("first", "second"); Assert.AreEqual(2, args.Count); Assert.AreEqual("first second", args.ToString()); }
private PrivateArguments HistoryProcessInfoArgs(DateTime from, DateTime to, string tempOutputFileName) { var builder = new PrivateArguments(); builder.Add("history ", Project, true); builder.Add(RecursiveCommandLineOption); builder.Add(string.Format("-Vd{0}~{1}", locale.FormatCommandDate(to), locale.FormatCommandDate(from))); AppendUsernameAndPassword(builder); builder.Add("-I-Y"); builder.Add(null, "-O@" + tempOutputFileName, true); return builder; }
public void ToStringGeneratesPublicString() { PrivateString hidden = "private"; var args = new PrivateArguments("public", hidden); Assert.AreEqual("public " + hidden.PublicValue, args.ToString()); }
private ProcessInfo NewProcessInfoWith(PrivateArguments args, IIntegrationResult result) { string workingDirectory = result.BaseFromWorkingDirectory(WorkingDirectory); if (! Directory.Exists(workingDirectory)) Directory.CreateDirectory(workingDirectory); ProcessInfo processInfo = new ProcessInfo(Executable, args, workingDirectory); if (SsDir != null) { processInfo.EnvironmentVariables[SS_DIR_KEY] = SsDir; } return processInfo; }
private ProcessInfo NewCheckoutProcessInfo(IIntegrationResult result) { var buffer = new PrivateArguments("checkout"); buffer.Add(string.Empty, TrunkUrl, true); buffer.Add(null, Path.GetFullPath(result.BaseFromWorkingDirectory(WorkingDirectory)), true); AppendCommonSwitches(buffer); return NewProcessInfo(buffer, result); }