add wall test

This commit is contained in:
温少
2012-03-15 23:55:29 +08:00
6 changed files with 106 additions and 3 deletions
@@ -0,0 +1,24 @@
package com.alibaba.druid.bvt.filter.wall;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.filter.wall.WallUtils;
/**
* 测试单行注释的场景
* @author admin
*
*/
public class WallLineCommentTest extends TestCase {
private String sql = "select f1 from t -- ";
public void testOracle() throws Exception {
Assert.assertFalse(WallUtils.isValidateOracle(sql));
}
public void testMySql() throws Exception {
Assert.assertFalse(WallUtils.isValidateMySql(sql));
}
}
@@ -0,0 +1,24 @@
package com.alibaba.druid.bvt.filter.wall;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.filter.wall.WallUtils;
/**
* 测试多行注释的场景
* @author admin
*
*/
public class WallMultiLineCommentTest extends TestCase {
private String sql = "select f1 from t /* xx */ ";
public void testOracle() throws Exception {
Assert.assertFalse(WallUtils.isValidateOracle(sql));
}
public void testMySql() throws Exception {
Assert.assertFalse(WallUtils.isValidateMySql(sql));
}
}
@@ -0,0 +1,24 @@
package com.alibaba.druid.bvt.filter.wall;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.filter.wall.WallUtils;
/**
* 测试禁止多条语句执行的场景
* @author admin
*
*/
public class WallMultiStatementTest extends TestCase {
private String sql = "SELECT email FROM members WHERE email = 'x'; UPDATE members SET email = 'steve@unixwiz.net' WHERE email = 'bob@example.com';";
public void testOracle() throws Exception {
Assert.assertFalse(WallUtils.isValidateOracle(sql));
}
public void testMySql() throws Exception {
Assert.assertFalse(WallUtils.isValidateMySql(sql));
}
}