Package com.alibaba.druid.bvt.filter.wall

Source Code of com.alibaba.druid.bvt.filter.wall.PGDenyFunctionTest

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 PGDenyFunctionTest extends TestCase {

    public void test_false() throws Exception {
        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)); //
    }
}
TOP

Related Classes of com.alibaba.druid.bvt.filter.wall.PGDenyFunctionTest

TOP
Copyright © 2018 www.massapi.com. 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.