Java Code Examples for org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl#buildProcessEngine()

The following examples show how to use org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl#buildProcessEngine() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LeaveJpaEntityTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
protected void initializeProcessEngine() {
    if (cachedProcessEngine == null) {
        ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
                .createProcessEngineConfigurationFromResource("activiti.jpa.cfg.xml");

        cachedProcessEngine = processEngineConfiguration.buildProcessEngine();

        EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration
                .getSessionFactories()
                .get(EntityManagerSession.class);

        System.out.println("entityManagerSessionFactory=" + entityManagerSessionFactory);
        entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
    }
    processEngine = cachedProcessEngine;
}
 
Example 2
Source File: HistoricJPAVariableTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Override
protected void initializeProcessEngine() {
  if (cachedProcessEngine==null) {
    ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
      .createProcessEngineConfigurationFromResource("org/activiti5/standalone/jpa/activiti.cfg.xml");
    
    cachedProcessEngine = processEngineConfiguration.buildProcessEngine();
    
    org.activiti5.engine.impl.cfg.ProcessEngineConfigurationImpl activiti5ProcessEngineConfig = (org.activiti5.engine.impl.cfg.ProcessEngineConfigurationImpl) 
        ((ProcessEngineConfigurationImpl) cachedProcessEngine.getProcessEngineConfiguration()).getActiviti5CompatibilityHandler().getRawProcessConfiguration();

    EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) activiti5ProcessEngineConfig
      .getSessionFactories()
      .get(EntityManagerSession.class);
    
    entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
  }
  processEngine = cachedProcessEngine;
}
 
Example 3
Source File: AsyncExecutorTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
private ProcessEngine createProcessEngine(boolean enableAsyncExecutor, Date time) {
  ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneInMemProcessEngineConfiguration();
  processEngineConfiguration.setJdbcUrl("jdbc:h2:mem:activiti-AsyncExecutorTest;DB_CLOSE_DELAY=1000");
  processEngineConfiguration.setDatabaseSchemaUpdate("true");

  if (enableAsyncExecutor) {
    processEngineConfiguration.setAsyncExecutorActivate(true);

    CountingAsyncExecutor countingAsyncExecutor = new CountingAsyncExecutor();
    countingAsyncExecutor.setDefaultAsyncJobAcquireWaitTimeInMillis(50); // To avoid waiting too long when a retry happens
    countingAsyncExecutor.setDefaultTimerJobAcquireWaitTimeInMillis(50);
    processEngineConfiguration.setAsyncExecutor(countingAsyncExecutor);
  }

  ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();

  if (time != null) {
    processEngine.getProcessEngineConfiguration().getClock().setCurrentTime(time);
  }

  return processEngine;
}
 
Example 4
Source File: JPAEnhancedVariableTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Override
protected void initializeProcessEngine() {
  if (cachedProcessEngine == null) {
    ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
        .createProcessEngineConfigurationFromResource("org/activiti5/standalone/jpa/activiti.cfg.xml");

    cachedProcessEngine = processEngineConfiguration.buildProcessEngine();
    
    activiti5ProcessEngineConfig = (org.activiti5.engine.impl.cfg.ProcessEngineConfigurationImpl) 
        ((ProcessEngineConfigurationImpl) cachedProcessEngine.getProcessEngineConfiguration()).getActiviti5CompatibilityHandler().getRawProcessConfiguration();

    EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) activiti5ProcessEngineConfig
        .getSessionFactories()
        .get(EntityManagerSession.class);

    entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();

    setupJPAVariables();
  }
  processEngine = cachedProcessEngine;
}
 
Example 5
Source File: JPAVariableTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
protected void initializeProcessEngine() {
  if (cachedProcessEngine==null) {
    ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
      .createProcessEngineConfigurationFromResource("org/activiti5/standalone/jpa/activiti.cfg.xml");
    
    cachedProcessEngine = processEngineConfiguration.buildProcessEngine();
    
    org.activiti5.engine.impl.cfg.ProcessEngineConfigurationImpl activiti5ProcessEngineConfig = (org.activiti5.engine.impl.cfg.ProcessEngineConfigurationImpl) 
        ((ProcessEngineConfigurationImpl) cachedProcessEngine.getProcessEngineConfiguration()).getActiviti5CompatibilityHandler().getRawProcessConfiguration();

    EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) activiti5ProcessEngineConfig
      .getSessionFactories()
      .get(EntityManagerSession.class);
    
    entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
  }
  processEngine = cachedProcessEngine;
}
 
