use of org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl in project Activiti by Activiti.
the class ReplayEventLogTest method initProcessEngine.
private ProcessEngineImpl initProcessEngine() {
ProcessEngineConfigurationImpl configuration = getProcessEngineConfiguration();
ProcessEngineImpl processEngine = (ProcessEngineImpl) configuration.buildProcessEngine();
processEngine.getRepositoryService().createDeployment().addClasspathResource(THE_USERTASK_PROCESS).deploy();
return processEngine;
}
use of org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl in project Activiti by Activiti.
the class ReplayRunTest method initProcessEngine.
private ProcessEngineImpl initProcessEngine() {
ProcessEngineConfigurationImpl configuration = getProcessEngineConfiguration();
ProcessEngineImpl processEngine = (ProcessEngineImpl) configuration.buildProcessEngine();
processEngine.getRepositoryService().createDeployment().addClasspathResource(THE_USERTASK_PROCESS).deploy();
return processEngine;
}
use of org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl in project Activiti by Activiti.
the class ReplayRunTest method getProcessEngineConfiguration.
private ProcessEngineConfigurationImpl getProcessEngineConfiguration() {
ProcessEngineConfigurationImpl configuration = new org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration();
configuration.setHistory("full").setDatabaseSchemaUpdate("drop-create").setJobExecutorActivate(false);
configuration.setCustomDefaultBpmnParseHandlers(Arrays.<BpmnParseHandler>asList(new AddListenerUserTaskParseHandler(TaskListener.EVENTNAME_CREATE, new UserTaskExecutionListener(USER_TASK_COMPLETED_EVENT_TYPE, USER_TASK_COMPLETED_EVENT_TYPE, listener.getSimulationEvents()))));
configuration.setEventListeners(Arrays.<ActivitiEventListener>asList(listener));
return configuration;
}
use of org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl in project Activiti by Activiti.
the class ProcessEngineEndpoint method invoke.
@Override
public Map<String, Object> invoke() {
Map<String, Object> metrics = new HashMap<String, Object>();
// Process definitions
metrics.put("processDefinitionCount", processEngine.getRepositoryService().createProcessDefinitionQuery().count());
// List of all process definitions
List<ProcessDefinition> processDefinitions = processEngine.getRepositoryService().createProcessDefinitionQuery().orderByProcessDefinitionKey().asc().list();
List<String> processDefinitionKeys = new ArrayList<String>();
for (ProcessDefinition processDefinition : processDefinitions) {
processDefinitionKeys.add(processDefinition.getKey() + " (v" + processDefinition.getVersion() + ")");
}
metrics.put("deployedProcessDefinitions", processDefinitionKeys);
// Process instances
Map<String, Object> processInstanceCountMap = new HashMap<String, Object>();
metrics.put("runningProcessInstanceCount", processInstanceCountMap);
for (ProcessDefinition processDefinition : processDefinitions) {
processInstanceCountMap.put(processDefinition.getKey() + " (v" + processDefinition.getVersion() + ")", processEngine.getRuntimeService().createProcessInstanceQuery().processDefinitionId(processDefinition.getId()).count());
}
Map<String, Object> completedProcessInstanceCountMap = new HashMap<String, Object>();
metrics.put("completedProcessInstanceCount", completedProcessInstanceCountMap);
for (ProcessDefinition processDefinition : processDefinitions) {
completedProcessInstanceCountMap.put(processDefinition.getKey() + " (v" + processDefinition.getVersion() + ")", processEngine.getHistoryService().createHistoricProcessInstanceQuery().finished().processDefinitionId(processDefinition.getId()).count());
}
// Open tasks
metrics.put("openTaskCount", processEngine.getTaskService().createTaskQuery().count());
metrics.put("completedTaskCount", processEngine.getHistoryService().createHistoricTaskInstanceQuery().finished().count());
// Tasks completed today
metrics.put("completedTaskCountToday", processEngine.getHistoryService().createHistoricTaskInstanceQuery().finished().taskCompletedAfter(new Date(System.currentTimeMillis() - secondsForDays(1))).count());
// Process steps
metrics.put("completedActivities", processEngine.getHistoryService().createHistoricActivityInstanceQuery().finished().count());
// Process definition cache
DeploymentCache<ProcessDefinitionEntity> deploymentCache = ((ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration()).getProcessDefinitionCache();
if (deploymentCache instanceof DefaultDeploymentCache) {
metrics.put("cachedProcessDefinitionCount", ((DefaultDeploymentCache) deploymentCache).size());
}
return metrics;
}
use of org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl in project Activiti by Activiti.
the class ConnectionPoolTest method testMyBatisConnectionPoolProperlyConfigured.
public void testMyBatisConnectionPoolProperlyConfigured() {
ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("org/activiti/engine/test/db/connection-pool.activiti.cfg.xml");
config.buildProcessEngine();
// Expected values
int maxActive = 25;
int maxIdle = 10;
int maxCheckoutTime = 30000;
int maxWaitTime = 25000;
assertEquals(maxActive, config.getJdbcMaxActiveConnections());
assertEquals(maxIdle, config.getJdbcMaxIdleConnections());
assertEquals(maxCheckoutTime, config.getJdbcMaxCheckoutTime());
assertEquals(maxWaitTime, config.getJdbcMaxWaitTime());
// Verify that these properties are correctly set in the MyBatis datasource
DataSource datasource = config.getDbSqlSessionFactory().getSqlSessionFactory().getConfiguration().getEnvironment().getDataSource();
assertTrue(datasource instanceof PooledDataSource);
PooledDataSource pooledDataSource = (PooledDataSource) datasource;
assertEquals(maxActive, pooledDataSource.getPoolMaximumActiveConnections());
assertEquals(maxIdle, pooledDataSource.getPoolMaximumIdleConnections());
assertEquals(maxCheckoutTime, pooledDataSource.getPoolMaximumCheckoutTime());
assertEquals(maxWaitTime, pooledDataSource.getPoolTimeToWait());
}
Aggregations