Example #1
0
        /// <summary>
        /// Performs an integration.
        /// </summary>
        /// <param name="request">The request.</param>
        public virtual IntegrationStatus Integrate(IntegrationRequest request)
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var status = IntegrationStatus.Unknown;

            logger.Debug("Initialising integration for '{0}'", this.Name);
            if (this.InitialiseForIntegration())
            {
                logger.Debug("Running tasks for '{0}'", this.Name);
                var context = this.TaskExecutionFactory.StartNew(this, request);
                try
                {
                    this.RunTasks(context, this.Tasks);
                }
                finally
                {
                    context.Complete();
                    status = context.CurrentStatus;
                }
            }

            logger.Debug("Cleaning up after integration for '{0}'", this.Name);
            this.CleanUpAfterIntegration();

            stopwatch.Stop();
            logger.Debug("Total duration for integration for '{0}' was {1:#,##0.000}s",
                         this.Name,
                         (double)stopwatch.ElapsedMilliseconds / 1000);
            return(status);
        }
 /// <summary>
 /// Prevents a default instance of the <see cref="TaskExecutionContext"/> class from being created.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 public TaskExecutionContext(TaskExecutionParameters parameters)
 {
     this.writer = parameters.XmlWriter;
     this.fileSystem = parameters.FileSystem;
     this.clock = parameters.Clock;
     this.request = parameters.IntegrationRequest;
     this.project = parameters.Project;
     this.buildName = parameters.BuildName;
 }
Example #3
0
 /// <summary>
 /// Prevents a default instance of the <see cref="TaskExecutionContext"/> class from being created.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 public TaskExecutionContext(TaskExecutionParameters parameters)
 {
     this.writer     = parameters.XmlWriter;
     this.fileSystem = parameters.FileSystem;
     this.clock      = parameters.Clock;
     this.request    = parameters.IntegrationRequest;
     this.project    = parameters.Project;
     this.buildName  = parameters.BuildName;
 }
Example #4
0
 /// <summary>
 /// Resets this trigger after an integration.
 /// </summary>
 public void Reset()
 {
     logger.Trace("Resetting trigger '{0}'", this.NameOrType);
     this.current = null;
     this.OnReset();
 }
Example #5
0
 /// <summary>
 /// Checks if this trigger has been tripped.
 /// </summary>
 /// <returns>
 /// An <see cref="IntegrationRequest"/> if tripped; <c>null</c> otherwise.
 /// </returns>
 public IntegrationRequest Check()
 {
     logger.Trace("Checking trigger '{0}'", this.NameOrType);
     return this.current ?? (this.current = this.OnCheck());
 }
Example #6
0
 /// <summary>
 /// Resets this trigger after an integration.
 /// </summary>
 public void Reset()
 {
     logger.Trace("Resetting trigger '{0}'", this.NameOrType);
     this.current = null;
     this.OnReset();
 }
Example #7
0
 /// <summary>
 /// Checks if this trigger has been tripped.
 /// </summary>
 /// <returns>
 /// An <see cref="IntegrationRequest"/> if tripped; <c>null</c> otherwise.
 /// </returns>
 public IntegrationRequest Check()
 {
     logger.Trace("Checking trigger '{0}'", this.NameOrType);
     return(this.current ?? (this.current = this.OnCheck()));
 }