Package com.alibaba.druid.wall

Examples of com.alibaba.druid.wall.WallProvider$WallCommentHandler


       
        Assert.assertEquals(1, provider.getTableStats().size());
    }
   
    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
       
        Assert.assertFalse(provider.checkValid(//
                "select * from t where fid = 1 union SELECT USER() FROM X"));
       
    }
View Full Code Here


* @see
*/
public class MySqlWallTest87 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
       
        Assert.assertTrue(provider.checkValid(//
        "CREATE VIEW test.v AS SELECT * FROM t;"));

        Assert.assertEquals(1, provider.getTableStats().size());
        Assert.assertTrue(provider.getTableStats().containsKey("t"));
    }
View Full Code Here

import com.alibaba.druid.wall.spi.MySqlWallProvider;

public class MySqlWallTest120 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
        provider.getConfig().setCommentAllow(false);

        String sql = "SELECT name, '******' password, createTime from user where name like 'admin%' AND SLEEP(5) AND '%'=''";

        Assert.assertFalse(provider.checkValid(sql));
    }
View Full Code Here

* @see
*/
public class MySqlWallTest85 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
       
        Assert.assertTrue(provider.checkValid(//
        "CREATE TABLE lookup (id INT) ENGINE = MEMORY;"));

        Assert.assertEquals(1, provider.getTableStats().size());
    }
View Full Code Here

* @see
*/
public class MySqlWallTest45 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();

        Assert.assertTrue(provider.checkValid(//
        "SELECT @1119453529t_processID, @1119453529t_ret"));

        Assert.assertEquals(0, provider.getTableStats().size());
    }
View Full Code Here

* @see
*/
public class MySqlWallTest79 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
       
        Assert.assertFalse(provider.checkValid(//
        "SELECT * FROM T WHERE FID = ? OR LEAST(2,1,9,8) = 1"));

        Assert.assertEquals(1, provider.getTableStats().size());
    }
View Full Code Here

* @see
*/
public class MySqlWallTest46 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();

        Assert.assertTrue(provider.checkValid(//
        "select aid,subject,dateline from www_subject where subject like '%%' order by aid desc limit 30;"));

        Assert.assertEquals(1, provider.getTableStats().size());
    }
View Full Code Here

* @see
*/
public class MySqlWallTest40 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
        provider.getConfig().setUseAllow(false);

        Assert.assertFalse(provider.checkValid(//
        "use huaianapp")); //

        Assert.assertEquals(0, provider.getTableStats().size());
    }
View Full Code Here

        Assert.assertEquals(0, provider.getTableStats().size());
    }

    public void test_true() throws Exception {
        WallProvider provider = new MySqlWallProvider();

        Assert.assertTrue(provider.checkValid(//
        "use huaianapp")); //

        Assert.assertEquals(0, provider.getTableStats().size());
    }
View Full Code Here

    protected void tearDown() throws Exception {
        WallContext.clearContext();
    }

    public void testMySql() throws Exception {
        WallProvider provider = new MySqlWallProvider();

        for (int i = 0; i < 1001; ++i) {
            String sql = "select * from t where id = " + i + " OR 1 = 1";
            Assert.assertFalse(provider.checkValid(sql));
        }

        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1001, tableStat.getSelectCount());
        Assert.assertEquals(0, provider.getBlackListHitCount());
        Assert.assertEquals(0, provider.getWhiteListHitCount());
        Assert.assertEquals(0, provider.getWhiteList().size());
        Assert.assertEquals(200, provider.getBlackList().size());
        Assert.assertEquals(1001, provider.getCheckCount());
    }
View Full Code Here

TOP

Related Classes of com.alibaba.druid.wall.WallProvider$WallCommentHandler

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.