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
|
2
|
3
|
4
|
5
(3) |
6
|
|
7
|
8
(2) |
9
(3) |
10
|
11
|
12
(2) |
13
|
|
14
|
15
(18) |
16
|
17
(1) |
18
(1) |
19
|
20
|
|
21
(15) |
22
(1) |
23
|
24
|
25
|
26
(13) |
27
|
|
28
|
29
|
30
|
|
|
|
|
|
From: <dre...@us...> - 2003-09-26 13:33:17
|
Update of /cvsroot/ccnet/ccnet/project/core/publishers/test In directory sc8-pr-cvs1:/tmp/cvs-serv13027/project/core/publishers/test Modified Files: EmailPublisherTest.cs Log Message: Fixed broken unit tests. I should have ran the tests again after CVS merged before checking in. Index: EmailPublisherTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/publishers/test/EmailPublisherTest.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EmailPublisherTest.cs 26 Sep 2003 10:00:26 -0000 1.4 --- EmailPublisherTest.cs 26 Sep 2003 13:33:13 -0000 1.5 *************** *** 73,77 **** _publisher.IncludeDetails = false; string message = _publisher.CreateMessage(CreateIntegrationResult(IntegrationStatus.Success, IntegrationStatus.Success)); ! AssertEquals(@"CC.NET Build Results for Project#9: http://localhost/ccnet?log=log19741224023000Lbuild.0.xml", message); } --- 73,77 ---- _publisher.IncludeDetails = false; string message = _publisher.CreateMessage(CreateIntegrationResult(IntegrationStatus.Success, IntegrationStatus.Success)); ! AssertEquals(@"CruiseControl.NET Build Results for project Project#9: http://localhost/ccnet?log=log19741224023000Lbuild.0.xml", message); } *************** *** 81,85 **** string message = _publisher.CreateMessage(CreateIntegrationResult(IntegrationStatus.Success, IntegrationStatus.Success)); Assert(message.StartsWith("<html>")); ! Assert(message.IndexOf("CC.NET Build Results for Project#9") > 0); Assert(message.IndexOf("Modifications since last build:") > 0); Assert(message.EndsWith("</html>")); --- 81,85 ---- string message = _publisher.CreateMessage(CreateIntegrationResult(IntegrationStatus.Success, IntegrationStatus.Success)); Assert(message.StartsWith("<html>")); ! Assert(message.IndexOf("CruiseControl.NET Build Results for project Project#9") > 0); Assert(message.IndexOf("Modifications since last build:") > 0); Assert(message.EndsWith("</html>")); *************** *** 216,220 **** AssertEquals("Project#9 Build Failed", _publisher.CreateSubject(result)); ! Assert(_publisher.CreateMessage(result).StartsWith("CC.NET Build Results for Project#9")); _publisher.IncludeDetails = true; --- 216,220 ---- AssertEquals("Project#9 Build Failed", _publisher.CreateSubject(result)); ! Assert(_publisher.CreateMessage(result).StartsWith("CruiseControl.NET Build Results for project Project#9")); _publisher.IncludeDetails = true; |
|
From: <dre...@us...> - 2003-09-26 13:33:17
|
Update of /cvsroot/ccnet/ccnet/project/core/test
In directory sc8-pr-cvs1:/tmp/cvs-serv13027/project/core/test
Modified Files:
ProjectTest.cs
Log Message:
Fixed broken unit tests. I should have ran the tests again after CVS merged before checking in.
Index: ProjectTest.cs
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/core/test/ProjectTest.cs,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** ProjectTest.cs 26 Sep 2003 10:00:33 -0000 1.13
--- ProjectTest.cs 26 Sep 2003 13:33:13 -0000 1.14
***************
*** 297,301 ****
mock.Verify();
AssertEquals("1.2.1", ((MockSourceControl)_project.SourceControl).Label);
! AssertEquals(4, _listener.Traces.Count);
}
--- 297,301 ----
mock.Verify();
AssertEquals("1.2.1", ((MockSourceControl)_project.SourceControl).Label);
! AssertEquals(3, _listener.Traces.Count);
}
***************
*** 322,326 ****
Assert(publisher.Published);
mock.Verify();
! AssertEquals(5, _listener.Traces.Count);
}
--- 322,326 ----
Assert(publisher.Published);
mock.Verify();
! AssertEquals(4, _listener.Traces.Count);
}
***************
*** 347,351 ****
Assert(publisher.Published);
mock.Verify();
! AssertEquals(5, _listener.Traces.Count);
}
--- 347,351 ----
Assert(publisher.Published);
mock.Verify();
! AssertEquals(4, _listener.Traces.Count);
}
|
Update of /cvsroot/ccnet/ccnet/project/core In directory sc8-pr-cvs1:/tmp/cvs-serv8284/project/core Modified Files: CruiseControl.cs CruiseManager.cs GenericProject.cs IProject.cs IntegrationEvents.cs IntegrationResult.cs LogFile.cs Project.cs core.csproj Log Message: Exceptions raised in a publisher no longer stop other publishers from executing. Modified PublisherBase to support this, and exposed public event IntegrationCompleted on IProject. Replaced references to concrete Project class with IProject interface references (adding to interface to do so). More documentation and code tidying. This is a 'blind' checkin, as I can't see the CruiseControl.NET website right now... has it crashed somehow? (http://ccnetlive.thoughtworks.com/ccnet/) Index: CruiseControl.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/CruiseControl.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CruiseControl.cs 17 May 2003 13:49:41 -0000 1.4 --- CruiseControl.cs 26 Sep 2003 10:00:16 -0000 1.5 *************** *** 138,146 **** } ! public IntegrationStatus GetLastBuildStatus() { ! foreach (IProject p in Projects) { ! return p.GetLastBuildStatus(); } --- 138,152 ---- } ! /// <summary> ! /// Gets the most recent build status across all projects for this CruiseControl.NET ! /// instance. ! /// </summary> ! /// <returns></returns> ! public IntegrationStatus GetLatestBuildStatus() { ! // TODO determine the most recent where multiple projects exist, rather than simply returning the first ! foreach (IProject project in Projects) { ! return project.GetLatestBuildStatus(); } *************** *** 150,156 **** public ProjectActivity CurrentProjectActivity() { ! foreach (IProject p in Projects) { ! return ((Project)p).CurrentActivity; } --- 156,162 ---- public ProjectActivity CurrentProjectActivity() { ! foreach (IProject project in Projects) { ! return project.CurrentActivity; } Index: CruiseManager.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/CruiseManager.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CruiseManager.cs 31 Jul 2003 20:40:33 -0000 1.6 --- CruiseManager.cs 26 Sep 2003 10:00:17 -0000 1.7 *************** *** 16,31 **** public class CruiseManager : MarshalByRefObject, ICruiseManager { ! private CruiseControl _cruiseControl; ! private ConfigurationLoader _loader; ! private Thread _cruiseControlThread; public const int TCP_PORT = 1234; ! public CruiseManager(string configFileName) ! { ! _loader = new ConfigurationLoader(configFileName); ! _cruiseControl = new CruiseControl(_loader); ! } ! private void InitializeThread() { _cruiseControlThread = new Thread(new ThreadStart(_cruiseControl.Start)); --- 16,31 ---- public class CruiseManager : MarshalByRefObject, ICruiseManager { ! private CruiseControl _cruiseControl; ! private ConfigurationLoader _loader; ! private Thread _cruiseControlThread; public const int TCP_PORT = 1234; ! public CruiseManager(string configFileName) ! { ! _loader = new ConfigurationLoader(configFileName); ! _cruiseControl = new CruiseControl(_loader); ! } ! private void InitializeThread() { _cruiseControlThread = new Thread(new ThreadStart(_cruiseControl.Start)); *************** *** 84,88 **** e.MoveNext(); Project p = (Project)e.Current; ! return new ProjectStatus(GetStatus(), p.GetLastBuildStatus(), p.CurrentActivity, p.Name, p.WebURL, p.LastIntegration.StartTime, p.LastIntegration.Label); } --- 84,88 ---- e.MoveNext(); Project p = (Project)e.Current; ! return new ProjectStatus(GetStatus(), p.GetLatestBuildStatus(), p.CurrentActivity, p.Name, p.WebURL, p.LastIntegrationResult.StartTime, p.LastIntegrationResult.Label); } *************** *** 96,151 **** } ! public string Configuration ! { ! get ! { ! StreamReader stream = new StreamReader(_loader.ConfigFile); ! try ! { ! return stream.ReadToEnd(); ! } ! finally ! { ! stream.Close(); ! } ! } ! set ! { ! StreamWriter stream = new StreamWriter(_loader.ConfigFile); ! try ! { ! stream.Write(value); ! } ! finally ! { ! stream.Close(); ! } ! } ! } ! public void RegisterForRemoting() ! { ! string configFile = System.Reflection.Assembly.GetEntryAssembly().Location + ".config"; ! string uri = "CruiseManager.rem"; ! RemotingConfiguration.Configure(configFile); ! RemotingServices.Marshal(this, uri); ! string url = uri; ! try ! { ! IChannelReceiver channel = (IChannelReceiver)ChannelServices.RegisteredChannels[0]; ! url = channel.GetUrlsForUri(uri)[0]; ! ICruiseManager marshalledObject = (ICruiseManager) RemotingServices.Connect(typeof(ICruiseManager), url); ! marshalledObject.GetStatus(); // this will throw an exception if it didn't connect ! Console.WriteLine("listening on " + url); ! } ! catch ! { ! throw new Exception("couldn't listen on " + url); ! } ! } ! } } --- 96,151 ---- } ! public string Configuration ! { ! get ! { ! StreamReader stream = new StreamReader(_loader.ConfigFile); ! try ! { ! return stream.ReadToEnd(); ! } ! finally ! { ! stream.Close(); ! } ! } ! set ! { ! StreamWriter stream = new StreamWriter(_loader.ConfigFile); ! try ! { ! stream.Write(value); ! } ! finally ! { ! stream.Close(); ! } ! } ! } ! public void RegisterForRemoting() ! { ! string configFile = System.Reflection.Assembly.GetEntryAssembly().Location + ".config"; ! string uri = "CruiseManager.rem"; ! RemotingConfiguration.Configure(configFile); ! RemotingServices.Marshal(this, uri); ! string url = uri; ! try ! { ! IChannelReceiver channel = (IChannelReceiver)ChannelServices.RegisteredChannels[0]; ! url = channel.GetUrlsForUri(uri)[0]; ! ICruiseManager marshalledObject = (ICruiseManager) RemotingServices.Connect(typeof(ICruiseManager), url); ! marshalledObject.GetStatus(); // this will throw an exception if it didn't connect ! Console.WriteLine("listening on " + url); ! } ! catch ! { ! throw new Exception("couldn't listen on " + url); ! } ! } ! } } Index: GenericProject.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/GenericProject.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GenericProject.cs 25 Jul 2003 12:36:28 -0000 1.1 --- GenericProject.cs 26 Sep 2003 10:00:18 -0000 1.2 *************** *** 6,12 **** --- 6,17 ---- namespace tw.ccnet.core { + /// <summary> + /// TODO explain why this class is here... + /// </summary> [ReflectorType("generic")] public class GenericProject : IProject { + public event IntegrationCompletedEventHandler IntegrationCompleted; + private IList _tasks = new ArrayList(); public string Name *************** *** 27,39 **** } ! public void Run(bool forceBuild) ! { ! } ! ! public void AddIntegrationEventHandler(IntegrationEventHandler handler) { } ! public IntegrationStatus GetLastBuildStatus() { return IntegrationStatus.Unknown; --- 32,40 ---- } ! public void RunIntegration(bool forceBuild) { } ! public IntegrationStatus GetLatestBuildStatus() { return IntegrationStatus.Unknown; *************** *** 43,46 **** --- 44,57 ---- { get { return 0; } + } + + public ArrayList Publishers + { + get { return new ArrayList(); } + } + + public ProjectActivity CurrentActivity + { + get { return ProjectActivity.Unknown; } } } Index: IProject.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/IProject.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IProject.cs 17 May 2003 13:49:41 -0000 1.4 --- IProject.cs 26 Sep 2003 10:00:18 -0000 1.5 *************** *** 1,16 **** using System; using tw.ccnet.remote; namespace tw.ccnet.core { public interface IProject { ! string Name { get; } ! ISchedule Schedule { get; } ! void Run(bool forceBuild); ! void AddIntegrationEventHandler(IntegrationEventHandler handler); ! IntegrationStatus GetLastBuildStatus(); ! int MinimumSleepTime { get; } } } --- 1,74 ---- using System; + using System.Collections; using tw.ccnet.remote; namespace tw.ccnet.core { + /// <summary> + /// Interface to which all projects must adhere, and via which all application + /// code should interact with projects. + /// </summary> public interface IProject { ! /// <summary> ! /// Raised upon completion of an integration for this project. ! /// </summary> ! event IntegrationCompletedEventHandler IntegrationCompleted; ! /// <summary> ! /// The name of this project. ! /// </summary> ! string Name ! { ! get; ! } ! ! /// <summary> ! /// Schedule information for this project's build. ! /// </summary> ! ISchedule Schedule ! { ! get; ! } ! ! /// <summary> ! /// The minimum period of time for which the build process should wait ! /// after one build, before starting the next (unless a build is forced). ! /// </summary> ! int MinimumSleepTime ! { ! get; ! } ! ! /// <summary> ! /// Gets a list of IPublisher instances, used by this project. ! /// TODO make this an IPublisher[] (need to check whether NetReflector works with arrays). ! /// </summary> ! ArrayList Publishers ! { ! get; ! } ! ! /// <summary> ! /// Gets this project's current activity, such as Building, Sleeping, etc... ! /// </summary> ! ProjectActivity CurrentActivity ! { ! get; ! } ! ! /// <summary> ! /// Attempts to run an integration. If <see cref="forceBuild"/> is not set, then a build ! /// should occur only if the elapsed sleeping period has occurred. If <see cref="forceBuild"/> ! /// if true, then a build should occur regardless of sleeping time. ! /// </summary> ! /// <param name="forceBuild"></param> ! void RunIntegration(bool forceBuild); ! ! /// <summary> ! /// Returns the most recent build status. ! /// </summary> ! /// <returns>The most recent build status</returns> ! IntegrationStatus GetLatestBuildStatus(); } } Index: IntegrationEvents.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/IntegrationEvents.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IntegrationEvents.cs 28 Apr 2003 22:41:36 -0000 1.2 --- IntegrationEvents.cs 26 Sep 2003 10:00:18 -0000 1.3 *************** *** 3,11 **** namespace tw.ccnet.core { ! public delegate void IntegrationEventHandler(object sender, IntegrationResult result); ! public interface IIntegrationEventHandler { ! IntegrationEventHandler IntegrationEventHandler { get ; } } } --- 3,34 ---- namespace tw.ccnet.core { ! public delegate void IntegrationCompletedEventHandler(object sender, IntegrationCompletedEventArgs e); ! public interface IIntegrationCompletedEventHandler { ! /// <summary> ! /// Gets a delegate for the IntegrationCompleted event. ! /// </summary> ! IntegrationCompletedEventHandler IntegrationCompletedEventHandler ! { ! get; ! } } + + /// <summary> + /// Event arguments for completed integrations. + /// </summary> + public class IntegrationCompletedEventArgs : EventArgs + { + /// <summary> + /// The result of the completed integration. + /// </summary> + public IntegrationResult IntegrationResult; + + public IntegrationCompletedEventArgs(IntegrationResult result) + { + IntegrationResult = result; + } + } + } Index: IntegrationResult.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/IntegrationResult.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IntegrationResult.cs 8 Sep 2003 20:00:11 -0000 1.4 --- IntegrationResult.cs 26 Sep 2003 10:00:18 -0000 1.5 *************** *** 47,50 **** --- 47,53 ---- } + /// <summary> + /// The date and time at which the integration commenced. + /// </summary> public DateTime StartTime { *************** *** 53,56 **** --- 56,62 ---- } + /// <summary> + /// The date and time at which the integration was completed. + /// </summary> public DateTime EndTime { *************** *** 99,113 **** } ! public void Start() { _startTime = DateTime.Now; } ! public void End() { _endTime = DateTime.Now; } ! public bool ShouldRunIntegration() { return Modifications.Length > 0; --- 105,119 ---- } ! public void MarkStartTime() { _startTime = DateTime.Now; } ! public void MarkEndTime() { _endTime = DateTime.Now; } ! public bool HasModifications() { return Modifications.Length > 0; *************** *** 165,169 **** && this.StartTime == other.StartTime && this.EndTime == other.EndTime; ! // && this.ExceptionResult == other.ExceptionResult; } --- 171,175 ---- && this.StartTime == other.StartTime && this.EndTime == other.EndTime; ! // && this.ExceptionResult == other.ExceptionResult; } Index: LogFile.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/LogFile.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LogFile.cs 23 Apr 2003 08:31:37 -0000 1.1 --- LogFile.cs 26 Sep 2003 10:00:18 -0000 1.2 *************** *** 34,51 **** public static bool IsSuccessful(string filename) { ! return filename[FilenamePrefix.Length+DateFormat.Length] == 'L'; } ! // public static string ParseForBuildLabel(string filename) ! // { ! // return null; ! // } ! ! public static string CreateFileName(DateTime date) { ! return String.Format("{0}{1}.xml",FilenamePrefix,date.ToString(DateFormat)); } ! public static string CreateFileName(DateTime date, string label) { return String.Format("{0}{1}Lbuild.{2}.xml", --- 34,47 ---- public static bool IsSuccessful(string filename) { ! int characterIndex = FilenamePrefix.Length + DateFormat.Length; ! return filename[characterIndex] == 'L'; } ! public static string CreateFailedBuildLogFileName(DateTime date) { ! return String.Format("{0}{1}.xml", FilenamePrefix,date.ToString(DateFormat)); } ! public static string CreateSuccessfulBuildLogFileName(DateTime date, string label) { return String.Format("{0}{1}Lbuild.{2}.xml", *************** *** 53,57 **** date.ToString(DateFormat), label ! ); } --- 49,53 ---- date.ToString(DateFormat), label ! ); } *************** *** 151,161 **** { throw new ArgumentException(String.Format( ! "{0} does not start with {1}.", filename, FilenamePrefix)); } if (filename.Length < FilenamePrefix.Length + DateFormat.Length) { throw new ArgumentException(String.Format( ! "{0} does not start with {1} followed by a date in {2} format", ! filename, FilenamePrefix, DateFormat)); } } --- 147,157 ---- { throw new ArgumentException(String.Format( ! "{0} does not start with {1}.", filename, FilenamePrefix)); } if (filename.Length < FilenamePrefix.Length + DateFormat.Length) { throw new ArgumentException(String.Format( ! "{0} does not start with {1} followed by a date in {2} format", ! filename, FilenamePrefix, DateFormat)); } } *************** *** 169,175 **** { if (result.Status == IntegrationStatus.Success) ! return CreateUrl(CreateFileName(result.LastModificationDate, result.Label)); else ! return CreateUrl(CreateFileName(result.LastModificationDate)); } --- 165,171 ---- { if (result.Status == IntegrationStatus.Success) ! return CreateUrl(CreateSuccessfulBuildLogFileName(result.LastModificationDate, result.Label)); else ! return CreateUrl(CreateFailedBuildLogFileName(result.LastModificationDate)); } Index: Project.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/Project.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Project.cs 21 Sep 2003 15:28:16 -0000 1.10 --- Project.cs 26 Sep 2003 10:00:18 -0000 1.11 *************** *** 1,14 **** using System; using System.Collections; ! using System.Diagnostics; ! using System.Threading; using Exortech.NetReflector; ! using tw.ccnet.core.state; using tw.ccnet.core.label; using tw.ccnet.core.publishers; - using tw.ccnet.core; - using tw.ccnet.remote; using tw.ccnet.core.schedule; using tw.ccnet.core.util; namespace tw.ccnet.core --- 1,13 ---- using System; using System.Collections; ! using Exortech.NetReflector; ! using tw.ccnet.core.label; using tw.ccnet.core.publishers; using tw.ccnet.core.schedule; + using tw.ccnet.core.state; using tw.ccnet.core.util; + using tw.ccnet.remote; namespace tw.ccnet.core *************** *** 30,51 **** public class Project : IProject { ! public static readonly string END_OF_INTEGRATION_LOG_OUTPUT = Environment.NewLine; ! private string _name; ! private string _webURL = "http://localhost/CruiseControl.NET/"; ! private ISchedule _schedule; ! private ISourceControl _sourceControl; ! private IBuilder _builder; ! private ILabeller _labeller = new DefaultLabeller(); ! private IList _publishers = new ArrayList(); ! private IStateManager _state = new IntegrationStateManager(); ! private bool _stopped = false; ! private IntegrationResult _lastIntegration; ! private IntegrationResult _currentIntegration; ! private event IntegrationEventHandler _integrationEventHandler; ! private ProjectActivity currentActivity; ! private int modificationDelay = 0; ! private int sleepTime = 0; - #region Project Properties [ReflectorProperty("name")] public string Name --- 29,54 ---- public class Project : IProject { ! /// <summary> ! /// Raised whenever an integration is completed. ! /// </summary> ! public event IntegrationCompletedEventHandler IntegrationCompleted; ! ! string _name; ! string _webURL = "http://localhost/CruiseControl.NET/"; // default value ! ISchedule _schedule; ! ISourceControl _sourceControl; ! IBuilder _builder; ! ILabeller _labeller = new DefaultLabeller(); ! ArrayList _publishers = new ArrayList(); ! IStateManager _state = new IntegrationStateManager(); ! IntegrationResult _lastIntegrationResult = null; ! IntegrationResult _currentIntegrationResult = null; ! ProjectActivity _currentActivity = ProjectActivity.Unknown; ! int _modificationDelay = 0; ! int _sleepTime = 0; ! bool _stopped = false; ! ! #region Properties set via Xml configuration [ReflectorProperty("name")] public string Name *************** *** 66,74 **** { get ! { ! if (_schedule == null) ! { _schedule = new Schedule(); ! } return _schedule; } --- 69,77 ---- { get ! { ! // construct a new schedule if none exists ! if (_schedule==null) _schedule = new Schedule(); ! return _schedule; } *************** *** 90,95 **** } [ReflectorCollection("publishers", InstanceType=typeof(ArrayList), Required=false)] ! public IList Publishers { get { return _publishers; } --- 93,103 ---- } + /// <summary> + /// The list of build-completed publishers used by this project. This property is + /// intended to be set via Xml configuration. Additional publishers should be + /// added via the <see cref="AddPublisher"/> method. + /// </summary> [ReflectorCollection("publishers", InstanceType=typeof(ArrayList), Required=false)] ! public ArrayList Publishers { get { return _publishers; } *************** *** 97,104 **** { _publishers = value; ! AddEventHandlers(_publishers); } } public bool Stopped { --- 105,138 ---- { _publishers = value; ! ! // an arraylist is used for netreflector, and this array cast ensures ! // strong typing at runtime ! IIntegrationCompletedEventHandler[] handlers ! = (IIntegrationCompletedEventHandler[])_publishers.ToArray(typeof(IIntegrationCompletedEventHandler)); ! ! // register each of these event handlers ! foreach (IIntegrationCompletedEventHandler handler in handlers) ! IntegrationCompleted += handler.IntegrationCompletedEventHandler; } } + [ReflectorProperty("state", InstanceTypeKey="type", Required=false)] + public IStateManager StateManager + { + get { return _state; } + set { _state = value; } + } + + [ReflectorProperty("modificationDelay", Required=false)] + public int ModificationDelay + { + get { return _modificationDelay; } + set { _modificationDelay = value; } + } + + #endregion + + #region Other properties + public bool Stopped { *************** *** 109,120 **** public int MinimumSleepTime { ! get { return sleepTime; } ! } ! ! [ReflectorProperty("state", InstanceTypeKey="type", Required=false)] ! public IStateManager StateManager ! { ! get { return _state; } ! set { _state = value; } } --- 143,147 ---- public int MinimumSleepTime { ! get { return _sleepTime; } } *************** *** 125,171 **** } ! public IntegrationResult LastIntegration { get { ! if (_lastIntegration == null) { ! _lastIntegration = LoadLastIntegration(); } ! return _lastIntegration; } ! set { _lastIntegration = value; } } ! public IntegrationResult CurrentIntegration { ! get { return _currentIntegration; } ! set { _currentIntegration = value; } } ! [ReflectorProperty("modificationDelay", Required=false)] ! public int ModificationDelay { ! get { return modificationDelay; } ! set { modificationDelay = value; } } #endregion ! public void Run() { ! Run(true); } ! public void Run(bool forceBuild) { ! if (Stopped) return; // lock ! sleepTime = 0; try { ! PreBuild(); ! DateTime modStart = DateTime.Now; GetSourceModifications(); if (forceBuild || ShouldRunBuild()) --- 152,197 ---- } ! public IntegrationResult LastIntegrationResult { get { ! if (_lastIntegrationResult == null) { ! _lastIntegrationResult = LoadLastIntegration(); } ! return _lastIntegrationResult; } ! set { _lastIntegrationResult = value; } } ! public IntegrationResult CurrentIntegrationResult { ! get { return _currentIntegrationResult; } ! set { _currentIntegrationResult = value; } } ! public ProjectActivity CurrentActivity { ! get { return _currentActivity; } } + #endregion ! public void RunIntegrationAndForceBuild() { ! RunIntegration(true); } ! public void RunIntegration(bool forceBuild) { ! if (Stopped) ! return; // lock ! _sleepTime = 0; try { ! InitialiseCurrentIntegrationResult(); GetSourceModifications(); if (forceBuild || ShouldRunBuild()) *************** *** 178,237 **** { Log("Exception occurred while running integration", ex); ! CurrentIntegration.ExceptionResult = ex; PostBuild(); } ! currentActivity = ProjectActivity.Sleeping; } ! internal void PreBuild() { ! CurrentIntegration = new IntegrationResult(); ! CurrentIntegration.ProjectName = Name; ! CurrentIntegration.LastIntegrationStatus = LastIntegration.Status; // test ! CurrentIntegration.Label = Labeller.Generate(LastIntegration); ! CurrentIntegration.Start(); ! Log(String.Format("Starting new integration...{0}", CurrentIntegration.StartTime)); } internal void GetSourceModifications() { ! currentActivity = ProjectActivity.CheckingModifications; ! CurrentIntegration.Modifications = SourceControl.GetModifications(LastIntegration.StartTime, CurrentIntegration.StartTime); ! Log(String.Format("{0} Modifications detected...", CurrentIntegration.Modifications.Length)); } internal void RunBuild() { ! currentActivity = ProjectActivity.Building; ! Builder.Run(CurrentIntegration); ! Log(String.Format("Build Complete: {0}", CurrentIntegration.Status.ToString())); } internal void PostBuild() { ! CurrentIntegration.End(); try { ! StateManager.Save(CurrentIntegration); } catch (CruiseControlException ex) { Log("Exception when saving integration state", ex); ! if (CurrentIntegration.ExceptionResult == null) { ! CurrentIntegration.ExceptionResult = ex; } } - LabelProject(CurrentIntegration); - RaiseIntegrationEvent(CurrentIntegration); - LastIntegration = CurrentIntegration; - Log(String.Format("Integration Complete... {0}", CurrentIntegration.EndTime)); } ! private IntegrationResult LoadLastIntegration() { ! return (StateManager.Exists()) ? StateManager.Load() : new IntegrationResult(); } private void Log(string message) { --- 204,282 ---- { Log("Exception occurred while running integration", ex); ! CurrentIntegrationResult.ExceptionResult = ex; PostBuild(); } ! ! // go to sleep ! _currentActivity = ProjectActivity.Sleeping; } ! internal void InitialiseCurrentIntegrationResult() { ! CurrentIntegrationResult = new IntegrationResult(); ! CurrentIntegrationResult.ProjectName = Name; ! CurrentIntegrationResult.LastIntegrationStatus = LastIntegrationResult.Status; // test ! CurrentIntegrationResult.Label = Labeller.Generate(LastIntegrationResult); ! CurrentIntegrationResult.MarkStartTime(); } internal void GetSourceModifications() { ! _currentActivity = ProjectActivity.CheckingModifications; ! CurrentIntegrationResult.Modifications = SourceControl.GetModifications(LastIntegrationResult.StartTime, CurrentIntegrationResult.StartTime); ! Log(String.Format("{0} Modifications detected...", CurrentIntegrationResult.Modifications.Length)); } internal void RunBuild() { ! _currentActivity = ProjectActivity.Building; ! Builder.Run(CurrentIntegrationResult); ! Log(String.Format("Build Complete: {0}", CurrentIntegrationResult.Status.ToString())); } internal void PostBuild() { ! CurrentIntegrationResult.MarkEndTime(); ! AttemptToSaveState(); ! HandleProjectLabelling(CurrentIntegrationResult); ! // raise event (publishers do their thing in response) ! OnIntegrationCompleted(new IntegrationCompletedEventArgs(CurrentIntegrationResult)); ! // update reference to the most recent result ! LastIntegrationResult = CurrentIntegrationResult; ! Log(String.Format("Integration Complete... {0}", CurrentIntegrationResult.EndTime)); ! } ! ! void AttemptToSaveState() ! { try { ! StateManager.Save(CurrentIntegrationResult); } catch (CruiseControlException ex) { Log("Exception when saving integration state", ex); ! if (CurrentIntegrationResult.ExceptionResult == null) { ! CurrentIntegrationResult.ExceptionResult = ex; } } } ! IntegrationResult LoadLastIntegration() { ! if (StateManager.Exists()) ! { ! return StateManager.Load(); ! } ! else ! { ! // no integration result is on record ! // TODO consider something such as IntegrationResult.Empty, to indicate 'unknown state' ! return new IntegrationResult(); ! } } + #region Logging helper methods + private void Log(string message) { *************** *** 244,325 **** } ! public void AddPublisher(IIntegrationEventHandler publisher) ! { ! _publishers.Add(publisher); ! AddIntegrationEventHandler(publisher.IntegrationEventHandler); ! } internal bool ShouldRunBuild() { ! if (CurrentIntegration.ShouldRunIntegration()) ! { ! if (ModificationDelay > 0) ! { ! return CheckModificationDelay(); ! } ! else ! { ! return true; ! } ! } return false; } ! private bool CheckModificationDelay() { ! TimeSpan diff = DateTime.Now - CurrentIntegration.LastModificationDate; if (diff.TotalMilliseconds < ModificationDelay) { ! sleepTime = ModificationDelay - (int)diff.TotalMilliseconds; Log("Changes found within the modification delay"); ! return false; } - return true; - } ! public IntegrationStatus GetLastBuildStatus() ! { ! if (LastIntegration != null) ! { ! return LastIntegration.Status; ! } ! return IntegrationStatus.Unknown; } ! public ProjectActivity CurrentActivity { ! get { return currentActivity; } } ! private void LabelProject(IntegrationResult result) { if (result.Succeeded) - { SourceControl.LabelSourceControl(result.Label, result.StartTime); - } } #region Event Handling - private void AddEventHandlers(IList list) - { - for (int i = 0; i < list.Count; i++) - { - AddIntegrationEventHandler(((IIntegrationEventHandler)list[i]).IntegrationEventHandler); - } - } ! public void AddIntegrationEventHandler(IntegrationEventHandler handler) { ! _integrationEventHandler += handler; } ! private void RaiseIntegrationEvent(IntegrationResult result) { ! if (_integrationEventHandler != null) ! { ! _integrationEventHandler(this, result); ! } } ! #endregion Event Handling } } --- 289,364 ---- } ! #endregion + /// <summary> + /// Determines whether a build should run. A build should run if there + /// are modifications, and none have occurred within the modification + /// delay. + /// </summary> internal bool ShouldRunBuild() { ! if (CurrentIntegrationResult.HasModifications()) ! return !DoModificationsExistWithinModificationDelay(); ! return false; } ! /// <summary> ! /// Checks whether modifications occurred within the modification delay. If the ! /// modification delay is not set (has a value of zero or less), this method ! /// will always return false. ! /// </summary> ! bool DoModificationsExistWithinModificationDelay() { ! if (ModificationDelay <= 0) ! return false; ! ! TimeSpan diff = DateTime.Now - CurrentIntegrationResult.LastModificationDate; if (diff.TotalMilliseconds < ModificationDelay) { ! _sleepTime = ModificationDelay - (int)diff.TotalMilliseconds; Log("Changes found within the modification delay"); ! return true; } ! return false; } ! public IntegrationStatus GetLatestBuildStatus() { ! if (LastIntegrationResult!=null) ! return LastIntegrationResult.Status; ! ! return IntegrationStatus.Unknown; } ! /// <summary> ! /// Labels the project, if the build was successful. ! /// </summary> ! void HandleProjectLabelling(IntegrationResult result) { if (result.Succeeded) SourceControl.LabelSourceControl(result.Label, result.StartTime); } #region Event Handling ! public void AddPublisher(PublisherBase publisher) { ! _publishers.Add(publisher); ! IntegrationCompleted += publisher.IntegrationCompletedEventHandler; } ! /// <summary> ! /// Raises the IntegrationCompleted event. ! /// </summary> ! /// <param name="e">Arguments to pass with the raised event.</param> ! protected virtual void OnIntegrationCompleted(IntegrationCompletedEventArgs e) { ! if (IntegrationCompleted!=null) ! IntegrationCompleted(this, e); } ! ! #endregion } } Index: core.csproj =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/core.csproj,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** core.csproj 13 Aug 2003 02:45:54 -0000 1.13 --- core.csproj 26 Sep 2003 10:00:18 -0000 1.14 *************** *** 18,22 **** OutputType = "Library" PreBuildEvent = "" ! PostBuildEvent = "copy $(ProjectDir)test\ccnet.core.dll.config $(TargetDir)
mkdir $(TargetDir)xsl
copy $(ProjectDir)publishers\xsl\*.xsl $(TargetDir)xsl" RootNamespace = "tw.ccnet.core" RunPostBuildEvent = "OnBuildSuccess" --- 18,22 ---- OutputType = "Library" PreBuildEvent = "" ! PostBuildEvent = 'copy "$(ProjectDir)test\ccnet.core.dll.config" "$(TargetDir)"
mkdir "$(TargetDir)xsl"
copy "$(ProjectDir)publishers\xsl\*.xsl" "$(TargetDir)xsl"' RootNamespace = "tw.ccnet.core" RunPostBuildEvent = "OnBuildSuccess" |
Update of /cvsroot/ccnet/ccnet/project/core/test In directory sc8-pr-cvs1:/tmp/cvs-serv8284/project/core/test Modified Files: ConfigSectionHandler.cs CruiseControlTest.cs IntegrationResultFixture.cs LogFileTest.cs MockProject.cs ProjectTest.cs Log Message: Exceptions raised in a publisher no longer stop other publishers from executing. Modified PublisherBase to support this, and exposed public event IntegrationCompleted on IProject. Replaced references to concrete Project class with IProject interface references (adding to interface to do so). More documentation and code tidying. This is a 'blind' checkin, as I can't see the CruiseControl.NET website right now... has it crashed somehow? (http://ccnetlive.thoughtworks.com/ccnet/) Index: ConfigSectionHandler.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/test/ConfigSectionHandler.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ConfigSectionHandler.cs 16 May 2003 18:07:42 -0000 1.1 --- ConfigSectionHandler.cs 26 Sep 2003 10:00:32 -0000 1.2 *************** *** 12,16 **** public void GetConfig() { ! IList list = (IList) ConfigurationSettings.GetConfig("xslFiles"); Assertion.AssertNotNull(list); Assertion.AssertEquals(5, list.Count); --- 12,16 ---- public void GetConfig() { ! IList list = (IList)ConfigurationSettings.GetConfig("xslFiles"); Assertion.AssertNotNull(list); Assertion.AssertEquals(5, list.Count); Index: CruiseControlTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/test/CruiseControlTest.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CruiseControlTest.cs 16 May 2003 18:08:26 -0000 1.5 --- CruiseControlTest.cs 26 Sep 2003 10:00:32 -0000 1.6 *************** *** 71,76 **** _mockConfig.Verify(); ! Assertion.AssertEquals(1, _project1.Runs); ! Assertion.AssertEquals(1, _project2.Runs); } --- 71,76 ---- _mockConfig.Verify(); ! Assertion.AssertEquals(1, _project1.RunIntegration_CallCount); ! Assertion.AssertEquals(1, _project2.RunIntegration_CallCount); } *************** *** 201,237 **** } ! // public void TestStopSleepingProject() ! // { ! // _project1.Sleep = 100000; ! // _cc.Start(_project1); ! // Assertion.AssertEquals(1, _cc.Threads.Count); ! // Thread.Sleep(1000); ! // ! // _cc.Stop(_project1); ! // Assertion.AssertEquals(0, _cc.Threads.Count); ! // } ! // ! // // test stop if thread has already stopped ! // public void TestStopAlreadyStoppedProject() ! // { ! // _cc.Start(_project1); ! // Thread.Sleep(1000); ! // _project1.Stop(); ! // Thread.Sleep(1000); ! // _cc.Stop(_project1); ! // Assertion.AssertEquals(0, _cc.Threads.Count); ! // } ! // ! // public void TestDisposeIfThreadsAreNotStopped() ! // { ! // _mockConfig.ExpectAndReturn("HasConfigurationChanged", true); ! // _mockConfig.ExpectAndReturn("LoadProjects", _projects); ! // ! // ! // _cc.Start(); ! // Thread.Sleep(2); ! // // do not shut down threads -- need to verify dispose called ! // _cc.Dispose(); ! // } } } --- 201,237 ---- } ! // public void TestStopSleepingProject() ! // { ! // _project1.Sleep = 100000; ! // _cc.Start(_project1); ! // Assertion.AssertEquals(1, _cc.Threads.Count); ! // Thread.Sleep(1000); ! // ! // _cc.Stop(_project1); ! // Assertion.AssertEquals(0, _cc.Threads.Count); ! // } ! // ! // // test stop if thread has already stopped ! // public void TestStopAlreadyStoppedProject() ! // { ! // _cc.Start(_project1); ! // Thread.Sleep(1000); ! // _project1.Stop(); ! // Thread.Sleep(1000); ! // _cc.Stop(_project1); ! // Assertion.AssertEquals(0, _cc.Threads.Count); ! // } ! // ! // public void TestDisposeIfThreadsAreNotStopped() ! // { ! // _mockConfig.ExpectAndReturn("HasConfigurationChanged", true); ! // _mockConfig.ExpectAndReturn("LoadProjects", _projects); ! // ! // ! // _cc.Start(); ! // Thread.Sleep(2); ! // // do not shut down threads -- need to verify dispose called ! // _cc.Dispose(); ! // } } } Index: IntegrationResultFixture.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/test/IntegrationResultFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IntegrationResultFixture.cs 23 Apr 2003 08:37:01 -0000 1.1 --- IntegrationResultFixture.cs 26 Sep 2003 10:00:33 -0000 1.2 *************** *** 10,19 **** { IntegrationResult result = new IntegrationResult("testProject"); ! result.Start(); result.Status = IntegrationStatus.Success; result.Label = "hello"; result.Modifications = new Modification[] { new Modification() }; result.Output = "<somexml>output</somexml>"; ! result.End(); return result; } --- 10,19 ---- { IntegrationResult result = new IntegrationResult("testProject"); ! result.MarkStartTime(); result.Status = IntegrationStatus.Success; result.Label = "hello"; result.Modifications = new Modification[] { new Modification() }; result.Output = "<somexml>output</somexml>"; ! result.MarkEndTime(); return result; } Index: LogFileTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/test/LogFileTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LogFileTest.cs 23 Apr 2003 08:37:01 -0000 1.1 --- LogFileTest.cs 26 Sep 2003 10:00:33 -0000 1.2 *************** *** 48,61 **** { string[] filenames = new string[]{ ! "log19710514150000.xml", ! "log19710514150001.xml", ! "log20020830164057Lbuild.9.xml", ! "log19710514150002.xml", ! "log20020830164057Lbuild.7.xml", ! "log19710514150003.xml", ! "log20020830164057Lbuild.6.xml", ! "log20020830164057Lbuild.8.xml", ! "log19710514150004.xml" ! }; int actual = LogFile.GetLatestBuildNumber(filenames); Assertion.AssertEquals(9, actual); --- 48,61 ---- { string[] filenames = new string[]{ ! "log19710514150000.xml", ! "log19710514150001.xml", ! "log20020830164057Lbuild.9.xml", ! "log19710514150002.xml", ! "log20020830164057Lbuild.7.xml", ! "log19710514150003.xml", ! "log20020830164057Lbuild.6.xml", ! "log20020830164057Lbuild.8.xml", ! "log19710514150004.xml" ! }; int actual = LogFile.GetLatestBuildNumber(filenames); Assertion.AssertEquals(9, actual); *************** *** 66,70 **** // testFilenames array must be in sorted order -- otherwise links iteration will fail string[] testFilenames = {"log123.xml", "log200.xml", "logfile.txt", ! "log20020830164057Lbuild.6.xml", "badfile.xml" }; TempFileUtil.CreateTempFiles(TestFolder, testFilenames); --- 66,70 ---- // testFilenames array must be in sorted order -- otherwise links iteration will fail string[] testFilenames = {"log123.xml", "log200.xml", "logfile.txt", ! "log20020830164057Lbuild.6.xml", "badfile.xml" }; TempFileUtil.CreateTempFiles(TestFolder, testFilenames); *************** *** 78,85 **** { string[] testFilenames = {"log123.xml", "log200.xml", "logfile.txt", ! "log20010830164057Lbuild.6.xml", ! "log20011230164057Lbuild.8.xml", ! "log20010430164057Lbuild.7.xml", ! "badfile.xml" }; TempFileUtil.CreateTempFiles(TestFolder, testFilenames); string path = TempFileUtil.GetTempPath(TestFolder); --- 78,85 ---- { string[] testFilenames = {"log123.xml", "log200.xml", "logfile.txt", ! "log20010830164057Lbuild.6.xml", ! "log20011230164057Lbuild.8.xml", ! "log20010430164057Lbuild.7.xml", ! "badfile.xml" }; TempFileUtil.CreateTempFiles(TestFolder, testFilenames); string path = TempFileUtil.GetTempPath(TestFolder); *************** *** 104,111 **** { string[] testFilenames = {"log123.xml", "log200.xml", "logfile.txt", ! "log20010830164057Lbuild.6.xml", ! "log20011230164057Lbuild.6.xml", ! "log20010430164057Lbuild.6.xml", ! "badfile.xml" }; TempFileUtil.CreateTempFiles(TestFolder, testFilenames); DateTime expected = new DateTime(2001,12,30,16,40,57); --- 104,111 ---- { string[] testFilenames = {"log123.xml", "log200.xml", "logfile.txt", ! "log20010830164057Lbuild.6.xml", ! "log20011230164057Lbuild.6.xml", ! "log20010430164057Lbuild.6.xml", ! "badfile.xml" }; TempFileUtil.CreateTempFiles(TestFolder, testFilenames); DateTime expected = new DateTime(2001,12,30,16,40,57); *************** *** 159,163 **** DateTime date = new DateTime(2002, 3, 28, 13, 0, 0); string expected = "log20020328130000.xml"; ! Assertion.AssertEquals(expected, LogFile.CreateFileName(date)); } --- 159,163 ---- DateTime date = new DateTime(2002, 3, 28, 13, 0, 0); string expected = "log20020328130000.xml"; ! Assertion.AssertEquals(expected, LogFile.CreateFailedBuildLogFileName(date)); } *************** *** 166,170 **** DateTime date = new DateTime(2002, 3, 28, 13, 0, 0); string expected = "log20020328130000Lbuild.33.xml"; ! Assertion.AssertEquals(expected, LogFile.CreateFileName(date, "33")); } --- 166,170 ---- DateTime date = new DateTime(2002, 3, 28, 13, 0, 0); string expected = "log20020328130000Lbuild.33.xml"; ! Assertion.AssertEquals(expected, LogFile.CreateSuccessfulBuildLogFileName(date, "33")); } Index: MockProject.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/test/MockProject.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MockProject.cs 17 May 2003 13:49:43 -0000 1.4 --- MockProject.cs 26 Sep 2003 10:00:33 -0000 1.5 *************** *** 1,4 **** --- 1,6 ---- using System; + using System.Collections; using System.Threading; + using tw.ccnet.core.schedule; using tw.ccnet.remote; *************** *** 8,15 **** public class MockProject : IProject { private string name; - private int runs = 0; private ISchedule schedule; - public bool ForceBuild; public MockProject(string name, ISchedule schedule) --- 10,17 ---- public class MockProject : IProject { + public event IntegrationCompletedEventHandler IntegrationCompleted; + private string name; private ISchedule schedule; public MockProject(string name, ISchedule schedule) *************** *** 35,59 **** } ! public virtual void Run(bool forceBuild) { ! ForceBuild = forceBuild; RunIntegration(); } public virtual void RunIntegration() { ! runs++; } ! public int Runs { ! get { return runs; } } ! public void AddIntegrationEventHandler(IntegrationEventHandler handler) {} ! ! public IntegrationStatus GetLastBuildStatus() { ! return IntegrationStatus.Unknown; } } --- 37,66 ---- } ! public ArrayList Publishers { ! get { return new ArrayList(); } ! } ! ! public bool RunIntegration_forceBuild; ! public virtual void RunIntegration(bool forceBuild) ! { ! RunIntegration_forceBuild = forceBuild; RunIntegration(); } + public int RunIntegration_CallCount = 0; public virtual void RunIntegration() { ! RunIntegration_CallCount++; } ! public IntegrationStatus GetLatestBuildStatus() { ! return IntegrationStatus.Unknown; } ! public ProjectActivity CurrentActivity { ! get { return ProjectActivity.Unknown; } } } Index: ProjectTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/test/ProjectTest.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ProjectTest.cs 21 Sep 2003 15:28:17 -0000 1.12 --- ProjectTest.cs 26 Sep 2003 10:00:33 -0000 1.13 *************** *** 40,44 **** { Mock mock = SetMockStateManager(false, null); ! IntegrationResult last = _project.LastIntegration; AssertNotNull(last); AssertEquals(DateTime.Now.AddDays(-1), last.LastModificationDate); // will load all modifications --- 40,44 ---- { Mock mock = SetMockStateManager(false, null); ! IntegrationResult last = _project.LastIntegrationResult; AssertNotNull(last); AssertEquals(DateTime.Now.AddDays(-1), last.LastModificationDate); // will load all modifications *************** *** 58,62 **** _project.StateManager = (IStateManager)mock.MockInstance; ! AssertEquals(expected, _project.LastIntegration); mock.Verify(); } --- 58,62 ---- _project.StateManager = (IStateManager)mock.MockInstance; ! AssertEquals(expected, _project.LastIntegrationResult); mock.Verify(); } *************** *** 66,74 **** { SetMockStateManager(false, null); ! _project.PreBuild(); ! AssertNotNull(_project.LastIntegration); ! AssertNotNull(_project.CurrentIntegration); ! AssertEquals("1", _project.CurrentIntegration.Label); ! AssertEquals(_project.Name, _project.CurrentIntegration.ProjectName); } --- 66,74 ---- { SetMockStateManager(false, null); ! _project.InitialiseCurrentIntegrationResult(); ! AssertNotNull(_project.LastIntegrationResult); ! AssertNotNull(_project.CurrentIntegrationResult); ! AssertEquals("1", _project.CurrentIntegrationResult.Label); ! AssertEquals(_project.Name, _project.CurrentIntegrationResult.ProjectName); } *************** *** 76,87 **** public void PostBuild() { ! _project.CurrentIntegration = new IntegrationResult(); DynamicMock publisherMock = new DynamicMock(typeof(PublisherBase)); CollectingConstraint constraint = new CollectingConstraint(); ! publisherMock.Expect("Publish", new IsAnything(), constraint); DynamicMock stateMock = new DynamicMock(typeof(IStateManager)); ! stateMock.Expect("Save", _project.CurrentIntegration); _project.AddPublisher((PublisherBase)publisherMock.MockInstance); --- 76,87 ---- public void PostBuild() { ! _project.CurrentIntegrationResult = new IntegrationResult(); DynamicMock publisherMock = new DynamicMock(typeof(PublisherBase)); CollectingConstraint constraint = new CollectingConstraint(); ! publisherMock.Expect("PublishIntegrationResults", new IsAnything(), constraint); DynamicMock stateMock = new DynamicMock(typeof(IStateManager)); ! stateMock.Expect("Save", _project.CurrentIntegrationResult); _project.AddPublisher((PublisherBase)publisherMock.MockInstance); *************** *** 93,102 **** publisherMock.Verify(); AssertNotNull(constraint.Parameter); ! AssertEquals(_project.CurrentIntegration, (IntegrationResult)constraint.Parameter); // verify build was written to state manager stateMock.Verify(); ! AssertEquals("verify that current build has become last build", _project.CurrentIntegration, _project.LastIntegration); } --- 93,102 ---- publisherMock.Verify(); AssertNotNull(constraint.Parameter); ! AssertEquals(_project.CurrentIntegrationResult, (IntegrationResult)constraint.Parameter); // verify build was written to state manager stateMock.Verify(); ! AssertEquals("verify that current build has become last build", _project.CurrentIntegrationResult, _project.LastIntegrationResult); } *************** *** 114,129 **** _project.StateManager = (IStateManager)stateMock.MockInstance; ! _project.Run(); AssertEquals(ProjectActivity.Sleeping, _project.CurrentActivity); ! AssertEquals(3, _project.CurrentIntegration.Modifications.Length); // verify that build was invoked builderMock.Verify(); // verify postbuild invoked ! AssertEquals(_project.CurrentIntegration, _project.LastIntegration); ! TimeSpan span = DateTime.Now - _project.CurrentIntegration.StartTime; ! Assert("start time is not set", _project.CurrentIntegration.StartTime != DateTime.MinValue); ! Assert("end time is not set", _project.CurrentIntegration.EndTime != DateTime.MinValue); } --- 114,129 ---- _project.StateManager = (IStateManager)stateMock.MockInstance; ! _project.RunIntegrationAndForceBuild(); AssertEquals(ProjectActivity.Sleeping, _project.CurrentActivity); ! AssertEquals(3, _project.CurrentIntegrationResult.Modifications.Length); // verify that build was invoked builderMock.Verify(); // verify postbuild invoked ! AssertEquals(_project.CurrentIntegrationResult, _project.LastIntegrationResult); ! TimeSpan span = DateTime.Now - _project.CurrentIntegrationResult.StartTime; ! Assert("start time is not set", _project.CurrentIntegrationResult.StartTime != DateTime.MinValue); ! Assert("end time is not set", _project.CurrentIntegrationResult.EndTime != DateTime.MinValue); } *************** *** 138,144 **** int buildTimeout = 1000; ! _project.LastIntegration = new IntegrationResult(); ! _project.LastIntegration.Modifications = CreateModifications(); ! _project.LastIntegration.StartTime = MockSourceControl.LastModificationTime; _project.SourceControl = new MockSourceControl(); _project.Builder = (IBuilder)builderMock.MockInstance; --- 138,144 ---- int buildTimeout = 1000; ! _project.LastIntegrationResult = new IntegrationResult(); ! _project.LastIntegrationResult.Modifications = CreateModifications(); ! _project.LastIntegrationResult.StartTime = MockSourceControl.LastModificationTime; _project.SourceControl = new MockSourceControl(); _project.Builder = (IBuilder)builderMock.MockInstance; *************** *** 154,162 **** DateTime stop = DateTime.Now; ! AssertEquals(0, _project.CurrentIntegration.Modifications.Length); // verify that build was NOT invoked and postbuild was NOT invoked builderMock.Verify(); ! AssertNotEquals(_project.CurrentIntegration, _project.LastIntegration); // verify that project slept --- 154,162 ---- DateTime stop = DateTime.Now; ! AssertEquals(0, _project.CurrentIntegrationResult.Modifications.Length); // verify that build was NOT invoked and postbuild was NOT invoked builderMock.Verify(); ! AssertNotEquals(_project.CurrentIntegrationResult, _project.LastIntegrationResult); // verify that project slept *************** *** 168,177 **** public void ShouldRunIntegration() { ! _project.CurrentIntegration = _project.LastIntegration; Assert("There are no modifications, project should not run", !_project.ShouldRunBuild()); Modification mod = new Modification(); mod.ModifiedTime = DateTime.Now; ! _project.CurrentIntegration.Modifications = new Modification[1]; ! _project.CurrentIntegration.Modifications[0] = mod; Assert("There are modifications, project should run", _project.ShouldRunBuild()); _project.ModificationDelay = 1000; --- 168,177 ---- public void ShouldRunIntegration() { ! _project.CurrentIntegrationResult = _project.LastIntegrationResult; Assert("There are no modifications, project should not run", !_project.ShouldRunBuild()); Modification mod = new Modification(); mod.ModifiedTime = DateTime.Now; ! _project.CurrentIntegrationResult.Modifications = new Modification[1]; ! _project.CurrentIntegrationResult.Modifications[0] = mod; Assert("There are modifications, project should run", _project.ShouldRunBuild()); _project.ModificationDelay = 1000; *************** *** 181,212 **** } ! /* [Test] ! [Ignore("too fragile")] ! public void SleepTime() ! { ! _project.CurrentIntegration = _project.LastIntegration; ! Modification mod = new Modification(); ! mod.ModifiedTime = DateTime.Now; ! _project.IntegrationTimeout = 100; ! _project.PreBuild(); ! _project.CurrentIntegration.Modifications = new Modification[1]; ! _project.CurrentIntegration.Modifications[0] = mod; ! DateTime start = DateTime.Now; ! _project.Sleep(); ! TimeSpan diff = DateTime.Now - start; ! Assert("Didn't sleep long enough", !(diff.TotalMilliseconds < 100)); ! _project.ModificationDelay = 50; ! mod.ModifiedTime = DateTime.Now.AddMilliseconds(-5); ! Assert("There are modifications within ModificationDelay, project should not run", !_project.ShouldRunBuild()); ! mod.ModifiedTime = DateTime.Now.AddMilliseconds(-5); ! start = DateTime.Now; ! _project.Sleep(); ! diff = DateTime.Now - start; ! Assert("Didn't sleep long enough", !(diff.TotalMilliseconds < 45)); ! Assert("Slept too long", !(diff.TotalMilliseconds > 100)); ! } ! */ public void TestStateChange() { --- 181,212 ---- } ! /* [Test] ! [Ignore("too fragile")] ! public void SleepTime() ! { ! _project.CurrentIntegration = _project.LastIntegration; ! Modification mod = new Modification(); ! mod.ModifiedTime = DateTime.Now; ! _project.IntegrationTimeout = 100; ! _project.PreBuild(); ! _project.CurrentIntegration.Modifications = new Modification[1]; ! _project.CurrentIntegration.Modifications[0] = mod; ! DateTime start = DateTime.Now; ! _project.Sleep(); ! TimeSpan diff = DateTime.Now - start; ! Assert("Didn't sleep long enough", !(diff.TotalMilliseconds < 100)); ! _project.ModificationDelay = 50; ! mod.ModifiedTime = DateTime.Now.AddMilliseconds(-5); ! Assert("There are modifications within ModificationDelay, project should not run", !_project.ShouldRunBuild()); ! mod.ModifiedTime = DateTime.Now.AddMilliseconds(-5); ! start = DateTime.Now; ! _project.Sleep(); ! diff = DateTime.Now - start; ! Assert("Didn't sleep long enough", !(diff.TotalMilliseconds < 45)); ! Assert("Slept too long", !(diff.TotalMilliseconds > 100)); ! } ! */ public void TestStateChange() { *************** *** 224,229 **** { _project.Stopped = true; ! _project.Run(); ! AssertNull(_project.CurrentIntegration); } --- 224,229 ---- { _project.Stopped = true; ! _project.RunIntegrationAndForceBuild(); ! AssertNull(_project.CurrentIntegrationResult); } *************** *** 236,247 **** stateMock.ExpectAndThrow("Exists", expectedException); _project.StateManager = (IStateManager)stateMock.MockInstance; ! _project.AddIntegrationEventHandler(publisher.IntegrationEventHandler); ! _project.Run(); ! AssertEquals(_project.CurrentIntegration, _project.LastIntegration); ! AssertEquals(expectedException, _project.LastIntegration.ExceptionResult); ! AssertEquals(IntegrationStatus.Exception, _project.LastIntegration.Status); ! AssertNotNull(_project.CurrentIntegration.EndTime); Assert(publisher.Published); stateMock.Verify(); --- 236,247 ---- stateMock.ExpectAndThrow("Exists", expectedException); _project.StateManager = (IStateManager)stateMock.MockInstance; ! _project.IntegrationCompleted += publisher.IntegrationCompletedEventHandler; ! _project.RunIntegrationAndForceBuild(); ! AssertEquals(_project.CurrentIntegrationResult, _project.LastIntegrationResult); ! AssertEquals(expectedException, _project.LastIntegrationResult.ExceptionResult); ! AssertEquals(IntegrationStatus.Exception, _project.LastIntegrationResult.Status); ! AssertNotNull(_project.CurrentIntegrationResult.EndTime); Assert(publisher.Published); stateMock.Verify(); *************** *** 257,272 **** mock.ExpectAndThrow("Generate", expectedException, new NMock.Constraints.IsAnything()); _project.Labeller = (ILabeller)mock.MockInstance; ! _project.AddIntegrationEventHandler(publisher.IntegrationEventHandler); IMock stateMock = new DynamicMock(typeof(IStateManager)); stateMock.ExpectAndReturn("Exists", false); ! stateMock.Expect("Save", _project.CurrentIntegration); _project.StateManager = (IStateManager)stateMock.MockInstance; ! _project.Run(); ! AssertEquals(_project.CurrentIntegration, _project.LastIntegration); ! AssertEquals(IntegrationStatus.Exception, _project.LastIntegration.Status); ! AssertEquals(expectedException, _project.LastIntegration.ExceptionResult); ! AssertNotNull(_project.CurrentIntegration.EndTime); Assert(publisher.Published); mock.Verify(); --- 257,272 ---- mock.ExpectAndThrow("Generate", expectedException, new NMock.Constraints.IsAnything()); _project.Labeller = (ILabeller)mock.MockInstance; ! _project.IntegrationCompleted += publisher.IntegrationCompletedEventHandler; IMock stateMock = new DynamicMock(typeof(IStateManager)); stateMock.ExpectAndReturn("Exists", false); ! stateMock.Expect("Save", _project.CurrentIntegrationResult); _project.StateManager = (IStateManager)stateMock.MockInstance; ! _project.RunIntegrationAndForceBuild(); ! AssertEquals(_project.CurrentIntegrationResult, _project.LastIntegrationResult); ! AssertEquals(IntegrationStatus.Exception, _project.LastIntegrationResult.Status); ! AssertEquals(expectedException, _project.LastIntegrationResult.ExceptionResult); ! AssertNotNull(_project.CurrentIntegrationResult.EndTime); Assert(publisher.Published); mock.Verify(); *************** *** 277,281 **** public void SourceControlLabeled() { ! // SetMockSourceControl(); _project.SourceControl = new MockSourceControl(); _project.Builder = new MockBuilder(); --- 277,281 ---- public void SourceControlLabeled() { ! // SetMockSourceControl(); _project.SourceControl = new MockSourceControl(); _project.Builder = new MockBuilder(); *************** *** 284,297 **** mock.ExpectAndReturn("Generate", "1.2.1", new NMock.Constraints.IsAnything()); _project.Labeller = (ILabeller)mock.MockInstance; ! _project.AddIntegrationEventHandler(publisher.IntegrationEventHandler); IMock stateMock = new DynamicMock(typeof(IStateManager)); stateMock.ExpectAndReturn("Exists", false); ! stateMock.Expect("Save", _project.CurrentIntegration); _project.StateManager = (IStateManager)stateMock.MockInstance; ! _project.Run(); ! AssertEquals(_project.CurrentIntegration, _project.LastIntegration); ! AssertNotNull(_project.CurrentIntegration.EndTime); Assert(publisher.Published); mock.Verify(); --- 284,297 ---- mock.ExpectAndReturn("Generate", "1.2.1", new NMock.Constraints.IsAnything()); _project.Labeller = (ILabeller)mock.MockInstance; ! _project.IntegrationCompleted += publisher.IntegrationCompletedEventHandler; IMock stateMock = new DynamicMock(typeof(IStateManager)); stateMock.ExpectAndReturn("Exists", false); ! stateMock.Expect("Save", _project.CurrentIntegrationResult); _project.StateManager = (IStateManager)stateMock.MockInstance; ! _project.RunIntegrationAndForceBuild(); ! AssertEquals(_project.CurrentIntegrationResult, _project.LastIntegrationResult); ! AssertNotNull(_project.CurrentIntegrationResult.EndTime); Assert(publisher.Published); mock.Verify(); *************** *** 309,323 **** _project.StateManager = (IStateManager)mock.MockInstance; MockPublisher publisher = new MockPublisher(); ! _project.AddIntegrationEventHandler(publisher.IntegrationEventHandler); _project.SourceControl = new MockSourceControl(); _project.Builder = new MockBuilder(); ! _project.Run(); // failure to save the integration result will register as a failed project ! AssertEquals(_project.CurrentIntegration, _project.LastIntegration); ! AssertEquals(IntegrationStatus.Exception, _project.LastIntegration.Status); ! AssertEquals(expectedException, _project.LastIntegration.ExceptionResult); ! AssertNotNull(_project.CurrentIntegration.EndTime); Assert(publisher.Published); mock.Verify(); --- 309,323 ---- _project.StateManager = (IStateManager)mock.MockInstance; MockPublisher publisher = new MockPublisher(); ! _project.IntegrationCompleted += publisher.IntegrationCompletedEventHandler; _project.SourceControl = new MockSourceControl(); _project.Builder = new MockBuilder(); ! _project.RunIntegrationAndForceBuild(); // failure to save the integration result will register as a failed project ! AssertEquals(_project.CurrentIntegrationResult, _project.LastIntegrationResult); ! AssertEquals(IntegrationStatus.Exception, _project.LastIntegrationResult.Status); ! AssertEquals(expectedException, _project.LastIntegrationResult.ExceptionResult); ! AssertNotNull(_project.CurrentIntegrationResult.EndTime); Assert(publisher.Published); mock.Verify(); *************** *** 334,348 **** _project.StateManager = (IStateManager)mock.MockInstance; MockPublisher publisher = new MockPublisher(); ! _project.AddIntegrationEventHandler(publisher.IntegrationEventHandler); _project.SourceControl = new MockSourceControl(); _project.Builder = new MockBuilder(); ! _project.Run(); // failure to save the integration result will register as a failed project ! AssertEquals(_project.CurrentIntegration, _project.LastIntegration); ! AssertEquals(IntegrationStatus.Exception, _project.LastIntegration.Status); ! AssertEquals(expectedException, _project.LastIntegration.ExceptionResult); ! AssertNotNull(_project.CurrentIntegration.EndTime); Assert(publisher.Published); mock.Verify(); --- 334,348 ---- _project.StateManager = (IStateManager)mock.MockInstance; MockPublisher publisher = new MockPublisher(); ! _project.IntegrationCompleted += publisher.IntegrationCompletedEventHandler; _project.SourceControl = new MockSourceControl(); _project.Builder = new MockBuilder(); ! _project.RunIntegrationAndForceBuild(); // failure to save the integration result will register as a failed project ! AssertEquals(_project.CurrentIntegrationResult, _project.LastIntegrationResult); ! AssertEquals(IntegrationStatus.Exception, _project.LastIntegrationResult.Status); ! AssertEquals(expectedException, _project.LastIntegrationResult.ExceptionResult); ! AssertNotNull(_project.CurrentIntegrationResult.EndTime); Assert(publisher.Published); mock.Verify(); *************** *** 359,363 **** AssertFalse(((MockBuilder)_project.Builder).HasRun); ! _project.Run(true); Assert(((MockBuilder)_project.Builder).HasRun); --- 359,363 ---- AssertFalse(((MockBuilder)_project.Builder).HasRun); ! _project.RunIntegration(true); Assert(((MockBuilder)_project.Builder).HasRun); |
|
From: <dre...@us...> - 2003-09-26 10:01:09
|
Update of /cvsroot/ccnet/ccnet/project/web/test In directory sc8-pr-cvs1:/tmp/cvs-serv8284/project/web/test Modified Files: LogFileListTest.cs Log Message: Exceptions raised in a publisher no longer stop other publishers from executing. Modified PublisherBase to support this, and exposed public event IntegrationCompleted on IProject. Replaced references to concrete Project class with IProject interface references (adding to interface to do so). More documentation and code tidying. This is a 'blind' checkin, as I can't see the CruiseControl.NET website right now... has it crashed somehow? (http://ccnetlive.thoughtworks.com/ccnet/) Index: LogFileListTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/web/test/LogFileListTest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LogFileListTest.cs 26 May 2003 21:50:22 -0000 1.2 --- LogFileListTest.cs 26 Sep 2003 10:00:34 -0000 1.3 *************** *** 130,134 **** HtmlAnchor previous = new HtmlAnchor(); HtmlAnchor next = new HtmlAnchor(); ! TempFileUtil.CreateTempFile(_tempFolder, LogFile.CreateFileName(new DateTime(), "2")); LogFileLister.InitAdjacentAnchors(new HtmlAnchor(), new HtmlAnchor(), _tempFolder, null); --- 130,134 ---- HtmlAnchor previous = new HtmlAnchor(); HtmlAnchor next = new HtmlAnchor(); ! TempFileUtil.CreateTempFile(_tempFolder, LogFile.CreateSuccessfulBuildLogFileName(new DateTime(), "2")); LogFileLister.InitAdjacentAnchors(new HtmlAnchor(), new HtmlAnchor(), _tempFolder, null); |
|
From: <dre...@us...> - 2003-09-26 10:01:06
|
Update of /cvsroot/ccnet/ccnet/project/core/schedule/test In directory sc8-pr-cvs1:/tmp/cvs-serv8284/project/core/schedule/test Modified Files: SchedulerTest.cs Log Message: Exceptions raised in a publisher no longer stop other publishers from executing. Modified PublisherBase to support this, and exposed public event IntegrationCompleted on IProject. Replaced references to concrete Project class with IProject interface references (adding to interface to do so). More documentation and code tidying. This is a 'blind' checkin, as I can't see the CruiseControl.NET website right now... has it crashed somehow? (http://ccnetlive.thoughtworks.com/ccnet/) Index: SchedulerTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/schedule/test/SchedulerTest.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SchedulerTest.cs 25 Jul 2003 12:36:28 -0000 1.8 --- SchedulerTest.cs 26 Sep 2003 10:00:31 -0000 1.9 *************** *** 69,75 **** Assertion.Assert("The project did not sleep", delta >= expectedDelta); ! // TimeSpan expectedDelta = new TimeSpan(_schedule.TimeOut * 2); ! // // Assert("The project did not sleep", delta >= expectedDelta); ! // //Console.WriteLine("expected: " + expectedDelta + " actual: " + delta); } --- 69,75 ---- Assertion.Assert("The project did not sleep", delta >= expectedDelta); ! // TimeSpan expectedDelta = new TimeSpan(_schedule.TimeOut * 2); ! // // Assert("The project did not sleep", delta >= expectedDelta); ! // //Console.WriteLine("expected: " + expectedDelta + " actual: " + delta); } *************** *** 86,90 **** // verify that the project has run multiple times ! Assert(_project.Runs > 0); AssertEquals(SchedulerState.Stopped, _scheduler.State); } --- 86,90 ---- // verify that the project has run multiple times ! Assert(_project.RunIntegration_CallCount > 0); AssertEquals(SchedulerState.Stopped, _scheduler.State); } *************** *** 147,159 **** _scheduler.WaitForExit(); ! //<<<<<<< SchedulerTest.cs ! // _scheduler.Project = new MockProject("mock"); ! // Schedule newSchedule = new Schedule(); ! // newSchedule.TotalIterations = 1; ! // newSchedule.TimeOut = 1; ! //======= Schedule newSchedule = new Schedule(1, 1); _scheduler.Project = new MockProject("mock", newSchedule); ! //>>>>>>> 1.4 _scheduler.Schedule = newSchedule; --- 147,159 ---- _scheduler.WaitForExit(); ! //<<<<<<< SchedulerTest.cs ! // _scheduler.Project = new MockProject("mock"); ! // Schedule newSchedule = new Schedule(); ! // newSchedule.TotalIterations = 1; ! // newSchedule.TimeOut = 1; ! //======= Schedule newSchedule = new Schedule(1, 1); _scheduler.Project = new MockProject("mock", newSchedule); ! //>>>>>>> 1.4 _scheduler.Schedule = newSchedule; *************** *** 186,190 **** _scheduler.WaitForExit(); ! Assert(_project.ForceBuild); } --- 186,190 ---- _scheduler.WaitForExit(); ! Assert(_project.RunIntegration_forceBuild); } |
|
From: <dre...@us...> - 2003-09-26 10:01:04
|
Update of /cvsroot/ccnet/ccnet/project/core/schedule In directory sc8-pr-cvs1:/tmp/cvs-serv8284/project/core/schedule Modified Files: Scheduler.cs Log Message: Exceptions raised in a publisher no longer stop other publishers from executing. Modified PublisherBase to support this, and exposed public event IntegrationCompleted on IProject. Replaced references to concrete Project class with IProject interface references (adding to interface to do so). More documentation and code tidying. This is a 'blind' checkin, as I can't see the CruiseControl.NET website right now... has it crashed somehow? (http://ccnetlive.thoughtworks.com/ccnet/) Index: Scheduler.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/schedule/Scheduler.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Scheduler.cs 17 May 2003 13:49:43 -0000 1.5 --- Scheduler.cs 26 Sep 2003 10:00:29 -0000 1.6 *************** *** 55,59 **** try { ! _project.Run(_schedule.ForceBuild); } catch (Exception ex) --- 55,59 ---- try { ! _project.RunIntegration(_schedule.ForceBuild); } catch (Exception ex) |
Update of /cvsroot/ccnet/ccnet/project/core/publishers/test In directory sc8-pr-cvs1:/tmp/cvs-serv8284/project/core/publishers/test Modified Files: BuildPublisherTest.cs EmailPublisherTest.cs MockPublisher.cs NetSendPublisherTest.cs XmlLogPublisherTest.cs Log Message: Exceptions raised in a publisher no longer stop other publishers from executing. Modified PublisherBase to support this, and exposed public event IntegrationCompleted on IProject. Replaced references to concrete Project class with IProject interface references (adding to interface to do so). More documentation and code tidying. This is a 'blind' checkin, as I can't see the CruiseControl.NET website right now... has it crashed somehow? (http://ccnetlive.thoughtworks.com/ccnet/) Index: BuildPublisherTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/publishers/test/BuildPublisherTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BuildPublisherTest.cs 23 Apr 2003 08:45:38 -0000 1.1 --- BuildPublisherTest.cs 26 Sep 2003 10:00:24 -0000 1.2 *************** *** 61,65 **** result.Label = "99"; ! publisher.Publish(null, result); FileInfo resultFile = new FileInfo(pubDir + @"\99\" + fileName); --- 61,65 ---- result.Label = "99"; ! publisher.PublishIntegrationResults(null, result); FileInfo resultFile = new FileInfo(pubDir + @"\99\" + fileName); Index: EmailPublisherTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/publishers/test/EmailPublisherTest.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EmailPublisherTest.cs 4 Jul 2003 22:02:53 -0000 1.3 --- EmailPublisherTest.cs 26 Sep 2003 10:00:26 -0000 1.4 *************** *** 76,80 **** } ! public void TestEmailMessageWithDetails() { _publisher.IncludeDetails = true; string message = _publisher.CreateMessage(CreateIntegrationResult(IntegrationStatus.Success, IntegrationStatus.Success)); --- 76,81 ---- } ! public void TestEmailMessageWithDetails() ! { _publisher.IncludeDetails = true; string message = _publisher.CreateMessage(CreateIntegrationResult(IntegrationStatus.Success, IntegrationStatus.Success)); *************** *** 141,145 **** { IntegrationResult result = CreateIntegrationResult(IntegrationStatus.Success, IntegrationStatus.Success); ! _publisher.Publish(null, result); AssertEquals("mock.gateway.org", _gateway.MailHost); AssertEquals(1, _gateway.SentMessages.Count); --- 142,146 ---- { IntegrationResult result = CreateIntegrationResult(IntegrationStatus.Success, IntegrationStatus.Success); ! _publisher.PublishIntegrationResults(null, result); AssertEquals("mock.gateway.org", _gateway.MailHost); AssertEquals(1, _gateway.SentMessages.Count); *************** *** 148,152 **** public void TestPublish_UnknownIntegrationStatus() { ! _publisher.Publish(null, new IntegrationResult()); AssertEquals(0, _gateway.SentMessages.Count); // verify that no messages are sent if there were no modifications --- 149,153 ---- public void TestPublish_UnknownIntegrationStatus() { ! _publisher.PublishIntegrationResults(null, new IntegrationResult()); AssertEquals(0, _gateway.SentMessages.Count); // verify that no messages are sent if there were no modifications *************** *** 156,161 **** public void TestHandleIntegrationEvent() { ! IntegrationEventHandler handler = _publisher.IntegrationEventHandler; ! handler(null, CreateIntegrationResult(IntegrationStatus.Success, IntegrationStatus.Success)); Assert("Mail message was not sent!", _gateway.SentMessages.Count > 0); } --- 157,163 ---- public void TestHandleIntegrationEvent() { ! IntegrationCompletedEventHandler handler = _publisher.IntegrationCompletedEventHandler; ! IntegrationResult result = CreateIntegrationResult(IntegrationStatus.Success, IntegrationStatus.Success); ! handler(null, new IntegrationCompletedEventArgs(result)); Assert("Mail message was not sent!", _gateway.SentMessages.Count > 0); } Index: MockPublisher.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/publishers/test/MockPublisher.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockPublisher.cs 23 Apr 2003 08:45:38 -0000 1.1 --- MockPublisher.cs 26 Sep 2003 10:00:28 -0000 1.2 *************** *** 21,25 **** } ! public override void Publish(object source, IntegrationResult result) { _published = true; --- 21,25 ---- } ! public override void PublishIntegrationResults(IProject project, IntegrationResult result) { _published = true; Index: NetSendPublisherTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/publishers/test/NetSendPublisherTest.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NetSendPublisherTest.cs 13 Aug 2003 02:43:44 -0000 1.3 --- NetSendPublisherTest.cs 26 Sep 2003 10:00:28 -0000 1.4 *************** *** 106,115 **** { DynamicMock mockPublisher = new DynamicMock(typeof(NetSendPublisher)); ! mockPublisher.Ignore("Publish"); mockPublisher.ExpectAndReturn("ExecuteProcess", 0, new NMock.Constraints.IsTypeOf(typeof(Process))); NetSendPublisher publisher = (NetSendPublisher)mockPublisher.MockInstance; publisher.Names = "localhost"; ! publisher.Publish(null, IntegrationResultMother.CreateFailed()); mockPublisher.Verify(); --- 106,115 ---- { DynamicMock mockPublisher = new DynamicMock(typeof(NetSendPublisher)); ! mockPublisher.Ignore("PublishIntegrationResults"); mockPublisher.ExpectAndReturn("ExecuteProcess", 0, new NMock.Constraints.IsTypeOf(typeof(Process))); NetSendPublisher publisher = (NetSendPublisher)mockPublisher.MockInstance; publisher.Names = "localhost"; ! publisher.PublishIntegrationResults(null, IntegrationResultMother.CreateFailed()); mockPublisher.Verify(); *************** *** 124,128 **** DynamicMock mockPublisher = new DynamicMock(typeof(NetSendPublisher)); ! mockPublisher.Ignore("Publish"); mockPublisher.ExpectAndReturn("ExecuteProcess", 0, process1); mockPublisher.ExpectAndReturn("ExecuteProcess", 0, process2); --- 124,128 ---- DynamicMock mockPublisher = new DynamicMock(typeof(NetSendPublisher)); ! mockPublisher.Ignore("PublishIntegrationResults"); mockPublisher.ExpectAndReturn("ExecuteProcess", 0, process1); mockPublisher.ExpectAndReturn("ExecuteProcess", 0, process2); *************** *** 132,136 **** publisher.Names = "machine1,machine2,machine3"; ! publisher.Publish(null, IntegrationResultMother.CreateFailed()); mockPublisher.Verify(); --- 132,136 ---- publisher.Names = "machine1,machine2,machine3"; ! publisher.PublishIntegrationResults(null, IntegrationResultMother.CreateFailed()); mockPublisher.Verify(); *************** *** 145,149 **** NetSendPublisher publisher = new NetSendPublisher(); publisher.Names = "localhost"; ! publisher.Publish(null, CreateFailedIntegrationResult()); Win32Window window = Win32Window.Find("Messenger Service "); --- 145,149 ---- NetSendPublisher publisher = new NetSendPublisher(); publisher.Names = "localhost"; ! publisher.PublishIntegrationResults(null, CreateFailedIntegrationResult()); Win32Window window = Win32Window.Find("Messenger Service "); Index: XmlLogPublisherTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/publishers/test/XmlLogPublisherTest.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** XmlLogPublisherTest.cs 16 May 2003 18:08:46 -0000 1.3 --- XmlLogPublisherTest.cs 26 Sep 2003 10:00:29 -0000 1.4 *************** *** 35,39 **** { string xml = String.Format( ! @" <xmllogger> <logDir>{0}</logDir> </xmllogger>", LOGDIR); --- 35,39 ---- { string xml = String.Format( ! @" <xmllogger> <logDir>{0}</logDir> </xmllogger>", LOGDIR); *************** *** 116,120 **** { string xml = String.Format( ! @" <xmllogger> <logDir>{0}</logDir> <mergeFiles> --- 116,120 ---- { string xml = String.Format( ! @" <xmllogger> <logDir>{0}</logDir> <mergeFiles> *************** *** 153,162 **** _publisher.MergeFiles = new string[] {LOGDIR + "\\*.xml"}; ! ArrayList list = _publisher.getFileList(); Assertion.AssertEquals(1, list.Count); Assertion.AssertEquals(LOGDIR + "\\foo.xml", (string)list[0]); _publisher.MergeFiles = new string[] {LOGDIR + "\\foo.*"}; ! list = _publisher.getFileList(); Assertion.AssertEquals(2, list.Count); } --- 153,162 ---- _publisher.MergeFiles = new string[] {LOGDIR + "\\*.xml"}; ! ArrayList list = _publisher.GetMergeFileList(); Assertion.AssertEquals(1, list.Count); Assertion.AssertEquals(LOGDIR + "\\foo.xml", (string)list[0]); _publisher.MergeFiles = new string[] {LOGDIR + "\\foo.*"}; ! list = _publisher.GetMergeFileList(); Assertion.AssertEquals(2, list.Count); } *************** *** 195,199 **** IntegrationResult result = CreateIntegrationResult(IntegrationStatus.Success, true); ! _publisher.Publish(null, result); string filename = _publisher.GetFilename(result); --- 195,199 ---- IntegrationResult result = CreateIntegrationResult(IntegrationStatus.Success, true); ! _publisher.PublishIntegrationResults(null, result); string filename = _publisher.GetFilename(result); *************** *** 207,211 **** { AssertFalse(LOGDIR + " should be not exist at start of test.", Directory.Exists(LOGDIR)); ! _publisher.Publish(null, new IntegrationResult()); AssertFalse(LOGDIR + " should still not exist at end of this test.", Directory.Exists(LOGDIR)); } --- 207,211 ---- { AssertFalse(LOGDIR + " should be not exist at start of test.", Directory.Exists(LOGDIR)); ! _publisher.PublishIntegrationResults(null, new IntegrationResult()); AssertFalse(LOGDIR + " should still not exist at end of this test.", Directory.Exists(LOGDIR)); } |
Update of /cvsroot/ccnet/ccnet/project/core/publishers In directory sc8-pr-cvs1:/tmp/cvs-serv8284/project/core/publishers Modified Files: BuildLogTransformer.cs BuildPublisher.cs EmailPublisher.cs NetSendPublisher.cs PublisherBase.cs XmlLogPublisher.cs Log Message: Exceptions raised in a publisher no longer stop other publishers from executing. Modified PublisherBase to support this, and exposed public event IntegrationCompleted on IProject. Replaced references to concrete Project class with IProject interface references (adding to interface to do so). More documentation and code tidying. This is a 'blind' checkin, as I can't see the CruiseControl.NET website right now... has it crashed somehow? (http://ccnetlive.thoughtworks.com/ccnet/) Index: BuildLogTransformer.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/publishers/BuildLogTransformer.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BuildLogTransformer.cs 17 May 2003 13:49:40 -0000 1.3 --- BuildLogTransformer.cs 26 Sep 2003 10:00:18 -0000 1.4 *************** *** 10,21 **** { /// <summary> ! /// Summary description for BuildLogTransformer. /// </summary> public class BuildLogTransformer { ! public static string Transform(XmlDocument document) { StringBuilder builder = new StringBuilder(); ! IList list = (IList) ConfigurationSettings.GetConfig("xslFiles"); foreach (string xslFile in list) { --- 10,33 ---- { /// <summary> ! /// Utility class that provides static methods to transform build results using ! /// Xsl stylesheets. /// </summary> public class BuildLogTransformer { ! /// <summary> ! /// Utility class; not intended for instantiation. ! /// </summary> ! private BuildLogTransformer() {} ! ! /// <summary> ! /// Transforms the specified Xml document using all configured Xsl files, ! /// and returns the concatenated resulting Xml. ! /// </summary> ! /// <param name="document"></param> ! /// <returns></returns> ! public static string TransformResultsWithAllStyleSheets(XmlDocument document) { StringBuilder builder = new StringBuilder(); ! IList list = (IList)ConfigurationSettings.GetConfig("xslFiles"); foreach (string xslFile in list) { *************** *** 26,29 **** --- 38,47 ---- } + /// <summary> + /// Transforms an Xml document using a specific Xsl file. + /// </summary> + /// <param name="document"></param> + /// <param name="xslFile"></param> + /// <returns></returns> public static string Transform(XmlDocument document, string xslFile) { *************** *** 45,64 **** } } ! private static void LoadStylesheet(XslTransform transform, string xslfile) { try { ! transform.Load(xslfile); } ! catch(FileNotFoundException) { ! throw new CruiseControlException(String.Format("XSL stylesheet file not found: {0}", xslfile)); } ! catch(XmlException ex) { ! throw new CruiseControlException(String.Format("Bad XML in stylesheet: " + ex.Message)); } } } } --- 63,92 ---- } } + + #region Helper method ! /// <summary> ! /// Attempts to load the specified stylesheet. Throws a <see cref="CruiseControlException"/> ! /// if an error occurs. ! /// </summary> ! /// <param name="transform"></param> ! /// <param name="xslfile"></param> ! private static void LoadStylesheet(XslTransform transform, string xslFileName) { try { ! transform.Load(xslFileName); } ! catch (FileNotFoundException) { ! throw new CruiseControlException("XSL stylesheet file not found: " + xslFileName); } ! catch (XmlException ex) { ! throw new CruiseControlException("Bad XML in stylesheet: " + ex.Message); } } + + #endregion } } Index: BuildPublisher.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/publishers/BuildPublisher.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BuildPublisher.cs 4 Jul 2003 22:00:40 -0000 1.2 --- BuildPublisher.cs 26 Sep 2003 10:00:20 -0000 1.3 *************** *** 38,42 **** } ! public override void Publish(object source, IntegrationResult result) { if (result.Succeeded) --- 38,42 ---- } ! public override void PublishIntegrationResults(IProject project, IntegrationResult result) { if (result.Succeeded) Index: EmailPublisher.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/publishers/EmailPublisher.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EmailPublisher.cs 4 Jul 2003 22:02:53 -0000 1.4 --- EmailPublisher.cs 26 Sep 2003 10:00:21 -0000 1.5 *************** *** 10,14 **** using tw.ccnet.remote; - namespace tw.ccnet.core.publishers { --- 10,13 ---- *************** *** 32,35 **** --- 31,38 ---- #region Configuration Properties + + /// <summary> + /// The host name of the mail server. This field is required to send email notifications. + /// </summary> [ReflectorProperty("mailhost")] public string MailHost *************** *** 39,42 **** --- 42,49 ---- } + /// <summary> + /// The email address from which build results appear to have originated from. This + /// value seems to be required for most mail servers. + /// </summary> [ReflectorProperty("from")] public string FromAddress *************** *** 46,49 **** --- 53,59 ---- } + /// <summary> + /// Set this property (in configuration) to enable HTML emails containing build details. + /// </summary> [ReflectorProperty("includeDetails", Required=false)] public bool IncludeDetails *************** *** 73,76 **** --- 83,87 ---- set { _groups = value; } } + #endregion *************** *** 85,103 **** } ! public override void Publish(object source, IntegrationResult result) { ! if (result.Status == IntegrationStatus.Unknown) { return; } ! Project p = (Project) source; ! if (p != null) { ! foreach (PublisherBase publisher in p.Publishers) { if (publisher is XmlLogPublisher) { ! logPublisher = (XmlLogPublisher) publisher; break; } --- 96,113 ---- } ! public override void PublishIntegrationResults(IProject project, IntegrationResult result) { ! if (result.Status==IntegrationStatus.Unknown) { return; } ! if (project!=null) { ! foreach (PublisherBase publisher in project.Publishers) { if (publisher is XmlLogPublisher) { ! logPublisher = (XmlLogPublisher)publisher; break; } *************** *** 148,152 **** { // TODO Add culprit to message text -- especially if modifier is not an email user ! if(_includeDetails) { return CreateHtmlMessage(result); --- 158,162 ---- { // TODO Add culprit to message text -- especially if modifier is not an email user ! if (_includeDetails) { return CreateHtmlMessage(result); *************** *** 154,191 **** else { ! return CreateLinkMessage(result); } } ! private string CreateLinkMessage(IntegrationResult result) { ! return String.Format(@"CC.NET Build Results for {0}: {1}", ! result.ProjectName, LogFile.CreateUrl(ProjectUrl, result)) ; } ! private string CreateHtmlMessage(IntegrationResult result) { StringBuilder message = new StringBuilder(10000); ! message.Append("<html><head></head><body>"); ! message.Append(CreateLinkMessage(result)); AppendHtmlMessageDetails(result, message); message.Append("</body></html>"); return message.ToString(); } ! private void AppendHtmlMessageDetails(IntegrationResult result, StringBuilder message) { StringWriter buffer = new StringWriter(); XmlTextWriter writer = new XmlTextWriter(buffer); if (logPublisher != null) logPublisher.Write(result, writer); else new XmlLogPublisher().Write(result, writer); writer.Close(); XmlDocument xml = new XmlDocument(); xml.LoadXml(buffer.ToString()); ! message.Append(BuildLogTransformer.Transform(xml)); } internal string CreateRecipientList(IntegrationResult result) --- 164,235 ---- else { ! return CreateLinkMessage(result, false); } } ! string CreateLinkMessage(IntegrationResult result, bool makeHyperlink) { ! string link = LogFile.CreateUrl(ProjectUrl, result); ! ! if (makeHyperlink) ! link = string.Format("<a href='{0}'>view results</a>", link); ! ! return string.Format("CruiseControl.NET Build Results for project {0}: {1}", ! result.ProjectName, link); } ! #region HTML email stuff ! ! /// <summary> ! /// Creates an HTML representation of the build result as a string, intended ! /// to be included in the email message whenever 'IncludeDetails' is set to ! /// true. ! /// </summary> ! /// <param name="result"></param> ! /// <returns></returns> ! string CreateHtmlMessage(IntegrationResult result) { StringBuilder message = new StringBuilder(10000); ! ! // open HTML tags ! message.Append(string.Format("<html><head>{0}</head><body bgcolor='#DEDEF7'>", HtmlEmailCss)); ! ! // include a link to the build results page ! message.Append(CreateLinkMessage(result, true)); ! ! // append html details of the build AppendHtmlMessageDetails(result, message); + + // close HTML tags message.Append("</body></html>"); + return message.ToString(); } ! void AppendHtmlMessageDetails(IntegrationResult result, StringBuilder message) { StringWriter buffer = new StringWriter(); XmlTextWriter writer = new XmlTextWriter(buffer); if (logPublisher != null) + { logPublisher.Write(result, writer); + } else + { + // no log publisher has been set -- create a new one new XmlLogPublisher().Write(result, writer); + } writer.Close(); XmlDocument xml = new XmlDocument(); xml.LoadXml(buffer.ToString()); ! message.Append(BuildLogTransformer.TransformResultsWithAllStyleSheets(xml)); } + + const string HtmlEmailCss = @"<style> + BODY { font-family: verdana, arial, helvetica, sans-serif; font-size:9pt; } + </style>"; + + #endregion internal string CreateRecipientList(IntegrationResult result) *************** *** 237,241 **** return result.LastIntegrationStatus != result.Status; } - } } --- 281,284 ---- Index: NetSendPublisher.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/publishers/NetSendPublisher.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NetSendPublisher.cs 8 Aug 2003 11:22:51 -0000 1.2 --- NetSendPublisher.cs 26 Sep 2003 10:00:21 -0000 1.3 *************** *** 19,23 **** public string FixedMessage = "BUILD FIXED!"; ! public override void Publish(object source, IntegrationResult result) { if (ShouldSendMessage(result)) --- 19,23 ---- public string FixedMessage = "BUILD FIXED!"; ! public override void PublishIntegrationResults(IProject project, IntegrationResult result) { if (ShouldSendMessage(result)) Index: PublisherBase.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/publishers/PublisherBase.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PublisherBase.cs 28 Apr 2003 22:41:37 -0000 1.2 --- PublisherBase.cs 26 Sep 2003 10:00:23 -0000 1.3 *************** *** 3,25 **** using System.Xml; namespace tw.ccnet.core.publishers { ! public abstract class PublisherBase : IIntegrationEventHandler { ! private IntegrationEventHandler _publish; public PublisherBase() { ! _publish = new IntegrationEventHandler(Publish); } ! public IntegrationEventHandler IntegrationEventHandler { ! get { return _publish;} } ! public abstract void Publish(object source, IntegrationResult result); } } - - --- 3,66 ---- using System.Xml; + using tw.ccnet.core.util; + namespace tw.ccnet.core.publishers { ! /// <summary> ! /// Base class for all CruiseControl.NET build result publishers. ! /// </summary> ! public abstract class PublisherBase : IIntegrationCompletedEventHandler { ! private IntegrationCompletedEventHandler _publish; ! ! #region Constructor public PublisherBase() { ! _publish = new IntegrationCompletedEventHandler(Project_IntegrationCompleted); } + + #endregion + + #region Event registration ! public IntegrationCompletedEventHandler IntegrationCompletedEventHandler { ! get ! { ! return _publish; ! } } + + /// <summary> + /// The handler for the <see cref="IntegrationCompleted"/> event on IProject. + /// </summary> + /// <param name="source"></param> + /// <param name="e"></param> + private void Project_IntegrationCompleted(object source, IntegrationCompletedEventArgs e) + { + try + { + PublishIntegrationResults((IProject)source, e.IntegrationResult); + } + catch (Exception ex) + { + // TODO what do we do with these exceptions (apart from log them)??? + LogUtil.Log((IProject)source, "Exception thrown by publisher.", new CruiseControlException("Exception thrown by publisher", ex)); + } + } + + #endregion + + #region Abstract methods ! /// <summary> ! /// Performs all actions for this publisher implementation. ! /// </summary> ! /// <param name="project">The project from which results originated.</param> ! /// <param name="result">The result of this integration.</param> ! public abstract void PublishIntegrationResults(IProject project, IntegrationResult result); ! ! #endregion } } Index: XmlLogPublisher.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/publishers/XmlLogPublisher.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** XmlLogPublisher.cs 16 May 2003 18:08:44 -0000 1.3 --- XmlLogPublisher.cs 26 Sep 2003 10:00:23 -0000 1.4 *************** *** 12,24 **** public class XmlLogPublisher : PublisherBase { - public class Elements - { - public const string BUILD="build"; - public const string CRUISE_ROOT="cruisecontrol"; - public const string MODIFICATIONS="modifications"; - public const string INFO="info"; - public const string EXCEPTION="exception"; - } - private string _logDir; private string[] _mergeFiles; --- 12,15 ---- *************** *** 28,31 **** --- 19,24 ---- } + #region Xml configuration bound properties + [ReflectorProperty("logDir")] public string LogDir *************** *** 49,55 **** } ! public override void Publish(object source, IntegrationResult result) { ! if (result.Status == IntegrationStatus.Unknown) return; XmlWriter writer = GetXmlWriter(LogDir, GetFilename(result)); --- 42,52 ---- } ! #endregion ! ! public override void PublishIntegrationResults(IProject project, IntegrationResult result) { ! // only deal with known integration status ! if (result.Status==IntegrationStatus.Unknown) ! return; XmlWriter writer = GetXmlWriter(LogDir, GetFilename(result)); *************** *** 66,73 **** public XmlWriter GetXmlWriter(string dirname, string filename) { ! if (! Directory.Exists(dirname)) ! { Directory.CreateDirectory(dirname); ! } string path = Path.Combine(dirname, filename); return new XmlTextWriter(path, System.Text.Encoding.UTF8); --- 63,71 ---- public XmlWriter GetXmlWriter(string dirname, string filename) { ! // create directory if necessary ! if (!Directory.Exists(dirname)) Directory.CreateDirectory(dirname); ! ! // create Xml writer using UTF8 encoding string path = Path.Combine(dirname, filename); return new XmlTextWriter(path, System.Text.Encoding.UTF8); *************** *** 76,113 **** public string GetFilename(IntegrationResult result) { ! DateTime date = result.LastModificationDate; if (result.Succeeded) { ! return LogFile.CreateFileName(date, result.Label); } else { ! return LogFile.CreateFileName(date); } } - - public void Write(IntegrationResult result, XmlWriter writer) - { - writer.WriteStartElement(Elements.CRUISE_ROOT); - writer.WriteStartElement(Elements.MODIFICATIONS); - Write(result.Modifications, writer); - writer.WriteEndElement(); - WriteBuildElement(result, writer); - WriteMergeFiles(writer); - WriteException(result, writer); - writer.WriteEndElement(); - } ! public ArrayList getFileList() { ArrayList result = new ArrayList(); ! foreach(string file in MergeFiles) { ! int index = file.IndexOf("*"); ! if (index != -1) { string dir = Path.GetDirectoryName(file); string pattern = Path.GetFileName(file); DirectoryInfo info = new DirectoryInfo(dir); foreach (FileInfo fileInfo in info.GetFiles(pattern)) { --- 74,105 ---- public string GetFilename(IntegrationResult result) { ! DateTime lastModDate = result.LastModificationDate; if (result.Succeeded) { ! return LogFile.CreateSuccessfulBuildLogFileName(lastModDate, result.Label); } else { ! return LogFile.CreateFailedBuildLogFileName(lastModDate); } } ! /// <summary> ! /// Gets the list of file names, as specified in the MergeFiles property. Any wildcards ! /// are expanded to include such files. ! /// </summary> ! public ArrayList GetMergeFileList() { ArrayList result = new ArrayList(); ! ! foreach (string file in MergeFiles) { ! if (file.IndexOf("*")>-1) { + // filename has a wildcard string dir = Path.GetDirectoryName(file); string pattern = Path.GetFileName(file); DirectoryInfo info = new DirectoryInfo(dir); + // add all files that match wildcard foreach (FileInfo fileInfo in info.GetFiles(pattern)) { *************** *** 117,123 **** else { result.Add(file); } - } --- 109,115 ---- else { + // no wildcard, so just add result.Add(file); } } *************** *** 125,131 **** } private void WriteMergeFiles(XmlWriter writer) { ! ArrayList files = getFileList(); foreach (string file in files) { --- 117,137 ---- } + #region Writing + + public void Write(IntegrationResult result, XmlWriter writer) + { + writer.WriteStartElement(Elements.CRUISE_ROOT); + writer.WriteStartElement(Elements.MODIFICATIONS); + Write(result.Modifications, writer); + writer.WriteEndElement(); + WriteBuildElement(result, writer); + WriteMergeFiles(writer); + WriteException(result, writer); + writer.WriteEndElement(); + } + private void WriteMergeFiles(XmlWriter writer) { ! ArrayList files = GetMergeFileList(); foreach (string file in files) { *************** *** 205,210 **** } } - } - } --- 211,229 ---- } } + #endregion + + #region Inner type: Elements + public class Elements + { + public const string BUILD = "build"; + public const string CRUISE_ROOT = "cruisecontrol"; + public const string MODIFICATIONS = "modifications"; + public const string INFO = "info"; + public const string EXCEPTION = "exception"; + } + + #endregion + } + } |
|
From: <dre...@us...> - 2003-09-26 09:48:38
|
Update of /cvsroot/ccnet/ccnet/project/core/util
In directory sc8-pr-cvs1:/tmp/cvs-serv32445/project/core/util
Modified Files:
LogUtil.cs
Log Message:
Added private constructor.
Index: LogUtil.cs
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/core/util/LogUtil.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** LogUtil.cs 28 Jul 2003 23:59:59 -0000 1.3
--- LogUtil.cs 26 Sep 2003 09:48:34 -0000 1.4
***************
*** 7,10 ****
--- 7,15 ----
public class LogUtil
{
+ /// <summary>
+ /// Utility type, not intended for instantiation.
+ /// </summary>
+ private LogUtil() {}
+
public static void Log(IProject project, string message)
{
|
|
From: <dre...@us...> - 2003-09-26 09:47:32
|
Update of /cvsroot/ccnet/ccnet/project/core/sourcecontrol/test
In directory sc8-pr-cvs1:/tmp/cvs-serv32285/project/core/sourcecontrol/test
Modified Files:
PvcsTest.cs
Log Message:
Fixed typo...
Index: PvcsTest.cs
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/core/sourcecontrol/test/PvcsTest.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PvcsTest.cs 8 Sep 2003 22:22:40 -0000 1.3
--- PvcsTest.cs 26 Sep 2003 09:47:28 -0000 1.4
***************
*** 30,34 ****
// detected modifications during periods where daylight savings was active)
[Ignore("Date dependent test due to day light savings time bug in PVCS v7.5.1")]
! public void TestDetectedDayLightSavingsTime_PVCSDayLighSavingsBug()
{
Pvcs pvcs = new Pvcs();
--- 30,34 ----
// detected modifications during periods where daylight savings was active)
[Ignore("Date dependent test due to day light savings time bug in PVCS v7.5.1")]
! public void TestDetectedDayLightSavingsTime_PVCSDayLightSavingsBug()
{
Pvcs pvcs = new Pvcs();
***************
*** 36,40 ****
}
! public void TestSubtractAnHour_PVCSDayLighSavingsBug()
{
Pvcs pvcs = new Pvcs();
--- 36,40 ----
}
! public void TestSubtractAnHour_PVCSDayLightSavingsBug()
{
Pvcs pvcs = new Pvcs();
|
|
From: <dre...@us...> - 2003-09-26 09:43:34
|
Update of /cvsroot/ccnet/ccnet/project/web
In directory sc8-pr-cvs1:/tmp/cvs-serv31842/project/web
Modified Files:
web.csproj
Log Message:
Updated PostBuildEvent to wrap path names in quotes (supporting paths with spaces in... I learned this the hard way).
Index: web.csproj
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/web/web.csproj,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** web.csproj 21 Sep 2003 15:28:17 -0000 1.9
--- web.csproj 26 Sep 2003 09:43:30 -0000 1.10
***************
*** 18,22 ****
OutputType = "Library"
PreBuildEvent = ""
! PostBuildEvent = "copy $(ProjectDir)test\ccnet.web.dll.config $(TargetDir)"
RootNamespace = "tw.ccnet.web"
RunPostBuildEvent = "OnBuildSuccess"
--- 18,22 ----
OutputType = "Library"
PreBuildEvent = ""
! PostBuildEvent = 'copy "$(ProjectDir)test\ccnet.web.dll.config" "$(TargetDir)"'
RootNamespace = "tw.ccnet.web"
RunPostBuildEvent = "OnBuildSuccess"
|
Update of /cvsroot/ccnet/ccnet/project/ccnet.remote
In directory sc8-pr-cvs1:/tmp/cvs-serv29868/project/ccnet.remote
Modified Files:
ICruiseManager.cs ISchedule.cs ccnet.remote.csproj
Added Files:
CruiseControlStatus.cs IntegrationStatus.cs ProjectActivity.cs
ProjectStatus.cs
Log Message:
ICruiseManager.cs broken up so there's one file per class/enumeration, instead of having 5 types defined in ICruiseManager.cs
--- NEW FILE: CruiseControlStatus.cs ---
using System;
namespace tw.ccnet.remote
{
/// <remarks>
/// Enumeration of possible states for the CruiseControl.NET server.
/// </remarks>
public enum CruiseControlStatus
{
/// <summary>
/// The server is not running.
/// </summary>
Stopped,
/// <summary>
/// The server is running.
/// </summary>
Running,
/// <summary>
/// The server is scheduled to be stopped.
/// </summary>
WillBeStopped,
/// <summary>
/// The server's state is unknown.
/// </summary>
Unknown
}
}
--- NEW FILE: IntegrationStatus.cs ---
using System;
namespace tw.ccnet.remote
{
/// <summary>
/// Enumeration of possible summations following the integration of a project.
/// </summary>
public enum IntegrationStatus
{
/// <summary>
/// Indicates the project's integration was successful. Compilation succeeded,
/// and any tests passed.
/// </summary>
Success,
/// <summary>
/// Indicates the project's integration failed. Either the compilation or tests failed.
/// </summary>
Failure,
/// <summary>
/// Indicated CruiseControl.NET experienced exceptional circumstances during the
/// integration of the project.
/// </summary>
Exception,
/// <summary>
/// Indicates the state of the most recent integration is unknown. Perhaps no integration
/// has yet occurred.
/// </summary>
Unknown
}
}
--- NEW FILE: ProjectActivity.cs ---
using System;
namespace tw.ccnet.remote
{
/// <summary>
/// Enumeration of the possible activities of projects under continuous
/// integration by CruiseControl.NET.
/// </summary>
public enum ProjectActivity
{
/// <summary>
/// CruiseControl.NET is checking for modifications in this project's
/// source control system.
/// </summary>
CheckingModifications,
/// <summary>
/// CruiseControl.NET is running the build phase of the project's
/// integration.
/// </summary>
Building,
/// <summary>
/// CruiseControl.NET is sleeping, and no activity is being performed
/// for this project.
/// </summary>
Sleeping,
/// <summary>
/// The project's current activity is unknown.
/// </summary>
Unknown
}
}
--- NEW FILE: ProjectStatus.cs ---
using System;
namespace tw.ccnet.remote
{
/// <summary>
/// Value type that contains extensive details about a project's most recent
/// integration.
/// </summary>
/// <remarks>
/// This class is serialized to persist CruiseControl.NET's state for a
/// particular project, hence is is marked <see cref="Serializable"/>.
/// </remarks>
[Serializable]
public struct ProjectStatus
{
private CruiseControlStatus status;
private IntegrationStatus buildStatus;
private ProjectActivity activity;
private string name;
private string webURL;
private DateTime lastBuildDate;
private string lastBuildLabel;
public ProjectStatus(
CruiseControlStatus status,
IntegrationStatus buildStatus,
ProjectActivity activity,
string name,
string webURL,
DateTime lastBuildDate,
string lastBuildLabel
)
{
this.status = status;
this.buildStatus = buildStatus;
this.activity = activity;
this.name = name;
this.webURL = webURL;
this.lastBuildDate = lastBuildDate;
this.lastBuildLabel = lastBuildLabel;
}
/// <summary>
/// The state of the CruiseControl.NET server.
/// </summary>
public CruiseControlStatus Status
{
get { return status; }
}
public IntegrationStatus BuildStatus
{
get { return buildStatus; }
}
public ProjectActivity Activity
{
get { return activity; }
}
public string Name
{
get { return name; }
}
public string WebURL
{
get { return webURL; }
}
public DateTime LastBuildDate
{
get { return lastBuildDate; }
}
public string LastBuildLabel
{
get { return lastBuildLabel; }
}
}
}
Index: ICruiseManager.cs
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/ccnet.remote/ICruiseManager.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ICruiseManager.cs 31 Jul 2003 20:40:33 -0000 1.7
--- ICruiseManager.cs 26 Sep 2003 09:38:59 -0000 1.8
***************
*** 4,8 ****
{
/// <remarks>
! /// Remote Interface to CruiseControl.NET
/// </remarks>
public interface ICruiseManager
--- 4,8 ----
{
/// <remarks>
! /// Remote Interface to CruiseControl.NET.
/// </remarks>
public interface ICruiseManager
***************
*** 33,132 ****
ProjectStatus GetProjectStatus();
void Run(string project, ISchedule schedule);
! string Configuration { get; set; }
! }
!
! /// <remarks>
! /// Status of cruise control status
! /// </remarks>
! public enum CruiseControlStatus
! {
! Stopped,
! Running,
! WillBeStopped,
! Unknown
! }
!
! public enum ProjectActivity
! {
! CheckingModifications,
! Building,
! Sleeping,
! Unknown
! }
!
! [Serializable]
! public struct ProjectStatus
! {
! private CruiseControlStatus status;
! private IntegrationStatus buildStatus;
! private ProjectActivity activity;
! private string name;
! private string webURL;
! private DateTime lastBuildDate;
! private string lastBuildLabel;
!
! public ProjectStatus(
! CruiseControlStatus status,
! IntegrationStatus buildStatus,
! ProjectActivity activity,
! string name,
! string webURL,
! DateTime lastBuildDate,
! string lastBuildLabel
! )
! {
! this.status = status;
! this.buildStatus = buildStatus;
! this.activity = activity;
! this.name = name;
! this.webURL = webURL;
! this.lastBuildDate = lastBuildDate;
! this.lastBuildLabel = lastBuildLabel;
! }
!
! public CruiseControlStatus Status
! {
! get { return status; }
! }
!
! public IntegrationStatus BuildStatus
! {
! get { return buildStatus; }
! }
!
! public ProjectActivity Activity
! {
! get { return activity; }
! }
!
! public string Name
! {
! get { return name; }
! }
!
! public string WebURL
! {
! get { return webURL; }
! }
!
! public DateTime LastBuildDate
! {
! get { return lastBuildDate; }
! }
!
! public string LastBuildLabel
{
! get { return lastBuildLabel; }
}
- }
-
- public enum IntegrationStatus
- {
- Success,
- Failure,
- Exception,
- Unknown
}
}
--- 33,51 ----
ProjectStatus GetProjectStatus();
+ /// <summary>
+ /// TODO describe this method.
+ /// </summary>
+ /// <param name="project"></param>
+ /// <param name="schedule"></param>
void Run(string project, ISchedule schedule);
! /// <summary>
! /// Gets and sets the configuration string for this CruiseControl.NET instance.
! /// </summary>
! string Configuration
{
! get;
! set;
}
}
}
Index: ISchedule.cs
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/ccnet.remote/ISchedule.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ISchedule.cs 15 May 2003 09:59:16 -0000 1.1
--- ISchedule.cs 26 Sep 2003 09:38:59 -0000 1.2
***************
*** 5,8 ****
--- 5,10 ----
public interface ISchedule
{
+ // TODO provide some documentation on this interface... it's a bit cryptic!
+
bool ForceBuild { get; }
bool ShouldRun();
Index: ccnet.remote.csproj
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/ccnet.remote/ccnet.remote.csproj,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ccnet.remote.csproj 19 May 2003 02:11:26 -0000 1.4
--- ccnet.remote.csproj 26 Sep 2003 09:38:59 -0000 1.5
***************
*** 90,93 ****
--- 90,98 ----
/>
<File
+ RelPath = "CruiseControlStatus.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "ICruiseManager.cs"
SubType = "Code"
***************
*** 95,99 ****
--- 100,119 ----
/>
<File
+ RelPath = "IntegrationStatus.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "ISchedule.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ProjectActivity.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ProjectStatus.cs"
SubType = "Code"
BuildAction = "Compile"
|
|
From: <mik...@us...> - 2003-09-22 19:36:26
|
Update of /cvsroot/ccnet/ccnet/project/console In directory sc8-pr-cvs1:/tmp/cvs-serv7997/project/console Modified Files: StartCCNet.bat Log Message: Pass through arguments when starting with batch file Index: StartCCNet.bat =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/console/StartCCNet.bat,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StartCCNet.bat 28 Jul 2003 23:59:59 -0000 1.1 --- StartCCNet.bat 22 Sep 2003 19:36:20 -0000 1.2 *************** *** 1 **** ! ccnet -remoting:on \ No newline at end of file --- 1 ---- ! ccnet -remoting:on %* \ No newline at end of file |
|
From: <exo...@us...> - 2003-09-21 16:04:20
|
Update of /cvsroot/ccnet/ccnet/project/web In directory sc8-pr-cvs1:/tmp/cvs-serv25086/project/web Modified Files: Decorator.aspx Log Message: fixed decorator page to remove dependency on DecoratorControls assembly Index: Decorator.aspx =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/web/Decorator.aspx,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Decorator.aspx 15 Sep 2003 21:20:00 -0000 1.5 --- Decorator.aspx 21 Sep 2003 16:04:17 -0000 1.6 *************** *** 1,3 **** ! <%@ Register Namespace="SiteMesh.DecoratorControls" TagPrefix="decorator" Assembly="DecoratorControls" %> <%@ Page language="c#" Codebehind="Decorator.aspx.cs" AutoEventWireup="false" Inherits="tw.ccnet.web.Decorator" %> <!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN" "http://localhost/NUnitAsp/dtd/xhtml1-transitional.dtd"> --- 1,3 ---- ! <%@ Register Namespace="SiteMesh.DecoratorControls" TagPrefix="decorator" Assembly="Sitemesh" %> <%@ Page language="c#" Codebehind="Decorator.aspx.cs" AutoEventWireup="false" Inherits="tw.ccnet.web.Decorator" %> <!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN" "http://localhost/NUnitAsp/dtd/xhtml1-transitional.dtd"> |
|
From: <exo...@us...> - 2003-09-21 16:04:20
|
Update of /cvsroot/ccnet/ccnet/project/core/configuration/test In directory sc8-pr-cvs1:/tmp/cvs-serv25086/project/core/configuration/test Modified Files: ConfigurationLoaderTest.cs Log Message: fixed decorator page to remove dependency on DecoratorControls assembly Index: ConfigurationLoaderTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/configuration/test/ConfigurationLoaderTest.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ConfigurationLoaderTest.cs 17 May 2003 13:49:41 -0000 1.3 --- ConfigurationLoaderTest.cs 21 Sep 2003 16:04:17 -0000 1.4 *************** *** 3,6 **** --- 3,7 ---- using System.IO; using System.Xml; + using Exortech.NetReflector; using NUnit.Framework; using tw.ccnet.core.util; *************** *** 112,115 **** --- 113,132 ---- { loader.PopulateProjectsFromXml(XmlUtil.CreateDocument("<loader/>")); + } + + [Test] + public void PopulateCustomProjectFromXml() + { + string xml = @"<customtestproject name=""foo"" />"; + IDictionary projects = loader.PopulateProjectsFromXml(ConfigurationFixture.GenerateConfig(xml)); + Assertion.Assert(projects["foo"] is CustomTestProject); + Assertion.AssertEquals("foo", ((CustomTestProject) projects["foo"]).Name); + } + + [ReflectorType("customtestproject")] + class CustomTestProject // properly should implement IProject + { + [ReflectorProperty("name")] + public string Name; } |
|
From: <exo...@us...> - 2003-09-21 15:37:56
|
Update of /cvsroot/ccnet/ccnet/project/core/sourcecontrol/test
In directory sc8-pr-cvs1:/tmp/cvs-serv20887/project/core/sourcecontrol/test
Modified Files:
PvcsHistoryParserTest.cs
Log Message:
jr's pvcs date fix
Index: PvcsHistoryParserTest.cs
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/core/sourcecontrol/test/PvcsHistoryParserTest.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PvcsHistoryParserTest.cs 23 Apr 2003 08:37:00 -0000 1.1
--- PvcsHistoryParserTest.cs 21 Sep 2003 15:37:52 -0000 1.2
***************
*** 926,930 ****
mod1.FileName = "foo.txt";
mod1.FolderName = "piddy dee";
! mod1.ModifiedTime = CreateDate("2001/09/13 13:34:52");
mod1.UserName = "dante";
mod1.Comment = "made a first hello world comment";
--- 926,930 ----
mod1.FileName = "foo.txt";
mod1.FolderName = "piddy dee";
! mod1.ModifiedTime = CreateDate("0001/01/01 00:00:00");
mod1.UserName = "dante";
mod1.Comment = "made a first hello world comment";
***************
*** 934,938 ****
mod2.FileName = "bar.txt";
mod2.FolderName = "raise the";
! mod2.ModifiedTime = CreateDate("2001/10/31 18:52:13");
mod2.UserName = "virgil";
mod2.Comment = "made a second hello world comment";
--- 934,938 ----
mod2.FileName = "bar.txt";
mod2.FolderName = "raise the";
! mod1.ModifiedTime = CreateDate("0001/01/01 00:00:00");
mod2.UserName = "virgil";
mod2.Comment = "made a second hello world comment";
***************
*** 953,957 ****
Assertion.AssertEquals("kerstinb", second.UserName);
Assertion.AssertEquals("Enabled system printouts.", second.Comment);
! Assertion.AssertEquals(CreateDate("1998/05/18 04:53:12"), second.ModifiedTime);
Assertion.AssertEquals(
@"D:\root\PVCS\vm\common\SampleDB\archives\chess\client\ChessRules.java-arc",
--- 953,958 ----
Assertion.AssertEquals("kerstinb", second.UserName);
Assertion.AssertEquals("Enabled system printouts.", second.Comment);
! Assertion.AssertEquals(CreateDate("2000/02/01 16:26:14"), second.ModifiedTime);
!
Assertion.AssertEquals(
@"D:\root\PVCS\vm\common\SampleDB\archives\chess\client\ChessRules.java-arc",
|
|
From: <exo...@us...> - 2003-09-21 15:37:56
|
Update of /cvsroot/ccnet/ccnet/project/core/sourcecontrol
In directory sc8-pr-cvs1:/tmp/cvs-serv20887/project/core/sourcecontrol
Modified Files:
PvcsHistoryParser.cs
Log Message:
jr's pvcs date fix
Index: PvcsHistoryParser.cs
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/core/sourcecontrol/PvcsHistoryParser.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PvcsHistoryParser.cs 22 Apr 2003 17:39:17 -0000 1.1
--- PvcsHistoryParser.cs 21 Sep 2003 15:37:52 -0000 1.2
***************
*** 66,70 ****
modification.FileName = line.Substring(18);
}
! else if (line.StartsWith("Last modified:")){
// if this is the newest revision...
if (firstModifiedTime) {
--- 66,70 ----
modification.FileName = line.Substring(18);
}
! else if (line.StartsWith("Checked in:")){
// if this is the newest revision...
if (firstModifiedTime) {
|
|
From: <exo...@us...> - 2003-09-21 15:28:22
|
Update of /cvsroot/ccnet/ccnet/project/core/publishers/test
In directory sc8-pr-cvs1:/tmp/cvs-serv19116/project/core/publishers/test
Added Files:
ProjectStartPublisherTest.cs
Log Message:
upgraded sitemesh
added project start publisher (in progress)
--- NEW FILE: ProjectStartPublisherTest.cs ---
using System;
using System.Runtime.Remoting.Channels.Tcp;
using Exortech.NetReflector;
using NUnit.Framework;
using NMock;
using NMock.Constraints;
using NMock.Remoting;
using tw.ccnet.remote;
using tw.ccnet.core.test;
using tw.ccnet.core.util;
namespace tw.ccnet.core.publishers.test
{
[TestFixture]
public class ProjectStartPublisherTest : CustomAssertion
{
[Test]
public void LoadMinXmlFromConfig()
{
string xml = @"
<startproject>
<project>myproject</project>
<url>tcp://localhost:2334/MockCruise.rem</url>
</startproject>";
object result = new XmlPopulator().Populate(XmlUtil.CreateDocumentElement(xml));
AssertNotNull(result);
AssertEquals(typeof(ProjectStartPublisher), result.GetType());
ProjectStartPublisher projectStart = result as ProjectStartPublisher;
AssertEquals("myproject", projectStart.Project);
AssertEquals("tcp://localhost:2334/MockCruise.rem", projectStart.Url);
}
[Test]
public void StartProject()
{
RemotingMock mock = new RemotingMock(typeof(ICruiseManager));
mock.Expect("Run", "myproject", new IsAnything());
using (MockServer server = new MockServer(mock.MarshalByRefInstance, new TcpChannel(4444), "Cruise2.rem"))
{
ExecutePublisher("myproject", "tcp://localhost:4444/Cruise2.rem");
}
mock.Verify();
}
[Test, ExpectedException(typeof(CruiseControlRemotingException))]
public void RemoteCruiseNotStarted()
{
ExecutePublisher("myproject", "tcp://localhost:4445/Cruise2.rem");
}
[Test, ExpectedException(typeof(CruiseControlRemotingException))]
public void InvalidRemoteUrl()
{
ExecutePublisher("myproject", "foo.bar");
}
[Test, ExpectedException(typeof(CruiseControlRemotingException))]
public void InvalidRemoteUrlUsingHttp()
{
ExecutePublisher("myproject", "tcp://localhost:4445/Cruise2.rem");
}
[Test, ExpectedException(typeof(CruiseControlException)), Ignore("in progress")]
public void RemoteProjectThrowsException()
{
RemotingMock mock = new RemotingMock(typeof(ICruiseManager));
mock.ExpectAndThrow("Run", new CruiseControlException("expected"), "myproject", new IsAnything());
using (MockServer server = new MockServer(mock.MarshalByRefInstance, new TcpChannel(4446), "Cruise3.rem"))
{
ExecutePublisher("myproject", "tcp://localhost:4446/Cruise3.rem");
}
mock.Verify();
}
// resource has wrong name
private void ExecutePublisher(string project, string url)
{
ProjectStartPublisher publisher = new ProjectStartPublisher();
ExecutePublisher(project, url, publisher);
}
private void ExecutePublisherThrowsException(string project, string url, Exception ex)
{
Mock managerMock = new DynamicMock(typeof(ICruiseManager));
// managerMock.ExpectAndThrow("Run",
ProjectStartPublisherExtension publisher = new ProjectStartPublisherExtension((ICruiseManager) managerMock.MockInstance);
ExecutePublisher(project, url, publisher);
}
private void ExecutePublisher(string project, string url, ProjectStartPublisher publisher)
{
publisher.Project = project;
publisher.Url = url;
publisher.Publish(null, IntegrationResultMother.CreateSuccessful());
publisher.WaitForCompletion();
}
class ProjectStartPublisherExtension : ProjectStartPublisher
{
ICruiseManager _manager;
public ProjectStartPublisherExtension(ICruiseManager manager)
{
_manager = manager;
}
protected override ICruiseManager GetRemoteCruiseManager()
{
return _manager;
}
}
}
}
|
|
From: <exo...@us...> - 2003-09-21 15:28:22
|
Update of /cvsroot/ccnet/ccnet/project/web
In directory sc8-pr-cvs1:/tmp/cvs-serv19116/project/web
Modified Files:
Web.config web.csproj web2002.csproj
Log Message:
upgraded sitemesh
added project start publisher (in progress)
Index: Web.config
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/web/Web.config,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Web.config 15 Sep 2003 21:20:00 -0000 1.7
--- Web.config 21 Sep 2003 15:28:17 -0000 1.8
***************
*** 102,115 ****
<sitemesh>
! <decorators defaultdir="/decorators">
! </decorators>
<page-parsers>
! <parser default="true" type="SiteMesh.Parser.HTMLPageParser, SiteMesh" />
! <parser content-type="text/html" type="SiteMesh.Parser.HTMLPageParser, SiteMesh" />
</page-parsers>
<decorator-mappers>
</decorator-mappers>
</sitemesh>
-
<CCNet>
<xslFiles>
--- 102,155 ----
<sitemesh>
! <decorators defaultdir="">
! <decorator name="simple" page="Decorator.aspx">
! <pattern>*</pattern>
! </decorator>
! </decorators>
<page-parsers>
! <parser default="true" type="SiteMesh.Parser.HtmlPageParser, SiteMesh" />
! <parser content-type="text/html" type="SiteMesh.Parser.HtmlPageParser, SiteMesh" />
</page-parsers>
<decorator-mappers>
+ <!--
+ <mapper type="SiteMesh.Mapper.PageDecoratorMapper, SiteMesh">
+ <param name="property.1" value="meta.decorator" />
+ <param name="property.2" value="decorator" />
+ </mapper>
+
+ <mapper type="SiteMesh.Mapper.FrameSetDecoratorMapper, SiteMesh">
+ </mapper>
+
+ <mapper type="SiteMesh.Mapper.AgentDecoratorMapper, SiteMesh">
+ <param name="match.MSIE" value="ie" />
+ <param name="match.Mozilla [" value="ns" />
+ <param name="match.Opera" value="opera" />
+ <param name="match.Lynx" value="lynx" />
+ </mapper>
+
+ <mapper type="SiteMesh.Mapper.PrintableDecoratorMapper, SiteMesh">
+ <param name="decorator" value="printable" />
+ <param name="parameter.name" value="printable" />
+ <param name="parameter.value" value="true" />
+ </mapper>
+
+ <mapper type="SiteMesh.Mapper.RobotDecoratorMapper, SiteMesh">
+ <param name="decorator" value="robot" />
+ </mapper>
+
+ <mapper type="SiteMesh.Mapper.ParameterDecoratorMapper, SiteMesh">
+ <param name="decorator.parameter" value="decorator" />
+ <param name="parameter.name" value="confirm" />
+ <param name="parameter.value" value="true" />
+ </mapper>
+
+ <mapper type="SiteMesh.Mapper.FileDecoratorMapper, SiteMesh">
+ </mapper>
+ -->
+ <mapper type="SiteMesh.Mapper.ConfigDecoratorMapper, SiteMesh">
+ </mapper>
+
</decorator-mappers>
</sitemesh>
<CCNet>
<xslFiles>
***************
*** 131,134 ****
</buildPlugins>
</CCNet>
-
</configuration>
--- 171,173 ----
Index: web.csproj
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/web/web.csproj,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** web.csproj 15 Sep 2003 21:20:00 -0000 1.8
--- web.csproj 21 Sep 2003 15:28:17 -0000 1.9
***************
*** 116,124 ****
/>
<Reference
- Name = "DecoratorControls"
- AssemblyName = "DecoratorControls"
- HintPath = "..\..\lib\DecoratorControls.dll"
- />
- <Reference
Name = "nunit.framework"
AssemblyName = "nunit.framework"
--- 116,119 ----
Index: web2002.csproj
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/web/web2002.csproj,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** web2002.csproj 8 Aug 2003 11:22:52 -0000 1.3
--- web2002.csproj 21 Sep 2003 15:28:17 -0000 1.4
***************
*** 113,121 ****
HintPath = "..\..\lib\SiteMesh.dll"
/>
- <Reference
- Name = "DecoratorControls"
- AssemblyName = "DecoratorControls"
- HintPath = "..\..\lib\DecoratorControls.dll"
- />
</References>
</Build>
--- 113,116 ----
***************
*** 188,191 ****
--- 183,196 ----
<File
RelPath = "LogStatistics.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PluginSpecification.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PluginsSectionHandler.cs"
SubType = "Code"
BuildAction = "Compile"
|
|
From: <exo...@us...> - 2003-09-21 15:28:22
|
Update of /cvsroot/ccnet/ccnet/project/core/publishers In directory sc8-pr-cvs1:/tmp/cvs-serv19116/project/core/publishers Added Files: ProjectStartPublisher.cs Log Message: upgraded sitemesh added project start publisher (in progress) --- NEW FILE: ProjectStartPublisher.cs --- using System; using System.Net; using System.Net.Sockets; using System.Runtime.Remoting; using System.Runtime.Remoting.Messaging; using System.Threading; using Exortech.NetReflector; using tw.ccnet.remote; using tw.ccnet.core.schedule; namespace tw.ccnet.core.publishers { [ReflectorType("startproject")] public class ProjectStartPublisher : PublisherBase { private delegate void StartProjectDelegate(IntegrationResult result); [ReflectorProperty("project")] public string Project; [ReflectorProperty("url")] public string Url; private IAsyncResult _result; private Exception _ex; public override void Publish(object source, IntegrationResult result) { AsyncCallback cb = new AsyncCallback(FinishedCallback); StartProjectDelegate startProjectDelegate = new StartProjectDelegate(StartProject); _result = startProjectDelegate.BeginInvoke(result, cb, new object()); } private void StartProject(IntegrationResult result) { try { ICruiseManager manager = GetRemoteCruiseManager(); manager.Run(Project, new Schedule(0, 1)); } catch (Exception ex) { // log exception Console.WriteLine(ex.ToString()); _ex = ex; } } protected virtual ICruiseManager GetRemoteCruiseManager() { return (ICruiseManager) RemotingServices.Connect(typeof(ICruiseManager), Url); } private void FinishedCallback(IAsyncResult ar) { Console.WriteLine("3" + _result.IsCompleted); } public void WaitForCompletion() { _result.AsyncWaitHandle.WaitOne(); if (_ex == null) return; if (_ex is SocketException || _ex is WebException || _ex is RemotingException) { throw new CruiseControlRemotingException("Remote server may not have be started or the connection url may not be correct", Url, _ex); } else { throw _ex; } } } } |
|
From: <exo...@us...> - 2003-09-21 15:28:22
|
Update of /cvsroot/ccnet/ccnet/project/core/test In directory sc8-pr-cvs1:/tmp/cvs-serv19116/project/core/test Modified Files: ProjectTest.cs Log Message: upgraded sitemesh added project start publisher (in progress) Index: ProjectTest.cs =================================================================== RCS file: /cvsroot/ccnet/ccnet/project/core/test/ProjectTest.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ProjectTest.cs 2 Aug 2003 21:32:54 -0000 1.11 --- ProjectTest.cs 21 Sep 2003 15:28:17 -0000 1.12 *************** *** 246,250 **** Assert(publisher.Published); stateMock.Verify(); ! AssertEquals(3, _listener.Traces.Count); } --- 246,250 ---- Assert(publisher.Published); stateMock.Verify(); ! AssertEquals(2, _listener.Traces.Count); } *************** *** 271,275 **** Assert(publisher.Published); mock.Verify(); ! AssertEquals(3, _listener.Traces.Count); } --- 271,275 ---- Assert(publisher.Published); mock.Verify(); ! AssertEquals(2, _listener.Traces.Count); } |
|
From: <exo...@us...> - 2003-09-21 15:28:21
|
Update of /cvsroot/ccnet/ccnet/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19116/lib Modified Files: SiteMesh.dll Removed Files: DecoratorControls.dll Log Message: upgraded sitemesh added project start publisher (in progress) Index: SiteMesh.dll =================================================================== RCS file: /cvsroot/ccnet/ccnet/lib/SiteMesh.dll,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvseSoleK and /tmp/cvsSgwa4j differ --- DecoratorControls.dll DELETED --- |
|
From: <exo...@us...> - 2003-09-21 15:28:21
|
Update of /cvsroot/ccnet/ccnet/project/core/schedule
In directory sc8-pr-cvs1:/tmp/cvs-serv19116/project/core/schedule
Modified Files:
Schedule.cs
Log Message:
upgraded sitemesh
added project start publisher (in progress)
Index: Schedule.cs
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/core/schedule/Schedule.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Schedule.cs 15 May 2003 09:59:17 -0000 1.2
--- Schedule.cs 21 Sep 2003 15:28:17 -0000 1.3
***************
*** 5,8 ****
--- 5,9 ----
namespace tw.ccnet.core.schedule
{
+ [Serializable]
[ReflectorType("schedule")]
public class Schedule : ISchedule
|
|
From: <exo...@us...> - 2003-09-21 15:28:21
|
Update of /cvsroot/ccnet/ccnet/project/core
In directory sc8-pr-cvs1:/tmp/cvs-serv19116/project/core
Modified Files:
CruiseControlException.cs Project.cs core2002.csproj
Added Files:
CruiseControlRemotingException.cs
Log Message:
upgraded sitemesh
added project start publisher (in progress)
--- NEW FILE: CruiseControlRemotingException.cs ---
using System;
using System.Runtime.Serialization;
namespace tw.ccnet.core
{
public class CruiseControlRemotingException : CruiseControlException
{
public CruiseControlRemotingException(string message, string url, Exception e) : base(CreateMessage(message, url), e) {}
public CruiseControlRemotingException(SerializationInfo info, StreamingContext context) : base(info, context) { }
private static string CreateMessage(string message, string url)
{
return String.Format("Cannot connect to CruiseControl server {0}. {1}", url, message);
}
}
}
Index: CruiseControlException.cs
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/core/CruiseControlException.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CruiseControlException.cs 28 Apr 2003 22:41:36 -0000 1.2
--- CruiseControlException.cs 21 Sep 2003 15:28:16 -0000 1.3
***************
*** 11,14 ****
--- 11,15 ----
public CruiseControlException(string s) : base(s) {}
public CruiseControlException(string s, Exception e) : base(s, e) {}
+ public CruiseControlException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
Index: Project.cs
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/core/Project.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Project.cs 31 Jul 2003 20:40:33 -0000 1.9
--- Project.cs 21 Sep 2003 15:28:16 -0000 1.10
***************
*** 182,191 ****
}
currentActivity = ProjectActivity.Sleeping;
- Log(END_OF_INTEGRATION_LOG_OUTPUT);
}
internal void PreBuild()
{
- Log("Starting new integration...");
CurrentIntegration = new IntegrationResult();
CurrentIntegration.ProjectName = Name;
--- 182,189 ----
***************
*** 193,196 ****
--- 191,195 ----
CurrentIntegration.Label = Labeller.Generate(LastIntegration);
CurrentIntegration.Start();
+ Log(String.Format("Starting new integration...{0}", CurrentIntegration.StartTime));
}
***************
*** 227,230 ****
--- 226,230 ----
RaiseIntegrationEvent(CurrentIntegration);
LastIntegration = CurrentIntegration;
+ Log(String.Format("Integration Complete... {0}", CurrentIntegration.EndTime));
}
Index: core2002.csproj
===================================================================
RCS file: /cvsroot/ccnet/ccnet/project/core/core2002.csproj,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** core2002.csproj 8 Aug 2003 11:22:51 -0000 1.3
--- core2002.csproj 21 Sep 2003 15:28:16 -0000 1.4
***************
*** 69,82 ****
/>
<Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
- />
- <Reference
- Name = "System.Web"
- AssemblyName = "System.Web"
- HintPath = "..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Web.dll"
- />
- <Reference
Name = "nunit.framework"
AssemblyName = "nunit.framework"
--- 69,72 ----
***************
*** 99,105 ****
/>
<Reference
! Name = "System.Windows.Forms"
! AssemblyName = "System.Windows.Forms"
! HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll"
/>
</References>
--- 89,105 ----
/>
<Reference
! Name = "System.Runtime.Remoting"
! AssemblyName = "System.Runtime.Remoting"
! HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Runtime.Remoting.dll"
! />
! <Reference
! Name = "System.Web"
! AssemblyName = "System.Web"
! HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Web.dll"
! />
! <Reference
! Name = "System.Data"
! AssemblyName = "System.Data"
! HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
/>
</References>
***************
*** 118,121 ****
--- 118,126 ----
/>
<File
+ RelPath = "CruiseControlRemotingException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "CruiseManager.cs"
SubType = "Code"
***************
*** 287,290 ****
--- 292,300 ----
/>
<File
+ RelPath = "publishers\ProjectStartPublisher.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "publishers\PublisherBase.cs"
SubType = "Code"
***************
*** 333,336 ****
--- 343,351 ----
<File
RelPath = "publishers\test\NetSendPublisherTest.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "publishers\test\ProjectStartPublisherTest.cs"
SubType = "Code"
BuildAction = "Compile"
|