use of jodd.db.pool.CoreConnectionPool in project jodd by oblac.
the class DbH2TestCase method setUp.
@Before
public void setUp() throws Exception {
LoggerFactory.setLoggerFactory(new TestLoggerFactory());
if (dbtxm != null) {
return;
}
cp = new CoreConnectionPool();
cp.setDriver("org.h2.Driver");
cp.setUrl("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1");
cp.setUser("sa");
cp.setPassword("");
cp.init();
dbtxm = new DbJtxTransactionManager(cp);
}
use of jodd.db.pool.CoreConnectionPool in project jodd by oblac.
the class DbHsqldbTestCase method setUp.
@Before
public void setUp() throws Exception {
DbManager.getInstance().setQueryMap(new DbPropsQueryMap());
LoggerFactory.setLoggerFactory(new TestLoggerFactory());
cp = new CoreConnectionPool();
cp.setDriver("org.hsqldb.jdbcDriver");
cp.setUrl("jdbc:hsqldb:mem:test");
cp.setUser("sa");
cp.setPassword("");
cp.init();
dbtxm = new DbJtxTransactionManager(cp);
// initial data
DbSession session = new DbSession(cp);
createTables(session);
session.closeSession();
}
use of jodd.db.pool.CoreConnectionPool in project jodd by oblac.
the class DbBaseTest method init.
protected void init() {
LoggerFactory.setLoggerFactory(new NOPLoggerFactory() {
@Override
public Logger getLogger(String name) {
return new NOPLogger("") {
@Override
public boolean isWarnEnabled() {
return true;
}
@Override
public void warn(String message) {
throw new UncheckedException("NO WARNINGS ALLOWED: " + message);
}
@Override
public void warn(String message, Throwable throwable) {
throw new UncheckedException("NO WARNINGS ALLOWED: " + message);
}
};
}
});
DbOomManager.resetAll();
dboom = DbOomManager.getInstance();
connectionPool = new CoreConnectionPool();
}
use of jodd.db.pool.CoreConnectionPool in project jodd by oblac.
the class DbHsqldbTestCase method setUp.
@Before
public void setUp() throws Exception {
cp = new CoreConnectionPool();
cp.setDriver("org.hsqldb.jdbcDriver");
cp.setUrl("jdbc:hsqldb:mem:test");
cp.setUser("sa");
cp.setPassword("");
cp.init();
dbtxm = new DbJtxTransactionManager(cp);
// initial data
DbSession session = new DbSession(cp);
executeUpdate(session, "drop table BOY if exists");
executeUpdate(session, "drop table GIRL if exists");
String sql = "create table GIRL (" + "ID integer not null," + "NAME varchar(20) not null," + "SPECIALITY varchar(20) null," + "primary key (ID)" + ')';
executeUpdate(session, sql);
sql = "create table BOY (" + "ID integer not null," + "GIRL_ID integer null," + "NAME varchar(20) null," + "primary key (ID)," + "FOREIGN KEY (GIRL_ID) REFERENCES GIRL (ID)" + ')';
executeUpdate(session, sql);
session.closeSession();
}
Aggregations