Search in sources :

Example 21 with StatFilter

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

the class StatFilterTest3 method test_merge_nodbtype.

public void test_merge_nodbtype() throws Exception {
    StatFilter filter = new StatFilter();
    Assert.assertFalse(filter.isMergeSql());
    filter.setMergeSql(true);
    Assert.assertTrue(filter.isMergeSql());
    Assert.assertNull(filter.getDbType());
    Assert.assertEquals("SELECT *\n" + "FROM temp.test\n" + "ORDER BY id DESC\n" + "LIMIT ?", filter.mergeSql("select * from temp.test order by id desc limit 1"));
}
Also used : StatFilter(com.alibaba.druid.filter.stat.StatFilter)

Example 22 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)

Aggregations

StatFilter (com.alibaba.druid.filter.stat.StatFilter)22 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)4 Connection (java.sql.Connection)4 DataSourceProxyConfig (com.alibaba.druid.proxy.jdbc.DataSourceProxyConfig)3 DataSourceProxyImpl (com.alibaba.druid.proxy.jdbc.DataSourceProxyImpl)3 WallFilter (com.alibaba.druid.wall.WallFilter)3 MockDriver (com.alibaba.druid.mock.MockDriver)2 ResultSetProxy (com.alibaba.druid.proxy.jdbc.ResultSetProxy)2 WebStatFilter (com.alibaba.druid.support.http.WebStatFilter)2 ActiveRecordPlugin (com.jfinal.plugin.activerecord.ActiveRecordPlugin)2 MysqlDialect (com.jfinal.plugin.activerecord.dialect.MysqlDialect)2 DruidPlugin (com.jfinal.plugin.druid.DruidPlugin)2 Statement (java.sql.Statement)2 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)2 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)2 Bean (org.springframework.context.annotation.Bean)2 Filter (com.alibaba.druid.filter.Filter)1 FilterChain (com.alibaba.druid.filter.FilterChain)1 FilterChainImpl (com.alibaba.druid.filter.FilterChainImpl)1 Log4jFilter (com.alibaba.druid.filter.logging.Log4jFilter)1