davidkiss/spring-boot-quartz-demo

Question about using scheduler in Integration Test

glideken opened this issue · 5 comments

Appreciate if you can help me figure out an issue with my IntegrationTest.

In this commit, I removed the sampleTrigger in SchedulerConfig and scheduled a job in an integration test but the job doesn't start.

But the same exact code from ApplicationTest put into Application starts the job here

Any idea why? Thanks.

In ApplicationTest class extending the AbstractTestNGSpringContextTests class instead of AbstractTransactionalTestNGSpringContextTests seems to be a better choice. I tested it and it works.

Do you know why switching to AbstractTestNGSpringContextTests works? Thanks for the help!

Could it be because for AbstractTransactionalTestNGSpringContextTests, test() is in a transaction meaning the job/trigger won't be saved into the db until test() exists?

That sounds right

On Fri, Jul 31, 2015 at 7:17 AM, glideken notifications@github.com wrote:

Could it be because for AbstractTransactionalTestNGSpringContextTests,
test() is in a transaction meaning the job/trigger won't be saved into
the db until test() exists?


Reply to this email directly or view it on GitHub
#3 (comment)
.

Thanks!