Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding hasExternalContent/isExternalContentOf properties and IT for l…
…inking from repo object to federated filesystem datastream
  • Loading branch information
escowles committed May 27, 2014
1 parent 9afee37 commit e4c52c5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
Expand Up @@ -1375,6 +1375,32 @@ public void testCopyFromProjection() throws IOException {
assertEquals(OK.getStatusCode(), originalResult.getStatusLine().getStatusCode());
}

/**
* I should be able to link to content on a federated filesystem.
**/
@Test
public void testFederatedDatastream() throws IOException {
// create object in federated filesystem
final String fedObj = getRandomUniquePid();
final HttpPost post = postDSMethod("files/" + fedObj, "ds1", "abc123");
final HttpResponse response = client.execute(post);
assertEquals(CREATED.getStatusCode(), response.getStatusLine().getStatusCode());

// create an object in the repository
final String repoObj = getRandomUniquePid();
final HttpPut put = new HttpPut(serverAddress + repoObj);
assertEquals(201, getStatus(put));

// link from the object to the content of the file on the federated filesystem
final String sparql = "insert data { <> <http://fedora.info/definitions/v4/rels-ext#hasExternalContent> "
+ "<" + serverAddress + "files/" + fedObj + "/ds1/fcr:content> . }";
final HttpPatch patch = new HttpPatch(serverAddress + repoObj);
patch.addHeader("Content-Type", "application/sparql-update");
final BasicHttpEntity e = new BasicHttpEntity();
e.setContent(new ByteArrayInputStream(sparql.getBytes()));
assertEquals("Couldn't link to external datastream!", 204, getStatus(patch));
}

@Test
public void testPaging() throws Exception {
// create a node with 4 children
Expand Down
5 changes: 4 additions & 1 deletion fcrepo-kernel/src/main/resources/fedora-node-types.cnd
Expand Up @@ -65,6 +65,9 @@
- fedorarelsext:isAnnotationOf (REFERENCE) multiple COPY
- fedorarelsext:HasAnnotation (REFERENCE) multiple COPY
- fedorarelsext:hasEquivalent (REFERENCE) multiple COPY
- fedorarelsext:hasExternalContent (URI) multiple COPY
- fedorarelsext:isExternalContentOf (URI) multiple COPY


/*
* Dublin Core terms
Expand Down Expand Up @@ -114,4 +117,4 @@
- premis:hasSize (LONG) COPY
- fedora:digest (URI) COPY

[fedora:blanknode] > mix:referenceable mixin
[fedora:blanknode] > mix:referenceable mixin

0 comments on commit e4c52c5

Please sign in to comment.