H2 DB is not supporting for storedprocs. In place of stored proc we have to create function which returns some output jst like storedproc as we did using registerInOut params. For example,
if ur QueryConst is like this:
public static final String INSERT_EMPLOYEE = "{call INSERT_EMPLOYEE(?,?,?)}";
then,
In our schema.sql(which executes @Test before)
DROP ALIAS IF EXISTS INSERT_EMPLOYEE;
CREATE ALIAS INSERT_EMPLOYEE FOR "com.test.EmployeeDaoImplTest.updateEmpStoredproc";
package com.test;
@ContextConfiguration(locations = { "classpath:configxmltest.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
@Sql(scripts = { "classpath:schema.sql" }, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
public class EmployeeDaoImplTest {
public static final String INSERT_EMPLOYEE = "{call INSERT_EMPLOYEE(?,?,?)}";
@Autowired
EmployeeDaoImpl employeeDaoTest;
and other dependencies....(if any)
@Test
public void testUpdateEmployee() {
..ur logic if any input data settings
assertEquals("Inserted Successfully", employeeDaoTest.updateEmployee(input, INSERT_EMPLOYEE));
}
public static ResultSet updateEmpStoredproc(String name, String w, Integer i) throws SQLException {
SimpleResultSet rs = new SimpleResultSet();
rs.addColumn("input", Types.VARCHAR, 255, 0);
rs.addColumn("error", Types.VARCHAR, 255, 0);
rs.addColumn("count", Types.INTEGER, 10, 0);
rs.addRow(0, "Inserted Successfully");
rs.addRow(1, 10);
return rs;
}
}