use of test.com.ctrip.platform.dal.dao.unitbase.ClientTestDalRowMapper in project dal by ctripcorp.
the class DalDirectClientTestStub method queryTestWithFetchSizeLimit.
/**
* Test the basic query function with maxRows limit
*
* @throws SQLException
*/
@Test
public void queryTestWithFetchSizeLimit() throws SQLException {
String querySql = "SELECT * FROM " + TABLE_NAME;
StatementParameters parameters = new StatementParameters();
ClientTestDalRowMapper mapper = new ClientTestDalRowMapper();
DalHints hints = new DalHints();
// Set fetch size limit
hints.set(DalHintEnum.maxRows, 1);
List<ClientTestModel> res = client.query(querySql, parameters, hints, new DalRowMapperExtractor<ClientTestModel>(mapper));
Assert.assertTrue(null != res);
Assert.assertEquals(1, res.size());
}
use of test.com.ctrip.platform.dal.dao.unitbase.ClientTestDalRowMapper in project dal by ctripcorp.
the class DalDirectClientTestStub method quryTestWithoutParameters.
/**
* Test the basic query function without parameters
*
* @throws SQLException
*/
@Test
public void quryTestWithoutParameters() throws SQLException {
String querySql = "SELECT * FROM " + TABLE_NAME;
StatementParameters parameters = new StatementParameters();
ClientTestDalRowMapper mapper = new ClientTestDalRowMapper();
DalHints hints = new DalHints();
List<ClientTestModel> res = client.query(querySql, parameters, hints, new DalRowMapperExtractor<ClientTestModel>(mapper));
Assert.assertTrue(null != res && res.size() == 3);
ClientTestModel model = res.get(0);
Assert.assertTrue(model.getQuantity() == 10 && model.getType() == 1 && model.getAddress().equals("SH INFO"));
}
use of test.com.ctrip.platform.dal.dao.unitbase.ClientTestDalRowMapper in project dal by ctripcorp.
the class DalDirectClientTestStub method quryTestWithParameters.
/**
* Test the basic query function without parameters
*
* @throws SQLException
*/
@Test
public void quryTestWithParameters() throws SQLException {
String querySql = "SELECT * FROM " + TABLE_NAME + " WHERE type = ?";
StatementParameters parameters = new StatementParameters();
parameters.set(1, Types.SMALLINT, 1);
ClientTestDalRowMapper mapper = new ClientTestDalRowMapper();
DalHints hints = new DalHints();
List<ClientTestModel> res = client.query(querySql, parameters, hints, new DalRowMapperExtractor<ClientTestModel>(mapper));
Assert.assertTrue(null != res);
Assert.assertEquals(2, res.size());
}
Aggregations