Example 6
Source File: JPAEnhancedVariableTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Override
protected void initializeProcessEngine() {
  if (cachedProcessEngine == null) {
    ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
        .createProcessEngineConfigurationFromResource("org/activiti/standalone/jpa/activiti.cfg.xml");

    cachedProcessEngine = processEngineConfiguration.buildProcessEngine();

    EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration.getSessionFactories().get(EntityManagerSession.class);

    entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();

    setupJPAVariables();
  }
  processEngine = cachedProcessEngine;
}
 
Example 7
Source File: HistoricJPAVariableTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Override
protected void initializeProcessEngine() {
	if (cachedProcessEngine==null) {
		ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
			.createProcessEngineConfigurationFromResource("org/activiti/standalone/jpa/activiti.cfg.xml");

		cachedProcessEngine = processEngineConfiguration.buildProcessEngine();

		EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration
			.getSessionFactories()
			.get(EntityManagerSession.class);

		entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
	}
	processEngine = cachedProcessEngine;
}
 
Example 8
Source File: AsyncExecutorTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
private ProcessEngine createProcessEngine(boolean enableAsyncExecutor, Date time) {
	ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneInMemProcessEngineConfiguration();
	processEngineConfiguration.setJdbcUrl("jdbc:h2:mem:activiti-AsyncExecutorTest;DB_CLOSE_DELAY=1000");
	processEngineConfiguration.setDatabaseSchemaUpdate("true");
	processEngineConfiguration.setActiviti5CompatibilityEnabled(true);
	
	if (enableAsyncExecutor) {
		processEngineConfiguration.setAsyncExecutorActivate(true);
		
		CountingAsyncExecutor countingAsyncExecutor = new CountingAsyncExecutor();
    countingAsyncExecutor.setDefaultAsyncJobAcquireWaitTimeInMillis(100); // To avoid waiting too long when a retry happens
    countingAsyncExecutor.setDefaultTimerJobAcquireWaitTimeInMillis(100);
    processEngineConfiguration.setAsyncExecutor(countingAsyncExecutor);
	}

	ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
	
	if (time != null) {
	  processEngine.getProcessEngineConfiguration().getClock().setCurrentTime(time);
	}
	
	return processEngine;
}
 
Example 9
Source File: ReplayEventLogTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
private ProcessEngineImpl initProcessEngine() {
  ProcessEngineConfigurationImpl configuration = getProcessEngineConfiguration();
  ProcessEngineImpl processEngine = (ProcessEngineImpl) configuration.buildProcessEngine();

  processEngine.getRepositoryService().
      createDeployment().
      addClasspathResource(THE_USERTASK_PROCESS).
      deploy();
  return processEngine;
}
 
Example 10
Source File: LeaveJpaEntityTest.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
protected void initializeProcessEngine() {
    if (cachedProcessEngine == null) {
        ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
                .createProcessEngineConfigurationFromResource("activiti.jpa.cfg.xml");

        cachedProcessEngine = processEngineConfiguration.buildProcessEngine();

        EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration
                .getSessionFactories()
                .get(EntityManagerSession.class);

        entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
    }
    processEngine = cachedProcessEngine;
}
 
Example 11
Source File: LeaveJpaEntityTest.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
protected void initializeProcessEngine() {
    if (cachedProcessEngine == null) {
        ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
                .createProcessEngineConfigurationFromResource("activiti.jpa.cfg.xml");

        cachedProcessEngine = processEngineConfiguration.buildProcessEngine();

        EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration
                .getSessionFactories()
                .get(EntityManagerSession.class);

        entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
    }
    processEngine = cachedProcessEngine;
}
 
