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 "Suran Jayathilaka (JIRA)" <ji...@apache.org> on 2008/04/02 09:52:24 UTC

[jira] Created: (DERBY-3587) Convert jdbcapi/testRelative.java to JUnit

Convert jdbcapi/testRelative.java to JUnit
------------------------------------------

                 Key: DERBY-3587
                 URL: https://issues.apache.org/jira/browse/DERBY-3587
             Project: Derby
          Issue Type: Improvement
          Components: Test
            Reporter: Suran Jayathilaka
            Assignee: Suran Jayathilaka
            Priority: Minor


Convert jdbcapi/testRelative.java from the old testHarness to JUnit.

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


[jira] Updated: (DERBY-3587) Convert jdbcapi/testRelative.java to JUnit

Posted by "Myrna van Lunteren (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3587?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Myrna van Lunteren updated DERBY-3587:
--------------------------------------

    Fix Version/s: 10.5.0.0

> Convert jdbcapi/testRelative.java to JUnit
> ------------------------------------------
>
>                 Key: DERBY-3587
>                 URL: https://issues.apache.org/jira/browse/DERBY-3587
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Suran Jayathilaka
>            Assignee: Suran Jayathilaka
>            Priority: Minor
>             Fix For: 10.5.0.0
>
>         Attachments: derby-3587-fail_addition.diff, jdbcapi-testRelative-converted-2.diff, jdbcapi-testRelative-converted-3.diff, jdbcapi-testRelative-converted.diff
>
>
> Convert jdbcapi/testRelative.java from the old testHarness to JUnit.

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


[jira] Updated: (DERBY-3587) Convert jdbcapi/testRelative.java to JUnit

Posted by "Suran Jayathilaka (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3587?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Suran Jayathilaka updated DERBY-3587:
-------------------------------------

    Attachment: jdbcapi-testRelative-converted-2.diff

Thanks for the helpful comments.

This updated patch removes the testRelative.java and master/testRelative.out files. Also makes the changes suggested above. 

Please review and comment.

> Convert jdbcapi/testRelative.java to JUnit
> ------------------------------------------
>
>                 Key: DERBY-3587
>                 URL: https://issues.apache.org/jira/browse/DERBY-3587
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Suran Jayathilaka
>            Assignee: Suran Jayathilaka
>            Priority: Minor
>         Attachments: jdbcapi-testRelative-converted-2.diff, jdbcapi-testRelative-converted.diff
>
>
> Convert jdbcapi/testRelative.java from the old testHarness to JUnit.

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


[jira] Updated: (DERBY-3587) Convert jdbcapi/testRelative.java to JUnit

Posted by "Suran Jayathilaka (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3587?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Suran Jayathilaka updated DERBY-3587:
-------------------------------------

    Attachment: jdbcapi-testRelative-converted.diff

This patch adds the RelativeTest.java file which is a conversion of the jdbcapi/testRelative test, to the same package as the latter. Also adds the tests to the _Suite class.

Please review and comment if anything is lacking or incorrect.

> Convert jdbcapi/testRelative.java to JUnit
> ------------------------------------------
>
>                 Key: DERBY-3587
>                 URL: https://issues.apache.org/jira/browse/DERBY-3587
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Suran Jayathilaka
>            Assignee: Suran Jayathilaka
>            Priority: Minor
>         Attachments: jdbcapi-testRelative-converted.diff
>
>
> Convert jdbcapi/testRelative.java from the old testHarness to JUnit.

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


[jira] Commented: (DERBY-3587) Convert jdbcapi/testRelative.java to JUnit

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586859#action_12586859 ] 

Kathey Marsden commented on DERBY-3587:
---------------------------------------

Thanks for the patch. Below are some comments:

- remove the old test from the suite and remove associated test and master files.
- In RelativeTest, keep connections  local to the fixtures  instead of making  a field.
- Instead of creating your table in setup, use CleanDatabaseSetup and decorateSQL, (see BatchUpdateTest for an example).  This way it will get automatically cleaned up.
- Instead of con.prepareStatement() and con.createStatement()  you can use just prepareStatement  createStatement() and statements  will get closed automatically.

In the following code, only the call that is expected to fail should be in the try block
	try {
			rs.relative(10);
			/*
			 * Attempting to move beyond the first/last row in the 
			 * result set positions the cursor before/after the the 
			 * first/last row. Therefore, attempting to get value now
			 * will throw an exception.
			 */
			rs.getString("name");
		} catch (SQLException sqle) {
			assertSQLState("Unexpected SQL state.", NO_CURRENT_ROW_SQL_STATE, sqle);
		}
-  I wonder if using 
	assertSQLState("Unexpected SQL state.", NO_CURRENT_ROW_SQL_STATE, sqle);

