public async Task TestScheduling_MinimalConfiguration() { Stream s = ReadJobXmlFromEmbeddedResource("MinimalConfiguration_20.xml"); await processor.ProcessStream(s, null); Assert.IsFalse(processor.OverWriteExistingData); await processor.ScheduleJobs(mockScheduler); }
public void TestScheduling_RichConfiguration() { Stream s = ReadJobXmlFromEmbeddedResource("RichConfiguration_20.xml"); processor.ProcessStream(s, null); Assert.IsFalse(processor.OverWriteExistingData); Assert.IsTrue(processor.IgnoreDuplicates); processor.ScheduleJobs(mockScheduler); mockScheduler.AssertWasCalled(x => x.ScheduleJob(Arg <ITrigger> .Is.NotNull), options => options.Repeat.Times(5)); }
/// <summary> /// 启动 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void btnStart_Click(object sender, EventArgs e) { try { await MQTTContext.getInstance(). Initialize(txtServer.Text.Trim(), int.Parse(txtPort.Text.Trim()), notification); if (_scheduler == null) { _scheduler = await StdSchedulerFactory.GetDefaultScheduler(); //任务、触发器执行配置 XMLSchedulingDataProcessor processor = new XMLSchedulingDataProcessor(new SimpleTypeLoadHelper()); Stream s = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + @"\Quartz.config").BaseStream; await processor.ProcessStream(s, null); await processor.ScheduleJobs(_scheduler); await _scheduler.Start(); } btnStart.Enabled = false; btnStop.Enabled = true; } catch (Exception ex) { showMessage(ex.Message); } }
// 手動加載配置文件 public void Test03() { XMLSchedulingDataProcessor processor = new XMLSchedulingDataProcessor(new SimpleTypeLoadHelper()); ISchedulerFactory sf = new StdSchedulerFactory(); IScheduler scheduler = sf.GetScheduler(); Stream s = new StreamReader("~/quartz.xml").BaseStream; processor.ProcessStream(s, null); processor.ScheduleJobs(scheduler); scheduler.Start(); scheduler.Shutdown(); }
// 手動加載配置文件 public void Test03() { XMLSchedulingDataProcessor processor = new XMLSchedulingDataProcessor(new SimpleTypeLoadHelper()); ISchedulerFactory sf = new StdSchedulerFactory(); IScheduler scheduler = sf.GetScheduler(); Stream s = new StreamReader("~/quartz.xml").BaseStream; processor.ProcessStream(s, null); processor.ScheduleJobs(scheduler); scheduler.Start(); scheduler.Shutdown(); }