[ 
https://issues.apache.org/jira/browse/UIMA-2051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12997802#comment-12997802
 ] 

Marshall Schor commented on UIMA-2051:
--------------------------------------

The test :

1) sets up an Import_impl, with a path
2) asks the UIMA framework to resolve this into an "absolute" path, using a 
default resource manager,
which in turn picks up the working directory as the base dir to use for 
resolution,
3) then compares it to a computed "canonical" path

I think the issue arises because the /home in the "absolute" path is converted 
to /zonestorage/hudson/home in the canonical path.  The Javadocs for canonical 
path say:

This method first converts this pathname to absolute form if necessary, as if 
by invoking the getAbsolutePath() method, and then maps it to its unique form 
in a system-dependent way. This typically involves removing redundant names 
such as "." and ".." from the pathname, resolving symbolic links (on UNIX 
platforms), and converting drive letters to a standard case (on Microsoft 
Windows platforms).

I'm guessing the resolving symbolic links is what's happening here.

A simple fix is to change the test computation of the expected value from  
{noformat}
URL expectedUrl = new File(System.getProperty("user.dir"), 
"foo/bar/MyFile.xml").getCanonicalFile().toURL();
{noformat}
to
{noformat}
URL expectedUrl = new File(System.getProperty("user.dir"), 
"foo/bar/MyFile.xml").getAbsoluteFile().toURL();
{noformat}

I'll do this, and also check the rest of the tests in this file for more 
instances of this kind of thing.


> Import_implTest.testFindAbsoluteUrl fails on Hudson
> ---------------------------------------------------
>
>                 Key: UIMA-2051
>                 URL: https://issues.apache.org/jira/browse/UIMA-2051
>             Project: UIMA
>          Issue Type: Bug
>          Components: Build, Packaging and Test
>            Reporter: Jörn Kottmann
>            Priority: Minor
>
> This test fails on hudson and should be fixed.
> The following error messages is printed out:
> Error Message
> expected:<file:/zonestorage/hudson/home/hudson/hudson-slave/workspace/UIMA-SDK/trunk/uimaj-core/foo/bar/MyFile.xml>
>  but 
> was:<file:/home/hudson/hudson-slave/workspace/UIMA-SDK/trunk/uimaj-core/foo/bar/MyFile.xml>
> Stacktrace:
> junit.framework.AssertionFailedError: 
> expected:<file:/zonestorage/hudson/home/hudson/hudson-slave/workspace/UIMA-SDK/trunk/uimaj-core/foo/bar/MyFile.xml>
>  but 
> was:<file:/home/hudson/hudson-slave/workspace/UIMA-SDK/trunk/uimaj-core/foo/bar/MyFile.xml>
>       at junit.framework.Assert.fail(Assert.java:47)
>       at junit.framework.Assert.failNotEquals(Assert.java:282)
>       at junit.framework.Assert.assertEquals(Assert.java:64)
>       at junit.framework.Assert.assertEquals(Assert.java:71)
>       at 
> org.apache.uima.resource.metadata.impl.Import_implTest.testFindAbsoluteUrl(Import_implTest.java:124)

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


Reply via email to