Search in sources :

Example 21 with OpBGP

use of org.apache.jena.sparql.algebra.op.OpBGP in project jena by apache.

the class OpRewriterTest method testBGPNoReadAccess.

@Test
public void testBGPNoReadAccess() {
    SecurityEvaluator securityEvaluator = new MockSecurityEvaluator(true, true, false, true, true, true, true);
    rewriter = new OpRewriter(securityEvaluator, "http://example.com/dummy");
    Triple[] triples = { new Triple(NodeFactory.createVariable("foo"), RDF.type.asNode(), NodeFactory.createURI("http://example.com/class")), new Triple(NodeFactory.createVariable("foo"), NodeFactory.createBlankNode(), NodeFactory.createVariable("bar")), new Triple(NodeFactory.createVariable("bar"), NodeFactory.createBlankNode(), NodeFactory.createVariable("baz")) };
    try {
        rewriter.visit(new OpBGP(BasicPattern.wrap(Arrays.asList(triples))));
        Assert.fail("Should have thrown AccessDeniedException");
    } catch (ReadDeniedException e) {
    // expected
    }
}
Also used : Triple(org.apache.jena.graph.Triple) ReadDeniedException(org.apache.jena.shared.ReadDeniedException) MockSecurityEvaluator(org.apache.jena.permissions.MockSecurityEvaluator) OpBGP(org.apache.jena.sparql.algebra.op.OpBGP) SecurityEvaluator(org.apache.jena.permissions.SecurityEvaluator) MockSecurityEvaluator(org.apache.jena.permissions.MockSecurityEvaluator) Test(org.junit.Test)

Aggregations

OpBGP (org.apache.jena.sparql.algebra.op.OpBGP)21 BasicPattern (org.apache.jena.sparql.core.BasicPattern)19 Op (org.apache.jena.sparql.algebra.Op)11 Node (org.apache.jena.graph.Node)10 Triple (org.apache.jena.graph.Triple)9 Test (org.junit.Test)9 SocketException (java.net.SocketException)5 OpService (org.apache.jena.sparql.algebra.op.OpService)5 QueryExceptionHTTP (org.apache.jena.sparql.engine.http.QueryExceptionHTTP)5 Context (org.apache.jena.sparql.util.Context)5 Var (org.apache.jena.sparql.core.Var)4 ArrayList (java.util.ArrayList)3 ConnectTimeoutException (org.apache.http.conn.ConnectTimeoutException)3 Query (org.apache.jena.query.Query)3 QueryIterator (org.apache.jena.sparql.engine.QueryIterator)3 Binding (org.apache.jena.sparql.engine.binding.Binding)3 Expr (org.apache.jena.sparql.expr.Expr)3 ExprVar (org.apache.jena.sparql.expr.ExprVar)3 UnknownHostException (java.net.UnknownHostException)2 HttpConnectTimeoutException (java.net.http.HttpConnectTimeoutException)2