db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Houx Zhang (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-5217) make ImportExportIJTest pass in non-English locale
Date Tue, 10 May 2011 13:52:47 GMT

     [ https://issues.apache.org/jira/browse/DERBY-5217?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Houx Zhang updated DERBY-5217:
------------------------------

    Attachment: DERBY-5217-log-LocalizedResource.patch

Hi, Bryan. Thanks for your advice, I have logged on LocalizedResource, and got the  log below.

 ImportExportIJTest.setUp() locale=zh_CN
ScriptTestCase.runTest() locale=toString(){
locale=en
encode=null
messageFile=org.apache.derby.loc.toolsmessages
resourceKey=derby.ui.locale
enableLocalized=false 
dateSize=28
timeSize=18
timestampSize=23
}
ij.runScript()----0--- locale=toString(){
locale=en
encode=null
messageFile=org.apache.derby.loc.toolsmessages
resourceKey=derby.ui.locale
enableLocalized=false 
dateSize=28
timeSize=18
timestampSize=23
}
ij.runScript()----1--- locale=toString(){
locale=en
encode=null
messageFile=org.apache.derby.loc.toolsmessages
resourceKey=derby.ui.locale
enableLocalized=false 
dateSize=28
timeSize=18
timestampSize=23
}
ij.runScript()----2--- locale=toString(){
locale=en
encode=null
messageFile=org.apache.derby.loc.toolsmessages
resourceKey=derby.ui.locale
enableLocalized=false 
dateSize=28
timeSize=18
timestampSize=23
}
ij.runScript()----3--- locale=toString(){
locale=en
encode=null
messageFile=org.apache.derby.loc.toolsmessages
resourceKey=derby.ui.locale
enableLocalized=false 
dateSize=28
timeSize=18
timestampSize=23
}
utilMain.goScript()   locale=toString(){
locale=en
encode=null
messageFile=org.apache.derby.loc.toolsmessages
resourceKey=derby.ui.locale
enableLocalized=false 
dateSize=28
timeSize=18
timestampSize=23
}
utilMain.runScriptGuts()   locale=toString(){
locale=en
encode=null
messageFile=org.apache.derby.loc.toolsmessages
resourceKey=derby.ui.locale
enableLocalized=false 
dateSize=28
timeSize=18
timestampSize=23
}
ImportExportIJTest.tearDown() locale=en

We can see, the original locale is zh_CN, but in the ScriptTestCase.runTest(), the locale
has changed into en, 

and all the work in ij was in en Locale. 

Besise, from the setUp() and tearDown() in ScriptTestCase, the en Locale has been set, that's
why all work in 

ScriptTestCase.runTest() is English locale.

 /**
     * Set up the new locale for the test
     */
    protected void setUp() {
        oldLocale = Locale.getDefault();

        AccessController.doPrivileged(new java.security.PrivilegedAction() {
            public Object run() {
                Locale.setDefault(Locale.ENGLISH);
                return null;
            }
        });
    }

    /**
     * Revert the locale back to the old one
     */
    protected void tearDown() throws Exception {
        super.tearDown();

        AccessController.doPrivileged(new java.security.PrivilegedAction() {
            public Object run() {
                Locale.setDefault(oldLocale);
                return null;
            }
        });
    }

Considering my first comment on this issue, I think there is some thing wrong in the derbyLocale_zh_CN.jar.

Besides, another interesting is when run ij based on the distribution of db-derby-10.7.1.1-bin,
I got the 

error message on "drop table T1" is "错误 42Y55:“DROP TABLE”无法在“T1”上执行,因为它不存在。",
which is 

the exact Chinese error meesage according to "'DROP TABLE' cannot be performed on 'T1' because
it does not 

exist."

ij> drop table T1;
错误 42Y55:“DROP TABLE”无法在“T1”上执行,因为它不存在。




> make ImportExportIJTest pass in non-English locale
> --------------------------------------------------
>
>                 Key: DERBY-5217
>                 URL: https://issues.apache.org/jira/browse/DERBY-5217
>             Project: Derby
>          Issue Type: Sub-task
>          Components: Test
>            Reporter: Houx Zhang
>            Assignee: Houx Zhang
>              Labels: gsoc2011
>         Attachments: DERBY-5217-LocaleTestSetup.patch, DERBY-5217-SystemPropertyTestSetup.patch,
DERBY-5217-log-LocalizedResource.patch, DERBY-5217-log-locale.patch
>
>
> ImportExportIJTest fails in Chinese locale, just like below:
> D:\derby\test>java junit.textui.TestRunner org.apache.derbyTesting.functionTests
> .tests.tools.ImportExportIJTest
> .F
> Time: 7.937
> There was 1 failure:
> 1) importExportIJ(org.apache.derbyTesting.functionTests.tests.tools.ImportExport
> IJTest)junit.framework.ComparisonFailure: Output at line 22 expected:<ERROR 42Y5
> 5: ['DROP TABLE' cannot be performed on 'T1' because it does not exist.]> but wa
> s:<ERROR 42Y55: [?DROP TABLE?????T1????????????]>
>         at org.apache.derbyTesting.functionTests.util.CanonTestCase.compareCanon
> (CanonTestCase.java:109)
>         at org.apache.derbyTesting.functionTests.util.ScriptTestCase.runTest(Scr
> iptTestCase.java:201)
>         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)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message