Derby
  1. Derby
  2. DERBY-2464

convert lang/ShutdownDatabase.java to junit

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 10.3.1.4
    • Fix Version/s: 10.3.1.4
    • Component/s: Test
    • Labels:
      None

      Description

      Place holder for the conversion of lang/ShutdownDatabase.java to junit

      1. DERBY-2464_diff_03_21_ver1.txt
        11 kB
        Manjula Kutty
      2. DERBY-2464_diff_03_21.txt
        15 kB
        Manjula Kutty
      3. DERBY-2464_stat_03_21.txt
        0.8 kB
        Manjula Kutty

        Issue Links

          Activity

          Gavin made changes -
          Workflow jira [ 12399781 ] Default workflow, editable Closed status [ 12797988 ]
          Kristian Waagan made changes -
          Link This issue is duplicated by DERBY-4707 [ DERBY-4707 ]
          Tiago R. Espinha made changes -
          Link This issue is part of DERBY-4090 [ DERBY-4090 ]
          Dag H. Wanvik made changes -
          Issue Type Test [ 6 ] Improvement [ 4 ]
          Myrna van Lunteren made changes -
          Resolution Fixed [ 1 ]
          Derby Info [Patch Available]
          Status Open [ 1 ] Closed [ 6 ]
          Myrna van Lunteren made changes -
          Link This issue is related to DERBY-2477 [ DERBY-2477 ]
          Hide
          Manjula Kutty added a comment -

          do i have to keep this issue opened until there is a fix for n/w server? Or can I make it resolved now?

          Show
          Manjula Kutty added a comment - do i have to keep this issue opened until there is a fix for n/w server? Or can I make it resolved now?
          Hide
          Daniel John Debrunner added a comment -

          patch applied (with cleanup) Committed revision 521056.

          Show
          Daniel John Debrunner added a comment - patch applied (with cleanup) Committed revision 521056.
          Hide
          Daniel John Debrunner added a comment -

          I see those failures, I simplfied the test and continued to see those failures.
          The main simplification was not using openConnection(), just continue to use the utility methods like createStatement() after a shutdown.
          These use getConnection() which will open a new connection if the existing connection is closed.
          This also means the connection will be closed automatically, while those opened via openConnection() need to be closed explicitly.

          So i think the test has found a bug, shutting down the database causes some issues for the network server.
          I'll commit my modified version but running only in embedded, can you enter a bug for the failure?

          Show
          Daniel John Debrunner added a comment - I see those failures, I simplfied the test and continued to see those failures. The main simplification was not using openConnection(), just continue to use the utility methods like createStatement() after a shutdown. These use getConnection() which will open a new connection if the existing connection is closed. This also means the connection will be closed automatically, while those opened via openConnection() need to be closed explicitly. So i think the test has found a bug, shutting down the database causes some issues for the network server. I'll commit my modified version but running only in embedded, can you enter a bug for the failure?
          Manjula Kutty made changes -
          Attachment DERBY-2464_diff_03_21_ver1.txt [ 12353900 ]
          Hide
          Manjula Kutty added a comment -

          Thanks for the valuable comments, Dan, I made changes to the test so that it will use the default database . But when I did the drop table in the tear down method, I get the following error . Any gues what is going wrong here?

          I commented that code in the tear down method and just did the drop table in each test.

          There was 1 error:
          1) testOnlyTransactionWasCommited(org.apache.derbyTesting.functionTests.tests.la
          ng.ShutdownDatabaseTest)java.sql.SQLException: A network protocol error was enco
          untered and the connection has been terminated: the requested command encountere
          d an unarchitected and implementation-specific condition for which there was no
          architected message
          at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknow
          n Source)
          at org.apache.derby.client.am.SqlException.getSQLException(Unknown Sourc
          e)
          at org.apache.derby.client.am.Statement.execute(Unknown Source)
          at org.apache.derbyTesting.functionTests.tests.lang.ShutdownDatabaseTest
          .tearDown(ShutdownDatabaseTest.java:77)
          at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:
          80)
          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 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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
          at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
          at junit.extensions.TestSetup.run(TestSetup.java:23)
          Caused by: org.apache.derby.client.am.DisconnectException: A network protocol er
          ror was encountered and the connection has been terminated: the requested comman
          d encountered an unarchitected and implementation-specific condition for which t
          here was no architected message
          at org.apache.derby.client.net.NetConnectionReply.parseCMDCHKRM(Unknown
          Source)
          at org.apache.derby.client.net.NetStatementReply.parseExecuteImmediateEr
          ror(Unknown Source)
          at org.apache.derby.client.net.NetStatementReply.parseEXCSQLIMMreply(Unk
          nown Source)
          at org.apache.derby.client.net.NetStatementReply.readExecuteImmediate(Un
          known Source)
          at org.apache.derby.client.net.StatementReply.readExecuteImmediate(Unkno
          wn Source)
          at org.apache.derby.client.net.NetStatement.readExecuteImmediate_(Unknow
          n Source)
          at org.apache.derby.client.am.Statement.readExecuteImmediate(Unknown Sou
          rce)
          at org.apache.derby.client.am.Statement.flowExecute(Unknown Source)
          at org.apache.derby.client.am.Statement.executeX(Unknown Source)
          ... 27 more

          Show
          Manjula Kutty added a comment - Thanks for the valuable comments, Dan, I made changes to the test so that it will use the default database . But when I did the drop table in the tear down method, I get the following error . Any gues what is going wrong here? I commented that code in the tear down method and just did the drop table in each test. There was 1 error: 1) testOnlyTransactionWasCommited(org.apache.derbyTesting.functionTests.tests.la ng.ShutdownDatabaseTest)java.sql.SQLException: A network protocol error was enco untered and the connection has been terminated: the requested command encountere d an unarchitected and implementation-specific condition for which there was no architected message at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknow n Source) at org.apache.derby.client.am.SqlException.getSQLException(Unknown Sourc e) at org.apache.derby.client.am.Statement.execute(Unknown Source) at org.apache.derbyTesting.functionTests.tests.lang.ShutdownDatabaseTest .tearDown(ShutdownDatabaseTest.java:77) at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java: 80) 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 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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) Caused by: org.apache.derby.client.am.DisconnectException: A network protocol er ror was encountered and the connection has been terminated: the requested comman d encountered an unarchitected and implementation-specific condition for which t here was no architected message at org.apache.derby.client.net.NetConnectionReply.parseCMDCHKRM(Unknown Source) at org.apache.derby.client.net.NetStatementReply.parseExecuteImmediateEr ror(Unknown Source) at org.apache.derby.client.net.NetStatementReply.parseEXCSQLIMMreply(Unk nown Source) at org.apache.derby.client.net.NetStatementReply.readExecuteImmediate(Un known Source) at org.apache.derby.client.net.StatementReply.readExecuteImmediate(Unkno wn Source) at org.apache.derby.client.net.NetStatement.readExecuteImmediate_(Unknow n Source) at org.apache.derby.client.am.Statement.readExecuteImmediate(Unknown Sou rce) at org.apache.derby.client.am.Statement.flowExecute(Unknown Source) at org.apache.derby.client.am.Statement.executeX(Unknown Source) ... 27 more
          Hide
          Daniel John Debrunner added a comment -

          It looks like the test is just using a single database.

          So could the test use the TestConfiguration.singleUseDatabaseDecorator instead of the additional database decorator?
          This would mean that you wouldn't need a reopenConnection() method, though I don't think the test does as it stands.
          I'm not sure why the test can't just use openConnection(dbName) again.

          Then going further, I wonder why the default database cannot be used? The single use databases are for when the test leaves the database in a state such that it cannot be re-used, does this test do that?

          The assertGetIntEquals() probably needs some cleanup, if an exception is thrown no failure will be generated.
          Can you use instead the existing:

          JDBC.assertSingleValueResultSet()

          which I think is what you are trying to test for.

          Show
          Daniel John Debrunner added a comment - It looks like the test is just using a single database. So could the test use the TestConfiguration.singleUseDatabaseDecorator instead of the additional database decorator? This would mean that you wouldn't need a reopenConnection() method, though I don't think the test does as it stands. I'm not sure why the test can't just use openConnection(dbName) again. Then going further, I wonder why the default database cannot be used? The single use databases are for when the test leaves the database in a state such that it cannot be re-used, does this test do that? The assertGetIntEquals() probably needs some cleanup, if an exception is thrown no failure will be generated. Can you use instead the existing: JDBC.assertSingleValueResultSet() which I think is what you are trying to test for.
          Manjula Kutty made changes -
          Derby Info [Patch Available]
          Manjula Kutty made changes -
          Field Original Value New Value
          Attachment DERBY-2464_stat_03_21.txt [ 12353881 ]
          Attachment DERBY-2464_diff_03_21.txt [ 12353882 ]
          Hide
          Manjula Kutty added a comment -

          Attaching the first patch for this test. Please review it. Please review.

          Show
          Manjula Kutty added a comment - Attaching the first patch for this test. Please review it. Please review.
          Manjula Kutty created issue -

            People

            • Assignee:
              Manjula Kutty
              Reporter:
              Manjula Kutty
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development