Java Code Examples for org.camunda.bpm.engine.ProcessEngine#getManagementService()
The following examples show how to use
org.camunda.bpm.engine.ProcessEngine#getManagementService() .
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: HistoryCleanupOnEngineBootstrapTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void testDecreaseNumberOfHistoryCleanupJobs() { // given // create history cleanup job ProcessEngine engine = ProcessEngineConfiguration .createProcessEngineConfigurationFromResource("org/camunda/bpm/engine/test/history/history-cleanup-parallelism-default.camunda.cfg.xml") .buildProcessEngine(); // assume ManagementService managementService = engine.getManagementService(); assertEquals(4, managementService.createJobQuery().list().size()); engine.close(); // when engine = ProcessEngineConfiguration .createProcessEngineConfigurationFromResource("org/camunda/bpm/engine/test/history/history-cleanup-parallelism-less.camunda.cfg.xml") .buildProcessEngine(); // then // reconfigure history cleanup job managementService = engine.getManagementService(); assertEquals(1, managementService.createJobQuery().list().size()); Job job = managementService.createJobQuery().singleResult(); assertEquals(0, getHistoryCleanupJobHandlerConfiguration(job).getMinuteFrom()); assertEquals(59, getHistoryCleanupJobHandlerConfiguration(job).getMinuteTo()); closeProcessEngine(engine); }
Example 2
Source File: EnsureCleanDbPlugin.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@SuppressWarnings("resource") @Override public void postProcessApplicationUndeploy(ProcessApplicationInterface processApplication) { // some tests deploy multiple PAs. => only clean DB after last PA is undeployed // if the deployment fails for example during parsing the deployment counter was not incremented // so we have to check if the counter is already zero otherwise we go into the negative values // best example is TestWarDeploymentWithBrokenBpmnXml in integration-test-engine test suite if(counter.get() == 0 || counter.decrementAndGet() == 0) { final ProcessEngine defaultProcessEngine = BpmPlatform.getDefaultProcessEngine(); try { logger.log(Level.INFO, "=== Ensure Clean Database ==="); ManagementServiceImpl managementService = (ManagementServiceImpl) defaultProcessEngine.getManagementService(); PurgeReport report = managementService.purge(); if (report.isEmpty()) { logger.log(Level.INFO, "Clean DB and cache."); } else { StringBuilder builder = new StringBuilder(); DatabasePurgeReport databasePurgeReport = report.getDatabasePurgeReport(); if (!databasePurgeReport.isEmpty()) { builder.append(DATABASE_NOT_CLEAN).append(databasePurgeReport.getPurgeReportAsString()); } CachePurgeReport cachePurgeReport = report.getCachePurgeReport(); if (!cachePurgeReport.isEmpty()) { builder.append(CACHE_IS_NOT_CLEAN).append(cachePurgeReport.getPurgeReportAsString()); } logger.log(Level.INFO, builder.toString()); } } catch(Throwable e) { logger.log(Level.SEVERE, "Could not clean DB:", e); } } }
Example 3
Source File: SetVariablesScenario.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@DescribesScenario("setVariablesScenario") public static ScenarioSetup createUserOperationLogEntries() { return new ScenarioSetup() { @Override public void execute(ProcessEngine engine, String scenarioName) { RuntimeService runtimeService = engine.getRuntimeService(); ProcessInstance processInstanceWithInitialVariables = runtimeService.createProcessInstanceQuery() .processDefinitionKey("asyncBeforeStartProcess_712") .processInstanceBusinessKey("712_ProcessIntanceExecuted") .singleResult(); ManagementService managementService = engine.getManagementService(); Job firstJob = managementService.createJobQuery() .processDefinitionKey("asyncBeforeStartProcess_712") .processInstanceId(processInstanceWithInitialVariables.getId()) .singleResult(); try { managementService.executeJob(firstJob.getId()); } catch (Exception e) { // ignore } ProcessInstance processInstance = runtimeService.createProcessInstanceQuery() .processDefinitionKey("asyncBeforeStartProcess_712") .processInstanceBusinessKey("7120_ProcessIntanceWithoutExecute") .singleResult(); runtimeService.setVariable(processInstance.getId(), "foo", "value"); runtimeService.setVariableLocal(processInstance.getId(), "local", "foo1"); } }; }
Example 4
Source File: TestFixture.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public TestFixture(ProcessEngine processEngine) { this.processEngine = processEngine; repositoryService = processEngine.getRepositoryService(); runtimeService = processEngine.getRuntimeService(); managementService = processEngine.getManagementService(); taskService = processEngine.getTaskService(); }
Example 5
Source File: TestFixture.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public TestFixture(ProcessEngine processEngine) { this.processEngine = processEngine; repositoryService = processEngine.getRepositoryService(); runtimeService = processEngine.getRuntimeService(); managementService = processEngine.getManagementService(); taskService = processEngine.getTaskService(); }
Example 6
Source File: HistoryCleanupOnEngineBootstrapTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void testIncreaseNumberOfHistoryCleanupJobs() { // given // create history cleanup job ProcessEngine engine = ProcessEngineConfiguration .createProcessEngineConfigurationFromResource("org/camunda/bpm/engine/test/history/history-cleanup-parallelism-default.camunda.cfg.xml") .buildProcessEngine(); // assume ManagementService managementService = engine.getManagementService(); assertEquals(4, managementService.createJobQuery().count()); engine.close(); // when engine = ProcessEngineConfiguration .createProcessEngineConfigurationFromResource("org/camunda/bpm/engine/test/history/history-cleanup-parallelism-more.camunda.cfg.xml") .buildProcessEngine(); // then // reconfigure history cleanup job managementService = engine.getManagementService(); List<Job> jobs = managementService.createJobQuery().list(); assertEquals(8, jobs.size()); for (Job job : jobs) { int minuteTo = getHistoryCleanupJobHandlerConfiguration(job).getMinuteTo(); int minuteFrom = getHistoryCleanupJobHandlerConfiguration(job).getMinuteFrom(); if (minuteFrom == 0) { assertEquals(6, minuteTo); } else if (minuteFrom == 7) { assertEquals(13, minuteTo); } else if (minuteFrom == 14) { assertEquals(20, minuteTo); } else if (minuteFrom == 21) { assertEquals(27, minuteTo); } else if (minuteFrom == 28) { assertEquals(34, minuteTo); } else if (minuteFrom == 35) { assertEquals(41, minuteTo); } else if (minuteFrom == 42) { assertEquals(48, minuteTo); } else if (minuteFrom == 49) { assertEquals(59, minuteTo); } else { fail("unexpected minute from " + minuteFrom); } } closeProcessEngine(engine); }