public void RunningJobsAreOrphanedWhenSchedulerRegistrationRefreshFails()
        {
            Mocks.ReplayAll();

            CreateRunningJob("running-job");

            SetBrokenConnectionMocking(JobStore, true);
            JobStore.SchedulerExpirationTimeInSeconds = 1;

            // Allow some time for the expiration time to expire.
            Thread.Sleep(3000);

            // Now get a new scheduler.
            // Its next job up for processing should be the one that we created earlier
            // but now it will be Orphaned.
            PersistentJobStore newJobStore = CreatePersistentJobStore();

            newJobStore.SchedulerExpirationTimeInSeconds = 1;
            newJobStore.PollIntervalInSeconds            = 1;

            IJobWatcher jobWatcher  = newJobStore.CreateJobWatcher(Guid.NewGuid());
            JobDetails  orphanedJob = jobWatcher.GetNextJobToProcess();

            Assert.AreEqual("running-job", orphanedJob.JobSpec.Name);
            Assert.AreEqual(JobState.Orphaned, orphanedJob.JobState);
            Assert.AreEqual(false, orphanedJob.LastJobExecutionDetails.Succeeded);
            Assert.IsNotNull(orphanedJob.LastJobExecutionDetails.EndTimeUtc);
        }
        protected override BaseJobStore CreateJobStore()
        {
            PersistentJobStore jobStore = CreatePersistentJobStore();

            Assert.AreEqual(15, jobStore.PollIntervalInSeconds);
            Assert.AreEqual(120, jobStore.SchedulerExpirationTimeInSeconds);

            jobStore.PollIntervalInSeconds            = 1;
            jobStore.SchedulerExpirationTimeInSeconds = 5;
            return(jobStore);
        }
示例#3
0
 protected override void SetBrokenConnectionMocking(PersistentJobStore jobStore, bool brokenConnections)
 {
     InstrumentedSqlServerJobStoreDao dao = (InstrumentedSqlServerJobStoreDao) jobStore.JobStoreDao;
     dao.BrokenConnections = brokenConnections;
 }
 /// <summary>
 /// Sets whether subsequent Db connection requests for the specified job store
 /// should be caused to fail.
 /// </summary>
 protected abstract void SetBrokenConnectionMocking(PersistentJobStore jobStore, bool brokenConnections);
		/// <summary>
		/// Sets whether subsequent Db connection requests for the specified job store
		/// should be caused to fail.
		/// </summary>
		protected abstract void SetBrokenConnectionMocking(PersistentJobStore jobStore, bool brokenConnections);
示例#6
0
        protected override void SetBrokenConnectionMocking(PersistentJobStore jobStore, bool brokenConnections)
        {
            InstrumentedSqlServerJobStoreDao dao = (InstrumentedSqlServerJobStoreDao)jobStore.JobStoreDao;

            dao.BrokenConnections = brokenConnections;
        }