Package com.alibaba.druid.mock

Examples of com.alibaba.druid.mock.MockClob


public class DruidLobHandlerTest extends TestCase {

    public void test_0() throws Exception {
        DruidLobHandler handler = new DruidLobHandler();
        List<Object[]> rows = new ArrayList<Object[]>();
        rows.add(new Object[] { null, new MockBlob(), new MockClob() });
        MockResultSet rs = new MockResultSet(null, rows);
        rs.next();

        handler.getBlobAsBinaryStream(rs, 1);
        handler.getBlobAsBinaryStream(rs, "1");
View Full Code Here


            @Override
            public Object resultSet_getObject(FilterChain chain, ResultSetProxy result, int columnIndex)
                                                                                                      throws SQLException {
                return new ClobProxyImpl(result.getStatementProxy().getConnectionProxy().getDirectDataSource(),
                                         result.getStatementProxy().getConnectionProxy(), new MockClob());
            }

            @Override
            public Object resultSet_getObject(FilterChain chain, ResultSetProxy result, String columnLabel)
                                                                                                         throws SQLException {
                return new ClobProxyImpl(result.getStatementProxy().getConnectionProxy().getDirectDataSource(),
                                         result.getStatementProxy().getConnectionProxy(), new MockClob());
            }

            @Override
            public Object resultSet_getObject(FilterChain chain, ResultSetProxy result, int columnIndex,
                                              java.util.Map<String, Class<?>> map) throws SQLException {
                return new ClobProxyImpl(result.getStatementProxy().getConnectionProxy().getDirectDataSource(),
                                         result.getStatementProxy().getConnectionProxy(), new MockClob());
            }

            @Override
            public Object resultSet_getObject(FilterChain chain, ResultSetProxy result, String columnIndex,
                                              java.util.Map<String, Class<?>> map) throws SQLException {
                return new ClobProxyImpl(result.getStatementProxy().getConnectionProxy().getDirectDataSource(),
                                         result.getStatementProxy().getConnectionProxy(), new MockClob());
            }
        });
        dataSource.init();
    }
View Full Code Here

        mockResultSet = new MockResultSet(null) {

            public Object getObject(int columnIndex) throws SQLException {
                invokeCount++;
                return new MockClob();
            }
        };
    }
View Full Code Here

            PreparedStatement stmt = conn.prepareStatement(sql);

            stmt.setNull(1, Types.VARCHAR);
            stmt.setString(2, buf.toString());
            stmt.setClob(3, new MockClob());
            stmt.setNClob(4, new MockNClob());
            stmt.setBlob(5, new MockBlob());

            ResultSet rs = stmt.executeQuery();
            rs.close();
View Full Code Here

            @Override
            public Clob resultSet_getClob(FilterChain chain, ResultSetProxy result, int columnIndex)
                                                                                                    throws SQLException {
                return new ClobProxyImpl(result.getStatementProxy().getConnectionProxy().getDirectDataSource(),
                                         result.getStatementProxy().getConnectionProxy(), new MockClob());
            }

            @Override
            public Clob resultSet_getClob(FilterChain chain, ResultSetProxy result, String columnLabel)
                                                                                                       throws SQLException {
                return new ClobProxyImpl(result.getStatementProxy().getConnectionProxy().getDirectDataSource(),
                                         result.getStatementProxy().getConnectionProxy(), new MockClob());
            }
        });
        dataSource.init();
    }
View Full Code Here

        MockCallableStatement mockStmt = new MockCallableStatement(null, "") {

            @Override
            public Object getObject(int parameterIndex) throws SQLException {
                invokeCount++;
                return new MockClob();
            }
        };

        statement = new CallableStatementProxyImpl(new ConnectionProxyImpl(null, null, null, 0), mockStmt, "", 1);
View Full Code Here

        Connection conn = dataSource.getConnection();

        PreparedStatement stmt = conn.prepareStatement(sql);

        MockClob clob = new MockClob();
        stmt.setClob(1, clob);

        ResultSet rs = stmt.executeQuery();
        rs.next();
        Assert.assertTrue(rs.getObject(1) instanceof ClobProxy);
View Full Code Here

TOP

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

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.