improve WallFilter, support intersectAllow

This commit is contained in:
wenshao
2013-03-19 01:31:32 +08:00
parent f1e6e0d937
commit c75c44e9ee
4 changed files with 41 additions and 4 deletions
@@ -0,0 +1,23 @@
package com.alibaba.druid.bvt.filter.wall;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.wall.WallConfig;
import com.alibaba.druid.wall.WallUtils;
public class IntersectTest extends TestCase {
public void test_false() throws Exception {
Assert.assertFalse(WallUtils.isValidateOracle(//
"SELECT * FROM A MINUS SELECT * FROM B")); //
}
public void test_true() throws Exception {
WallConfig config = new WallConfig();
config.setMinusAllow(true);
Assert.assertTrue(WallUtils.isValidateOracle(//
"SELECT * FROM A MINUS SELECT * FROM B", config)); //
}
}
@@ -11,13 +11,13 @@ public class MinusTest extends TestCase {
public void test_false() throws Exception {
Assert.assertFalse(WallUtils.isValidateOracle(//
"SELECT * FROM A MINUS SELECT * FROM B")); //
"SELECT * FROM A Intersect SELECT * FROM B")); //
}
public void test_true() throws Exception {
WallConfig config = new WallConfig();
config.setMinusAllow(true);
config.setIntersectAllow(true);
Assert.assertTrue(WallUtils.isValidateOracle(//
"SELECT * FROM A MINUS SELECT * FROM B", config)); //
"SELECT * FROM A Intersect SELECT * FROM B", config)); //
}
}