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 "Ramin Moazeni (JIRA)" <ji...@apache.org> on 2007/07/16 20:43:05 UTC

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

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

                 Key: DERBY-2942
                 URL: https://issues.apache.org/jira/browse/DERBY-2942
             Project: Derby
          Issue Type: Task
          Components: Test
            Reporter: Ramin Moazeni
            Assignee: Ramin Moazeni




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


Re: [jira] Commented: (DERBY-2942) Convert jdbcapi/statementJdbc30.java to JUnit

Posted by Ramin Moazeni <rm...@gmail.com>.
I am attaching a patch with this email since JIra patch attachment
does not seem to be working.

The reason for the new patch is the following errors I got
when I ran the junit tests:
1) testExecuteUpdateNoAutoGenColumnName(org.apache.derbyTesting.functionTests.tests.jdbcapi.StatementJdbc30Test)junit.framework.ComparisonFailure:
Unexpected SQL state. expected:<...E> but was:<...F>
        at org.apache.derbyTesting.junit.BaseJDBCTestCase.assertSQLState(BaseJDBCTestCase.java:624)
        at org.apache.derbyTesting.junit.BaseJDBCTestCase.assertSQLState(BaseJDBCTestCase.java:673)
        at org.apache.derbyTesting.functionTests.tests.jdbcapi.StatementJdbc30Test.assertFailedExecuteUpdate(StatementJdbc30Test.java:235)
        at org.apache.derbyTesting.functionTests.tests.jdbcapi.StatementJdbc30Test.testExecuteUpdateNoAutoGenColumnName(StatementJdbc30Test.java:180)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:95)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)
        at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
Caused by: java.sql.SQLException: Table 'TAB1' does not have an
auto-generated column named 'I'.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown
Source)
        at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown
Source)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
Source)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
Source)
        at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown
Source)
        at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown
Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown
Source)
        at org.apache.derbyTesting.functionTests.tests.jdbcapi.StatementJdbc30Test.testExecuteUpdateNoAutoGenColumnName(StatementJdbc30Test.java:176)
        ... 31 more
Caused by: java.sql.SQLException: Table 'TAB1' does not have an
auto-generated column named 'I'.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
Source)
        ... 41 more
Caused by: ERROR X0X0F: Table 'TAB1' does not have an auto-generated
column named 'I'.
        at org.apache.derby.iapi.error.StandardException.newException(Unknown
Source)
        at org.apache.derby.impl.sql.execute.InsertResultSet.verifyAutoGeneratedColumnsNames(Unknown
Source)
        at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown
Source)
        at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown
Source)
        ... 35 more


On 7/26/07, Ramin Moazeni (JIRA) <ji...@apache.org> wrote:
>
>     [ https://issues.apache.org/jira/browse/DERBY-2942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12515879 ]
>
> Ramin Moazeni commented on DERBY-2942:
> --------------------------------------
>
> Hi Kathey,
>
> no problem. Please feel free to check it in with your changes.
>
> Thanks
> Ramin
>
>
>
> > Convert jdbcapi/statementJdbc30.java to JUnit
> > ---------------------------------------------
> >
> >                 Key: DERBY-2942
> >                 URL: https://issues.apache.org/jira/browse/DERBY-2942
> >             Project: Derby
> >          Issue Type: Task
> >          Components: Test
> >            Reporter: Ramin Moazeni
> >            Assignee: Ramin Moazeni
> >         Attachments: DERBY-2942v0.diff, DERBY-2942v0.stat, DERBY-2942v1.diff
> >
> >
>
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

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

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

Kathey Marsden commented on DERBY-2942:
---------------------------------------

Ramin, do you mind if I make a couple of small changes before I check this in
1) Reformat the code to remove mixed tab/spaces.
2) Change the test cases so they run in both embedded and client. I think I did not make my prior comment  clear.  
Essentially we will run all the test with both embedded and client and have
     } catch (SQLException ex) {
            assertFailedExecuteUpdate(ex);
        }


where  we have

 /**
     * Assert executeUpdate failed. There are different SQLStates for 
     * client and server.
     * 
     * @param ex
     */
    private void assertFailedExecuteUpdate(SQLException ex) {
        /*
         * DERBY-2943 -- execute() and executeUpdate() return different
         * SQLState in embedded and network client
         * 
         */
        if (usingDerbyNetClient()) {
            assertSQLState("0A000", ex);
        } else {
            assertSQLState("X0X0E", ex);
        }
    }

If you don't mind these changes, I'll go ahead and check in.

Kathey


> Convert jdbcapi/statementJdbc30.java to JUnit
> ---------------------------------------------
>
>                 Key: DERBY-2942
>                 URL: https://issues.apache.org/jira/browse/DERBY-2942
>             Project: Derby
>          Issue Type: Task
>          Components: Test
>            Reporter: Ramin Moazeni
>            Assignee: Ramin Moazeni
>         Attachments: DERBY-2942v0.diff, DERBY-2942v0.stat, DERBY-2942v1.diff
>
>


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


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

