本文整理汇总了Java中org.camunda.bpm.engine.ProcessEngine.close方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessEngine.close方法的具体用法?Java ProcessEngine.close怎么用?Java ProcessEngine.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.camunda.bpm.engine.ProcessEngine
的用法示例。
在下文中一共展示了ProcessEngine.close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get_eventBus_from_engine_composite
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@Test
public void get_eventBus_from_engine_composite() {
final CamundaEventBus eventBus = new CamundaEventBus();
ReactorProcessEnginePlugin plugin = new ReactorProcessEnginePlugin(eventBus);
ReactorProcessEngineConfiguration configuration = new ReactorProcessEngineConfiguration(eventBus);
configuration.getProcessEnginePlugins().clear();
configuration.getProcessEnginePlugins().add(new CompositeProcessEnginePlugin(plugin));
ProcessEngine engine = configuration.buildProcessEngine();
try {
assertThat(CamundaReactor.eventBus(engine)).isEqualTo(eventBus);
} finally {
engine.close();
}
}
示例2: restartEventingBundleAfterShutdown
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
/**
* If we stop the eventing bundle and restart it afterwards we want to receive
* events again.
*
* @throws FileNotFoundException
* @throws BundleException
* @throws InterruptedException
*/
@Test
public void restartEventingBundleAfterShutdown() throws FileNotFoundException, BundleException, InterruptedException {
final ProcessEngine processEngine = createProcessEngine();
deployProcess(processEngine, "longRunningTestProcess", "src/test/resources/eventing/longRunningTestProcess.bpmn");
stopEventingBundle();
processEngine.getRuntimeService().startProcessInstanceByKey("slowProcess");
TestEventHandler eventHandler = new TestEventHandler();
registerEventHandler(eventHandler);
startEventingBundle();
processEngine.getRuntimeService().startProcessInstanceByKey("slowProcess");
processEngine.close();
checkLogListener();
assertThat(eventHandler.endCalled(), is(true));
}
示例3: testForceCloseMybatisConnectionPoolTrue
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@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);
}
示例4: shouldInitTaskPermission
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@Test
public void shouldInitTaskPermission() {
ProcessEngine engine = null;
try {
// if
final TestProcessEngineCfg testProcessEngineCfg = new TestProcessEngineCfg();
engine = testProcessEngineCfg.setProcessEngineName("DefaultTaskPermissionsCfgTest-engine")
.setJdbcUrl(String.format("jdbc:h2:mem:%s", "DefaultTaskPermissionsCfgTest-engine-db"))
.setMetricsEnabled(false)
.setJobExecutorActivate(false)
.buildProcessEngine();
// then
assertTrue(testProcessEngineCfg.initMethodCalled);
} finally {
if(engine != null) {
engine.close();
}
}
}
示例5: cleanDatabase
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public void cleanDatabase(ProcessEngine engine) {
// delete all deployments
RepositoryService repositoryService = engine.getRepositoryService();
List<Deployment> deployments = repositoryService
.createDeploymentQuery()
.list();
for (Deployment deployment : deployments) {
repositoryService.deleteDeployment(deployment.getId(), true);
}
// drop DB
((ProcessEngineImpl)engine).getProcessEngineConfiguration()
.getCommandExecutorTxRequired()
.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
commandContext.getDbSqlSession().dbSchemaDrop();
return null;
}
});
engine.close();
}
示例6: get_eventBus_from_engine
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@Test
public void get_eventBus_from_engine() {
final CamundaEventBus eventBus = new CamundaEventBus();
ProcessEngine engine = new ReactorProcessEngineConfiguration(eventBus).buildProcessEngine();
try {
assertThat(CamundaReactor.eventBus(engine)).isEqualTo(eventBus);
} finally {
engine.close();
}
}
示例7: get_eventBus_from_default_engine
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@Test
public void get_eventBus_from_default_engine() {
CamundaEventBus camundaEventBus = new CamundaEventBus();
ProcessEngine engine = new ReactorProcessEngineConfiguration(camundaEventBus).buildProcessEngine();
try {
assertThat(CamundaReactor.eventBus()).isEqualTo(camundaEventBus);
} finally {
engine.close();
}
}
示例8: fails_to_get_eventBus_from_engine
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@Test
public void fails_to_get_eventBus_from_engine() {
ProcessEngine engine = new StandaloneInMemProcessEngineConfiguration(){{
setDatabaseSchemaUpdate(ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_DROP_CREATE);
}}.buildProcessEngine();
try {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("No eventBus found. Make sure the Reactor plugin is configured correctly.");
CamundaReactor.eventBus(engine);
} finally {
engine.close();
}
}
示例9: cleanUp
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@After
public void cleanUp() {
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
if (processEngine != null) {
processEngine.close();
}
}
示例10: testEventBrigde
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@Test
public void testEventBrigde() throws FileNotFoundException {
TestEventHandler eventHandler = new TestEventHandler();
registerEventHandler(eventHandler);
ProcessEngine processEngine = createProcessEngine();
deployProcess(processEngine, "testProcess", "src/test/resources/testprocess.bpmn");
processEngine.getRuntimeService().startProcessInstanceByKey("Process_1");
processEngine.close();
checkLogListener();
assertThat(eventHandler.isCalled(), is(true));
}
示例11: shutdownDuringRunningProcess
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
/**
* We don't want to receive any more events after shutting the bundle down.
*/
@Test
public void shutdownDuringRunningProcess() throws Exception {
TestEventHandler eventHandler = new TestEventHandler();
registerEventHandler(eventHandler);
final ProcessEngine processEngine = createProcessEngine();
deployProcess(processEngine, "longRunningTestProcess", "src/test/resources/eventing/longRunningTestProcess.bpmn");
stopEventingBundle();
processEngine.getRuntimeService().startProcessInstanceByKey("slowProcess");
processEngine.close();
checkLogListener();
assertThat(eventHandler.endCalled(), is(false));
}
示例12: deleted
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@Override
public void deleted(String pid) {
ProcessEngine engine = existingEngines.get(pid);
if (engine != null) {
engine.close();
existingEngines.remove(pid);
existingRegisteredEngines.get(pid).unregister();
existingRegisteredEngines.remove(pid);
}
}
示例13: testMyBatisConnectionPoolProperlyConfigured
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public void testMyBatisConnectionPoolProperlyConfigured() {
ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
.createProcessEngineConfigurationFromResource("org/camunda/bpm/engine/test/api/cfg/connection-pool.camunda.cfg.xml");
ProcessEngine engine = config.buildProcessEngine();
// Expected values
int maxActive = 25;
int maxIdle = 10;
int maxCheckoutTime = 30000;
int maxWaitTime = 25000;
Integer jdbcStatementTimeout = 300;
assertEquals(maxActive, config.getJdbcMaxActiveConnections());
assertEquals(maxIdle, config.getJdbcMaxIdleConnections());
assertEquals(maxCheckoutTime, config.getJdbcMaxCheckoutTime());
assertEquals(maxWaitTime, config.getJdbcMaxWaitTime());
assertEquals(jdbcStatementTimeout, config.getJdbcStatementTimeout());
// Verify that these properties are correctly set in the MyBatis datasource
Configuration sessionFactoryConfiguration = config.getDbSqlSessionFactory().getSqlSessionFactory().getConfiguration();
DataSource datasource = sessionFactoryConfiguration.getEnvironment().getDataSource();
assertTrue(datasource instanceof PooledDataSource);
PooledDataSource pooledDataSource = (PooledDataSource) datasource;
assertEquals(maxActive, pooledDataSource.getPoolMaximumActiveConnections());
assertEquals(maxIdle, pooledDataSource.getPoolMaximumIdleConnections());
assertEquals(maxCheckoutTime, pooledDataSource.getPoolMaximumCheckoutTime());
assertEquals(maxWaitTime, pooledDataSource.getPoolTimeToWait());
assertEquals(jdbcStatementTimeout, sessionFactoryConfiguration.getDefaultStatementTimeout());
engine.close();
}
示例14: testPerformDatabaseSchemaOperationCreateTwice
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public void testPerformDatabaseSchemaOperationCreateTwice() throws Exception {
// both process engines will be using this datasource.
PooledDataSource pooledDataSource = new PooledDataSource(ReflectUtil.getClassLoader(), "org.h2.Driver",
"jdbc:h2:mem:DatabaseTablePrefixTest;DB_CLOSE_DELAY=1000", "sa", "");
Connection connection = pooledDataSource.getConnection();
connection.createStatement().execute("drop schema if exists " + SCHEMA_NAME);
connection.createStatement().execute("create schema " + SCHEMA_NAME);
connection.close();
ProcessEngineConfigurationImpl config1 = createCustomProcessEngineConfiguration().setProcessEngineName("DatabaseTablePrefixTest-engine1")
// disable auto create/drop schema
.setDataSource(pooledDataSource).setDatabaseSchemaUpdate("NO_CHECK");
config1.setDatabaseTablePrefix(SCHEMA_NAME + ".");
config1.setDatabaseSchema(SCHEMA_NAME);
config1.setDbMetricsReporterActivate(false);
ProcessEngine engine1 = config1.buildProcessEngine();
// create the tables for the first time
connection = pooledDataSource.getConnection();
connection.createStatement().execute("set schema " + SCHEMA_NAME);
engine1.getManagementService().databaseSchemaUpgrade(connection, "", SCHEMA_NAME);
connection.close();
// create the tables for the second time; here we shouldn't crash since the
// session should tell us that the tables are already present and
// databaseSchemaUpdate is set to noop
connection = pooledDataSource.getConnection();
connection.createStatement().execute("set schema " + SCHEMA_NAME);
engine1.getManagementService().databaseSchemaUpgrade(connection, "", SCHEMA_NAME);
engine1.close();
}
示例15: main
import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) {
ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
.createProcessEngineConfigurationFromResource("camunda.cfg.xml");
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
// register test scenarios
ScenarioRunner runner = new ScenarioRunner(processEngine, ENGINE_VERSION);
// cmmn sentries
runner.setupScenarios(SentryScenario.class);
// compensation
runner.setupScenarios(SingleActivityCompensationScenario.class);
runner.setupScenarios(NestedCompensationScenario.class);
runner.setupScenarios(SingleActivityConcurrentCompensationScenario.class);
runner.setupScenarios(ParallelMultiInstanceCompensationScenario.class);
runner.setupScenarios(SequentialMultiInstanceCompensationScenario.class);
runner.setupScenarios(NestedMultiInstanceCompensationScenario.class);
runner.setupScenarios(InterruptingEventSubProcessCompensationScenario.class);
runner.setupScenarios(NonInterruptingEventSubProcessCompensationScenario.class);
runner.setupScenarios(InterruptingEventSubProcessNestedCompensationScenario.class);
// job
runner.setupScenarios(JobMigrationScenario.class);
// boundary events
runner.setupScenarios(NonInterruptingBoundaryEventScenario.class);
processEngine.close();
}