use of com.alibaba.druid.filter.FilterChain in project druid by alibaba.
the class StatFilterOpenClobCountTest method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setFilters("stat");
dataSource.setTestOnBorrow(false);
dataSource.getProxyFilters().add(new FilterAdapter() {
@Override
public Clob resultSet_getClob(FilterChain chain, ResultSetProxy result, int columnIndex) throws SQLException {
return new ClobProxyImpl(result.getStatementProxy().getConnectionProxy().getDirectDataSource(), result.getStatementProxy().getConnectionProxy(), new MockClob());
}
@Override
public Clob resultSet_getClob(FilterChain chain, ResultSetProxy result, String columnLabel) throws SQLException {
return new ClobProxyImpl(result.getStatementProxy().getConnectionProxy().getDirectDataSource(), result.getStatementProxy().getConnectionProxy(), new MockClob());
}
});
dataSource.init();
}
use of com.alibaba.druid.filter.FilterChain in project druid by alibaba.
the class StatFilterOpenInputStreamCountTest method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setFilters("stat");
dataSource.setTestOnBorrow(false);
dataSource.getProxyFilters().add(new FilterAdapter() {
@Override
public java.io.InputStream resultSet_getBinaryStream(FilterChain chain, ResultSetProxy result, int columnIndex) throws SQLException {
return new ByteArrayInputStream(new byte[0]);
}
@Override
public java.io.InputStream resultSet_getBinaryStream(FilterChain chain, ResultSetProxy result, String columnLabel) throws SQLException {
return new ByteArrayInputStream(new byte[0]);
}
});
dataSource.init();
}
use of com.alibaba.druid.filter.FilterChain in project druid by alibaba.
the class StatFilterOpenInputStreamCountTest2 method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setFilters("stat");
dataSource.setTestOnBorrow(false);
dataSource.getProxyFilters().add(new FilterAdapter() {
@Override
public java.io.InputStream resultSet_getAsciiStream(FilterChain chain, ResultSetProxy result, int columnIndex) throws SQLException {
return new ByteArrayInputStream(new byte[0]);
}
@Override
public java.io.InputStream resultSet_getAsciiStream(FilterChain chain, ResultSetProxy result, String columnLabel) throws SQLException {
return new ByteArrayInputStream(new byte[0]);
}
});
dataSource.init();
}
use of com.alibaba.druid.filter.FilterChain in project druid by alibaba.
the class StatFilterOpenReaderCountTest method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setFilters("stat");
dataSource.setTestOnBorrow(false);
dataSource.getProxyFilters().add(new FilterAdapter() {
@Override
public java.io.Reader resultSet_getCharacterStream(FilterChain chain, ResultSetProxy result, int columnIndex) throws SQLException {
return new StringReader("");
}
@Override
public java.io.Reader resultSet_getCharacterStream(FilterChain chain, ResultSetProxy result, String columnLabel) throws SQLException {
return new StringReader("");
}
});
dataSource.init();
}
use of com.alibaba.druid.filter.FilterChain in project druid by alibaba.
the class StatFilterReadBytesLengthTest method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setFilters("stat");
dataSource.setTestOnBorrow(false);
dataSource.getProxyFilters().add(new FilterAdapter() {
@Override
public byte[] resultSet_getBytes(FilterChain chain, ResultSetProxy result, int columnIndex) throws SQLException {
return new byte[6];
}
@Override
public byte[] resultSet_getBytes(FilterChain chain, ResultSetProxy result, String columnIndex) throws SQLException {
return new byte[7];
}
});
dataSource.init();
}
Aggregations