Package com.alibaba.druid.bvt.bug

Source Code of com.alibaba.druid.bvt.bug.Bug_for_wdw1206

package com.alibaba.druid.bvt.bug;

import java.sql.Connection;

import junit.framework.TestCase;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.util.JdbcUtils;

public class Bug_for_wdw1206 extends TestCase {

    private ClassLoader     ctxClassLoader;
    private DruidDataSource dataSource;

    protected void setUp() throws Exception {
        ctxClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(null);

        dataSource = new DruidDataSource();
        dataSource.setUrl("jdbc:mock:");
        dataSource.setPoolPreparedStatements(false);
        dataSource.setTestOnBorrow(true);
        dataSource.setFilters("stat");
    }

    protected void tearDown() throws Exception {
        Thread.currentThread().setContextClassLoader(ctxClassLoader);
       
        JdbcUtils.close(dataSource);
    }

    public void test_nullCtxClassLoader() throws Exception {
        Connection conn = dataSource.getConnection();
        conn.close();
    }
}
TOP

Related Classes of com.alibaba.druid.bvt.bug.Bug_for_wdw1206

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.