mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor
This commit is contained in:
@@ -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 WallDropTest1 extends TestCase {
|
||||
private String sql = "DROP TABLE T1";
|
||||
|
||||
private WallConfig config = new WallConfig();
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
config.setNoneBaseStatementAllow(true);
|
||||
}
|
||||
|
||||
public void testMySql() throws Exception {
|
||||
Assert.assertTrue(WallUtils.isValidateMySql(sql, config));
|
||||
}
|
||||
|
||||
public void testORACLE() throws Exception {
|
||||
|
||||
Assert.assertTrue(WallUtils.isValidateOracle(sql, config));
|
||||
}
|
||||
}
|
||||
@@ -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 WallTruncateTest extends TestCase {
|
||||
private String sql = "TRUNCATE TABLE T1";
|
||||
|
||||
private WallConfig config = new WallConfig();
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
//config.setTruncateAllow(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,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 WallTruncateTest1 extends TestCase {
|
||||
private String sql = "TRUNCATE TABLE T1";
|
||||
|
||||
private WallConfig config = new WallConfig();
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
config.setTruncateAllow(true);
|
||||
}
|
||||
|
||||
public void testMySql() throws Exception {
|
||||
Assert.assertTrue(WallUtils.isValidateMySql(sql, config));
|
||||
}
|
||||
|
||||
public void testORACLE() throws Exception {
|
||||
|
||||
Assert.assertTrue(WallUtils.isValidateOracle(sql, config));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user