Example 12
Source File: ConnectionPoolTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testMyBatisConnectionPoolProperlyConfigured() {
  ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
    .createProcessEngineConfigurationFromResource("org/activiti5/engine/test/db/connection-pool.activiti.cfg.xml");
  
  config.buildProcessEngine();
  
  // Expected values
  int maxActive = 25;
  int maxIdle = 10;
  int maxCheckoutTime = 30000;
  int maxWaitTime = 25000;
  
  assertEquals(maxActive, config.getJdbcMaxActiveConnections());
  assertEquals(maxIdle, config.getJdbcMaxIdleConnections());
  assertEquals(maxCheckoutTime, config.getJdbcMaxCheckoutTime());
  assertEquals(maxWaitTime, config.getJdbcMaxWaitTime());
  
  // Verify that these properties are correctly set in the MyBatis datasource
  DataSource datasource = config.getDbSqlSessionFactory().getSqlSessionFactory().getConfiguration().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());
}
 
Example 13
Source File: RetryInterceptorTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Before
public void setupProcessEngine() {
  ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) new StandaloneInMemProcessEngineConfiguration();
  processEngineConfiguration.setJdbcUrl("jdbc:h2:mem:retryInterceptorTest");
  List<CommandInterceptor> interceptors = new ArrayList<CommandInterceptor>();
  retryInterceptor = new RetryInterceptor();
  interceptors.add(retryInterceptor);
  processEngineConfiguration.setCustomPreCommandInterceptors(interceptors);
  processEngine = processEngineConfiguration.buildProcessEngine();
}
 
Example 14
Source File: ReplayRunTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
private ProcessEngineImpl initProcessEngine() {
  ProcessEngineConfigurationImpl configuration = getProcessEngineConfiguration();
  ProcessEngineImpl processEngine = (ProcessEngineImpl) configuration.buildProcessEngine();

  processEngine.getRepositoryService().
      createDeployment().
      addClasspathResource(THE_USERTASK_PROCESS).
      deploy();
  return processEngine;
}
 
Example 15
Source File: JPAVariableTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void initializeProcessEngine() {
  if (cachedProcessEngine == null) {
    ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
        .createProcessEngineConfigurationFromResource("org/activiti/standalone/jpa/activiti.cfg.xml");

    cachedProcessEngine = processEngineConfiguration.buildProcessEngine();

    EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration.getSessionFactories().get(EntityManagerSession.class);

    entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
  }
  processEngine = cachedProcessEngine;
}
 
Example 16
Source File: DisabledDefinitionInfoCacheTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void initializeProcessEngine() {
  if (cachedProcessEngine==null) {
    ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
        .createProcessEngineConfigurationFromResource("org/activiti/engine/test/bpmn/usertask/activiti.cfg.xml");
    
    cachedProcessEngine = processEngineConfiguration.buildProcessEngine();
  }
  processEngine = cachedProcessEngine;
}
 
Example 17
Source File: LeaveJpaEntityTest.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
protected void initializeProcessEngine() {
    if (cachedProcessEngine == null) {
        ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
                .createProcessEngineConfigurationFromResource("activiti.jpa.cfg.xml");

        cachedProcessEngine = processEngineConfiguration.buildProcessEngine();

        EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration
                .getSessionFactories()
                .get(EntityManagerSession.class);

        entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
    }
    processEngine = cachedProcessEngine;
}
 
