Derby
  1. Derby
  2. DERBY-4248

convert checkConstraint.sql to JUnit

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.4.2.1
    • Fix Version/s: 10.6.1.0
    • Component/s: Test
    • Labels:
      None
    • Urgency:
      Normal
    • Issue & fix info:
      Newcomer

      Description

      Converting CheckConstraint.sql to JUnit under supervision of Bryan Pendleton.

      1. ASF.LICENSE.NOT.GRANTED--CheckConstraintTest.java
        13 kB
        Eranda Sooriyabandara
      2. ASF.LICENSE.NOT.GRANTED--CheckConstraintTest.diff
        24 kB
        Eranda Sooriyabandara
      3. ASF.LICENSE.NOT.GRANTED--CheckConstraintTest.diff
        39 kB
        Eranda Sooriyabandara
      4. ASF.LICENSE.NOT.GRANTED--CheckConstraintTest.diff
        60 kB
        Eranda Sooriyabandara
      5. ASF.LICENSE.NOT.GRANTED--CheckConstraintTest.diff
        60 kB
        Eranda Sooriyabandara

        Issue Links

          Activity

          Eranda Sooriyabandara created issue -
          Hide
          Eranda Sooriyabandara added a comment -

          Hi,
          Here I add the patch with this, which produce by the DERBY-2151
          ijToJUnit tool with some basic editing.

          Show
          Eranda Sooriyabandara added a comment - Hi, Here I add the patch with this, which produce by the DERBY-2151 ijToJUnit tool with some basic editing.
          Eranda Sooriyabandara made changes -
          Field Original Value New Value
          Attachment CheckConstraintTest.java [ 12408970 ]
          Hide
          Eranda Sooriyabandara added a comment -
          Show
          Eranda Sooriyabandara added a comment -
          Eranda Sooriyabandara made changes -
          Attachment CheckConstraintTest.diff [ 12408972 ]
          Hide
          Bryan Pendleton added a comment -

          Hi Eranda, thanks for attaching the patch proposal.

          Your diff file also includes the AlterTableTest changes from DERBY-4187.
          It would be better to keep these separate. Can you construct a separate
          source tree on your system containing only the CheckConstraint test changes
          and provide a diff with only those contents? Thanks!

          Show
          Bryan Pendleton added a comment - Hi Eranda, thanks for attaching the patch proposal. Your diff file also includes the AlterTableTest changes from DERBY-4187 . It would be better to keep these separate. Can you construct a separate source tree on your system containing only the CheckConstraint test changes and provide a diff with only those contents? Thanks!
          Hide
          Eranda Sooriyabandara added a comment -

          Hi Bryan,
          Sorry for the mistake. Here I attach the patch. But I am not pretty
          sure about the test contain all the tests which were in
          checkConstraint.sql.Please make a comment on that.
          Thanks

          Show
          Eranda Sooriyabandara added a comment - Hi Bryan, Sorry for the mistake. Here I attach the patch. But I am not pretty sure about the test contain all the tests which were in checkConstraint.sql.Please make a comment on that. Thanks
          Eranda Sooriyabandara made changes -
          Attachment CheckConstraintTest.diff [ 12409068 ]
          Hide
          Eranda Sooriyabandara added a comment -

          Hi Bryan,
          Compilation was successful and here I attaching the patch. Working
          further on it.
          Thanks

          Show
          Eranda Sooriyabandara added a comment - Hi Bryan, Compilation was successful and here I attaching the patch. Working further on it. Thanks
          Eranda Sooriyabandara made changes -
          Attachment CheckConstraintTest.diff [ 12409222 ]
          Hide
          Bryan Pendleton added a comment -

          Hi Eranda,

          The new patch looks good, it seems like the new test is taking shape nicely.

          I think that the conversion tool did not handle this section of the script very well:

          prepare p1 as 'insert into t1 values 1';
          prepare p2 as 'update t1 set c1 = 3 where c1 = 4';
          prepare p3 as 'select * from t1';
          – the insert and update should fail, select should succeed
          execute p1;
          execute p2;
          execute p3;

          In the new JUnit test, this seemed to show up as:

          + pSt = prepareStatement(
          + "insert into t1 values 1");
          +
          + pSt = prepareStatement(
          + "update t1 set c1 = 3 where c1 = 4");
          +
          + pSt = prepareStatement(
          + "select * from t1");
          +
          + // the insert and update should fail, select should succeed
          +
          + assertStatementError("23505", pSt);
          +
          + assertStatementError("23505", pSt);
          +
          + rs = pSt.executeQuery();

          I think that we should not be using the same variable for these 3 prepared statements,
          instead we need to have 3 separate PreparedStatement objects.

          Show
          Bryan Pendleton added a comment - Hi Eranda, The new patch looks good, it seems like the new test is taking shape nicely. I think that the conversion tool did not handle this section of the script very well: prepare p1 as 'insert into t1 values 1'; prepare p2 as 'update t1 set c1 = 3 where c1 = 4'; prepare p3 as 'select * from t1'; – the insert and update should fail, select should succeed execute p1; execute p2; execute p3; In the new JUnit test, this seemed to show up as: + pSt = prepareStatement( + "insert into t1 values 1"); + + pSt = prepareStatement( + "update t1 set c1 = 3 where c1 = 4"); + + pSt = prepareStatement( + "select * from t1"); + + // the insert and update should fail, select should succeed + + assertStatementError("23505", pSt); + + assertStatementError("23505", pSt); + + rs = pSt.executeQuery(); I think that we should not be using the same variable for these 3 prepared statements, instead we need to have 3 separate PreparedStatement objects.
          Eranda Sooriyabandara made changes -
          Attachment AlterTableTest.diff [ 12409481 ]
          Eranda Sooriyabandara made changes -
          Comment [ Hi Bryan,
          I am sorry I have mistaken and I attached a file belong to the
          DERBY-4187 file here.
          Thanks
          Eranda
          ]
          Eranda Sooriyabandara made changes -
          Comment [ Hi Bryan,
          Here I attaching the complete patch file.
          Thanks
          Eranda
          ]
          Eranda Sooriyabandara made changes -
          Attachment AlterTableTest.diff [ 12409481 ]
          Eranda Sooriyabandara made changes -
          Attachment CheckConstraintTest.diff [ 12408972 ]
          Eranda Sooriyabandara made changes -
          Link This issue blocks DERBY-4282 [ DERBY-4282 ]
          Eranda Sooriyabandara made changes -
          Link This issue blocks DERBY-4282 [ DERBY-4282 ]
          Eranda Sooriyabandara made changes -
          Link This issue depends on DERBY-4282 [ DERBY-4282 ]
          Hide
          Eranda Sooriyabandara added a comment -

          Hi Bryan,
          I commented that part which consider as a new bug and make the test
          complete. With the knowledge of working in AlterTableTest.
          Here I send patch file with this.
          Now what can we do? Can we proceed with the bug?
          Thanks
          Eranda

          Show
          Eranda Sooriyabandara added a comment - Hi Bryan, I commented that part which consider as a new bug and make the test complete. With the knowledge of working in AlterTableTest. Here I send patch file with this. Now what can we do? Can we proceed with the bug? Thanks Eranda
          Eranda Sooriyabandara made changes -
          Attachment CheckConstraintTest.diff [ 12411353 ]
          Hide
          Bryan Pendleton added a comment -

          Hi Eranda, I will have a look at your latest version of CheckConstraintTest as soon as I can.

          Show
          Bryan Pendleton added a comment - Hi Eranda, I will have a look at your latest version of CheckConstraintTest as soon as I can.
          Hide
          Bryan Pendleton added a comment -

          I successfully built and ran CheckConstraintTest, and the test passed.

          Show
          Bryan Pendleton added a comment - I successfully built and ran CheckConstraintTest, and the test passed.
          Dag H. Wanvik made changes -
          Issue & fix info [Newcomer]
          Dag H. Wanvik made changes -
          Issue Type Test [ 6 ] Improvement [ 4 ]
          Hide
          Eranda Sooriyabandara added a comment -

          Hi Bryan,I break the test into five separate methods,

          testNotAllowedInCheckConstraint()
          testCheckConstriant()
          testPositionalUpdate()
          testBuiltInFunctions()
          testJira2989()

          Here I am attaching the patch file with this, Are there more to do with
          coding if any please let me know.
          Now I think to compare checkConstraint.out and the CheckConstraintTest and
          make a complete patch file.

          Thanks
          Eranda

          Show
          Eranda Sooriyabandara added a comment - Hi Bryan,I break the test into five separate methods, testNotAllowedInCheckConstraint() testCheckConstriant() testPositionalUpdate() testBuiltInFunctions() testJira2989() Here I am attaching the patch file with this, Are there more to do with coding if any please let me know. Now I think to compare checkConstraint.out and the CheckConstraintTest and make a complete patch file. Thanks Eranda
          Eranda Sooriyabandara made changes -
          Attachment CheckConstraintTest.diff [ 12413839 ]
          Hide
          Eranda Sooriyabandara added a comment -

          Hi Bryan,
          I compared CheckContraintTest with the checkConstraint.sql and
          I didn't find an error in this test and successfully ran in my platform.
          Here is my final patch file attaching with this.
          Thanks
          Eranda

          Show
          Eranda Sooriyabandara added a comment - Hi Bryan, I compared CheckContraintTest with the checkConstraint.sql and I didn't find an error in this test and successfully ran in my platform. Here is my final patch file attaching with this. Thanks Eranda
          Hide
          Bryan Pendleton added a comment -

          Hi Eranda, I don't see an updated diff file. Maybe the attachment did not go through?

          Show
          Bryan Pendleton added a comment - Hi Eranda, I don't see an updated diff file. Maybe the attachment did not go through?
          Hide
          Bryan Pendleton added a comment -

          The patch looks good to me. I ran a complete set of regression tests, and
          submitted the patch to the trunk as revision 796893.

          Eranda, please update your subversion client and check that the patch
          appears to have been applied correctly, and that the test still runs
          correctly for you, and then please close this issue at your convenience.

          Thanks very much for this contribution to Derby!

          Show
          Bryan Pendleton added a comment - The patch looks good to me. I ran a complete set of regression tests, and submitted the patch to the trunk as revision 796893. Eranda, please update your subversion client and check that the patch appears to have been applied correctly, and that the test still runs correctly for you, and then please close this issue at your convenience. Thanks very much for this contribution to Derby!
          Bryan Pendleton made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Eranda Sooriyabandara added a comment -

          Hi Bryan,
          Thanks for submitting the patch. I am happy to about the update.
          I am closing this issue.
          Thanks
          Eranda

          Show
          Eranda Sooriyabandara added a comment - Hi Bryan, Thanks for submitting the patch. I am happy to about the update. I am closing this issue. Thanks Eranda
          Eranda Sooriyabandara made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Dag H. Wanvik made changes -
          Affects Version/s 10.4.2.1 [ 12313401 ]
          Affects Version/s 10.4.3.0 [ 12313654 ]
          Gavin made changes -
          Link This issue depends on DERBY-4282 [ DERBY-4282 ]
          Gavin made changes -
          Link This issue depends upon DERBY-4282 [ DERBY-4282 ]
          Gavin made changes -
          Workflow jira [ 12464304 ] Default workflow, editable Closed status [ 12799046 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          58d 43m 1 Bryan Pendleton 22/Jul/09 23:22
          Resolved Resolved Closed Closed
          5h 49m 1 Eranda Sooriyabandara 23/Jul/09 05:11

            People

            • Assignee:
              Eranda Sooriyabandara
              Reporter:
              Eranda Sooriyabandara
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved:

                Development