Package org.springframework.scheduling

Examples of org.springframework.scheduling.TriggerContext


  public void testIncrementSecondAndRollover() throws Exception {
    CronTrigger trigger = new CronTrigger("10 * * * * *", timeZone);
    calendar.set(Calendar.SECOND, 11);
    Date date = calendar.getTime();
    calendar.add(Calendar.SECOND, 59);
    TriggerContext context = getTriggerContext(date);
    assertEquals(calendar.getTime(), trigger.nextExecutionTime(context));
  }
View Full Code Here


    CronTrigger trigger = new CronTrigger("0 * * * * *", timeZone);
    calendar.set(Calendar.MINUTE, 10);
    Date date = calendar.getTime();
    calendar.add(Calendar.MINUTE, 1);
    calendar.set(Calendar.SECOND, 0);
    TriggerContext context1 = getTriggerContext(date);
    date = trigger.nextExecutionTime(context1);
    assertEquals(calendar.getTime(), date);
    calendar.add(Calendar.MINUTE, 1);
    TriggerContext context2 = getTriggerContext(date);
    date = trigger.nextExecutionTime(context2);
    assertEquals(calendar.getTime(), date);
  }
View Full Code Here

  @Test
  public void testIncrementMinuteByOne() throws Exception {
    CronTrigger trigger = new CronTrigger("0 11 * * * *", timeZone);
    calendar.set(Calendar.MINUTE, 10);
    TriggerContext context = getTriggerContext(calendar.getTime());
    calendar.add(Calendar.MINUTE, 1);
    calendar.set(Calendar.SECOND, 0);
    assertEquals(calendar.getTime(), trigger.nextExecutionTime(context));
  }
View Full Code Here

    CronTrigger trigger = new CronTrigger("0 10 * * * *", timeZone);
    calendar.set(Calendar.MINUTE, 11);
    calendar.set(Calendar.SECOND, 0);
    Date date = calendar.getTime();
    calendar.add(Calendar.MINUTE, 59);
    TriggerContext context = getTriggerContext(date);
    assertEquals(calendar.getTime(), trigger.nextExecutionTime(context));
  }
View Full Code Here

    calendar.set(Calendar.MINUTE, 1);
    calendar.set(Calendar.SECOND, 0);
    Date date = calendar.getTime();
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.HOUR_OF_DAY, 12);
    TriggerContext context1 = getTriggerContext(date);
    assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context1));
    calendar.set(Calendar.HOUR_OF_DAY, 13);
    TriggerContext context2 = getTriggerContext(date);
    assertEquals(calendar.getTime(), trigger.nextExecutionTime(context2));
  }
View Full Code Here

    calendar.set(Calendar.SECOND, 0);
    Date date = calendar.getTime();
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.DAY_OF_MONTH, 11);
    TriggerContext context1 = getTriggerContext(date);
    assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context1));
    calendar.set(Calendar.HOUR_OF_DAY, 1);
    TriggerContext context2 = getTriggerContext(date);
    assertEquals(calendar.getTime(), trigger.nextExecutionTime(context2));
  }
View Full Code Here

    Date date = calendar.getTime();
    calendar.add(Calendar.DAY_OF_MONTH, 1);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    TriggerContext context1 = getTriggerContext(date);
    assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context1));
    assertEquals(2, calendar.get(Calendar.DAY_OF_MONTH));
    calendar.add(Calendar.DAY_OF_MONTH, 1);
    TriggerContext context2 = getTriggerContext(date);
    assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context2));
    assertEquals(3, calendar.get(Calendar.DAY_OF_MONTH));
  }
View Full Code Here

    Date date = calendar.getTime();
    calendar.add(Calendar.DAY_OF_MONTH, 1);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    TriggerContext context = getTriggerContext(date);
    assertEquals(calendar.getTime(), trigger.nextExecutionTime(context));
  }
View Full Code Here

    calendar.add(Calendar.MONTH, 1);
    calendar.set(Calendar.DAY_OF_MONTH, 10);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    TriggerContext context = getTriggerContext(date);
    assertEquals(calendar.getTime(), trigger.nextExecutionTime(context));
  }
View Full Code Here

    calendar.set(Calendar.MONTH, 9); // October
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.DAY_OF_MONTH, 1);
    TriggerContext context1 = getTriggerContext(date);
    assertEquals(calendar.getTime(), date = trigger.nextExecutionTime(context1));
    calendar.set(Calendar.DAY_OF_MONTH, 2);
    TriggerContext context2 = getTriggerContext(date);
    assertEquals(calendar.getTime(), trigger.nextExecutionTime(context2));
  }
View Full Code Here

TOP

Related Classes of org.springframework.scheduling.TriggerContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.