Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
fcrepo-kernel/src/test/java/org/fcrepo/integration/utils/JcrRdfToolsIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.fcrepo.integration.utils; | ||
|
||
|
||
import com.hp.hpl.jena.rdf.model.Model; | ||
import org.apache.commons.io.IOUtils; | ||
import org.fcrepo.integration.AbstractIT; | ||
import org.fcrepo.rdf.impl.DefaultGraphSubjects; | ||
import org.fcrepo.utils.JcrRdfTools; | ||
import org.junit.Test; | ||
import org.springframework.test.context.ContextConfiguration; | ||
|
||
import javax.inject.Inject; | ||
import javax.jcr.LoginException; | ||
import javax.jcr.Repository; | ||
import javax.jcr.RepositoryException; | ||
import javax.jcr.Session; | ||
import javax.jcr.nodetype.NodeType; | ||
import java.io.ByteArrayOutputStream; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
@ContextConfiguration({"/spring-test/repo.xml"}) | ||
public class JcrRdfToolsIT extends AbstractIT { | ||
|
||
@Inject | ||
Repository repo; | ||
|
||
final DefaultGraphSubjects defaultGraphSubjects = new DefaultGraphSubjects(); | ||
|
||
@Test | ||
public void shouldMapJcrNodeTypesToRDFS() throws RepositoryException { | ||
|
||
final Session session = repo.login(); | ||
|
||
|
||
final Model jcrPropertiesModel = JcrRdfTools.getJcrPropertiesModel(defaultGraphSubjects, session, session.getWorkspace().getNodeTypeManager()); | ||
|
||
final ByteArrayOutputStream o = new ByteArrayOutputStream(); | ||
jcrPropertiesModel.write(o, "N3"); | ||
|
||
final String s = o.toString(); | ||
|
||
assertTrue("", s.contains("#fedora:object")); | ||
session.logout(); | ||
} | ||
|
||
} |