Example 18
Source File: DatabaseTablePrefixTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void testPerformDatabaseSchemaOperationCreate() throws Exception{
  
  // both process engines will be using this datasource.
  PooledDataSource pooledDataSource = new PooledDataSource(ReflectUtil.getClassLoader(), 
          "org.h2.Driver", 
          "jdbc:h2:mem:activiti-test;DB_CLOSE_DELAY=1000", 
          "sa", 
          "" );
        
  // create two schemas is the database
  Connection connection = pooledDataSource.getConnection();
  connection.createStatement().execute("drop schema if exists SCHEMA1");
  connection.createStatement().execute("drop schema if exists SCHEMA2");
  connection.createStatement().execute("create schema SCHEMA1");
  connection.createStatement().execute("create schema SCHEMA2");    
  connection.close();

  // configure & build two different process engines, each having a separate table prefix 
  ProcessEngineConfigurationImpl config1 = (ProcessEngineConfigurationImpl) ProcessEngineConfigurationImpl
          .createStandaloneInMemProcessEngineConfiguration()
          .setDataSource(pooledDataSource)
          .setDatabaseSchemaUpdate("NO_CHECK"); // disable auto create/drop schema
  config1.setDatabaseTablePrefix("SCHEMA1.");
  config1.setActiviti5CompatibilityEnabled(true);
  config1.getPerformanceSettings().setValidateExecutionRelationshipCountConfigOnBoot(false);
  ProcessEngine engine1 = config1.buildProcessEngine();
  
  ProcessEngineConfigurationImpl config2 = (ProcessEngineConfigurationImpl) ProcessEngineConfigurationImpl
          .createStandaloneInMemProcessEngineConfiguration()
          .setDataSource(pooledDataSource)
          .setDatabaseSchemaUpdate("NO_CHECK"); // disable auto create/drop schema        
  config2.setDatabaseTablePrefix("SCHEMA2.");
  config2.setActiviti5CompatibilityEnabled(true);
  config2.getPerformanceSettings().setValidateExecutionRelationshipCountConfigOnBoot(false);
  ProcessEngine engine2 = config2.buildProcessEngine();
  
  // create the tables in SCHEMA1
  connection = pooledDataSource.getConnection();
  connection.createStatement().execute("set schema SCHEMA1");    
  engine1.getManagementService().databaseSchemaUpgrade(connection, "", "SCHEMA1");
  connection.close();

  // create the tables in SCHEMA2
  connection = pooledDataSource.getConnection();
  connection.createStatement().execute("set schema SCHEMA2");    
  engine2.getManagementService().databaseSchemaUpgrade(connection, "", "SCHEMA2");
  connection.close();

  // if I deploy a process to one engine, it is not visible to the other engine:
  try {
    engine1.getRepositoryService()
      .createDeployment()
      .addClasspathResource("org/activiti5/engine/test/db/oneJobProcess.bpmn20.xml")
      .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE)
      .deploy();

    assertEquals(1, engine1.getRepositoryService().createDeploymentQuery().count());
    assertEquals(0, engine2.getRepositoryService().createDeploymentQuery().count());

  } finally {
    engine1.close();
    engine2.close();
  }
}
 
