Skip to content
Permalink
Browse files

Make inbound-references an opt-in preference

  • Loading branch information...
cbeer committed Oct 28, 2014
1 parent 9b27b81 commit 7d6cb0fec2c00de41e1d9c0d1f8325c3c434b0f8
@@ -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",
@@ -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",
@@ -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());

@@ -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"));

}
@@ -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",
@@ -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());

@@ -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());
@@ -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.
You can’t perform that action at this time.