Exemplo n.º 1
0
        public void Add_HistoryDisabled_HistoryRemainsEmpty()
        {
            _settings.ApplicationSettings.JobHistory.Enabled = false;

            _jobHistoryManager.Add(_job);

            Assert.IsEmpty(_jobHistoryManager.History);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Process a single job
        /// </summary>
        /// <param name="jobInfo">The jobinfo to process</param>
        /// <returns>True if the job was processed. If the user decided to manage the print jobs instead, this returns false</returns>
        private void ProcessJob(JobInfo jobInfo)
        {
            _logger.Trace("Creating job workflow");

            var job = _jobBuilder.BuildJobFromJobInfo(jobInfo, _settingsProvider.Settings);

            var mode     = DetermineMode(job);
            var workflow = _workflowFactory.CreateWorkflow(mode);

            _logger.Trace("Running workflow");
            var workflowResult = workflow.RunWorkflow(job);

            if (workflowResult != WorkflowResult.Finished)
            {
                if (workflowResult == WorkflowResult.AbortedByUser)
                {
                    _logger.Info("The job '{0}' was aborted by the user.",
                                 job.JobInfo.Metadata.Title);
                }
                else
                {
                    _logger.Error("The job '{0}' terminated at step {1} and did not end successfully.",
                                  job.JobInfo.Metadata.Title, workflowResult);
                }
            }
            else
            {
                _jobHistoryManager.Add(job);
            }
        }