Derby
  1. Derby
  2. DERBY-5252

make GrantRevokeTest pass in non-English locale

    Details

      Description

      D:\derby\test>java junit.textui.TestRunner org.apache.derbyTesting.functionTests
      .tests.lang.GrantRevokeTest
      .......................F.F..F.F.........
      Time: 10.563
      There were 4 failures:
      1) testGrantOnNonexistantFunction(org.apache.derbyTesting.functionTests.tests.la
      ng.GrantRevokeTest)junit.framework.ComparisonFailure: null expected:<'S1.NOSUCH'
      [is not recognized as a function.]> but was:<'S1.NOSUCH' [未被识别为函数。]>
      at org.apache.derbyTesting.functionTests.tests.lang.GrantRevokeTest.test
      GrantOnNonexistantFunction(GrantRevokeTest.java:627)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:
      112)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      2) testGrantOnNonexistantFunctionForProcedure(org.apache.derbyTesting.functionTe
      sts.tests.lang.GrantRevokeTest)junit.framework.ComparisonFailure: null expected:
      <'S1.P1' [is not recognized as a function.]> but was:<'S1.P1' [未被识别为函数。]
      >
      at org.apache.derbyTesting.functionTests.tests.lang.GrantRevokeTest.test
      GrantOnNonexistantFunctionForProcedure(GrantRevokeTest.java:636)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:
      112)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      3) testGrantOnNonexistantProcedure(org.apache.derbyTesting.functionTests.tests.l
      ang.GrantRevokeTest)junit.framework.ComparisonFailure: null expected:<'S1.NOSUCH
      ' [is not recognized as a procedure.]> but was:<'S1.NOSUCH' [未被识别为过程。]>
      at org.apache.derbyTesting.functionTests.tests.lang.GrantRevokeTest.test
      GrantOnNonexistantProcedure(GrantRevokeTest.java:653)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:
      112)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      4) testGrantOnNonexistantProcedureForFunction(org.apache.derbyTesting.functionTe
      sts.tests.lang.GrantRevokeTest)junit.framework.ComparisonFailure: null expected:
      <'S1.F2' [is not recognized as a procedure.]> but was:<'S1.F2' [未被识别为过程。
      ]>
      at org.apache.derbyTesting.functionTests.tests.lang.GrantRevokeTest.test
      GrantOnNonexistantProcedureForFunction(GrantRevokeTest.java:662)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:
      112)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57
      )
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
      at junit.extensions.TestSetup.run(TestSetup.java:27)

      FAILURES!!!
      Tests run: 36, Failures: 4, Errors: 0

      D:\derby\test>

      1. DERBY-5252-1.patch
        2 kB
        Houx Zhang
      2. DERBY-5252-setlocale-just-testing.patch
        1 kB
        Houx Zhang

        Issue Links

          Activity

          Knut Anders Hatlen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Hide
          Knut Anders Hatlen added a comment -

          [bulk update: close all resolved issues that haven't had any activity the last year]

          Show
          Knut Anders Hatlen added a comment - [bulk update: close all resolved issues that haven't had any activity the last year]
          Gavin made changes -
          Workflow jira [ 12614955 ] Default workflow, editable Closed status [ 12801924 ]
          Kathey Marsden made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Kathey Marsden made changes -
          Labels gsoc11 derby_backport_reject_10_5
          Kathey Marsden made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Myrna van Lunteren made changes -
          Fix Version/s 10.8.2.2 [ 12317968 ]
          Fix Version/s 10.8.2.0 [ 12317955 ]
          Myrna van Lunteren made changes -
          Fix Version/s 10.8.2.0 [ 12317955 ]
          Fix Version/s 10.8.1.6 [ 12316676 ]
          Myrna van Lunteren made changes -
          Status Reopened [ 4 ] Closed [ 6 ]
          Fix Version/s 10.8.1.6 [ 12316676 ]
          Resolution Fixed [ 1 ]
          Myrna van Lunteren made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Hide
          Myrna van Lunteren added a comment -

          Reopen to document backport to 10.8

          Show
          Myrna van Lunteren added a comment - Reopen to document backport to 10.8
          Houx Zhang made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Bryan Pendleton made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Resolved [ 5 ]
          Issue & fix info [Patch Available]
          Fix Version/s 10.9.0.0 [ 12316344 ]
          Hide
          Bryan Pendleton added a comment -

          I think the proposed patch is a clear improvement to the test, as it
          preserves the existing testing while also allowing the test to be
          run in other locales.

          Committed to the trunk as revision 1134139.

          Thank you, Houx, for the contribution!

          Show
          Bryan Pendleton added a comment - I think the proposed patch is a clear improvement to the test, as it preserves the existing testing while also allowing the test to be run in other locales. Committed to the trunk as revision 1134139. Thank you, Houx, for the contribution!
          Hide
          Bryan Pendleton added a comment -

          Hello Houx, did you happen to see Dag's comment on the mailing list?
          http://mail-archives.apache.org/mod_mbox/db-derby-dev/201105.mbox/%3Cx6k4d7yl5j.fsf@oracle.com%3E

          Show
          Bryan Pendleton added a comment - Hello Houx, did you happen to see Dag's comment on the mailing list? http://mail-archives.apache.org/mod_mbox/db-derby-dev/201105.mbox/%3Cx6k4d7yl5j.fsf@oracle.com%3E
          Houx Zhang made changes -
          Issue & fix info [Patch Available]
          Houx Zhang made changes -
          Attachment DERBY-5252-1.patch [ 12481816 ]
          Hide
          Houx Zhang added a comment -

          I also prefer the second method, and added a patch by following this idea. And the test can pass in Chinese Locale now. Please check it, thanks!

          D:\derby\test>java junit.textui.TestRunner org.apache.derbyTesting.functionTests
          .tests.lang.GrantRevokeTest
          ....................................
          Time: 8.094

          OK (36 tests)

          Show
          Houx Zhang added a comment - I also prefer the second method, and added a patch by following this idea. And the test can pass in Chinese Locale now. Please check it, thanks! D:\derby\test>java junit.textui.TestRunner org.apache.derbyTesting.functionTests .tests.lang.GrantRevokeTest .................................... Time: 8.094 OK (36 tests)
          Hide
          Bryan Pendleton added a comment -

          Link to DERBY-3610 because it appears to have added the assertions that are failing in this issue.

          Show
          Bryan Pendleton added a comment - Link to DERBY-3610 because it appears to have added the assertions that are failing in this issue.
          Bryan Pendleton made changes -
          Link This issue is related to DERBY-3610 [ DERBY-3610 ]
          Hide
          Bryan Pendleton added a comment -

          Since there are only 4 calls to getMessage() in this test, perhaps it would be better to
          leave the test running in the default locale (which can be any locale, not just English),
          and change those 4 calls to getMessage().

          We could either
          (a) remove those 4 calls to getMessage entirely, or
          (b) add some code like:

          if ( Locale.getDefault().getLanguage().equals("en") )
          assertEquals("'S1.NOSUCH' is not recognized as a procedure.", e.getMessage());

          Since the test does a assertSQLState() right before each call to getMessage(), I don't
          think that the getMessage() test is the most important part of the test, and maybe
          a solution such as this would be fine?

          However, I see those 4 getMessage() calls were specifically added in revision 765087 (
          http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeTest.java?r1=765086&r2=765087& )
          as part of the fix for DERBY-3610.

          Knut Anders, Dag: do you have any experience running your system in a locale other than English?
          Does the GrantRevokeTest pass for you when run in a non-English locale? What do you think about
          the getMessage() assertions that were added by DERBY-3610? Would it be helpful to guard them
          with some sort of locale-specific check?

          Show
          Bryan Pendleton added a comment - Since there are only 4 calls to getMessage() in this test, perhaps it would be better to leave the test running in the default locale (which can be any locale, not just English), and change those 4 calls to getMessage(). We could either (a) remove those 4 calls to getMessage entirely, or (b) add some code like: if ( Locale.getDefault().getLanguage().equals("en") ) assertEquals("'S1.NOSUCH' is not recognized as a procedure.", e.getMessage()); Since the test does a assertSQLState() right before each call to getMessage(), I don't think that the getMessage() test is the most important part of the test, and maybe a solution such as this would be fine? However, I see those 4 getMessage() calls were specifically added in revision 765087 ( http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GrantRevokeTest.java?r1=765086&r2=765087& ) as part of the fix for DERBY-3610 . Knut Anders, Dag: do you have any experience running your system in a locale other than English? Does the GrantRevokeTest pass for you when run in a non-English locale? What do you think about the getMessage() assertions that were added by DERBY-3610 ? Would it be helpful to guard them with some sort of locale-specific check?
          Houx Zhang made changes -
          Link This issue relates to DERBY-5217 [ DERBY-5217 ]
          Houx Zhang made changes -
          Link This issue is part of DERBY-5155 [ DERBY-5155 ]
          Houx Zhang made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Houx Zhang made changes -
          Field Original Value New Value
          Attachment DERBY-5252-setlocale-just-testing.patch [ 12480776 ]
          Hide
          Houx Zhang added a comment -

          In DERBY-5252-setlocale-just-testing.patch, LocaleTestSetup is used to give a English Locale. However, it still failed as before.

          I also logged in testGrantOnNonexistantProcedureForFunction(), and shows, it do be English locale in this function, but we still get a Chinese output.

          I think this issue is similiar with DERBY-5217.

          Show
          Houx Zhang added a comment - In DERBY-5252 -setlocale-just-testing.patch, LocaleTestSetup is used to give a English Locale. However, it still failed as before. I also logged in testGrantOnNonexistantProcedureForFunction(), and shows, it do be English locale in this function, but we still get a Chinese output. I think this issue is similiar with DERBY-5217 .
          Houx Zhang created issue -

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development