use of org.eclipse.rdf4j.repository.RepositoryConnection in project rdf4j by eclipse.
the class ContextAwareConnectionTest method testBaseURI.
@Test
public void testBaseURI() throws Exception {
RepositoryConnection stub = new RepositoryConnectionStub();
Repository repo = stub.getRepository();
ContextAwareConnection a = new ContextAwareConnection(repo, stub);
ContextAwareConnection b = new ContextAwareConnection(repo, a);
b.setBaseURI("http://example.com/");
assertEquals("http://example.com/", b.getBaseURI());
assertEquals("http://example.com/", a.getBaseURI());
}
use of org.eclipse.rdf4j.repository.RepositoryConnection in project rdf4j by eclipse.
the class ContextAwareConnectionTest method testTupleQuery.
@Test
public void testTupleQuery() throws Exception {
RepositoryConnection stub = new RepositoryConnectionStub() {
@Override
public TupleQuery prepareTupleQuery(QueryLanguage ql, String query, String baseURI) throws MalformedQueryException, RepositoryException {
assertEquals(SPARQL, ql);
assertEquals(queryString, query);
return new TupleQueryStub() {
@Override
public void setDataset(Dataset dataset) {
Set<IRI> contexts = Collections.singleton(context);
assertEquals(contexts, dataset.getDefaultGraphs());
super.setDataset(dataset);
}
};
}
};
Repository repo = stub.getRepository();
ContextAwareConnection con = new ContextAwareConnection(repo, stub);
con.setReadContexts(context);
con.setQueryLanguage(SERQL);
con.prepareTupleQuery(SPARQL, queryString, null);
}
use of org.eclipse.rdf4j.repository.RepositoryConnection in project rdf4j by eclipse.
the class ContextAwareConnectionTest method testMaxQueryTime.
@Test
public void testMaxQueryTime() throws Exception {
RepositoryConnection stub = new RepositoryConnectionStub();
Repository repo = stub.getRepository();
ContextAwareConnection a = new ContextAwareConnection(repo, stub);
ContextAwareConnection b = new ContextAwareConnection(repo, a);
b.setMaxQueryTime(1);
assertEquals(1, b.getMaxQueryTime());
assertEquals(1, a.getMaxQueryTime());
}
use of org.eclipse.rdf4j.repository.RepositoryConnection in project rdf4j by eclipse.
the class ContextAwareConnectionTest method testAddContexts.
@Test
public void testAddContexts() throws Exception {
RepositoryConnection stub = new RepositoryConnectionStub();
Repository repo = stub.getRepository();
ContextAwareConnection a = new ContextAwareConnection(repo, stub);
ContextAwareConnection b = new ContextAwareConnection(repo, a);
b.setAddContexts(context);
assertEquals(context, b.getAddContexts()[0]);
assertEquals(context, a.getAddContexts()[0]);
}
use of org.eclipse.rdf4j.repository.RepositoryConnection in project rdf4j by eclipse.
the class ContextAwareConnectionTest method testInsertContexts.
@Test
public void testInsertContexts() throws Exception {
RepositoryConnection stub = new RepositoryConnectionStub();
Repository repo = stub.getRepository();
ContextAwareConnection a = new ContextAwareConnection(repo, stub);
ContextAwareConnection b = new ContextAwareConnection(repo, a);
b.setInsertContext(context);
assertEquals(context, b.getInsertContext());
assertEquals(context, a.getInsertContext());
}
Aggregations