Package com.alibaba.druid.wall

Examples of com.alibaba.druid.wall.WallConfig


        Assert.assertFalse(WallUtils.isValidatePostgres(//
        "select * from t where fid = 1 union SELECT current_catalog() from t where id = ?")); //
    }

    public void test_true() throws Exception {
        WallConfig config = new WallConfig();
        config.setFunctionCheck(false);
        Assert.assertTrue(WallUtils.isValidatePostgres(//
        "SELECT current_catalog() from t where id = ?", config)); //
    }
View Full Code Here


    public void test_0_0() throws Exception {
        Assert.assertFalse(WallUtils.isValidateMySql("select * FROM X where version=@@version_compile_os"));
    }

    public void test_1() throws Exception {
        final WallConfig config = new WallConfig();
        config.setDoPrivilegedAllow(true);

        WallProvider.doPrivileged(new PrivilegedAction<Object>() {

            @Override
            public Object run() {
View Full Code Here

public class WallUpdateTest2 extends TestCase {

    private String sql = "UPDATE T_USER SET FNAME = ?";

    public void testMySql_true() throws Exception {
        WallConfig config = new WallConfig();
        Assert.assertTrue(WallUtils.isValidateMySql(sql, config));
    }
View Full Code Here

        WallConfig config = new WallConfig();
        Assert.assertTrue(WallUtils.isValidateMySql(sql, config));
    }

    public void testORACLE_true() throws Exception {
        WallConfig config = new WallConfig();
        Assert.assertTrue(WallUtils.isValidateOracle(sql, config));
    }
View Full Code Here

        WallConfig config = new WallConfig();
        Assert.assertTrue(WallUtils.isValidateOracle(sql, config));
    }
   
    public void testMySql_false() throws Exception {
        WallConfig config = new WallConfig();
        config.setUpdateAllow(false);
        Assert.assertFalse(WallUtils.isValidateMySql(sql, config));
    }
View Full Code Here

        config.setUpdateAllow(false);
        Assert.assertFalse(WallUtils.isValidateMySql(sql, config));
    }
   
    public void testORACLE_false() throws Exception {
        WallConfig config = new WallConfig();
        config.setUpdateAllow(false);
        Assert.assertFalse(WallUtils.isValidateOracle(sql, config));
    }
View Full Code Here

        Assert.assertTrue(WallUtils.isValidateMySql(//
        "SELECT * from t where ~2")); //
    }

    public void test_false() throws Exception {
        WallConfig config = new WallConfig();
        config.setConditionOpBitwseAllow(false);
        Assert.assertFalse(WallUtils.isValidateMySql(//
        "SELECT * from t where ~2", config)); //
    }
View Full Code Here

import com.alibaba.druid.wall.WallUtils;

public class MySqlWallTest_union extends TestCase {

    public void testUnion() throws Exception {
        WallConfig config = new WallConfig();
        config.setSelectUnionCheck(true);

        Assert.assertTrue(WallUtils.isValidateMySql("select f1, f2 from t where id=1 union select 1, 2", config)); // not end of comment
        Assert.assertFalse(WallUtils.isValidateMySql("select f1, f2 from t where id=1 union select 1, 2 --", config));

        Assert.assertTrue(WallUtils.isValidateMySql("select f1, f2 from t union select 1, 2", config)); // no where
View Full Code Here

* @author wenshao
*/
public class WallDropTest extends TestCase {

    public void testMySql() throws Exception {
        WallConfig config = new WallConfig();
        config.setDropTableAllow(false);
        Assert.assertFalse(WallUtils.isValidateMySql("DROP TABLE T1", config));
    }
View Full Code Here

        config.setDropTableAllow(false);
        Assert.assertFalse(WallUtils.isValidateMySql("DROP TABLE T1", config));
    }

    public void testOracle() throws Exception {
        WallConfig config = new WallConfig();
        config.setDropTableAllow(false);
        Assert.assertFalse(WallUtils.isValidateOracle("DROP TABLE T1", config));
    }
View Full Code Here

TOP

Related Classes of com.alibaba.druid.wall.WallConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.