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,30 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 这个场景测试访问Oracle系统对象
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
public class MySqlWallPermitVariantTest extends TestCase {
|
||||
|
||||
public void test_allow() throws Exception {
|
||||
WallConfig config = new WallConfig();
|
||||
config.setVariantCheck(false);
|
||||
|
||||
Assert.assertTrue(WallUtils.isValidateMySql("select @@version_compile_os", config));
|
||||
}
|
||||
|
||||
public void test_not_allow() throws Exception {
|
||||
WallConfig config = new WallConfig();
|
||||
config.setVariantCheck(true);
|
||||
|
||||
Assert.assertFalse(WallUtils.isValidateMySql("select @@version_compile_os", config));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 这个场景测试访问Oracle系统对象
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
public class OracleWallPermitVariantTest extends TestCase {
|
||||
|
||||
public void test_permitTable() throws Exception {
|
||||
WallConfig config = new WallConfig();
|
||||
config.setVariantCheck(false);
|
||||
|
||||
Assert.assertTrue(WallUtils.isValidateOracle("select UID from dual", config));
|
||||
Assert.assertTrue(WallUtils.isValidateOracle("select USER from dual", config));
|
||||
Assert.assertTrue(WallUtils.isValidateOracle("select user from dual", config));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.alibaba.druid.bvt.filter.wall;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.filter.wall.WallUtils;
|
||||
|
||||
/**
|
||||
* 这个场景测试访问Oracle系统对象
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
public class OracleWallPermitVariantTest2 extends TestCase {
|
||||
|
||||
public void test_permitTable() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("select UID from dual"));
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("select USER from dual"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class OnlineOracleTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_connect() throws Exception {
|
||||
executeQuery("select * from all_users");
|
||||
executeQuery("select UID, USER FROM DUAL");
|
||||
}
|
||||
|
||||
public void executeQuery(String sql) throws SQLException {
|
||||
|
||||
Reference in New Issue
Block a user