Derby
  1. Derby
  2. DERBY-2492

convert checkDataSource, checkDataSource30 and checkDriver.java to junit

    Details

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

      Issue Links

        Activity

        Hide
        Myrna van Lunteren added a comment -

        completed the last TODO with revision 532005.

        Show
        Myrna van Lunteren added a comment - completed the last TODO with revision 532005.
        Hide
        Myrna van Lunteren added a comment -

        forgot to reinstate the checking for correct connection info printing.

        Show
        Myrna van Lunteren added a comment - forgot to reinstate the checking for correct connection info printing.
        Hide
        Myrna van Lunteren added a comment -

        Created DERBY-2533 to reflect the spin-off task of addressing the bad state of the db. I think there might be a bug - if all connections, statements, etc. are closed, should there still be locks?

        Show
        Myrna van Lunteren added a comment - Created DERBY-2533 to reflect the spin-off task of addressing the bad state of the db. I think there might be a bug - if all connections, statements, etc. are closed, should there still be locks?
        Hide
        Myrna van Lunteren added a comment -

        So, from the list above, we get the following bugs:
        1. Statement.getConnection() is different from the ofiringal XA(or ConnectionPool)DataSource.getConnection() - DERBY-2531
        2. ReadOnly in global transaction not reset - DERBY-911
        3. XAConnection.getXAResource() on closed connection does not give SQLException - DERBY-2532
        4. testXAHoldability does not get changed to CLOSE_CURSORS_AT_COMMIT inside global transaction - DERBY-1370.

        Show
        Myrna van Lunteren added a comment - So, from the list above, we get the following bugs: 1. Statement.getConnection() is different from the ofiringal XA(or ConnectionPool)DataSource.getConnection() - DERBY-2531 2. ReadOnly in global transaction not reset - DERBY-911 3. XAConnection.getXAResource() on closed connection does not give SQLException - DERBY-2532 4. testXAHoldability does not get changed to CLOSE_CURSORS_AT_COMMIT inside global transaction - DERBY-1370 .
        Hide
        Kathey Marsden added a comment -

        It is correct for the holdability to change to CLOSE_CURSORS_AT_COMMIT
        in the global transaction.. I filed this issue as DERBY-2481, but
        looking just now I think
        it might be a duplicate of DERBY-1370

        Kathey

        Show
        Kathey Marsden added a comment - It is correct for the holdability to change to CLOSE_CURSORS_AT_COMMIT in the global transaction.. I filed this issue as DERBY-2481 , but looking just now I think it might be a duplicate of DERBY-1370 Kathey
        Hide
        Myrna van Lunteren added a comment -

        I just committed the first version of the converted test for checkDataSource and checkDataSource30: DataSourceTest.java with revision 526087.
        Also temporarily added a method to SecurityCheck.java, which will be replacing the similar inspect method when I remove checkDataSource*.
        The only place where SecurityCheck is actually used, is in the checkDataSource tests, as far as I could see. ResultSetMiscTest loads the class, but doesn't actually call any methods, or so it seems to me).

        There are some things left to do with this test, marked with '// TODO:'

        • the fixtures testGlobalLocalInterleaf() and testReuseAcrossGlobalLocal() leave the system
          in a locked state - with embedded, shutting down the database and reconnecting release the
          locks, but with Network Server / DerbyNetClient that action results in a DRDA_Protocol
          error for testGlobalLocalInterleaf, and another, severe, protocol error for testReuse...

        This is not new - I've had trouble before running checkDataSource* with remote server, because
        of the bad state the test leaves the database in.

        I think there might be a bug somewhere, because even though all statements, preparedstatements,
        connections, resources, have been closed, the locks are stell held. Or I could just be missing
        something...

        Hopefully someone else can have a look and identify the problem.
        I will log a separate bug for it, for I don't think fixing this need be part of the conversion effort.

        In the meantime, these two tests do not run with DerbyNetClient.

        • there are some other differences between Network Server/ DerbyNetClient and embedded that I need to find out/check if they are known bugs, or need to log new bugs for and hang off the bug for differences (DERBY-310). The differences were present in the original masters for DerbyNetClient, so there should be bugs, or the behavior should be documented.

        these differences are:
        1. testAllDataSources(), through assertConnectionOK() and testReuseAcrossGlobalLocal() through queryOnStatement(), returns a different connection when comparing a connection obtained from a ConnectionPoolDataSource or an XADataSource, and Statement.getConnection() on a statement created by doing Connection.createStatement().
        Note, that currently, testReuseAcrossGlobalLocal has been switched off for NetworkServer, but I first added a if(usingEmbedded()) block to ignore this difference in both places where I saw this diff pop up.

        2. There is a difference in the ReadOnly value returned in testGlobalLocalInterleaf() in the XATransaction after setting ReadOnly. NetworkServer appears to not listen, Embedded has the changed value.

        3. In testReuseAcrossGlobalLocal() when testing on a closed XAConnection, xac2.getXAResource() does not return an error with NetworkServer, but does with Embedded.

        4. testXAHoldability(), when testing holdability of a statement created with holdability true, outside the global transaction, the holdability inside global transaction is different.

        • Finally, the setUp() and tearDown() methods are a little inelegant and probably could be improved.
        Show
        Myrna van Lunteren added a comment - I just committed the first version of the converted test for checkDataSource and checkDataSource30: DataSourceTest.java with revision 526087. Also temporarily added a method to SecurityCheck.java, which will be replacing the similar inspect method when I remove checkDataSource*. The only place where SecurityCheck is actually used, is in the checkDataSource tests, as far as I could see. ResultSetMiscTest loads the class, but doesn't actually call any methods, or so it seems to me). There are some things left to do with this test, marked with '// TODO:' the fixtures testGlobalLocalInterleaf() and testReuseAcrossGlobalLocal() leave the system in a locked state - with embedded, shutting down the database and reconnecting release the locks, but with Network Server / DerbyNetClient that action results in a DRDA_Protocol error for testGlobalLocalInterleaf, and another, severe, protocol error for testReuse... This is not new - I've had trouble before running checkDataSource* with remote server, because of the bad state the test leaves the database in. I think there might be a bug somewhere, because even though all statements, preparedstatements, connections, resources, have been closed, the locks are stell held. Or I could just be missing something... Hopefully someone else can have a look and identify the problem. I will log a separate bug for it, for I don't think fixing this need be part of the conversion effort. In the meantime, these two tests do not run with DerbyNetClient. there are some other differences between Network Server/ DerbyNetClient and embedded that I need to find out/check if they are known bugs, or need to log new bugs for and hang off the bug for differences ( DERBY-310 ). The differences were present in the original masters for DerbyNetClient, so there should be bugs, or the behavior should be documented. these differences are: 1. testAllDataSources(), through assertConnectionOK() and testReuseAcrossGlobalLocal() through queryOnStatement(), returns a different connection when comparing a connection obtained from a ConnectionPoolDataSource or an XADataSource, and Statement.getConnection() on a statement created by doing Connection.createStatement(). Note, that currently, testReuseAcrossGlobalLocal has been switched off for NetworkServer, but I first added a if(usingEmbedded()) block to ignore this difference in both places where I saw this diff pop up. 2. There is a difference in the ReadOnly value returned in testGlobalLocalInterleaf() in the XATransaction after setting ReadOnly. NetworkServer appears to not listen, Embedded has the changed value. 3. In testReuseAcrossGlobalLocal() when testing on a closed XAConnection, xac2.getXAResource() does not return an error with NetworkServer, but does with Embedded. 4. testXAHoldability(), when testing holdability of a statement created with holdability true, outside the global transaction, the holdability inside global transaction is different. Finally, the setUp() and tearDown() methods are a little inelegant and probably could be improved.

          People

          • Assignee:
            Myrna van Lunteren
            Reporter:
            Myrna van Lunteren
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development