Package com.alibaba.druid.wall

Examples of com.alibaba.druid.wall.WallProvider


* @see
*/
public class MySqlWallTest53 extends TestCase {

    public void test_true() throws Exception {
        WallProvider provider = new MySqlWallProvider();
        provider.getConfig().setLimitZeroAllow(true);

        Assert.assertTrue(provider.checkValid(//
        "select * from t limit 0,0"));

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


        Assert.assertEquals(1, provider.getTableStats().size());
    }
   
    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
       
        Assert.assertFalse(provider.checkValid(//
                "select * from t limit 0,0"));
       
        Assert.assertEquals(1, provider.getTableStats().size());
    }
View Full Code Here

* @see
*/
public class MySqlWallTest54 extends TestCase {

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

        Assert.assertTrue(provider.checkValid(//
        "SELECT *FROM T UNION select `ENGINE`, `SUPPORT` from information_schema.Engines"));

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

        Assert.assertEquals(2, provider.getTableStats().size());
    }
   
    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
       
        Assert.assertFalse(provider.checkValid(//
                "SELECT *FROM T UNION select `ENGINE`, `SUPPORT` from information_schema.Engines"));
       
        Assert.assertEquals(2, provider.getTableStats().size());
    }
View Full Code Here

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

    public void testMySql() throws Exception {
        WallProvider provider = new MySqlWallProvider();
        Assert.assertTrue(provider.checkValid(sql));

        {
            WallTableStat tableStat = provider.getTableStat("t");
            Assert.assertEquals(1, tableStat.getSelectCount());
            Assert.assertEquals(0, tableStat.getSelectIntoCount());
        }
        {
            WallTableStat tableStat = provider.getTableStat("x");
            Assert.assertEquals(0, tableStat.getSelectCount());
            Assert.assertEquals(1, tableStat.getSelectIntoCount());
        }
    }
View Full Code Here

            Assert.assertEquals(1, tableStat.getSelectIntoCount());
        }
    }

    public void testOracle() throws Exception {
        WallProvider provider = new OracleWallProvider();
        Assert.assertTrue(provider.checkValid(sql));
        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getSelectCount());
    }
View Full Code Here

        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getSelectCount());
    }

    public void testPG() throws Exception {
        WallProvider provider = new PGWallProvider();
        Assert.assertTrue(provider.checkValid(sql));
        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getSelectCount());
    }
View Full Code Here

        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getSelectCount());
    }

    public void testSQLServer() throws Exception {
        WallProvider provider = new SQLServerWallProvider();
        Assert.assertTrue(provider.checkValid(sql));
        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getSelectCount());
    }
View Full Code Here

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

public class MySqlWallTest138 extends TestCase {

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

        String sql = "INSERT INTO T01_CHECKIN_CUSTOMER" //
                     + "(WEB_USER_ID,NAME,COUNTRY,PROVINCE,CITY" //
                     + ",POSTCODE,PHONE,FAX,EMAIL,ADDRESS,FIRST_NAME,LAST_NAME,sex) " //
                     + "select 2,null,'4225',null,'beijing','','1','','1223@123.com','beijing','booking','test',null "//
                     + "from dual " //
                     + "where not exists   ("//
                     + "    select EMAIL" //
                     + "    from T01_CHECKIN_CUSTOMER" //
                     + "    where WEB_USER_ID=2 and EMAIL='1223@123.com'" //
                     + ")";
        Assert.assertTrue(provider.checkValid(sql));
    }
View Full Code Here

* @see
*/
public class MySqlWallTest_comment extends TestCase {

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

        provider.getConfig().setCommentAllow(true);

        Assert.assertTrue(provider.checkValid(//
        "SELECT * FROM T WHERE FID = ? #AND 1"));

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

TOP

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

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.