Java Code Examples for org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration#setDbMetricsReporterActivate()
The following examples show how to use
org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration#setDbMetricsReporterActivate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SequentialJobAcquisitionTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@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()); }
Example 2
Source File: SequentialJobAcquisitionTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void testExecuteJobsForTwoEnginesSameAcquisition() { // configure and build a process engine StandaloneProcessEngineConfiguration engineConfiguration1 = new StandaloneInMemProcessEngineConfiguration(); engineConfiguration1.setProcessEngineName(getClass().getName() + "-engine1"); engineConfiguration1.setJdbcUrl("jdbc:h2:mem:activiti1"); engineConfiguration1.setJobExecutorActivate(false); engineConfiguration1.setJobExecutor(jobExecutor); engineConfiguration1.setDbMetricsReporterActivate(false); ProcessEngine engine1 = engineConfiguration1.buildProcessEngine(); createdProcessEngines.add(engine1); // and a second one StandaloneProcessEngineConfiguration engineConfiguration2 = new StandaloneInMemProcessEngineConfiguration(); engineConfiguration2.setProcessEngineName(getClass().getName() + "engine2"); engineConfiguration2.setJdbcUrl("jdbc:h2:mem:activiti2"); engineConfiguration2.setJobExecutorActivate(false); engineConfiguration2.setJobExecutor(jobExecutor); engineConfiguration2.setDbMetricsReporterActivate(false); ProcessEngine engine2 = engineConfiguration2.buildProcessEngine(); createdProcessEngines.add(engine2); // stop the acquisition jobExecutor.shutdown(); // deploy the processes engine1.getRepositoryService().createDeployment() .addClasspathResource(PROCESS_RESOURCE) .deploy(); engine2.getRepositoryService().createDeployment() .addClasspathResource(PROCESS_RESOURCE) .deploy(); // start one instance for each engine: engine1.getRuntimeService().startProcessInstanceByKey("intermediateTimerEventExample"); engine2.getRuntimeService().startProcessInstanceByKey("intermediateTimerEventExample"); Assert.assertEquals(1, engine1.getManagementService().createJobQuery().count()); Assert.assertEquals(1, engine2.getManagementService().createJobQuery().count()); Calendar calendar = Calendar.getInstance(); calendar.add(Field.DAY_OF_YEAR.getCalendarField(), 6); ClockUtil.setCurrentTime(calendar.getTime()); jobExecutor.start(); // assert task completed for the first engine waitForJobExecutorToProcessAllJobs(10000, 100, jobExecutor, engine1.getManagementService(), true); jobExecutor.start(); // assert task completed for the second engine waitForJobExecutorToProcessAllJobs(10000, 100, jobExecutor, engine2.getManagementService(), true); Assert.assertEquals(0, engine1.getManagementService().createJobQuery().count()); Assert.assertEquals(0, engine2.getManagementService().createJobQuery().count()); }
Example 3
Source File: SequentialJobAcquisitionTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void testJobAddedGuardForTwoEnginesSameAcquisition() throws InterruptedException { // configure and build a process engine StandaloneProcessEngineConfiguration engineConfiguration1 = new StandaloneInMemProcessEngineConfiguration(); engineConfiguration1.setProcessEngineName(getClass().getName() + "-engine1"); engineConfiguration1.setJdbcUrl("jdbc:h2:mem:activiti1"); engineConfiguration1.setJobExecutorActivate(false); engineConfiguration1.setJobExecutor(jobExecutor); engineConfiguration1.setDbMetricsReporterActivate(false); ProcessEngine engine1 = engineConfiguration1.buildProcessEngine(); createdProcessEngines.add(engine1); // and a second one StandaloneProcessEngineConfiguration engineConfiguration2 = new StandaloneInMemProcessEngineConfiguration(); engineConfiguration2.setProcessEngineName(getClass().getName() + "engine2"); engineConfiguration2.setJdbcUrl("jdbc:h2:mem:activiti2"); engineConfiguration2.setJobExecutorActivate(false); engineConfiguration2.setJobExecutor(jobExecutor); engineConfiguration2.setDbMetricsReporterActivate(false); ProcessEngine engine2 = engineConfiguration2.buildProcessEngine(); createdProcessEngines.add(engine2); // stop the acquisition jobExecutor.shutdown(); // deploy the processes engine1.getRepositoryService().createDeployment() .addClasspathResource(PROCESS_RESOURCE) .deploy(); engine2.getRepositoryService().createDeployment() .addClasspathResource(PROCESS_RESOURCE) .deploy(); // start one instance for each engine: engine1.getRuntimeService().startProcessInstanceByKey("intermediateTimerEventExample"); engine2.getRuntimeService().startProcessInstanceByKey("intermediateTimerEventExample"); Calendar calendar = Calendar.getInstance(); calendar.add(Field.DAY_OF_YEAR.getCalendarField(), 6); ClockUtil.setCurrentTime(calendar.getTime()); Assert.assertEquals(1, engine1.getManagementService().createJobQuery().count()); Assert.assertEquals(1, engine2.getManagementService().createJobQuery().count()); // assert task completed for the first engine jobExecutor.start(); waitForJobExecutorToProcessAllJobs(10000, 100, jobExecutor, engine1.getManagementService(), false); // assert task completed for the second engine jobExecutor.start(); waitForJobExecutorToProcessAllJobs(10000, 100, jobExecutor, engine2.getManagementService(), false); Thread.sleep(2000); Assert.assertFalse(((SequentialJobAcquisitionRunnable) jobExecutor.getAcquireJobsRunnable()).isJobAdded()); Assert.assertEquals(0, engine1.getManagementService().createJobQuery().count()); Assert.assertEquals(0, engine2.getManagementService().createJobQuery().count()); }