Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make inbound-references an opt-in preference
  • Loading branch information
cbeer committed Oct 28, 2014
1 parent 9b27b81 commit 7d6cb0f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
Expand Up @@ -305,7 +305,6 @@ public String apply(final RDFNode input) {
assertTrue("Expected RDF contexts missing", rdfNodes.containsAll(ImmutableSet.of(
"class org.fcrepo.kernel.impl.rdf.impl.LdpContainerRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.LdpIsMemberOfRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.ReferencesRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.TypeRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.LdpRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.PropertiesRdfContext",
Expand Down Expand Up @@ -338,7 +337,6 @@ public String apply(final RDFNode input) {
assertTrue("Expected RDF contexts missing", rdfNodes.containsAll(ImmutableSet.of(
"class org.fcrepo.kernel.impl.rdf.impl.LdpContainerRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.LdpIsMemberOfRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.ReferencesRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.TypeRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.LdpRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.PropertiesRdfContext",
Expand Down Expand Up @@ -432,10 +430,10 @@ public String apply(final RDFNode input) {
}

@Test
public void testGetWithObjectOmitReferences() throws Exception {
public void testGetWithObjectIncludeReferences() throws Exception {
setResource(FedoraObject.class);
setField(testObj, "prefer",
new Prefer("return=representation; omit=\"" + INBOUND_REFERENCES + "\""));
new Prefer("return=representation; include=\"" + INBOUND_REFERENCES + "\""));
final Response actual = testObj.describe(null);
assertEquals(OK.getStatusCode(), actual.getStatus());

Expand All @@ -449,7 +447,7 @@ public String apply(final RDFNode input) {
}
});

assertFalse("Should not include references contexts",
assertTrue("Should include references contexts",
rdfNodes.contains("class org.fcrepo.kernel.impl.rdf.impl.ReferencesRdfContext"));

}
Expand Down Expand Up @@ -501,7 +499,6 @@ public String apply(final RDFNode input) {
assertTrue("Expected RDF contexts missing", rdfNodes.containsAll(ImmutableSet.of(
"class org.fcrepo.kernel.impl.rdf.impl.LdpContainerRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.LdpIsMemberOfRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.ReferencesRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.TypeRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.LdpRdfContext",
"class org.fcrepo.kernel.impl.rdf.impl.PropertiesRdfContext",
Expand Down
Expand Up @@ -73,8 +73,7 @@ public LdpPreferTag(final PreferTag preferTag) {
containment = (!preferMinimalContainer && !omits.contains(LDP_NAMESPACE + "PreferContainment")) ||
includes.contains(LDP_NAMESPACE + "PreferContainment");

references = includes.contains(INBOUND_REFERENCES.toString())
|| !omits.contains(INBOUND_REFERENCES.toString()) && !minimal;
references = includes.contains(INBOUND_REFERENCES.toString());

embed = includes.contains(EMBED_CONTAINS.toString());

Expand Down
Expand Up @@ -53,7 +53,7 @@ public void testMinimalContainer() throws ParseException {
testObj = new LdpPreferTag(prefer);

assertTrue(testObj.prefersServerManaged());
assertTrue(testObj.prefersReferences());
assertFalse(testObj.prefersReferences());
assertFalse(testObj.prefersContainment());
assertFalse(testObj.prefersMembership());
assertFalse(testObj.prefersEmbed());
Expand Down Expand Up @@ -111,12 +111,12 @@ public void testPreferEmbed() throws ParseException {
}

@Test
public void testPreferOmitReference() throws ParseException {
public void testPreferReference() throws ParseException {
final PreferTag prefer
= new PreferTag("return=representation; omit=\"" + INBOUND_REFERENCES + "\"");
= new PreferTag("return=representation; include=\"" + INBOUND_REFERENCES + "\"");
testObj = new LdpPreferTag(prefer);

assertFalse(testObj.prefersReferences());
assertTrue(testObj.prefersReferences());
}

}

0 comments on commit 7d6cb0f

Please sign in to comment.