Package org.springframework.jdbc.support.lob

Examples of org.springframework.jdbc.support.lob.LobHandler


* @since 17.12.2003
*/
public class DefaultLobHandlerTests extends TestCase {

  public void testGetBlobAsBytes() throws SQLException {
    LobHandler lobHandler = new DefaultLobHandler();
    MockControl rsControl = MockControl.createControl(ResultSet.class);
    ResultSet rs = (ResultSet) rsControl.getMock();
    rs.getBytes(1);
    rsControl.setReturnValue(null);
    rsControl.replay();
    lobHandler.getBlobAsBytes(rs, 1);
    rsControl.verify();
  }
View Full Code Here


    lobHandler.getBlobAsBytes(rs, 1);
    rsControl.verify();
  }

  public void testGetBlobAsBinaryStream() throws SQLException {
    LobHandler lobHandler = new DefaultLobHandler();
    MockControl rsControl = MockControl.createControl(ResultSet.class);
    ResultSet rs = (ResultSet) rsControl.getMock();
    rs.getBinaryStream(1);
    rsControl.setReturnValue(null);
    rsControl.replay();
    lobHandler.getBlobAsBinaryStream(rs, 1);
    rsControl.verify();
  }
View Full Code Here

    lobHandler.getBlobAsBinaryStream(rs, 1);
    rsControl.verify();
  }

  public void testGetClobAsString() throws SQLException {
    LobHandler lobHandler = new DefaultLobHandler();
    MockControl rsControl = MockControl.createControl(ResultSet.class);
    ResultSet rs = (ResultSet) rsControl.getMock();
    rs.getString(1);
    rsControl.setReturnValue(null);
    rsControl.replay();
    lobHandler.getClobAsString(rs, 1);
    rsControl.verify();
  }
View Full Code Here

    lobHandler.getClobAsString(rs, 1);
    rsControl.verify();
  }

  public void testGetClobAsAsciiStream() throws SQLException {
    LobHandler lobHandler = new DefaultLobHandler();
    MockControl rsControl = MockControl.createControl(ResultSet.class);
    ResultSet rs = (ResultSet) rsControl.getMock();
    rs.getAsciiStream(1);
    rsControl.setReturnValue(null);
    rsControl.replay();
    lobHandler.getClobAsAsciiStream(rs, 1);
    rsControl.verify();
  }
View Full Code Here

    lobHandler.getClobAsAsciiStream(rs, 1);
    rsControl.verify();
  }

  public void testGetClobAsCharacterStream() throws SQLException {
    LobHandler lobHandler = new DefaultLobHandler();
    MockControl rsControl = MockControl.createControl(ResultSet.class);
    ResultSet rs = (ResultSet) rsControl.getMock();
    rs.getCharacterStream(1);
    rsControl.setReturnValue(null);
    rsControl.replay();
    lobHandler.getClobAsCharacterStream(rs, 1);
    rsControl.verify();
  }
View Full Code Here

    // - lob creator should be closed
    // - set return value should be called
    // - execute update should be called
   
    MockControl lobHandlerControl = MockControl.createControl(LobHandler.class);
    LobHandler handler = (LobHandler)lobHandlerControl.getMock();   
   
    MockControl lobCreatorControl = MockControl.createControl(LobCreator.class);
    LobCreator creator = (LobCreator)lobCreatorControl.getMock();
   
    MockControl psControl = MockControl.createControl(PreparedStatement.class);
    PreparedStatement ps = (PreparedStatement)psControl.getMock();
   
    handler.getLobCreator();
    lobHandlerControl.setReturnValue(creator);
    ps.executeUpdate();
    psControl.setReturnValue(3);
    creator.close();
   
View Full Code Here

              @Override
              public void processRow(ResultSet rs)
                  throws SQLException {
                if (!bFirstRowRead) {
                  LobHandler lobHandler = new DefaultLobHandler();
                  String clobText = lobHandler
                      .getClobAsString(rs, 1);
                  aCAS.setDocumentText(clobText);
                  bFirstRowRead = true;
                } else {
                  log.error("Multiple documents for document key: "
View Full Code Here

    props.load(in);

    datasource = new DriverManagerDataSource(props.getProperty("db.url"), props.getProperty("db.username"), props.getProperty("db.password"));

    DataObjectFactory dataObjectFactory = new TgacDataObjectFactory();
    LobHandler lh = new DefaultLobHandler();
    JdbcTemplate template = new JdbcTemplate(datasource);

    //securityDAO = new SQLSecurityDAO();
    securityDAO = new MockSQLSecurityDAO();
    securityDAO.setLobHandler(lh);
View Full Code Here

  @Rule
  public ExpectedException thrown = ExpectedException.none();

  @Test
  public void testCreatingPreparedStatementCallback() throws SQLException {
    LobHandler handler = mock(LobHandler.class);
    LobCreator creator = mock(LobCreator.class);
    PreparedStatement ps = mock(PreparedStatement.class);

    given(handler.getLobCreator()).willReturn(creator);
    given(ps.executeUpdate()).willReturn(3);

    class SetValuesCalled {
      boolean b = false;
    }
View Full Code Here

    when(incrementerFactory.getIncrementer("ORACLE", tablePrefix + "JOB_EXECUTION_SEQ")).thenReturn(new StubIncrementer());
    when(incrementerFactory.getIncrementer("ORACLE", tablePrefix + "STEP_EXECUTION_SEQ")).thenReturn(new StubIncrementer());
    factory.setIncrementerFactory(incrementerFactory);

    factory.afterPropertiesSet();
    LobHandler lobHandler = (LobHandler) ReflectionTestUtils.getField(factory, "lobHandler");
    assertTrue(lobHandler instanceof OracleLobHandler);

  }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.support.lob.LobHandler

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.