Package com.mockrunner.mock.jdbc

Examples of com.mockrunner.mock.jdbc.MockStatement


        assertEquals("1", row.get("a"));
    }

    public void testClose() throws Exception {
        MockConnection c = new MockConnection();
        MockStatement s = new MockStatement(c);
        MockResultSet rs = new MockResultSet("rs");
        rs.addColumn("a", new Object[] {
                "1", "2", "3"
        });
        RowDescriptor descriptor = new RowDescriptorBuilder()
                .setResultSet(rs)
                .getDescriptor(new ExtendedTypeMap());

        JDBCResultIterator it = new JDBCResultIterator(c, s, rs, descriptor, new MockQueryMetadata());

        assertFalse(rs.isClosed());
        assertFalse(s.isClosed());
        assertFalse(c.isClosed());

        it.setClosingConnection(false);
        it.close();

        assertTrue(rs.isClosed());
        assertTrue(s.isClosed());
        assertFalse(c.isClosed());
    }
View Full Code Here


    }

    JDBCResultIterator makeIterator() throws Exception {

        Connection c = new MockConnection();
        Statement s = new MockStatement(c);
        MockResultSet rs = new MockResultSet("rs");
        rs.addColumn("a", new Object[] {
                "1", "2", "3"
        });
View Full Code Here

        MockPreparedStatement pstmt;
       
        @Override
        public Statement createStatement() throws SQLException {
            // statement used for all queries
            stmt = new MockStatement(this) {
               
                @Override
                public ResultSet executeQuery(String sql)
                        throws SQLException {
                    // check if the condition ID = 'some text' is present in the query
View Full Code Here

    static class RecordingConnection extends MockConnection {

        List<String> commands = new ArrayList<String>();

        public java.sql.Statement createStatement() throws java.sql.SQLException {
            return new MockStatement(this) {
                public boolean execute(String sql) throws java.sql.SQLException {
                    commands.add(sql);
                    return false;
                }
            };
View Full Code Here

TOP

Related Classes of com.mockrunner.mock.jdbc.MockStatement

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.