Package org.jooq.tools.jdbc

Examples of org.jooq.tools.jdbc.MockConnection


        assertFalse(r.next());
    }

    @Test
    public void testCallableStatements() throws SQLException {
        MockConnection connection = new MockConnection(new MockDataProvider() {
            @Override
            public MockResult[] execute(MockExecuteContext ctx) throws SQLException {
                assertEquals("{ ? = call my_function(?, ?, ?, ?) }", ctx.sql());

                assertEquals(5, ctx.bindings().length);
                assertEquals(null, ctx.bindings()[0]);
                assertEquals(2, ctx.bindings()[1]);
                assertEquals(null, ctx.bindings()[2]);
                assertEquals(4, ctx.bindings()[3]);
                assertEquals(null, ctx.bindings()[4]);

                assertEquals(5, ctx.outParameterTypes().length);
                assertEquals(Types.INTEGER, ctx.outParameterTypes()[0]);
                assertEquals(0, ctx.outParameterTypes()[1]);
                assertEquals(Types.VARCHAR, ctx.outParameterTypes()[2]);
                assertEquals(0, ctx.outParameterTypes()[3]);
                assertEquals(Types.DATE, ctx.outParameterTypes()[4]);

                return new MockResult[] { new MockResult(recordOne) };
            }
        });

        CallableStatement stmt = connection.prepareCall("{ ? = call my_function(?, ?, ?, ?) }");

        stmt.registerOutParameter(1, Types.INTEGER);
        stmt.setInt(2, 2);
        stmt.registerOutParameter(3, Types.VARCHAR);
        stmt.setInt(4, 4);
View Full Code Here


            public MockResult[] execute(MockExecuteContext c) throws SQLException {
                return new MockResult[0];
            }
        };

        return ctx.bindContext(new MockStatement(new MockConnection(p), p));
    }
View Full Code Here

public class ConverterTest extends AbstractTest {

    @Test
    public void testConverterInMockResult() {
        Result<BoolRecord> result =
        DSL.using(new MockConnection(new MockDataProvider() {

            @Override
            public MockResult[] execute(MockExecuteContext ctx) throws SQLException {
                Result<BoolRecord> r = create.newResult(BOOL_TABLE);
View Full Code Here

TOP

Related Classes of org.jooq.tools.jdbc.MockConnection

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.