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());
}
Aggregations