Example 19
Source File: ProcessDefinitionCacheTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void testStartProcessInstanceByIdAfterReboot() {

    // In case this test is run in a test suite, previous engines might
    // have been initialized and cached. First we close the
    // existing process engines to make sure that the db is clean
    // and that there are no existing process engines involved.
    ProcessEngines.destroy();

    // Creating the DB schema (without building a process engine)
    ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneInMemProcessEngineConfiguration();
    processEngineConfiguration.setProcessEngineName("reboot-test-schema");
    processEngineConfiguration.setJdbcUrl("jdbc:h2:mem:activiti-reboot-test;DB_CLOSE_DELAY=1000");
    ProcessEngine schemaProcessEngine = processEngineConfiguration.buildProcessEngine();

    // Create process engine and deploy test process
    ProcessEngine processEngine = new StandaloneProcessEngineConfiguration().setProcessEngineName("reboot-test").setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
        .setJdbcUrl("jdbc:h2:mem:activiti-reboot-test;DB_CLOSE_DELAY=1000").setAsyncExecutorActivate(false).buildProcessEngine();

    processEngine.getRepositoryService().createDeployment().addClasspathResource("org/activiti/engine/test/cache/originalProcess.bpmn20.xml").deploy();

    // verify existence of process definition
    List<ProcessDefinition> processDefinitions = processEngine.getRepositoryService().createProcessDefinitionQuery().list();

    assertEquals(1, processDefinitions.size());

    // Start a new Process instance
    ProcessInstance processInstance = processEngine.getRuntimeService().startProcessInstanceById(processDefinitions.get(0).getId());
    String processInstanceId = processInstance.getId();
    assertNotNull(processInstance);

    // Close the process engine
    processEngine.close();
    assertNotNull(processEngine.getRuntimeService());

    // Reboot the process engine
    processEngine = new StandaloneProcessEngineConfiguration().setProcessEngineName("reboot-test").setDatabaseSchemaUpdate(org.activiti.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
        .setJdbcUrl("jdbc:h2:mem:activiti-reboot-test;DB_CLOSE_DELAY=1000").setAsyncExecutorActivate(false).buildProcessEngine();

    // Check if the existing process instance is still alive
    processInstance = processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();

    assertNotNull(processInstance);

    // Complete the task. That will end the process instance
    TaskService taskService = processEngine.getTaskService();
    Task task = taskService.createTaskQuery().list().get(0);
    taskService.complete(task.getId());

    // Check if the process instance has really ended. This means that the
    // process definition has
    // re-loaded into the process definition cache
    processInstance = processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();

    assertNull(processInstance);

    // Extra check to see if a new process instance can be started as well
    processInstance = processEngine.getRuntimeService().startProcessInstanceById(processDefinitions.get(0).getId());
    assertNotNull(processInstance);

    // close the process engine
    processEngine.close();

    // Cleanup schema
    schemaProcessEngine.close();
  }
 
Example 20
Source File: DatabaseTablePrefixTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void testPerformDatabaseSchemaOperationCreate() throws Exception {

    // both process engines will be using this datasource.
    PooledDataSource pooledDataSource = new PooledDataSource(ReflectUtil.getClassLoader(), "org.h2.Driver", "jdbc:h2:mem:activiti-test;DB_CLOSE_DELAY=1000", "sa", "");

    // create two schemas is the database
    Connection connection = pooledDataSource.getConnection();
    connection.createStatement().execute("drop schema if exists SCHEMA1");
    connection.createStatement().execute("drop schema if exists SCHEMA2");
    connection.createStatement().execute("create schema SCHEMA1");
    connection.createStatement().execute("create schema SCHEMA2");
    connection.close();

    // configure & build two different process engines, each having a
    // separate table prefix
    ProcessEngineConfigurationImpl config1 = (ProcessEngineConfigurationImpl) ProcessEngineConfigurationImpl.createStandaloneInMemProcessEngineConfiguration().setDataSource(pooledDataSource)
        .setDatabaseSchemaUpdate("NO_CHECK"); // disable auto create/drop schema
    config1.setDatabaseTablePrefix("SCHEMA1.");
    config1.getPerformanceSettings().setValidateExecutionRelationshipCountConfigOnBoot(false);
    ProcessEngine engine1 = config1.buildProcessEngine();

    ProcessEngineConfigurationImpl config2 = (ProcessEngineConfigurationImpl) ProcessEngineConfigurationImpl.createStandaloneInMemProcessEngineConfiguration().setDataSource(pooledDataSource)
        .setDatabaseSchemaUpdate("NO_CHECK"); // disable auto create/drop schema
    config2.setDatabaseTablePrefix("SCHEMA2.");
    config2.getPerformanceSettings().setValidateExecutionRelationshipCountConfigOnBoot(false);
    ProcessEngine engine2 = config2.buildProcessEngine();

    // create the tables in SCHEMA1
    connection = pooledDataSource.getConnection();
    connection.createStatement().execute("set schema SCHEMA1");
    engine1.getManagementService().databaseSchemaUpgrade(connection, "", "SCHEMA1");
    connection.close();

    // create the tables in SCHEMA2
    connection = pooledDataSource.getConnection();
    connection.createStatement().execute("set schema SCHEMA2");
    engine2.getManagementService().databaseSchemaUpgrade(connection, "", "SCHEMA2");
    connection.close();

    // if I deploy a process to one engine, it is not visible to the other
    // engine:
    try {
      engine1.getRepositoryService().createDeployment().addClasspathResource("org/activiti/engine/test/db/oneJobProcess.bpmn20.xml").deploy();

      assertEquals(1, engine1.getRepositoryService().createDeploymentQuery().count());
      assertEquals(0, engine2.getRepositoryService().createDeploymentQuery().count());

    } finally {
      engine1.close();
      engine2.close();
    }
  }