use of com.alibaba.druid.wall.WallTableStat in project druid by alibaba.
the class WallStatTest_blackList_1 method testMySql.
public void testMySql() throws Exception {
WallProvider provider = new MySqlWallProvider();
for (int i = 0; i < 1001; ++i) {
String sql = "select * from t where id = " + i + " OR 1 = 1";
Assert.assertFalse(provider.checkValid(sql));
}
WallTableStat tableStat = provider.getTableStat("t");
Assert.assertEquals(1001, tableStat.getSelectCount());
Assert.assertEquals(0, provider.getBlackListHitCount());
Assert.assertEquals(0, provider.getWhiteListHitCount());
Assert.assertEquals(0, provider.getWhiteList().size());
Assert.assertEquals(200, provider.getBlackList().size());
Assert.assertEquals(1001, provider.getCheckCount());
}
use of com.alibaba.druid.wall.WallTableStat in project druid by alibaba.
the class WallStatTest_create_table method testOracle.
public void testOracle() throws Exception {
WallProvider provider = new OracleWallProvider();
provider.getConfig().setCreateTableAllow(true);
Assert.assertTrue(provider.checkValid(sql));
WallTableStat tableStat = provider.getTableStat("t");
Assert.assertEquals(1, tableStat.getCreateCount());
}
use of com.alibaba.druid.wall.WallTableStat in project druid by alibaba.
the class WallStatTest_create_table method testMySql.
public void testMySql() throws Exception {
WallProvider provider = new MySqlWallProvider();
provider.getConfig().setCreateTableAllow(true);
Assert.assertTrue(provider.checkValid(sql));
WallTableStat tableStat = provider.getTableStat("t");
Assert.assertEquals(1, tableStat.getCreateCount());
}
use of com.alibaba.druid.wall.WallTableStat in project druid by alibaba.
the class WallStatTest_delete method testOracle.
public void testOracle() throws Exception {
WallProvider provider = new OracleWallProvider();
Assert.assertTrue(provider.checkValid(sql));
WallTableStat tableStat = provider.getTableStat("t");
Assert.assertEquals(1, tableStat.getDeleteCount());
}
use of com.alibaba.druid.wall.WallTableStat in project druid by alibaba.
the class WallStatTest_delete method testSQLServer.
public void testSQLServer() throws Exception {
WallProvider provider = new SQLServerWallProvider();
Assert.assertTrue(provider.checkValid(sql));
WallTableStat tableStat = provider.getTableStat("t");
Assert.assertEquals(1, tableStat.getDeleteCount());
}
Aggregations