0

I have a system based on various Spring schedulers. I have used cron and fixedDelay schedulers type. I want to be able to replay all modifications with a minimum effort without wait the real time taken.

Example : I want to replay all modifications with for example 1 second equals 1 minute to speed up my test. For that, I set my current time like -Dtime=2017-01-01T00:00:00Z -Dspeed=1s for 1 minute and my system replay all calls at that speed.

I used in my example -D properties but it can also be programmatically or with an extern tools witch manipulate directly my laptop clock.

Is there a way to do this?

Franck Anso
  • 1,342
  • 4
  • 17
  • 34
  • This is very similar to http://stackoverflow.com/questions/17327956/testing-scheduled-in-spring. Could you take a look at that and let us know here if you have any constraints that make your problem unlike that problem? – John C Mar 17 '17 at 18:10
  • I dont want to unit test it, I want to execute the same code just much faster because I have codes which need to be executed at the first day of month. – Franck Anso Mar 19 '17 at 17:16

1 Answers1

0

What about usage external parameterized configuration:

@Scheduled(cron = "${externalVariable}")

and set this variable for production and for testing.

Matej Marconak
  • 1,365
  • 3
  • 20
  • 25