Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.JdbcOperations


        return new Date();
      }
    };

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForObject(sql, new Object[]{arg1, arg2, arg3}, rm);
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
View Full Code Here


        return new Date();
      }
    };

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForObject(sql, new Object[]{arg1, arg2, arg3}, rm);
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
View Full Code Here

      unifiedTypes2[unifiedTypes2.length - 1] = Object[].class;
      unifiedArgs2[unifiedArgs2.length - 1] = new Object[]{};
    }

    MockControl mc;
    JdbcOperations jo = null;
    NamedParameterJdbcOperations npjo = null;
    Method joMethod = null;
    SimpleJdbcTemplate jth = null;

    if (namedParameters) {
View Full Code Here

        logger.info("JDBC DataSources");
        for (final Entry<String, JdbcOperations> jdbcEntry : this.jdbcOperations.entrySet()) {
            final String jdbcName = jdbcEntry.getKey();
            try {
                logger.info("\t" + jdbcName);
                final JdbcOperations jdbcOps = jdbcEntry.getValue();
                jdbcOps.execute(new ConnectionCallback<Object>() {
                    @Override
                    public Object doInConnection(Connection con) throws SQLException, DataAccessException {
                        printInfo(con);
                        return null;
                    }
View Full Code Here

  public void testQueryForIntWithoutArgs() {
    String sql = "SELECT COUNT(0) FROM BAR";
    int expectedResult = 666;

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForInt(sql);
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
View Full Code Here

    int expectedResult = 666;
    int arg1 = 24;
    String arg2 = "foo";

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForInt(sql, new Object[]{arg1, arg2});
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
View Full Code Here

  public void testQueryForLongWithoutArgs() {
    String sql = "SELECT COUNT(0) FROM BAR";
    long expectedResult = 666;

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForLong(sql);
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
    long result = jth.queryForLong(sql);
View Full Code Here

    double arg1 = 24.7;
    String arg2 = "foo";
    Object arg3 = new Object();

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForLong(sql, new Object[]{arg1, arg2, arg3});
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
View Full Code Here

    double arg1 = 24.7;
    String arg2 = "foo";
    Object arg3 = new Object();

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForLong(sql, new Object[]{arg1, arg2, arg3});
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
View Full Code Here

  public void testQueryForObjectWithoutArgs() throws Exception {
    String sql = "SELECT SYSDATE FROM DUAL";
    Date expectedResult = new Date();

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForObject(sql, Date.class);
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
    Date result = jth.queryForObject(sql, Date.class);
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.JdbcOperations

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.