abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remy Gendron (JIRA)" <j...@apache.org>
Subject [jira] Commented: (ABDERA-101) Issue with collection resolved href?
Date Tue, 05 Feb 2008 20:29:08 GMT

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

Remy Gendron commented on ABDERA-101:
-------------------------------------

Here is my Jetty initialization:

    @BeforeClass
    public static void setUp() throws Exception {
        try {
            server = new Server(DEFAULT_PORT);
            Context context = new Context(server, "/" + ImdbConstants.DEFAULT_APPLICATION_CONTEXT,
Context.SESSIONS);
            ServletHolder servletHolder = new ServletHolder(new ImdbServlet());
            servletHolder.setInitParameter(ServiceManager.PROVIDER, ImdbProvider.class.getName());
            context.addServlet(servletHolder, "/*");
            server.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


> 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.


Mime
View raw message