use of org.jbpm.test.util.PoolingDataSource in project jbpm by kiegroup.
the class JbpmBpmn2TestCase method setupPoolingDataSource.
public static PoolingDataSource setupPoolingDataSource() {
Properties dsProps = PersistenceUtil.getDatasourceProperties();
String jdbcUrl = dsProps.getProperty("url");
String driverClass = dsProps.getProperty("driverClassName");
// Setup the datasource
PoolingDataSource ds1 = PersistenceUtil.setupPoolingDataSource(dsProps, "jdbc/testDS1", false);
if (driverClass.startsWith("org.h2")) {
ds1.getDriverProperties().setProperty("url", jdbcUrl);
}
ds1.init();
return ds1;
}
use of org.jbpm.test.util.PoolingDataSource in project jbpm by kiegroup.
the class DBUserInfoImplTest method setup.
@Before
public void setup() {
Properties dsProps = loadDataSourceProperties();
pds = new PoolingDataSource();
pds.setUniqueName("jdbc/jbpm-ds");
pds.setClassName(dsProps.getProperty("className"));
for (String propertyName : new String[] { "user", "password" }) {
pds.getDriverProperties().put(propertyName, dsProps.getProperty(propertyName));
}
setDatabaseSpecificDataSourceProperties(pds, dsProps);
pds.init();
prepareDb();
props = new Properties();
props.setProperty(DBUserInfoImpl.DS_JNDI_NAME, "jdbc/jbpm-ds");
props.setProperty(DBUserInfoImpl.NAME_QUERY, "select name from Users where userId = ?");
props.setProperty(DBUserInfoImpl.EMAIL_QUERY, "select email from Users where userId = ?");
props.setProperty(DBUserInfoImpl.LANG_QUERY, "select lang from Users where userId = ?");
props.setProperty(DBUserInfoImpl.HAS_EMAIL_QUERY, "select email from Groups where groupId = ?");
props.setProperty(DBUserInfoImpl.MEMBERS_QUERY, "select userId from Groups where groupId = ?");
props.setProperty(DBUserInfoImpl.ID_QUERY, "select userId from Users where email = ?");
}
use of org.jbpm.test.util.PoolingDataSource in project jbpm by kiegroup.
the class JbpmJUnitBaseTestCase method setupPoolingDataSource.
protected PoolingDataSource setupPoolingDataSource() {
PoolingDataSource pds = new PoolingDataSource();
pds.setUniqueName("jdbc/jbpm-ds");
pds.setClassName("org.h2.jdbcx.JdbcDataSource");
pds.getDriverProperties().put("user", "sa");
pds.getDriverProperties().put("password", "");
pds.getDriverProperties().put("url", "jdbc:h2:mem:jbpm-db;MVCC=true");
pds.getDriverProperties().put("driverClassName", "org.h2.Driver");
try {
pds.init();
} catch (Exception e) {
logger.warn("DBPOOL_MGR:Looks like there is an issue with creating db pool because of " + e.getMessage() + " cleaing up...");
try {
pds.close();
} catch (Exception ex) {
// ignore
}
logger.debug("DBPOOL_MGR: attempting to create db pool again...");
pds = new PoolingDataSource();
pds.setUniqueName("jdbc/jbpm-ds");
pds.setClassName("org.h2.jdbcx.JdbcDataSource");
pds.getDriverProperties().put("user", "sa");
pds.getDriverProperties().put("password", "");
pds.getDriverProperties().put("url", "jdbc:h2:mem:jbpm-db;MVCC=true");
pds.getDriverProperties().put("driverClassName", "org.h2.Driver");
pds.init();
logger.debug("DBPOOL_MGR:Pool created after cleanup of leftover resources");
}
return pds;
}
use of org.jbpm.test.util.PoolingDataSource in project jbpm by kiegroup.
the class TimerBaseTest method setupPoolingDataSource.
public static PoolingDataSource setupPoolingDataSource() {
Properties dsProps = getDatasourceProperties();
PoolingDataSource pds = PersistenceUtil.setupPoolingDataSource(dsProps, "jdbc/jbpm-ds", false);
try {
pds.init();
} catch (Exception e) {
logger.warn("DBPOOL_MGR:Looks like there is an issue with creating db pool because of " + e.getMessage() + " cleaing up...");
try {
pds.close();
} catch (Exception ex) {
// ignore
}
logger.info("DBPOOL_MGR: attempting to create db pool again...");
pds = PersistenceUtil.setupPoolingDataSource(dsProps, "jdbc/jbpm-ds", false);
pds.init();
logger.info("DBPOOL_MGR:Pool created after cleanup of leftover resources");
}
return pds;
}
use of org.jbpm.test.util.PoolingDataSource in project jbpm by kiegroup.
the class HTWorkItemHandlerTest method setupPoolingDataSource.
protected PoolingDataSource setupPoolingDataSource() {
PoolingDataSource pds = new PoolingDataSource();
pds.setUniqueName("jdbc/jbpm-ds");
pds.setClassName("org.h2.jdbcx.JdbcDataSource");
pds.getDriverProperties().put("user", "sa");
pds.getDriverProperties().put("password", "");
pds.getDriverProperties().put("url", "jdbc:h2:mem:jbpm-db;MVCC=true");
pds.getDriverProperties().put("driverClassName", "org.h2.Driver");
pds.init();
return pds;
}
Aggregations