Derby
  1. Derby
  2. DERBY-2242

Convert jdbcapi/metadata.java to JUnit test.

    Details

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

      Description

      Create a test for DatabaseMetaData that matches the testing of metadata.java.
      Should also handle the odbc_metadata variant.

      Once created can be used by other tests to ensure database meta data works in other situations, such as upgrade and read-only databases.

        Issue Links

          Activity

          Hide
          Daniel John Debrunner added a comment -

          Conversion will also cover dbMetaDataJdbc30

          Show
          Daniel John Debrunner added a comment - Conversion will also cover dbMetaDataJdbc30
          Hide
          Knut Anders Hatlen added a comment -

          Revision 498840 broke metadata and odbc_metadata under DerbyNet. Updated master files and committed a fix with revision 498958.

          Show
          Knut Anders Hatlen added a comment - Revision 498840 broke metadata and odbc_metadata under DerbyNet. Updated master files and committed a fix with revision 498958.
          Hide
          Myrna van Lunteren added a comment -

          I grabbed this one because I'll be looking at it in reference to DERBY-3088, and it's not seen any action since June.
          But - if anyone else wants to try their hand at one of the things left to do...
          I assume what's left is what's listed at the top of the test plus 2 TODO's:

          • Methods left to test from JDBC 3
          • getBestRowIdentifier
          • getColumnPrivileges
          • getCrossReference
          • getExportedKeys
          • getImportedKeys
          • getIndexInfo
          • getPrimaryKeys
          • getProcedureColumns
          • getProcedures
          • getTablePrivileges
            TODO re getSQLKeyworks: //TODO: more testing but not sure what!
            TODO re testUnimplementedSQLObjectAttributes: TODO: types and column names of the ResultSets
          Show
          Myrna van Lunteren added a comment - I grabbed this one because I'll be looking at it in reference to DERBY-3088 , and it's not seen any action since June. But - if anyone else wants to try their hand at one of the things left to do... I assume what's left is what's listed at the top of the test plus 2 TODO's: Methods left to test from JDBC 3 getBestRowIdentifier getColumnPrivileges getCrossReference getExportedKeys getImportedKeys getIndexInfo getPrimaryKeys getProcedureColumns getProcedures getTablePrivileges TODO re getSQLKeyworks: //TODO: more testing but not sure what! TODO re testUnimplementedSQLObjectAttributes: TODO: types and column names of the ResultSets
          Hide
          Myrna van Lunteren added a comment -

          I started looking at the getSQLKeywords //TODO, thinking we should be able to either compare with an existing set of strings, or execute create table statement and ensure that that would fail for any of the keywords returned, but the current returned value from getSQLKeywords is probably not what should be returned, nor, apparently, does it mean that you can't create a table. See DERBY-2245.

          Show
          Myrna van Lunteren added a comment - I started looking at the getSQLKeywords //TODO, thinking we should be able to either compare with an existing set of strings, or execute create table statement and ensure that that would fail for any of the keywords returned, but the current returned value from getSQLKeywords is probably not what should be returned, nor, apparently, does it mean that you can't create a table. See DERBY-2245 .
          Hide
          Myrna van Lunteren added a comment -

          I implemented the TODO for testUnimplementedSQLObjectAttributes fixture with revision 590476.
          I made a first cut at implementing getBestRowIdentifier by taking the tests from bestrowidentifier.sql and metadata.java with revision 592240.

          However, I now have a question on the basic set up for this test as explained in the javadoc.
          The javadoc indicates that for methods that return a resultset, there are to be 2 versions; one fixture that modifies the database, and one that doesn't.
          With, if I understand this correctly, the idea that the ones that don't modify the database are to be used for the upgrade tests.
          However, I'm wondering if this idea was dropped?

          The javadoc appears unfinished, there are only tests for getTables and getColumns that have a modify and non-modify version, and the upgrade tests appear to execute any test that start with 'test' except for 'testGetTablesModify'.

          Clarification please?
          If I don't hear anything, I'm going to adjust the javadoc on the modify/non modify bit to only apply to getTables and getColumns tests.

          Show
          Myrna van Lunteren added a comment - I implemented the TODO for testUnimplementedSQLObjectAttributes fixture with revision 590476. I made a first cut at implementing getBestRowIdentifier by taking the tests from bestrowidentifier.sql and metadata.java with revision 592240. However, I now have a question on the basic set up for this test as explained in the javadoc. The javadoc indicates that for methods that return a resultset, there are to be 2 versions; one fixture that modifies the database, and one that doesn't. With, if I understand this correctly, the idea that the ones that don't modify the database are to be used for the upgrade tests. However, I'm wondering if this idea was dropped? The javadoc appears unfinished, there are only tests for getTables and getColumns that have a modify and non-modify version, and the upgrade tests appear to execute any test that start with 'test' except for 'testGetTablesModify'. Clarification please? If I don't hear anything, I'm going to adjust the javadoc on the modify/non modify bit to only apply to getTables and getColumns tests.
          Hide
          Myrna van Lunteren added a comment -

          I converted the remaining test cases that needed it with revision 597311, and removed the old files with revision 597464.

          For intermediate changes, please see the svn revision log...

          One note: metadata_test.java had a section marked 'beetle 4620'. It refered to edge case testing the algorithm for getColumns in metadata.properties that sets max integer for octet_length when the datatype is char or varchar with length > max integer / 2 ....
          However, I think since then, there's been a change in the max size of the char/varchar, to size 32672, and the test case was adjusted accordingly.
          I am wondering if that code in metadata.properties is still necessary...

          Show
          Myrna van Lunteren added a comment - I converted the remaining test cases that needed it with revision 597311, and removed the old files with revision 597464. For intermediate changes, please see the svn revision log... One note: metadata_test.java had a section marked 'beetle 4620'. It refered to edge case testing the algorithm for getColumns in metadata.properties that sets max integer for octet_length when the datatype is char or varchar with length > max integer / 2 .... However, I think since then, there's been a change in the max size of the char/varchar, to size 32672, and the test case was adjusted accordingly. I am wondering if that code in metadata.properties is still necessary...

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development