Package org.activiti.engine.impl.util

Examples of org.activiti.engine.impl.util.DefaultClockImpl


* @author martin.grofcik
*/
public class DefaultClockFactory implements FactoryBean<Clock> {
  @Override
  public Clock getObject() throws RuntimeException {
    return new DefaultClockImpl();
  }
View Full Code Here


    simProcessEngine.close();
    ProcessEngines.destroy();
  }

  private void recordEvents() {
    Clock clock = new DefaultClockImpl();
    ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
    config.setClock(clock);
    ProcessEngine processEngine = (new RecordableProcessEngineFactory(config, listener)).getObject();

    processEngine.getProcessEngineConfiguration().setClock(clock);
View Full Code Here

    HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().taskDefinitionKey("userTask").singleResult();
    assertEquals("user1", historicTaskInstance.getAssignee());
  }

  private void recordEvents() {
    Clock clock = new DefaultClockImpl();
    clock.setCurrentTime(new Date(0));
    ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
    config.setClock(clock);

    ProcessEngine processEngine = (new RecordableProcessEngineFactory(config, listener))
      .getObject();
View Full Code Here

  protected InMemoryRecordActivitiEventListener listener = new InMemoryRecordActivitiEventListener(getTransformers());


  @Override
  protected void initializeProcessEngine() {
    Clock clock = new DefaultClockImpl();

    ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
    processEngineConfiguration.setClock(clock);

    this.processEngine = (new RecordableProcessEngineFactory(
View Full Code Here

import org.activiti.engine.runtime.Clock;

public class CycleBusinessCalendarTest extends PvmTestCase {

  public void testSimpleCron() throws Exception {
    Clock testingClock = new DefaultClockImpl();
    CycleBusinessCalendar businessCalendar = new CycleBusinessCalendar(testingClock);

    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy MM dd - HH:mm");
    Date now = simpleDateFormat.parse("2011 03 11 - 17:23");
    testingClock.setCurrentTime(now);

    Date duedate = businessCalendar.resolveDuedate("0 0 0 1 * ?");

    Date expectedDuedate = simpleDateFormat.parse("2011 04 1 - 00:00");

View Full Code Here

    assertEquals(expectedDuedate, duedate);
  }

  public void testSimpleDuration() throws Exception {
    Clock testingClock = new DefaultClockImpl();
    CycleBusinessCalendar businessCalendar = new CycleBusinessCalendar(testingClock);

    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy MM dd - HH:mm");
    Date now = simpleDateFormat.parse("2010 06 11 - 17:23");
    testingClock.setCurrentTime(now);

    Date duedate = businessCalendar.resolveDuedate("R/P2DT5H70M");

    Date expectedDuedate = simpleDateFormat.parse("2010 06 13 - 23:33");
View Full Code Here

    assertEquals(parseCalendar("20131103-06:45:00", TimeZone.getTimeZone("UTC")), dh.getCalendarAfter(testingClock.getCurrentCalendar(TimeZone.getTimeZone("US/Eastern"))));
}

  @Test
  public void daylightSavingFallFirstHour() throws Exception {
    Clock testingClock = new DefaultClockImpl();
    testingClock.setCurrentCalendar(parseCalendar("20131103-05:45:00", TimeZone.getTimeZone("UTC")));
    Calendar easternTime = testingClock.getCurrentCalendar(TimeZone.getTimeZone("US/Eastern"));

    DurationHelper dh = new DurationHelper("R2/2013-11-03T01:45:00-04:00/PT1H", testingClock);

    assertEquals(parseCalendar("20131103-06:45:00", TimeZone.getTimeZone("UTC")), dh.getCalendarAfter(easternTime));
  }
View Full Code Here

    assertEquals(parseCalendar("20131103-06:45:00", TimeZone.getTimeZone("UTC")), dh.getCalendarAfter(easternTime));
  }

  @Test
  public void daylightSavingFallSecondHour() throws Exception {
    Clock testingClock = new DefaultClockImpl();
    testingClock.setCurrentCalendar(parseCalendar("20131103-06:45:00", TimeZone.getTimeZone("UTC")));
    Calendar easternTime = testingClock.getCurrentCalendar(TimeZone.getTimeZone("US/Eastern"));

    DurationHelper dh = new DurationHelper("R2/2013-11-03T01:45:00-05:00/PT1H", testingClock);

    assertEquals(parseCalendar("20131103-07:45:00", TimeZone.getTimeZone("UTC")), dh.getCalendarAfter(easternTime));
  }
View Full Code Here

  }


  @Test
  public void daylightSavingFallObservedFirstHour() throws Exception {
    Clock testingClock = new DefaultClockImpl();
    testingClock.setCurrentCalendar(parseCalendar("20131103-00:45:00", TimeZone.getTimeZone("US/Eastern")));

    DurationHelper dh = new DurationHelper("R2/2013-11-03T00:45:00-04:00/PT1H", testingClock);
    Calendar expected = parseCalendarWithOffset("20131103-01:45:00 -04:00", TimeZone.getTimeZone("US/Eastern"));

    assertEquals(expected, dh.getCalendarAfter());
View Full Code Here

    assertEquals(expected, dh.getCalendarAfter());
  }

  @Test
  public void daylightSavingFallObservedSecondHour() throws Exception {
    Clock testingClock = new DefaultClockImpl();
    testingClock.setCurrentCalendar(parseCalendar("20131103-00:45:00", TimeZone.getTimeZone("US/Eastern")));

    DurationHelper dh = new DurationHelper("R2/2013-11-03T00:45:00-04:00/PT2H", testingClock);
    Calendar expected = parseCalendarWithOffset("20131103-01:45:00 -05:00", TimeZone.getTimeZone("US/Eastern"));

    assertEquals(expected, dh.getCalendarAfter());
View Full Code Here

TOP

Related Classes of org.activiti.engine.impl.util.DefaultClockImpl

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.