db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tiago Espinha <ti...@espinhas.net>
Subject Re: Issue with JUnit - 0 tests?
Date Sat, 06 Jun 2009 07:03:41 GMT
Hello Knut,

Well, I do think this test should be ran regardless of the locale since it's
a generic test that configures ports for the client/server through different
methods (derby.properties and -p switch) and then tries to ping the server.
Hardly something bound to a specific locale.

However, this probably must be done with caution and I think I know why this
locale check is in place. Basically some asserts have hardcoded strings to
check for a failed ping. Like:

assertFailedPing(pingCmd1, "Could not connect to Derby Network Server");

Although, you said that we could set the default locale to US and then
switch it back at the end of the test. That probably will also fix this
caveat.

Do you think I should include this in my derby.tests.port patch for
DERBY-4217 or should I create an issue for it?

Tiago Espinha

On Sat, Jun 6, 2009 at 7:52 AM, Knut Anders Hatlen <Knut.Hatlen@sun.com>wrote:

> Tiago Espinha <tiago@espinhas.net> writes:
>
> > Thanks to Kathey, we were able to find out the problem and the
> > solution for the issue. It turns out that the test has the following
> > check on the suite() method:
> >
> > if (!Derby.hasServer() ||
> > !Locale.getDefault().getLanguage().equals("en") ||
> > JDBC.vmSupportsJSR169())
> >
> > Since the locale on my machine is probably set to Portuguese, it
> > wouldn't run the test at all. The solution was to override the locale
> > with the following properties:
> >
> > -Duser.language=2-char-language-code -Duser.region=2-char-country-code
> >
> > Set it to any anglophone country, with the respective 'en' language
> > code and it all starts working.
>
> Hi Tiago,
>
> Do you think it would make sense for this test to call
> Locale.setDefault(Locale.US) in setUp() and reset the locale in
> tearDown()?  Something similar is done in SysinfoLocaleTest. If we do
> so, we should probably factor it out in a separate decorator class to
> make it easier to use in other tests later.
>
> --
> Knut Anders
>

Mime
View raw message