Search in sources :

Example 86 with DruidDataSource

use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.

the class DruidConnectionHolderTest3 method setUp.

protected void setUp() throws Exception {
    dataSource = new DruidDataSource();
    dataSource.setUrl("jdbc:mock:xxx");
    dataSource.setTestOnBorrow(false);
    dataSource.setInitialSize(1);
    dataSource.getProxyFilters().add(new FilterAdapter() {

        public int connection_getTransactionIsolation(FilterChain chain, ConnectionProxy connection) throws SQLException {
            throw new MySQLException();
        }
    });
}
Also used : SQLException(java.sql.SQLException) FilterChain(com.alibaba.druid.filter.FilterChain) FilterAdapter(com.alibaba.druid.filter.FilterAdapter) DruidDataSource(com.alibaba.druid.pool.DruidDataSource) ConnectionProxy(com.alibaba.druid.proxy.jdbc.ConnectionProxy)

Example 87 with DruidDataSource

use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.

the class DruidConnectionHolderTest4 method setUp.

protected void setUp() throws Exception {
    dataSource = new DruidDataSource();
    dataSource.setUrl("jdbc:mock:xxx");
    dataSource.setTestOnBorrow(false);
    dataSource.setPoolPreparedStatements(true);
}
Also used : DruidDataSource(com.alibaba.druid.pool.DruidDataSource)

Example 88 with DruidDataSource

use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.

the class DruidDataSourceTest_autocommit3 method setUp.

protected void setUp() throws Exception {
    dataSource = new DruidDataSource();
    dataSource.setUrl("jdbc:mock:xxx");
    dataSource.setTestOnBorrow(false);
    dataSource.setDefaultAutoCommit(false);
    dataSource.setInitialSize(1);
    dataSource.getProxyFilters().add(new FilterAdapter() {

        public ConnectionProxy connection_connect(FilterChain chain, Properties info) throws SQLException {
            ConnectionProxy conn = chain.connection_connect(info);
            conn.setAutoCommit(false);
            return conn;
        }
    });
}
Also used : SQLException(java.sql.SQLException) FilterChain(com.alibaba.druid.filter.FilterChain) FilterAdapter(com.alibaba.druid.filter.FilterAdapter) Properties(java.util.Properties) DruidDataSource(com.alibaba.druid.pool.DruidDataSource) ConnectionProxy(com.alibaba.druid.proxy.jdbc.ConnectionProxy)

Example 89 with DruidDataSource

use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.

the class DruidDataSourceTest_clearCache method setUp.

protected void setUp() throws Exception {
    dataSource = new DruidDataSource();
    dataSource.setUrl("jdbc:mock:xxx");
    dataSource.setTestOnBorrow(false);
    dataSource.setPoolPreparedStatements(true);
}
Also used : DruidDataSource(com.alibaba.druid.pool.DruidDataSource)

Example 90 with DruidDataSource

use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.

the class DruidDataSourceTest_closeError method setUp.

protected void setUp() throws Exception {
    dataSource = new DruidDataSource();
    dataSource.setUrl("jdbc:mock:xxx");
    dataSource.setTestOnBorrow(false);
    dataSource.setInitialSize(1);
    dataSource.getProxyFilters().add(new FilterAdapter() {

        public void connection_close(FilterChain chain, ConnectionProxy connection) throws SQLException {
            throw new SQLException();
        }
    });
    dataSource.init();
}
Also used : SQLException(java.sql.SQLException) FilterChain(com.alibaba.druid.filter.FilterChain) FilterAdapter(com.alibaba.druid.filter.FilterAdapter) DruidDataSource(com.alibaba.druid.pool.DruidDataSource) ConnectionProxy(com.alibaba.druid.proxy.jdbc.ConnectionProxy)

Aggregations

DruidDataSource (com.alibaba.druid.pool.DruidDataSource)389 SQLException (java.sql.SQLException)56 OracleMockDriver (com.alibaba.druid.test.util.OracleMockDriver)55 OracleExceptionSorter (com.alibaba.druid.pool.vendor.OracleExceptionSorter)50 MockDriver (com.alibaba.druid.mock.MockDriver)48 Connection (java.sql.Connection)36 FilterAdapter (com.alibaba.druid.filter.FilterAdapter)35 Properties (java.util.Properties)34 FilterChain (com.alibaba.druid.filter.FilterChain)33 ResultSet (java.sql.ResultSet)19 ConnectionProxy (com.alibaba.druid.proxy.jdbc.ConnectionProxy)18 MockConnection (com.alibaba.druid.mock.MockConnection)13 ResultSetProxy (com.alibaba.druid.proxy.jdbc.ResultSetProxy)13 Method (java.lang.reflect.Method)11 PreparedStatement (java.sql.PreparedStatement)11 MockPreparedStatement (com.alibaba.druid.mock.MockPreparedStatement)10 Field (java.lang.reflect.Field)8 MockResultSet (com.alibaba.druid.mock.MockResultSet)7 TabularData (javax.management.openmbean.TabularData)7 MockCallableStatement (com.alibaba.druid.mock.MockCallableStatement)6