Package com.alibaba.druid.pool

Examples of com.alibaba.druid.pool.DruidPooledConnection


        conn.close();
    }

    public void test_rollback() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        conn.setAutoCommit(false);
        Statement stmt = conn.createStatement();
        stmt.execute("SELECT 1");

        conn.getConnection().close();
        {
            SQLException error = null;
            try {
                conn.rollback();
            } catch (SQLException ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }

        conn.close();
    }
View Full Code Here


        conn.close();
    }

    public void test_rollback_1() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        conn.getConnection().close();
        {
            SQLException error = null;
            try {
                conn.rollback(null);
            } catch (SQLException ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }

        conn.close();
    }
View Full Code Here

        conn.close();
    }

    public void test_releaseSavepoint_1() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        conn.getConnection().close();
        {
            SQLException error = null;
            try {
                conn.releaseSavepoint(null);
            } catch (SQLException ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }

        conn.close();
    }
View Full Code Here

        conn.close();
    }

    public void test_addListenerError() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        conn.close();
        {
            Exception error = null;
            try {
                conn.addConnectionEventListener(null);
            } catch (IllegalStateException ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }
View Full Code Here

            Assert.assertNotNull(error);
        }
    }

    public void test_addListenerError2() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        conn.close();
        {
            Exception error = null;
            try {
                conn.addStatementEventListener(null);
            } catch (IllegalStateException ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }
View Full Code Here

            Assert.assertNotNull(error);
        }
    }

    public void test_removeConnectionEventListener() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        conn.close();
        {
            Exception error = null;
            try {
                conn.removeConnectionEventListener(null);
            } catch (IllegalStateException ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }
View Full Code Here

            Assert.assertNotNull(error);
        }
    }

    public void test_removeStatementEventListener() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        conn.close();
        {
            Exception error = null;
            try {
                conn.removeStatementEventListener(null);
            } catch (IllegalStateException ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }
View Full Code Here

        JdbcStatManager.getInstance().setStatContext(null);
    }

    public void test_basic() throws Exception {
        DruidPooledConnection conn = (DruidPooledConnection) dataSource.getConnection();
        conn.close();

        Assert.assertEquals(true, dataSource.isResetStatEnable());
        dataSource.setResetStatEnable(false);
        Assert.assertEquals(false, dataSource.isResetStatEnable());
        Assert.assertEquals(1, dataSource.getConnectCount());
View Full Code Here

        Assert.assertEquals(0, dataSource.getConnectCount());

    }

    public void test_handleException() throws Exception {
        DruidPooledConnection conn = (DruidPooledConnection) dataSource.getConnection();
        conn.close();

        SQLException error = new SQLException();
        try {
            conn.handleException(error);
        } catch (SQLException ex) {
            Assert.assertEquals(error, ex);
        }
    }
View Full Code Here

            Assert.assertEquals(error, ex);
        }
    }

    public void test_handleException_2() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
        conn.getConnection().close();

        {
            SQLException error = null;
            try {
                conn.handleException(new RuntimeException());
            } catch (SQLException ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }

        conn.close();
    }
View Full Code Here

TOP

Related Classes of com.alibaba.druid.pool.DruidPooledConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.