Search in sources :

Example 36 with ProcessEngineConfigurationImpl

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

the class DmnEngineConfigurationTest method setFeelEngineFactory.

@Test
public void setFeelEngineFactory() {
    // given a DMN engine configuration with feel engine factory
    DefaultDmnEngineConfiguration dmnEngineConfiguration = (DefaultDmnEngineConfiguration) DmnEngineConfiguration.createDefaultDmnEngineConfiguration();
    FeelEngineFactory feelEngineFactory = mock(FeelEngineFactory.class);
    dmnEngineConfiguration.setFeelEngineFactory(feelEngineFactory);
    ProcessEngineConfigurationImpl processEngineConfiguration = createProcessEngineConfiguration();
    processEngineConfiguration.setDmnEngineConfiguration(dmnEngineConfiguration);
    // when the engine is initialized
    engine = processEngineConfiguration.buildProcessEngine();
    // then the feel engine factory should be set on the DMN engine
    assertThat(getConfigurationOfDmnEngine().getFeelEngineFactory(), is(feelEngineFactory));
}
Also used : DefaultDmnEngineConfiguration(org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) FeelEngineFactory(org.camunda.bpm.dmn.feel.impl.FeelEngineFactory) Test(org.junit.Test)

Example 37 with ProcessEngineConfigurationImpl

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

the class ForceCloseMybatisConnectionPoolTest method testForceCloseMybatisConnectionPoolFalse.

@Test
public void testForceCloseMybatisConnectionPoolFalse() {
    // given
    // that the process engine is configured with forceCloseMybatisConnectionPool = false
    ProcessEngineConfigurationImpl configurationImpl = new StandaloneInMemProcessEngineConfiguration().setJdbcUrl("jdbc:h2:mem:camunda-forceclose").setProcessEngineName("engine-forceclose").setForceCloseMybatisConnectionPool(false);
    ProcessEngine processEngine = configurationImpl.buildProcessEngine();
    PooledDataSource pooledDataSource = (PooledDataSource) configurationImpl.getDataSource();
    PoolState state = pooledDataSource.getPoolState();
    int idleConnections = state.getIdleConnectionCount();
    // then
    // if the process engine is closed
    processEngine.close();
    // the idle connections are not closed
    Assert.assertEquals(state.getIdleConnectionCount(), idleConnections);
    pooledDataSource.forceCloseAll();
    Assert.assertTrue(state.getIdleConnectionCount() == 0);
}
Also used : PoolState(org.apache.ibatis.datasource.pooled.PoolState) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) StandaloneInMemProcessEngineConfiguration(org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) PooledDataSource(org.apache.ibatis.datasource.pooled.PooledDataSource) Test(org.junit.Test)

Example 38 with ProcessEngineConfigurationImpl

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

the class MyFormFieldValidator method validate.

public boolean validate(Object submittedValue, FormFieldValidatorContext validatorContext) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    IdentityService identityService = processEngineConfiguration.getIdentityService();
    RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
    logAuthentication(identityService);
    logInstancesCount(runtimeService);
    return true;
}
Also used : IdentityService(org.camunda.bpm.engine.IdentityService) RuntimeService(org.camunda.bpm.engine.RuntimeService) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 39 with ProcessEngineConfigurationImpl

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

the class DatabaseHistoryPropertyAutoTest method usesDefaultValueAuditWhenNoValueIsConfigured.

@Test
public void usesDefaultValueAuditWhenNoValueIsConfigured() {
    final ProcessEngineConfigurationImpl config = config("true", ProcessEngineConfiguration.HISTORY_AUTO);
    ProcessEngineImpl processEngine = buildEngine(config);
    final Integer level = config.getCommandExecutorSchemaOperations().execute(new Command<Integer>() {

        @Override
        public Integer execute(CommandContext commandContext) {
            return HistoryLevelSetupCommand.databaseHistoryLevel(commandContext);
        }
    });
    assertThat(level, equalTo(HistoryLevel.HISTORY_LEVEL_AUDIT.getId()));
    assertThat(processEngine.getProcessEngineConfiguration().getHistoryLevel(), equalTo(HistoryLevel.HISTORY_LEVEL_AUDIT));
}
Also used : CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) ProcessEngineImpl(org.camunda.bpm.engine.impl.ProcessEngineImpl) Test(org.junit.Test)

Example 40 with ProcessEngineConfigurationImpl

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

the class MyTaskFormHandler method createTaskForm.

public TaskFormData createTaskForm(TaskEntity task) {
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    IdentityService identityService = processEngineConfiguration.getIdentityService();
    RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
    logAuthentication(identityService);
    logInstancesCount(runtimeService);
    TaskFormDataImpl result = new TaskFormDataImpl();
    result.setTask(task);
    return result;
}
Also used : IdentityService(org.camunda.bpm.engine.IdentityService) TaskFormDataImpl(org.camunda.bpm.engine.impl.form.TaskFormDataImpl) RuntimeService(org.camunda.bpm.engine.RuntimeService) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Aggregations

ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)161 Test (org.junit.Test)35 HistoryLevel (org.camunda.bpm.engine.impl.history.HistoryLevel)22 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)18 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)17 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)17 HistoryEvent (org.camunda.bpm.engine.impl.history.event.HistoryEvent)13 HistoryEventProcessor (org.camunda.bpm.engine.impl.history.event.HistoryEventProcessor)12 HistoryEventProducer (org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer)12 Before (org.junit.Before)11 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)8 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)8 After (org.junit.After)8 Date (java.util.Date)7 PooledDataSource (org.apache.ibatis.datasource.pooled.PooledDataSource)7 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)7 DefaultDmnEngineConfiguration (org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration)7 IdentityService (org.camunda.bpm.engine.IdentityService)7 ProcessEngineImpl (org.camunda.bpm.engine.impl.ProcessEngineImpl)7 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)6