Updated verifyCursorPosition default to true in JdbcCursorItemReaderBuilder

Issue #3893
This commit is contained in:
Parikshit Dutta
2021-04-23 21:20:26 +05:30
committed by Mahmoud Ben Hassine
parent 0c4c660529
commit ff2bcdba07
2 changed files with 16 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 the original author or authors.
* Copyright 2016-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@ import org.springframework.util.StringUtils;
* @author Drummond Dawson
* @author Mahmoud Ben Hassine
* @author Ankur Trapasiya
* @author Parikshit Dutta
* @since 4.0
*/
public class JdbcCursorItemReaderBuilder<T> {
@@ -50,7 +51,7 @@ public class JdbcCursorItemReaderBuilder<T> {
private boolean ignoreWarnings;
private boolean verifyCursorPosition;
private boolean verifyCursorPosition = true;
private boolean driverSupportsAbsolute;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 the original author or authors.
* Copyright 2016-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,6 +48,7 @@ import static org.junit.Assert.fail;
* @author Michael Minella
* @author Drummond Dawson
* @author Ankur Trapasiya
* @author Parikshit Dutta
*/
public class JdbcCursorItemReaderBuilderTests {
@@ -314,6 +315,17 @@ public class JdbcCursorItemReaderBuilderTests {
assertTrue((boolean) ReflectionTestUtils.getField(reader, "connectionAutoCommit"));
}
@Test
public void testVerifyCursorPositionDefaultToTrue() {
JdbcCursorItemReader<Foo> reader = new JdbcCursorItemReaderBuilder<Foo>()
.dataSource(this.dataSource)
.name("fooReader")
.sql("SELECT * FROM FOO ORDER BY FIRST")
.beanRowMapper(Foo.class)
.build();
assertTrue((boolean) ReflectionTestUtils.getField(reader, "verifyCursorPosition"));
}
@Test
public void testValidation() {
try {