mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor
This commit is contained in:
@@ -9,8 +9,6 @@ import com.alibaba.druid.wall.WallUtils;
|
||||
|
||||
public class MustParameterizedTest3 extends TestCase {
|
||||
|
||||
private String sql = "select * from t where id not in (3, 5)";
|
||||
|
||||
private WallConfig config = new WallConfig();
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@@ -18,11 +16,10 @@ public class MustParameterizedTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void testMySql() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateMySql(sql, config));
|
||||
Assert.assertFalse(WallUtils.isValidateMySql("select * from t where id = (3 + 5 - 2 - 1)", config));
|
||||
Assert.assertFalse(WallUtils.isValidateMySql("select * from t where id != id + 3", config));
|
||||
Assert.assertTrue(WallUtils.isValidateMySql("select * from t where id = ? ORDER BY 1", config));
|
||||
Assert.assertTrue(WallUtils.isValidateMySql("select 1, 2, 3 from t where id = ?", 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 MustParameterizedTest4 extends TestCase {
|
||||
|
||||
private String sql = "select * from t where id not in (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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user