[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Automated tests  XML
Forum Index -> Quartz
Author Message
cwalzl

neo

Joined: 12/01/2009 13:50:31
Messages: 4
Offline

Hi All,

Any thoughts on best practices for setting up automated tests that use quartz?

For example, if I setup a tests that create a quartz trigger set to fire on every Wednesday and Friday, I'd like to write a test that verifies that my job will execute every Wednesday and Friday, but not the other days.

Another example might be a job that executes every 3 days.

For simpler tests I can just set the trigger start date a few seconds into the future, and then sleep, and then test to see if my job executed. For more complex examples, such as above, do I need to somehow fake out the system time?

Normally, I'd try to abstract out the work Quartz does in my tests, but in code I'm currently working on, a lot of these triggers are created programmatically on the fly, based on custom input types. I'd like to test that the triggers that are built, are valid and will work as intended.

Any ideas?

Thanks,
Chris
jhouse

seraphim
[Avatar]
Joined: 11/06/2009 15:29:56
Messages: 1703
Offline


see the methods on TriggerUtils that compute future fire-times of triggers... they're perfect for enabling the type of tests you're inquiring about.


cwalzl

neo

Joined: 12/01/2009 13:50:31
Messages: 4
Offline

That worked beautifully. Thank you!
 
Forum Index -> Quartz
Go to:   
Powered by JForum 2.1.7 © JForum Team