sqll wall

This commit is contained in:
温少
2012-03-22 18:16:54 +08:00
parent 827170f879
commit 019f54ab8f
10 changed files with 216 additions and 9 deletions
@@ -0,0 +1,28 @@
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 IdentEqualsTest extends TestCase {
private String sql = "select * from t where id = id";
private WallConfig config = new WallConfig();
protected void setUp() throws Exception {
}
public void testMySql() throws Exception {
Assert.assertFalse(WallUtils.isValidateMySql(sql, config));
}
public void testORACLE() throws Exception {
Assert.assertFalse(WallUtils.isValidateOracle(sql, config));
}
}
@@ -0,0 +1,28 @@
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 IdentEqualsTest1 extends TestCase {
private String sql = "select * from t where not (id != id)";
private WallConfig config = new WallConfig();
protected void setUp() throws Exception {
}
public void testMySql() throws Exception {
Assert.assertFalse(WallUtils.isValidateMySql(sql, config));
}
public void testORACLE() throws Exception {
Assert.assertFalse(WallUtils.isValidateOracle(sql, config));
}
}
@@ -0,0 +1,28 @@
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 MustParameterizedTest extends TestCase {
private String sql = "select * from t where id = 3";
private WallConfig config = new WallConfig();
protected void setUp() throws Exception {
config.setMustParameterized(true);
}
public void testMySql() throws Exception {
Assert.assertFalse(WallUtils.isValidateMySql(sql, config));
}
public void testORACLE() throws Exception {
Assert.assertFalse(WallUtils.isValidateOracle(sql, config));
}
}
@@ -0,0 +1,28 @@
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 MustParameterizedTest1 extends TestCase {
private String sql = "select * from t where id = 3 + 5";
private WallConfig config = new WallConfig();
protected void setUp() throws Exception {
config.setMustParameterized(true);
}
public void testMySql() throws Exception {
Assert.assertFalse(WallUtils.isValidateMySql(sql, config));
}
public void testORACLE() throws Exception {
Assert.assertFalse(WallUtils.isValidateOracle(sql, config));
}
}