use of org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration 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);
}
use of org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration in project camunda-bpm-platform by camunda.
the class DatabaseTableSchemaTest method testCreateConfigurationWithMismatchtingSchemaAndPrefix.
public void testCreateConfigurationWithMismatchtingSchemaAndPrefix() {
try {
StandaloneInMemProcessEngineConfiguration configuration = new StandaloneInMemProcessEngineConfiguration();
configuration.setDatabaseSchema("foo");
configuration.setDatabaseTablePrefix("bar");
configuration.buildProcessEngine();
fail("Should throw exception");
} catch (ProcessEngineException e) {
// as expected
assertTrue(e.getMessage().contains("When setting a schema the prefix has to be schema + '.'"));
}
}
use of org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration in project camunda-bpm-platform by camunda.
the class FallbackSerializerFactoryTest method testFallbackSerializerDoesNotOverrideRegularSerializer.
@Test
public void testFallbackSerializerDoesNotOverrideRegularSerializer() {
// given
// that the process engine is configured with a serializer for a certain format
// and a fallback serializer factory for the same format
ProcessEngineConfigurationImpl engineConfiguration = new StandaloneInMemProcessEngineConfiguration().setJdbcUrl("jdbc:h2:mem:camunda-forceclose").setProcessEngineName("engine-forceclose");
engineConfiguration.setCustomPreVariableSerializers(Arrays.<TypedValueSerializer>asList(new ExampleConstantSerializer()));
engineConfiguration.setFallbackSerializerFactory(new ExampleSerializerFactory());
processEngine = engineConfiguration.buildProcessEngine();
deployOneTaskProcess(processEngine);
// when setting a variable that no regular serializer can handle
ObjectValue objectValue = Variables.objectValue("foo").serializationDataFormat(ExampleSerializer.FORMAT).create();
ProcessInstance pi = processEngine.getRuntimeService().startProcessInstanceByKey("oneTaskProcess", Variables.createVariables().putValueTyped("var", objectValue));
ObjectValue fetchedValue = processEngine.getRuntimeService().getVariableTyped(pi.getId(), "var", true);
// then the fallback serializer is used
Assert.assertNotNull(fetchedValue);
Assert.assertEquals(ExampleSerializer.FORMAT, fetchedValue.getSerializationDataFormat());
Assert.assertEquals(ExampleConstantSerializer.DESERIALIZED_VALUE, fetchedValue.getValue());
}
use of org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration in project camunda-bpm-platform by camunda.
the class FallbackSerializerFactoryTest method testFallbackSerializer.
@Test
public void testFallbackSerializer() {
// given
// that the process engine is configured with a fallback serializer factory
ProcessEngineConfigurationImpl engineConfiguration = new StandaloneInMemProcessEngineConfiguration().setJdbcUrl("jdbc:h2:mem:camunda-forceclose").setProcessEngineName("engine-forceclose");
engineConfiguration.setFallbackSerializerFactory(new ExampleSerializerFactory());
processEngine = engineConfiguration.buildProcessEngine();
deployOneTaskProcess(processEngine);
// when setting a variable that no regular serializer can handle
ObjectValue objectValue = Variables.objectValue("foo").serializationDataFormat(ExampleSerializer.FORMAT).create();
ProcessInstance pi = processEngine.getRuntimeService().startProcessInstanceByKey("oneTaskProcess", Variables.createVariables().putValueTyped("var", objectValue));
ObjectValue fetchedValue = processEngine.getRuntimeService().getVariableTyped(pi.getId(), "var", true);
// then the fallback serializer is used
Assert.assertNotNull(fetchedValue);
Assert.assertEquals(ExampleSerializer.FORMAT, fetchedValue.getSerializationDataFormat());
Assert.assertEquals("foo", fetchedValue.getValue());
}
use of org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration in project camunda-bpm-platform by camunda.
the class HistoryLevelTest method createConfig.
protected ProcessEngineConfigurationImpl createConfig() {
StandaloneInMemProcessEngineConfiguration configuration = new StandaloneInMemProcessEngineConfiguration();
configuration.setProcessEngineName("process-engine-HistoryTest");
configuration.setDbMetricsReporterActivate(false);
configuration.setJdbcUrl("jdbc:h2:mem:HistoryTest");
return configuration;
}
Aggregations