Package com.alibaba.druid.mock

Examples of com.alibaba.druid.mock.MockDriver


    private MockDriver       driver;

    private volatile boolean failed = false;

    protected void setUp() throws Exception {
        driver = new MockDriver() {

            public ResultSet executeQuery(MockStatementBase stmt, String sql) throws SQLException {
                if (failed) {
                    throw new SQLException("", "", 1040);
                }
View Full Code Here


    private MockDriver      driver;
    private DruidDataSource dataSource;

    protected void setUp() throws Exception {
        driver = new MockDriver();

        dataSource = new DruidDataSource();
        dataSource.setUrl("jdbc:mock:xxx");
        dataSource.setDriver(driver);
        dataSource.setInitialSize(1);
View Full Code Here

        config.setUrl("");
        config.setRawUrl("jdbc:mock:");

        StatFilter filter = new StatFilter();

        MockDriver driver = new MockDriver();
        DataSourceProxyImpl dataSource = new DataSourceProxyImpl(driver, config);

        filter.init(dataSource);
        config.getFilters().add(filter);
View Full Code Here

        Assert.assertEquals(0, JdbcStatManager.getInstance().getSqlList().size());
    }

    public void test_resultset() throws Exception {

        MockDriver driver = new MockDriver();
        DataSourceProxyConfig config = new DataSourceProxyConfig();
        config.setUrl("");
        config.setRawUrl("jdbc:mock:");
        DataSourceProxyImpl dataSource = new DataSourceProxyImpl(driver, config);
View Full Code Here

        String url = "jdbc:fake:x1";
        Properties info = new Properties();

        String sql = "SELECT 1";

        MockDriver driver = new MockDriver();

        Connection conn = driver.connect(url, info);
        Statement stmt = conn.createStatement();

        ResultSet rs = stmt.executeQuery(sql);
        Assert.assertEquals(true, rs.next());
        Assert.assertEquals(1, rs.getInt(1));
View Full Code Here

    }
   
    public void test_logFilter_0() throws Exception {
        DataSourceProxyConfig config = new DataSourceProxyConfig();
        config.setRawUrl("jdbc:mock:");
        DataSourceProxyImpl dataSource = new DataSourceProxyImpl(new MockDriver(), config);

        Log4jFilter log4jFilter = new Log4jFilter();
        log4jFilter.init(dataSource);
        config.getFilters().add(log4jFilter);
        setLogDisableAll(log4jFilter, true);
View Full Code Here

    }

    public void test_logFilter_1() throws Exception {
        DataSourceProxyConfig config = new DataSourceProxyConfig();
        config.setRawUrl("jdbc:mock:");
        DataSourceProxyImpl dataSource = new DataSourceProxyImpl(new MockDriver(), config);

        Log4jFilter log4jFilter = new Log4jFilter();
        log4jFilter.init(dataSource);
        config.getFilters().add(log4jFilter);
        setLogDisableAll(log4jFilter, true);
View Full Code Here

    }

    public void test_logFilter_2() throws Exception {
        DataSourceProxyConfig config = new DataSourceProxyConfig();
        config.setRawUrl("jdbc:mock:");
        DataSourceProxyImpl dataSource = new DataSourceProxyImpl(new MockDriver(), config);

        Log4jFilter log4jFilter = new Log4jFilter();
        {
            log4jFilter.init(dataSource);
            setLogDisableAll(log4jFilter, true);
View Full Code Here

TOP

Related Classes of com.alibaba.druid.mock.MockDriver

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.