Examples of DruidConnectionHolder


Examples of com.alibaba.druid.pool.DruidConnectionHolder

    }

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

        DruidConnectionHolder holder = conn.getConnectionHolder();
        PreparedStatementPool stmtPool = holder.getStatementPool();

        final String sql_0 = "select 0";
        final String sql_1 = "select 1";
        final String sql_2 = "select 2";
        final String sql_3 = "select 3";
View Full Code Here

Examples of com.alibaba.druid.pool.DruidConnectionHolder

    protected DruidPooledPreparedStatement stmt;

    protected void setUp() throws Exception {
        DruidDataSource                dataSource = new DruidDataSource();
        MockConnection mockConn = new MockConnection();
        DruidConnectionHolder connHolder = new DruidConnectionHolder(dataSource, mockConn);
        DruidPooledConnection conn = new DruidPooledConnection(connHolder);

        raw = new MockPreparedStatement(null, null);
        stmt = new DruidPooledPreparedStatement(conn, new PreparedStatementHolder(new PreparedStatementKey("", null,
                                                                                                           null, 0, 0,
View Full Code Here

Examples of com.alibaba.druid.pool.DruidConnectionHolder

    protected MockCallableStatement        raw;
    protected DruidPooledCallableStatement stmt;

    protected void setUp() throws Exception {
        MockConnection mockConn = new MockConnection();
        DruidConnectionHolder connHolder = new DruidConnectionHolder(dataSource, mockConn);
        conn = new DruidPooledConnection(connHolder);
        raw = new MockCallableStatement(null, null);
        stmt = new DruidPooledCallableStatement(conn, new PreparedStatementHolder(new PreparedStatementKey("", null,
                                                                                                           null, 0, 0,
                                                                                                           0), raw)) {
View Full Code Here

Examples of com.alibaba.druid.pool.DruidConnectionHolder

    }

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

        DruidConnectionHolder holder = conn.getConnectionHolder();
        PreparedStatementPool stmtPool = holder.getStatementPool();

        final String sql_0 = "select 0";
        final String sql_1 = "select 1";

        Assert.assertEquals(0, stmtPool.size());
View Full Code Here

Examples of com.alibaba.druid.pool.DruidConnectionHolder

        }
        Assert.assertNotEquals(t0, t1);
    }

    private long getLastActiveTime(DruidPooledConnection conn) throws IllegalAccessException {
        DruidConnectionHolder holder = (DruidConnectionHolder) field.get(conn);
        return holder.getLastActiveTimeMillis();
    }
View Full Code Here

Examples of com.alibaba.druid.pool.DruidConnectionHolder

    }

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

        DruidConnectionHolder holder = conn.getConnectionHolder();

        Field field = DruidConnectionHolder.class.getDeclaredField("statementPool");
        field.setAccessible(true);
        Assert.assertNull(field.get(holder));

        holder.toString();

        Assert.assertNull(field.get(holder));

        holder.getStatementPool();

        Assert.assertNotNull(field.get(holder));

        holder.toString();

        PreparedStatement stmt = conn.prepareStatement("select 1");
        stmt.execute();
        stmt.close();

        conn.close();
       
        Assert.assertEquals(1, holder.getStatementPool().size());
       
        holder.toString();
    }
View Full Code Here

Examples of com.alibaba.druid.pool.DruidConnectionHolder

    public void test_contains() throws Exception {
        DruidDataSource dataSource = new DruidDataSource();
        MockConnection conn = new MockConnection();
        PreparedStatementKey k1 = new PreparedStatementKey("x1", "c1", MethodType.M1);

        PreparedStatementPool pool = new PreparedStatementPool(new DruidConnectionHolder(dataSource, conn));
        MockPreparedStatement raw = new MockPreparedStatement(null, null);
        pool.put(new PreparedStatementHolder(k1, raw));

        Assert.assertTrue(pool.get(k1) != null);
        Assert.assertTrue(pool.get(k1) != null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.