You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Junjie Peng (JIRA)" <ji...@apache.org> on 2008/07/02 11:10:45 UTC

[jira] Created: (DERBY-3751) Convert case.sql to junit

Convert case.sql to junit
-------------------------

                 Key: DERBY-3751
                 URL: https://issues.apache.org/jira/browse/DERBY-3751
             Project: Derby
          Issue Type: Test
          Components: Test
         Environment: Windows Xp, sp2.
            Reporter: Junjie Peng
            Assignee: Junjie Peng


In the package "org.apache.derbyTesting.functionTests.tests.lang", we have both "CaseExpressionTest.java"  and "case.sql", which are both about case.  Now, I would like to convert "case.sql" to junit, and I will add new test cases into "CaseExpressionTest.java" ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DERBY-3751) Convert case.sql to junit

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3751?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan resolved DERBY-3751.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.5.0.0
       Derby Info:   (was: [Patch Available])

Thanks for the updated patch Junjie.

I committed 'derby-3751-2-patch.txt' to trunk with revision 674451.
As the reporter of the issue, feel free to close it when you have verified the fix/commit.

> Convert case.sql to junit
> -------------------------
>
>                 Key: DERBY-3751
>                 URL: https://issues.apache.org/jira/browse/DERBY-3751
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>         Environment: Windows Xp, sp2.
>            Reporter: Junjie Peng
>            Assignee: Junjie Peng
>             Fix For: 10.5.0.0
>
>         Attachments: derby-3751-1-patch.txt, derby-3751-1-stat.txt, derby-3751-2-patch.txt, derby-3751-2-stat.txt, derby-3751-patch.txt
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> In the package "org.apache.derbyTesting.functionTests.tests.lang", we have both "CaseExpressionTest.java"  and "case.sql", which are both about case.  Now, I would like to convert "case.sql" to junit, and I will add new test cases into "CaseExpressionTest.java" ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3751) Convert case.sql to junit

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12609940#action_12609940 ] 

Kristian Waagan commented on DERBY-3751:
----------------------------------------

Hello Junjie,

Thanks for the patch.
Below are some comments after a quick look at the first revision:

 1) Are you sure 'CaseExpressionTest' is the best place to put the test?

 2) I don't see much value in the assertEquals for the create
    statements.
    If the statement fails because of case sensitivity, it will throw an
    SQLException.

 3) I think the results from the select statements should be verified by
    using a helper method from the JDBC utility class. You can find the
    class in the package org.apache.derbyTesting.junit.
    I don't understand the use of 'getFetchSize()'.


As a committer, I would also appreciate a stat file (genereated by 'svn
stat') for patches like this where files are deleted (or added). 
It makes it easier to avoid leaving empty files in the repository :)


Thank you, keep up the good work!


regards,

> Convert case.sql to junit
> -------------------------
>
>                 Key: DERBY-3751
>                 URL: https://issues.apache.org/jira/browse/DERBY-3751
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>         Environment: Windows Xp, sp2.
>            Reporter: Junjie Peng
>            Assignee: Junjie Peng
>         Attachments: derby-3751-patch.txt
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> In the package "org.apache.derbyTesting.functionTests.tests.lang", we have both "CaseExpressionTest.java"  and "case.sql", which are both about case.  Now, I would like to convert "case.sql" to junit, and I will add new test cases into "CaseExpressionTest.java" ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3751) Convert case.sql to junit

Posted by "Junjie Peng (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3751?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Junjie Peng updated DERBY-3751:
-------------------------------

    Attachment: derby-3751-patch.txt

1.  Convert  "case.sql" into test case in "CaseExpressionTest.java"
2.  delete the output file named "case.out"  for "case.sql"

Please check it!

> Convert case.sql to junit
> -------------------------
>
>                 Key: DERBY-3751
>                 URL: https://issues.apache.org/jira/browse/DERBY-3751
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>         Environment: Windows Xp, sp2.
>            Reporter: Junjie Peng
>            Assignee: Junjie Peng
>         Attachments: derby-3751-patch.txt
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> In the package "org.apache.derbyTesting.functionTests.tests.lang", we have both "CaseExpressionTest.java"  and "case.sql", which are both about case.  Now, I would like to convert "case.sql" to junit, and I will add new test cases into "CaseExpressionTest.java" ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3751) Convert case.sql to junit

