public void afterPropertiesSet() throws Exception { dataSource = new PooledDataSource( ReflectUtil.getClassLoader(), "org.h2.Driver", "jdbc:h2:mem:DatabaseTablePrefixTest;DB_CLOSE_DELAY=1000;MVCC=TRUE;", "sa", ""); // create schema in the Connection connection = dataSource.getConnection(); connection.createStatement().execute("drop schema if exists SCHEMA1"); connection.createStatement().execute("create schema SCHEMA1"); connection.close(); ProcessEngineConfigurationImpl config1 = createCustomProcessEngineConfiguration() .setProcessEngineName("DatabaseTablePrefixTest-engine1") .setDataSource(dataSource) .setDbMetricsReporterActivate(false) .setDatabaseSchemaUpdate("NO_CHECK"); // disable auto create/drop schema config1.setDatabaseTablePrefix("SCHEMA1."); ProcessEngine engine1 = config1.buildProcessEngine(); // create the tables in SCHEMA1 connection = dataSource.getConnection(); connection.createStatement().execute("set schema SCHEMA1"); engine1.getManagementService().databaseSchemaUpgrade(connection, "", "SCHEMA1"); connection.close(); engine1.close(); }
/** * get a resource location by convention based on a class (type) and a relative resource name. The * return value will be the full classpath location of the type, plus a suffix built from the name * parameter: <code>BpmnDeployer.BPMN_RESOURCE_SUFFIXES</code>. The first resource matching a * suffix will be returned. */ public static String getBpmnProcessDefinitionResource(Class<?> type, String name) { for (String suffix : RESOURCE_SUFFIXES) { String resource = type.getName().replace('.', '/') + "." + name + "." + suffix; InputStream inputStream = ReflectUtil.getResourceAsStream(resource); if (inputStream == null) { continue; } else { return resource; } } return type.getName().replace('.', '/') + "." + name + "." + BpmnDeployer.BPMN_RESOURCE_SUFFIXES[0]; }