Ejemplo n.º 1
0
 @Test
 public void jobsWithEveryAnnotationShouldBeExecuted() throws Exception {
   EveryTestJob.results.clear();
   jobManager.start();
   Thread.sleep(5000);
   assertThat(EveryTestJob.results, hasSize(greaterThan(5)));
 }
Ejemplo n.º 2
0
 @Test
 public void jobsOnStartupShouldBeExecuted() throws Exception {
   ApplicationStartTestJob.results.clear();
   jobManager.start();
   Thread.sleep(1000);
   assertThat(ApplicationStartTestJob.results, hasSize(1));
 }
Ejemplo n.º 3
0
 @Test
 public void jobsWithEveryAnnotationAndNoValueShouldBeExternallyConfigured() throws Exception {
   givenConfigurationFor("everyTestJobDefaultConfiguration", "1s");
   EveryTestJobDefaultConfiguration.results.clear();
   jobManager.start();
   Thread.sleep(5000);
   assertThat(EveryTestJobDefaultConfiguration.results, hasSize(greaterThan(5)));
 }
Ejemplo n.º 4
0
 @Test
 public void jobsOnStoppingShouldBeExecuted() throws Exception {
   ApplicationStopTestJob.results.clear();
   jobManager.start();
   jobManager.stop();
   stopped = true;
   assertThat(ApplicationStopTestJob.results, hasSize(1));
 }
Ejemplo n.º 5
0
 @Test
 public void jobsWithEveryAnnotationAndDelayStartShouldWaitToBeExecuted() throws Exception {
   EveryTestJobWithDelay.results.clear();
   jobManager.start();
   Thread.sleep(2500);
   assertThat(EveryTestJobWithDelay.results, hasSize(0));
   Thread.sleep(2500);
   assertThat(EveryTestJobWithDelay.results, hasSize(lessThan(4)));
 }