Derby
  1. Derby
  2. DERBY-1826

Add JUnit utility methods for database/server shutdown

    Details

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

      Description

      Dan suggested a good place to add these is TestConfiguration class. See http://issues.apache.org/jira/browse/DERBY-1522#action_12433121

      1. derby-1826-v1.diff
        8 kB
        Deepa Remesh
      2. derby-1826-v1.status
        0.2 kB
        Deepa Remesh

        Activity

        Hide
        Deepa Remesh added a comment -

        The attached patch 'derby-1826-v1.diff' adds methods to get connection by specifying connection attributes. These can be used to shutdown databases/system.

        Changes in the patch:

        • Adds following methods to TestConfiguration and corresponding wrapper methods to BaseJDBCTestCase:
          getDefaultConnection(String connAttrs)
          getConnection (String databaseName, String connAttrs)

        These methods can be used to get connection using specific connection attributes. By passing shutdown attribute, these can be used to shutdown database/system.

        Without this patch, this was possible using BaseJDBCTestCase.openConnection(String databaseName) method and passing in databaseName+";<connection attributes>". To shutdown default database, we would need to explicitly pass in the default database name. I think the new methods in the patch improve the usage.

        • Changes methods used to set DataSource properties to take in connection attributes.
        • Changes lang/SQLAuthorizationProp test to use the new method to shutdown the database.

        With the patch, I successfully ran the JUnit Embedded suite standalone. I tried to run "All" suite standalone but getting OutOfMemoryError in client suite. I am getting the memory errors even without this patch. I will open a separate issue for it. I am currently running derbyall to check the changes in the helper methods have not affected any other tests.

        Please provide feedback on the patch. I would appreciate if anyone can also check if the changes fit into the current JUnit infrastructure.

        Show
        Deepa Remesh added a comment - The attached patch 'derby-1826-v1.diff' adds methods to get connection by specifying connection attributes. These can be used to shutdown databases/system. Changes in the patch: Adds following methods to TestConfiguration and corresponding wrapper methods to BaseJDBCTestCase: getDefaultConnection(String connAttrs) getConnection (String databaseName, String connAttrs) These methods can be used to get connection using specific connection attributes. By passing shutdown attribute, these can be used to shutdown database/system. Without this patch, this was possible using BaseJDBCTestCase.openConnection(String databaseName) method and passing in databaseName+";<connection attributes>". To shutdown default database, we would need to explicitly pass in the default database name. I think the new methods in the patch improve the usage. Changes methods used to set DataSource properties to take in connection attributes. Changes lang/SQLAuthorizationProp test to use the new method to shutdown the database. With the patch, I successfully ran the JUnit Embedded suite standalone. I tried to run "All" suite standalone but getting OutOfMemoryError in client suite. I am getting the memory errors even without this patch. I will open a separate issue for it. I am currently running derbyall to check the changes in the helper methods have not affected any other tests. Please provide feedback on the patch. I would appreciate if anyone can also check if the changes fit into the current JUnit infrastructure.
        Hide
        Deepa Remesh added a comment -

        derbyall ran okay using Sun jdk 1.4.2 on Windows XP. Few tests had failed due to some issues on my machine but on re-run, they passed. derby-1826-v1.diff patch is ready for review/commit.

        Show
        Deepa Remesh added a comment - derbyall ran okay using Sun jdk 1.4.2 on Windows XP. Few tests had failed due to some issues on my machine but on re-run, they passed. derby-1826-v1.diff patch is ready for review/commit.
        Hide
        Mike Matrigali added a comment -

        patch available, making it a candidate for 10.2.

        Show
        Mike Matrigali added a comment - patch available, making it a candidate for 10.2.
        Hide
        Knut Anders Hatlen added a comment -

        Committed revision 448900. I'm leaving the issue open until it has been committed to the 10.2 branch.

        Show
        Knut Anders Hatlen added a comment - Committed revision 448900. I'm leaving the issue open until it has been committed to the 10.2 branch.
        Hide
        Deepa Remesh added a comment -

        Verified the patch has been committed to trunk and 10.2 branch. Thanks Kristian, Knut and Rick.

        Show
        Deepa Remesh added a comment - Verified the patch has been committed to trunk and 10.2 branch. Thanks Kristian, Knut and Rick.

          People

          • Assignee:
            Deepa Remesh
            Reporter:
            Deepa Remesh
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development