Search in sources :

Example 26 with ProcessEngineConfigurationImpl

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

the class StringUtil method toByteArray.

/**
 * Gets the bytes from a string using the current process engine's default charset
 *
 * @param string the string to get the bytes form
 * @return the byte array
 */
public static byte[] toByteArray(String string) {
    EnsureUtil.ensureActiveCommandContext("StringUtil.toByteArray");
    ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
    return toByteArray(string, processEngineConfiguration.getProcessEngine());
}
Also used : ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 27 with ProcessEngineConfigurationImpl

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

the class StringUtil method toByteArray.

/**
 * Gets the bytes from a string using the provided process engine's default charset
 *
 * @param string the string to get the bytes form
 * @param processEngine the process engine to use
 * @return the byte array
 */
public static byte[] toByteArray(String string, ProcessEngine processEngine) {
    ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration();
    Charset charset = processEngineConfiguration.getDefaultCharset();
    return string.getBytes(charset);
}
Also used : Charset(java.nio.charset.Charset) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) ProcessEngineImpl(org.camunda.bpm.engine.impl.ProcessEngineImpl)

Example 28 with ProcessEngineConfigurationImpl

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

the class RedeploymentRegistrationTest method caseDefinitionTestProvider.

protected static TestProvider caseDefinitionTestProvider() {
    return new TestProvider() {

        @Override
        public Command<ProcessApplicationReference> createGetProcessApplicationCommand(final String definitionId) {
            return new Command<ProcessApplicationReference>() {

                public ProcessApplicationReference execute(CommandContext commandContext) {
                    ProcessEngineConfigurationImpl configuration = commandContext.getProcessEngineConfiguration();
                    DeploymentCache deploymentCache = configuration.getDeploymentCache();
                    CaseDefinitionEntity definition = deploymentCache.findDeployedCaseDefinitionById(definitionId);
                    return ProcessApplicationContextUtil.getTargetProcessApplication(definition);
                }
            };
        }

        @Override
        public String getLatestDefinitionIdByKey(RepositoryService repositoryService, String key) {
            return repositoryService.createCaseDefinitionQuery().caseDefinitionKey(key).latestVersion().singleResult().getId();
        }
    };
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) Command(org.camunda.bpm.engine.impl.interceptor.Command) CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) RepositoryService(org.camunda.bpm.engine.RepositoryService)

Example 29 with ProcessEngineConfigurationImpl

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

the class PlatformJobExecutorActivateTest method shouldAutoActivateIfNoPropertySet.

@Test
public void shouldAutoActivateIfNoPropertySet() {
    // given
    JobExecutorXmlImpl jobExecutorXml = defineJobExecutor();
    ProcessEngineXmlImpl processEngineXml = defineProcessEngine();
    BpmPlatformXmlImpl bpmPlatformXml = new BpmPlatformXmlImpl(jobExecutorXml, Collections.<ProcessEngineXml>singletonList(processEngineXml));
    // when
    deployPlatform(bpmPlatformXml);
    try {
        ProcessEngine processEngine = getProcessEngine(ENGINE_NAME);
        ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
        // then
        assertEquals(true, processEngineConfiguration.getJobExecutor().isActive());
    } finally {
        undeployPlatform();
    }
}
Also used : ProcessEngineXmlImpl(org.camunda.bpm.container.impl.metadata.ProcessEngineXmlImpl) JobExecutorXmlImpl(org.camunda.bpm.container.impl.metadata.JobExecutorXmlImpl) BpmPlatformXmlImpl(org.camunda.bpm.container.impl.metadata.BpmPlatformXmlImpl) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) Test(org.junit.Test)

Example 30 with ProcessEngineConfigurationImpl

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

the class PropertyHelperTest method testConfigurationPropertiesWithMismatchingFieldAndSetter.

/**
 * Assures that property names are matched on the setter name according to java beans conventions
 * and not on the field name.
 */
public void testConfigurationPropertiesWithMismatchingFieldAndSetter() {
    ProcessEngineConfigurationImpl engineConfiguration = new StandaloneProcessEngineConfiguration();
    Map<String, String> propertiesToSet = new HashMap<String, String>();
    propertiesToSet.put(DB_IDENTITY_USED_PROP, "false");
    PropertyHelper.applyProperties(engineConfiguration, propertiesToSet);
    Assert.assertFalse(engineConfiguration.isDbIdentityUsed());
    propertiesToSet.put(DB_IDENTITY_USED_PROP, "true");
    PropertyHelper.applyProperties(engineConfiguration, propertiesToSet);
    Assert.assertTrue(engineConfiguration.isDbIdentityUsed());
}
Also used : StandaloneProcessEngineConfiguration(org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration) HashMap(java.util.HashMap) 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