Package com.alibaba.druid.bvt.pool

Source Code of com.alibaba.druid.bvt.pool.DruidDataSourceTest_getPoolingPeakTime

package com.alibaba.druid.bvt.pool;

import java.sql.Connection;

import org.junit.Assert;
import junit.framework.TestCase;

import com.alibaba.druid.pool.DruidDataSource;

/**
* 这个场景测试initialSize > maxActive
*
* @author wenshao<szujobs@hotmail.com>
*/
public class DruidDataSourceTest_getPoolingPeakTime extends TestCase {

    private DruidDataSource dataSource;

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

    }

    protected void tearDown() throws Exception {
        dataSource.close();
    }

    public void test_error() throws Exception {
        Assert.assertNull(dataSource.getPoolingPeakTime());
        Assert.assertNull(dataSource.getActivePeakTime());
       
        Connection conn = dataSource.getConnection();
        conn.close();
       
        Assert.assertNotNull(dataSource.getPoolingPeakTime());
        Assert.assertNotNull(dataSource.getActivePeakTime());
    }
}
TOP

Related Classes of com.alibaba.druid.bvt.pool.DruidDataSourceTest_getPoolingPeakTime

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.