public async Task TestRescheduleJob_SchedulerListenersCalledOnReschedule() { const string TriggerName = "triggerName"; const string TriggerGroup = "triggerGroup"; const string JobName = "jobName"; const string JobGroup = "jobGroup"; NameValueCollection properties = new NameValueCollection(); properties["quartz.serializer.type"] = TestConstants.DefaultSerializerType; ISchedulerFactory sf = new StdSchedulerFactory(properties); IScheduler scheduler = await sf.GetScheduler(); DateTime startTimeUtc = DateTime.UtcNow.AddSeconds(2); JobDetailImpl jobDetail = new JobDetailImpl(JobName, JobGroup, typeof(NoOpJob)); SimpleTriggerImpl jobTrigger = new SimpleTriggerImpl(TriggerName, TriggerGroup, JobName, JobGroup, startTimeUtc, null, 1, TimeSpan.FromMilliseconds(1000)); ISchedulerListener listener = A.Fake <ISchedulerListener>(); await scheduler.ScheduleJob(jobDetail, jobTrigger); // add listener after scheduled scheduler.ListenerManager.AddSchedulerListener(listener); // act await scheduler.RescheduleJob(new TriggerKey(TriggerName, TriggerGroup), jobTrigger); // assert // expect unschedule and schedule A.CallTo(() => listener.JobUnscheduled(new TriggerKey(TriggerName, TriggerGroup), A <CancellationToken> ._)).MustHaveHappened(); A.CallTo(() => listener.JobScheduled(jobTrigger, A <CancellationToken> ._)).MustHaveHappened(); }
public void TestRescheduleJob_SchedulerListenersCalledOnReschedule() { const string TriggerName = "triggerName"; const string TriggerGroup = "triggerGroup"; const string JobName = "jobName"; const string JobGroup = "jobGroup"; ISchedulerFactory sf = new StdSchedulerFactory(); IScheduler scheduler = sf.GetScheduler(); DateTime startTimeUtc = DateTime.UtcNow.AddSeconds(2); JobDetail jobDetail = new JobDetail(JobName, JobGroup, typeof(NoOpJob)); SimpleTrigger jobTrigger = new SimpleTrigger(TriggerName, TriggerGroup, JobName, JobGroup, startTimeUtc, null, 1, TimeSpan.FromMilliseconds(1000)); MockRepository mockery = new MockRepository(); ISchedulerListener listener = (ISchedulerListener)mockery.CreateMock(typeof(ISchedulerListener)); scheduler.ScheduleJob(jobDetail, jobTrigger); // add listener after scheduled scheduler.AddSchedulerListener(listener); // expect unschedule and schedule listener.JobUnscheduled(TriggerName, TriggerGroup); listener.JobScheduled(jobTrigger); mockery.ReplayAll(); // act scheduler.RescheduleJob(TriggerName, TriggerGroup, jobTrigger); // verify mockery.VerifyAll(); }
public void AddSchedulerListener(ISchedulerListener schedulerListener) { lock (schedulerListeners) { schedulerListeners.Add(schedulerListener); } }
public void TestRescheduleJob_SchedulerListenersCalledOnReschedule() { const string TriggerName = "triggerName"; const string TriggerGroup = "triggerGroup"; const string JobName = "jobName"; const string JobGroup = "jobGroup"; ISchedulerFactory sf = new StdSchedulerFactory(); IScheduler scheduler = sf.GetScheduler(); DateTime startTimeUtc = DateTime.UtcNow.AddSeconds(2); JobDetailImpl jobDetail = new JobDetailImpl(JobName, JobGroup, typeof(NoOpJob)); SimpleTriggerImpl jobTrigger = new SimpleTriggerImpl(TriggerName, TriggerGroup, JobName, JobGroup, startTimeUtc, null, 1, TimeSpan.FromMilliseconds(1000)); ISchedulerListener listener = MockRepository.GenerateMock <ISchedulerListener>(); scheduler.ScheduleJob(jobDetail, jobTrigger); // add listener after scheduled scheduler.ListenerManager.AddSchedulerListener(listener); // act scheduler.RescheduleJob(new TriggerKey(TriggerName, TriggerGroup), jobTrigger); // assert // expect unschedule and schedule listener.AssertWasCalled(l => l.JobUnscheduled(new TriggerKey(TriggerName, TriggerGroup))); listener.AssertWasCalled(l => l.JobScheduled(jobTrigger)); }
public bool RemoveSchedulerListener(ISchedulerListener schedulerListener) { lock (schedulerListeners) { return(schedulerListeners.Remove(schedulerListener)); } }
public QuartzHostedService(ILogger <QuartzHostedService> logger, ISchedulerFactory schedulerFactory, IJobFactory jobFactory, IEnumerable <JobSchedule> jobSchedules, IJobListener jobListener, ISchedulerListener schedulerListener) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _schedulerFactory = schedulerFactory ?? throw new ArgumentNullException(nameof(schedulerFactory)); _jobFactory = jobFactory ?? throw new ArgumentNullException(nameof(jobFactory)); _jobListener = jobListener ?? throw new ArgumentNullException(nameof(jobListener)); _schedulerListener = schedulerListener ?? throw new ArgumentNullException(nameof(schedulerListener)); _injectJobSchedules = jobSchedules ?? throw new ArgumentNullException(nameof(jobSchedules)); }
public bool RemoveListener(ISchedulerListener listener) { if (listeners.Contains(listener)) { listeners.Remove(listener); return(true); } else { return(false); } }
public bool RemoveListener(ISchedulerListener listener) { if (listeners.Contains(listener)) { listeners.Remove(listener); return true; } else { return false; } }
public bool RemoveSchedulerListener(ISchedulerListener schedulerListener) { lock (schedulerListeners) { return schedulerListeners.Remove(schedulerListener); } }
public void AddSchedulerListener(ISchedulerListener schedulerListener) { scheduler.AddSchedulerListener(schedulerListener); }
public bool RemoveSchedulerListener(ISchedulerListener schedulerListener) { return scheduler.RemoveSchedulerListener(schedulerListener); }
public SyncAgentScheduler(ISchedulerFactory schedulerFactory, ISchedulerListener schedulerListener, IUnityContainer container) { _schedulerFactory = schedulerFactory; _schedulerListener = schedulerListener; _container = container; }
/// <summary> /// Calls the equivalent method on the 'proxied' <see cref="QuartzScheduler" />. /// </summary> public virtual bool RemoveSchedulerListener(ISchedulerListener schedulerListener) { throw new SchedulerException("Operation not supported for remote schedulers.", SchedulerException.ErrorUnsupportedFunctionInThisConfiguration); }
public bool RemoveListener(ISchedulerListener listener) { return(listeners.Remove(listener)); }
public JsonSchedulerListener(ISchedulerListener listener) { name = listener.GetType().FullName; }
/// <summary> /// Register the given <see cref="ISchedulerListener" /> with the /// <see cref="IScheduler" />'s list of internal listeners. /// </summary> /// <param name="schedulerListener"></param> public void AddInternalSchedulerListener(ISchedulerListener schedulerListener) { lock (internalSchedulerListeners) { internalSchedulerListeners.Add(schedulerListener); } }
/// <summary> /// Calls the equivalent method on the 'proxied' <see cref="QuartzScheduler" />. /// </summary> public virtual void AddSchedulerListener(ISchedulerListener schedulerListener) { sched.AddSchedulerListener(schedulerListener); }
public void AddListener(ISchedulerListener listener) { listeners.Add(listener); }
public bool RemoveListener(ISchedulerListener listener) { return listeners.Remove(listener); }
/// <summary> /// Calls the equivalent method on the 'proxied' <see cref="QuartzScheduler" />. /// </summary> public virtual bool RemoveSchedulerListener(ISchedulerListener schedulerListener) { return(sched.RemoveSchedulerListener(schedulerListener)); }
/// <summary> /// Remove the given <see cref="ISchedulerListener" /> from the /// <see cref="IScheduler" />. /// </summary> /// <returns> /// true if the identifed listener was found in the list, and removed. /// </returns> public virtual bool RemoveSchedulerListener(ISchedulerListener schedulerListener) { lock (schedulerListeners) { return CollectionUtil.Remove(schedulerListeners, schedulerListener); } }
/// <summary> /// Remove the given <see cref="ISchedulerListener" /> from the /// <see cref="IScheduler" />'s list of internal listeners. /// </summary> /// <param name="schedulerListener"></param> /// <returns>true if the identified listener was found in the list, andremoved.</returns> public bool RemoveInternalSchedulerListener(ISchedulerListener schedulerListener) { lock (internalSchedulerListeners) { return internalSchedulerListeners.Remove(schedulerListener); } }
/// <summary> /// Calls the equivalent method on the 'proxied' <see cref="QuartzScheduler" />. /// </summary> public virtual bool RemoveSchedulerListener(ISchedulerListener schedulerListener) { return sched.RemoveSchedulerListener(schedulerListener); }