Skip to content

Commit

Permalink
Use the translated RDF namespace URIs when adding a namespace's prefe…
Browse files Browse the repository at this point in the history
…rred URI triples
  • Loading branch information
cbeer committed Dec 10, 2013
1 parent b3952fd commit fbdf974
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Expand Up @@ -90,7 +90,7 @@ public NamespaceRdfContext(final Session session) throws RepositoryException {
nsTriples.add(create(nsSubject, HAS_NAMESPACE_PREFIX.asNode(),
createLiteral(prefix)));
nsTriples.add(create(nsSubject, HAS_NAMESPACE_URI.asNode(),
createLiteral(nsURI)));
createLiteral(rdfNsUri)));
}
}
concat(nsTriples.build()).namespaces(namespaces.build());
Expand Down
Expand Up @@ -18,14 +18,16 @@

import static com.google.common.collect.Iterators.any;
import static com.hp.hpl.jena.graph.NodeFactory.createLiteral;
import static com.hp.hpl.jena.rdf.model.ResourceFactory.createResource;
import static org.fcrepo.kernel.RdfLexicon.HAS_NAMESPACE_URI;
import static org.fcrepo.kernel.RdfLexicon.REPOSITORY_NAMESPACE;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Workspace;

import org.fcrepo.kernel.rdf.impl.NamespaceRdfContext;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
Expand Down Expand Up @@ -53,6 +55,13 @@ public void testConstructor() throws RepositoryException {
assertTrue(any(new NamespaceRdfContext(mockSession), hasTestUriAsObject));
}

@Test
public void testJcrUris() throws RepositoryException {
when(mockNamespaceRegistry.getPrefixes()).thenReturn(new String[] {"jcr"});
when(mockNamespaceRegistry.getURI("jcr")).thenReturn("http://www.jcp.org/jcr/1.0");
assertTrue(new NamespaceRdfContext(mockSession).asModel().contains(createResource(REPOSITORY_NAMESPACE), HAS_NAMESPACE_URI, REPOSITORY_NAMESPACE));
}

@Before
public void setUp() throws RepositoryException {
initMocks(this);
Expand Down

0 comments on commit fbdf974

Please sign in to comment.