This commit is contained in:
温少
2012-03-17 15:10:52 +08:00
parent 2254bcfeb5
commit 204d94d6f4
24 changed files with 243 additions and 277 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;
/**
* 这个场景,检测可疑的Having条件
* @author wenshao
*
*/
public class WallSelectIntoTest extends TestCase {
private String sql = "SELECT F1, F2 INTO T2 FROM T1";
public void testMySql() throws Exception {
Assert.assertTrue(WallUtils.isValidateMySql(sql));
}
public void testORACLE() throws Exception {
Assert.assertTrue(WallUtils.isValidateOracle(sql));
}
}
@@ -0,0 +1,32 @@
package com.alibaba.druid.bvt.filter.wall;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.filter.wall.WallConfig;
import com.alibaba.druid.filter.wall.WallUtils;
/**
* 这个场景,检测
* @author wenshao
*
*/
public class WallSelectIntoTest1 extends TestCase {
private String sql = "SELECT F1, F2 INTO T2 FROM T1";
private WallConfig config = new WallConfig();
protected void setUp() throws Exception {
config.setSelectIntoAllow(false);
}
public void testMySql() throws Exception {
Assert.assertFalse(WallUtils.isValidateMySql(sql, config));
}
public void testORACLE() throws Exception {
Assert.assertFalse(WallUtils.isValidateOracle(sql, config));
}
}