db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dag.wan...@oracle.com (Dag H. Wanvik)
Subject Re: [jira] [Commented] (DERBY-5252) make GrantRevokeTest pass in non-English locale
Date Mon, 30 May 2011 20:43:20 GMT

Hi,

"Bryan Pendleton (JIRA)" <jira@apache.org> writes:

> (a) remove those 4 calls to getMessage entirely, or

The believe the intent here was to check that the message text was more
specific as to "function" or "procedure", so I think it would be nice to
keep the asserts, cf. the three forms: "42Y03.S.0", "42Y03.S.1" and
"42Y03.S.2".

Only performing those asserts when running with US English default
locale is acceptable, I think. I'd certainly prefer that over dropping
the asserts.

Even better, the test could check if the locale language is one of those
for which we have bundles and load/use the correct locale bundle for the
test (using java.util.ResourceBundle), maybe MessageBundleTest.java has
some useful pattern. The the test would need to fill in the parameter
(routine name) before comparing, though, so it may not be worth the
trouble..

Since Derby doesn't contain a Norwegian language bundle, I use
"en_US.UTF-8" locale myself - most of the time.

Thanks,
Dag

> (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?
>
>
>
>> make GrantRevokeTest pass in non-English locale
>> -----------------------------------------------
>>
>>                 Key: DERBY-5252
>>                 URL: https://issues.apache.org/jira/browse/DERBY-5252
>>             Project: Derby
>>          Issue Type: Bug
>>          Components: Test
>>         Environment: Chinese Locale,Dos
>>            Reporter: Houx Zhang
>>            Assignee: Houx Zhang
>>              Labels: gsoc11
>>         Attachments: DERBY-5252-setlocale-just-testing.patch
>>
>>
>> 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>
>
> --
> This message is automatically generated by JIRA.
> For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message