本文整理匯總了C#中Quartz.Impl.Triggers.CalendarIntervalTriggerImpl類的典型用法代碼示例。如果您正苦於以下問題:C# CalendarIntervalTriggerImpl類的具體用法?C# CalendarIntervalTriggerImpl怎麽用?C# CalendarIntervalTriggerImpl使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CalendarIntervalTriggerImpl類屬於Quartz.Impl.Triggers命名空間,在下文中一共展示了CalendarIntervalTriggerImpl類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestMonthlyIntervalGetFireTimeAfter
public void TestMonthlyIntervalGetFireTimeAfter()
{
DateTimeOffset startCalendar = DateBuilder.DateOf(9, 30, 17, 1, 6, 2005);
var yearlyTrigger = new CalendarIntervalTriggerImpl
{
StartTimeUtc = startCalendar,
RepeatIntervalUnit = IntervalUnit.Month,
RepeatInterval = 5 // every five months
};
DateTimeOffset targetCalendar = startCalendar.AddMonths(25); // jump 25 five months (5 intervals)
IList<DateTimeOffset> fireTimes = TriggerUtils.ComputeFireTimes(yearlyTrigger, null, 6);
DateTimeOffset sixthTime = fireTimes[5]; // get the sixth fire time
Assert.AreEqual(targetCalendar, sixthTime, "Month increment result not as expected.");
}
示例2: TestDailyIntervalGetFireTimeAfter
public void TestDailyIntervalGetFireTimeAfter()
{
DateTimeOffset startCalendar = new DateTimeOffset(2005, 6, 1, 9, 30, 17, TimeSpan.Zero);
CalendarIntervalTriggerImpl dailyTrigger = new CalendarIntervalTriggerImpl();
dailyTrigger.StartTimeUtc = startCalendar;
dailyTrigger.RepeatIntervalUnit = IntervalUnit.Day;
dailyTrigger.RepeatInterval = 90; // every ninety days
DateTimeOffset targetCalendar = new DateTimeOffset(2005, 6, 1, 9, 30, 17, TimeSpan.Zero);
targetCalendar = targetCalendar.AddDays(360); // jump 360 days (4 intervals)
IList<DateTimeOffset> fireTimes = TriggerUtils.ComputeFireTimes(dailyTrigger, null, 6);
DateTimeOffset fifthTime = fireTimes[4]; // get the fifth fire time
Assert.AreEqual(targetCalendar, fifthTime, "Day increment result not as expected.");
}
示例3: TestWeeklyIntervalGetFireTimeAfter
public void TestWeeklyIntervalGetFireTimeAfter()
{
DateTimeOffset startCalendar = DateBuilder.DateOf(9, 30, 17, 1, 6, 2005);
var yearlyTrigger = new CalendarIntervalTriggerImpl
{
StartTimeUtc = startCalendar,
RepeatIntervalUnit = IntervalUnit.Week,
RepeatInterval = 6 // every six weeks
};
DateTimeOffset targetCalendar = startCalendar.AddDays(7*6*4); // jump 24 weeks (4 intervals)
IList<DateTimeOffset> fireTimes = TriggerUtils.ComputeFireTimes(yearlyTrigger, null, 7);
DateTimeOffset fifthTime = fireTimes[4]; // get the fifth fire time
Assert.AreEqual(targetCalendar, fifthTime, "Week increment result not as expected.");
}
示例4: TestDailyIntervalGetFireTimeAfter
public void TestDailyIntervalGetFireTimeAfter()
{
DateTimeOffset startCalendar = DateBuilder.DateOf(9, 30, 17, 1, 6, 2005);
var dailyTrigger = new CalendarIntervalTriggerImpl
{
StartTimeUtc = startCalendar,
RepeatIntervalUnit = IntervalUnit.Day,
RepeatInterval = 90 // every ninety days
};
DateTimeOffset targetCalendar = startCalendar.AddDays(360); // jump 360 days (4 intervals)
IList<DateTimeOffset> fireTimes = TriggerUtils.ComputeFireTimes(dailyTrigger, null, 6);
DateTimeOffset fifthTime = fireTimes[4]; // get the fifth fire time
Assert.AreEqual(targetCalendar, fifthTime, "Day increment result not as expected.");
}
示例5: TestYearlyIntervalGetFireTimeAfter
public void TestYearlyIntervalGetFireTimeAfter()
{
DateTimeOffset startCalendar = DateBuilder.DateOf(9, 30, 17, 1, 6, 2005);
var yearlyTrigger = new CalendarIntervalTriggerImpl
{
StartTimeUtc = startCalendar,
RepeatIntervalUnit = IntervalUnit.Year,
RepeatInterval = 2 // every two years;
};
DateTimeOffset targetCalendar = startCalendar.AddYears(4);
IList<DateTimeOffset> fireTimes = TriggerUtils.ComputeFireTimes(yearlyTrigger, null, 4);
DateTimeOffset thirdTime = fireTimes[2]; // get the third fire time
Assert.AreEqual(targetCalendar, thirdTime, "Year increment result not as expected.");
}
示例6: TestDaylightSavingsTransitions
public void TestDaylightSavingsTransitions()
{
// Pick a day before a daylight savings transition...
DateTimeOffset startCalendar = DateBuilder.DateOf(9, 30, 17, 12, 3, 2010);
var dailyTrigger = new CalendarIntervalTriggerImpl
{
StartTimeUtc = startCalendar,
RepeatIntervalUnit = IntervalUnit.Day,
RepeatInterval = 5 // every 5 days
};
DateTimeOffset targetCalendar = startCalendar.AddDays(10); // jump 10 days (2 intervals)
IList<DateTimeOffset> fireTimes = TriggerUtils.ComputeFireTimes(dailyTrigger, null, 6);
DateTimeOffset testTime = fireTimes[2]; // get the third fire time
Assert.AreEqual(targetCalendar, testTime, "Day increment result not as expected over spring daylight savings transition.");
// Pick a day before a daylight savings transition...
startCalendar = new DateTimeOffset(2010, 10, 31, 9, 30, 17, TimeSpan.Zero);
dailyTrigger = new CalendarIntervalTriggerImpl
{
StartTimeUtc = startCalendar,
RepeatIntervalUnit = IntervalUnit.Day,
RepeatInterval = 5 // every 5 days
};
targetCalendar = startCalendar.AddDays(15); // jump 15 days (3 intervals)
fireTimes = TriggerUtils.ComputeFireTimes(dailyTrigger, null, 6);
testTime = fireTimes[3]; // get the fourth fire time
Assert.AreEqual(targetCalendar, testTime, "Day increment result not as expected over fall daylight savings transition.");
}
示例7: TestCrossingDSTBoundry
public void TestCrossingDSTBoundry()
{
TimeZoneInfo cetTimeZone = TimeZoneUtil.FindTimeZoneById("Central European Standard Time");
DateTimeOffset startCalendar = TimeZoneUtil.ConvertTime(new DateTime(2011, 3, 26, 4, 0, 0), cetTimeZone);
CalendarIntervalTriggerImpl dailyTrigger = new CalendarIntervalTriggerImpl();
dailyTrigger.StartTimeUtc = startCalendar;
dailyTrigger.RepeatIntervalUnit = IntervalUnit.Day;
dailyTrigger.RepeatInterval = 1;
dailyTrigger.TimeZone = cetTimeZone;
dailyTrigger.PreserveHourOfDayAcrossDaylightSavings = true;
var fireTimes = TriggerUtils.ComputeFireTimes(dailyTrigger, null, 6);
//none of these should match the previous fire time.
for (int i = 1; i < fireTimes.Count; i++)
{
var previousFire = fireTimes[i - 1];
var currentFire = fireTimes[i];
Assert.AreNotEqual(previousFire, currentFire);
}
}
示例8: TestFinalFireTimes
public void TestFinalFireTimes()
{
DateTimeOffset startCalendar = new DateTimeOffset(2010, 3, 12, 9, 0, 0, TimeSpan.Zero);
CalendarIntervalTriggerImpl dailyTrigger = new CalendarIntervalTriggerImpl();
dailyTrigger.StartTimeUtc = startCalendar;
dailyTrigger.RepeatIntervalUnit = IntervalUnit.Day;
dailyTrigger.RepeatInterval = 5; // every 5 days
DateTimeOffset endCalendar = startCalendar;
endCalendar = endCalendar.AddDays(10); // jump 10 days (2 intervals)
dailyTrigger.EndTimeUtc = endCalendar;
DateTimeOffset? testTime = dailyTrigger.FinalFireTimeUtc;
Assert.AreEqual(endCalendar, testTime, "Final fire time not computed correctly for day interval.");
startCalendar = new DateTimeOffset(2010, 3, 12, 9, 0, 0, TimeSpan.Zero);
dailyTrigger = new CalendarIntervalTriggerImpl();
dailyTrigger.StartTimeUtc = startCalendar;
dailyTrigger.RepeatIntervalUnit = IntervalUnit.Minute;
dailyTrigger.RepeatInterval = 5; // every 5 minutes
endCalendar = startCalendar;
endCalendar = endCalendar.AddDays(15); // jump 15 days
endCalendar = endCalendar.AddMinutes(-2); // back up two minutes
dailyTrigger.EndTimeUtc = endCalendar;
testTime = dailyTrigger.FinalFireTimeUtc;
Assert.IsTrue((endCalendar > (testTime)), "Final fire time not computed correctly for minutely interval.");
endCalendar = endCalendar.AddMinutes(-3); // back up three more minutes
Assert.IsTrue((endCalendar.Equals(testTime)), "Final fire time not computed correctly for minutely interval.");
}
示例9: TestSecondlyIntervalGetFireTimeAfter
public void TestSecondlyIntervalGetFireTimeAfter()
{
DateTimeOffset startCalendar = DateBuilder.DateOf(9, 30, 17, 1, 6, 2005);
var yearlyTrigger = new CalendarIntervalTriggerImpl
{
StartTimeUtc = startCalendar,
RepeatIntervalUnit = IntervalUnit.Second,
RepeatInterval = 100 // every 100 seconds
};
DateTimeOffset targetCalendar = startCalendar.AddSeconds(400); // jump 400 seconds (4 intervals)
IList<DateTimeOffset> fireTimes = TriggerUtils.ComputeFireTimes(yearlyTrigger, null, 6);
DateTimeOffset fifthTime = fireTimes[4]; // get the third fire time
Assert.AreEqual(targetCalendar, fifthTime, "Seconds increment result not as expected.");
}
示例10: TestMisfireInstructionValidity
public void TestMisfireInstructionValidity()
{
var trigger = new CalendarIntervalTriggerImpl();
try
{
trigger.MisfireInstruction = MisfireInstruction.IgnoreMisfirePolicy;
trigger.MisfireInstruction = MisfireInstruction.SmartPolicy;
trigger.MisfireInstruction = MisfireInstruction.CalendarIntervalTrigger.DoNothing;
trigger.MisfireInstruction = MisfireInstruction.CalendarIntervalTrigger.FireOnceNow;
}
catch (Exception)
{
Assert.Fail("Unexpected exception while setting misfire instruction.");
}
try
{
trigger.MisfireInstruction = MisfireInstruction.CalendarIntervalTrigger.DoNothing + 1;
Assert.Fail("Expected exception while setting invalid misfire instruction but did not get it.");
}
catch (Exception ex)
{
if (ex is AssertionException)
{
throw;
}
}
}
示例11: TestYearlyIntervalGetFireTimeAfter
public void TestYearlyIntervalGetFireTimeAfter()
{
DateTimeOffset startCalendar = new DateTimeOffset(2005, 6, 1, 9, 30, 17, TimeSpan.Zero);
CalendarIntervalTriggerImpl yearlyTrigger = new CalendarIntervalTriggerImpl();
yearlyTrigger.StartTimeUtc = startCalendar;
yearlyTrigger.RepeatIntervalUnit = IntervalUnit.Year;
yearlyTrigger.RepeatInterval = 2; // every two years;
DateTimeOffset targetCalendar = new DateTimeOffset(2009, 6, 1, 9, 30, 17, TimeSpan.Zero); // jump 4 years (2 intervals)
IList<DateTimeOffset> fireTimes = TriggerUtils.ComputeFireTimes(yearlyTrigger, null, 4);
DateTimeOffset secondTime = fireTimes[2]; // get the third fire time
Assert.AreEqual(targetCalendar, secondTime, "Year increment result not as expected.");
}
示例12: GetTargetObject
protected override object GetTargetObject()
{
JobDataMap jobDataMap = new JobDataMap();
jobDataMap["A"] = "B";
CalendarIntervalTriggerImpl t = new CalendarIntervalTriggerImpl();
t.Name = "test";
t.Group = "testGroup";
t.CalendarName = "MyCalendar";
t.Description = "CronTriggerDesc";
t.JobDataMap = jobDataMap;
t.RepeatInterval = 5;
t.RepeatIntervalUnit = IntervalUnit.Day;
return t;
}
示例13: TestSecondlyIntervalGetFireTimeAfter
public void TestSecondlyIntervalGetFireTimeAfter()
{
DateTimeOffset startCalendar = new DateTimeOffset(2005, 6, 1, 9, 30, 17, TimeSpan.Zero);
CalendarIntervalTriggerImpl yearlyTrigger = new CalendarIntervalTriggerImpl();
yearlyTrigger.StartTimeUtc = startCalendar;
yearlyTrigger.RepeatIntervalUnit = IntervalUnit.Second;
yearlyTrigger.RepeatInterval = 100; // every 100 seconds
DateTimeOffset targetCalendar = new DateTimeOffset(2005, 6, 1, 9, 30, 17, TimeSpan.Zero);
targetCalendar = targetCalendar.AddSeconds(400); // jump 400 seconds (4 intervals)
IList<DateTimeOffset> fireTimes = TriggerUtils.ComputeFireTimes(yearlyTrigger, null, 6);
DateTimeOffset fifthTime = fireTimes[4]; // get the third fire time
Assert.AreEqual(targetCalendar, fifthTime, "Seconds increment result not as expected.");
}
示例14: TestWeeklyIntervalGetFireTimeAfter
public void TestWeeklyIntervalGetFireTimeAfter()
{
DateTimeOffset startCalendar = new DateTimeOffset(2005, 6, 1, 9, 30, 17, TimeSpan.Zero);
CalendarIntervalTriggerImpl yearlyTrigger = new CalendarIntervalTriggerImpl();
yearlyTrigger.StartTimeUtc = startCalendar;
yearlyTrigger.RepeatIntervalUnit = IntervalUnit.Week;
yearlyTrigger.RepeatInterval = 6; // every six weeks
DateTimeOffset targetCalendar = new DateTimeOffset(2005, 6, 1, 9, 30, 17, TimeSpan.Zero);
targetCalendar = targetCalendar.AddDays(7 * 6 * 4); // jump 24 weeks (4 intervals)
IList<DateTimeOffset> fireTimes = TriggerUtils.ComputeFireTimes(yearlyTrigger, null, 7);
DateTimeOffset fifthTime = fireTimes[4]; // get the fifth fire time
Console.Out.WriteLine("targetCalendar:" + targetCalendar);
Console.Out.WriteLine("fifthTimee" + fifthTime);
Assert.AreEqual(targetCalendar, fifthTime, "Week increment result not as expected.");
}
示例15: TestDaylightSavingsTransitions
public void TestDaylightSavingsTransitions()
{
// Pick a day before a spring daylight savings transition...
DateTimeOffset startCalendar = DateBuilder.DateOf(9, 30, 17, 12, 3, 2010);
var dailyTrigger = new CalendarIntervalTriggerImpl
{
StartTimeUtc = startCalendar,
RepeatIntervalUnit = IntervalUnit.Day,
RepeatInterval = 5 // every 5 days
};
DateTimeOffset targetCalendar = startCalendar.AddDays(10); // jump 10 days (2 intervals)
IList<DateTimeOffset> fireTimes = TriggerUtils.ComputeFireTimes(dailyTrigger, null, 6);
DateTimeOffset testTime = fireTimes[2]; // get the third fire time
Assert.AreEqual(targetCalendar, testTime, "Day increment result not as expected over spring 2010 daylight savings transition.");
// And again, Pick a day before a spring daylight savings transition... (QTZ-240)
startCalendar = new DateTime(2011, 3, 12, 1, 0, 0);
dailyTrigger = new CalendarIntervalTriggerImpl();
dailyTrigger.StartTimeUtc = startCalendar;
dailyTrigger.RepeatIntervalUnit = IntervalUnit.Day;
dailyTrigger.RepeatInterval = 1; // every day
targetCalendar = startCalendar.AddDays(2); // jump 2 days (2 intervals)
fireTimes = TriggerUtils.ComputeFireTimes(dailyTrigger, null, 6);
testTime = fireTimes[2]; // get the third fire time
Assert.AreEqual(targetCalendar, testTime, "Day increment result not as expected over spring 2011 daylight savings transition.");
// And again, Pick a day before a spring daylight savings transition... (QTZ-240) - and prove time of day is not preserved without setPreserveHourOfDayAcrossDaylightSavings(true)
var cetTimeZone = TimeZoneUtil.FindTimeZoneById("Central European Standard Time");
startCalendar = TimeZoneInfo.ConvertTime(new DateTime(2011, 3, 26, 4, 0, 0), cetTimeZone);
dailyTrigger = new CalendarIntervalTriggerImpl();
dailyTrigger.StartTimeUtc = startCalendar;
dailyTrigger.RepeatIntervalUnit = IntervalUnit.Day;
dailyTrigger.RepeatInterval = 1; // every day
targetCalendar = TimeZoneUtil.ConvertTime(startCalendar, cetTimeZone);
targetCalendar = targetCalendar.AddDays(2); // jump 2 days (2 intervals)
fireTimes = TriggerUtils.ComputeFireTimes(dailyTrigger, null, 6);
testTime = fireTimes[2]; // get the third fire time
DateTimeOffset testCal = TimeZoneUtil.ConvertTime(testTime, cetTimeZone);
Assert.AreNotEqual(targetCalendar.Hour, testCal.Hour, "Day increment time-of-day result not as expected over spring 2011 daylight savings transition.");
// And again, Pick a day before a spring daylight savings transition... (QTZ-240) - and prove time of day is preserved with setPreserveHourOfDayAcrossDaylightSavings(true)
startCalendar = TimeZoneUtil.ConvertTime(new DateTime(2011, 3, 26, 4, 0, 0), cetTimeZone);
dailyTrigger = new CalendarIntervalTriggerImpl();
dailyTrigger.StartTimeUtc = startCalendar;
dailyTrigger.RepeatIntervalUnit = IntervalUnit.Day;
dailyTrigger.RepeatInterval = 1; // every day
dailyTrigger.TimeZone = cetTimeZone;
dailyTrigger.PreserveHourOfDayAcrossDaylightSavings = true;
targetCalendar = startCalendar.AddDays(2); // jump 2 days (2 intervals)
fireTimes = TriggerUtils.ComputeFireTimes(dailyTrigger, null, 6);
testTime = fireTimes[1]; // get the second fire time
testCal = TimeZoneUtil.ConvertTime(testTime, cetTimeZone);
Assert.AreEqual(targetCalendar.Hour, testCal.Hour, "Day increment time-of-day result not as expected over spring 2011 daylight savings transition.");
// Pick a day before a fall daylight savings transition...
startCalendar = new DateTimeOffset(2010, 10, 31, 9, 30, 17, TimeSpan.Zero);
dailyTrigger = new CalendarIntervalTriggerImpl
{
StartTimeUtc = startCalendar,
RepeatIntervalUnit = IntervalUnit.Day,
RepeatInterval = 5 // every 5 days
};
targetCalendar = startCalendar.AddDays(15); // jump 15 days (3 intervals)
fireTimes = TriggerUtils.ComputeFireTimes(dailyTrigger, null, 6);
testTime = fireTimes[3]; // get the fourth fire time
Assert.AreEqual(targetCalendar, testTime, "Day increment result not as expected over fall daylight savings transition.");
}