private ProcessEngine createProcessEngine(String name) { StandaloneInMemProcessEngineConfiguration processEngineConfiguration = new StandaloneInMemProcessEngineConfiguration(); processEngineConfiguration.setProcessEngineName(name); processEngineConfiguration.setJdbcUrl(String.format("jdbc:h2:mem:%s", name)); return processEngineConfiguration.buildProcessEngine(); }
private static ProcessEngineConfigurationImpl config(final String schemaUpdate, final String historyLevel) { StandaloneInMemProcessEngineConfiguration engineConfiguration = new StandaloneInMemProcessEngineConfiguration(); engineConfiguration.setProcessEngineName(UUID.randomUUID().toString()); engineConfiguration.setDatabaseSchemaUpdate(schemaUpdate); engineConfiguration.setHistory(historyLevel); engineConfiguration.setDbMetricsReporterActivate(false); engineConfiguration.setJdbcUrl("jdbc:h2:mem:DatabaseHistoryPropertyAutoTest"); return engineConfiguration; }
private static ProcessEngineConfigurationImpl config(final String schemaUpdate, final String historyLevel) { StandaloneInMemProcessEngineConfiguration engineConfiguration = new StandaloneInMemProcessEngineConfiguration(); engineConfiguration.setProcessEngineName(UUID.randomUUID().toString()); engineConfiguration.setDatabaseSchemaUpdate(schemaUpdate); engineConfiguration.setHistory(historyLevel); engineConfiguration.setDbMetricsReporterActivate(false); engineConfiguration.setJdbcUrl("jdbc:h2:mem:DatabaseHistoryPropertyAutoTest"); return engineConfiguration; }
protected ProcessEngineConfigurationImpl createConfig() { StandaloneInMemProcessEngineConfiguration configuration = new StandaloneInMemProcessEngineConfiguration(); configuration.setProcessEngineName("process-engine-HistoryTest"); configuration.setDbMetricsReporterActivate(false); configuration.setJdbcUrl("jdbc:h2:mem:HistoryTest"); return configuration; }
@Test public void testForceCloseMybatisConnectionPoolTrue() { // given // that the process engine is configured with forceCloseMybatisConnectionPool = true ProcessEngineConfigurationImpl configurationImpl = new StandaloneInMemProcessEngineConfiguration() .setJdbcUrl("jdbc:h2:mem:camunda-forceclose") .setProcessEngineName("engine-forceclose") .setForceCloseMybatisConnectionPool(true); ProcessEngine processEngine = configurationImpl .buildProcessEngine(); PooledDataSource pooledDataSource = (PooledDataSource) configurationImpl.getDataSource(); PoolState state = pooledDataSource.getPoolState(); // then // if the process engine is closed processEngine.close(); // the idle connections are closed Assert.assertTrue(state.getIdleConnectionCount() == 0); }
@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); }
@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()); }
@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()); }
private ProcessEngine createProcessEngine(String name) { StandaloneInMemProcessEngineConfiguration processEngineConfiguration = new StandaloneInMemProcessEngineConfiguration(); processEngineConfiguration.setProcessEngineName(name); processEngineConfiguration.setJdbcUrl(String.format("jdbc:h2:mem:%s", name)); return processEngineConfiguration.buildProcessEngine(); }
config.setJdbcUrl(h2DbJdbcUrl); config.setDatabaseSchemaUpdate("false"); } else { config.setJdbcUrl(h2DbServerJdbcUrl); h2Server = startH2Server();
config.setJdbcUrl(h2DbJdbcUrl); config.setDatabaseSchemaUpdate("false"); } else { config.setJdbcUrl(h2DbServerJdbcUrl); h2Server = startH2Server();
private static ProcessEngineConfigurationImpl config(final String schemaUpdate, final String historyLevel) { StandaloneInMemProcessEngineConfiguration engineConfiguration = new StandaloneInMemProcessEngineConfiguration(); engineConfiguration.setProcessEngineName(UUID.randomUUID().toString()); engineConfiguration.setDatabaseSchemaUpdate(schemaUpdate); engineConfiguration.setHistory(historyLevel); engineConfiguration.setDbMetricsReporterActivate(false); engineConfiguration.setJdbcUrl("jdbc:h2:mem:DatabaseHistoryPropertyAutoTest"); return engineConfiguration; }
private static ProcessEngineConfigurationImpl config(final String schemaUpdate, final String historyLevel) { StandaloneInMemProcessEngineConfiguration engineConfiguration = new StandaloneInMemProcessEngineConfiguration(); engineConfiguration.setProcessEngineName(UUID.randomUUID().toString()); engineConfiguration.setDatabaseSchemaUpdate(schemaUpdate); engineConfiguration.setHistory(historyLevel); engineConfiguration.setDbMetricsReporterActivate(false); engineConfiguration.setJdbcUrl("jdbc:h2:mem:DatabaseHistoryPropertyAutoTest"); return engineConfiguration; }
protected ProcessEngineConfigurationImpl createConfig() { StandaloneInMemProcessEngineConfiguration configuration = new StandaloneInMemProcessEngineConfiguration(); configuration.setProcessEngineName("process-engine-HistoryTest"); configuration.setDbMetricsReporterActivate(false); configuration.setJdbcUrl("jdbc:h2:mem:HistoryTest"); return configuration; }
@Test public void testForceCloseMybatisConnectionPoolTrue() { // given // that the process engine is configured with forceCloseMybatisConnectionPool = true ProcessEngineConfigurationImpl configurationImpl = new StandaloneInMemProcessEngineConfiguration() .setJdbcUrl("jdbc:h2:mem:camunda-forceclose") .setProcessEngineName("engine-forceclose") .setForceCloseMybatisConnectionPool(true); ProcessEngine processEngine = configurationImpl .buildProcessEngine(); PooledDataSource pooledDataSource = (PooledDataSource) configurationImpl.getDataSource(); PoolState state = pooledDataSource.getPoolState(); // then // if the process engine is closed processEngine.close(); // the idle connections are closed Assert.assertTrue(state.getIdleConnectionCount() == 0); }
@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); }
@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()); }
@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()); }