예제 #1
0
  public void test_true() throws Exception {
    WallProvider provider = new MySqlWallProvider();

    Assert.assertTrue(
        provider.checkValid( //
            "COMMIT")); //

    Assert.assertEquals(0, provider.getTableStats().size());
    System.out.println(JSONUtils.toJSONString(provider.getStatsMap()));
  }
  protected void setUp() throws Exception {
    TabularData sqlList = JdbcStatManager.getInstance().getSqlList();
    if (sqlList.size() > 0) {
      for (Object item : JdbcStatManager.getInstance().getSqlList().values()) {
        String text = JSONUtils.toJSONString(item);
        System.out.println(text);
      }
    }

    Assert.assertEquals(0, JdbcStatManager.getInstance().getSqlList().size());

    dataSource = new DruidDataSource();
    dataSource.setUrl("jdbc:mock:xx");
    dataSource.setFilters("mergeStat");
    dataSource.setDbType("mysql");
  }
예제 #3
0
 public static String returnJSONResult(int resultCode, Object content) {
   Map<String, Object> dataMap = new LinkedHashMap<String, Object>();
   dataMap.put("ResultCode", resultCode);
   dataMap.put("Content", content);
   return JSONUtils.toJSONString(dataMap);
 }
예제 #4
0
 public void test_parse() throws Exception {
   String text = Utils.readFromResource("bvt/sonar-sql.json");
   Map<String, Object> result = (Map<String, Object>) JSONUtils.parse(text);
   LinkedHashMap wallStats = (LinkedHashMap) result.get("Content");
   System.out.println(wallStats.get("blackList"));
 }
예제 #5
0
 public void test_parse() throws Exception {
   String text = "{\"\\u0006\":\"123\"}";
   JSONUtils.parse(text);
 }