Search in sources :

Example 16 with StandaloneInMemProcessEngineConfiguration

use of org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration in project camunda-bpm-platform by camunda.

the class SequentialJobAcquisitionTest method testExecuteJobsForSingleEngine.

@Test
public void testExecuteJobsForSingleEngine() {
    // configure and build a process engine
    StandaloneProcessEngineConfiguration standaloneProcessEngineConfiguration = new StandaloneInMemProcessEngineConfiguration();
    standaloneProcessEngineConfiguration.setProcessEngineName(getClass().getName() + "-engine1");
    standaloneProcessEngineConfiguration.setJdbcUrl("jdbc:h2:mem:jobexecutor-test-engine");
    standaloneProcessEngineConfiguration.setJobExecutorActivate(false);
    standaloneProcessEngineConfiguration.setJobExecutor(jobExecutor);
    standaloneProcessEngineConfiguration.setDbMetricsReporterActivate(false);
    ProcessEngine engine = standaloneProcessEngineConfiguration.buildProcessEngine();
    createdProcessEngines.add(engine);
    engine.getRepositoryService().createDeployment().addClasspathResource(PROCESS_RESOURCE).deploy();
    jobExecutor.shutdown();
    engine.getRuntimeService().startProcessInstanceByKey("intermediateTimerEventExample");
    Assert.assertEquals(1, engine.getManagementService().createJobQuery().count());
    Calendar calendar = Calendar.getInstance();
    calendar.add(Field.DAY_OF_YEAR.getCalendarField(), 6);
    ClockUtil.setCurrentTime(calendar.getTime());
    jobExecutor.start();
    waitForJobExecutorToProcessAllJobs(10000, 100, jobExecutor, engine.getManagementService(), true);
    Assert.assertEquals(0, engine.getManagementService().createJobQuery().count());
}
Also used : StandaloneProcessEngineConfiguration(org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration) Calendar(java.util.Calendar) StandaloneInMemProcessEngineConfiguration(org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) Test(org.junit.Test)

Aggregations

StandaloneInMemProcessEngineConfiguration (org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration)16 Test (org.junit.Test)8 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)6 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)6 StandaloneProcessEngineConfiguration (org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration)4 Calendar (java.util.Calendar)3 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)3 PoolState (org.apache.ibatis.datasource.pooled.PoolState)2 PooledDataSource (org.apache.ibatis.datasource.pooled.PooledDataSource)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 ObjectValue (org.camunda.bpm.engine.variable.value.ObjectValue)2 TaskService (org.camunda.bpm.engine.TaskService)1 ProcessEngineImpl (org.camunda.bpm.engine.impl.ProcessEngineImpl)1 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)1 Task (org.camunda.bpm.engine.task.Task)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1