You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(142) |
Jun
(27) |
Jul
(122) |
Aug
(36) |
Sep
(59) |
Oct
(86) |
Nov
(140) |
Dec
(80) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(52) |
Feb
(153) |
Mar
(118) |
Apr
(143) |
May
(123) |
Jun
(64) |
Jul
(282) |
Aug
(469) |
Sep
(56) |
Oct
(201) |
Nov
(182) |
Dec
(31) |
| 2005 |
Jan
(229) |
Feb
(316) |
Mar
(187) |
Apr
(130) |
May
(190) |
Jun
(154) |
Jul
(148) |
Aug
(133) |
Sep
(209) |
Oct
(234) |
Nov
(100) |
Dec
(40) |
| 2006 |
Jan
(1) |
Feb
(87) |
Mar
(73) |
Apr
(126) |
May
(58) |
Jun
(8) |
Jul
(12) |
Aug
(14) |
Sep
(22) |
Oct
(33) |
Nov
(4) |
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(1) |
2
|
|
3
|
4
(5) |
5
(50) |
6
(1) |
7
(26) |
8
|
9
|
|
10
|
11
|
12
|
13
(1) |
14
(20) |
15
(4) |
16
|
|
17
|
18
|
19
|
20
|
21
|
22
|
23
|
|
24
|
25
(16) |
26
(2) |
27
|
28
|
29
(2) |
30
(2) |
|
From: Graham T. <ta...@us...> - 2005-04-30 10:16:28
|
Update of /cvsroot/ccnet/ccnet/project/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21103/project/core Modified Files: IntegrationRunner.cs Log Message: CCNET-411 - Integration status should be Building during GetSource and temporary labelling Index: IntegrationRunner.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/IntegrationRunner.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IntegrationRunner.cs 16 Mar 2005 02:28:52 -0000 1.1 --- IntegrationRunner.cs 30 Apr 2005 10:16:02 -0000 1.2 *************** *** 31,34 **** --- 31,36 ---- if (result.ShouldRunBuild(target.ModificationDelaySeconds)) { + target.Activity = ProjectActivity.Building; + CreateWorkingDirectoryIfItDoesntExist(); CreateTemporaryLabelIfNeeded(sourceControl); *************** *** 78,82 **** } ! internal void CreateTemporaryLabelIfNeeded(ISourceControl sourceControl) { if (sourceControl is ITemporaryLabeller) --- 80,84 ---- } ! private void CreateTemporaryLabelIfNeeded(ISourceControl sourceControl) { if (sourceControl is ITemporaryLabeller) *************** *** 88,92 **** private void RunBuild(IIntegrationResult result) { - target.Activity = ProjectActivity.Building; if (result.BuildCondition == BuildCondition.ForceBuild) Log.Info("Build forced"); --- 90,93 ---- *************** *** 99,105 **** private void PostBuild(IIntegrationResult result, IIntegrationResultManager resultManager) { ! if (ShouldPublishException(result)) { - // Shouldn't this be outside the if? HandleProjectLabelling(result); --- 100,105 ---- private void PostBuild(IIntegrationResult result, IIntegrationResultManager resultManager) { ! if (ShouldPublishResult(result)) { HandleProjectLabelling(result); *************** *** 114,118 **** } ! private bool ShouldPublishException(IIntegrationResult result) { IntegrationStatus integrationStatus = result.Status; --- 114,118 ---- } ! private bool ShouldPublishResult(IIntegrationResult result) { IntegrationStatus integrationStatus = result.Status; |
|
From: Graham T. <ta...@us...> - 2005-04-30 10:16:28
|
Update of /cvsroot/ccnet/ccnet/project/UnitTests/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21103/project/UnitTests/Core Modified Files: IntegrationRunnerTest.cs Log Message: CCNET-411 - Integration status should be Building during GetSource and temporary labelling Index: IntegrationRunnerTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/UnitTests/Core/IntegrationRunnerTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IntegrationRunnerTest.cs 16 Mar 2005 02:29:13 -0000 1.1 --- IntegrationRunnerTest.cs 30 Apr 2005 10:16:02 -0000 1.2 *************** *** 167,178 **** private void SetupShouldBuildExpectations() { - targetMock.Expect("Activity", ProjectActivity.Building); - targetMock.Expect("Activity", ProjectActivity.Sleeping); resultMock.ExpectAndReturn("ShouldRunBuild", true, modificationDelay); sourceControlMock.Expect("GetSource", result); resultMock.ExpectAndReturn("BuildCondition", BuildCondition.IfModificationExists); targetMock.Expect("Run", result); resultMock.Expect("MarkEndTime"); resultManagerMock.Expect("FinishIntegration"); resultMock.ExpectAndReturn("EndTime", time3); } --- 167,181 ---- private void SetupShouldBuildExpectations() { resultMock.ExpectAndReturn("ShouldRunBuild", true, modificationDelay); + + targetMock.Expect("Activity", ProjectActivity.Building); + sourceControlMock.Expect("GetSource", result); resultMock.ExpectAndReturn("BuildCondition", BuildCondition.IfModificationExists); + targetMock.Expect("Run", result); resultMock.Expect("MarkEndTime"); resultManagerMock.Expect("FinishIntegration"); + targetMock.Expect("Activity", ProjectActivity.Sleeping); resultMock.ExpectAndReturn("EndTime", time3); } |
|
From: Graham T. <ta...@us...> - 2005-04-29 12:51:48
|
Update of /cvsroot/ccnet/ccnet/project/UnitTests/Core/SourceControl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23164/project/UnitTests/Core/SourceControl Modified Files: ClearCaseTest.cs Log Message: CCNET-382 - ClearCase: labels with spaces cause failure CCNET-409 - ClearCase provider should support AutoGetSource Index: ClearCaseTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/UnitTests/Core/SourceControl/ClearCaseTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ClearCaseTest.cs 5 Apr 2005 17:00:01 -0000 1.1 --- ClearCaseTest.cs 29 Apr 2005 12:51:10 -0000 1.2 *************** *** 2,5 **** --- 2,6 ---- using System.Globalization; using Exortech.NetReflector; + using NMock; using NUnit.Framework; using ThoughtWorks.CruiseControl.Core; *************** *** 76,80 **** ProcessInfo info = _clearCase.CreateRenameBaselineProcessInfo(newName); ! Assert.AreEqual(string.Format("{0} rename baseline:{1}@\\{2} {3}", EXECUTABLE, _clearCase.TempBaseline, --- 77,81 ---- ProcessInfo info = _clearCase.CreateRenameBaselineProcessInfo(newName); ! Assert.AreEqual(string.Format("{0} rename baseline:{1}@\\{2} \"{3}\"", EXECUTABLE, _clearCase.TempBaseline, *************** *** 168,172 **** string label = "This-is-a-test"; ProcessInfo labelTypeProcess = _clearCase.CreateLabelTypeProcessInfo(label); ! Assert.AreEqual(" mklbtype -c \"CRUISECONTROL Comment\" " + label, labelTypeProcess.Arguments); Assert.AreEqual("cleartool.exe", labelTypeProcess.FileName); } --- 169,173 ---- string label = "This-is-a-test"; ProcessInfo labelTypeProcess = _clearCase.CreateLabelTypeProcessInfo(label); ! Assert.AreEqual(" mklbtype -c \"CRUISECONTROL Comment\" \"" + label + "\"", labelTypeProcess.Arguments); Assert.AreEqual("cleartool.exe", labelTypeProcess.FileName); } *************** *** 177,181 **** const string label = "This-is-a-test"; ProcessInfo labelProcess = _clearCase.CreateMakeLabelProcessInfo(label); ! Assert.AreEqual(@" mklabel -recurse " + label + " " + VIEWPATH, labelProcess.Arguments); Assert.AreEqual("cleartool.exe", labelProcess.FileName); } --- 178,182 ---- const string label = "This-is-a-test"; ProcessInfo labelProcess = _clearCase.CreateMakeLabelProcessInfo(label); ! Assert.AreEqual(@" mklabel -recurse """ + label + "\" " + VIEWPATH, labelProcess.Arguments); Assert.AreEqual("cleartool.exe", labelProcess.FileName); } *************** *** 192,195 **** --- 193,229 ---- Assert.IsTrue(_clearCase.HasFatalError(ClearCaseMother.REAL_ERROR_WITH_VOB)); } + + [Test] + public void ShouldGetSourceIfAutoGetSourceTrue() + { + DynamicMock executor = new DynamicMock(typeof(ProcessExecutor)); + ClearCase clearCase = new ClearCase((ProcessExecutor) executor.MockInstance); + clearCase.Executable = EXECUTABLE; + clearCase.ViewPath = VIEWPATH; + clearCase.AutoGetSource = true; + + IntegrationResult result = new IntegrationResult(); + ProcessInfo expectedProcessRequest = new ProcessInfo(EXECUTABLE, @"update -force -overwrite """ + VIEWPATH + @""""); + + executor.ExpectAndReturn("Execute", new ProcessResult("foo", null, 0, false), expectedProcessRequest); + clearCase.GetSource(result); + executor.Verify(); + } + + [Test] + public void ShouldNotGetSourceIfAutoGetSourceFalse() + { + DynamicMock executor = new DynamicMock(typeof(ProcessExecutor)); + ClearCase clearCase = new ClearCase((ProcessExecutor) executor.MockInstance); + clearCase.Executable = EXECUTABLE; + clearCase.ViewPath = VIEWPATH; + clearCase.AutoGetSource = false; + + IntegrationResult result = new IntegrationResult(); + + executor.ExpectNoCall("Execute", typeof(ProcessInfo)); + clearCase.GetSource(result); + executor.Verify(); + } } } \ No newline at end of file |
|
From: Graham T. <ta...@us...> - 2005-04-29 12:51:48
|
Update of /cvsroot/ccnet/ccnet/project/core/sourcecontrol In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23164/project/core/sourcecontrol Modified Files: ClearCase.cs Log Message: CCNET-382 - ClearCase: labels with spaces cause failure CCNET-409 - ClearCase provider should support AutoGetSource Index: ClearCase.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/sourcecontrol/ClearCase.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ClearCase.cs 5 Apr 2005 16:59:41 -0000 1.6 --- ClearCase.cs 29 Apr 2005 12:51:11 -0000 1.7 *************** *** 30,33 **** --- 30,38 ---- } + public ClearCase( ProcessExecutor executor ) + : base( new ClearCaseHistoryParser(), executor ) + { + } + [ReflectorProperty("executable", Required=false)] public string Executable *************** *** 72,75 **** --- 77,83 ---- } + [ReflectorProperty("autoGetSource", Required = false)] + public bool AutoGetSource = false; + public string TempBaseline { *************** *** 139,143 **** // This is a HACK. ProcessSourceControl.Execute doesn't allow the flexibility ClearCase needs // to allow nonzero exit codes and to selectively ignore certian error messages. ! internal void ExecuteIgnoreNonVobObjects( ProcessInfo info ) { info.TimeOut = Timeout; --- 147,151 ---- // This is a HACK. ProcessSourceControl.Execute doesn't allow the flexibility ClearCase needs // to allow nonzero exit codes and to selectively ignore certian error messages. ! private void ExecuteIgnoreNonVobObjects( ProcessInfo info ) { info.TimeOut = Timeout; *************** *** 210,214 **** public ProcessInfo CreateLabelTypeProcessInfo( string label ) { ! string args = " mklbtype -c \"CRUISECONTROL Comment\" " + label; Log.Debug( string.Format( "mklbtype: {0} {1}; [working dir: {2}]", Executable, args, ViewPath ) ); return new ProcessInfo( Executable, args, ViewPath ); --- 218,222 ---- public ProcessInfo CreateLabelTypeProcessInfo( string label ) { ! string args = " mklbtype -c \"CRUISECONTROL Comment\" \"" + label + "\""; Log.Debug( string.Format( "mklbtype: {0} {1}; [working dir: {2}]", Executable, args, ViewPath ) ); return new ProcessInfo( Executable, args, ViewPath ); *************** *** 222,226 **** public ProcessInfo CreateMakeLabelProcessInfo( string label ) { ! string args = String.Format( @" mklabel -recurse {0} {1}", label, ViewPath ); Log.Debug( string.Format( "mklabel: {0} {1}", Executable, args ) ); return new ProcessInfo( Executable, args ); --- 230,234 ---- public ProcessInfo CreateMakeLabelProcessInfo( string label ) { ! string args = String.Format( @" mklabel -recurse ""{0}"" {1}", label, ViewPath ); Log.Debug( string.Format( "mklabel: {0} {1}", Executable, args ) ); return new ProcessInfo( Executable, args ); *************** *** 236,240 **** public ProcessInfo CreateRenameBaselineProcessInfo( string name ) { ! string args = string.Format( "rename baseline:{0}@\\{1} {2}", TempBaseline, ProjectVobName, name ); Log.Debug( string.Format( "rename baseline: {0} {1}", Executable, args ) ); return new ProcessInfo( Executable, args ); --- 244,248 ---- public ProcessInfo CreateRenameBaselineProcessInfo( string name ) { ! string args = string.Format( "rename baseline:{0}@\\{1} \"{2}\"", TempBaseline, ProjectVobName, name ); Log.Debug( string.Format( "rename baseline: {0} {1}", Executable, args ) ); return new ProcessInfo( Executable, args ); *************** *** 280,284 **** throw new CruiseControlException( "you must specify the project VOB and view name if UseBaseLine is true" ); } ! } } } --- 288,307 ---- throw new CruiseControlException( "you must specify the project VOB and view name if UseBaseLine is true" ); } ! } ! ! public override void GetSource( IIntegrationResult result ) ! { ! if (AutoGetSource) ! { ! ProcessInfo info = new ProcessInfo(Executable, BuildGetSourceArguments()); ! Log.Info(string.Format("Getting source from ClearCase: {0} {1}", info.FileName, info.Arguments)); ! Execute(info); ! } ! } ! ! private string BuildGetSourceArguments() ! { ! return string.Format(@"update -force -overwrite ""{0}""", ViewPath); ! } } } |
|
From: Mike R. <mik...@us...> - 2005-04-26 22:00:34
|
Update of /cvsroot/ccnet/ccnet/project/UnitTests/Core/Tasks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9487/project/UnitTests/Core/Tasks Modified Files: ExecutableTaskTest.cs Log Message: CCNET-407 - setting ccnet.label in <exec> task Index: ExecutableTaskTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/UnitTests/Core/Tasks/ExecutableTaskTest.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExecutableTaskTest.cs 25 Apr 2005 02:00:24 -0000 1.3 --- ExecutableTaskTest.cs 26 Apr 2005 22:00:25 -0000 1.4 *************** *** 127,130 **** --- 127,131 ---- Assert.AreEqual(222000, info.TimeOut); Assert.AreEqual("test-args", info.Arguments); + Assert.AreEqual("1.0", info.EnvironmentVariables["ccnet.label"]); VerifyAll(); } |
|
From: Mike R. <mik...@us...> - 2005-04-26 22:00:33
|
Update of /cvsroot/ccnet/ccnet/project/core/tasks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9487/project/core/tasks Modified Files: ExecutableTask.cs Log Message: CCNET-407 - setting ccnet.label in <exec> task Index: ExecutableTask.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/tasks/ExecutableTask.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExecutableTask.cs 25 Apr 2005 02:00:25 -0000 1.2 --- ExecutableTask.cs 26 Apr 2005 22:00:24 -0000 1.3 *************** *** 89,92 **** --- 89,93 ---- ProcessInfo info = new ProcessInfo(executable, buildArgs, BaseDirectory(result)); info.TimeOut = buildTimeoutSeconds*1000; + info.EnvironmentVariables.Add("ccnet.label", result.Label); return info; } |
|
From: Owen R. <exo...@us...> - 2005-04-25 02:33:30
|
Update of /cvsroot/ccnet/ccnet/project/UnitTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15488/project/UnitTests Modified Files: UnitTests.csproj Log Message: forgot to save the UnitTests project Index: UnitTests.csproj =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/UnitTests/UnitTests.csproj,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -d -r1.109 -r1.110 *** UnitTests.csproj 25 Apr 2005 01:50:59 -0000 1.109 --- UnitTests.csproj 25 Apr 2005 02:33:21 -0000 1.110 *************** *** 953,961 **** /> <File - RelPath = "Web\ServerLogFileReaderTest.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "Web\test.config" BuildAction = "None" --- 953,956 ---- |
|
From: Owen R. <exo...@us...> - 2005-04-25 02:04:43
|
Update of /cvsroot/ccnet/ccnet/project/core/tasks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4544/project/core/tasks Added Files: ProcessTaskResult.cs Log Message: forgot to add ProcessTaskResult --- NEW FILE: ProcessTaskResult.cs --- using System; using System.Xml; using ThoughtWorks.CruiseControl.Core.Util; namespace ThoughtWorks.CruiseControl.Core.Tasks { public class ProcessTaskResult : ITaskResult { protected readonly ProcessResult result; public ProcessTaskResult(ProcessResult result) { this.result = result; } public virtual string Data { get { throw new NotImplementedException(); } } public virtual void WriteTo(XmlWriter writer) { writer.WriteStartElement("task"); if (result.Failed) writer.WriteAttributeString("failed", true.ToString()); if (result.TimedOut) writer.WriteAttributeString("timedout", true.ToString()); writer.WriteElementString("standardOutput", result.StandardOutput); writer.WriteElementString("standardError", result.StandardError); writer.WriteEndElement(); } public bool Succeeded() { return ! Failed(); } public bool Failed() { return result.Failed; } } } |
|
From: Owen R. <exo...@us...> - 2005-04-25 02:00:35
|
Update of /cvsroot/ccnet/ccnet/project/core/tasks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2602/project/core/tasks Modified Files: ExecutableTask.cs NAntTask.cs NUnitTask.cs Log Message: refactored BaseWorkingDirectory functionality into IntegrationResult Index: ExecutableTask.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/tasks/ExecutableTask.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExecutableTask.cs 17 Mar 2005 01:02:18 -0000 1.1 --- ExecutableTask.cs 25 Apr 2005 02:00:25 -0000 1.2 *************** *** 1,4 **** using System; - using System.IO; using Exortech.NetReflector; using ThoughtWorks.CruiseControl.Core.Util; --- 1,3 ---- *************** *** 95,110 **** private string BaseDirectory(IIntegrationResult result) { ! if (configuredBaseDirectory == null || configuredBaseDirectory == "") ! { ! return result.WorkingDirectory; ! } ! else if (Path.IsPathRooted(configuredBaseDirectory)) ! { ! return configuredBaseDirectory; ! } ! else ! { ! return Path.Combine(result.WorkingDirectory, configuredBaseDirectory); ! } } --- 94,98 ---- private string BaseDirectory(IIntegrationResult result) { ! return result.BaseFromWorkingDirectory(configuredBaseDirectory); } Index: NUnitTask.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/tasks/NUnitTask.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NUnitTask.cs 14 Apr 2005 18:03:05 -0000 1.9 --- NUnitTask.cs 25 Apr 2005 02:00:26 -0000 1.10 *************** *** 25,33 **** [ReflectorProperty("outputfile", Required=false)] ! public string OutputFile; public virtual void Run(IIntegrationResult result) { ! string outputFile = result.BaseFromArtifactsDirectory(OutputFile, DefaultOutputFile); string args = new NUnitArgument(Assemblies, outputFile).ToString(); Log.Debug(string.Format("Running unit tests: {0} {1}", NUnitPath, args)); --- 25,33 ---- [ReflectorProperty("outputfile", Required=false)] ! public string OutputFile = DefaultOutputFile; public virtual void Run(IIntegrationResult result) { ! string outputFile = result.BaseFromArtifactsDirectory(OutputFile); string args = new NUnitArgument(Assemblies, outputFile).ToString(); Log.Debug(string.Format("Running unit tests: {0} {1}", NUnitPath, args)); Index: NAntTask.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/tasks/NAntTask.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NAntTask.cs 17 Mar 2005 01:02:18 -0000 1.1 --- NAntTask.cs 25 Apr 2005 02:00:25 -0000 1.2 *************** *** 28,32 **** } ! private string _executable = DEFAULT_EXECUTABLE; private string buildFile = ""; private string configuredBaseDirectory = ""; --- 28,32 ---- } ! private string executable = DEFAULT_EXECUTABLE; private string buildFile = ""; private string configuredBaseDirectory = ""; *************** *** 43,48 **** public string Executable { ! get { return _executable; } ! set { _executable = value; } } --- 43,48 ---- public string Executable { ! get { return executable; } ! set { executable = value; } } *************** *** 130,145 **** private string BaseDirectory(IIntegrationResult result) { ! if (StringUtil.IsBlank(configuredBaseDirectory)) ! { ! return result.WorkingDirectory; ! } ! else if (Path.IsPathRooted(configuredBaseDirectory)) ! { ! return configuredBaseDirectory; ! } ! else ! { ! return Path.Combine(result.WorkingDirectory, configuredBaseDirectory); ! } } --- 130,134 ---- private string BaseDirectory(IIntegrationResult result) { ! return result.BaseFromWorkingDirectory(configuredBaseDirectory); } |
|
From: Owen R. <exo...@us...> - 2005-04-25 02:00:34
|
Update of /cvsroot/ccnet/ccnet/project/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2602/project/core Modified Files: CruiseServer.cs IIntegrationResult.cs IntegrationResult.cs Log Message: refactored BaseWorkingDirectory functionality into IntegrationResult Index: IntegrationResult.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/IntegrationResult.cs,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** IntegrationResult.cs 14 Apr 2005 18:08:45 -0000 1.26 --- IntegrationResult.cs 25 Apr 2005 02:00:24 -0000 1.27 *************** *** 273,287 **** } ! public string BaseFromArtifactsDirectory(string fileToBase, string defaultFilename) { ! if (StringUtil.IsBlank(fileToBase)) return Path.Combine(ArtifactDirectory, defaultFilename); ! return Path.Combine(ArtifactDirectory, fileToBase); } ! public string BaseFromWorkingDirectory(string fileToBase, string defaultFilename) { ! if (StringUtil.IsBlank(fileToBase)) return Path.Combine(WorkingDirectory, defaultFilename); ! return Path.Combine(WorkingDirectory, fileToBase); ! } /// <summary> --- 273,287 ---- } ! public string BaseFromArtifactsDirectory(string pathToBase) { ! if (StringUtil.IsBlank(pathToBase)) return ArtifactDirectory; ! return Path.Combine(ArtifactDirectory, pathToBase); } ! public string BaseFromWorkingDirectory(string pathToBase) { ! if (StringUtil.IsBlank(pathToBase)) return WorkingDirectory; ! return Path.Combine(WorkingDirectory, pathToBase); ! } /// <summary> Index: IIntegrationResult.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/IIntegrationResult.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** IIntegrationResult.cs 14 Apr 2005 18:08:45 -0000 1.6 --- IIntegrationResult.cs 25 Apr 2005 02:00:24 -0000 1.7 *************** *** 36,40 **** void MarkEndTime(); bool ShouldRunBuild(int modificationDelaySeconds); ! string BaseFromArtifactsDirectory(string fileToBase, string defaultFilename); } } \ No newline at end of file --- 36,41 ---- void MarkEndTime(); bool ShouldRunBuild(int modificationDelaySeconds); ! string BaseFromArtifactsDirectory(string pathToBase); ! string BaseFromWorkingDirectory(string pathToBase); } } \ No newline at end of file Index: CruiseServer.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/CruiseServer.cs,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** CruiseServer.cs 15 Feb 2005 05:43:07 -0000 1.31 --- CruiseServer.cs 25 Apr 2005 02:00:24 -0000 1.32 *************** *** 3,8 **** using System.IO; using System.Threading; - using ThoughtWorks.Core.Log; using ThoughtWorks.CruiseControl.Core.Config; using ThoughtWorks.CruiseControl.Core.Publishers; using ThoughtWorks.CruiseControl.Core.Util; --- 3,8 ---- using System.IO; using System.Threading; using ThoughtWorks.CruiseControl.Core.Config; + using ThoughtWorks.CruiseControl.Core.Logging; using ThoughtWorks.CruiseControl.Core.Publishers; using ThoughtWorks.CruiseControl.Core.Util; |
|
From: Owen R. <exo...@us...> - 2005-04-25 02:00:34
|
Update of /cvsroot/ccnet/ccnet/project/core/label In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2602/project/core/label Modified Files: DefaultLabeller.cs Log Message: refactored BaseWorkingDirectory functionality into IntegrationResult Index: DefaultLabeller.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/label/DefaultLabeller.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DefaultLabeller.cs 28 Oct 2004 17:29:45 -0000 1.8 --- DefaultLabeller.cs 25 Apr 2005 02:00:25 -0000 1.9 *************** *** 8,21 **** public class DefaultLabeller : ILabeller { ! private string _labelPrefix = ""; ! ! public static string INITIAL_LABEL = "1"; [ReflectorProperty("prefix", Required=false)] ! public string LabelPrefix ! { ! get { return _labelPrefix; } ! set { _labelPrefix = value; } ! } public string Generate(IIntegrationResult previousResult) --- 8,15 ---- public class DefaultLabeller : ILabeller { ! public static readonly string INITIAL_LABEL = "1"; [ReflectorProperty("prefix", Required=false)] ! public string LabelPrefix = ""; public string Generate(IIntegrationResult previousResult) *************** *** 23,32 **** if (previousResult == null || previousResult.Label == null) { ! return _labelPrefix + INITIAL_LABEL; } ! else if(previousResult.Status == IntegrationStatus.Success) { ! return _labelPrefix + IncrementLabel(previousResult.Label); ! } else { --- 17,26 ---- if (previousResult == null || previousResult.Label == null) { ! return LabelPrefix + INITIAL_LABEL; } ! else if (previousResult.Status == IntegrationStatus.Success) { ! return LabelPrefix + IncrementLabel(previousResult.Label); ! } else { *************** *** 42,46 **** public string IncrementLabel(string label) { ! string numericLabel = Regex.Replace(label,@".*?(\d+$)", "$1"); int newLabel = int.Parse(numericLabel); newLabel++; --- 36,40 ---- public string IncrementLabel(string label) { ! string numericLabel = Regex.Replace(label, @".*?(\d+$)", "$1"); int newLabel = int.Parse(numericLabel); newLabel++; *************** *** 48,50 **** } } ! } --- 42,44 ---- } } ! } \ No newline at end of file |
|
From: Owen R. <exo...@us...> - 2005-04-25 02:00:34
|
Update of /cvsroot/ccnet/ccnet/project/UnitTests/Core/Tasks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2602/project/UnitTests/Core/Tasks Modified Files: ExecutableTaskTest.cs NAntTaskTest.cs Log Message: refactored BaseWorkingDirectory functionality into IntegrationResult Index: ExecutableTaskTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/UnitTests/Core/Tasks/ExecutableTaskTest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExecutableTaskTest.cs 7 Apr 2005 15:44:53 -0000 1.2 --- ExecutableTaskTest.cs 25 Apr 2005 02:00:24 -0000 1.3 *************** *** 166,170 **** { _task.ConfiguredBaseDirectory = @"c:\my\base\directory"; ! CheckBaseDirectory(new IntegrationResult(), @"c:\my\base\directory"); } --- 166,170 ---- { _task.ConfiguredBaseDirectory = @"c:\my\base\directory"; ! CheckBaseDirectory(new IntegrationResult("project", "projectWorkingDirectory"), @"c:\my\base\directory"); } Index: NAntTaskTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/UnitTests/Core/Tasks/NAntTaskTest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NAntTaskTest.cs 7 Apr 2005 15:44:52 -0000 1.2 --- NAntTaskTest.cs 25 Apr 2005 02:00:24 -0000 1.3 *************** *** 19,35 **** public const int FAILED_EXIT_CODE = -1; ! private NAntTask _builder; ! private IMock _mockExecutor; [SetUp] public void SetUp() { ! _mockExecutor = new DynamicMock(typeof (ProcessExecutor)); ! _builder = new NAntTask((ProcessExecutor) _mockExecutor.MockInstance); } private void VerifyAll() { ! _mockExecutor.Verify(); } --- 19,35 ---- public const int FAILED_EXIT_CODE = -1; ! private NAntTask builder; ! private IMock mockExecutor; [SetUp] public void SetUp() { ! mockExecutor = new DynamicMock(typeof (ProcessExecutor)); ! builder = new NAntTask((ProcessExecutor) mockExecutor.MockInstance); } private void VerifyAll() { ! mockExecutor.Verify(); } *************** *** 37,41 **** public void TearDown() { ! _mockExecutor.Verify(); } --- 37,41 ---- public void TearDown() { ! mockExecutor.Verify(); } *************** *** 56,68 **** </nant>"; ! NetReflector.Read(xml, _builder); ! Assert.AreEqual(@"C:\", _builder.ConfiguredBaseDirectory); ! Assert.AreEqual("mybuild.build", _builder.BuildFile); ! Assert.AreEqual("NAnt.exe", _builder.Executable); ! Assert.AreEqual(1, _builder.Targets.Length); ! Assert.AreEqual(123, _builder.BuildTimeoutSeconds); ! Assert.AreEqual("SourceForge.NAnt.XmlLogger", _builder.Logger); ! Assert.AreEqual("foo", _builder.Targets[0]); ! Assert.AreEqual(false, _builder.NoLogo); } --- 56,68 ---- </nant>"; ! NetReflector.Read(xml, builder); ! Assert.AreEqual(@"C:\", builder.ConfiguredBaseDirectory); ! Assert.AreEqual("mybuild.build", builder.BuildFile); ! Assert.AreEqual("NAnt.exe", builder.Executable); ! Assert.AreEqual(1, builder.Targets.Length); ! Assert.AreEqual(123, builder.BuildTimeoutSeconds); ! Assert.AreEqual("SourceForge.NAnt.XmlLogger", builder.Logger); ! Assert.AreEqual("foo", builder.Targets[0]); ! Assert.AreEqual(false, builder.NoLogo); } *************** *** 72,82 **** string xml = @"<nant />"; ! NetReflector.Read(xml, _builder); ! Assert.AreEqual("", _builder.ConfiguredBaseDirectory); ! Assert.AreEqual(NAntTask.DEFAULT_EXECUTABLE, _builder.Executable); ! Assert.AreEqual(0, _builder.Targets.Length); ! Assert.AreEqual(NAntTask.DEFAULT_BUILD_TIMEOUT, _builder.BuildTimeoutSeconds); ! Assert.AreEqual(NAntTask.DEFAULT_LOGGER, _builder.Logger); ! Assert.AreEqual(NAntTask.DEFAULT_NOLOGO, _builder.NoLogo); } --- 72,82 ---- string xml = @"<nant />"; ! NetReflector.Read(xml, builder); ! Assert.AreEqual("", builder.ConfiguredBaseDirectory); ! Assert.AreEqual(NAntTask.DEFAULT_EXECUTABLE, builder.Executable); ! Assert.AreEqual(0, builder.Targets.Length); ! Assert.AreEqual(NAntTask.DEFAULT_BUILD_TIMEOUT, builder.BuildTimeoutSeconds); ! Assert.AreEqual(NAntTask.DEFAULT_LOGGER, builder.Logger); ! Assert.AreEqual(NAntTask.DEFAULT_NOLOGO, builder.NoLogo); } *************** *** 85,92 **** { ProcessResult returnVal = CreateSuccessfulProcessResult(); ! _mockExecutor.ExpectAndReturn("Execute", returnVal, new IsAnything()); IntegrationResult result = new IntegrationResult(); ! _builder.Run(result); Assert.IsTrue(result.Succeeded); --- 85,92 ---- { ProcessResult returnVal = CreateSuccessfulProcessResult(); ! mockExecutor.ExpectAndReturn("Execute", returnVal, new IsAnything()); IntegrationResult result = new IntegrationResult(); ! builder.Run(result); Assert.IsTrue(result.Succeeded); *************** *** 99,106 **** { ProcessResult returnVal = new ProcessResult("output", null, FAILED_EXIT_CODE, false); ! _mockExecutor.ExpectAndReturn("Execute", returnVal, new IsAnything()); IntegrationResult result = new IntegrationResult(); ! _builder.Run(result); Assert.IsTrue(result.Failed); --- 99,106 ---- { ProcessResult returnVal = new ProcessResult("output", null, FAILED_EXIT_CODE, false); ! mockExecutor.ExpectAndReturn("Execute", returnVal, new IsAnything()); IntegrationResult result = new IntegrationResult(); ! builder.Run(result); Assert.IsTrue(result.Failed); *************** *** 113,120 **** { ProcessResult returnVal = new ProcessResult("output", null, SUCCESSFUL_EXIT_CODE, true); ! _mockExecutor.ExpectAndReturn("Execute", returnVal, new IsAnything()); IntegrationResult result = new IntegrationResult(); ! _builder.Run(result); } --- 113,120 ---- { ProcessResult returnVal = new ProcessResult("output", null, SUCCESSFUL_EXIT_CODE, true); ! mockExecutor.ExpectAndReturn("Execute", returnVal, new IsAnything()); IntegrationResult result = new IntegrationResult(); ! builder.Run(result); } *************** *** 122,129 **** public void ShouldThrowBuilderExceptionIfProcessThrowsException() { ! _mockExecutor.ExpectAndThrow("Execute", new Win32Exception(), new IsAnything()); IntegrationResult result = new IntegrationResult(); ! _builder.Run(result); } --- 122,129 ---- public void ShouldThrowBuilderExceptionIfProcessThrowsException() { ! mockExecutor.ExpectAndThrow("Execute", new Win32Exception(), new IsAnything()); IntegrationResult result = new IntegrationResult(); ! builder.Run(result); } *************** *** 133,137 **** ProcessResult returnVal = CreateSuccessfulProcessResult(); CollectingConstraint constraint = new CollectingConstraint(); ! _mockExecutor.ExpectAndReturn("Execute", returnVal, constraint); IntegrationResult result = new IntegrationResult(); --- 133,137 ---- ProcessResult returnVal = CreateSuccessfulProcessResult(); CollectingConstraint constraint = new CollectingConstraint(); ! mockExecutor.ExpectAndReturn("Execute", returnVal, constraint); IntegrationResult result = new IntegrationResult(); *************** *** 140,154 **** result.ArtifactDirectory = @"C:\temp"; ! _builder.ConfiguredBaseDirectory = @"c:\"; ! _builder.Executable = "NAnt.exe"; ! _builder.BuildFile = "mybuild.build"; ! _builder.BuildArgs = "myArgs"; ! _builder.Targets = new string[] {"target1", "target2"}; ! _builder.BuildTimeoutSeconds = 2; ! _builder.Run(result); ProcessInfo info = (ProcessInfo) constraint.Parameter; ! Assert.AreEqual(_builder.Executable, info.FileName); ! Assert.AreEqual(_builder.ConfiguredBaseDirectory, info.WorkingDirectory); Assert.AreEqual(2000, info.TimeOut); Assert.AreEqual(@"-nologo -buildfile:mybuild.build -logger:NAnt.Core.XmlLogger myArgs -D:label-to-apply=1.0 -D:ccnet.label=1.0 -D:ccnet.buildcondition=NoBuild -D:ccnet.working.directory=""C:\temp"" -D:ccnet.artifact.directory=""C:\temp"" target1 target2", info.Arguments); --- 140,154 ---- result.ArtifactDirectory = @"C:\temp"; ! builder.ConfiguredBaseDirectory = @"c:\"; ! builder.Executable = "NAnt.exe"; ! builder.BuildFile = "mybuild.build"; ! builder.BuildArgs = "myArgs"; ! builder.Targets = new string[] {"target1", "target2"}; ! builder.BuildTimeoutSeconds = 2; ! builder.Run(result); ProcessInfo info = (ProcessInfo) constraint.Parameter; ! Assert.AreEqual(builder.Executable, info.FileName); ! Assert.AreEqual(builder.ConfiguredBaseDirectory, info.WorkingDirectory); Assert.AreEqual(2000, info.TimeOut); Assert.AreEqual(@"-nologo -buildfile:mybuild.build -logger:NAnt.Core.XmlLogger myArgs -D:label-to-apply=1.0 -D:ccnet.label=1.0 -D:ccnet.buildcondition=NoBuild -D:ccnet.working.directory=""C:\temp"" -D:ccnet.artifact.directory=""C:\temp"" target1 target2", info.Arguments); *************** *** 160,169 **** ProcessResult returnVal = CreateSuccessfulProcessResult(); CollectingConstraint constraint = new CollectingConstraint(); ! _mockExecutor.ExpectAndReturn("Execute", returnVal, constraint); ! _builder.Run(new IntegrationResult()); ProcessInfo info = (ProcessInfo) constraint.Parameter; ! Assert.AreEqual(_builder.Executable, NAntTask.DEFAULT_EXECUTABLE); Assert.AreEqual(NAntTask.DEFAULT_BUILD_TIMEOUT*1000, info.TimeOut); Assert.AreEqual("-nologo -logger:NAnt.Core.XmlLogger -D:ccnet.buildcondition=NoBuild", info.Arguments); --- 160,169 ---- ProcessResult returnVal = CreateSuccessfulProcessResult(); CollectingConstraint constraint = new CollectingConstraint(); ! mockExecutor.ExpectAndReturn("Execute", returnVal, constraint); ! builder.Run(new IntegrationResult()); ProcessInfo info = (ProcessInfo) constraint.Parameter; ! Assert.AreEqual(builder.Executable, NAntTask.DEFAULT_EXECUTABLE); Assert.AreEqual(NAntTask.DEFAULT_BUILD_TIMEOUT*1000, info.TimeOut); Assert.AreEqual("-nologo -logger:NAnt.Core.XmlLogger -D:ccnet.buildcondition=NoBuild", info.Arguments); *************** *** 175,182 **** ProcessResult returnVal = CreateSuccessfulProcessResult(); CollectingConstraint constraint = new CollectingConstraint(); ! _mockExecutor.ExpectAndReturn("Execute", returnVal, constraint); ! _builder.BuildFile = "my project.build"; ! _builder.Run(new IntegrationResult()); ProcessInfo info = (ProcessInfo) constraint.Parameter; --- 175,182 ---- ProcessResult returnVal = CreateSuccessfulProcessResult(); CollectingConstraint constraint = new CollectingConstraint(); ! mockExecutor.ExpectAndReturn("Execute", returnVal, constraint); ! builder.BuildFile = "my project.build"; ! builder.Run(new IntegrationResult()); ProcessInfo info = (ProcessInfo) constraint.Parameter; *************** *** 187,191 **** public void IfConfiguredBaseDirectoryIsNotSetUseProjectWorkingDirectoryAsBaseDirectory() { ! _builder.ConfiguredBaseDirectory = null; CheckBaseDirectoryIsProjectDirectoryWithGivenRelativePart(""); } --- 187,191 ---- public void IfConfiguredBaseDirectoryIsNotSetUseProjectWorkingDirectoryAsBaseDirectory() { ! builder.ConfiguredBaseDirectory = null; CheckBaseDirectoryIsProjectDirectoryWithGivenRelativePart(""); } *************** *** 194,198 **** public void IfConfiguredBaseDirectoryIsEmptyUseProjectWorkingDirectoryAsBaseDirectory() { ! _builder.ConfiguredBaseDirectory = ""; CheckBaseDirectoryIsProjectDirectoryWithGivenRelativePart(""); } --- 194,198 ---- public void IfConfiguredBaseDirectoryIsEmptyUseProjectWorkingDirectoryAsBaseDirectory() { ! builder.ConfiguredBaseDirectory = ""; CheckBaseDirectoryIsProjectDirectoryWithGivenRelativePart(""); } *************** *** 201,205 **** public void IfConfiguredBaseDirectoryIsNotAbsoluteUseProjectWorkingDirectoryAsFirstPartOfBaseDirectory() { ! _builder.ConfiguredBaseDirectory = "relativeBaseDirectory"; CheckBaseDirectoryIsProjectDirectoryWithGivenRelativePart("relativeBaseDirectory"); } --- 201,205 ---- public void IfConfiguredBaseDirectoryIsNotAbsoluteUseProjectWorkingDirectoryAsFirstPartOfBaseDirectory() { ! builder.ConfiguredBaseDirectory = "relativeBaseDirectory"; CheckBaseDirectoryIsProjectDirectoryWithGivenRelativePart("relativeBaseDirectory"); } *************** *** 218,223 **** public void IfConfiguredBaseDirectoryIsAbsoluteUseItAtBaseDirectory() { ! _builder.ConfiguredBaseDirectory = @"c:\my\base\directory"; ! CheckBaseDirectory(new IntegrationResult(), @"c:\my\base\directory"); } --- 218,223 ---- public void IfConfiguredBaseDirectoryIsAbsoluteUseItAtBaseDirectory() { ! builder.ConfiguredBaseDirectory = @"c:\my\base\directory"; ! CheckBaseDirectory(new IntegrationResult("project", "projectWorkingDirectory"), @"c:\my\base\directory"); } *************** *** 226,232 **** ProcessResult returnVal = CreateSuccessfulProcessResult(); CollectingConstraint constraint = new CollectingConstraint(); ! _mockExecutor.ExpectAndReturn("Execute", returnVal, constraint); ! _builder.Run(result); ProcessInfo info = (ProcessInfo) constraint.Parameter; --- 226,232 ---- ProcessResult returnVal = CreateSuccessfulProcessResult(); CollectingConstraint constraint = new CollectingConstraint(); ! mockExecutor.ExpectAndReturn("Execute", returnVal, constraint); ! builder.Run(result); ProcessInfo info = (ProcessInfo) constraint.Parameter; *************** *** 238,243 **** public void ShouldGiveAPresentationValueForTargetsThatIsANewLineSeparatedEquivalentOfAllTargets() { ! _builder.Targets = new string[] {"target1", "target2"}; ! Assert.AreEqual("target1" + Environment.NewLine + "target2", _builder.TargetsForPresentation); } --- 238,243 ---- public void ShouldGiveAPresentationValueForTargetsThatIsANewLineSeparatedEquivalentOfAllTargets() { ! builder.Targets = new string[] {"target1", "target2"}; ! Assert.AreEqual("target1" + Environment.NewLine + "target2", builder.TargetsForPresentation); } *************** *** 245,251 **** public void ShouldWorkForSingleTargetWhenSettingThroughPresentationValue() { ! _builder.TargetsForPresentation = "target1"; ! Assert.AreEqual("target1", _builder.Targets[0]); ! Assert.AreEqual(1, _builder.Targets.Length); } --- 245,251 ---- public void ShouldWorkForSingleTargetWhenSettingThroughPresentationValue() { ! builder.TargetsForPresentation = "target1"; ! Assert.AreEqual("target1", builder.Targets[0]); ! Assert.AreEqual(1, builder.Targets.Length); } *************** *** 253,260 **** public void ShouldSplitAtNewLineWhenSettingThroughPresentationValue() { ! _builder.TargetsForPresentation = "target1" + Environment.NewLine + "target2"; ! Assert.AreEqual("target1", _builder.Targets[0]); ! Assert.AreEqual("target2", _builder.Targets[1]); ! Assert.AreEqual(2, _builder.Targets.Length); } --- 253,260 ---- public void ShouldSplitAtNewLineWhenSettingThroughPresentationValue() { ! builder.TargetsForPresentation = "target1" + Environment.NewLine + "target2"; ! Assert.AreEqual("target1", builder.Targets[0]); ! Assert.AreEqual("target2", builder.Targets[1]); ! Assert.AreEqual(2, builder.Targets.Length); } *************** *** 262,269 **** public void ShouldWorkForEmptyAndNullStringsWhenSettingThroughPresentationValue() { ! _builder.TargetsForPresentation = ""; ! Assert.AreEqual(0, _builder.Targets.Length); ! _builder.TargetsForPresentation = null; ! Assert.AreEqual(0, _builder.Targets.Length); } --- 262,269 ---- public void ShouldWorkForEmptyAndNullStringsWhenSettingThroughPresentationValue() { ! builder.TargetsForPresentation = ""; ! Assert.AreEqual(0, builder.Targets.Length); ! builder.TargetsForPresentation = null; ! Assert.AreEqual(0, builder.Targets.Length); } |
|
From: Owen R. <exo...@us...> - 2005-04-25 02:00:33
|
Update of /cvsroot/ccnet/ccnet/project/UnitTests/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2602/project/UnitTests/Core Modified Files: IntegrationResultManagerTest.cs IntegrationResultTest.cs Log Message: refactored BaseWorkingDirectory functionality into IntegrationResult Index: IntegrationResultManagerTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/UnitTests/Core/IntegrationResultManagerTest.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IntegrationResultManagerTest.cs 5 Apr 2005 17:53:29 -0000 1.3 --- IntegrationResultManagerTest.cs 25 Apr 2005 02:00:23 -0000 1.4 *************** *** 111,115 **** project.Labeller = (ILabeller) mockLabeller.MockInstance; project.StateManager = (IStateManager) mockStateManager.MockInstance; - project.WebURL = Project.DEFAULT_WEB_URL; project.ConfiguredArtifactDirectory = project.ConfiguredWorkingDirectory; return project; --- 111,114 ---- Index: IntegrationResultTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/UnitTests/Core/IntegrationResultTest.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** IntegrationResultTest.cs 14 Apr 2005 18:08:44 -0000 1.6 --- IntegrationResultTest.cs 25 Apr 2005 02:00:23 -0000 1.7 *************** *** 127,131 **** { result.ArtifactDirectory = @"c:\"; ! Assert.AreEqual(@"c:\hello.bat", result.BaseFromArtifactsDirectory("hello.bat", "default.bat")); } --- 127,131 ---- { result.ArtifactDirectory = @"c:\"; ! Assert.AreEqual(@"c:\hello.bat", result.BaseFromArtifactsDirectory("hello.bat")); } *************** *** 134,147 **** { result.ArtifactDirectory = @"c:\"; ! Assert.AreEqual(@"d:\hello.bat", result.BaseFromArtifactsDirectory(@"d:\hello.bat", "default.bat")); ! Assert.AreEqual(@"c:\temp\hello.bat", result.BaseFromArtifactsDirectory(@"c:\temp\hello.bat", "default.bat")); ! } ! ! [Test] ! public void ShouldBaseFromArtifactsDirUsingDefaultFileIfPathIsEmptyOrNull() ! { ! result.ArtifactDirectory = @"c:\"; ! Assert.AreEqual(@"c:\foo.bat", result.BaseFromArtifactsDirectory(null, "foo.bat")); ! Assert.AreEqual(@"c:\foo.bat", result.BaseFromArtifactsDirectory(string.Empty, "foo.bat")); } --- 134,138 ---- { result.ArtifactDirectory = @"c:\"; ! Assert.AreEqual(@"d:\hello.bat", result.BaseFromArtifactsDirectory(@"d:\hello.bat")); } *************** *** 150,154 **** { result.WorkingDirectory = @"c:\"; ! Assert.AreEqual(@"c:\hello.bat", result.BaseFromWorkingDirectory("hello.bat", "default.bat")); } --- 141,145 ---- { result.WorkingDirectory = @"c:\"; ! Assert.AreEqual(@"c:\hello.bat", result.BaseFromWorkingDirectory("hello.bat")); } *************** *** 157,170 **** { result.WorkingDirectory = @"c:\"; ! Assert.AreEqual(@"d:\hello.bat", result.BaseFromWorkingDirectory(@"d:\hello.bat", "default.bat")); ! Assert.AreEqual(@"c:\temp\hello.bat", result.BaseFromWorkingDirectory(@"c:\temp\hello.bat", "default.bat")); ! } ! ! [Test] ! public void ShouldBaseFromWorkingDirUsingDefaultFileIfPathIsEmptyOrNull() ! { ! result.WorkingDirectory = @"c:\"; ! Assert.AreEqual(@"c:\foo.bat", result.BaseFromWorkingDirectory(null, "foo.bat")); ! Assert.AreEqual(@"c:\foo.bat", result.BaseFromWorkingDirectory(string.Empty, "foo.bat")); } } --- 148,152 ---- { result.WorkingDirectory = @"c:\"; ! Assert.AreEqual(@"d:\hello.bat", result.BaseFromWorkingDirectory(@"d:\hello.bat")); } } |
|
From: Owen R. <exo...@us...> - 2005-04-25 01:54:21
|
Update of /cvsroot/ccnet/ccnet/project/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv890/project/core Modified Files: Project.cs ProjectBase.cs Log Message: improved default project url Index: ProjectBase.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/ProjectBase.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ProjectBase.cs 9 Mar 2005 23:35:31 -0000 1.18 --- ProjectBase.cs 25 Apr 2005 01:54:11 -0000 1.19 *************** *** 2,5 **** --- 2,6 ---- using Exortech.NetReflector; using ThoughtWorks.CruiseControl.Core.Triggers; + using ThoughtWorks.CruiseControl.Core.Util; using ThoughtWorks.CruiseControl.Remote; *************** *** 12,17 **** private string _name; ! private string _configuredWorkingDirectory = ""; ! private string _configuredArtifactDirectory = ""; private ITrigger[] triggers = new ITrigger[] { new IntervalTrigger() }; private ExternalLink[] externalLinks = new ExternalLink[0]; --- 13,18 ---- private string _name; ! private string configuredWorkingDirectory = ""; ! private string configuredArtifactDirectory = ""; private ITrigger[] triggers = new ITrigger[] { new IntervalTrigger() }; private ExternalLink[] externalLinks = new ExternalLink[0]; *************** *** 34,39 **** public string ConfiguredWorkingDirectory { ! get { return _configuredWorkingDirectory; } ! set { _configuredWorkingDirectory = value; } } --- 35,40 ---- public string ConfiguredWorkingDirectory { ! get { return configuredWorkingDirectory; } ! set { configuredWorkingDirectory = value; } } *************** *** 41,46 **** public string ConfiguredArtifactDirectory { ! get { return _configuredArtifactDirectory; } ! set { _configuredArtifactDirectory = value; } } --- 42,47 ---- public string ConfiguredArtifactDirectory { ! get { return configuredArtifactDirectory; } ! set { configuredArtifactDirectory = value; } } *************** *** 56,67 **** get { ! if (_configuredWorkingDirectory == null || _configuredWorkingDirectory == string.Empty) { return new DirectoryInfo(Path.Combine(Name, DefaultWorkingSubDirectory)).FullName; } ! else ! { ! return new DirectoryInfo(_configuredWorkingDirectory).FullName; ! } } } --- 57,65 ---- get { ! if (StringUtil.IsBlank(configuredWorkingDirectory)) { return new DirectoryInfo(Path.Combine(Name, DefaultWorkingSubDirectory)).FullName; } ! return new DirectoryInfo(configuredWorkingDirectory).FullName; } } *************** *** 71,82 **** get { ! if (_configuredArtifactDirectory == null || _configuredArtifactDirectory == string.Empty) { return new DirectoryInfo(Path.Combine(Name, DefaultArtifactSubDirectory)).FullName; } ! else ! { ! return new DirectoryInfo(_configuredArtifactDirectory).FullName; ! } } } --- 69,77 ---- get { ! if (StringUtil.IsBlank(configuredArtifactDirectory)) { return new DirectoryInfo(Path.Combine(Name, DefaultArtifactSubDirectory)).FullName; } ! return new DirectoryInfo(configuredArtifactDirectory).FullName; } } Index: Project.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/Project.cs,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** Project.cs 16 Mar 2005 04:33:42 -0000 1.52 --- Project.cs 25 Apr 2005 01:54:11 -0000 1.53 *************** *** 1,2 **** --- 1,3 ---- + using System; using System.ComponentModel; using System.IO; *************** *** 38,67 **** public event IntegrationCompletedEventHandler IntegrationCompleted; ! public const string DEFAULT_WEB_URL = "http://localhost/CruiseControl.NET/"; ! ! private string _webURL = DEFAULT_WEB_URL; ! private ISourceControl _sourceControl = new NullSourceControl(); ! private ITask _builder = new NullTask(); ! private ILabeller _labeller = new DefaultLabeller(); ! private ITask[] _tasks = new ITask[0]; ! private IIntegrationCompletedEventHandler[] _publishers = new IIntegrationCompletedEventHandler[0]; ! private ProjectActivity _currentActivity = ProjectActivity.Sleeping; ! private int _modificationDelaySeconds = 0; ! private IStateManager _state; ! private IIntegrationResultManager _integrationResultManager; ! private bool _publishExceptions = true; private IIntegratable integratable; public Project() { ! _state = new ProjectStateManager(this, new IntegrationStateManager()); ! _integrationResultManager = new IntegrationResultManager(this); ! this.integratable = new IntegrationRunner(_integrationResultManager, this); } // This is nasty - test constructors and real constructors should be linked, but we have circular references here that need // to be sorted out ! public Project(IIntegratable integratable) : this () ! { this.integratable = integratable; } --- 39,66 ---- public event IntegrationCompletedEventHandler IntegrationCompleted; ! private string webUrl = DefaultUrl(); ! private ISourceControl sourceControl = new NullSourceControl(); ! private ITask builder = new NullTask(); ! private ILabeller labeller = new DefaultLabeller(); ! private ITask[] tasks = new ITask[0]; ! private IIntegrationCompletedEventHandler[] publishers = new IIntegrationCompletedEventHandler[0]; ! private ProjectActivity currentActivity = ProjectActivity.Sleeping; ! private int modificationDelaySeconds = 0; ! private IStateManager state; ! private IIntegrationResultManager integrationResultManager; ! private bool publishExceptions = true; private IIntegratable integratable; public Project() { ! state = new ProjectStateManager(this, new IntegrationStateManager()); ! integrationResultManager = new IntegrationResultManager(this); ! integratable = new IntegrationRunner(integrationResultManager, this); } // This is nasty - test constructors and real constructors should be linked, but we have circular references here that need // to be sorted out ! public Project(IIntegratable integratable) : this() ! { this.integratable = integratable; } *************** *** 69,76 **** [ReflectorProperty("state", InstanceTypeKey="type", Required=false)] [Description("State")] ! public virtual IStateManager StateManager { ! get { return _state; } ! set { _state = value; } } --- 68,75 ---- [ReflectorProperty("state", InstanceTypeKey="type", Required=false)] [Description("State")] ! public IStateManager StateManager { ! get { return state; } ! set { state = value; } } *************** *** 78,83 **** public string WebURL { ! get { return _webURL; } ! set { _webURL = value; } } --- 77,82 ---- public string WebURL { ! get { return webUrl; } ! set { webUrl = value; } } *************** *** 85,90 **** public ITask Builder { ! get { return _builder; } ! set { _builder = value; } } --- 84,89 ---- public ITask Builder { ! get { return builder; } ! set { builder = value; } } *************** *** 92,97 **** public ISourceControl SourceControl { ! get { return _sourceControl; } ! set { _sourceControl = value; } } --- 91,96 ---- public ISourceControl SourceControl { ! get { return sourceControl; } ! set { sourceControl = value; } } *************** *** 103,113 **** public IIntegrationCompletedEventHandler[] Publishers { ! get { return _publishers; } set { ! _publishers = value; // register each of these event handlers ! foreach (IIntegrationCompletedEventHandler handler in _publishers) IntegrationCompleted += handler.IntegrationCompletedEventHandler; } --- 102,112 ---- public IIntegrationCompletedEventHandler[] Publishers { ! get { return publishers; } set { ! publishers = value; // register each of these event handlers ! foreach (IIntegrationCompletedEventHandler handler in publishers) IntegrationCompleted += handler.IntegrationCompletedEventHandler; } *************** *** 123,128 **** public int ModificationDelaySeconds { ! get { return _modificationDelaySeconds; } ! set { _modificationDelaySeconds = value; } } --- 122,127 ---- public int ModificationDelaySeconds { ! get { return modificationDelaySeconds; } ! set { modificationDelaySeconds = value; } } *************** *** 130,135 **** public ILabeller Labeller { ! get { return _labeller; } ! set { _labeller = value; } } --- 129,134 ---- public ILabeller Labeller { ! get { return labeller; } ! set { labeller = value; } } *************** *** 137,142 **** public ITask[] Tasks { ! get { return _tasks; } ! set { _tasks = value; } } --- 136,141 ---- public ITask[] Tasks { ! get { return tasks; } ! set { tasks = value; } } *************** *** 144,149 **** public bool PublishExceptions { ! get { return _publishExceptions; } ! set { _publishExceptions = value; } } --- 143,148 ---- public bool PublishExceptions { ! get { return publishExceptions; } ! set { publishExceptions = value; } } *************** *** 151,165 **** public ProjectActivity Activity { ! set { _currentActivity = value; } } public ProjectActivity CurrentActivity { ! get { return _currentActivity; } } public IIntegrationResult LastIntegrationResult { ! get { return _integrationResultManager.LastIntegrationResult; } } --- 150,164 ---- public ProjectActivity Activity { ! set { currentActivity = value; } } public ProjectActivity CurrentActivity { ! get { return currentActivity; } } public IIntegrationResult LastIntegrationResult { ! get { return integrationResultManager.LastIntegrationResult; } } *************** *** 180,184 **** Builder.Run(result); } ! foreach (ITask task in _tasks) { task.Run(result); --- 179,183 ---- Builder.Run(result); } ! foreach (ITask task in tasks) { task.Run(result); *************** *** 217,220 **** --- 216,224 ---- } } + + public static string DefaultUrl() + { + return string.Format("http://{0}/ccnet", Environment.MachineName); + } } } \ No newline at end of file |
|
From: Owen R. <exo...@us...> - 2005-04-25 01:54:20
|
Update of /cvsroot/ccnet/ccnet/project/UnitTests/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv890/project/UnitTests/Core Modified Files: ProjectTest.cs Log Message: improved default project url Index: ProjectTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/UnitTests/Core/ProjectTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ProjectTest.cs 5 Apr 2005 17:53:29 -0000 1.1 --- ProjectTest.cs 25 Apr 2005 01:54:11 -0000 1.2 *************** *** 21,32 **** public class ProjectTest : CustomAssertion { ! private Project _project; ! private IMock _mockBuilder; ! private IMock _mockSourceControl; ! private IMock _mockStateManager; ! private IMock _mockIntegrationTrigger; ! private IMock _mockLabeller; ! private IMock _mockPublisher; ! private IMock _mockTask; private string workingDirPath; private string artifactDirPath; --- 21,32 ---- public class ProjectTest : CustomAssertion { ! private Project project; ! private IMock mockBuilder; ! private IMock mockSourceControl; ! private IMock mockStateManager; ! private IMock mockIntegrationTrigger; ! private IMock mockLabeller; ! private IMock mockPublisher; ! private IMock mockTask; private string workingDirPath; private string artifactDirPath; *************** *** 42,61 **** Assert.IsTrue(Directory.Exists(artifactDirPath)); ! _mockBuilder = new DynamicMock(typeof (ITask)); ! _mockBuilder.Strict = true; ! _mockSourceControl = new DynamicMock(typeof (ISourceControl)); ! _mockSourceControl.Strict = true; ! _mockStateManager = new DynamicMock(typeof (IStateManager)); ! _mockStateManager.Strict = true; ! _mockIntegrationTrigger = new DynamicMock(typeof (ITrigger)); ! _mockIntegrationTrigger.Strict = true; ! _mockLabeller = new DynamicMock(typeof (ILabeller)); ! _mockLabeller.Strict = true; ! _mockPublisher = new DynamicMock((typeof (PublisherBase))); ! _mockPublisher.Strict = true; ! _mockTask = new DynamicMock((typeof (ITask))); ! _mockTask.Strict = true; ! _project = new Project(); SetupProject(); --- 42,61 ---- Assert.IsTrue(Directory.Exists(artifactDirPath)); ! mockBuilder = new DynamicMock(typeof (ITask)); ! mockBuilder.Strict = true; ! mockSourceControl = new DynamicMock(typeof (ISourceControl)); ! mockSourceControl.Strict = true; ! mockStateManager = new DynamicMock(typeof (IStateManager)); ! mockStateManager.Strict = true; ! mockIntegrationTrigger = new DynamicMock(typeof (ITrigger)); ! mockIntegrationTrigger.Strict = true; ! mockLabeller = new DynamicMock(typeof (ILabeller)); ! mockLabeller.Strict = true; ! mockPublisher = new DynamicMock((typeof (PublisherBase))); ! mockPublisher.Strict = true; ! mockTask = new DynamicMock((typeof (ITask))); ! mockTask.Strict = true; ! project = new Project(); SetupProject(); *************** *** 66,90 **** private void SetupProject() { ! _project.Name = PROJECT_NAME; ! _project.Builder = (ITask) _mockBuilder.MockInstance; ! _project.SourceControl = (ISourceControl) _mockSourceControl.MockInstance; ! _project.StateManager = (IStateManager) _mockStateManager.MockInstance; ! _project.Triggers = new ITrigger[] {(ITrigger) _mockIntegrationTrigger.MockInstance}; ! _project.Labeller = (ILabeller) _mockLabeller.MockInstance; ! _project.Publishers = new IIntegrationCompletedEventHandler[] {(IIntegrationCompletedEventHandler) _mockPublisher.MockInstance}; ! _project.Tasks = new ITask[] {(ITask) _mockTask.MockInstance}; ! _project.ConfiguredWorkingDirectory = workingDirPath; ! _project.ConfiguredArtifactDirectory = artifactDirPath; } private void VerifyAll() { ! _mockBuilder.Verify(); ! _mockSourceControl.Verify(); ! _mockStateManager.Verify(); ! _mockIntegrationTrigger.Verify(); ! _mockLabeller.Verify(); ! _mockPublisher.Verify(); ! _mockTask.Verify(); } --- 66,90 ---- private void SetupProject() { ! project.Name = PROJECT_NAME; ! project.Builder = (ITask) mockBuilder.MockInstance; ! project.SourceControl = (ISourceControl) mockSourceControl.MockInstance; ! project.StateManager = (IStateManager) mockStateManager.MockInstance; ! project.Triggers = new ITrigger[] {(ITrigger) mockIntegrationTrigger.MockInstance}; ! project.Labeller = (ILabeller) mockLabeller.MockInstance; ! project.Publishers = new IIntegrationCompletedEventHandler[] {(IIntegrationCompletedEventHandler) mockPublisher.MockInstance}; ! project.Tasks = new ITask[] {(ITask) mockTask.MockInstance}; ! project.ConfiguredWorkingDirectory = workingDirPath; ! project.ConfiguredArtifactDirectory = artifactDirPath; } private void VerifyAll() { ! mockBuilder.Verify(); ! mockSourceControl.Verify(); ! mockStateManager.Verify(); ! mockIntegrationTrigger.Verify(); ! mockLabeller.Verify(); ! mockPublisher.Verify(); ! mockTask.Verify(); } *************** *** 151,155 **** Project project = (Project) NetReflector.Read(xml); Assert.AreEqual("foo", project.Name); ! Assert.AreEqual(Project.DEFAULT_WEB_URL, project.WebURL); Assert.AreEqual(0, project.ModificationDelaySeconds); //TODO: is this the correct default? should quiet period be turned off by default? is this sourcecontrol specific? Assert.AreEqual(true, project.PublishExceptions); --- 151,155 ---- Project project = (Project) NetReflector.Read(xml); Assert.AreEqual("foo", project.Name); ! Assert.AreEqual(Project.DefaultUrl(), project.WebURL); Assert.AreEqual(0, project.ModificationDelaySeconds); //TODO: is this the correct default? should quiet period be turned off by default? is this sourcecontrol specific? Assert.AreEqual(true, project.PublishExceptions); *************** *** 181,186 **** public void ShouldCreateInitialIntegrationResultIfThisIsTheFirstIntegration() { ! _mockStateManager.ExpectAndReturn("StateFileExists", false, null); ! Assert.IsTrue(_project.LastIntegrationResult.IsInitial()); VerifyAll(); } --- 181,186 ---- public void ShouldCreateInitialIntegrationResultIfThisIsTheFirstIntegration() { ! mockStateManager.ExpectAndReturn("StateFileExists", false, null); ! Assert.IsTrue(project.LastIntegrationResult.IsInitial()); VerifyAll(); } *************** *** 193,200 **** expected.Status = IntegrationStatus.Success; ! _mockStateManager.ExpectAndReturn("StateFileExists", true); ! _mockStateManager.ExpectAndReturn("LoadState", expected); ! Assert.AreEqual(expected, _project.LastIntegrationResult); VerifyAll(); } --- 193,200 ---- expected.Status = IntegrationStatus.Success; ! mockStateManager.ExpectAndReturn("StateFileExists", true); ! mockStateManager.ExpectAndReturn("LoadState", expected); ! Assert.AreEqual(expected, project.LastIntegrationResult); VerifyAll(); } *************** *** 203,207 **** public void InitialActivityState() { ! Assert.AreEqual(ProjectActivity.Sleeping, _project.CurrentActivity); VerifyAll(); } --- 203,207 ---- public void InitialActivityState() { ! Assert.AreEqual(ProjectActivity.Sleeping, project.CurrentActivity); VerifyAll(); } *************** *** 211,218 **** { // Setup ! _mockSourceControl.Expect("Initialize", _project); // Execute ! _project.Initialize(); // Verify --- 211,218 ---- { // Setup ! mockSourceControl.Expect("Initialize", project); // Execute ! project.Initialize(); // Verify *************** *** 224,231 **** { // Setup ! _mockSourceControl.ExpectNoCall("Purge", typeof (IProject)); // Execute ! _project.Purge(false, false, false); // Verify --- 224,231 ---- { // Setup ! mockSourceControl.ExpectNoCall("Purge", typeof (IProject)); // Execute ! project.Purge(false, false, false); // Verify *************** *** 239,246 **** { // Setup ! _mockSourceControl.Expect("Purge", _project); // Execute ! _project.Purge(false, false, true); // Verify --- 239,246 ---- { // Setup ! mockSourceControl.Expect("Purge", project); // Execute ! project.Purge(false, false, true); // Verify *************** *** 252,259 **** { // Setup ! _mockSourceControl.Expect("Purge", _project); // Execute ! _project.Purge(true, true, true); // Verify --- 252,259 ---- { // Setup ! mockSourceControl.Expect("Purge", project); // Execute ! project.Purge(true, true, true); // Verify *************** *** 267,274 **** { // Setup ! _mockSourceControl.ExpectNoCall("Purge", typeof (IProject)); // Execute ! _project.Purge(true, false, false); // Verify --- 267,274 ---- { // Setup ! mockSourceControl.ExpectNoCall("Purge", typeof (IProject)); // Execute ! project.Purge(true, false, false); // Verify *************** *** 281,288 **** { // Setup ! _mockSourceControl.ExpectNoCall("Purge", typeof (IProject)); // Execute ! _project.Purge(false, true, false); // Verify --- 281,288 ---- { // Setup ! mockSourceControl.ExpectNoCall("Purge", typeof (IProject)); // Execute ! project.Purge(false, true, false); // Verify *************** *** 295,304 **** { // Setup ! _mockSourceControl.ExpectAndThrow("Purge", new CruiseControlException(), _project); // Execute try { ! _project.Purge(true, true, true); } catch (CruiseControlException) --- 295,304 ---- { // Setup ! mockSourceControl.ExpectAndThrow("Purge", new CruiseControlException(), project); // Execute try { ! project.Purge(true, true, true); } catch (CruiseControlException) *************** *** 315,324 **** { // Setup ! _mockSourceControl.ExpectNoCall("Purge", typeof (IProject)); TempFileUtil.DeleteTempDir("workingDir"); Assert.IsFalse(Directory.Exists(workingDirPath)); // Execute ! _project.Purge(true, false, false); // Verify --- 315,324 ---- { // Setup ! mockSourceControl.ExpectNoCall("Purge", typeof (IProject)); TempFileUtil.DeleteTempDir("workingDir"); Assert.IsFalse(Directory.Exists(workingDirPath)); // Execute ! project.Purge(true, false, false); // Verify *************** *** 330,339 **** { // Setup ! _mockSourceControl.ExpectNoCall("Purge", typeof (IProject)); TempFileUtil.DeleteTempDir("artifactDir"); Assert.IsFalse(Directory.Exists(artifactDirPath)); // Execute ! _project.Purge(false, true, false); // Verify --- 330,339 ---- { // Setup ! mockSourceControl.ExpectNoCall("Purge", typeof (IProject)); TempFileUtil.DeleteTempDir("artifactDir"); Assert.IsFalse(Directory.Exists(artifactDirPath)); // Execute ! project.Purge(false, true, false); // Verify *************** *** 345,351 **** { IIntegrationResult result = (IIntegrationResult) new DynamicMock(typeof(IIntegrationResult)).MockInstance; ! _mockBuilder.Expect("Run", result); ! _mockTask.Expect("Run", result); ! _project.Run(result); VerifyAll(); } --- 345,351 ---- { IIntegrationResult result = (IIntegrationResult) new DynamicMock(typeof(IIntegrationResult)).MockInstance; ! mockBuilder.Expect("Run", result); ! mockTask.Expect("Run", result); ! project.Run(result); VerifyAll(); } *************** *** 355,364 **** { DynamicMock integratableMock = new DynamicMock(typeof(IIntegratable)); ! _project = new Project((IIntegratable) integratableMock.MockInstance); SetupProject(); IIntegrationResult result = (IIntegrationResult) new DynamicMock(typeof(IIntegrationResult)).MockInstance; integratableMock.ExpectAndReturn("RunIntegration", result, BuildCondition.ForceBuild); ! Assert.AreEqual(result, _project.RunIntegration(BuildCondition.ForceBuild)); VerifyAll(); } --- 355,364 ---- { DynamicMock integratableMock = new DynamicMock(typeof(IIntegratable)); ! project = new Project((IIntegratable) integratableMock.MockInstance); SetupProject(); IIntegrationResult result = (IIntegrationResult) new DynamicMock(typeof(IIntegrationResult)).MockInstance; integratableMock.ExpectAndReturn("RunIntegration", result, BuildCondition.ForceBuild); ! Assert.AreEqual(result, project.RunIntegration(BuildCondition.ForceBuild)); VerifyAll(); } *************** *** 369,393 **** public void RunningFirstIntegrationShouldForceBuild() { ! _mockStateManager.ExpectAndReturn("StateFileExists", false); // running the first integration (no state file) ! _mockStateManager.Expect("SaveState", new IsAnything()); ! _mockLabeller.ExpectAndReturn("Generate", "label", new IsAnything()); // generate new label ! _mockSourceControl.ExpectAndReturn("GetModifications", new Modification[0], new IsAnything(), new IsAnything()); // return no modifications found ! _mockSourceControl.Expect("GetSource", new IsAnything()); ! _mockSourceControl.Expect("LabelSourceControl", "label", new IsAnything()); ! _mockPublisher.Expect("PublishIntegrationResults", new IsAnything()); ! _mockTask.Expect("Run", new IsAnything()); ! _project.Builder = new MockBuilder(); // need to use mock builder in order to set properties on IntegrationResult ! _project.ConfiguredWorkingDirectory = @"c:\temp"; ! IIntegrationResult result = _project.RunIntegration(BuildCondition.IfModificationExists); Assert.AreEqual(PROJECT_NAME, result.ProjectName); Assert.AreEqual(null, result.ExceptionResult); ! Assert.AreEqual(ProjectActivity.Sleeping, _project.CurrentActivity); Assert.AreEqual(IntegrationStatus.Success, result.Status); Assert.AreEqual(IntegrationStatus.Unknown, result.LastIntegrationStatus); Assert.AreEqual(BuildCondition.ForceBuild, result.BuildCondition); Assert.AreEqual(@"c:\temp", result.WorkingDirectory); ! Assert.AreEqual(result, _project.LastIntegrationResult); Assert.AreEqual("label", result.Label); AssertFalse("unexpected modifications were returned", result.HasModifications()); --- 369,393 ---- public void RunningFirstIntegrationShouldForceBuild() { ! mockStateManager.ExpectAndReturn("StateFileExists", false); // running the first integration (no state file) ! mockStateManager.Expect("SaveState", new IsAnything()); ! mockLabeller.ExpectAndReturn("Generate", "label", new IsAnything()); // generate new label ! mockSourceControl.ExpectAndReturn("GetModifications", new Modification[0], new IsAnything(), new IsAnything()); // return no modifications found ! mockSourceControl.Expect("GetSource", new IsAnything()); ! mockSourceControl.Expect("LabelSourceControl", "label", new IsAnything()); ! mockPublisher.Expect("PublishIntegrationResults", new IsAnything()); ! mockTask.Expect("Run", new IsAnything()); ! project.Builder = new MockBuilder(); // need to use mock builder in order to set properties on IntegrationResult ! project.ConfiguredWorkingDirectory = @"c:\temp"; ! IIntegrationResult result = project.RunIntegration(BuildCondition.IfModificationExists); Assert.AreEqual(PROJECT_NAME, result.ProjectName); Assert.AreEqual(null, result.ExceptionResult); ! Assert.AreEqual(ProjectActivity.Sleeping, project.CurrentActivity); Assert.AreEqual(IntegrationStatus.Success, result.Status); Assert.AreEqual(IntegrationStatus.Unknown, result.LastIntegrationStatus); Assert.AreEqual(BuildCondition.ForceBuild, result.BuildCondition); Assert.AreEqual(@"c:\temp", result.WorkingDirectory); ! Assert.AreEqual(result, project.LastIntegrationResult); Assert.AreEqual("label", result.Label); AssertFalse("unexpected modifications were returned", result.HasModifications()); *************** *** 401,418 **** public void RunningIntegrationWithNoModificationsShouldNotBuildOrPublish() { ! _mockStateManager.ExpectAndReturn("StateFileExists", true); // running the first integration (no state file) ! _mockStateManager.ExpectAndReturn("LoadState", IntegrationResultMother.CreateSuccessful()); ! _mockLabeller.ExpectAndReturn("Generate", "label", new IsAnything()); // generate new label ! _mockSourceControl.ExpectAndReturn("GetModifications", new Modification[0], new IsAnything(), new IsAnything()); // return no modifications found ! _mockBuilder.ExpectNoCall("Run", typeof (IntegrationResult)); ! _mockPublisher.ExpectNoCall("PublishIntegrationResults", typeof (IntegrationResult)); ! IIntegrationResult result = _project.RunIntegration(BuildCondition.IfModificationExists); Assert.AreEqual(PROJECT_NAME, result.ProjectName); Assert.AreEqual(null, result.ExceptionResult); ! Assert.AreEqual(ProjectActivity.Sleeping, _project.CurrentActivity); Assert.AreEqual(IntegrationStatus.Unknown, result.Status); ! Assert.IsNotNull(_project.LastIntegrationResult); Assert.AreEqual("label", result.Label); AssertFalse("unexpected modifications were returned", result.HasModifications()); --- 401,418 ---- public void RunningIntegrationWithNoModificationsShouldNotBuildOrPublish() { ! mockStateManager.ExpectAndReturn("StateFileExists", true); // running the first integration (no state file) ! mockStateManager.ExpectAndReturn("LoadState", IntegrationResultMother.CreateSuccessful()); ! mockLabeller.ExpectAndReturn("Generate", "label", new IsAnything()); // generate new label ! mockSourceControl.ExpectAndReturn("GetModifications", new Modification[0], new IsAnything(), new IsAnything()); // return no modifications found ! mockBuilder.ExpectNoCall("Run", typeof (IntegrationResult)); ! mockPublisher.ExpectNoCall("PublishIntegrationResults", typeof (IntegrationResult)); ! IIntegrationResult result = project.RunIntegration(BuildCondition.IfModificationExists); Assert.AreEqual(PROJECT_NAME, result.ProjectName); Assert.AreEqual(null, result.ExceptionResult); ! Assert.AreEqual(ProjectActivity.Sleeping, project.CurrentActivity); Assert.AreEqual(IntegrationStatus.Unknown, result.Status); ! Assert.IsNotNull(project.LastIntegrationResult); Assert.AreEqual("label", result.Label); AssertFalse("unexpected modifications were returned", result.HasModifications()); *************** *** 428,446 **** Modification[] modifications = new Modification[1] {new Modification()}; ! _mockStateManager.ExpectAndReturn("StateFileExists", false); // running the first integration (no state file) ! _mockStateManager.Expect("SaveState", new IsAnything()); ! _mockLabeller.ExpectAndReturn("Generate", "label", new IsAnything()); // generate new label ! _mockSourceControl.ExpectAndReturn("GetModifications", modifications, new IsAnything(), new IsAnything()); ! _mockSourceControl.Expect("LabelSourceControl", "label", new IsAnything()); ! _mockSourceControl.Expect("GetSource", new IsAnything()); ! _mockPublisher.Expect("PublishIntegrationResults", new IsAnything()); ! _mockTask.Expect("Run", new IsAnything()); ! _project.Builder = new MockBuilder(); // need to use mock builder in order to set properties on IntegrationResult ! IIntegrationResult result = _project.RunIntegration(BuildCondition.IfModificationExists); Assert.AreEqual(PROJECT_NAME, result.ProjectName); ! Assert.AreEqual(ProjectActivity.Sleeping, _project.CurrentActivity); Assert.AreEqual(IntegrationStatus.Success, result.Status); Assert.AreEqual(IntegrationStatus.Unknown, result.LastIntegrationStatus); --- 428,446 ---- Modification[] modifications = new Modification[1] {new Modification()}; ! mockStateManager.ExpectAndReturn("StateFileExists", false); // running the first integration (no state file) ! mockStateManager.Expect("SaveState", new IsAnything()); ! mockLabeller.ExpectAndReturn("Generate", "label", new IsAnything()); // generate new label ! mockSourceControl.ExpectAndReturn("GetModifications", modifications, new IsAnything(), new IsAnything()); ! mockSourceControl.Expect("LabelSourceControl", "label", new IsAnything()); ! mockSourceControl.Expect("GetSource", new IsAnything()); ! mockPublisher.Expect("PublishIntegrationResults", new IsAnything()); ! mockTask.Expect("Run", new IsAnything()); ! project.Builder = new MockBuilder(); // need to use mock builder in order to set properties on IntegrationResult ! IIntegrationResult result = project.RunIntegration(BuildCondition.IfModificationExists); Assert.AreEqual(PROJECT_NAME, result.ProjectName); ! Assert.AreEqual(ProjectActivity.Sleeping, project.CurrentActivity); Assert.AreEqual(IntegrationStatus.Success, result.Status); Assert.AreEqual(IntegrationStatus.Unknown, result.LastIntegrationStatus); *************** *** 455,467 **** public void ShouldNotPublishIntegrationResultsIfPublishExceptionsIsFalseAndSourceControlThrowsAnException() { ! _mockStateManager.ExpectAndReturn("StateFileExists", false); // running the first integration (no state file) ! _mockLabeller.ExpectAndReturn("Generate", "label", new IsAnything()); // generate new label CruiseControlException expectedException = new CruiseControlException(); ! _mockSourceControl.ExpectAndThrow("GetModifications", expectedException, new IsAnything(), new IsAnything()); ! _mockPublisher.ExpectNoCall("PublishIntegrationResults", typeof (IntegrationResult)); ! _mockStateManager.ExpectNoCall("SaveState", typeof (IntegrationResult)); ! _project.PublishExceptions = false; ! IIntegrationResult result = _project.RunIntegration(BuildCondition.IfModificationExists); Assert.AreEqual(expectedException, result.ExceptionResult); VerifyAll(); --- 455,467 ---- public void ShouldNotPublishIntegrationResultsIfPublishExceptionsIsFalseAndSourceControlThrowsAnException() { ! mockStateManager.ExpectAndReturn("StateFileExists", false); // running the first integration (no state file) ! mockLabeller.ExpectAndReturn("Generate", "label", new IsAnything()); // generate new label CruiseControlException expectedException = new CruiseControlException(); ! mockSourceControl.ExpectAndThrow("GetModifications", expectedException, new IsAnything(), new IsAnything()); ! mockPublisher.ExpectNoCall("PublishIntegrationResults", typeof (IntegrationResult)); ! mockStateManager.ExpectNoCall("SaveState", typeof (IntegrationResult)); ! project.PublishExceptions = false; ! IIntegrationResult result = project.RunIntegration(BuildCondition.IfModificationExists); Assert.AreEqual(expectedException, result.ExceptionResult); VerifyAll(); *************** *** 471,483 **** public void ShouldPublishIntegrationResultsIfPublishExceptionsIsTrueAndSourceControlThrowsAnException() { ! _mockStateManager.ExpectAndReturn("StateFileExists", false); // running the first integration (no state file) ! _mockLabeller.ExpectAndReturn("Generate", "label", new IsAnything()); // generate new label CruiseControlException expectedException = new CruiseControlException(); ! _mockSourceControl.ExpectAndThrow("GetModifications", expectedException, new IsAnything(), new IsAnything()); ! _mockPublisher.Expect("PublishIntegrationResults", new IsAnything()); ! _mockStateManager.Expect("SaveState", new IsAnything()); ! _project.PublishExceptions = true; ! IIntegrationResult result = _project.RunIntegration(BuildCondition.IfModificationExists); Assert.AreEqual(expectedException, result.ExceptionResult); VerifyAll(); --- 471,483 ---- public void ShouldPublishIntegrationResultsIfPublishExceptionsIsTrueAndSourceControlThrowsAnException() { ! mockStateManager.ExpectAndReturn("StateFileExists", false); // running the first integration (no state file) ! mockLabeller.ExpectAndReturn("Generate", "label", new IsAnything()); // generate new label CruiseControlException expectedException = new CruiseControlException(); ! mockSourceControl.ExpectAndThrow("GetModifications", expectedException, new IsAnything(), new IsAnything()); ! mockPublisher.Expect("PublishIntegrationResults", new IsAnything()); ! mockStateManager.Expect("SaveState", new IsAnything()); ! project.PublishExceptions = true; ! IIntegrationResult result = project.RunIntegration(BuildCondition.IfModificationExists); Assert.AreEqual(expectedException, result.ExceptionResult); VerifyAll(); *************** *** 487,493 **** public void RethrowExceptionIfLoadingStateFileThrowsException() { ! _mockStateManager.ExpectAndThrow("StateFileExists", new CruiseControlException("expected exception")); ! _project.RunIntegration(BuildCondition.IfModificationExists); VerifyAll(); } --- 487,493 ---- public void RethrowExceptionIfLoadingStateFileThrowsException() { ! mockStateManager.ExpectAndThrow("StateFileExists", new CruiseControlException("expected exception")); ! project.RunIntegration(BuildCondition.IfModificationExists); VerifyAll(); } *************** *** 497,504 **** { Exception expectedException = new CruiseControlException("expected exception"); ! _mockStateManager.ExpectAndReturn("StateFileExists", false); ! _mockLabeller.ExpectAndThrow("Generate", expectedException, new IsAnything()); ! _project.RunIntegration(BuildCondition.IfModificationExists); VerifyAll(); } --- 497,504 ---- { Exception expectedException = new CruiseControlException("expected exception"); ! mockStateManager.ExpectAndReturn("StateFileExists", false); ! mockLabeller.ExpectAndThrow("Generate", expectedException, new IsAnything()); ! project.RunIntegration(BuildCondition.IfModificationExists); VerifyAll(); } *************** *** 507,527 **** public void SourceControlLabeled() { ! _project.Builder = new MockBuilder(); ! _mockLabeller.ExpectAndReturn("Generate", "1.2.1", new IsAnything()); ! _mockTask.Expect("Run", new IsAnything()); ! _mockSourceControl.ExpectAndReturn("GetModifications", CreateModifications(), new IsAnything(), new IsAnything()); ! _mockSourceControl.Expect("GetSource", new IsAnything()); ! _mockSourceControl.Expect("LabelSourceControl", "1.2.1", new IsAnything()); integrationCompletedCalled = false; ! _project.IntegrationCompleted += new IntegrationCompletedEventHandler(Project_IntegrationCompleted); IMock stateMock = new DynamicMock(typeof (IStateManager)); stateMock.ExpectAndReturn("StateFileExists", false); ! _project.StateManager = (IStateManager) stateMock.MockInstance; ! IIntegrationResult results = _project.RunIntegration(BuildCondition.IfModificationExists); stateMock.Expect("SaveState", results); ! Assert.AreEqual(results, _project.LastIntegrationResult, "new integration result has not been set to the last integration result"); Assert.IsNotNull(results.EndTime); Assert.IsTrue(integrationCompletedCalled); --- 507,527 ---- public void SourceControlLabeled() { ! project.Builder = new MockBuilder(); ! mockLabeller.ExpectAndReturn("Generate", "1.2.1", new IsAnything()); ! mockTask.Expect("Run", new IsAnything()); ! mockSourceControl.ExpectAndReturn("GetModifications", CreateModifications(), new IsAnything(), new IsAnything()); ! mockSourceControl.Expect("GetSource", new IsAnything()); ! mockSourceControl.Expect("LabelSourceControl", "1.2.1", new IsAnything()); integrationCompletedCalled = false; ! project.IntegrationCompleted += new IntegrationCompletedEventHandler(Project_IntegrationCompleted); IMock stateMock = new DynamicMock(typeof (IStateManager)); stateMock.ExpectAndReturn("StateFileExists", false); ! project.StateManager = (IStateManager) stateMock.MockInstance; ! IIntegrationResult results = project.RunIntegration(BuildCondition.IfModificationExists); stateMock.Expect("SaveState", results); ! Assert.AreEqual(results, project.LastIntegrationResult, "new integration result has not been set to the last integration result"); Assert.IsNotNull(results.EndTime); Assert.IsTrue(integrationCompletedCalled); *************** *** 549,567 **** public void IfPublisherThrowsExceptionShouldStillSaveState() { ! _mockLabeller.ExpectAndReturn("Generate", "1.0", new IsAnything()); ! _mockStateManager.ExpectAndReturn("StateFileExists", false); ! _mockStateManager.Expect("SaveState", new IsAnything()); ! _mockSourceControl.ExpectAndReturn("GetModifications", CreateModifications(), new IsAnything(), new IsAnything()); ! _mockSourceControl.Expect("GetSource", new IsAnything()); ! _mockSourceControl.Expect("LabelSourceControl", "1.0", new IsAnything()); ! _mockTask.Expect("Run", new IsAnything()); Exception expectedException = new CruiseControlException("expected exception"); ! _mockPublisher.ExpectAndThrow("PublishIntegrationResults", expectedException, new IsAnything()); ! _project.Builder = new MockBuilder(); ! IIntegrationResult results = _project.RunIntegration(BuildCondition.IfModificationExists); // failure to save the integration result will register as a failed project ! Assert.AreEqual(results, _project.LastIntegrationResult, "new integration result has not been set to the last integration result"); Assert.IsNotNull(results.EndTime); VerifyAll(); --- 549,567 ---- public void IfPublisherThrowsExceptionShouldStillSaveState() { ! mockLabeller.ExpectAndReturn("Generate", "1.0", new IsAnything()); ! mockStateManager.ExpectAndReturn("StateFileExists", false); ! mockStateManager.Expect("SaveState", new IsAnything()); ! mockSourceControl.ExpectAndReturn("GetModifications", CreateModifications(), new IsAnything(), new IsAnything()); ! mockSourceControl.Expect("GetSource", new IsAnything()); ! mockSourceControl.Expect("LabelSourceControl", "1.0", new IsAnything()); ! mockTask.Expect("Run", new IsAnything()); Exception expectedException = new CruiseControlException("expected exception"); ! mockPublisher.ExpectAndThrow("PublishIntegrationResults", expectedException, new IsAnything()); ! project.Builder = new MockBuilder(); ! IIntegrationResult results = project.RunIntegration(BuildCondition.IfModificationExists); // failure to save the integration result will register as a failed project ! Assert.AreEqual(results, project.LastIntegrationResult, "new integration result has not been set to the last integration result"); Assert.IsNotNull(results.EndTime); VerifyAll(); |
|
From: Owen R. <exo...@us...> - 2005-04-25 01:51:10
|
Update of /cvsroot/ccnet/ccnet/project/UnitTests/Web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32005/project/UnitTests/Web Removed Files: ServerLogFileReaderTest.cs Log Message: mike luke's patch to ServerLogFileReader to improve performance deleted duplicate ServerLogFileReader in web project --- ServerLogFileReaderTest.cs DELETED --- |
|
From: Owen R. <exo...@us...> - 2005-04-25 01:51:10
|
Update of /cvsroot/ccnet/ccnet/project/UnitTests/Core/Tasks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32005/project/UnitTests/Core/Tasks Added Files: ProcessTaskResultTest.cs Log Message: mike luke's patch to ServerLogFileReader to improve performance deleted duplicate ServerLogFileReader in web project --- NEW FILE: ProcessTaskResultTest.cs --- using System.IO; using System.Xml; using NUnit.Framework; using ThoughtWorks.CruiseControl.Core.Tasks; using ThoughtWorks.CruiseControl.Core.Test; using ThoughtWorks.CruiseControl.Core.Util; namespace ThoughtWorks.CruiseControl.UnitTests.Core.Tasks { [TestFixture] public class ProcessTaskResultTest { private StringWriter writer; [Test] public void SucceededIfProcessResultSucceeded() { ProcessTaskResult result = new ProcessTaskResult(ProcessResultFixture.CreateSuccessfulResult()); Assert.IsTrue(result.Succeeded()); Assert.IsFalse(result.Failed()); } [Test] public void FailedIfProcessResultFailed() { ProcessTaskResult result = new ProcessTaskResult(ProcessResultFixture.CreateNonZeroExitCodeResult()); Assert.IsFalse(result.Succeeded()); Assert.IsTrue(result.Failed()); } [Test] public void FailedIfProcessResultTimedout() { ProcessTaskResult result = new ProcessTaskResult(ProcessResultFixture.CreateTimedOutResult()); Assert.IsFalse(result.Succeeded()); Assert.IsTrue(result.Failed()); } [Test] public void WriteProcessResultToXml() { Assert.AreEqual("<task><standardOutput>foo</standardOutput><standardError>bar</standardError></task>", WriteToXml("foo", "bar", ProcessResult.SUCCESSFUL_EXIT_CODE, false)); } [Test] public void WriteFailedProcessResultToXml() { Assert.AreEqual(@"<task failed=""True""><standardOutput /><standardError>bar</standardError></task>", WriteToXml(null, "bar", -3, false)); } [Test] public void WriteTimedOutProcessResultToXml() { Assert.AreEqual(@"<task failed=""True"" timedout=""True""><standardOutput /><standardError>bar</standardError></task>", WriteToXml(null, "bar", ProcessResult.TIMED_OUT_EXIT_CODE, true)); } private string WriteToXml(string output, string error, int errorCode, bool timedOut) { TaskResult(output, error, errorCode, timedOut).WriteTo(XmlWriter()); return writer.ToString(); } private ProcessTaskResult TaskResult(string output, string error, int errorCode, bool timedOut) { return new ProcessTaskResult(new ProcessResult(output, error, errorCode, timedOut)); } private XmlWriter XmlWriter() { writer = new StringWriter(); return new XmlTextWriter(writer); } } } |
|
From: Owen R. <exo...@us...> - 2005-04-25 01:51:09
|
Update of /cvsroot/ccnet/ccnet/project/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32005/project/web Modified Files: ServerLog.aspx.cs web.csproj Removed Files: ServerLogFileReader.cs Log Message: mike luke's patch to ServerLogFileReader to improve performance deleted duplicate ServerLogFileReader in web project --- ServerLogFileReader.cs DELETED --- Index: web.csproj =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/web/web.csproj,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** web.csproj 31 Mar 2005 11:49:35 -0000 1.43 --- web.csproj 25 Apr 2005 01:51:00 -0000 1.44 *************** *** 296,304 **** /> <File - RelPath = "ServerLogFileReader.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "Simian.aspx" BuildAction = "Content" --- 296,299 ---- Index: ServerLog.aspx.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/web/ServerLog.aspx.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ServerLog.aspx.cs 23 Jun 2004 05:19:24 -0000 1.4 --- ServerLog.aspx.cs 25 Apr 2005 01:51:00 -0000 1.5 *************** *** 3,6 **** --- 3,7 ---- using System.Web.UI; using System.Web.UI.HtmlControls; + using ThoughtWorks.CruiseControl.Core.Logging; namespace ThoughtWorks.CruiseControl.Web |
|
From: Owen R. <exo...@us...> - 2005-04-25 01:51:09
|
Update of /cvsroot/ccnet/ccnet/project/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32005/project/core Modified Files: core.csproj Log Message: mike luke's patch to ServerLogFileReader to improve performance deleted duplicate ServerLogFileReader in web project Index: core.csproj =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/core.csproj,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -d -r1.132 -r1.133 *** core.csproj 14 Apr 2005 16:26:48 -0000 1.132 --- core.csproj 25 Apr 2005 01:50:59 -0000 1.133 *************** *** 410,413 **** --- 410,423 ---- /> <File + RelPath = "Log\CircularArray.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Log\EnumeratorDirection.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Log\ServerLogFileReader.cs" SubType = "Code" *************** *** 844,847 **** --- 854,862 ---- /> <File + RelPath = "tasks\ProcessTaskResult.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "tasks\test\MockBuilder.cs" SubType = "Code" |
|
From: Owen R. <exo...@us...> - 2005-04-25 01:51:09
|
Update of /cvsroot/ccnet/ccnet/project/core/Log In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32005/project/core/Log Modified Files: ServerLogFileReader.cs Added Files: CircularArray.cs EnumeratorDirection.cs Log Message: mike luke's patch to ServerLogFileReader to improve performance deleted duplicate ServerLogFileReader in web project --- NEW FILE: CircularArray.cs --- using System; using System.Collections; using System.Text; namespace ThoughtWorks.CruiseControl.Core.Logging { public class CircularArray : IEnumerable { private const int AssumedAverageLineLength = 80; private static readonly EnumeratorDirection DefaultDirection = EnumeratorDirection.Forward; private int currentIndex = 0; private object[] items; private bool isFull; public CircularArray(int capacity) { this.items = new object[capacity]; } public void Add(object item) { items[currentIndex] = item; currentIndex = IncrementIndex(currentIndex); } public object this[int index] { get { return items[index]; } } private int IncrementIndex(int index) { int nextIndex = (index + 1)%items.Length; if (nextIndex == 0) isFull = true; return nextIndex; } public override string ToString() { return ToString(DefaultDirection); } public string ToString(EnumeratorDirection direction) { StringBuilder builder = new StringBuilder(items.GetUpperBound(0)*AssumedAverageLineLength); IEnumerator enumerator = new CircularArrayEnumerator(this, direction); while (enumerator.MoveNext()) { if (builder.Length > 0) builder.Append(Environment.NewLine); builder.Append(enumerator.Current); } return builder.ToString(); } public IEnumerator GetEnumerator() { return new CircularArrayEnumerator(this, DefaultDirection); } internal class CircularArrayEnumerator : IEnumerator { private const int InitialIndex = -1; private readonly CircularArray array; private readonly EnumeratorDirection direction; private int index = InitialIndex; public CircularArrayEnumerator(CircularArray array, EnumeratorDirection direction) { this.array = array; this.direction = direction; } public bool MoveNext() { if (array.currentIndex == 0 && ! array.isFull) return false; // array is empty if (index == InitialIndex) { index = StartIndex(); return true; } if (direction == EnumeratorDirection.Backward) { index = Decrement(index); return index != StartIndex(); } else { index = Increment(index); return index != StartIndex(); } } private int StartIndex() { return (direction == EnumeratorDirection.Backward) ? Decrement(array.currentIndex) : Increment(array.currentIndex - 1); } private int Increment(int index) { if (! array.isFull && index == array.currentIndex - 1) return 0; return (index + 1) % array.items.Length; } private int Decrement(int currentIndex) { if (! array.isFull && currentIndex == 0) return array.currentIndex - 1; return (currentIndex - 1 + array.items.Length) % array.items.Length; } public void Reset() { throw new NotImplementedException(); } public object Current { get { return array[index]; } } } } } Index: ServerLogFileReader.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/Log/ServerLogFileReader.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ServerLogFileReader.cs 25 Jul 2004 20:07:18 -0000 1.1 --- ServerLogFileReader.cs 25 Apr 2005 01:50:59 -0000 1.2 *************** *** 1,90 **** - using System; using System.Configuration; using System.IO; ! using System.Text; ! namespace ThoughtWorks.Core.Log { public class ServerLogFileReader { ! private string _filename; ! private int _maxLines; ! public ServerLogFileReader() ! { ! string linesToReadConfig = ConfigurationSettings.AppSettings["ServerLogFileLines"]; ! _maxLines = (linesToReadConfig != null) ? int.Parse(ConfigurationSettings.AppSettings["ServerLogFileLines"]) : 80; ! _filename = ConfigurationSettings.AppSettings["ServerLogFilePath"]; ! if (_filename == null || _filename == string.Empty) ! { ! _filename = "ccnet.log"; ! } } ! public ServerLogFileReader(string filename, int maxLines) { ! _filename = filename; ! _maxLines = maxLines; } ! public string Read() ! { ! StringBuilder builder = new StringBuilder(10000); ! int readLines = 0; using (Stream stream = OpenFile()) { ! SeekPastEnd(stream); ! while (MovePrevious(stream) && readLines < _maxLines) { ! builder.Insert(0, ReadChar(stream)); ! if (HasReadNewLine(builder)) { ! readLines++; } } } ! return builder.ToString().TrimStart(); } private Stream OpenFile() { ! return new BufferedStream(new FileStream(_filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)); ! } ! ! private void SeekPastEnd(Stream stream) ! { ! stream.Seek(1, SeekOrigin.End); ! } ! ! private bool MovePrevious(Stream stream) ! { ! if (stream.Position > 1) ! { ! stream.Seek(-2, SeekOrigin.Current); ! return true; ! } ! else ! { ! return false; ! } } ! private bool HasReadNewLine(StringBuilder builder) { ! if (builder.Length >= Environment.NewLine.Length) ! { ! if (builder.ToString(0, Environment.NewLine.Length).Equals(Environment.NewLine)) ! { ! return true; ! } ! } ! return false; } ! private char ReadChar(Stream stream) { ! return (char)stream.ReadByte(); } } ! } --- 1,61 ---- using System.Configuration; using System.IO; ! using ThoughtWorks.CruiseControl.Core.Util; ! namespace ThoughtWorks.CruiseControl.Core.Logging { public class ServerLogFileReader { ! private const int DefaultMaxLines = 80; ! private string filename; ! private int maxLines; ! public ServerLogFileReader() : this(ReadFilenameFromConfig(), ReadMaxLinesFromConfig()) ! {} ! public ServerLogFileReader(string filename, int maxLines) ! { ! this.filename = filename; ! this.maxLines = maxLines; } ! public string Read() { ! return Read(EnumeratorDirection.Forward); } ! public string Read(EnumeratorDirection direction) ! { ! CircularArray buffer = new CircularArray(maxLines); using (Stream stream = OpenFile()) { ! using (StreamReader reader = new StreamReader(stream)) { ! string line; ! while ((line = reader.ReadLine()) != null) { ! buffer.Add(line); } } } ! return buffer.ToString(direction); } private Stream OpenFile() { ! return new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); } ! private static string ReadFilenameFromConfig() { ! string filename = ConfigurationSettings.AppSettings["ServerLogFilePath"]; ! return StringUtil.IsBlank(filename) ? "ccnet.log" : filename; } ! private static int ReadMaxLinesFromConfig() { ! string linesToReadConfig = ConfigurationSettings.AppSettings["ServerLogFileLines"]; ! return (linesToReadConfig != null) ? int.Parse(ConfigurationSettings.AppSettings["ServerLogFileLines"]) : DefaultMaxLines; } } ! } \ No newline at end of file --- NEW FILE: EnumeratorDirection.cs --- namespace ThoughtWorks.CruiseControl.Core.Logging { public enum EnumeratorDirection { Backward, Forward } } |
|
From: Owen R. <exo...@us...> - 2005-04-25 01:51:08
|
Update of /cvsroot/ccnet/ccnet/project/UnitTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32005/project/UnitTests Modified Files: UnitTests.csproj Log Message: mike luke's patch to ServerLogFileReader to improve performance deleted duplicate ServerLogFileReader in web project Index: UnitTests.csproj =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/UnitTests/UnitTests.csproj,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** UnitTests.csproj 14 Apr 2005 16:26:47 -0000 1.108 --- UnitTests.csproj 25 Apr 2005 01:50:59 -0000 1.109 *************** *** 91,99 **** /> <Reference - Name = "System.Data" - AssemblyName = "System.Data" - HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" - /> - <Reference Name = "System.XML" AssemblyName = "System.Xml" --- 91,94 ---- *************** *** 405,408 **** --- 400,413 ---- /> <File + RelPath = "Core\Log\CircularArrayTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Core\Log\CircularArrayTestResources.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Core\Log\ServerLogFileReaderTest.cs" SubType = "Code" *************** *** 410,413 **** --- 415,422 ---- /> <File + RelPath = "Core\Log\TestLog.txt" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "Core\Publishers\BuildLogTransformerTest.cs" SubType = "Code" |
|
From: Owen R. <exo...@us...> - 2005-04-25 01:51:07
|
Update of /cvsroot/ccnet/ccnet/project/UnitTests/Core/Log In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32005/project/UnitTests/Core/Log Modified Files: ServerLogFileReaderTest.cs Added Files: CircularArrayTest.cs CircularArrayTestResources.cs TestLog.txt Log Message: mike luke's patch to ServerLogFileReader to improve performance deleted duplicate ServerLogFileReader in web project Index: ServerLogFileReaderTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/UnitTests/Core/Log/ServerLogFileReaderTest.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ServerLogFileReaderTest.cs 7 Apr 2005 15:45:00 -0000 1.4 --- ServerLogFileReaderTest.cs 25 Apr 2005 01:50:58 -0000 1.5 *************** *** 3,10 **** using System.Text.RegularExpressions; using NUnit.Framework; ! using ThoughtWorks.Core.Log; using ThoughtWorks.CruiseControl.Core.Util; ! namespace ThoughtWorks.CruiseControl.UnitTests.Core.Log { [TestFixture] --- 3,10 ---- using System.Text.RegularExpressions; using NUnit.Framework; ! using ThoughtWorks.CruiseControl.Core.Logging; using ThoughtWorks.CruiseControl.Core.Util; ! namespace ThoughtWorks.CruiseControl.UnitTests.Core.Logging { [TestFixture] --- NEW FILE: TestLog.txt --- 1. This is a test 2. This is a test 3. This is a test 4. This is a test 5. This is a test 6. This is a test 7. This is a test 8. This is a test 9. This is a test 10. This is a test 11. This is a test 12. This is a test 13. This is a test 14. This is a test 15. This is a test 16. This is a test 17. This is a test 18. This is a test 19. This is a test 20. This is a test --- NEW FILE: CircularArrayTest.cs --- using System.IO; using System.Reflection; using NUnit.Framework; namespace ThoughtWorks.CruiseControl.Core.Logging.Test { [TestFixture()] public class CircularArrayTest { private static readonly string TestResourceName = @"ThoughtWorks.CruiseControl.UnitTests.Core.Log.TestLog.txt"; private CircularArray arrayStringBuffer; [SetUp] public void SetUp() { arrayStringBuffer = new CircularArray(20); } [Test] public void ReadZeroLines() { Assert.AreEqual(string.Empty, arrayStringBuffer.ToString(EnumeratorDirection.Backward), "Should be blank when no lines added"); Assert.AreEqual(string.Empty, arrayStringBuffer.ToString(EnumeratorDirection.Forward), "Should be blank when no lines added"); } [Test] public void ReadOneLine() { AddLines(1); string newest = arrayStringBuffer.ToString(EnumeratorDirection.Backward); Assert.AreEqual(CircularArrayTestResources.SingleLine, newest, "Wrong line read"); string oldest = arrayStringBuffer.ToString(EnumeratorDirection.Forward); Assert.AreEqual(CircularArrayTestResources.SingleLine, oldest, "Wrong line read"); Assert.AreEqual(newest, oldest, "NewestFirst and OldestFirst should be identical for single line"); } [Test] public void ReadFiveLines() { arrayStringBuffer = new CircularArray(5); AddLines(5); Assert.AreEqual(CircularArrayTestResources.ForwardFive, arrayStringBuffer.ToString(EnumeratorDirection.Forward), "Wrong lines returned when filling array"); Assert.AreEqual(CircularArrayTestResources.BackwardFive, arrayStringBuffer.ToString(EnumeratorDirection.Backward), "Wrong lines returned"); } [Test] public void ReadFewerLinesThanCapacity() { arrayStringBuffer = new CircularArray(30); AddLines(20); Assert.AreEqual(CircularArrayTestResources.BackwardThirty, arrayStringBuffer.ToString(EnumeratorDirection.Backward), "Wrong lines returned when underfilling array"); Assert.AreEqual(CircularArrayTestResources.ForwardThirty, arrayStringBuffer.ToString(EnumeratorDirection.Forward), "Wrong lines returned when underfilling array"); } [Test] public void ReadMoreLinesThanCapacity() { arrayStringBuffer = new CircularArray(5); AddLines(20); Assert.AreEqual(CircularArrayTestResources.ForwardLastFive, arrayStringBuffer.ToString(EnumeratorDirection.Forward), "Wrong lines returned when overfilling array"); Assert.AreEqual(CircularArrayTestResources.BackwardLastFive, arrayStringBuffer.ToString(EnumeratorDirection.Backward), "Wrong lines returned when overfilling array"); } private void AddLines(int numberOfLines) { using (StreamReader Reader = new StreamReader(GetTestStream())) { for(int i = 0; i < numberOfLines; i++) { arrayStringBuffer.Add(Reader.ReadLine()); } } } private Stream GetTestStream() { return Assembly.GetExecutingAssembly().GetManifestResourceStream(TestResourceName); } } } --- NEW FILE: CircularArrayTestResources.cs --- namespace ThoughtWorks.CruiseControl.Core.Logging.Test { public class CircularArrayTestResources { private CircularArrayTestResources() { } public static readonly string SingleLine = @"1. This is a test"; public static readonly string ForwardFive = @"1. This is a test 2. This is a test 3. This is a test 4. This is a test 5. This is a test"; public static readonly string ForwardThirty = @"1. This is a test 2. This is a test 3. This is a test 4. This is a test 5. This is a test 6. This is a test 7. This is a test 8. This is a test 9. This is a test 10. This is a test 11. This is a test 12. This is a test 13. This is a test 14. This is a test 15. This is a test 16. This is a test 17. This is a test 18. This is a test 19. This is a test 20. This is a test"; public static readonly string ForwardLastFive = @"16. This is a test 17. This is a test 18. This is a test 19. This is a test 20. This is a test"; public static readonly string BackwardFive = @"5. This is a test 4. This is a test 3. This is a test 2. This is a test 1. This is a test"; public static readonly string BackwardThirty = @"20. This is a test 19. This is a test 18. This is a test 17. This is a test 16. This is a test 15. This is a test 14. This is a test 13. This is a test 12. This is a test 11. This is a test 10. This is a test 9. This is a test 8. This is a test 7. This is a test 6. This is a test 5. This is a test 4. This is a test 3. This is a test 2. This is a test 1. This is a test"; public static readonly string BackwardLastFive = @"20. This is a test 19. This is a test 18. This is a test 17. This is a test 16. This is a test"; } } |
|
From: Owen R. <exo...@us...> - 2005-04-15 07:34:01
|
Update of /cvsroot/ccnet/ccnet/project/service In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3890/project/service Modified Files: ProjectInstaller.cs Log Message: fixing small bug to service installer as pointed out by Marcin Index: ProjectInstaller.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/service/ProjectInstaller.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ProjectInstaller.cs 13 Apr 2005 15:46:48 -0000 1.8 --- ProjectInstaller.cs 15 Apr 2005 07:33:53 -0000 1.9 *************** *** 42,46 **** { string serviceName = ServiceName(stateSaver); ! stateSaver[serviceName] = serviceName; SetServiceName(serviceName); base.OnBeforeInstall(stateSaver); --- 42,46 ---- { string serviceName = ServiceName(stateSaver); ! stateSaver[ServiceNameSwitch] = serviceName; SetServiceName(serviceName); base.OnBeforeInstall(stateSaver); |
|
From: Owen R. <exo...@us...> - 2005-04-15 04:46:31
|
Update of /cvsroot/ccnet/ccnet/project/core/configuration In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16578/project/core/configuration Modified Files: DefaultConfigurationFileLoader.cs NetReflectorConfigurationReader.cs Log Message: updated to work with new NetReflector release Index: NetReflectorConfigurationReader.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/configuration/NetReflectorConfigurationReader.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NetReflectorConfigurationReader.cs 14 Apr 2005 16:53:41 -0000 1.2 --- NetReflectorConfigurationReader.cs 15 Apr 2005 04:46:17 -0000 1.3 *************** *** 13,17 **** private NetReflectorReader reader; ! public event UnusedNodeEventHandler UnusedNodeEventHandler; public NetReflectorConfigurationReader() --- 13,17 ---- private NetReflectorReader reader; ! public event InvalidNodeEventHandler InvalidNodeEventHandler; public NetReflectorConfigurationReader() *************** *** 20,24 **** typeTable.Add(AppDomain.CurrentDomain); typeTable.Add(Directory.GetCurrentDirectory(), CONFIG_ASSEMBLY_PATTERN); ! typeTable.UnusedNode += new UnusedNodeEventHandler(HandleUnusedNode); reader = new NetReflectorReader(typeTable); } --- 20,24 ---- typeTable.Add(AppDomain.CurrentDomain); typeTable.Add(Directory.GetCurrentDirectory(), CONFIG_ASSEMBLY_PATTERN); ! typeTable.InvalidNode += new InvalidNodeEventHandler(HandleUnusedNode); reader = new NetReflectorReader(typeTable); } *************** *** 55,62 **** } ! private void HandleUnusedNode(XmlNode node) { ! if (UnusedNodeEventHandler != null) ! UnusedNodeEventHandler(node); } } --- 55,62 ---- } ! private void HandleUnusedNode(InvalidNodeEventArgs args) { ! if (InvalidNodeEventHandler != null) ! InvalidNodeEventHandler(args); } } Index: DefaultConfigurationFileLoader.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/configuration/DefaultConfigurationFileLoader.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DefaultConfigurationFileLoader.cs 14 Apr 2005 16:53:41 -0000 1.5 --- DefaultConfigurationFileLoader.cs 15 Apr 2005 04:46:17 -0000 1.6 *************** *** 21,25 **** { this.reader = reader; ! reader.UnusedNodeEventHandler += new UnusedNodeEventHandler(WarnOnUnusedNodes); handler = new ValidationEventHandler(HandleSchemaEvent); } --- 21,25 ---- { this.reader = reader; ! reader.InvalidNodeEventHandler += new InvalidNodeEventHandler(WarnOnInvalidNode); handler = new ValidationEventHandler(HandleSchemaEvent); } *************** *** 82,88 **** } ! private void WarnOnUnusedNodes(XmlNode node) { ! Log.Warning(string.Format("Unused node detected in configuration: {0}.", node.OuterXml)); } } --- 82,88 ---- } ! private void WarnOnInvalidNode(InvalidNodeEventArgs args) { ! Log.Warning(args.Message); } } |
|
From: Owen R. <exo...@us...> - 2005-04-15 04:46:31
|
Update of /cvsroot/ccnet/ccnet/project/UnitTests/Core/Config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16578/project/UnitTests/Core/Config Modified Files: NetReflectorConfigurationReaderTest.cs Log Message: updated to work with new NetReflector release Index: NetReflectorConfigurationReaderTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/UnitTests/Core/Config/NetReflectorConfigurationReaderTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NetReflectorConfigurationReaderTest.cs 14 Apr 2005 16:26:46 -0000 1.1 --- NetReflectorConfigurationReaderTest.cs 15 Apr 2005 04:46:16 -0000 1.2 *************** *** 17,21 **** { private NetReflectorConfigurationReader reader; ! private IList unusedNodes; [SetUp] --- 17,21 ---- { private NetReflectorConfigurationReader reader; ! private IList invalidNodes; [SetUp] *************** *** 23,28 **** { reader = new NetReflectorConfigurationReader(); ! reader.UnusedNodeEventHandler += new UnusedNodeEventHandler(CheckUnusedNodes); ! unusedNodes = new ArrayList(); } --- 23,28 ---- { reader = new NetReflectorConfigurationReader(); ! reader.InvalidNodeEventHandler += new InvalidNodeEventHandler(CheckInvalidNode); ! invalidNodes = new ArrayList(); } *************** *** 69,74 **** IConfiguration configuration = reader.Read(ConfigurationFixture.GenerateConfig(xml)); Assert.IsNotNull(configuration.Projects["foo"]); ! Assert.AreEqual(1, unusedNodes.Count); ! Assert.AreEqual("bar", ((XmlNode)unusedNodes[0]).Name); } --- 69,74 ---- IConfiguration configuration = reader.Read(ConfigurationFixture.GenerateConfig(xml)); Assert.IsNotNull(configuration.Projects["foo"]); ! Assert.AreEqual(1, invalidNodes.Count); ! Assert.AreEqual("bar", ((InvalidNodeEventArgs)invalidNodes[0]).Node.Name); } *************** *** 100,105 **** Assert.AreEqual(1, project.Publishers.Length); Assert.IsTrue(project.Publishers[0] is MockPublisher); ! if (unusedNodes.Count > 0) ! Assert.Fail("The xml contains nodes that are no longer used: {0}.", ((XmlNode)unusedNodes[0]).OuterXml); } --- 100,105 ---- Assert.AreEqual(1, project.Publishers.Length); Assert.IsTrue(project.Publishers[0] is MockPublisher); ! if (invalidNodes.Count > 0) ! Assert.Fail("The xml contains nodes that are no longer used: {0}.", ((XmlNode)invalidNodes[0]).OuterXml); } *************** *** 114,120 **** } ! private void CheckUnusedNodes(XmlNode node) { ! unusedNodes.Add(node); } } --- 114,120 ---- } ! private void CheckInvalidNode(InvalidNodeEventArgs args) { ! invalidNodes.Add(args); } } |