public void ShouldBuildCorrectLabelProcessInfo() { ExpectToExecuteArguments("tag ver-foo"); cvs.LabelOnSuccess = true; cvs.WorkingDirectory = DefaultWorkingDirectory; cvs.LabelSourceControl(IntegrationResultMother.CreateSuccessful("foo")); }
public void TemporaryLabelNotAppliedByDefault() { ExpectThatExecuteWillNotBeCalled(); vss.ApplyLabel = false; vss.AutoGetSource = false; vss.GetSource(IntegrationResultMother.CreateSuccessful()); }
public virtual void ShouldNotGetSourceIfAutoGetSourceIsFalse() { ExpectThatExecuteWillNotBeCalled(); vault.AutoGetSource = false; vault.GetSource(IntegrationResultMother.CreateSuccessful()); VerifyAll(); }
public void CanEnforceProjectVobSetIfBaselineTrue() { clearCase.UseBaseline = true; clearCase.ProjectVobName = null; Assert.That(delegate { clearCase.LabelSourceControl(IntegrationResultMother.CreateSuccessful()); }, Throws.TypeOf <CruiseControlException>()); }
public void VerifyGetSourceProcessInfo() { ExpectToExecuteArguments(ForGetCommand()); vss.AutoGetSource = true; vss.GetSource(IntegrationResultMother.CreateSuccessful(today)); }
public void CanGetModificationsIfNoModsAreFound() { DateTime todatetime = DateTime.Today; DateTime fromdatetime = todatetime.AddDays(-1); IIntegrationResult from = IntegrationResultMother.CreateSuccessful(fromdatetime); IIntegrationResult to = IntegrationResultMother.CreateSuccessful(todatetime); InitialiseAlienbrain(); alienbrain.Branch = string.Empty; string args = string.Format(Alienbrain.MODIFICATIONS_COMMAND_TEMPLATE, PROJECT_PATH, SERVER, DATABASE, USER, PASSWORD, from.StartTime.ToFileTime(), to.StartTime.ToFileTime()); ProcessInfo expectedProcessRequest = NewProcessInfo(args); executor.Setup(e => e.Execute(expectedProcessRequest)).Returns(new ProcessResult(Alienbrain.NO_CHANGE, null, 1, false)).Verifiable(); alienbrain.GetModifications(from, to); executor.Verify(); }
public virtual void ShouldNotGetSourceIfAutoGetSourceIsFalse() { vault.AutoGetSource = false; vault.GetSource(IntegrationResultMother.CreateSuccessful()); mockProcessExecutor.VerifyNoOtherCalls(); VerifyAll(); }
public void PassesIndividualSourceDataAndCombinesSingleSourceControl() { IntegrationResult from = IntegrationResultMother.CreateSuccessful(DateTime.Now); IntegrationResult to = IntegrationResultMother.CreateSuccessful(DateTime.Now.AddDays(10)); string scValue = null; List <NameValuePair> list = new List <NameValuePair>(); list.Add(new NameValuePair("name0", "first")); scValue = XmlConversionUtil.ConvertObjectToXml(list); from.SourceControlData.Add(new NameValuePair("sc0", scValue)); list.Clear(); List <ISourceControl> sourceControls = new List <ISourceControl>(); sourceControls.Add(new MockSourceControl()); MultiSourceControl multiSourceControl = new MultiSourceControl(); multiSourceControl.SourceControls = sourceControls.ToArray(); //// EXECUTE ArrayList returnedMods = new ArrayList(multiSourceControl.GetModifications(from, to)); //// VERIFY Assert.AreEqual(from.SourceControlData.Count, to.SourceControlData.Count, "SourceControlData.Count"); list.Add(new NameValuePair("name0", "first")); Assert.AreEqual(XmlConversionUtil.ConvertObjectToXml(list), to.SourceControlData[0].Value, "SourceControlData[0].Value"); list.Clear(); Assert.AreEqual("sc0", to.SourceControlData[0].Name, "SourceControlData[0].Name"); }
public void MigratesSourceControlDataToNewFormatSameSourceControlCount() { IntegrationResult from = IntegrationResultMother.CreateSuccessful(DateTime.Now); IntegrationResult to = IntegrationResultMother.CreateSuccessful(DateTime.Now.AddDays(10)); ArrayList scList = new ArrayList(); scList.Add(new MockSourceControl()); scList.Add(new MockSourceControl()); from.SourceControlData.Add(new NameValuePair("test", "first")); from.SourceControlData.Add(new NameValuePair("commit", "first")); MultiSourceControl multiSourceControl = new MultiSourceControl(); multiSourceControl.SourceControls = (ISourceControl[])scList.ToArray(typeof(ISourceControl)); //// EXECUTE ArrayList returnedMods = new ArrayList(multiSourceControl.GetModifications(from, to)); //// VERIFY Assert.AreEqual(2, to.SourceControlData.Count, "SourceControlData.Count"); List <NameValuePair> list = new List <NameValuePair>(); list.Add(new NameValuePair("test", "first")); Assert.AreEqual(XmlConversionUtil.ConvertObjectToXml(list), to.SourceControlData[0].Value, "SourceControlData[0].Value"); list.Clear(); Assert.AreEqual("sc0", to.SourceControlData[0].Name, "SourceControlData[0].Name"); list.Add(new NameValuePair("commit", "first")); Assert.AreEqual(XmlConversionUtil.ConvertObjectToXml(list), to.SourceControlData[1].Value, "SourceControlData[1].Value"); list.Clear(); Assert.AreEqual("sc1", to.SourceControlData[1].Name, "SourceControlData[1].Name"); }
public void HandlesNullSourceControlDataValue() { var from = IntegrationResultMother.CreateSuccessful(DateTime.Now); var to = IntegrationResultMother.CreateSuccessful(DateTime.Now.AddDays(10)); from.SourceControlData.Add(new NameValuePair("SVN:LastRevision:svn://myserver/mypath", null)); var sourceControls = new List <ISourceControl> { new MockSourceControl(), new MockSourceControl() }; var multiSourceControl = new MultiSourceControl { SourceControls = sourceControls.ToArray() }; //// EXECUTE var returnedMods = new ArrayList(multiSourceControl.GetModifications(from, to)); //// VERIFY Assert.AreEqual(0, returnedMods.Count, "SourceControlData.Count"); Assert.AreEqual(2, to.SourceControlData.Count, "SourceControlData.Count"); Assert.AreEqual("<ArrayOfNameValuePair />", to.SourceControlData[0].Value, "SourceControlData[0].Value"); Assert.AreEqual("sc0", to.SourceControlData[0].Name, "SourceControlData[0].Name"); Assert.AreEqual("<ArrayOfNameValuePair><NameValuePair name=\"SVN:LastRevision:svn://myserver/mypath\" /></ArrayOfNameValuePair>", to.SourceControlData[1].Value, "SourceControlData[1].Value"); Assert.AreEqual("sc1", to.SourceControlData[1].Name, "SourceControlData[1].Name"); }
public void VerifyLabelProcessInfoArguments() { ExpectToExecuteArguments("label $/fooProject -LnewLabel \"-YJoe Admin,admin\" -I-Y"); vss.ApplyLabel = true; vss.LabelSourceControl(IntegrationResultMother.CreateSuccessful("newLabel")); }
public void TemporaryLabelNotAppliedByDefault() { vss.ApplyLabel = false; vss.AutoGetSource = false; vss.GetSource(IntegrationResultMother.CreateSuccessful()); mockProcessExecutor.VerifyNoOtherCalls(); }
public void GetModificationsCallsParseMemberInfo() { Modification addedModification = ModificationMother.CreateModification("myFile.file", "MyFolder"); addedModification.Type = "Added"; mksHistoryParserWrapper.ExpectAndReturn("Parse", new Modification[] { addedModification }, new IsTypeOf(typeof(TextReader)), FROM, TO); mksHistoryParserWrapper.ExpectAndReturn("ParseMemberInfoAndAddToModification", new Modification[] { addedModification }, new IsTypeOf(typeof(Modification)), new IsTypeOf(typeof(StringReader))); mockExecutorWrapper.ExpectAndReturn("Execute", new ProcessResult("", null, 0, false), new IsTypeOf(typeof(ProcessInfo))); string expectedCommand = string.Format(@"memberinfo --xmlapi --user=CCNetUser --password=CCNetPassword --quiet {0}", GeneratePath(@"{0}\MyFolder\myFile.file", sandboxRoot)); ProcessInfo expectedProcessInfo = ExpectedProcessInfo(expectedCommand); mockExecutorWrapper.ExpectAndReturn("Execute", new ProcessResult(null, null, 0, false), expectedProcessInfo); string expectedDisconnectCommand = string.Format(@"disconnect --user=CCNetUser --password=CCNetPassword --quiet --forceConfirm=yes"); ProcessInfo expectedDisconnectProcessInfo = ExpectedProcessInfo(expectedDisconnectCommand); mockExecutorWrapper.ExpectAndReturn("Execute", new ProcessResult(null, null, 0, false), expectedDisconnectProcessInfo); mks = CreateMks(CreateSourceControlXml(), mksHistoryParser, mockProcessExecutor); Modification[] modifications = mks.GetModifications(IntegrationResultMother.CreateSuccessful(FROM), IntegrationResultMother.CreateSuccessful(TO)); Assert.AreEqual(1, modifications.Length); }
public void GetModificationsForModificationInRootFolder() { sandboxRoot = TempFileUtil.GetTempPath("MksSandBox"); Modification addedModification = ModificationMother.CreateModification("myFile.file", null); addedModification.Type = "Added"; mksHistoryParserWrapper.Setup(parser => parser.Parse(It.IsAny <TextReader>(), FROM, TO)).Returns(new Modification[] { addedModification }).Verifiable(); mksHistoryParserWrapper.Setup(parser => parser.ParseMemberInfoAndAddToModification(It.IsAny <Modification>(), It.IsAny <StringReader>())).Verifiable(); mockExecutorWrapper.Setup(executor => executor.Execute(It.IsAny <ProcessInfo>())).Returns(new ProcessResult("", null, 0, false)).Verifiable(); string expectedCommand = string.Format(@"memberinfo --xmlapi --user=CCNetUser --password=CCNetPassword --quiet {0}", GeneratePath(@"{0}\myFile.file", sandboxRoot)); ProcessInfo expectedProcessInfo = ExpectedProcessInfo(expectedCommand); mockExecutorWrapper.Setup(executor => executor.Execute(expectedProcessInfo)).Returns(new ProcessResult(null, null, 0, false)).Verifiable(); string expectedDisconnectCommand = string.Format(@"disconnect --user=CCNetUser --password=CCNetPassword --quiet --forceConfirm=yes"); ProcessInfo expectedDisconnectProcessInfo = ExpectedProcessInfo(expectedDisconnectCommand); mockExecutorWrapper.Setup(executor => executor.Execute(expectedDisconnectProcessInfo)).Returns(new ProcessResult(null, null, 0, false)).Verifiable(); mks = CreateMks(CreateSourceControlXml(), mksHistoryParser, mockProcessExecutor); Modification[] modifications = mks.GetModifications(IntegrationResultMother.CreateSuccessful(FROM), IntegrationResultMother.CreateSuccessful(TO)); Assert.AreEqual(1, modifications.Length); }
public void FindsSimpleChange() { DateTime dtBeforeChange = DateTime.Parse("1/18/2006 3:34:06 PM", culture); DateTime dtAfterChange = DateTime.Parse("1/18/2006 3:34:08 PM", culture); result.StartTime = dtBeforeChange; this.ProcessResultOutput = @" <vault> <history> <item version=""78"" date=""1/18/2006 3:34:07 PM"" user=""testuser"" comment=""test comment"" txid=""4"" /> </history> <result success=""yes"" /> </vault>" ; ExpectToExecuteArguments(@"versionhistory $ -rowlimit 1" + SetAndGetCommonOptionalArguments()); this.ProcessResultOutput = @" <vault> <history> <item txid=""4"" date=""1/18/2006 3:34:07 PM"" name=""test.cs"" type=""60"" version=""29"" user=""testuser"" comment=""test comment"" actionString=""Checked In"" /> </history> <result success=""yes"" /> </vault>" ; string itemHistoryArgs = string.Format(@"history $ -excludeactions label,obliterate -rowlimit 0 -begindate {0:s} -enddate {1:s}{2}", dtBeforeChange, dtAfterChange, SetAndGetCommonOptionalArguments()); ExpectToExecuteArguments(itemHistoryArgs); Modification[] mods = vault.GetModifications(result, IntegrationResultMother.CreateSuccessful(dtAfterChange)); Assert.AreEqual(1, mods.Length, "Should have found 1 modification."); VerifyAll(); this.ProcessResultOutput = @" <vault> <history> <item version=""79"" date=""1/18/2006 3:35:07 PM"" user=""testuser"" comment=""test comment"" txid=""5"" /> </history> <result success=""yes"" /> </vault>" ; ExpectToExecuteArguments(@"versionhistory $ -beginversion 79 -rowlimit 1" + SetAndGetCommonOptionalArguments()); this.ProcessResultOutput = @" <vault> <history> <item txid=""5"" date=""1/18/2006 3:35:07 PM"" name=""test.cs"" type=""60"" version=""30"" user=""testuser"" comment=""test comment"" actionString=""Checked In"" /> </history> <result success=""yes"" /> </vault>" ; dtAfterChange = DateTime.Parse("1/18/2006 3:36:07 PM", culture); itemHistoryArgs = string.Format(@"history $ -excludeactions label,obliterate -rowlimit 0 -begindate {0:s} -enddate {1:s}{2}", dtBeforeChange, dtAfterChange, SetAndGetCommonOptionalArguments()); ExpectToExecuteArguments(itemHistoryArgs); mods = vault.GetModifications(result, IntegrationResultMother.CreateSuccessful(dtAfterChange)); Assert.AreEqual(1, mods.Length, "Should have found 1 modification."); VerifyAll(); }
public void ShouldNotApplyLabelIfTagOnSuccessFalse() { git.TagOnSuccess = false; ExpectThatExecuteWillNotBeCalled(); git.LabelSourceControl(IntegrationResultMother.CreateSuccessful()); }
public void ShouldApplyLabelIfTagOnSuccessTrue() { hg.TagOnSuccess = true; ExpectToExecuteArguments(@"tag -m ""Tagging CC.NET build foo"" -u CruiseControl.NET -f ccnet_build_foo", tempWorkDir); hg.LabelSourceControl(IntegrationResultMother.CreateSuccessful("foo")); }
public void ShouldCommitModificationsIfSpecified() { hg.CommitModifications = true; ExpectToExecuteArguments(@"commit -u CruiseControl.NET -m ""Modifications of CC.NET build foo""", tempWorkDir); hg.LabelSourceControl(IntegrationResultMother.CreateSuccessful("foo")); }
public void ShouldNotApplyLabelIfTagOnSuccessFalse() { git.TagOnSuccess = false; git.LabelSourceControl(IntegrationResultMother.CreateSuccessful()); mockProcessExecutor.VerifyNoOtherCalls(); }
public void ShouldNotLabelSourceControlifLabelOnSuccessisFalseAndResultisSuccess() { alienbrain.LabelOnSuccess = false; alienbrain.LabelSourceControl(IntegrationResultMother.CreateSuccessful()); executor.Verify(); executor.VerifyNoOtherCalls(); }
public void ShouldNotLabelSourceControlifLabelOnSuccessisFalseAndResultisSuccess() { alienbrain.LabelOnSuccess = false; executor.ExpectNoCall("Execute", typeof(ProcessInfo)); alienbrain.LabelSourceControl(IntegrationResultMother.CreateSuccessful()); executor.Verify(); }
public void ShouldNotApplyLabelIfTagOnSuccessFalse() { hg.TagOnSuccess = false; mockProcessExecutor.ExpectNoCall("Execute", typeof(ProcessInfo)); hg.LabelSourceControl(IntegrationResultMother.CreateSuccessful()); }
private IntegrationResult CreateSuccessfulWithModifications(DateTime integrationTime) { IntegrationResult temp = IntegrationResultMother.CreateSuccessful(integrationTime); temp.Modifications = modifications; return(temp); }
public void ShouldApplyLabelWithCustomMessageIfTagOnSuccessTrueAndACustomMessageIsSpecified() { ExpectToExecuteArguments(string.Format(@"copy -m ""a---- foo ----a"" {0} svn://someserver/tags/foo/foo --no-auth-cache --non-interactive", StringUtil.AutoDoubleQuoteString(DefaultWorkingDirectory))); svn.TagOnSuccess = true; svn.TagCommitMessage = "a---- {0} ----a"; svn.LabelSourceControl(IntegrationResultMother.CreateSuccessful("foo")); }
public void ShouldConvertLabelsThatContainIllegalCharacters() { ExpectToExecuteArguments("-d myCvsRoot tag ver-2_1_4"); cvs.CvsRoot = "myCvsRoot"; cvs.LabelOnSuccess = true; cvs.WorkingDirectory = DefaultWorkingDirectory; cvs.LabelSourceControl(IntegrationResultMother.CreateSuccessful("2.1.4")); }
public void GetSourceShouldNotGetCleanCopy() { ExpectToExecuteArguments(string.Format(System.Globalization.CultureInfo.CurrentCulture, "get $/fooProject/*?* -R -Vd{0} \"-YJoe Admin,admin\" -I-Y -W -GF- -GTM", CommandDate(today))); vss.AutoGetSource = true; vss.CleanCopy = false; vss.GetSource(IntegrationResultMother.CreateSuccessful(today)); }
public void VerifyGetSourceProcessInfoIfUsernameIsNotSpecified() { ExpectToExecuteArguments(RemoveUsername(ForGetCommand())); vss.AutoGetSource = true; vss.Username = ""; vss.GetSource(IntegrationResultMother.CreateSuccessful(today)); }
public void GetModifications() { mockExecutor.ExpectAndReturn("Execute", ProcessResultFixture.CreateSuccessfulResult(), new IsAnything()); mockParser.ExpectAndReturn("Parse", new Modification[] { new Modification(), new Modification() }, new IsAnything(), new IsAnything(), new IsAnything()); Modification[] mods = pvcs.GetModifications(IntegrationResultMother.CreateSuccessful(new DateTime(2004, 6, 1, 1, 1, 1)), IntegrationResultMother.CreateSuccessful(new DateTime(2004, 6, 1, 2, 2, 2))); Assert.AreEqual(2, mods.Length); }
public void DoNotGetFromDateIfAlwaysGetLatestIsTrue() { ExpectToExecuteArguments("get $/fooProject/*?* -R \"-YJoe Admin,admin\" -I-Y -W -GF- -GTM"); vss.AutoGetSource = true; vss.CleanCopy = false; vss.AlwaysGetLatest = true; vss.GetSource(IntegrationResultMother.CreateSuccessful(today)); }
public void ShouldApplyLabelWithCustomMessageIfTagOnSuccessTrueAndACustomMessageIsSpecified() { hg.TagOnSuccess = true; hg.TagCommitMessage = "a---- {0} ----a"; ExpectToExecuteArguments(@"tag -m ""a---- foo ----a"" -u CruiseControl.NET -f ccnet_build_foo", tempWorkDir); hg.LabelSourceControl(IntegrationResultMother.CreateSuccessful("foo")); }