Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ensure "Export As..." dropdown label still works, and add test.
  • Loading branch information
Andrew Woods committed Feb 5, 2014
1 parent 7b9fa9e commit e55a6c5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Expand Up @@ -144,6 +144,19 @@ public String getObjectTitle(final DatasetGraph dataset,
}

if (subject.isURI()) {
// FIXME: The following hack should be removed/resolved with:
// https://www.pivotaltracker.com/story/show/65221404
//
// For /fcr:export endpoints, there should be a way to look up the serialization format and find the
// appropriate label to return here.
// This method is used (among other places?) in "fcrepo-http-api/common-node-actions.vsl#95"
final String uri = subject.getURI();
final String target = "fcr:export?format=";
if (uri.contains(target)) {
// Return the value of the query param "format".
return uri.substring(uri.indexOf(target) + target.length());
}

return subject.getURI();
} else if (subject.isBlank()) {
return subject.getBlankNodeLabel();
Expand Down
Expand Up @@ -170,6 +170,15 @@ public void shouldJustUseTheStringIfItIsALiteral() {
assertEquals("\"xyz\"", testObj.getObjectTitle(mem, lit));
}

@Test
public void shouldGetSerializationFormat() {
final Node subject = createURI("subject/fcr:export?format=jcr/xml");
final DatasetGraph mem = createMem();

mem.add(createAnon(), subject, createLiteral("predicate"),createLiteral("abc"));
assertEquals("jcr/xml", testObj.getObjectTitle(mem, subject));
}

@Test
public void shouldConvertRdfObjectsToStrings() {

Expand Down

0 comments on commit e55a6c5

Please sign in to comment.