public void TestMonThroughFri() { Collection.ISet <DayOfWeek> daysOfWeek = DailyTimeIntervalScheduleBuilder.MondayThroughFriday; DateTimeOffset startTime = DateBuilder.DateOf(0, 0, 0, 1, 1, 2011); // SAT(7) TimeOfDay startTimeOfDay = new TimeOfDay(8, 0, 0); TimeOfDay endTimeOfDay = new TimeOfDay(17, 0, 0); DailyTimeIntervalTriggerImpl trigger = new DailyTimeIntervalTriggerImpl(); trigger.StartTimeUtc = startTime; trigger.StartTimeOfDayUtc = startTimeOfDay; trigger.EndTimeOfDayUtc = endTimeOfDay; trigger.DaysOfWeek = daysOfWeek; trigger.RepeatIntervalUnit = IntervalUnit.Minute; trigger.RepeatInterval = 60; IList <DateTimeOffset> fireTimes = TriggerUtils.ComputeFireTimes(trigger, null, 48); Assert.AreEqual(48, fireTimes.Count); Assert.AreEqual(DateBuilder.DateOf(8, 0, 0, 3, 1, 2011), fireTimes[0]); Assert.AreEqual(DayOfWeek.Monday, fireTimes[0].DayOfWeek); Assert.AreEqual(DateBuilder.DateOf(8, 0, 0, 4, 1, 2011), fireTimes[10]); Assert.AreEqual(DayOfWeek.Tuesday, fireTimes[10].DayOfWeek); Assert.AreEqual(DateBuilder.DateOf(15, 0, 0, 7, 1, 2011), fireTimes[47]); Assert.AreEqual(DayOfWeek.Friday, fireTimes[47].DayOfWeek); }
public void TestSatAndSun() { Collection.ISet <DayOfWeek> daysOfWeek = DailyTimeIntervalScheduleBuilder.SaturdayAndSunday; DateTimeOffset startTime = DateBuilder.DateOf(0, 0, 0, 1, 1, 2011); // SAT(7) TimeOfDay startTimeOfDay = new TimeOfDay(8, 0, 0); TimeOfDay endTimeOfDay = new TimeOfDay(17, 0, 0); var trigger = new DailyTimeIntervalTriggerImpl { StartTimeUtc = startTime.ToUniversalTime(), StartTimeOfDay = startTimeOfDay, EndTimeOfDay = endTimeOfDay, DaysOfWeek = daysOfWeek, RepeatIntervalUnit = IntervalUnit.Minute, RepeatInterval = 60 }; IList <DateTimeOffset> fireTimes = TriggerUtils.ComputeFireTimes(trigger, null, 48); Assert.AreEqual(48, fireTimes.Count); Assert.AreEqual(DateBuilder.DateOf(8, 0, 0, 1, 1, 2011), fireTimes[0]); Assert.AreEqual(DayOfWeek.Saturday, fireTimes[0].DayOfWeek); Assert.AreEqual(DateBuilder.DateOf(8, 0, 0, 2, 1, 2011), fireTimes[10]); Assert.AreEqual(DayOfWeek.Sunday, fireTimes[10].DayOfWeek); Assert.AreEqual(DateBuilder.DateOf(15, 0, 0, 15, 1, 2011), fireTimes[47]); Assert.AreEqual(DayOfWeek.Saturday, fireTimes[47].DayOfWeek); }
private static void CleanUp(IScheduler inScheduler) { // unschedule jobs IList <string> groups = inScheduler.GetTriggerGroupNames(); foreach (string group in groups) { Collection.ISet <TriggerKey> keys = inScheduler.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupEquals(group)); foreach (TriggerKey key in keys) { inScheduler.UnscheduleJob(key); } } // delete jobs groups = inScheduler.GetJobGroupNames(); foreach (string group in groups) { Collection.ISet <JobKey> jobNames = inScheduler.GetJobKeys(GroupMatcher <JobKey> .GroupEquals(group)); foreach (JobKey jobKey in jobNames) { inScheduler.DeleteJob(jobKey); } } inScheduler.DeleteCalendar("annualCalendar"); inScheduler.DeleteCalendar("baseCalendar"); inScheduler.DeleteCalendar("cronCalendar"); inScheduler.DeleteCalendar("dailyCalendar"); inScheduler.DeleteCalendar("holidayCalendar"); inScheduler.DeleteCalendar("monthlyCalendar"); inScheduler.DeleteCalendar("weeklyCalendar"); }
private static void AssertParsesForField(string expression, int constant) { try { SimpleCronExpression cronExpression = new SimpleCronExpression(expression); Collection.ISet <int> set = cronExpression.GetSetPublic(constant); if (set.Count == 0) { Assert.Fail("Empty field [" + constant + "] returned for " + expression); } } catch (FormatException pe) { Assert.Fail("Exception thrown during parsing: " + pe); } }
private static Collection.ISet <int> AssertParsesForField(string expression, int constant) { try { TestCronExpression cronExpression = new TestCronExpression(expression); Collection.ISet <int> set = cronExpression.GetSetPublic(constant); if (set.Count == 0) { Assert.Fail("Empty field [" + constant + "] returned for " + expression); } return(set); } catch (FormatException pe) { Assert.Fail("Exception thrown during parsing: " + pe); } return(null); // not reachable }
public void TestAllDaysOfTheWeek() { Collection.ISet <DayOfWeek> daysOfWeek = DailyTimeIntervalScheduleBuilder.AllDaysOfTheWeek; DateTimeOffset startTime = DateBuilder.DateOf(0, 0, 0, 1, 1, 2011); // SAT TimeOfDay startTimeOfDay = new TimeOfDay(8, 0, 0); TimeOfDay endTimeOfDay = new TimeOfDay(17, 0, 0); DailyTimeIntervalTriggerImpl trigger = new DailyTimeIntervalTriggerImpl(); trigger.StartTimeUtc = startTime; trigger.StartTimeOfDayUtc = startTimeOfDay; trigger.EndTimeOfDayUtc = endTimeOfDay; trigger.DaysOfWeek = daysOfWeek; trigger.RepeatIntervalUnit = IntervalUnit.Minute; trigger.RepeatInterval = 60; IList <DateTimeOffset> fireTimes = TriggerUtils.ComputeFireTimes(trigger, null, 48); Assert.AreEqual(48, fireTimes.Count); Assert.AreEqual(DateBuilder.DateOf(8, 0, 0, 1, 1, 2011), fireTimes[0]); Assert.AreEqual(DateBuilder.DateOf(17, 0, 0, 1, 1, 2011), fireTimes[9]); // The 10th hours is the end of day. Assert.AreEqual(DateBuilder.DateOf(15, 0, 0, 5, 1, 2011), fireTimes[47]); }
public void TestBasicStorageFunctions() { NameValueCollection config = new NameValueCollection(); config["quartz.threadPool.threadCount"] = "2"; config["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz"; IScheduler sched = new StdSchedulerFactory(config).GetScheduler(); // test basic storage functions of scheduler... IJobDetail job = JobBuilder.NewJob() .OfType <TestJob>() .WithIdentity("j1") .StoreDurably() .Build(); Assert.IsFalse(sched.CheckExists(new JobKey("j1")), "Unexpected existence of job named 'j1'."); sched.AddJob(job, false); Assert.IsTrue(sched.CheckExists(new JobKey("j1")), "Expected existence of job named 'j1' but checkExists return false."); job = sched.GetJobDetail(new JobKey("j1")); Assert.IsNotNull(job, "Stored job not found!"); sched.DeleteJob(new JobKey("j1")); ITrigger trigger = TriggerBuilder.Create() .WithIdentity("t1") .ForJob(job) .StartNow() .WithSchedule(SimpleScheduleBuilder.Create() .RepeatForever() .WithIntervalInSeconds(5)) .Build(); Assert.IsFalse(sched.CheckExists(new TriggerKey("t1")), "Unexpected existence of trigger named '11'."); sched.ScheduleJob(job, trigger); Assert.IsTrue(sched.CheckExists(new TriggerKey("t1")), "Expected existence of trigger named 't1' but checkExists return false."); job = sched.GetJobDetail(new JobKey("j1")); Assert.IsNotNull(job, "Stored job not found!"); trigger = sched.GetTrigger(new TriggerKey("t1")); Assert.IsNotNull(trigger, "Stored trigger not found!"); job = JobBuilder.NewJob() .OfType <TestJob>() .WithIdentity("j2", "g1") .Build(); trigger = TriggerBuilder.Create() .WithIdentity("t2", "g1") .ForJob(job) .StartNow() .WithSchedule(SimpleScheduleBuilder.Create() .RepeatForever() .WithIntervalInSeconds(5)) .Build(); sched.ScheduleJob(job, trigger); job = JobBuilder.NewJob() .OfType <TestJob>() .WithIdentity("j3", "g1") .Build(); trigger = TriggerBuilder.Create() .WithIdentity("t3", "g1") .ForJob(job) .StartNow() .WithSchedule(SimpleScheduleBuilder.Create() .RepeatForever() .WithIntervalInSeconds(5)) .Build(); sched.ScheduleJob(job, trigger); IList <string> jobGroups = sched.GetJobGroupNames(); IList <string> triggerGroups = sched.GetTriggerGroupNames(); Assert.AreEqual(2, jobGroups.Count, "Job group list size expected to be = 2 "); Assert.AreEqual(2, triggerGroups.Count, "Trigger group list size expected to be = 2 "); Collection.ISet <JobKey> jobKeys = sched.GetJobKeys(GroupMatcher <JobKey> .GroupEquals(JobKey.DefaultGroup)); Collection.ISet <TriggerKey> triggerKeys = sched.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupEquals(TriggerKey.DefaultGroup)); Assert.AreEqual(1, jobKeys.Count, "Number of jobs expected in default group was 1 "); Assert.AreEqual(1, triggerKeys.Count, "Number of triggers expected in default group was 1 "); jobKeys = sched.GetJobKeys(GroupMatcher <JobKey> .GroupEquals("g1")); triggerKeys = sched.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupEquals("g1")); Assert.AreEqual(2, jobKeys.Count, "Number of jobs expected in 'g1' group was 2 "); Assert.AreEqual(2, triggerKeys.Count, "Number of triggers expected in 'g1' group was 2 "); TriggerState s = sched.GetTriggerState(new TriggerKey("t2", "g1")); Assert.AreEqual(TriggerState.Normal, s, "State of trigger t2 expected to be NORMAL "); sched.PauseTrigger(new TriggerKey("t2", "g1")); s = sched.GetTriggerState(new TriggerKey("t2", "g1")); Assert.AreEqual(TriggerState.Paused, s, "State of trigger t2 expected to be PAUSED "); sched.ResumeTrigger(new TriggerKey("t2", "g1")); s = sched.GetTriggerState(new TriggerKey("t2", "g1")); Assert.AreEqual(TriggerState.Normal, s, "State of trigger t2 expected to be NORMAL "); Collection.ISet <string> pausedGroups = sched.GetPausedTriggerGroups(); Assert.AreEqual(0, pausedGroups.Count, "Size of paused trigger groups list expected to be 0 "); sched.PauseTriggers(GroupMatcher <TriggerKey> .GroupEquals("g1")); // test that adding a trigger to a paused group causes the new trigger to be paused also... job = JobBuilder.NewJob() .OfType <TestJob>() .WithIdentity("j4", "g1") .Build(); trigger = TriggerBuilder.Create() .WithIdentity("t4", "g1") .ForJob(job) .StartNow() .WithSchedule(SimpleScheduleBuilder.Create() .RepeatForever() .WithIntervalInSeconds(5)) .Build(); sched.ScheduleJob(job, trigger); pausedGroups = sched.GetPausedTriggerGroups(); Assert.AreEqual(1, pausedGroups.Count, "Size of paused trigger groups list expected to be 1 "); s = sched.GetTriggerState(new TriggerKey("t2", "g1")); Assert.AreEqual(TriggerState.Paused, s, "State of trigger t2 expected to be PAUSED "); s = sched.GetTriggerState(new TriggerKey("t4", "g1")); Assert.AreEqual(TriggerState.Paused, s, "State of trigger t4 expected to be PAUSED"); sched.ResumeTriggers(GroupMatcher <TriggerKey> .GroupEquals("g1")); s = sched.GetTriggerState(new TriggerKey("t2", "g1")); Assert.AreEqual(TriggerState.Normal, s, "State of trigger t2 expected to be NORMAL "); s = sched.GetTriggerState(new TriggerKey("t4", "g1")); Assert.AreEqual(TriggerState.Normal, s, "State of trigger t2 expected to be NORMAL "); pausedGroups = sched.GetPausedTriggerGroups(); Assert.AreEqual(0, pausedGroups.Count, "Size of paused trigger groups list expected to be 0 "); Assert.IsFalse(sched.UnscheduleJob(new TriggerKey("foasldfksajdflk")), "Scheduler should have returned 'false' from attempt to unschedule non-existing trigger. "); Assert.IsTrue(sched.UnscheduleJob(new TriggerKey("t3", "g1")), "Scheduler should have returned 'true' from attempt to unschedule existing trigger. "); jobKeys = sched.GetJobKeys(GroupMatcher <JobKey> .GroupEquals("g1")); triggerKeys = sched.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupEquals("g1")); Assert.AreEqual(2, jobKeys.Count, "Number of jobs expected in 'g1' group was 1 "); // job should have been deleted also, because it is non-durable Assert.AreEqual(2, triggerKeys.Count, "Number of triggers expected in 'g1' group was 1 "); Assert.IsTrue(sched.UnscheduleJob(new TriggerKey("t1")), "Scheduler should have returned 'true' from attempt to unschedule existing trigger. "); jobKeys = sched.GetJobKeys(GroupMatcher <JobKey> .GroupEquals(JobKey.DefaultGroup)); triggerKeys = sched.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupEquals(TriggerKey.DefaultGroup)); Assert.AreEqual(1, jobKeys.Count, "Number of jobs expected in default group was 1 "); // job should have been left in place, because it is non-durable Assert.AreEqual(0, triggerKeys.Count, "Number of triggers expected in default group was 0 "); }
public void ScheduleJob(IJobDetail jobDetail, Collection.ISet <ITrigger> triggersForJob, bool replace) { CallInGuard(x => x.ScheduleJob(jobDetail, triggersForJob, replace)); }
public void ScheduleJob(IJobDetail jobDetail, Collection.ISet <ITrigger> triggersForJob, bool replace) { sched.ScheduleJob(jobDetail, triggersForJob, replace); }
public void TestBasicStorageFunctions() { IScheduler sched = CreateScheduler("testBasicStorageFunctions", 2); sched.Clear(); // test basic storage functions of scheduler... IJobDetail job = JobBuilder.Create <TestJob>() .WithIdentity("j1") .StoreDurably() .Build(); Assert.That(sched.CheckExists(new JobKey("j1")), Is.False, "Unexpected existence of job named 'j1'."); sched.AddJob(job, false); Assert.That(sched.CheckExists(new JobKey("j1")), "Expected existence of job named 'j1' but checkExists return false."); job = sched.GetJobDetail(new JobKey("j1")); Assert.That(job, Is.Not.Null, "Stored job not found!"); sched.DeleteJob(new JobKey("j1")); ITrigger trigger = TriggerBuilder.Create() .WithIdentity("t1") .ForJob(job) .StartNow() .WithSimpleSchedule(x => x .RepeatForever() .WithIntervalInSeconds(5)) .Build(); Assert.That(sched.CheckExists(new TriggerKey("t1")), Is.False, "Unexpected existence of trigger named '11'."); sched.ScheduleJob(job, trigger); Assert.That(sched.CheckExists(new TriggerKey("t1")), "Expected existence of trigger named 't1' but checkExists return false."); job = sched.GetJobDetail(new JobKey("j1")); Assert.That(job, Is.Not.Null, "Stored job not found!"); trigger = sched.GetTrigger(new TriggerKey("t1")); Assert.That(trigger, Is.Not.Null, "Stored trigger not found!"); job = JobBuilder.Create <TestJob>() .WithIdentity("j2", "g1") .Build(); trigger = TriggerBuilder.Create() .WithIdentity("t2", "g1") .ForJob(job) .StartNow() .WithSimpleSchedule(x => x .RepeatForever() .WithIntervalInSeconds(5)) .Build(); sched.ScheduleJob(job, trigger); job = JobBuilder.Create <TestJob>() .WithIdentity("j3", "g1") .Build(); trigger = TriggerBuilder.Create() .WithIdentity("t3", "g1") .ForJob(job) .StartNow() .WithSimpleSchedule(x => x .RepeatForever() .WithIntervalInSeconds(5)) .Build(); sched.ScheduleJob(job, trigger); IList <string> jobGroups = sched.GetJobGroupNames(); IList <string> triggerGroups = sched.GetTriggerGroupNames(); Assert.That(jobGroups.Count, Is.EqualTo(2), "Job group list size expected to be = 2 "); Assert.That(triggerGroups.Count, Is.EqualTo(2), "Trigger group list size expected to be = 2 "); Collection.ISet <JobKey> jobKeys = sched.GetJobKeys(GroupMatcher <JobKey> .GroupEquals(JobKey.DefaultGroup)); Collection.ISet <TriggerKey> triggerKeys = sched.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupEquals(TriggerKey.DefaultGroup)); Assert.That(jobKeys.Count, Is.EqualTo(1), "Number of jobs expected in default group was 1 "); Assert.That(triggerKeys.Count, Is.EqualTo(1), "Number of triggers expected in default group was 1 "); jobKeys = sched.GetJobKeys(GroupMatcher <JobKey> .GroupEquals("g1")); triggerKeys = sched.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupEquals("g1")); Assert.That(jobKeys.Count, Is.EqualTo(2), "Number of jobs expected in 'g1' group was 2 "); Assert.That(triggerKeys.Count, Is.EqualTo(2), "Number of triggers expected in 'g1' group was 2 "); TriggerState s = sched.GetTriggerState(new TriggerKey("t2", "g1")); Assert.That(s.Equals(TriggerState.Normal), "State of trigger t2 expected to be NORMAL "); sched.PauseTrigger(new TriggerKey("t2", "g1")); s = sched.GetTriggerState(new TriggerKey("t2", "g1")); Assert.That(s.Equals(TriggerState.Paused), "State of trigger t2 expected to be PAUSED "); sched.ResumeTrigger(new TriggerKey("t2", "g1")); s = sched.GetTriggerState(new TriggerKey("t2", "g1")); Assert.That(s.Equals(TriggerState.Normal), "State of trigger t2 expected to be NORMAL "); Collection.ISet <string> pausedGroups = sched.GetPausedTriggerGroups(); Assert.That(pausedGroups, Is.Empty, "Size of paused trigger groups list expected to be 0 "); sched.PauseTriggers(GroupMatcher <TriggerKey> .GroupEquals("g1")); // test that adding a trigger to a paused group causes the new trigger to be paused also... job = JobBuilder.Create <TestJob>() .WithIdentity("j4", "g1") .Build(); trigger = TriggerBuilder.Create() .WithIdentity("t4", "g1") .ForJob(job) .StartNow() .WithSimpleSchedule(x => x.RepeatForever().WithIntervalInSeconds(5)) .Build(); sched.ScheduleJob(job, trigger); pausedGroups = sched.GetPausedTriggerGroups(); Assert.That(pausedGroups.Count, Is.EqualTo(1), "Size of paused trigger groups list expected to be 1 "); s = sched.GetTriggerState(new TriggerKey("t2", "g1")); Assert.That(s.Equals(TriggerState.Paused), "State of trigger t2 expected to be PAUSED "); s = sched.GetTriggerState(new TriggerKey("t4", "g1")); Assert.That(s.Equals(TriggerState.Paused), "State of trigger t4 expected to be PAUSED "); sched.ResumeTriggers(GroupMatcher <TriggerKey> .GroupEquals("g1")); s = sched.GetTriggerState(new TriggerKey("t2", "g1")); Assert.That(s.Equals(TriggerState.Normal), "State of trigger t2 expected to be NORMAL "); s = sched.GetTriggerState(new TriggerKey("t4", "g1")); Assert.That(s.Equals(TriggerState.Normal), "State of trigger t4 expected to be NORMAL "); pausedGroups = sched.GetPausedTriggerGroups(); Assert.That(pausedGroups, Is.Empty, "Size of paused trigger groups list expected to be 0 "); Assert.That(sched.UnscheduleJob(new TriggerKey("foasldfksajdflk")), Is.False, "Scheduler should have returned 'false' from attempt to unschedule non-existing trigger. "); Assert.That(sched.UnscheduleJob(new TriggerKey("t3", "g1")), "Scheduler should have returned 'true' from attempt to unschedule existing trigger. "); jobKeys = sched.GetJobKeys(GroupMatcher <JobKey> .GroupEquals("g1")); triggerKeys = sched.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupEquals("g1")); Assert.That(jobKeys.Count, Is.EqualTo(2), "Number of jobs expected in 'g1' group was 1 "); // job should have been deleted also, because it is non-durable Assert.That(triggerKeys.Count, Is.EqualTo(2), "Number of triggers expected in 'g1' group was 1 "); Assert.That(sched.UnscheduleJob(new TriggerKey("t1")), "Scheduler should have returned 'true' from attempt to unschedule existing trigger. "); jobKeys = sched.GetJobKeys(GroupMatcher <JobKey> .GroupEquals(JobKey.DefaultGroup)); triggerKeys = sched.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupEquals(TriggerKey.DefaultGroup)); Assert.That(jobKeys.Count, Is.EqualTo(1), "Number of jobs expected in default group was 1 "); // job should have been left in place, because it is non-durable Assert.That(triggerKeys, Is.Empty, "Number of triggers expected in default group was 0 "); sched.Shutdown(); }
private void TestMatchers(IScheduler scheduler) { scheduler.Clear(); IJobDetail job = JobBuilder.Create <NoOpJob>().WithIdentity("job1", "aaabbbccc").StoreDurably().Build(); scheduler.AddJob(job, true); SimpleScheduleBuilder schedule = SimpleScheduleBuilder.Create(); ITrigger trigger = TriggerBuilder.Create().WithIdentity("trig1", "aaabbbccc").WithSchedule(schedule).ForJob(job).Build(); scheduler.ScheduleJob(trigger); job = JobBuilder.Create <NoOpJob>().WithIdentity("job1", "xxxyyyzzz").StoreDurably().Build(); scheduler.AddJob(job, true); schedule = SimpleScheduleBuilder.Create(); trigger = TriggerBuilder.Create().WithIdentity("trig1", "xxxyyyzzz").WithSchedule(schedule).ForJob(job).Build(); scheduler.ScheduleJob(trigger); job = JobBuilder.Create <NoOpJob>().WithIdentity("job2", "xxxyyyzzz").StoreDurably().Build(); scheduler.AddJob(job, true); schedule = SimpleScheduleBuilder.Create(); trigger = TriggerBuilder.Create().WithIdentity("trig2", "xxxyyyzzz").WithSchedule(schedule).ForJob(job).Build(); scheduler.ScheduleJob(trigger); Collection.ISet <JobKey> jkeys = scheduler.GetJobKeys(GroupMatcher <JobKey> .AnyGroup()); Assert.That(jkeys.Count, Is.EqualTo(3), "Wrong number of jobs found by anything matcher"); jkeys = scheduler.GetJobKeys(GroupMatcher <JobKey> .GroupEquals("xxxyyyzzz")); Assert.That(jkeys.Count, Is.EqualTo(2), "Wrong number of jobs found by equals matcher"); jkeys = scheduler.GetJobKeys(GroupMatcher <JobKey> .GroupEquals("aaabbbccc")); Assert.That(jkeys.Count, Is.EqualTo(1), "Wrong number of jobs found by equals matcher"); jkeys = scheduler.GetJobKeys(GroupMatcher <JobKey> .GroupStartsWith("aa")); Assert.That(jkeys.Count, Is.EqualTo(1), "Wrong number of jobs found by starts with matcher"); jkeys = scheduler.GetJobKeys(GroupMatcher <JobKey> .GroupStartsWith("xx")); Assert.That(jkeys.Count, Is.EqualTo(2), "Wrong number of jobs found by starts with matcher"); jkeys = scheduler.GetJobKeys(GroupMatcher <JobKey> .GroupEndsWith("cc")); Assert.That(jkeys.Count, Is.EqualTo(1), "Wrong number of jobs found by ends with matcher"); jkeys = scheduler.GetJobKeys(GroupMatcher <JobKey> .GroupEndsWith("zzz")); Assert.That(jkeys.Count, Is.EqualTo(2), "Wrong number of jobs found by ends with matcher"); jkeys = scheduler.GetJobKeys(GroupMatcher <JobKey> .GroupContains("bc")); Assert.That(jkeys.Count, Is.EqualTo(1), "Wrong number of jobs found by contains with matcher"); jkeys = scheduler.GetJobKeys(GroupMatcher <JobKey> .GroupContains("yz")); Assert.That(jkeys.Count, Is.EqualTo(2), "Wrong number of jobs found by contains with matcher"); Collection.ISet <TriggerKey> tkeys = scheduler.GetTriggerKeys(GroupMatcher <TriggerKey> .AnyGroup()); Assert.That(tkeys.Count, Is.EqualTo(3), "Wrong number of triggers found by anything matcher"); tkeys = scheduler.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupEquals("xxxyyyzzz")); Assert.That(tkeys.Count, Is.EqualTo(2), "Wrong number of triggers found by equals matcher"); tkeys = scheduler.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupEquals("aaabbbccc")); Assert.That(tkeys.Count, Is.EqualTo(1), "Wrong number of triggers found by equals matcher"); tkeys = scheduler.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupStartsWith("aa")); Assert.That(tkeys.Count, Is.EqualTo(1), "Wrong number of triggers found by starts with matcher"); tkeys = scheduler.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupStartsWith("xx")); Assert.That(tkeys.Count, Is.EqualTo(2), "Wrong number of triggers found by starts with matcher"); tkeys = scheduler.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupEndsWith("cc")); Assert.That(tkeys.Count, Is.EqualTo(1), "Wrong number of triggers found by ends with matcher"); tkeys = scheduler.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupEndsWith("zzz")); Assert.That(tkeys.Count, Is.EqualTo(2), "Wrong number of triggers found by ends with matcher"); tkeys = scheduler.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupContains("bc")); Assert.That(tkeys.Count, Is.EqualTo(1), "Wrong number of triggers found by contains with matcher"); tkeys = scheduler.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupContains("yz")); Assert.That(tkeys.Count, Is.EqualTo(2), "Wrong number of triggers found by contains with matcher"); }
public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, Collection.ISet <T> value) { _serializer.Serialize(context, args, value); }