This commit is contained in:
温少
2012-03-18 01:46:38 +08:00
4 changed files with 179 additions and 41 deletions
@@ -1,28 +1,28 @@
package com.alibaba.druid.bvt.filter.wall;
import org.junit.Assert;
import com.alibaba.druid.filter.wall.WallConfig;
import com.alibaba.druid.filter.wall.WallUtils;
import junit.framework.TestCase;
/**
* 这个场景测试访问MySql系统函数
*
* @author admin
*/
public class MySqlWallPermitTableTest extends TestCase {
public void test_default() throws Exception {
Assert.assertFalse(WallUtils.isValidateMySql("select benchmark( 500000, sha1( 'test' ) )"));
}
public void test_allow() throws Exception {
WallConfig config = new WallConfig();
config.setTableCheck(false);
Assert.assertTrue(WallUtils.isValidateMySql("select benchmark( 500000, sha1( 'test' ) )", config));
}
}
package com.alibaba.druid.bvt.filter.wall;
import org.junit.Assert;
import com.alibaba.druid.filter.wall.WallConfig;
import com.alibaba.druid.filter.wall.WallUtils;
import junit.framework.TestCase;
/**
* 这个场景测试访问MySql系统表
*
* @author admin
*/
public class MySqlWallPermitTableTest extends TestCase {
public void test_default() throws Exception {
Assert.assertFalse(WallUtils.isValidateMySql("select benchmark( 500000, sha1( 'test' ) )"));
}
public void test_allow() throws Exception {
WallConfig config = new WallConfig();
config.setTableCheck(false);
Assert.assertTrue(WallUtils.isValidateMySql("select benchmark( 500000, sha1( 'test' ) )", config));
}
}
@@ -0,0 +1,20 @@
package com.alibaba.druid.bvt.filter.wall;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.filter.wall.WallUtils;
/**
* 这个场景测试访问SQLServer系统表
*
* @author RaymondXiu
* @version 1.0, 2012-3-18
* @see
*/
public class SQLServerWallPermitTableTest extends TestCase {
public void test_permitTable() throws Exception {
Assert.assertFalse(WallUtils.isValidateSqlServer("select * from sysObjects"));
}
}