use of org.camunda.bpm.engine.impl.db.sql.DbSqlSession in project camunda-bpm-platform by camunda.
the class DatabaseTableSchemaTest method testTablePresentWithSchemaAndPrefix.
public void testTablePresentWithSchemaAndPrefix() throws SQLException {
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.createStatement().execute("create table " + SCHEMA_NAME + "." + PREFIX_NAME + "SOME_TABLE(id varchar(64));");
connection.close();
ProcessEngineConfigurationImpl config1 = createCustomProcessEngineConfiguration().setProcessEngineName("DatabaseTablePrefixTest-engine1").setDataSource(pooledDataSource).setDatabaseSchemaUpdate("NO_CHECK");
config1.setDatabaseTablePrefix(SCHEMA_NAME + "." + PREFIX_NAME);
config1.setDatabaseSchema(SCHEMA_NAME);
config1.setDbMetricsReporterActivate(false);
ProcessEngine engine = config1.buildProcessEngine();
CommandExecutor commandExecutor = config1.getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
DbSqlSession sqlSession = commandContext.getSession(DbSqlSession.class);
assertTrue(sqlSession.isTablePresent("SOME_TABLE"));
return null;
}
});
engine.close();
}
Aggregations