Beispiel #1
0
        public void CommitExportJob(ExportJobLite job, string scheduleValues, string scheduleFequency, bool repeating, bool disabled)
        {
            try
            {
                var j = SchedulerManager.GetJobById(job.Id);
                if (j == null)
                {
                    var ej = job.ToInFuseExportJob(null);
                    SchedulerManager.AddJob(JobTypeEnum.InFuseExportJob, JsonConvert.SerializeObject(ej), scheduleValues, scheduleFequency, repeating, disabled);
                    //SchedulerManager.AddJob(JobTypeEnum.ExportJob, JsonConvert.SerializeObject(job.ToExportJob(null)), scheduleValues, scheduleFequency, repeating, disabled);
                }
                else
                {
                    var ej = job.ToInFuseExportJob(job.Id);
                    SchedulerManager.AddJob(JobTypeEnum.InFuseExportJob, JsonConvert.SerializeObject(ej), scheduleValues, scheduleFequency, repeating, disabled);
                }
            }
            catch (Exception e)
            {
                Logger.Info($"Errors saving Export Job {e.Message} - {e.StackTrace}");
                if (e.InnerException != null)
                {
                    Logger.Info($"Errors saving Export Job INNER exception {e.InnerException.Message} - {e.InnerException.StackTrace}");
                }

                throw;
            }
        }
        public void TestAddJobNoEventSubscription()
        {
            var jobMock = new Mock <IJob>();

            var schedulerManager = new SchedulerManager(null);

            Assert.False(schedulerManager.AddJob(jobMock.Object));
        }
        public void TestAddJob()
        {
            var jobMock = new Mock <IJob>();

            var schedulerManager = new SchedulerManager(null);

            schedulerManager.JobAdded += (sender, args) =>
            {
                Assert.Equal(schedulerManager, sender);
                Assert.Equal(jobMock.Object, args.Job);
                args.Success = true;
            };

            Assert.True(schedulerManager.AddJob(jobMock.Object));
        }