Package org.activiti.engine.runtime

Examples of org.activiti.engine.runtime.Clock


  public void testProcessInstanceStartEvents() throws Exception {
    recordEvents();

    final SimpleSimulationRun.Builder builder = new SimpleSimulationRun.Builder();
    // init simulation run
    Clock clock = new ThreadLocalClock(new DefaultClockFactory());
    ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
    config.setClock(clock);
    SimulationProcessEngineFactory simulationProcessEngineFactory = new SimulationProcessEngineFactory(config);
    final ProcessEngineImpl simProcessEngine = simulationProcessEngineFactory.getObject();
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

  }

  private SimulationDebugger createDebugger() {
    final SimpleSimulationRun.Builder builder = new SimpleSimulationRun.Builder();
    // init simulation run
    Clock clock = new ThreadLocalClock(new DefaultClockFactory());
    ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
    config.setClock(clock);

    SimulationProcessEngineFactory simulationProcessEngineFactory = new SimulationProcessEngineFactory(config);
    builder.processEngine(simulationProcessEngineFactory.getObject())
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

  private void runPlayback() throws Throwable {
    SimulationDebugger simDebugger = null;
    try {
      // init simulation run

      Clock clock = new ThreadLocalClock(new DefaultClockFactory());
      FactoryBean<ProcessEngineImpl> simulationProcessEngineFactory = new SimulationProcessEngineFactory(
        ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault()
      );

      final SimpleSimulationRun.Builder builder = new SimpleSimulationRun.Builder();
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

public class DurationHelperTest {

  @Test
  public void shouldNotExceedNumber() throws Exception {
    Clock testingClock = new DefaultClockImpl();
    testingClock.setCurrentTime(new Date(0));
    DurationHelper dh = new DurationHelper("R2/PT10S", testingClock);

    testingClock.setCurrentTime(new Date(15000));
    assertEquals(20000, dh.getDateAfter().getTime());

    testingClock.setCurrentTime(new Date(30000));
    assertEquals(30000, dh.getDateAfter().getTime());
  }
View Full Code Here

    assertEquals(30000, dh.getDateAfter().getTime());
  }

  @Test
  public void shouldNotExceedNumberPeriods() throws Exception {
    Clock testingClock = new DefaultClockImpl();
    testingClock.setCurrentTime(parse("19700101-00:00:00"));
    DurationHelper dh = new DurationHelper("R2/1970-01-01T00:00:00/1970-01-01T00:00:10", testingClock);

    testingClock.setCurrentTime(parse("19700101-00:00:15"));
    assertEquals(parse("19700101-00:00:20"), dh.getDateAfter());


    testingClock.setCurrentTime(parse("19700101-00:00:30"));
    assertEquals(parse("19700101-00:00:30"), dh.getDateAfter());
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.runtime.Clock

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.