[ 
https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565883#action_12565883
 ] 

Dan Diephouse commented on ABDERA-101:
--------------------------------------

There is a possibility here that we aren't interpreting the target path 
correctly. What happens if you initialize your provider with a constructor 
argument of ("/imdb") ?

> Issue with collection resolved href?
> ------------------------------------
>
>                 Key: ABDERA-101
>                 URL: https://issues.apache.org/jira/browse/ABDERA-101
>             Project: Abdera
>          Issue Type: Bug
>    Affects Versions: 0.3.0
>            Reporter: Remy Gendron
>
> Hi all,
> Am I missing something here? I'm setting up an example project for the 
> development team....
> I initialize my provider with a base of "/", which is the default value 
> anyway.
> My adapters are given a relative href (setHref()) when initialized in the 
> provider. (eg "actors")
> I start Jetty in my unit tests with an application context of "/imdb".
> The following unit test fails because when I retrieve the HREF property for 
> the actors collection it is now an absolute path ("/actors").
> When IRI.resolve(IRI b, IRI c) is called, c is absolute. My collection thus 
> returns an href of http://localhost:9002/actors instead of 
> http://localhost:9002/imdb/actors. 
> Here's the thread stack:
> Thread [main] (Suspended)     
>       IRI.resolve(IRI, IRI) line: 442 
>       IRI.resolve(IRI) line: 555      
>       FOMCollection(FOMElement)._resolve(IRI, IRI) line: 337  
>       FOMCollection.getResolvedHref() line: 138       
>       ImdbRestTest.testGetService() line: 43  
> And the unit test:
> public class ImdbRestTest extends AbstractRestTest {
>     @Test
>     public void testGetService() throws IOException {
>         ClientResponse resp = client.get(getTestBaseURI());
>         assertNotNull(resp);
>         try {
>             assertEquals(200, resp.getStatus());
>             assertEquals(ResponseType.SUCCESS, resp.getType());
>             
> assertTrue(MimeTypeHelper.isMatch(resp.getContentType().toString(), 
> Constants.APP_MEDIA_TYPE));
>             Document<Service> doc = resp.getDocument();
>             try {
>                 // prettyPrint(doc);
>             } catch (Exception e) {
>             }
>             Service service = doc.getRoot();
>             // prettyPrint(service);
>             assertEquals(1, service.getWorkspaces().size());
>             Workspace workspace = service.getWorkspaces().get(0);
>             assertEquals(3, workspace.getCollections().size());
>             for (Collection collection : workspace.getCollections()) {
>                 if 
> (collection.getTitle().startsWith(ImdbConstants.ACTORS_FEED)) {
>                     assertEquals(getTestBaseURI() + "/" + 
> ImdbConstants.ACTORS_FEED, collection.getResolvedHref().toString());
>                 }
>             }
>         } finally {
>             resp.release();
>         }
>     }
> }
> Rémy

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to