You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by "Remy Gendron (JIRA)" <ji...@apache.org> on 2008/02/05 21:13:09 UTC
[jira] Created: (ABDERA-101) Issue with collection resolved href?
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.
[jira] Commented: (ABDERA-101) Issue with collection resolved href?
Posted by "Remy Gendron (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565888#action_12565888 ]
Remy Gendron commented on ABDERA-101:
-------------------------------------
More info...
request.getBaseUri() now returns an / terminated URI, whereas the codebase from a few days ago did not.
Thus, CollectionAdapter.getId(RequestContext request) now returns an invalid path as I was using the following to buid the return value:
return request.getBaseUri() + "/" + ImdbConstants.ACTORS_FEED; // The constant value is "actors".
Dan, I will now try out your suggestion...
> 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.
[jira] Commented: (ABDERA-101) Issue with collection resolved href?
Posted by "James M Snell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566258#action_12566258 ]
James M Snell commented on ABDERA-101:
--------------------------------------
Well, IRI is acting correctly. The problem is the DefaultProvider. If you look at the generated service document, it is not properly taking the context path into account when generating the collection URIs. The CustomProvider example, by contrast, has no problem with this. I'll be taking a look and fixing this shortly
> 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.
[jira] Closed: (ABDERA-101) Issue with collection resolved href?
Posted by "Dan Diephouse (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dan Diephouse closed ABDERA-101.
--------------------------------
Resolution: Fixed
OK, all tests are green now! Thanks!
> 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
> Fix For: 0.4.0
>
> Attachments: CustomerAdapterTest-ABDERA-101.patch
>
>
> 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.
[jira] Commented: (ABDERA-101) Issue with collection resolved href?
Posted by "Remy Gendron (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566173#action_12566173 ]
Remy Gendron commented on ABDERA-101:
-------------------------------------
Following Dan's suggestion, I changed my servlet/abdera configuration to:
servlet context: /imdb
provider base: /feed/
adapter: actor
Things work somewhat better now. The service document now correctly lists the collection path as /feed/actors.
BUT... collection.getResolvedHref() now returns an invalid URI, where the servlet context (/imdb) part is missing (http://localhost:9002/feed/actors).
collection.getResolvedBaseUri() returns the correct value (http://localhost:9002/imdb/feed/).
collection.getHref() returns the correct value (/feed/actors).
However, collection._resolve() , which calls IRI.resolve(), does not provide the correct result:
* There is a strange, probably conflicting usage of both IRI.isAbsolute() and IRI.isPathAbsolute(). This prevents IRI.resolve(String, String) from being called.
* Even if IRI.resolve(String, String) was called, the logic assumes that the collection base path does not end with a "/".
I am stuck. I cannot specify a base path ending with a "/", and at the same time I cannot set the collection href (in the provider) to start with a "/" as the resolving process would assume it is an absolute path and discard the base path.
Thanks for looking into this.
> 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.
[jira] Commented: (ABDERA-101) Issue with collection resolved href?
Posted by "Remy Gendron (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Commented: (ABDERA-101) Issue with collection resolved href?
Posted by "Jim Ancona (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566176#action_12566176 ]
Jim Ancona commented on ABDERA-101:
-----------------------------------
This now starts to sound more like my bug: https://issues.apache.org/jira/browse/ABDERA-103. You might want to see if the patch there fixes this problem as well.
> 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.
[jira] Commented: (ABDERA-101) Issue with collection resolved href?
Posted by "Remy Gendron (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566707#action_12566707 ]
Remy Gendron commented on ABDERA-101:
-------------------------------------
Sorry, still not working when the servlet context is not root. But it works for a base other than root.
I am providing a patch for the CustomerAdapterTest which tests for the issue.
> 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
> Fix For: 0.4.0
>
> Attachments: CustomerAdapterTest-ABDERA-101.patch
>
>
> 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.
[jira] Updated: (ABDERA-101) Issue with collection resolved href?
Posted by "Remy Gendron (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Remy Gendron updated ABDERA-101:
--------------------------------
Attachment: CustomerAdapterTest-ABDERA-101.patch
Shows issue with non-root context path.
> 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
> Fix For: 0.4.0
>
> Attachments: CustomerAdapterTest-ABDERA-101.patch
>
>
> 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.
[jira] Commented: (ABDERA-101) Issue with collection resolved href?
Posted by "Remy Gendron (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566249#action_12566249 ]
Remy Gendron commented on ABDERA-101:
-------------------------------------
The patch did not solve the issue. The servlet context is still removed. The simplest way to reproduce is to modify the CustomerAdapterTest to deploy in Jetty with a servlet context other than root (/). For instance, my demo project uses /imdb.
My tests run fine when I deploy in the root context.
Again, I use:
app ctx: /imdb
provider base: /:feed/
adapter href: actors
The service document correctly report the collection's href to be /imdb/actors. However, calling collection.getResolvedHref() returns http://localhost:9002/feed/actors (imdb ctx missing).
I believe the issue is at IRI.resolve(IRI, IRI) [line 458]. Shouldn't isAbsolute() be called instead of isPathAbsolute()? The latter has it that c is returned normalized instead of resolving the adapter path (c) against the provider base (b).
If base is the root context, we are lucky. However, deploying in a specific context breaks the IRI resolution.
> 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.
[jira] Closed: (ABDERA-101) Issue with collection resolved href?
Posted by "Dan Diephouse (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dan Diephouse closed ABDERA-101.
--------------------------------
Resolution: Fixed
Fix Version/s: 0.4.0
I've fixed this in trunk I believe. If you could confirm that'd be great!!
> 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
> Fix For: 0.4.0
>
>
> 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.
[jira] Reopened: (ABDERA-101) Issue with collection resolved href?
Posted by "Dan Diephouse (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dan Diephouse reopened ABDERA-101:
----------------------------------
OK, thanks Remy! Will look at this later today.
> 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
> Fix For: 0.4.0
>
> Attachments: CustomerAdapterTest-ABDERA-101.patch
>
>
> 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.
[jira] Commented: (ABDERA-101) Issue with collection resolved href?
Posted by "James M Snell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566209#action_12566209 ]
James M Snell commented on ABDERA-101:
--------------------------------------
I'm not certain, but the change I just checked it might solve this. Please update and run your tests again. If the problem is not solved, can you please post a test case that I can use to resolve the issue.
> 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.
[jira] Commented: (ABDERA-101) Issue with collection resolved href?
Posted by "Dan Diephouse (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566269#action_12566269 ]
Dan Diephouse commented on ABDERA-101:
--------------------------------------
I'm going to try to fix this tonight. Remy is right on in that we need to modify the customeradaptertest so it uses a different context path in some of the tests. I'll do that and get things sorted.
> 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.
[jira] Commented: (ABDERA-101) Issue with collection resolved href?
Posted by "Dan Diephouse (JIRA)" <ji...@apache.org>.
[ 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.