Search in sources :

Example 1 with MonitorDaoJdbcImpl

use of com.alibaba.druid.support.monitor.dao.MonitorDaoJdbcImpl 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());
    }
}
Also used : JdbcSqlStatValue(com.alibaba.druid.stat.JdbcSqlStatValue) MonitorClient(com.alibaba.druid.support.monitor.MonitorClient) MonitorDaoJdbcImpl(com.alibaba.druid.support.monitor.dao.MonitorDaoJdbcImpl) List(java.util.List)

Aggregations

JdbcSqlStatValue (com.alibaba.druid.stat.JdbcSqlStatValue)1 MonitorClient (com.alibaba.druid.support.monitor.MonitorClient)1 MonitorDaoJdbcImpl (com.alibaba.druid.support.monitor.dao.MonitorDaoJdbcImpl)1 List (java.util.List)1