Skip to content

Commit

Permalink
update test with a more meaningful property check
Browse files Browse the repository at this point in the history
  • Loading branch information
acoburn committed Nov 5, 2015
1 parent ed8048d commit 43af096
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/test/java/org/fcrepo/integration/SparqlQueryTransformIT.java
Expand Up @@ -23,6 +23,7 @@
import org.fcrepo.kernel.api.utils.iterators.RdfStream;
import org.fcrepo.kernel.modeshape.rdf.impl.DefaultIdentifierTranslator;
import org.fcrepo.kernel.modeshape.rdf.impl.PropertiesRdfContext;
import org.fcrepo.kernel.modeshape.rdf.impl.TypeRdfContext;
import org.fcrepo.transform.transformations.SparqlQueryTransform;

import org.junit.Test;
Expand All @@ -43,7 +44,9 @@
import static java.util.Objects.requireNonNull;
import static java.util.UUID.randomUUID;
import static org.fcrepo.kernel.api.RdfLexicon.REPOSITORY_NAMESPACE;
import static org.fcrepo.kernel.api.RdfLexicon.RDF_NAMESPACE;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;


/**
Expand All @@ -67,22 +70,22 @@ public class SparqlQueryTransformIT extends AbstractResourceIT {
private SparqlQueryTransform testObj;

@Test
public void testQueryNoPrimaryType() throws RepositoryException, IOException {
public void testQueryRdfType() throws RepositoryException, IOException {
final Session session = repo.login();
try {
final Container object = containerService.findOrCreate(session, "/testObject-" + randomUUID());

final String s = "SELECT ?x ?type\n" +
"WHERE { ?x <" + REPOSITORY_NAMESPACE + "primaryType> ?type }";
"WHERE { ?x <" + RDF_NAMESPACE + "type> ?type }";
try (final InputStream stringReader = new ByteArrayInputStream(s.getBytes())) {

testObj = new SparqlQueryTransform(stringReader);

final RdfStream stream = object.getTriples(new DefaultIdentifierTranslator(session),
PropertiesRdfContext.class);
TypeRdfContext.class);
try (final QueryExecution qexec = testObj.apply(stream)) {
final ResultSet results = requireNonNull(qexec).execSelect();
assertFalse(requireNonNull(results).hasNext());
assertTrue(requireNonNull(results).hasNext());
}
}
} finally {
Expand Down

0 comments on commit 43af096

Please sign in to comment.