instead of 
	assertSQLState(NO_CURRENT_ROW_SQL_STATE, sqle);

will actually give us less information on failure, because I think with the latter format we will see what the actual SQLException is and with the former we will not.

I am not sure, but I think with some JVM's the test order may vary, so initializing NO_CURRENT_ROW_SQL_STATE = "24000"; and then changing it on setUp if we are running with derbyclient might be a problem if the network server tests go first. It might be clearer just to put the condition in the catch block or make an assertNoCurrrentRow() method that has the condition.

Otherwise looks good.

Thanks

Kathey


> Convert jdbcapi/testRelative.java to JUnit
> ------------------------------------------
>
>                 Key: DERBY-3587
>                 URL: https://issues.apache.org/jira/browse/DERBY-3587
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Suran Jayathilaka
>            Assignee: Suran Jayathilaka
>            Priority: Minor
>         Attachments: jdbcapi-testRelative-converted.diff
>
>
> Convert jdbcapi/testRelative.java from the old testHarness to JUnit.

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


[jira] Updated: (DERBY-3587) Convert jdbcapi/testRelative.java to JUnit

Posted by "Suran Jayathilaka (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3587?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Suran Jayathilaka updated DERBY-3587:
-------------------------------------

    Attachment: jdbcapi-testRelative-converted-3.diff

References to testRelative removed from JDBCHarnessJavaTest, suites/jdbcapi.runall and suites/DerbyNet.exclude.
Test suites run.

> Convert jdbcapi/testRelative.java to JUnit
> ------------------------------------------
>
>                 Key: DERBY-3587
>                 URL: https://issues.apache.org/jira/browse/DERBY-3587
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Suran Jayathilaka
>            Assignee: Suran Jayathilaka
>            Priority: Minor
>         Attachments: jdbcapi-testRelative-converted-2.diff, jdbcapi-testRelative-converted-3.diff, jdbcapi-testRelative-converted.diff
>
>
> Convert jdbcapi/testRelative.java from the old testHarness to JUnit.

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


[jira] Commented: (DERBY-3587) Convert jdbcapi/testRelative.java to JUnit

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592711#action_12592711 ] 

Kathey Marsden commented on DERBY-3587:
---------------------------------------

Sorry for the delay reviewing this patch.
Looks good except for the test should be removed from JDBCHarnessJavaTest.  It's good to run suites.All and derbyall to catch issues like this.


> Convert jdbcapi/testRelative.java to JUnit
> ------------------------------------------
>
>                 Key: DERBY-3587
>                 URL: https://issues.apache.org/jira/browse/DERBY-3587
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Suran Jayathilaka
>            Assignee: Suran Jayathilaka
>            Priority: Minor
>         Attachments: jdbcapi-testRelative-converted-2.diff, jdbcapi-testRelative-converted.diff
>
>
> Convert jdbcapi/testRelative.java from the old testHarness to JUnit.

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


[jira] Updated: (DERBY-3587) Convert jdbcapi/testRelative.java to JUnit

Posted by "Suran Jayathilaka (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3587?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Suran Jayathilaka updated DERBY-3587:
-------------------------------------

    Derby Info: [Patch Available]

> Convert jdbcapi/testRelative.java to JUnit
> ------------------------------------------
>
>                 Key: DERBY-3587
>                 URL: https://issues.apache.org/jira/browse/DERBY-3587
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Suran Jayathilaka
>            Assignee: Suran Jayathilaka
>            Priority: Minor
>         Attachments: jdbcapi-testRelative-converted-2.diff, jdbcapi-testRelative-converted.diff
>
>
> Convert jdbcapi/testRelative.java from the old testHarness to JUnit.

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


[jira] Issue Comment Edited: (DERBY-3587) Convert jdbcapi/testRelative.java to JUnit

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592711#action_12592711 ] 

kmarsden edited comment on DERBY-3587 at 4/27/08 5:55 PM:
----------------------------------------------------------------

Sorry for the delay reviewing this patch.
Looks good except for the test should be removed from JDBCHarnessJavaTest and also remove it from 
suites/jdbcapi.runall and suites/DerbyNet.exclude.  It's good to run suites.All and derbyall to catch issues like this.


      was (Author: kmarsden):
    Sorry for the delay reviewing this patch.
Looks good except for the test should be removed from JDBCHarnessJavaTest.  It's good to run suites.All and derbyall to catch issues like this.

  
> Convert jdbcapi/testRelative.java to JUnit
> ------------------------------------------
>
>                 Key: DERBY-3587
>                 URL: https://issues.apache.org/jira/browse/DERBY-3587
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Suran Jayathilaka
>            Assignee: Suran Jayathilaka
>            Priority: Minor
>         Attachments: jdbcapi-testRelative-converted-2.diff, jdbcapi-testRelative-converted.diff
>
>
> Convert jdbcapi/testRelative.java from the old testHarness to JUnit.

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


