use of com.alibaba.druid.proxy.jdbc.ResultSetProxyImpl in project druid by alibaba.
the class FilterChainTest_Clob method test_resultSet_getObject.
public void test_resultSet_getObject() throws Exception {
FilterChainImpl chain = new FilterChainImpl(dataSource);
Clob clob = (Clob) chain.resultSet_getObject(new ResultSetProxyImpl(statement, mockResultSet, 1, null), 1);
Assert.assertTrue(clob instanceof ClobProxy);
Assert.assertEquals(1, invokeCount);
}
use of com.alibaba.druid.proxy.jdbc.ResultSetProxyImpl in project druid by alibaba.
the class FilterChainTest_ResultSet method test_resultSet_getObject.
public void test_resultSet_getObject() throws Exception {
FilterChainImpl chain = new FilterChainImpl(dataSource);
ResultSet clob = (ResultSet) chain.resultSet_getObject(new ResultSetProxyImpl(statement, mockResultSet, 1, null), 1);
Assert.assertTrue(clob instanceof ResultSetProxy);
Assert.assertEquals(1, invokeCount);
}
use of com.alibaba.druid.proxy.jdbc.ResultSetProxyImpl in project druid by alibaba.
the class FilterChainTest_ResultSet method test_resultSet_getObject_1.
public void test_resultSet_getObject_1() throws Exception {
FilterChainImpl chain = new FilterChainImpl(dataSource);
ResultSet clob = (ResultSet) chain.resultSet_getObject(new ResultSetProxyImpl(statement, mockResultSet, 1, null), "1");
Assert.assertTrue(clob instanceof ResultSetProxy);
Assert.assertEquals(1, invokeCount);
}
use of com.alibaba.druid.proxy.jdbc.ResultSetProxyImpl in project druid by alibaba.
the class DruidDataSourceTest6 method setUp.
protected void setUp() throws Exception {
returnEmptyCount.set(0);
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(true);
dataSource.setInitialSize(1);
dataSource.setValidationQuery("select 1");
dataSource.setValidationQueryTimeout(10);
dataSource.setQueryTimeout(100);
dataSource.setUserCallback(new NameCallback("xx") {
});
dataSource.setPasswordCallback(new DruidPasswordCallback() {
@Override
public char[] getPassword() {
return "xx".toCharArray();
}
});
dataSource.getProxyFilters().add(new FilterAdapter() {
public ResultSetProxy statement_executeQuery(FilterChain chain, StatementProxy statement, String sql) throws SQLException {
if (errorCount.get() > 0) {
errorCount.decrementAndGet();
throw new RuntimeException();
}
if (returnEmptyCount.get() > 0) {
returnEmptyCount.decrementAndGet();
return new ResultSetProxyImpl(statement, new MockResultSet(statement), 0, sql);
}
return chain.statement_executeQuery(statement, sql);
}
});
}
use of com.alibaba.druid.proxy.jdbc.ResultSetProxyImpl in project druid by alibaba.
the class FilterChainTest_Clob method test_resultSet_getObject_2.
public void test_resultSet_getObject_2() throws Exception {
FilterChainImpl chain = new FilterChainImpl(dataSource);
Clob clob = (Clob) chain.resultSet_getObject(new ResultSetProxyImpl(statement, mockResultSet, 1, null), 1, Collections.<String, Class<?>>emptyMap());
Assert.assertTrue(clob instanceof ClobProxy);
Assert.assertEquals(1, invokeCount);
}
Aggregations