use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.
the class TnStatementFactoryImplTest method test_getActualStatementConfig_cursorSelectFetchSize_notCursor_suppressDefault.
public void test_getActualStatementConfig_cursorSelectFetchSize_notCursor_suppressDefault() throws Exception {
// ## Arrange ##
TnStatementFactoryImpl impl = new TnStatementFactoryImpl() {
@Override
protected boolean isSelectCursorFetchSizeCommand(BehaviorCommand<?> command) {
return false;
}
};
{
StatementConfig defaultConfig = new StatementConfig();
defaultConfig.queryTimeout(10).fetchSize(20).maxRows(30);
impl.setDefaultStatementConfig(defaultConfig);
}
impl.setCursorSelectFetchSize(200);
StatementConfig config = new StatementConfig();
config.suppressDefault();
config.queryTimeout(1);
// ## Act ##
StatementConfig actual = impl.getActualStatementConfig(config);
// ## Assert ##
assertNotNull(actual);
assertEquals(1, actual.getQueryTimeout());
assertEquals(null, actual.getFetchSize());
assertEquals(null, actual.getMaxRows());
}
use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.
the class TnStatementFactoryImplTest method test_getActualStatementConfig_cursorSelectFetchSize_cursor_plain.
// ===================================================================================
// CursorSelectFetchSize
// =====================
public void test_getActualStatementConfig_cursorSelectFetchSize_cursor_plain() throws Exception {
// ## Arrange ##
TnStatementFactoryImpl impl = new TnStatementFactoryImpl() {
@Override
protected boolean isSelectCursorFetchSizeCommand(BehaviorCommand<?> command) {
return true;
}
};
impl.setCursorSelectFetchSize(200);
// ## Act ##
StatementConfig actual = impl.getActualStatementConfig(null);
// ## Assert ##
assertNotNull(actual);
assertEquals(null, actual.getQueryTimeout());
assertEquals(200, actual.getFetchSize());
assertEquals(null, actual.getMaxRows());
}
use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.
the class TnStatementFactoryImplTest method test_getActualStatementConfig_defaultOnly_empty.
public void test_getActualStatementConfig_defaultOnly_empty() throws Exception {
// ## Arrange ##
TnStatementFactoryImpl impl = new TnStatementFactoryImpl();
{
StatementConfig defaultConfig = new StatementConfig();
defaultConfig.queryTimeout(10).fetchSize(20).maxRows(30);
impl.setDefaultStatementConfig(defaultConfig);
}
StatementConfig config = new StatementConfig();
// ## Act ##
StatementConfig actual = impl.getActualStatementConfig(config);
// ## Assert ##
assertNotNull(actual);
assertEquals(10, actual.getQueryTimeout());
assertEquals(20, actual.getFetchSize());
assertEquals(30, actual.getMaxRows());
}
use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.
the class TnStatementFactoryImplTest method test_getActualStatementConfig_defaultOnly_null.
// ===================================================================================
// DefaultOnly
// ===========
public void test_getActualStatementConfig_defaultOnly_null() throws Exception {
// ## Arrange ##
TnStatementFactoryImpl impl = new TnStatementFactoryImpl();
{
StatementConfig defaultConfig = new StatementConfig();
defaultConfig.queryTimeout(10).fetchSize(20).maxRows(30);
impl.setDefaultStatementConfig(defaultConfig);
}
// ## Act ##
StatementConfig actual = impl.getActualStatementConfig(null);
// ## Assert ##
assertNotNull(actual);
assertEquals(10, actual.getQueryTimeout());
assertEquals(20, actual.getFetchSize());
assertEquals(30, actual.getMaxRows());
}
use of org.dbflute.jdbc.StatementConfig in project dbflute-core by dbflute.
the class TnStatementFactoryImplTest method test_getActualStatementConfig_cursorSelectFetchSize_notCursor_plain.
public void test_getActualStatementConfig_cursorSelectFetchSize_notCursor_plain() throws Exception {
// ## Arrange ##
TnStatementFactoryImpl impl = new TnStatementFactoryImpl() {
@Override
protected boolean isSelectCursorFetchSizeCommand(BehaviorCommand<?> command) {
return false;
}
};
impl.setCursorSelectFetchSize(200);
// ## Act ##
StatementConfig actual = impl.getActualStatementConfig(null);
// ## Assert ##
assertNull(actual);
}
Aggregations