You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Mamta A. Satoor (JIRA)" <ji...@apache.org> on 2008/08/25 08:39:44 UTC

[jira] Commented: (DERBY-3839) Convert "org.apache.derbyTesting.functionTests.tests.store.holdCursorJDBC30.sql" to junit.

    [ https://issues.apache.org/jira/browse/DERBY-3839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12625255#action_12625255 ] 

Mamta A. Satoor commented on DERBY-3839:
----------------------------------------

Junjie, thanks for picking this really long test for conversion. The conversion job has been done pretty well. I just have following comments. (the comments might look little scattered because I wrote them down as I went through each of the subtest conversion.)

1)The first thing the test does is set autocommit to false. Shouldn't each of the junit test fixture do the same?

2)In several places in the original test, it does close on resultset first and then commit but the converted junit test appears to do it in reverse order. 


3)The converted junit test has fixture testBasicBtreeScanForZeroRowsUpdateNonkeyfield. This test uses for update of clause here but the some of the other tests didn't.

4)The converted junit test has fixture testBasicBtreeScanTestsForMultipleRowsOrUpdateNonkeyField. It needs to define index like the earlier test stUtil.executeUpdate("create index foox on foo (a)"); This will match what the original non-junit test intended.

5)The following set of tests from original test are missing in the junit test. I think it could go in test fixutre  testBasicBtreeScanTestsForMultipleRowsOrUpdateNonkeyField
ij> --  test negative case of trying non next operations after commit
get with hold cursor test1 as 
    'select * from foo for update of data';
ij> next  test1;
A          |DATA       
-----------------------
1          |10         
ij> commit;
ij> delete from foo where current of test1;
ERROR 24000: Invalid cursor state - no current row.
ij> next  test1;
A          |DATA       
-----------------------
1          |20         
ij> commit;
ij> update foo set data=-3000 where current of test1;
ERROR 24000: Invalid cursor state - no current row.
ij> next  test1;
A          |DATA       
-----------------------
1          |30         
ij> next  test1;
A          |DATA       
-----------------------
1          |40         
ij> next  test1;
A          |DATA       
-----------------------
1          |50         
ij> next  test1;
No current row
ij> close test1;
ij> commit;
ij> -- should fail
next test1;
IJ ERROR: Unable to establish cursor

6)There is a test as follows in the original test
ij> --  make sure above deletes/updates worked.
get with hold cursor test1 as 
    'select * from foo for update of data';
ij> next  test1;
A          |DATA       
-----------------------
1          |10         
ij> commit;
ij> next  test1;
A          |DATA       
-----------------------
1          |30         
ij> commit;
ij> next  test1;
A          |DATA       
-----------------------
1          |-3000 
The test above checks that update made earlier shows up. The converted test does not look for new value -3000. The converted test for above test is as below (it is in testBasicBtreeScanTestsForMultipleRowsOrUpdateNonkeyField)
+        //make sure above deletes/updates worked.
+        test1 = st.executeQuery("select * from foo for update of data");
+        assertTrue(test1.next());
+        assertEquals(1, test1.getRow());
+        commit();
+        assertTrue(test1.next());
+        assertEquals(2, test1.getRow());
+        commit();
+        assertTrue(test1.next());
+        assertEquals(3, test1.getRow());


7)The converted junit test has fixture testBasicBtreeScanTestsForMultipleRowsOrReadOnly. It should create an index on foo to match the original test.


8)There are several places in the test where it matters what was the exact row data retruned on a "next.." but the converted test always just checks for test1.getRow() rather than the actual row data. One of those examples would be Test 7, Test 8, Test 9. There might be other places in the test where we should look for the row data rather than row number.

> Convert "org.apache.derbyTesting.functionTests.tests.store.holdCursorJDBC30.sql" to junit. 
> -------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3839
>                 URL: https://issues.apache.org/jira/browse/DERBY-3839
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>            Reporter: Junjie Peng
>            Assignee: Junjie Peng
>         Attachments: derby-3839-1.patch, derby-3839-1.stat
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.