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

Kathey Marsden commented on DERBY-3568:
---------------------------------------

Thanks for the quick work and patch.  Looks like a good first effort.  Below 
are some comments.

some general comments:

- Add the test to jdbcapi._Suite
- Remove the test from the jdbcapi suite in the old harness and remove masters.
- Run suites.All and derbyall.
- Keep connections,result sets, statements and savepoints local to 
the fixtures.   These do not get cleaned up by JUnit.
- I wonder if there is a Jira issue that nested savepoints are not
  supported with the client driver.  If not we should file one.
- There are comments that refer to JCC that can probably be changed to client 
instead.

Some detailed comments on the code:

suite() 
Instead of !TestUtil.isNetFramework() use usingEmbedded() in BaseJDBCTestCase.
http://db.apache.org/derby/javadoc/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.html#usingEmbedded()

I'm not sure though if the current code is going to get things running at all 
with network server.  I have always just used TestConfiguration.defaultSuite() 
and had the fixtures return if usingDerbyNetClient() if I don't want them to 
run, but it may make more sense not to add them into the suite at all as you 
have attempted to do.  CallableTest has an example of how this can be done.


setup()/teardown() - Instead of creating the tables once per fixture, you can 
it once using  CleanDatabaseSetup and decorateSQL and then the cleanup will be 
automatic.  See BatchUpdateTest for an example.


When catching an exception check that the SQLState that you get is correct with
assertSQLState.
http://db.apache.org/derby/javadoc/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.html#assertSQLState(java.lang.String,%20java.sql.SQLException)
   

If no exception is expected, it is better just to let the exception be thrown 
instead of catching it and printing a message.  e.g. Instead of 
      try {
            savepoint2 = con.setSavepoint("s1");
        } catch (SQLException se) {
            fail("After releasing a savepoint, should be able to reuse it");
        }
just use 
 savepoint2 = con.setSavepoint("s1");


I see a few failures when I run the test.
testSavepointsInBatch: 
java.sql.SQLException: Table/View 't1' does not exist.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:201)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:391)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
        at 
org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2082)
        at 
org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:614)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(EmbedStatement.java:152)
        at 
org.apache.derbyTesting.junit.BaseJDBCTestCase.assertEscapedTableRowCount(BaseJDBCTestCase.java:895)
        at 
org.apache.derbyTesting.junit.BaseJDBCTestCase.assertTableRowCount(BaseJDBCTestCase.java:879)
        at 
org.apache.derbyTesting.functionTests.tests.jdbcapi.SavepointJdbc30_JSR169Test.testSavepointsInBatch(SavepointJdbc30_JSR169Test.java:489)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:615)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at 
org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:103)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: ERROR 42X05: Table/View 't1' does not exist.
        at 
org.apache.derby.iapi.error.StandardException.newException(StandardException.java:286)
        at 
org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(FromBaseTable.java:2451)
        at 
org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(FromBaseTable.java:2175)
        at 
org.apache.derby.impl.sql.compile.FromList.bindTables(FromList.java:310)
        at 
org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(SelectNode.java:390)
        at 
org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(DMLStatementNode.java:199)
        at 
org.apache.derby.impl.sql.compile.DMLStatementNode.bind(DMLStatementNode.java:137)
        at 
org.apache.derby.impl.sql.compile.CursorNode.bindStatement(CursorNode.java:236)
        at 
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:314)
        at 
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
        at 
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:768)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:606)
        ... 25 more


testBug5817 
java.sql.SQLException: 'DROP TABLE' cannot be performed on 'SAVEPOINT' because 
it does not exist.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:201)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:391)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
        at 
org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2082)
        at 
org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:614)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
        at 
org.apache.derbyTesting.functionTests.tests.jdbcapi.SavepointJdbc30_JSR169Test.testBug5817(SavepointJdbc30_JSR169Test.java:633)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:615)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at 
org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:103)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: ERROR 42Y55: 'DROP TABLE' cannot be performed on 'SAVEPOINT' because 
it does not exist.
        at 
org.apache.derby.iapi.error.StandardException.newException(StandardException.java:303)
        at 
org.apache.derby.impl.sql.compile.DDLStatementNode.getTableDescriptor(DDLStatementNode.java:296)
        at 
org.apache.derby.impl.sql.compile.DDLStatementNode.getTableDescriptor(DDLStatementNode.java:263)
        at 
org.apache.derby.impl.sql.compile.DropTableNode.bindStatement(DropTableNode.java:97)
        at 
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:314)
        at 
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
        at 
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:768)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:606)
        ... 23 more

xtestRollbackWillReleaseLaterSavepoints
java.sql.SQLException: Table/View 't1' does not exist.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:201)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:391)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
        at 
org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2082)
        at 
org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:614)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(EmbedStatement.java:152)
        at 
org.apache.derbyTesting.junit.BaseJDBCTestCase.assertEscapedTableRowCount(BaseJDBCTestCase.java:895)
        at 
org.apache.derbyTesting.junit.BaseJDBCTestCase.assertTableRowCount(BaseJDBCTestCase.java:879)
        at 
org.apache.derbyTesting.functionTests.tests.jdbcapi.SavepointJdbc30_JSR169Test.xtestRollbackWillReleaseLaterSavepoints(SavepointJdbc30_JSR169Test.java:758)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:615)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at 
org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:103)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: ERROR 42X05: Table/View 't1' does not exist.
        at 
org.apache.derby.iapi.error.StandardException.newException(StandardException.java:286)
        at 
org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(FromBaseTable.java:2451)
        at 
org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(FromBaseTable.java:2175)
        at 
org.apache.derby.impl.sql.compile.FromList.bindTables(FromList.java:310)
        at 
org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(SelectNode.java:390)
        at 
org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(DMLStatementNode.java:199)
        at 
org.apache.derby.impl.sql.compile.DMLStatementNode.bind(DMLStatementNode.java:137)
        at 
org.apache.derby.impl.sql.compile.CursorNode.bindStatement(CursorNode.java:236)
        at 
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:314)
        at 
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
        at 
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:768)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:606)
        ... 23 more



> Convert jdbcapi/savepointJdbc30_JSR169.java and 
> jdbcapi/savepointJdbc30_XA.java to JUnit
> ----------------------------------------------------------------------------------------
>
>                 Key: DERBY-3568
>                 URL: https://issues.apache.org/jira/browse/DERBY-3568
>             Project: Derby
>          Issue Type: Test
>          Components: Newcomer, Test
>            Reporter: Kathey Marsden
>            Assignee: Erlend Birkenes
>            Priority: Minor
>         Attachments: DERBY-3568.diff
>
>
> These are the last two in the jdk14 suite and might be a good beginner task.  

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

Reply via email to