Examples of MockConnection


Examples of org.jooq.tools.jdbc.MockConnection

    @Test
    public void testInsertReturning() {

        // Note: INSERT .. RETURNING is hard to mock for all dialects...
        DSLContext e = DSL.using(new MockConnection(new InsertReturning()), SQLDialect.POSTGRES);

        InsertResultStep<Table1Record> query = e
            .insertInto(TABLE1, FIELD_ID1)
            .values(1)
            .returning();
View Full Code Here

Examples of org.jooq.tools.jdbc.MockConnection

        }
    }

    @Test
    public void testArrays() {
        DSLContext e = DSL.using(new MockConnection(new ArrayResult(3)), SQLDialect.POSTGRES);

        Result<Record2<String[], Integer[]>> r = e.select(strings, integers).fetch();
        assertEquals(4, r.size());
        assertEquals(2, r.fields().length);
        assertNull(r.getValue(0, "STRINGS"));
View Full Code Here

Examples of org.jooq.tools.jdbc.MockConnection

        assertArrayEquals(new Integer[] { 2, 2 }, (Integer[]) r.getValue(3, "INTEGERS"));
    }

    @Test
    public void testJDBCArrays() throws SQLException {
        DSLContext e = DSL.using(new MockConnection(new ArrayResult(3)), SQLDialect.POSTGRES);

        ResultSet r = e.select(strings, integers).fetchResultSet();
        assertEquals(2, r.getMetaData().getColumnCount());

        assertTrue(r.next());
View Full Code Here

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

Examples of org.jooq.tools.jdbc.MockConnection

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

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

Examples of org.jooq.tools.jdbc.MockConnection

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

Examples of org.voltcore.network.MockConnection

    @Before
    public void setUp() throws Exception {
        RateLimitedClientNotifier.WARMUP_MS = 0;
        notifier = new RateLimitedClientNotifier();
        connection = new MockConnection();
        mws = connection.m_writeStream;
        messages = mws.m_messages;
        cihm = new ClientInterfaceHandleManager(false, connection, null );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.