use of com.alibaba.druid.filter.stat.StatFilter in project my_curd by qinyou.
the class AppConfig method configPlugin.
@Override
public void configPlugin(Plugins me) {
DruidPlugin dbPlugin = new DruidPlugin(PropKit.get("jdbcUrl"), PropKit.get("user"), PropKit.get("password"));
// druid 监控
dbPlugin.addFilter(new StatFilter());
WallFilter wall = new WallFilter();
wall.setDbType("mysql");
dbPlugin.addFilter(wall);
ActiveRecordPlugin arp = new ActiveRecordPlugin(dbPlugin);
arp.setShowSql(PropKit.getBoolean("devMode"));
arp.setDialect(new MysqlDialect());
MappingKit.mapping(arp);
me.add(dbPlugin);
me.add(arp);
}
use of com.alibaba.druid.filter.stat.StatFilter in project neweagle-api by apgzs.
the class DruidConfiguration method statFilter.
@Bean
public StatFilter statFilter() {
StatFilter statFilter = new StatFilter();
statFilter.setLogSlowSql(true);
statFilter.setMergeSql(true);
statFilter.setSlowSqlMillis(1000);
return statFilter;
}
use of com.alibaba.druid.filter.stat.StatFilter in project druid by alibaba.
the class SlowSqlMillisTest2 method test_connect.
public void test_connect() throws Exception {
StatFilter filter = (StatFilter) dataSource.getProxyFilters().get(0);
Assert.assertEquals(500, filter.getSlowSqlMillis());
}
use of com.alibaba.druid.filter.stat.StatFilter in project druid by alibaba.
the class SlowSqlMillisTest method test_connect.
public void test_connect() throws Exception {
StatFilter filter = (StatFilter) dataSource.getProxyFilters().get(0);
Assert.assertEquals(500, filter.getSlowSqlMillis());
}
use of com.alibaba.druid.filter.stat.StatFilter in project druid by alibaba.
the class ResultSetProxyImplTest method test_resultset.
public void test_resultset() throws Exception {
MockDriver driver = new MockDriver();
DataSourceProxyConfig config = new DataSourceProxyConfig();
config.setUrl("");
config.setRawUrl("jdbc:mock:");
DataSourceProxyImpl dataSource = new DataSourceProxyImpl(driver, config);
{
StatFilter filter = new StatFilter();
filter.init(dataSource);
config.getFilters().add(filter);
}
{
Log4jFilter filter = new Log4jFilter();
filter.init(dataSource);
config.getFilters().add(filter);
}
Connection conn = dataSource.connect(null);
conn.setClientInfo("name", null);
Statement stmt = conn.createStatement();
ResultSetProxy rs = (ResultSetProxy) stmt.executeQuery(sql);
rs.insertRow();
rs.refreshRow();
rs.moveToInsertRow();
rs.moveToCurrentRow();
rs.next();
rs.updateRef(1, null);
rs.updateArray(1, null);
rs.updateRowId(1, null);
rs.updateNString(1, null);
rs.updateNClob(1, (NClob) null);
rs.updateNClob(1, (Reader) null);
rs.updateNClob(1, (Reader) null, 0);
rs.updateSQLXML(1, null);
rs.updateNCharacterStream(1, null);
rs.updateNCharacterStream(1, null, 0);
rs.getArray("1");
rs.updateRef("1", null);
rs.updateArray("1", null);
rs.updateRowId("1", null);
rs.updateNString("1", null);
rs.updateNClob("1", (NClob) null);
rs.updateNClob("1", (Reader) null);
rs.updateNClob("1", (Reader) null, 0);
rs.updateSQLXML("1", null);
rs.updateNCharacterStream("1", null);
rs.updateNCharacterStream("1", null, 0);
}
Aggregations