Derby
  1. Derby
  2. DERBY-5342

make ScriptTestCase support "ij.showNoCountForSelect" and "ij.showNoConnectionsAtStart"

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.8.3.3, 10.9.1.0
    • Component/s: Test
    • Labels:

      Description

      Now, ScriptTestCase doesn't support property "ij.showNoConnectionsAtStart" (do nothing for it) and "ij.showNoCountForSelect"(it always works as "ij.showNoCountForSelect" = "flase").

      It will be better if the two properties be supported. To realise this, utilMain.goScript(Connection conn, LocalizedInput in) should be changed. Besides, some subclasses of ScripTestCase will be adapted accordingly.

      1. 5342-8.stat
        0.2 kB
        Houx Zhang
      2. 5342-8.patch
        2 kB
        Houx Zhang
      3. 5342-7-test.patch
        7 kB
        Houx Zhang
      4. 5342-6-testing.patch
        2 kB
        Houx Zhang
      5. 5342-5.stat
        0.1 kB
        Houx Zhang
      6. 5342-5.patch
        4 kB
        Houx Zhang
      7. 5342-4-test.patch
        6 kB
        Houx Zhang
      8. 5342-3.stat
        0.1 kB
        Houx Zhang
      9. 5342-3.patch
        4 kB
        Houx Zhang
      10. 5342-2.stat
        0.1 kB
        Houx Zhang
      11. 5342-2.patch
        4 kB
        Houx Zhang
      12. 5342-1.patch
        3 kB
        Houx Zhang

        Activity

        Hide
        Bryan Pendleton added a comment -

        Is this project related to DERBY-5332? That is, if this change is made, would we
        be able to put ij3.sql in ToolScripts.java?

        Show
        Bryan Pendleton added a comment - Is this project related to DERBY-5332 ? That is, if this change is made, would we be able to put ij3.sql in ToolScripts.java?
        Hide
        Houx Zhang added a comment -

        Hi, Bryan.

        This project doesn't related to DERBY-5332, as in ij3_app.properties, it says:

        1. ij3 wants to test an alternate path for driver loading
        2. from URL setting along
          ij.database=jdbc:derby:wombat;create=true

        so I think it's better to make a new subclass of ScriptTestCase than to add it in ToolScripts.

        In fact, this project relates to "DERBY-5327", in ij5_app.properties, it says:
        ij.showNoConnectionsAtStart=false
        ij.showNoCountForSelect=false

        however, ScriptTestCase doesn't support this two properties. With the two properties supporting, ij5.sql is fit to add into ToolScripts.

        I have changed utilMain in 5342-1.patch to support the two properties, and tested it well, however, I haven't yet to change the test cases affected by it.

        I'm not sure weather you think this project is not neccessary, so I will have a break first and get your advice. Thanks!

        Show
        Houx Zhang added a comment - Hi, Bryan. This project doesn't related to DERBY-5332 , as in ij3_app.properties, it says: ij3 wants to test an alternate path for driver loading from URL setting along ij.database=jdbc:derby:wombat;create=true so I think it's better to make a new subclass of ScriptTestCase than to add it in ToolScripts. In fact, this project relates to " DERBY-5327 ", in ij5_app.properties, it says: ij.showNoConnectionsAtStart=false ij.showNoCountForSelect=false however, ScriptTestCase doesn't support this two properties. With the two properties supporting, ij5.sql is fit to add into ToolScripts. I have changed utilMain in 5342-1.patch to support the two properties, and tested it well, however, I haven't yet to change the test cases affected by it. I'm not sure weather you think this project is not neccessary, so I will have a break first and get your advice. Thanks!
        Hide
        Bryan Pendleton added a comment -

        Thank you for the clear explanation.

        I think this is a good plan.

        I suggest that you continue working on this project, and on the related ij5 testing work.

        Meanwhile, I will move ahead with the ij3-related patches in DERBY-5332.

        Show
        Bryan Pendleton added a comment - Thank you for the clear explanation. I think this is a good plan. I suggest that you continue working on this project, and on the related ij5 testing work. Meanwhile, I will move ahead with the ij3-related patches in DERBY-5332 .
        Hide
        Houx Zhang added a comment -

        Thanks for your encouragement, I will go on.

        Show
        Houx Zhang added a comment - Thanks for your encouragement, I will go on.
        Hide
        Houx Zhang added a comment -

        In 5342-2.patch, utilMain.goScript() has been changed to support "ij.ShowNoCountForSelect" and "ij.showNoConnectionsAtStart". Besides, ScriptTestCase is changed:

        super(script, outputEnc);
        + BaseTestCase.setSystemProperty("ij.showNoConnectionsAtStart", "true");
        + BaseTestCase.setSystemProperty("ij.showNoCountForSelect", "true");

        inputEncoding = (inputEnc == null) ? DEFAULT_ENCODING : inputEnc;

        two properties are set to true to fit the current state of ScrtipTestCase.

        With the patch, tools._Suite can pass OK, and other classes affected are tested.

        Please check it, thanks!

        Show
        Houx Zhang added a comment - In 5342-2.patch, utilMain.goScript() has been changed to support "ij.ShowNoCountForSelect" and "ij.showNoConnectionsAtStart". Besides, ScriptTestCase is changed: super(script, outputEnc); + BaseTestCase.setSystemProperty("ij.showNoConnectionsAtStart", "true"); + BaseTestCase.setSystemProperty("ij.showNoCountForSelect", "true"); inputEncoding = (inputEnc == null) ? DEFAULT_ENCODING : inputEnc; two properties are set to true to fit the current state of ScrtipTestCase. With the patch, tools._Suite can pass OK, and other classes affected are tested. Please check it, thanks!
        Hide
        Bryan Pendleton added a comment -

        I don't understand what this new line in utilMain.goscript() is intending:

        + ijParser.(connEnv[0], (numConnections > 1));

        Is that possibly a typographical error in patch-2? It looks like it is incomplete, to me.

        When I remove that line, the patch builds cleanly for me, and tools._Suite passes
        for me as well.

        Show
        Bryan Pendleton added a comment - I don't understand what this new line in utilMain.goscript() is intending: + ijParser.(connEnv [0] , (numConnections > 1)); Is that possibly a typographical error in patch-2? It looks like it is incomplete, to me. When I remove that line, the patch builds cleanly for me, and tools._Suite passes for me as well.
        Hide
        Houx Zhang added a comment -

        Hi, Bryan.

        I'm sorry for this typographical error.

        It should be
        + ijParser.setConnection(connEnv[0], (numConnections > 1));
        just like used in utilMain.go().

        Please check the new patch, thanks!

        Show
        Houx Zhang added a comment - Hi, Bryan. I'm sorry for this typographical error. It should be + ijParser.setConnection(connEnv [0] , (numConnections > 1)); just like used in utilMain.go(). Please check the new patch, thanks!
        Hide
        Bryan Pendleton added a comment -

        When I run the complete JUnit test suite with the patch applied, I see three failures.

        I've pasted the information below.

        There were 3 failures:
        1) LocalizedConnectionAttribute(org.apache.derbyTesting.functionTests.tests.i18n.LocalizedAttributeScriptTest)junit.framework.ComparisonFailure: Output at line 1 expected:<ij> --> but was:<CONNECTION0* - jdbc:derby:singleUse/oneuse55>
        at org.apache.derbyTesting.functionTests.util.CanonTestCase.compareCanon(CanonTestCase.java:109)
        at org.apache.derbyTesting.functionTests.util.ScriptTestCase.runTest(ScriptTestCase.java:205)
        at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:112)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)
        at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)
        2) LocalizedDisplay(org.apache.derbyTesting.functionTests.tests.i18n.LocalizedDisplayScriptTest)junit.framework.ComparisonFailure: Output at line 1 expected:<ij> --> but was:<CONNECTION0* - jdbc:derby:singleUse/oneuse56>
        at org.apache.derbyTesting.functionTests.util.CanonTestCase.compareCanon(CanonTestCase.java:109)
        at org.apache.derbyTesting.functionTests.util.ScriptTestCase.runTest(ScriptTestCase.java:205)
        at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:112)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)
        at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)
        3) LocalizedDisplay(org.apache.derbyTesting.functionTests.tests.i18n.LocalizedDisplayScriptTest)junit.framework.ComparisonFailure: Output at line 1 expected:<ij> --> but was:<CONNECTION0* - jdbc:derby://localhost:1527/singleUse/oneuse57;create=true>
        at org.apache.derbyTesting.functionTests.util.CanonTestCase.compareCanon(CanonTestCase.java:109)
        at org.apache.derbyTesting.functionTests.util.ScriptTestCase.runTest(ScriptTestCase.java:205)
        at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:112)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)
        at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)
        at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
        at junit.extensions.TestSetup.run(TestSetup.java:23)

        FAILURES!!!
        Tests run: 14216, Failures: 3, Errors: 0

        Show
        Bryan Pendleton added a comment - When I run the complete JUnit test suite with the patch applied, I see three failures. I've pasted the information below. There were 3 failures: 1) LocalizedConnectionAttribute(org.apache.derbyTesting.functionTests.tests.i18n.LocalizedAttributeScriptTest)junit.framework.ComparisonFailure: Output at line 1 expected:<ij> --> but was:<CONNECTION0* - jdbc:derby:singleUse/oneuse55> at org.apache.derbyTesting.functionTests.util.CanonTestCase.compareCanon(CanonTestCase.java:109) at org.apache.derbyTesting.functionTests.util.ScriptTestCase.runTest(ScriptTestCase.java:205) at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:112) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) 2) LocalizedDisplay(org.apache.derbyTesting.functionTests.tests.i18n.LocalizedDisplayScriptTest)junit.framework.ComparisonFailure: Output at line 1 expected:<ij> --> but was:<CONNECTION0* - jdbc:derby:singleUse/oneuse56> at org.apache.derbyTesting.functionTests.util.CanonTestCase.compareCanon(CanonTestCase.java:109) at org.apache.derbyTesting.functionTests.util.ScriptTestCase.runTest(ScriptTestCase.java:205) at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:112) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) 3) LocalizedDisplay(org.apache.derbyTesting.functionTests.tests.i18n.LocalizedDisplayScriptTest)junit.framework.ComparisonFailure: Output at line 1 expected:<ij> --> but was:<CONNECTION0* - jdbc:derby://localhost:1527/singleUse/oneuse57;create=true> at org.apache.derbyTesting.functionTests.util.CanonTestCase.compareCanon(CanonTestCase.java:109) at org.apache.derbyTesting.functionTests.util.ScriptTestCase.runTest(ScriptTestCase.java:205) at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:112) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) at junit.extensions.TestSetup$1.protect(TestSetup.java:19) at junit.extensions.TestSetup.run(TestSetup.java:23) FAILURES!!! Tests run: 14216, Failures: 3, Errors: 0
        Hide
        Houx Zhang added a comment -

        When tested individually, each of them is OK. It's also OK when tested org.apache.derbyTesting.functionTests.tests.i18n._Suite. I will run the completed test to see the problem.

        Show
        Houx Zhang added a comment - When tested individually, each of them is OK. It's also OK when tested org.apache.derbyTesting.functionTests.tests.i18n._Suite. I will run the completed test to see the problem.
        Hide
        Bryan Pendleton added a comment -

        For me, too, the individual tests run correctly, and I also see no problems when
        just running i18n suite and tools suite.

        It is possible that there is some sort of underlying resource or capacity problem
        on the machine I am using for Derby development; it is a very under-powered computer...

        Please let me know the outcome of your experiment.

        Assuming the tests run properly, I think the patch is good and ready to commit.

        Show
        Bryan Pendleton added a comment - For me, too, the individual tests run correctly, and I also see no problems when just running i18n suite and tools suite. It is possible that there is some sort of underlying resource or capacity problem on the machine I am using for Derby development; it is a very under-powered computer... Please let me know the outcome of your experiment. Assuming the tests run properly, I think the patch is good and ready to commit.
        Hide
        Houx Zhang added a comment -

        Hi, Bryan, I have located the problem, but didn't know how to resolve it.

        In a complete testing, LocalizedAttributeScriptTest and LocalizedDisplayScriptTest failed because of IjConnNameTest. I have added the two tests into tools._Suite.suite() to make the failures reoccur fast.

        As shown in 5342-4-test.patch, after IjConnNameTest ran, LocalizedAttributeScriptTest and LocalizedDisplayScriptTest failed just because util.getSystemProperty("ij.showNoConnectionsAtStart") is false in utilMain.goScript().

        Besides, with the patch below, everything runs well:

        Index: java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java
        ===================================================================
        — java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java (revision 1149133)
        +++ java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java (working copy)
        @@ -106,6 +106,8 @@

        uiProps.put("derby.ui.locale","de_DE");
        uiProps.put("derby.ui.codeset","ISO-8859-1");
        + uiProps.put("ij.showNoConnectionsAtStart", "true");
        + uiProps.put("ij.showNoCountForSelect", "true");
        suite.addTest(new SystemPropertyTestSetup(
        new LocalizedAttributeScriptTest("LocalizedConnectionAttribute"), uiProps));

        Index: java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedDisplayScriptTest.java
        ===================================================================
        — java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedDisplayScriptTest.java (revision 1149133)
        +++ java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedDisplayScriptTest.java (working copy)
        @@ -110,6 +110,8 @@
        Properties uiProps = new Properties();
        uiProps.put("derby.ui.locale","es_AR");
        uiProps.put("derby.ui.codeset","EUC_JP");
        + uiProps.put("ij.showNoConnectionsAtStart", "true");
        + uiProps.put("ij.showNoCountForSelect", "true");
        suite.addTest(new SystemPropertyTestSetup(
        new LocalizedDisplayScriptTest("LocalizedDisplay"), uiProps));
        return getIJConfig(suite);

        However, I think this is not the right way to the problem.

        Now, I'm strange with why the two properties has been changed after IjConnNameTest ran.

        Show
        Houx Zhang added a comment - Hi, Bryan, I have located the problem, but didn't know how to resolve it. In a complete testing, LocalizedAttributeScriptTest and LocalizedDisplayScriptTest failed because of IjConnNameTest. I have added the two tests into tools._Suite.suite() to make the failures reoccur fast. As shown in 5342-4-test.patch, after IjConnNameTest ran, LocalizedAttributeScriptTest and LocalizedDisplayScriptTest failed just because util.getSystemProperty("ij.showNoConnectionsAtStart") is false in utilMain.goScript(). Besides, with the patch below, everything runs well: Index: java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java =================================================================== — java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java (revision 1149133) +++ java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java (working copy) @@ -106,6 +106,8 @@ uiProps.put("derby.ui.locale","de_DE"); uiProps.put("derby.ui.codeset","ISO-8859-1"); + uiProps.put("ij.showNoConnectionsAtStart", "true"); + uiProps.put("ij.showNoCountForSelect", "true"); suite.addTest(new SystemPropertyTestSetup( new LocalizedAttributeScriptTest("LocalizedConnectionAttribute"), uiProps)); Index: java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedDisplayScriptTest.java =================================================================== — java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedDisplayScriptTest.java (revision 1149133) +++ java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedDisplayScriptTest.java (working copy) @@ -110,6 +110,8 @@ Properties uiProps = new Properties(); uiProps.put("derby.ui.locale","es_AR"); uiProps.put("derby.ui.codeset","EUC_JP"); + uiProps.put("ij.showNoConnectionsAtStart", "true"); + uiProps.put("ij.showNoCountForSelect", "true"); suite.addTest(new SystemPropertyTestSetup( new LocalizedDisplayScriptTest("LocalizedDisplay"), uiProps)); return getIJConfig(suite); However, I think this is not the right way to the problem. Now, I'm strange with why the two properties has been changed after IjConnNameTest ran.
        Hide
        Bryan Pendleton added a comment -

        Yes, if I modify tools._Suite.java so that it contains just:
        1) IjConnNameTest
        2) LocalizedAttributeScriptTest
        3) LocalizedDisplayScriptTest

        then the failure reproduces easily for me. Thank you for this suggestion,
        it should make it easier to study this problem.

        Show
        Bryan Pendleton added a comment - Yes, if I modify tools._Suite.java so that it contains just: 1) IjConnNameTest 2) LocalizedAttributeScriptTest 3) LocalizedDisplayScriptTest then the failure reproduces easily for me. Thank you for this suggestion, it should make it easier to study this problem.
        Hide
        Bryan Pendleton added a comment -

        Perhaps the code in ScriptTestCase.java which sets the ij properties should be moved
        from the ScriptTestCase constructor to ScriptTestCase.setUp()?

        I.e., something like:

        Index: java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java
        ===================================================================
        — java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java (revision 1149636)
        +++ java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java (working copy)
        @@ -26,6 +26,7 @@
        import java.util.Locale;

        import org.apache.derby.iapi.tools.i18n.LocalizedResource;
        +import org.apache.derbyTesting.junit.BaseTestCase;
        import org.apache.derbyTesting.junit.Derby;

        import junit.framework.Test;
        @@ -215,6 +216,9 @@
        }
        });

        + BaseTestCase.setSystemProperty("ij.showNoConnectionsAtStart", "true");
        + BaseTestCase.setSystemProperty("ij.showNoCountForSelect", "true");
        +
        // Reset IJ's locale to allow it to pick up the new locale from
        // the environment.
        LocalizedResource.resetLocalizedResourceCache();

        Show
        Bryan Pendleton added a comment - Perhaps the code in ScriptTestCase.java which sets the ij properties should be moved from the ScriptTestCase constructor to ScriptTestCase.setUp()? I.e., something like: Index: java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java =================================================================== — java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java (revision 1149636) +++ java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java (working copy) @@ -26,6 +26,7 @@ import java.util.Locale; import org.apache.derby.iapi.tools.i18n.LocalizedResource; +import org.apache.derbyTesting.junit.BaseTestCase; import org.apache.derbyTesting.junit.Derby; import junit.framework.Test; @@ -215,6 +216,9 @@ } }); + BaseTestCase.setSystemProperty("ij.showNoConnectionsAtStart", "true"); + BaseTestCase.setSystemProperty("ij.showNoCountForSelect", "true"); + // Reset IJ's locale to allow it to pick up the new locale from // the environment. LocalizedResource.resetLocalizedResourceCache();
        Hide
        Bryan Pendleton added a comment -

        The reason why I think moving those calls is appropriate is because the ScriptTestCase constructor
        gets run when the entire test Suite is initially constructed, whereas the setUp() method gets run
        right before each individual test case. Since ScriptTestCase wants those properties to be
        initialized to true for each test case, it is better to do that in setUp() I think.

        However we still need to figure out how individual test cases which extend ScriptTestCase
        can arrange to have their own values for those properties.

        Show
        Bryan Pendleton added a comment - The reason why I think moving those calls is appropriate is because the ScriptTestCase constructor gets run when the entire test Suite is initially constructed, whereas the setUp() method gets run right before each individual test case. Since ScriptTestCase wants those properties to be initialized to true for each test case, it is better to do that in setUp() I think. However we still need to figure out how individual test cases which extend ScriptTestCase can arrange to have their own values for those properties.
        Hide
        Houx Zhang added a comment -

        Yes, Bryan. I agree that it's better to add the properties setting into the constructor of ScriptTestCase. It works well just like in 5342-5.patch. Please check it.

        As to why IjConnNameTest affected other tests, I think it has been resolved in the new patch.

        Show
        Houx Zhang added a comment - Yes, Bryan. I agree that it's better to add the properties setting into the constructor of ScriptTestCase. It works well just like in 5342-5.patch. Please check it. As to why IjConnNameTest affected other tests, I think it has been resolved in the new patch.
        Hide
        Bryan Pendleton added a comment -

        My revised testing was clean. I think this patch is ready to go,
        so I committed it to the trunk as revision 1151691.

        Show
        Bryan Pendleton added a comment - My revised testing was clean. I think this patch is ready to go, so I committed it to the trunk as revision 1151691.
        Hide
        Houx Zhang added a comment -

        Thanks, Bryan.

        Show
        Houx Zhang added a comment - Thanks, Bryan.
        Hide
        Houx Zhang added a comment -

        I'm sorry to reopen this issue, as in my working on ij5.sql, I've found the patch can not work well.

        I will show the failure in the next patch.

        Show
        Houx Zhang added a comment - I'm sorry to reopen this issue, as in my working on ij5.sql, I've found the patch can not work well. I will show the failure in the next patch.
        Hide
        Houx Zhang added a comment -

        In 5342-6-testing.patch, ij3Test sets "ij.showNoConnectionsAtStart" to false,

        props.setProperty("ij.showNoConnectionsAtStart", "false");

        but the test still passes, which is not expected. Furthermore,
        utilMain.goScript() show the property is still true.

        This is because ScriptTestcase.setUp() run after SystemPropertySetUp.setUp(), so the two properties setted in SystemPropertySetUp.setUp() will be covered.

        Now, let's return to 5342-3.patch, and to focus on why LocalizedAttributeScriptTest and LocalizedDisplayScriptTest are affected by ijConNameTest.

        Show
        Houx Zhang added a comment - In 5342-6-testing.patch, ij3Test sets "ij.showNoConnectionsAtStart" to false, props.setProperty("ij.showNoConnectionsAtStart", "false"); but the test still passes, which is not expected. Furthermore, utilMain.goScript() show the property is still true. This is because ScriptTestcase.setUp() run after SystemPropertySetUp.setUp(), so the two properties setted in SystemPropertySetUp.setUp() will be covered. Now, let's return to 5342-3.patch, and to focus on why LocalizedAttributeScriptTest and LocalizedDisplayScriptTest are affected by ijConNameTest.
        Hide
        Houx Zhang added a comment -

        Oh, I have found the key to resolve this problem, and will post the reason and attach a new patch tomorrow.

        Show
        Houx Zhang added a comment - Oh, I have found the key to resolve this problem, and will post the reason and attach a new patch tomorrow.
        Hide
        Bryan Pendleton added a comment -

        Perhaps the code in ScriptTestCase.setUp() should be conditional, something like:

        if( getproperty("ij.showNoConnectionsAtStart") == null)
        setProperty("ij.showNoConnectionsAtStart", true);

        Then the setProperty calls wouldn't run in the ij3Test case.

        Show
        Bryan Pendleton added a comment - Perhaps the code in ScriptTestCase.setUp() should be conditional, something like: if( getproperty("ij.showNoConnectionsAtStart") == null) setProperty("ij.showNoConnectionsAtStart", true); Then the setProperty calls wouldn't run in the ij3Test case.
        Hide
        Houx Zhang added a comment -

        I have posted 5342-7-test.patch to show the problem.

        When run tools._Suite, I've got the log below:
        ---sys.setup------------showNoCountForSelect=true
        ---------script.setup()------showNoCountForSelect=true
        showNoCountForSelect=true
        ---------script.teardown()------showNoCountForSelect=true
        ---sys.teardown------------showNoCountForSelect=true
        ---sys.teardown------------showNoCountForSelect=null
        ---sys.teardown------------showNoCountForSelect=null
        ---sys.teardown------------showNoCountForSelect=null

        ---sys.setup------------showNoCountForSelect=null
        ---------script.setup()------showNoCountForSelect=null
        showNoCountForSelect=false
        ---------script.teardown()------showNoCountForSelect=null
        ---sys.teardown------------showNoCountForSelect=null
        ---sys.teardown------------showNoCountForSelect=null
        ---sys.teardown------------showNoCountForSelect=null
        ---sys.teardown------------showNoCountForSelect=null

        ---sys.setup------------showNoCountForSelect=null
        ---------script.setup()------showNoCountForSelect=null
        showNoCountForSelect=false
        ---------script.teardown()------showNoCountForSelect=null
        ---sys.teardown------------showNoCountForSelect=null
        ---sys.teardown------------showNoCountForSelect=null
        ---sys.teardown------------showNoCountForSelect=null
        ---sys.teardown------------showNoCountForSelect=null

        ---sys.setup------------showNoCountForSelect=null
        ---------script.setup()------showNoCountForSelect=null
        showNoCountForSelect=false
        ---------script.teardown()------showNoCountForSelect=null
        ---sys.teardown------------showNoCountForSelect=null
        ---sys.teardown------------showNoCountForSelect=null
        ---sys.teardown------------showNoCountForSelect=null
        ---sys.teardown------------showNoCountForSelect=null

        We can see that, after run IjConnNameTest, "ij.showNoCountForSelect" is set to null. In fact, it's removed in SystemPropertyTestSetup.tearDown(). This hits a bug in SystemPropertyTestSetup. In SystemPropertyTestSetup.setUp() setProperties() is called, a property won't be added into oldValues if the old value equals the new one, so the property will be removed in tearDown() later.

        With 5342-8.patch, everything is OK, please check it, thanks!

        Show
        Houx Zhang added a comment - I have posted 5342-7-test.patch to show the problem. When run tools._Suite, I've got the log below: --- sys.setup ------------showNoCountForSelect=true --------- script.setup() ------showNoCountForSelect=true showNoCountForSelect=true --------- script.teardown() ------showNoCountForSelect=true --- sys.teardown ------------showNoCountForSelect=true --- sys.teardown ------------showNoCountForSelect=null --- sys.teardown ------------showNoCountForSelect=null --- sys.teardown ------------showNoCountForSelect=null --- sys.setup ------------showNoCountForSelect=null --------- script.setup() ------showNoCountForSelect=null showNoCountForSelect=false --------- script.teardown() ------showNoCountForSelect=null --- sys.teardown ------------showNoCountForSelect=null --- sys.teardown ------------showNoCountForSelect=null --- sys.teardown ------------showNoCountForSelect=null --- sys.teardown ------------showNoCountForSelect=null --- sys.setup ------------showNoCountForSelect=null --------- script.setup() ------showNoCountForSelect=null showNoCountForSelect=false --------- script.teardown() ------showNoCountForSelect=null --- sys.teardown ------------showNoCountForSelect=null --- sys.teardown ------------showNoCountForSelect=null --- sys.teardown ------------showNoCountForSelect=null --- sys.teardown ------------showNoCountForSelect=null --- sys.setup ------------showNoCountForSelect=null --------- script.setup() ------showNoCountForSelect=null showNoCountForSelect=false --------- script.teardown() ------showNoCountForSelect=null --- sys.teardown ------------showNoCountForSelect=null --- sys.teardown ------------showNoCountForSelect=null --- sys.teardown ------------showNoCountForSelect=null --- sys.teardown ------------showNoCountForSelect=null We can see that, after run IjConnNameTest, "ij.showNoCountForSelect" is set to null. In fact, it's removed in SystemPropertyTestSetup.tearDown(). This hits a bug in SystemPropertyTestSetup. In SystemPropertyTestSetup.setUp() setProperties() is called, a property won't be added into oldValues if the old value equals the new one, so the property will be removed in tearDown() later. With 5342-8.patch, everything is OK, please check it, thanks!
        Hide
        Bryan Pendleton added a comment -

        Your analysis makes sense to me. I tried the trick of putting the i18n tests at the end of tools.Suite and
        the tests still passed. And I ran the full test suite successfully.

        So I committed patch 8 to the trunk as revision 1152371.

        Thank you for following up on this to improve the behavior!

        Show
        Bryan Pendleton added a comment - Your analysis makes sense to me. I tried the trick of putting the i18n tests at the end of tools.Suite and the tests still passed. And I ran the full test suite successfully. So I committed patch 8 to the trunk as revision 1152371. Thank you for following up on this to improve the behavior!
        Hide
        Houx Zhang added a comment -

        Thanks for your encourage and for your advices on my working.

        And what do you think about resolve this issue, pleas?

        Show
        Houx Zhang added a comment - Thanks for your encourage and for your advices on my working. And what do you think about resolve this issue, pleas?
        Hide
        Bryan Pendleton added a comment -

        Yes, I think we can resolve this issue; I think you have the right Jira privileges to do that, right?

        Show
        Bryan Pendleton added a comment - Yes, I think we can resolve this issue; I think you have the right Jira privileges to do that, right?
        Hide
        Houx Zhang added a comment -

        Yes, Bryan, I will close it!

        Show
        Houx Zhang added a comment - Yes, Bryan, I will close it!
        Hide
        Kathey Marsden added a comment -

        reopen to change fix version

        Show
        Kathey Marsden added a comment - reopen to change fix version

          People

          • Assignee:
            Houx Zhang
            Reporter:
            Houx Zhang
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development