use of com.alibaba.druid.support.monitor.MonitorClient in project druid by alibaba.
the class MonitorClientContextListener method contextInitialized.
@Override
public void contextInitialized(ServletContextEvent event) {
client = new MonitorClient();
client.start();
}
use of com.alibaba.druid.support.monitor.MonitorClient in project druid by alibaba.
the class MonitorDaoJdbcImplTest method testBuildSql.
public void testBuildSql() throws Exception {
MonitorDaoJdbcImpl dao = new MonitorDaoJdbcImpl();
dao.setDataSource(dataSource);
// System.out.println(buildCreateSql(dao, new BeanInfo(WallProviderStatValue.class)));
// System.out.println(buildCreateSql(dao, new BeanInfo(WallSqlStatValue.class)));
// System.out.println(buildCreateSql(dao, new BeanInfo(WallTableStatValue.class)));
// System.out.println(buildCreateSql(dao, new BeanInfo(WallFunctionStatValue.class)));
// dao.createTables("mysql");
MonitorClient client = new MonitorClient();
client.setDao(dao);
client.checkInst();
client.collectSql();
{
List<JdbcSqlStatValue> sqlList = client.loadSqlList(Collections.<String, Object>emptyMap());
for (JdbcSqlStatValue sqlStatValue : sqlList) {
System.out.println(sqlStatValue.getData());
}
// Assert.assertEquals(11, sqlList.size());
}
client.collectSql();
{
List<JdbcSqlStatValue> sqlList = client.loadSqlList(Collections.<String, Object>emptyMap());
for (JdbcSqlStatValue sqlStatValue : sqlList) {
System.out.println(sqlStatValue.getData());
}
// Assert.assertEquals(14, sqlList.size());
}
}
Aggregations