Skip to content

Commit

Permalink
make sure creating objects with fcr:new creates the object at the rig…
Browse files Browse the repository at this point in the history
…ht path level.
  • Loading branch information
cbeer committed May 8, 2013
1 parent d14cb8a commit 87ab40a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Expand Up @@ -58,9 +58,11 @@ public MultivaluedMap<String, String> getMatrixParameters() {
}

};
ImmutableList.Builder<PathSegment> segments = ImmutableList.builder();
segments.addAll(pathList.subList(0, pathList.size() - 1));

ImmutableList.Builder<PathSegment> segments = ImmutableList.builder();
segments.addAll(pathList);
segments.add(path);

try {
return objectsResource.createObject(
segments.build(), "test label",
Expand Down
Expand Up @@ -41,6 +41,9 @@ public void testIngestWithNew() throws Exception {
assertTrue("Response wasn't a PID", compile("[a-z]+").matcher(content)
.find());
assertTrue("new object did not mint a PID", !content.endsWith("/fcr:new"));

assertEquals("Object wasn't created!", 200,
getStatus(new HttpGet(serverAddress + content)));
}

@Test
Expand Down
Expand Up @@ -149,8 +149,12 @@ public void setHttpServletRequest(final HttpServletRequest servletRequest) {
public static final String toPath(List<PathSegment> paths) {
StringBuffer result = new StringBuffer();
for (PathSegment path: paths) {
result.append('/');
result.append(path.getPath());
final String p = path.getPath();

if(!p.equals("")) {
result.append('/');
result.append(p);
}
}
return result.toString();
}
Expand Down

0 comments on commit 87ab40a

Please sign in to comment.