Posted by "Junjie Peng (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611484#action_12611484 ] 

Junjie Peng commented on DERBY-3751:
------------------------------------

Hehe.  I will remeber this revision and correct my other patches, thank you!

> Convert case.sql to junit
> -------------------------
>
>                 Key: DERBY-3751
>                 URL: https://issues.apache.org/jira/browse/DERBY-3751
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>         Environment: Windows Xp, sp2.
>            Reporter: Junjie Peng
>            Assignee: Junjie Peng
>             Fix For: 10.5.0.0
>
>         Attachments: derby-3751-1-patch.txt, derby-3751-1-stat.txt, derby-3751-2-patch.txt, derby-3751-2-stat.txt, derby-3751-patch.txt
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> In the package "org.apache.derbyTesting.functionTests.tests.lang", we have both "CaseExpressionTest.java"  and "case.sql", which are both about case.  Now, I would like to convert "case.sql" to junit, and I will add new test cases into "CaseExpressionTest.java" ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3751) Convert case.sql to junit

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610183#action_12610183 ] 

Kristian Waagan commented on DERBY-3751:
----------------------------------------

Thank you, Junjie.

1) I don't think the two tests test the same thing.
  case.sql : Tests keyword case insensitivity, i.e. both "seLEcT" and "select" should work.
  CaseExpressionTest : Tests the SQL conditional statement CASE. An example:

UPDATE inventory SET price = price * 
   CASE
      WHEN quantity > 20 THEN 0.75
      WHEN quantity BETWEEN 10 AND 20 THEN 0.90
   ELSE 0.95
END;

If my statement above is correct, I wold prefer to put the test elsewhere. Finding the right place isn't always straight-forward.
I think it should be in the lang directory, but I couldn't find a better home by looking at the tests in there.
I'll let you decide if you want to keep it where it is, create a new class or put it elsewhere. The existing test is rather limited, so one can imagine the test being extended later.


Your latest patch looks good. It can be committed once we agree on where the test should live.
If you wanted to improve it further, you could;
 a) Use 'JDBC.assertSingleValueResultSet' instead of 'assertFullResultSet'.
 b) Remove trailing whitespace. Many of the seemingly blank lines contain 8 space characters.

thanks,

> Convert case.sql to junit
> -------------------------
>
>                 Key: DERBY-3751
>                 URL: https://issues.apache.org/jira/browse/DERBY-3751
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>         Environment: Windows Xp, sp2.
>            Reporter: Junjie Peng
>            Assignee: Junjie Peng
>         Attachments: derby-3751-1-patch.txt, derby-3751-1-stat.txt, derby-3751-patch.txt
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> In the package "org.apache.derbyTesting.functionTests.tests.lang", we have both "CaseExpressionTest.java"  and "case.sql", which are both about case.  Now, I would like to convert "case.sql" to junit, and I will add new test cases into "CaseExpressionTest.java" ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3751) Convert case.sql to junit

Posted by "Junjie Peng (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610149#action_12610149 ] 

Junjie Peng commented on DERBY-3751:
------------------------------------

Dear Kristian:
Thank you for your advices and encouragement! I will check the patch again, and improve it! Please wait for it.


> Convert case.sql to junit
> -------------------------
>
>                 Key: DERBY-3751
>                 URL: https://issues.apache.org/jira/browse/DERBY-3751
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>         Environment: Windows Xp, sp2.
>            Reporter: Junjie Peng
>            Assignee: Junjie Peng
>         Attachments: derby-3751-patch.txt
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> In the package "org.apache.derbyTesting.functionTests.tests.lang", we have both "CaseExpressionTest.java"  and "case.sql", which are both about case.  Now, I would like to convert "case.sql" to junit, and I will add new test cases into "CaseExpressionTest.java" ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3751) Convert case.sql to junit

Posted by "Junjie Peng (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3751?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Junjie Peng updated DERBY-3751:
-------------------------------

    Attachment: derby-3751-2-stat.txt
                derby-3751-2-patch.txt

