Not sure if this is covered in a test elsewhere, but we could check
that the getLocalName() returns a non-null, non-empty string? After
all, both localhost and 127.0.0.1 should return valid lookups.

The other possibiltiy is to fork an 'nslookup' or 'host' command
(depending on platform) to find out what the platform thinks is the
local host name, and then comparing it to Java's result.

Alex.


On 25/10/06, Fedotov, Alexei A <[EMAIL PROTECTED]> wrote:
Denis wrote,
>It's possible but it will be another test
Agreed

>+1 exclude this test (not whole test but localhost check)
+1

With best regards,
Alexei Fedotov,
Intel Java & XML Engineering

>-----Original Message-----
>From: Denis Kishenko [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, October 24, 2006 3:31 PM
>To: [email protected]
>Subject: Re: [classlib][test] Configuration dependent test of
>InetAddress.getHostName
>
>2006/10/24, Fedotov, Alexei A <[EMAIL PROTECTED]>:
>> I wonder about the first option. Is there any way to check that
symbolic
>> name corresponds to the local computer? I can imagine the following
>> condition to check this.
>>
>>
InetAddress.getByName(InetAddress.getByName("127.0.0.1").getHostName()).
>> isLoopbackAddress()
>This test failed because isLoopbackAddress() expected 127.X.X.X
>
>2006/10/24, Fedotov, Alexei A <[EMAIL PROTECTED]>:
>> Andrew,
>>
>> I agree that test should be fixed. I suggested using one of the
>> following checks to validate that the host is localhost.
>>
>> InetAddress.getByName(host).isLoopbackAddress()
>> InetAddress.getByName(host).isSiteLocalAddress()
>It's possible but it will be another test
>
>IMHO
>+1 exclude this test (not whole test but localhost check)

Reply via email to