Posted by "Ramin Moazeni (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12515879 ] 

Ramin Moazeni commented on DERBY-2942:
--------------------------------------

Hi Kathey,

no problem. Please feel free to check it in with your changes.

Thanks
Ramin



> Convert jdbcapi/statementJdbc30.java to JUnit
> ---------------------------------------------
>
>                 Key: DERBY-2942
>                 URL: https://issues.apache.org/jira/browse/DERBY-2942
>             Project: Derby
>          Issue Type: Task
>          Components: Test
>            Reporter: Ramin Moazeni
>            Assignee: Ramin Moazeni
>         Attachments: DERBY-2942v0.diff, DERBY-2942v0.stat, DERBY-2942v1.diff
>
>


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


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

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

Ramin Moazeni updated DERBY-2942:
---------------------------------

    Attachment: DERBY-2942v1.diff

Hi Kathey

Thanks for the review. I am attaching a new patch
which addresses your review. 
I appreciate your review.

Thanks
Ramin

> Convert jdbcapi/statementJdbc30.java to JUnit
> ---------------------------------------------
>
>                 Key: DERBY-2942
>                 URL: https://issues.apache.org/jira/browse/DERBY-2942
>             Project: Derby
>          Issue Type: Task
>          Components: Test
>            Reporter: Ramin Moazeni
>            Assignee: Ramin Moazeni
>         Attachments: DERBY-2942v0.diff, DERBY-2942v0.stat, DERBY-2942v1.diff
>
>


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


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

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

Ramin Moazeni updated DERBY-2942:
---------------------------------

    Attachment: DERBY-2942v0.stat
                DERBY-2942v0.diff

I am attaching a patch that converts jdbcapistatementJdbc30.java to JUnit.
Your comments and feedback is appreciated.

Thanks
Ramin Moazeni

> Convert jdbcapi/statementJdbc30.java to JUnit
> ---------------------------------------------
>
>                 Key: DERBY-2942
>                 URL: https://issues.apache.org/jira/browse/DERBY-2942
>             Project: Derby
>          Issue Type: Task
>          Components: Test
>            Reporter: Ramin Moazeni
>            Assignee: Ramin Moazeni
>         Attachments: DERBY-2942v0.diff, DERBY-2942v0.stat
>
>


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


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

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

Kathey Marsden resolved DERBY-2942.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 10.4.0.0

> Convert jdbcapi/statementJdbc30.java to JUnit
> ---------------------------------------------
>
>                 Key: DERBY-2942
>                 URL: https://issues.apache.org/jira/browse/DERBY-2942
>             Project: Derby
>          Issue Type: Task
>          Components: Test
>            Reporter: Ramin Moazeni
>            Assignee: Ramin Moazeni
>             Fix For: 10.4.0.0
>
>         Attachments: DERBY-2942v0.diff, DERBY-2942v0.stat, DERBY-2942v1.diff
>
>


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


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

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

Kathey Marsden commented on DERBY-2942:
---------------------------------------

Hi Ramin,

Thanks for the patch.  A few minor  comments:

There are a few places where it says
*
                 * DERBY-2943 -- execute() and executeUpdate() return different
                 * SQLState in embedded and network client
                 *
                 * Disabling Network Client
                 */
		if (!usingDerbyNetClient())

I think it would be better to test with network client but just use the usingDerbyClient() to check for a different exception.

- The connection you get with getConnection in CleanDatabaseSetup is never used so can be removed.
- There is no longer a need to close the statements created with createStatement() they are now cleaned up automatically.




> Convert jdbcapi/statementJdbc30.java to JUnit
> ---------------------------------------------
>
>                 Key: DERBY-2942
>                 URL: https://issues.apache.org/jira/browse/DERBY-2942
>             Project: Derby
>          Issue Type: Task
>          Components: Test
>            Reporter: Ramin Moazeni
>            Assignee: Ramin Moazeni
>         Attachments: DERBY-2942v0.diff, DERBY-2942v0.stat
>
>


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


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

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

Ramin Moazeni updated DERBY-2942:
---------------------------------

    Derby Info: [Patch Available]

> Convert jdbcapi/statementJdbc30.java to JUnit
> ---------------------------------------------
>
>                 Key: DERBY-2942
>                 URL: https://issues.apache.org/jira/browse/DERBY-2942
>             Project: Derby
>          Issue Type: Task
>          Components: Test
>            Reporter: Ramin Moazeni
>            Assignee: Ramin Moazeni
>         Attachments: DERBY-2942v0.diff, DERBY-2942v0.stat
>
>


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