From ba0eeee5840a77898ab3d50e0440c2b98a441aee Mon Sep 17 00:00:00 2001 From: Andrew Woods Date: Fri, 19 Sep 2014 14:01:02 -0400 Subject: [PATCH] Updates based on fcrepo modifications Related to: https://www.pivotaltracker.com/story/show/78960386 --- .../org/fcrepo/auth/xacml/TripleAttributeFinderModule.java | 3 ++- .../fcrepo/auth/xacml/TripleAttributeFinderModuleTest.java | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/fcrepo/auth/xacml/TripleAttributeFinderModule.java b/src/main/java/org/fcrepo/auth/xacml/TripleAttributeFinderModule.java index 709ebf1..79cd721 100644 --- a/src/main/java/org/fcrepo/auth/xacml/TripleAttributeFinderModule.java +++ b/src/main/java/org/fcrepo/auth/xacml/TripleAttributeFinderModule.java @@ -34,6 +34,7 @@ import org.fcrepo.http.commons.session.SessionFactory; import org.fcrepo.kernel.FedoraResource; import org.fcrepo.kernel.exception.RepositoryRuntimeException; +import org.fcrepo.kernel.impl.rdf.impl.PropertiesRdfContext; import org.fcrepo.kernel.rdf.IdentifierTranslator; import org.fcrepo.kernel.impl.rdf.impl.DefaultIdentifierTranslator; import org.fcrepo.kernel.services.NodeService; @@ -185,7 +186,7 @@ public final EvaluationResult findAttribute(final URI attributeType, // Get the properties of the resource Model properties; try { - properties = resource.getTriples(idTranslator).asModel(); + properties = resource.getTriples(idTranslator, PropertiesRdfContext.class).asModel(); } catch (final RepositoryRuntimeException e) { LOGGER.debug("Cannot retrieve any properties for [{}]: {}", resourceId, e); diff --git a/src/test/java/org/fcrepo/auth/xacml/TripleAttributeFinderModuleTest.java b/src/test/java/org/fcrepo/auth/xacml/TripleAttributeFinderModuleTest.java index 2ceec58..b3e7328 100644 --- a/src/test/java/org/fcrepo/auth/xacml/TripleAttributeFinderModuleTest.java +++ b/src/test/java/org/fcrepo/auth/xacml/TripleAttributeFinderModuleTest.java @@ -23,6 +23,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; @@ -36,6 +37,7 @@ import org.fcrepo.http.commons.session.SessionFactory; import org.fcrepo.kernel.FedoraResource; import org.fcrepo.kernel.exception.RepositoryRuntimeException; +import org.fcrepo.kernel.impl.rdf.impl.PropertiesRdfContext; import org.fcrepo.kernel.rdf.IdentifierTranslator; import org.fcrepo.kernel.services.NodeService; import org.fcrepo.kernel.utils.iterators.RdfStream; @@ -163,7 +165,8 @@ public void testFindAttribute() throws RepositoryException { final String resourceId = "/{ns}path/{ns}to/{ns}resource"; when(mockNodeService.getObject(mockSession, resourceId)).thenReturn(mockFedoraResource); - when(mockFedoraResource.getTriples(any(IdentifierTranslator.class))).thenReturn(mockRdfStream); + when(mockFedoraResource.getTriples(any(IdentifierTranslator.class), eq(PropertiesRdfContext.class))).thenReturn( + mockRdfStream); when(mockIdentifierTranslator.getSubject(any(String.class))).thenReturn(mockResource); when(mockFedoraResource.getPath()).thenReturn(resourceId); when(mockRdfStream.asModel()).thenReturn(mockModel); @@ -297,7 +300,7 @@ public void testFindAttributeBadProperties() throws RepositoryException { final String[] actions = { "read" }; when(mockNodeService.getObject(mockSession, resourceId)).thenReturn(mockFedoraResource); - when(mockFedoraResource.getTriples(any(IdentifierTranslator.class))).thenThrow( + when(mockFedoraResource.getTriples(any(IdentifierTranslator.class), eq(PropertiesRdfContext.class))).thenThrow( new RepositoryRuntimeException("expected")); final EvaluationResult result = doFindAttribute(resourceId, actions);