Package com.alibaba.druid.wall

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


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

public class MySqlWallTest102 extends TestCase {

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

        String sql = "select * from t where id = ? or substr(bin(97>>5), -1, 1)";

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


* @see
*/
public class MySqlWallTest69 extends TestCase {

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

        Assert.assertTrue(provider.checkValid(//
        "select * from T--"));

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

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

public class MySqlWallTest131 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
        provider.getConfig().setCommentAllow(true);
       
        Assert.assertFalse(provider.checkValid("select * from t where id = 1 /*!30000union all select 2*/"));
    }
View Full Code Here

* @see
*/
public class MySqlWallTest_ifnull_2 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
       
        Assert.assertFalse(provider.checkValid(//
        "SELECT * FROM T WHERE FID = ? OR IFNULL(CAST(CURRENT_USER() AS CHAR))"));

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

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

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

        Assert.assertTrue(provider.checkValid(sql));
        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getDropCount());
    }
View Full Code Here

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

    public void testOracle() throws Exception {
        WallProvider provider = new OracleWallProvider();
        provider.getConfig().setDropTableAllow(true);

        Assert.assertTrue(provider.checkValid(sql));
        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getDropCount());
    }
View Full Code Here

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

    public void testPG() throws Exception {
        WallProvider provider = new PGWallProvider();
        provider.getConfig().setDropTableAllow(true);

        Assert.assertTrue(provider.checkValid(sql));
        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getDropCount());
    }
View Full Code Here

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

    public void testSQLServer() throws Exception {
        WallProvider provider = new SQLServerWallProvider();
        provider.getConfig().setDropTableAllow(true);

        Assert.assertTrue(provider.checkValid(sql));
        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getDropCount());
    }
View Full Code Here

* @see
*/
public class SQLServerWallTest_9 extends TestCase {

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

        String sql = "SELECT s.id FROM snapshots s " //
                     + "WHERE s.scope='PRJ'"//
                     + " and s.qualifier IN ('TRK', 'BRC')"//
                     + " AND status='P'" //
                     + " AND islast=0" //
                     + " AND NOT EXISTS (select m.id from project_measures m WHERE m.snapshot_id=s.id)";

        Assert.assertTrue(provider.checkValid(sql));

    }
View Full Code Here

* @see
*/
public class MySqlWallTest88 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
       
        Assert.assertTrue(provider.checkValid(//
        "DROP INDEX `PRIMARY` ON t;"));

        Assert.assertEquals(1, provider.getTableStats().size());
        Assert.assertTrue(provider.getTableStats().containsKey("t"));
    }
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.