use of org.apache.jena.sparql.algebra.op.OpBGP in project jena by apache.
the class TestService method testStringTimeout2.
@Test
public void testStringTimeout2() {
BasicPattern basicPattern = new BasicPattern();
basicPattern.add(Triple.ANY);
Node serviceNode = NodeFactory.createURI(SERVICE);
OpService opService = new OpService(serviceNode, new OpBGP(basicPattern), false);
Context context = new Context();
ARQ.setNormalMode(context);
context.set(Service.queryTimeout, "10,10000");
try {
Service.exec(opService, context);
Assert.fail("Expected QueryExceptionHTTP");
} catch (QueryExceptionHTTP expected) {
Throwable thrown = expected.getCause();
if (thrown instanceof SocketException || thrown instanceof ConnectTimeoutException) {
// expected
} else {
Assert.fail(String.format("Expected SocketException or ConnectTimeoutException, instead got: %s %s", thrown.getClass().getName(), thrown.getMessage()));
}
}
}
use of org.apache.jena.sparql.algebra.op.OpBGP in project jena by apache.
the class TestService method testNumericTimeout.
@Test
public void testNumericTimeout() {
BasicPattern basicPattern = new BasicPattern();
basicPattern.add(Triple.ANY);
Node serviceNode = NodeFactory.createURI(SERVICE);
OpService opService = new OpService(serviceNode, new OpBGP(basicPattern), false);
Context context = new Context();
ARQ.setNormalMode(context);
context.set(Service.queryTimeout, 10);
try {
Service.exec(opService, context);
Assert.fail("Expected QueryExceptionHTTP");
} catch (QueryExceptionHTTP expected) {
Throwable thrown = expected.getCause();
if (thrown instanceof SocketException || thrown instanceof ConnectTimeoutException) {
// expected
} else {
Assert.fail(String.format("Expected SocketException or ConnectTimeoutException, instead got: %s %s", thrown.getClass().getName(), thrown.getMessage()));
}
}
}
use of org.apache.jena.sparql.algebra.op.OpBGP in project jena by apache.
the class TestService method testStringTimeout.
@Test
public void testStringTimeout() {
BasicPattern basicPattern = new BasicPattern();
basicPattern.add(Triple.ANY);
Node serviceNode = NodeFactory.createURI(SERVICE);
OpService opService = new OpService(serviceNode, new OpBGP(basicPattern), false);
Context context = new Context();
ARQ.setNormalMode(context);
context.set(Service.queryTimeout, "10");
try {
Service.exec(opService, context);
Assert.fail("Expected QueryExceptionHTTP");
} catch (QueryExceptionHTTP expected) {
Throwable thrown = expected.getCause();
if (thrown instanceof SocketException || thrown instanceof ConnectTimeoutException) {
// expected
} else {
Assert.fail(String.format("Expected SocketException or ConnectTimeoutException, instead got: %s %s", thrown.getClass().getName(), thrown.getMessage()));
}
}
}
use of org.apache.jena.sparql.algebra.op.OpBGP in project jena by apache.
the class TestBlankNodeBinary method bNodeSPARQL_Query_2.
@Test
public void bNodeSPARQL_Query_2() {
String qs = "SELECT * { ?s ?p <_:BCD>}";
Query query = QueryFactory.create(qs);
Op op = Algebra.compile(query);
BasicPattern bp = ((OpBGP) op).getPattern();
Triple t = bp.get(0);
assertEquals("BCD", t.getObject().getBlankNodeLabel());
}
use of org.apache.jena.sparql.algebra.op.OpBGP in project jena by apache.
the class TestServiceSetup method testStringTimeout.
@Test
public void testStringTimeout() {
BasicPattern basicPattern = new BasicPattern();
basicPattern.add(Triple.ANY);
Node serviceNode = NodeFactory.createURI(SERVICE);
OpService opService = new OpService(serviceNode, new OpBGP(basicPattern), false);
Context context = new Context();
ARQ.setNormalMode(context);
context.set(Service.httpQueryTimeout, "10");
try {
Service.exec(opService, context);
Assert.fail("Expected QueryExceptionHTTP");
} catch (QueryExceptionHTTP expected) {
Throwable thrown = expected.getCause();
if (thrown instanceof SocketException || thrown instanceof HttpConnectTimeoutException || thrown instanceof UnknownHostException) {
// expected
} else {
Assert.fail(String.format("Expected SocketException or HttpConnectTimeoutException, instead got: %s %s", thrown.getClass().getName(), thrown.getMessage()));
}
}
}
Aggregations