Search in sources :

Example 1 with CoreConnectionPool

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);
}
Also used : CoreConnectionPool(jodd.db.pool.CoreConnectionPool) DbJtxTransactionManager(jodd.db.jtx.DbJtxTransactionManager) Before(org.junit.Before)

Example 2 with CoreConnectionPool

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();
}
Also used : DbPropsQueryMap(jodd.db.querymap.DbPropsQueryMap) CoreConnectionPool(jodd.db.pool.CoreConnectionPool) DbJtxTransactionManager(jodd.db.jtx.DbJtxTransactionManager) Before(org.junit.Before)

Example 3 with CoreConnectionPool

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();
}
Also used : UncheckedException(jodd.exception.UncheckedException) NOPLoggerFactory(jodd.log.impl.NOPLoggerFactory) NOPLogger(jodd.log.impl.NOPLogger) NOPLogger(jodd.log.impl.NOPLogger) Logger(jodd.log.Logger) CoreConnectionPool(jodd.db.pool.CoreConnectionPool)

Example 4 with 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();
}
Also used : DbSession(jodd.db.DbSession) CoreConnectionPool(jodd.db.pool.CoreConnectionPool) DbJtxTransactionManager(jodd.db.jtx.DbJtxTransactionManager) Before(org.junit.Before)

Aggregations

CoreConnectionPool (jodd.db.pool.CoreConnectionPool)4 DbJtxTransactionManager (jodd.db.jtx.DbJtxTransactionManager)3 Before (org.junit.Before)3 DbSession (jodd.db.DbSession)1 DbPropsQueryMap (jodd.db.querymap.DbPropsQueryMap)1 UncheckedException (jodd.exception.UncheckedException)1 Logger (jodd.log.Logger)1 NOPLogger (jodd.log.impl.NOPLogger)1 NOPLoggerFactory (jodd.log.impl.NOPLoggerFactory)1