Search in sources :

Example 11 with StatFilter

use of com.alibaba.druid.filter.stat.StatFilter in project druid by alibaba.

the class StatFilterConcurrentTest method setUp.

public void setUp() throws Exception {
    dataSource = new DruidDataSource();
    dataSource.setUrl("jdbc:mock:xxx");
    dataSource.setMaxActive(100);
    statFilter = new StatFilter();
    dataSource.getProxyFilters().add(statFilter);
    dataSource.setConnectionProperties("executeSleep=1");
}
Also used : StatFilter(com.alibaba.druid.filter.stat.StatFilter) DruidDataSource(com.alibaba.druid.pool.DruidDataSource)

Example 12 with StatFilter

use of com.alibaba.druid.filter.stat.StatFilter in project druid by alibaba.

the class StatFilterTest3 method test_dbType_error.

public void test_dbType_error() throws Exception {
    StatFilter filter = new StatFilter();
    filter.setDbType("mysql");
    filter.setMergeSql(true);
    Assert.assertEquals("mysql", filter.getDbType());
    Assert.assertEquals("sdafawer asf ", filter.mergeSql("sdafawer asf "));
}
Also used : StatFilter(com.alibaba.druid.filter.stat.StatFilter)

Example 13 with StatFilter

use of com.alibaba.druid.filter.stat.StatFilter in project druid by alibaba.

the class StatFilterTest3 method test_merge.

public void test_merge() throws Exception {
    StatFilter filter = new StatFilter();
    filter.setDbType("mysql");
    filter.setMergeSql(false);
    Assert.assertEquals("mysql", filter.getDbType());
    Assert.assertEquals("select 'x' limit 1", filter.mergeSql("select 'x' limit 1"));
}
Also used : StatFilter(com.alibaba.druid.filter.stat.StatFilter)

Aggregations

StatFilter (com.alibaba.druid.filter.stat.StatFilter)13 Connection (java.sql.Connection)4 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)3 DataSourceProxyConfig (com.alibaba.druid.proxy.jdbc.DataSourceProxyConfig)3 DataSourceProxyImpl (com.alibaba.druid.proxy.jdbc.DataSourceProxyImpl)3 MockDriver (com.alibaba.druid.mock.MockDriver)2 ResultSetProxy (com.alibaba.druid.proxy.jdbc.ResultSetProxy)2 Statement (java.sql.Statement)2 FilterChain (com.alibaba.druid.filter.FilterChain)1 FilterChainImpl (com.alibaba.druid.filter.FilterChainImpl)1 Log4jFilter (com.alibaba.druid.filter.logging.Log4jFilter)1 JdbcDataSourceStat (com.alibaba.druid.stat.JdbcDataSourceStat)1 SQLException (java.sql.SQLException)1 Properties (java.util.Properties)1