From da3e01eadfad0854fac15a7f7c335b0355b50694 Mon Sep 17 00:00:00 2001 From: Jerven Bolleman Date: Fri, 10 Nov 2023 14:28:57 +0100 Subject: [PATCH] GH-4592 Reenable geosparql junit testing. Allow for non DAWG approved tests to run. Adds a manifest-all.ttl file for geosparql like sparql 1.1. compliance. Also remove some unused imports. Signed-off-by: Jerven Bolleman --- .../algebra/geosparql/GeoSPARQLManifestTest.java | 4 +++- .../resources/testcases-geosparql/manifest-all.ttl | 10 ++++++++++ .../sparql/manifest/SPARQLQueryComplianceTest.java | 12 ++++++------ 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 testsuites/geosparql/src/main/resources/testcases-geosparql/manifest-all.ttl diff --git a/testsuites/geosparql/src/main/java/org/eclipse/rdf4j/testsuite/query/algebra/geosparql/GeoSPARQLManifestTest.java b/testsuites/geosparql/src/main/java/org/eclipse/rdf4j/testsuite/query/algebra/geosparql/GeoSPARQLManifestTest.java index 4afe05485b4..9733719e6b8 100644 --- a/testsuites/geosparql/src/main/java/org/eclipse/rdf4j/testsuite/query/algebra/geosparql/GeoSPARQLManifestTest.java +++ b/testsuites/geosparql/src/main/java/org/eclipse/rdf4j/testsuite/query/algebra/geosparql/GeoSPARQLManifestTest.java @@ -14,10 +14,12 @@ import org.eclipse.rdf4j.testsuite.query.parser.sparql.manifest.SPARQLQueryComplianceTest; import org.junit.jupiter.api.DynamicTest; +import org.junit.jupiter.api.TestFactory; public abstract class GeoSPARQLManifestTest extends SPARQLQueryComplianceTest { + @TestFactory public Collection tests() { - return getTestData("testcases-geosparql/functions/manifest.ttl"); + return getTestData("testcases-geosparql/manifest-all.ttl", false); } } diff --git a/testsuites/geosparql/src/main/resources/testcases-geosparql/manifest-all.ttl b/testsuites/geosparql/src/main/resources/testcases-geosparql/manifest-all.ttl new file mode 100644 index 00000000000..0a241a503e9 --- /dev/null +++ b/testsuites/geosparql/src/main/resources/testcases-geosparql/manifest-all.ttl @@ -0,0 +1,10 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix mf: . +@prefix qt: . + +<> rdf:type mf:Manifest ; + rdfs:label "GeoSPARQL Evaluation tests" ; + mf:include ( + + ). diff --git a/testsuites/sparql/src/main/java/org/eclipse/rdf4j/testsuite/query/parser/sparql/manifest/SPARQLQueryComplianceTest.java b/testsuites/sparql/src/main/java/org/eclipse/rdf4j/testsuite/query/parser/sparql/manifest/SPARQLQueryComplianceTest.java index 0082777e594..d13deef7a8e 100644 --- a/testsuites/sparql/src/main/java/org/eclipse/rdf4j/testsuite/query/parser/sparql/manifest/SPARQLQueryComplianceTest.java +++ b/testsuites/sparql/src/main/java/org/eclipse/rdf4j/testsuite/query/parser/sparql/manifest/SPARQLQueryComplianceTest.java @@ -17,7 +17,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.io.StringWriter; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.ArrayDeque; @@ -28,7 +27,6 @@ import java.util.List; import java.util.Optional; import java.util.Set; -import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.eclipse.rdf4j.common.io.IOUtil; @@ -57,7 +55,6 @@ import org.eclipse.rdf4j.query.resultio.TupleQueryResultParser; import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.RepositoryConnection; -import org.eclipse.rdf4j.repository.RepositoryResult; import org.eclipse.rdf4j.repository.sail.SailRepository; import org.eclipse.rdf4j.repository.sail.SailRepositoryConnection; import org.eclipse.rdf4j.rio.RDFFormat; @@ -518,14 +515,17 @@ public List getSubManifests() { public abstract Collection tests(); public Collection getTestData(String manifestResource) { + return getTestData(manifestResource, true); + } + + public Collection getTestData(String manifestResource, boolean approvedOnly) { List tests = new ArrayList<>(); Deque manifests = new ArrayDeque<>(); - manifests.add( - SPARQL11UpdateComplianceTest.class.getClassLoader().getResource(manifestResource).toExternalForm()); + manifests.add(this.getClass().getClassLoader().getResource(manifestResource).toExternalForm()); while (!manifests.isEmpty()) { String pop = manifests.pop(); - SPARQLQueryTestManifest manifest = new SPARQLQueryTestManifest(pop, excludedSubdirs); + SPARQLQueryTestManifest manifest = new SPARQLQueryTestManifest(pop, excludedSubdirs, approvedOnly); tests.addAll(manifest.tests); manifests.addAll(manifest.subManifests); }