Hi, Kristian. I agree with you to add a new test class for furture extension. I have done so and improve the code with "JDBC.assertSingleValueResultSet".  Whitespace problem is also resovled. Thank you!
Please check it.

> Convert case.sql to junit
> -------------------------
>
>                 Key: DERBY-3751
>                 URL: https://issues.apache.org/jira/browse/DERBY-3751
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>         Environment: Windows Xp, sp2.
>            Reporter: Junjie Peng
>            Assignee: Junjie Peng
>         Attachments: derby-3751-1-patch.txt, derby-3751-1-stat.txt, derby-3751-2-patch.txt, derby-3751-2-stat.txt, derby-3751-patch.txt
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> In the package "org.apache.derbyTesting.functionTests.tests.lang", we have both "CaseExpressionTest.java"  and "case.sql", which are both about case.  Now, I would like to convert "case.sql" to junit, and I will add new test cases into "CaseExpressionTest.java" ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3751) Convert case.sql to junit

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611483#action_12611483 ] 

Kristian Waagan commented on DERBY-3751:
----------------------------------------

Sorry, forgot to disable the test in the LangScripts test-script.
Committed to trunk with revision 674733.

> Convert case.sql to junit
> -------------------------
>
>                 Key: DERBY-3751
>                 URL: https://issues.apache.org/jira/browse/DERBY-3751
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>         Environment: Windows Xp, sp2.
>            Reporter: Junjie Peng
>            Assignee: Junjie Peng
>             Fix For: 10.5.0.0
>
>         Attachments: derby-3751-1-patch.txt, derby-3751-1-stat.txt, derby-3751-2-patch.txt, derby-3751-2-stat.txt, derby-3751-patch.txt
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> In the package "org.apache.derbyTesting.functionTests.tests.lang", we have both "CaseExpressionTest.java"  and "case.sql", which are both about case.  Now, I would like to convert "case.sql" to junit, and I will add new test cases into "CaseExpressionTest.java" ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3751) Convert case.sql to junit

Posted by "Junjie Peng (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3751?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Junjie Peng updated DERBY-3751:
-------------------------------

    Attachment: derby-3751-1-patch.txt
                derby-3751-1-stat.txt

Hi, Kristian. A new patch and stat file are provided!
(1.) "CaseExpressionTest"  and "case. sql" are both about testing on case expressions, maybe it's better to act as an integrity than adding a new test class. Where do you prefer?
(2.) I have applied your advices on my code, it's really better. Thank you!


> Convert case.sql to junit
> -------------------------
>
>                 Key: DERBY-3751
>                 URL: https://issues.apache.org/jira/browse/DERBY-3751
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>         Environment: Windows Xp, sp2.
>            Reporter: Junjie Peng
>            Assignee: Junjie Peng
>         Attachments: derby-3751-1-patch.txt, derby-3751-1-stat.txt, derby-3751-patch.txt
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> In the package "org.apache.derbyTesting.functionTests.tests.lang", we have both "CaseExpressionTest.java"  and "case.sql", which are both about case.  Now, I would like to convert "case.sql" to junit, and I will add new test cases into "CaseExpressionTest.java" ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DERBY-3751) Convert case.sql to junit

Posted by "Junjie Peng (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3751?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Junjie Peng closed DERBY-3751.
------------------------------


It's OK. Thank you, Kristian!

> Convert case.sql to junit
> -------------------------
>
>                 Key: DERBY-3751
>                 URL: https://issues.apache.org/jira/browse/DERBY-3751
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>         Environment: Windows Xp, sp2.
>            Reporter: Junjie Peng
>            Assignee: Junjie Peng
>             Fix For: 10.5.0.0
>
>         Attachments: derby-3751-1-patch.txt, derby-3751-1-stat.txt, derby-3751-2-patch.txt, derby-3751-2-stat.txt, derby-3751-patch.txt
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> In the package "org.apache.derbyTesting.functionTests.tests.lang", we have both "CaseExpressionTest.java"  and "case.sql", which are both about case.  Now, I would like to convert "case.sql" to junit, and I will add new test cases into "CaseExpressionTest.java" ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.