[jira] Commented: (DERBY-3587) Convert jdbcapi/testRelative.java to JUnit

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595641#action_12595641 ] 

Kathey Marsden commented on DERBY-3587:
---------------------------------------

Thanks Suran. Committed revision 654859. This issue can probably be resolved now.


> Convert jdbcapi/testRelative.java to JUnit
> ------------------------------------------
>
>                 Key: DERBY-3587
>                 URL: https://issues.apache.org/jira/browse/DERBY-3587
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Suran Jayathilaka
>            Assignee: Suran Jayathilaka
>            Priority: Minor
>         Attachments: derby-3587-fail_addition.diff, jdbcapi-testRelative-converted-2.diff, jdbcapi-testRelative-converted-3.diff, jdbcapi-testRelative-converted.diff
>
>
> Convert jdbcapi/testRelative.java from the old testHarness to JUnit.

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


[jira] Commented: (DERBY-3587) Convert jdbcapi/testRelative.java to JUnit

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12594994#action_12594994 ] 

Kathey Marsden commented on DERBY-3587:
---------------------------------------

I just noticed in the test that we are missing fail lines if an expected failure executes. For example we have:

try {
			/*
			 * Attempting to move beyond the first/last row in the result set
			 * positions the cursor before/after the the first/last row.
			 * Therefore, attempting to get value will throw an exception.
			 */
			rs.getString("name");
		} catch (SQLException sqle) {
			/**
			 * sets the expected sql state for the expected exceptions,
			 * according to return value of usingDerbyNetClient().
			 */
			String NO_CURRENT_ROW_SQL_STATE = "";
			if (usingDerbyNetClient()) {
				NO_CURRENT_ROW_SQL_STATE = "XJ121";
			} else {
				NO_CURRENT_ROW_SQL_STATE = "24000";
			}
			assertSQLState(NO_CURRENT_ROW_SQL_STATE, sqle);
		}

There should be a fail call after rs.getString so that we get a failure if the statement executes.  Could you submit a followup patch?



> Convert jdbcapi/testRelative.java to JUnit
> ------------------------------------------
>
>                 Key: DERBY-3587
>                 URL: https://issues.apache.org/jira/browse/DERBY-3587
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Suran Jayathilaka
>            Assignee: Suran Jayathilaka
>            Priority: Minor
>         Attachments: jdbcapi-testRelative-converted-2.diff, jdbcapi-testRelative-converted-3.diff, jdbcapi-testRelative-converted.diff
>
>
> Convert jdbcapi/testRelative.java from the old testHarness to JUnit.

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


[jira] Resolved: (DERBY-3587) Convert jdbcapi/testRelative.java to JUnit

Posted by "Suran Jayathilaka (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3587?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Suran Jayathilaka resolved DERBY-3587.
--------------------------------------

    Resolution: Fixed
    Derby Info:   (was: [Patch Available])

testRelative conversion to junit complete.

> Convert jdbcapi/testRelative.java to JUnit
> ------------------------------------------
>
>                 Key: DERBY-3587
>                 URL: https://issues.apache.org/jira/browse/DERBY-3587
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Suran Jayathilaka
>            Assignee: Suran Jayathilaka
>            Priority: Minor
>         Attachments: derby-3587-fail_addition.diff, jdbcapi-testRelative-converted-2.diff, jdbcapi-testRelative-converted-3.diff, jdbcapi-testRelative-converted.diff
>
>
> Convert jdbcapi/testRelative.java from the old testHarness to JUnit.

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


[jira] Updated: (DERBY-3587) Convert jdbcapi/testRelative.java to JUnit

Posted by "Suran Jayathilaka (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3587?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Suran Jayathilaka updated DERBY-3587:
-------------------------------------

    Attachment: derby-3587-fail_addition.diff

This patch adds the fail() statements that will fail the test if rs.getString() doesn't throw an exception when reading from an invalid row.

> Convert jdbcapi/testRelative.java to JUnit
> ------------------------------------------
>
>                 Key: DERBY-3587
>                 URL: https://issues.apache.org/jira/browse/DERBY-3587
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Suran Jayathilaka
>            Assignee: Suran Jayathilaka
>            Priority: Minor
>         Attachments: derby-3587-fail_addition.diff, jdbcapi-testRelative-converted-2.diff, jdbcapi-testRelative-converted-3.diff, jdbcapi-testRelative-converted.diff
>
>
> Convert jdbcapi/testRelative.java from the old testHarness to JUnit.

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