Search in sources :

Example 1 with VerboseMock

use of org.eclipse.scout.rt.server.jdbc.fixture.VerboseMock in project scout.rt by eclipse.

the class BindValueTest method testNullBindWithLong.

@Test
public void testNullBindWithLong() throws Exception {
    m_sqlService.clearProtocol();
    // actual behaviour
    m_sqlService.select("SELECT A FROM T WHERE A = :a", new NVPair("a", null));
    String actual = m_sqlService.getProtocol().toString();
    // expected behaviour
    VerboseMock m = new VerboseMock(new StringBuffer());
    m.log(Connection.class, "prepareStatement", "SELECT A FROM T WHERE A = ?");
    m.log(PreparedStatement.class, "setNull", 1, Types.NULL);
    m.log(PreparedStatement.class, "executeQuery");
    m.log(ResultSet.class, "getFetchSize");
    m.log(ResultSet.class, "next");
    m.log(ResultSet.class, "close");
    String expected = m.getProtocol().toString();
    // check
    assertEquals(expected, actual);
}
Also used : VerboseMock(org.eclipse.scout.rt.server.jdbc.fixture.VerboseMock) NVPair(org.eclipse.scout.rt.platform.holders.NVPair) Test(org.junit.Test)

Example 2 with VerboseMock

use of org.eclipse.scout.rt.server.jdbc.fixture.VerboseMock in project scout.rt by eclipse.

the class BindValueTest method testNullBindWithLongAndNullType.

@Test
public void testNullBindWithLongAndNullType() throws Exception {
    m_sqlService.clearProtocol();
    // actual behaviour
    m_sqlService.select("SELECT A FROM T WHERE A = :a", new NVPair("a", null, Long.class));
    String actual = m_sqlService.getProtocol().toString();
    // expected behaviour
    VerboseMock m = new VerboseMock(new StringBuffer());
    m.log(Connection.class, "prepareStatement", "SELECT A FROM T WHERE A = ?");
    m.log(PreparedStatement.class, "setObject", 1, null, Types.BIGINT);
    m.log(PreparedStatement.class, "executeQuery");
    m.log(ResultSet.class, "getFetchSize");
    m.log(ResultSet.class, "next");
    m.log(ResultSet.class, "close");
    String expected = m.getProtocol().toString();
    // check
    assertEquals(expected, actual);
}
Also used : VerboseMock(org.eclipse.scout.rt.server.jdbc.fixture.VerboseMock) NVPair(org.eclipse.scout.rt.platform.holders.NVPair) Test(org.junit.Test)

Example 3 with VerboseMock

use of org.eclipse.scout.rt.server.jdbc.fixture.VerboseMock in project scout.rt by eclipse.

the class BindValueTest method testNullBindWithLongHolder.

@Test
public void testNullBindWithLongHolder() throws Exception {
    m_sqlService.clearProtocol();
    // actual behaviour
    m_sqlService.select("SELECT A FROM T WHERE A = :a", new NVPair("a", new LongHolder()));
    String actual = m_sqlService.getProtocol().toString();
    // expected behaviour
    VerboseMock m = new VerboseMock(new StringBuffer());
    m.log(Connection.class, "prepareStatement", "SELECT A FROM T WHERE A = ?");
    m.log(PreparedStatement.class, "setObject", 1, null, Types.BIGINT);
    m.log(PreparedStatement.class, "executeQuery");
    m.log(ResultSet.class, "getFetchSize");
    m.log(ResultSet.class, "next");
    m.log(ResultSet.class, "close");
    String expected = m.getProtocol().toString();
    // check
    assertEquals(expected, actual);
}
Also used : LongHolder(org.eclipse.scout.rt.platform.holders.LongHolder) VerboseMock(org.eclipse.scout.rt.server.jdbc.fixture.VerboseMock) NVPair(org.eclipse.scout.rt.platform.holders.NVPair) Test(org.junit.Test)

Aggregations

NVPair (org.eclipse.scout.rt.platform.holders.NVPair)3 VerboseMock (org.eclipse.scout.rt.server.jdbc.fixture.VerboseMock)3 Test (org.junit.Test)3 LongHolder (org.eclipse.scout.rt.platform.holders.LongHolder)1