use of org.jbpm.test.util.PoolingDataSource in project jbpm by kiegroup.
the class HumanTaskServicesBaseTest method setupPoolingDataSource.
protected static PoolingDataSource setupPoolingDataSource() {
Properties dsProps = getDatasourceProperties();
PoolingDataSource pds = PersistenceUtil.setupPoolingDataSource(dsProps, "jdbc/jbpm-ds", false);
pds.init();
return pds;
}
use of org.jbpm.test.util.PoolingDataSource in project jbpm by kiegroup.
the class TestPersistenceContext method executeScripts.
public void executeScripts(final File scriptsRootFolder, String type) throws IOException, SQLException {
testIsInitialized();
final File[] sqlScripts = TestsUtil.getDDLScriptFilesByDatabaseType(scriptsRootFolder, databaseType, true);
final Connection connection = ((PoolingDataSource) context.get(PersistenceUtil.DATASOURCE)).getConnection();
connection.setAutoCommit(false);
try {
for (File script : sqlScripts) {
if (type == null || script.getName().startsWith(type)) {
logger.debug("Executing script {}", script.getName());
final List<String> scriptCommands = SQLScriptUtil.getCommandsFromScript(script, databaseType);
for (String command : scriptCommands) {
logger.debug(command);
final PreparedStatement statement;
if (databaseType == DatabaseType.SQLSERVER || databaseType == DatabaseType.SQLSERVER2008) {
statement = connection.prepareStatement(SQLCommandUtil.preprocessCommandSqlServer(command, dataSourceProperties));
} else {
statement = connection.prepareStatement(command);
}
statement.execute();
statement.close();
}
}
}
connection.commit();
} catch (SQLException ex) {
connection.rollback();
throw new RuntimeException(ex.getMessage(), ex);
} finally {
connection.close();
}
}
use of org.jbpm.test.util.PoolingDataSource in project jbpm by kiegroup.
the class TaskVariablesQueryServiceTest method buildDatasource.
protected void buildDatasource() {
ds = new PoolingDataSource();
ds.setUniqueName("jdbc/testDS1");
ds.setClassName("org.postgresql.xa.PGXADataSource");
ds.getDriverProperties().put("user", "bpms");
ds.getDriverProperties().put("password", "bpms");
ds.getDriverProperties().put("serverName", "localhost");
ds.getDriverProperties().put("portNumber", "5432");
ds.getDriverProperties().put("databaseName", "bpms");
ds.init();
}
use of org.jbpm.test.util.PoolingDataSource in project jbpm by kiegroup.
the class AbstractKieServicesBaseTest method buildDatasource.
protected void buildDatasource() {
ds = new PoolingDataSource();
ds.setUniqueName("jdbc/testDS1");
// NON XA CONFIGS
ds.setClassName("org.h2.jdbcx.JdbcDataSource");
ds.getDriverProperties().put("user", "sa");
ds.getDriverProperties().put("password", "sasa");
ds.getDriverProperties().put("URL", "jdbc:h2:mem:mydb");
ds.init();
}
use of org.jbpm.test.util.PoolingDataSource in project jbpm by kiegroup.
the class JBPMHelper method setupDataSource.
public static PoolingDataSource setupDataSource() {
Properties properties = getProperties();
// create data source
PoolingDataSource pds = new PoolingDataSource();
pds.setUniqueName(properties.getProperty("persistence.datasource.name", "jdbc/jbpm-ds"));
pds.setClassName("org.h2.jdbcx.JdbcDataSource");
pds.getDriverProperties().put("user", properties.getProperty("persistence.datasource.user", "sa"));
pds.getDriverProperties().put("password", properties.getProperty("persistence.datasource.password", ""));
pds.getDriverProperties().put("url", properties.getProperty("persistence.datasource.url", "jdbc:h2:tcp://localhost/~/jbpm-db;MVCC=TRUE"));
pds.getDriverProperties().put("driverClassName", properties.getProperty("persistence.datasource.driverClassName", "org.h2.Driver"));
pds.init();
return pds;
}
Aggregations