throws Exception
{
TestSuite suite = new TestSuite(factory.getClass().getName());
// Read manifest and create declared test cases
Repository manifestRep = new SailRepository(new MemoryStore());
manifestRep.initialize();
RepositoryConnection con = manifestRep.getConnection();
URL manifestURL = SeRQLQueryTestCase.class.getResource(MANIFEST_FILE);
RDFFormat format = RDFFormat.forFileName(MANIFEST_FILE, RDFFormat.TURTLE);
con.add(manifestURL, base(manifestURL.toExternalForm()), format);
String query = "SELECT testName, entailment, input, query, result " + "FROM {} mf:name {testName};"
+ " mf:result {result}; " + " tck:entailment {entailment}; "
+ " mf:action {} qt:query {query}; " + " qt:data {input} "
+ "USING NAMESPACE " + " mf = <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#>, "
+ " qt = <http://www.w3.org/2001/sw/DataAccess/tests/test-query#>, "
+ " tck = <urn:openrdf.org:sesame:tests#> ";
TupleResult tests = con.prepareTupleQuery(QueryLanguage.SERQL, query).evaluate();
while (tests.hasNext()) {
BindingSet testBindings = tests.next();
String testName = ((Literal)testBindings.getValue("testName")).getLabel();
String inputFile = testBindings.getValue("input").toString();
String queryFile = testBindings.getValue("query").toString();
String resultFile = testBindings.getValue("result").toString();
String entailment = ((Literal)testBindings.getValue("entailment")).getLabel();
query = "SELECT graph " + "FROM {} mf:name {testName}; "
+ " mf:action {} qt:graphData {graph} " + "WHERE testName = \""
+ SeRQLUtil.encodeString(testName) + "\" " + "USING NAMESPACE"
+ " mf = <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#>,"
+ " qt = <http://www.w3.org/2001/sw/DataAccess/tests/test-query#>";
List<String> graphNames = new ArrayList<String>();
TupleResult graphs = con.prepareTupleQuery(QueryLanguage.SERQL, query).evaluate();
while (graphs.hasNext()) {
BindingSet graphBindings = graphs.next();
graphNames.add(graphBindings.getValue("graph").toString());
}
graphs.close();
if (testName.startsWith("test-029:")) {
logger.error("test-029 SKIPPED in {}", SeRQLQueryTestCase.class.getName());
continue;
}
suite.addTest(factory.createTest(testName, inputFile, graphNames, queryFile, resultFile, entailment));
}
tests.close();
con.close();
manifestRep.shutDown();
return suite;
}