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());
}
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);
}
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();
}
};
}
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();
}
}
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());
}
Aggregations