mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Merge pull request #1235 from wenshao/master
WallConfig support properties config
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
package com.alibaba.druid.bvt.filter.wall;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.wall.WallConfig;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class WallConfigTest extends TestCase {
|
||||
public void test_selectAllow() throws Exception {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("druid.wall.selelctAllow", "true");
|
||||
WallConfig config = new WallConfig();
|
||||
config.configFromProperties(properties);
|
||||
|
||||
Assert.assertTrue(config.isSelelctAllow());
|
||||
}
|
||||
|
||||
public void test_selectAllow_false() throws Exception {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("druid.wall.selelctAllow", "false");
|
||||
WallConfig config = new WallConfig();
|
||||
config.configFromProperties(properties);
|
||||
|
||||
Assert.assertFalse(config.isSelelctAllow());
|
||||
}
|
||||
|
||||
public void test_deleteAllow() throws Exception {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("druid.wall.deleteAllow", "true");
|
||||
WallConfig config = new WallConfig();
|
||||
config.configFromProperties(properties);
|
||||
|
||||
Assert.assertTrue(config.isDeleteAllow());
|
||||
}
|
||||
|
||||
public void test_deleteAllow_false() throws Exception {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("druid.wall.deleteAllow", "false");
|
||||
WallConfig config = new WallConfig();
|
||||
config.configFromProperties(properties);
|
||||
|
||||
Assert.assertFalse(config.isDeleteAllow());
|
||||
}
|
||||
|
||||
public void test_updateAllow() throws Exception {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("druid.wall.updateAllow", "true");
|
||||
WallConfig config = new WallConfig();
|
||||
config.configFromProperties(properties);
|
||||
|
||||
Assert.assertTrue(config.isUpdateAllow());
|
||||
}
|
||||
|
||||
public void test_updateAllow_false() throws Exception {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("druid.wall.updateAllow", "false");
|
||||
WallConfig config = new WallConfig();
|
||||
config.configFromProperties(properties);
|
||||
|
||||
Assert.assertFalse(config.isUpdateAllow());
|
||||
}
|
||||
|
||||
|
||||
public void test_insertAllow() throws Exception {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("druid.wall.insertAllow", "true");
|
||||
WallConfig config = new WallConfig();
|
||||
config.configFromProperties(properties);
|
||||
|
||||
Assert.assertTrue(config.isInsertAllow());
|
||||
}
|
||||
|
||||
public void test_insertAllow_false() throws Exception {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("druid.wall.insertAllow", "false");
|
||||
WallConfig config = new WallConfig();
|
||||
config.configFromProperties(properties);
|
||||
|
||||
Assert.assertFalse(config.isInsertAllow());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user