mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add Slf4jFilter testcase
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package com.alibaba.druid.bvt.filter;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.filter.logging.Slf4jLogFilter;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
|
||||
public class Slf4jFilterTest extends TestCase {
|
||||
|
||||
private DruidDataSource dataSource;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
dataSource = new DruidDataSource();
|
||||
|
||||
dataSource.setUrl("jdbc:mock:xxx");
|
||||
dataSource.setFilters("slf4j");
|
||||
dataSource.setDbType("mysql");
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
JdbcUtils.close(dataSource);
|
||||
}
|
||||
|
||||
public void test_slf4j() throws Exception {
|
||||
dataSource.init();
|
||||
|
||||
Slf4jLogFilter filter = dataSource.unwrap(Slf4jLogFilter.class);
|
||||
Assert.assertNotNull(filter);
|
||||
|
||||
Connection conn = dataSource.getConnection();
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user