Derby
  1. Derby
  2. DERBY-2995

convert lang/renameIndex.sql to JUnit

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.4.1.3
    • Component/s: Test
    • Labels:
      None
    1. DERBY-2995.diff-p1
      21 kB
      Ravinder Reddy
    2. DERBY-2995.diff-p2
      20 kB
      Ravinder Reddy
    3. STATUS-p2
      0.5 kB
      Ravinder Reddy

      Activity

      Hide
      Ravinder Reddy added a comment -

      I have a small doubt regarding the following test case.
      public void testRenameColumnWithIndex() throws SQLException

      { Statement s = createStatement(); s.executeUpdate("create table t3(c31 int not null primary key, c32 int)"); s.executeUpdate("create index i1_t3 on t3(c32)"); s.executeUpdate("rename index i1_t3 to i1_3r"); //-- make sure that i1_t3 did get renamed. Following rename should fail to prove that. assertStatementError("42X65" , s , "rename index i1_t3 to i1_3r"); s.executeUpdate("drop table t3"); }

      It is not testing what is commented in lang/renameIndex.sql.
      Should I include this as a fixture or can I safely remove it as it was tested already.
      Thank You.

      Show
      Ravinder Reddy added a comment - I have a small doubt regarding the following test case. public void testRenameColumnWithIndex() throws SQLException { Statement s = createStatement(); s.executeUpdate("create table t3(c31 int not null primary key, c32 int)"); s.executeUpdate("create index i1_t3 on t3(c32)"); s.executeUpdate("rename index i1_t3 to i1_3r"); //-- make sure that i1_t3 did get renamed. Following rename should fail to prove that. assertStatementError("42X65" , s , "rename index i1_t3 to i1_3r"); s.executeUpdate("drop table t3"); } It is not testing what is commented in lang/renameIndex.sql. Should I include this as a fixture or can I safely remove it as it was tested already. Thank You.
      Hide
      Kathey Marsden added a comment -

      I think this fixture is ok as is except for maybe a comma after the word fail. Following rename should fail, to prove that, not the following rename should fail to prove that #.

      testDuplicateIndexWithPreparedStatement
      On the cleanup e.g. drop tables you should just have s.executeUpdate("drop table t3) instead of an assertion

      Why is this fixture commented out? There doesn't seem to be an open cursor.

      /*-- cannot rename an index when there is an open cursor on it
      public void testRenameIndexWithOpenCursor() throws SQLException

      { Statement s = createStatement(ResultSet.TYPE_FORWARD_ONLY , ResultSet.CONCUR_UPDATABLE); assertUpdateCount(s , 0 , "create table t1(c11 int, c12 int)"); assertUpdateCount(s , 0 , "create index i1 on t1(c11)"); assertStatementError("X0X95" , s , "rename index i1 to i1r"); //-- following rename should pass because cursor c1 has been closed assertUpdateCount(s , 0 , "rename index i1 to i1r"); assertUpdateCount(s , 0 , "drop table t1"); }

      */

      Show
      Kathey Marsden added a comment - I think this fixture is ok as is except for maybe a comma after the word fail. Following rename should fail, to prove that, not the following rename should fail to prove that # . testDuplicateIndexWithPreparedStatement On the cleanup e.g. drop tables you should just have s.executeUpdate("drop table t3) instead of an assertion Why is this fixture commented out? There doesn't seem to be an open cursor. /*-- cannot rename an index when there is an open cursor on it public void testRenameIndexWithOpenCursor() throws SQLException { Statement s = createStatement(ResultSet.TYPE_FORWARD_ONLY , ResultSet.CONCUR_UPDATABLE); assertUpdateCount(s , 0 , "create table t1(c11 int, c12 int)"); assertUpdateCount(s , 0 , "create index i1 on t1(c11)"); assertStatementError("X0X95" , s , "rename index i1 to i1r"); //-- following rename should pass because cursor c1 has been closed assertUpdateCount(s , 0 , "rename index i1 to i1r"); assertUpdateCount(s , 0 , "drop table t1"); } */
      Hide
      Ravinder Reddy added a comment -

      Thank You Kathey for your Review.
      I have modified to include your suggestions/comments.
      Thank You.

      Show
      Ravinder Reddy added a comment - Thank You Kathey for your Review. I have modified to include your suggestions/comments. Thank You.
      Hide
      Kathey Marsden added a comment -

      I added the test to lang._Suite and committed.

      Show
      Kathey Marsden added a comment - I added the test to lang._Suite and committed.
      Hide
      Myrna van Lunteren added a comment -

      looks like this is committed, and thus, done...
      Please reopen if that assumption is incorrect, or else close this.

      Show
      Myrna van Lunteren added a comment - looks like this is committed, and thus, done... Please reopen if that assumption is incorrect, or else close this.

        People

        • Assignee:
          Ravinder Reddy
          Reporter:
          Ravinder Reddy
        • Votes:
          0 Vote for this issue
          Watchers:
          1 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Development