[
https://issues.apache.org/jira/browse/DERBY-2411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12479268
]
Knut Anders Hatlen commented on DERBY-2411:
-------------------------------------------
I have read through the patch. It generally looks good. Please see my comments
below.
What about assertEquals() in these two cases?
+ rs.setFetchSize(5);
+ if (rs.getFetchSize() != 5) {
+ fail("getFetchSize() expected to return 5");
+ }
+
+ if (rs.getFetchDirection() != ResultSet.FETCH_FORWARD) {
+ fail("getFetchDirection() expected to return FETCH_FORWARD, not "
+ + rs.getFetchDirection());
+ }
assertNull(conn.getWarnings()) instead of the println loop?
+ // We should have gotten no warnings and a read only forward only
cursor
+ warning = conn.getWarnings();
+ while (warning != null) {
+ System.out.println("warning = " + warning);
+ warning = warning.getNextWarning();
+ }
assert instead of println here?
+ // Verify that result set from statement is
+ // scroll insensitive and read only
+ rs = ps_f_r.executeQuery();
+ if (rs.getType() != ResultSet.TYPE_FORWARD_ONLY) {
+ System.out.println("cursor type = " + rs.getType() + ", not "
+ + ResultSet.TYPE_FORWARD_ONLY);
+ }
+ if (rs.getConcurrency() != ResultSet.CONCUR_READ_ONLY) {
+ System.out.println("concurrency = " + rs.getConcurrency()
+ + ", not " + ResultSet.CONCUR_READ_ONLY);
+ }
assertNotNull? Actually, testing that the result set is not null could probably
be removed since the subsequent use of it would fail anyway.
+ rs = s_f_r.executeQuery("values 1, 2, 3, 4, 5, 6");
+ if (rs == null) {
+ fail("rs expected to be non-null.");
+ }
This could be replaced with a single call to JDBC.assertDrainResults(rs, 5):
+ if (rs == null) {
+ fail("rs expected to be non-null.");
+ }
+ // Iterate straight thru RS, expect only 5 rows.
+ for (int index = 1; index < 6; index++) {
+ if (!rs.next()) {
+ fail("rs.next() failed, index = " + index);
+ break;
+ }
+ }
+ // We should not see another row (only 5, not 6)
+ if (rs.next()) {
+ fail("rs.next() failed, should not have seen 6th row.");
+ passed = false;
+ }
+ rs.close();
scrollInsensitivePositive() and scrollInsensitiveNegative() should start with
"test".
The last ResultSets in scrollInsensitiveNegative() and
testScrollInsensitiveNegative() are not closed.
scrollVerifyMaxRowWithFetchSize() could be private to clearly indicate that
it's not a top-level test method.
Class lacks copyright header.
> convert scrollCursors2.java to junit
> -------------------------------------
>
> Key: DERBY-2411
> URL: https://issues.apache.org/jira/browse/DERBY-2411
> Project: Derby
> Issue Type: Task
> Components: Test
> Affects Versions: 10.3.0.0
> Reporter: Kathey Marsden
> Assigned To: Kathey Marsden
> Priority: Minor
> Attachments: derby-2411.diff
>
>
> convert scrollCursors2.java to junit
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.