Merge pull request #764 from afs/test4
JENA-1922: Runners for test sets using W3C test manifests
diff --git a/jena-arq/pom.xml b/jena-arq/pom.xml
index a14b0ed..e6cc1b8 100644
--- a/jena-arq/pom.xml
+++ b/jena-arq/pom.xml
@@ -162,13 +162,13 @@
<configuration>
<includes>
<!--
- The test collections TC_General, TC_Riot, TC_Atlas
+ The test collections TC_ARQ, TC_Riot, TC_Atlas_ARQ
are development support that collect the relevant
tests for partial testing during development.
+ TC_Examples does not run in the the build.
-->
<include>**/TS_*.java</include>
- <include>**/TC_Scripted.java</include>
- <include>**/TC_DAWG.java</include>
+ <include>**/Scripts_*.java</include>
</includes>
</configuration>
</plugin>
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/checker/CheckerLiterals.java b/jena-arq/src/main/java/org/apache/jena/riot/checker/CheckerLiterals.java
index 821689d..87311b7 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/checker/CheckerLiterals.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/checker/CheckerLiterals.java
@@ -29,8 +29,6 @@
import org.apache.jena.util.SplitIRI;
public class CheckerLiterals implements NodeChecker {
- // A flag to enable the test suite to read bad data.
- public static boolean WarnOnBadLiterals = true ;
private ErrorHandler handler ;
@@ -64,9 +62,6 @@
public static boolean checkLiteral(String lexicalForm, String lang, RDFDatatype datatype, ErrorHandler handler,
long line, long col) {
- if ( !WarnOnBadLiterals )
- return true ;
-
boolean hasLang = lang != null && !lang.equals("") ;
if ( !hasLang ) {
// Datatype check (and RDF 1.0 simple literals are always well formed)
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/ARQTestSuite.java b/jena-arq/src/test/java/org/apache/jena/arq/ARQTestSuite.java
new file mode 100644
index 0000000..53488a0
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/ARQTestSuite.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq;
+
+import org.apache.jena.arq.examples.TC_Examples;
+import org.apache.jena.atlas.TC_Atlas_ARQ;
+import org.apache.jena.atlas.legacy.BaseTest2;
+import org.apache.jena.common.TC_Common;
+import org.apache.jena.riot.TC_Riot;
+import org.apache.jena.sparql.Scripts_ARQ;
+import org.apache.jena.sparql.Scripts_DAWG;
+import org.apache.jena.sparql.Scripts_RefEngine;
+import org.apache.jena.sparql.TC_ARQ;
+import org.apache.jena.sparql.expr.E_Function;
+import org.apache.jena.sparql.expr.NodeValue;
+import org.apache.jena.sys.JenaSystem;
+import org.apache.jena.system.TS_System;
+import org.apache.jena.web.TS_Web;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * All the ARQ tests
+ */
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {
+ TC_Atlas_ARQ.class,
+ TC_Common.class,
+
+ TC_Riot.class,
+
+ TS_Web.class,
+ TS_System.class,
+
+ // Main ARQ java tests
+ TC_ARQ.class,
+
+ // ARQ SPARQL scripted.
+ Scripts_ARQ.class,
+ Scripts_DAWG.class,
+ //Scripts_SPARQL11.class, // Covered by Scripts_ARQ
+ Scripts_RefEngine.class,
+
+ // Only runs when src-examples is a source folder, which it isn't in the build.
+ TC_Examples.class
+
+
+})
+public class ARQTestSuite {
+ static {
+ JenaSystem.init();
+ }
+
+ public static final String testDirARQ = "testing/ARQ";
+ public static final String testDirUpdate = "testing/Update";
+
+ public static final String log4jPropertiesResourceName = "log4j2.properties";
+
+ @BeforeClass
+ public static void beforeClass() {
+ NodeValue.VerboseWarnings = false;
+ E_Function.WarnOnUnknownFunction = false;
+ BaseTest2.setTestLogging();
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ BaseTest2.unsetTestLogging();
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/examples/TC_Examples.java b/jena-arq/src/test/java/org/apache/jena/arq/examples/TC_Examples.java
new file mode 100644
index 0000000..65a2327
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/examples/TC_Examples.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.examples;
+
+import org.apache.jena.arq.junit.manifest.Label;
+import org.apache.jena.arq.junit.manifest.Manifests;
+import org.apache.jena.arq.junit.runners.RunnerSPARQL;
+import org.apache.jena.sparql.expr.E_Function;
+import org.apache.jena.sparql.expr.NodeValue;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+
+
+@RunWith(RunnerSPARQL.class)
+@Label("Examples")
+@Manifests({
+ "testing/ARQ/Examples/manifest.ttl"
+})
+public class TC_Examples
+{
+ private static boolean bVerboseWarnings;
+ private static boolean bWarnOnUnknownFunction;
+
+ @BeforeClass
+ public static void beforeClass() {
+ bVerboseWarnings = NodeValue.VerboseWarnings;
+ bWarnOnUnknownFunction = E_Function.WarnOnUnknownFunction;
+ NodeValue.VerboseWarnings = false;
+ E_Function.WarnOnUnknownFunction = false;
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ NodeValue.VerboseWarnings = bVerboseWarnings;
+ E_Function.WarnOnUnknownFunction = bWarnOnUnknownFunction;
+ }
+
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/LibTestSetup.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/LibTestSetup.java
new file mode 100644
index 0000000..c52390a
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/LibTestSetup.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit;
+
+import java.util.ArrayList ;
+import java.util.Collection ;
+import java.util.List ;
+
+import org.apache.jena.arq.junit.manifest.ExTestSetup;
+import org.apache.jena.rdf.model.* ;
+
+public class LibTestSetup
+{
+ public static Resource getResource(Resource r, Property p)
+ {
+ if ( r == null )
+ return null ;
+ if ( ! r.hasProperty(p) )
+ return null ;
+
+ RDFNode n = r.getProperty(p).getObject() ;
+ if ( n instanceof Resource )
+ return (Resource)n ;
+
+ throw new ExTestSetup("Manifest problem (not a Resource): "+n+" => "+p) ;
+ }
+
+ public static Collection<Resource> listResources(Resource r, Property p)
+ {
+ if ( r == null )
+ return null ;
+ List<Resource> x = new ArrayList<>() ;
+ StmtIterator sIter = r.listProperties(p) ;
+ for ( ; sIter.hasNext() ; ) {
+ RDFNode n = sIter.next().getObject() ;
+ if ( ! ( n instanceof Resource ) )
+ throw new ExTestSetup("Manifest problem (not a Resource): "+n+" => "+p) ;
+ x.add((Resource)n) ;
+ }
+ return x ;
+ }
+
+ public static String getLiteral(Resource r, Property p)
+ {
+ if ( r == null )
+ return null ;
+ if ( ! r.hasProperty(p) )
+ return null ;
+
+ RDFNode n = r.getProperty(p).getObject() ;
+ if ( n instanceof Literal )
+ return ((Literal)n).getLexicalForm() ;
+
+ throw new ExTestSetup("Manifest problem (not a Literal): "+n+" => "+p) ;
+ }
+
+ public static String getLiteralOrURI(Resource r, Property p)
+ {
+ if ( r == null )
+ return null ;
+
+ if ( ! r.hasProperty(p) )
+ return null ;
+
+ RDFNode n = r.getProperty(p).getObject() ;
+ if ( n instanceof Literal )
+ return ((Literal)n).getLexicalForm() ;
+
+ if ( n instanceof Resource )
+ {
+ Resource r2 = (Resource)n ;
+ if ( ! r2.isAnon() )
+ return r2.getURI() ;
+ }
+
+ throw new ExTestSetup("Manifest problem: "+n+" => "+p) ;
+ }
+
+ public static String safeName(String s)
+ {
+ // Safe from Eclipse
+ s = s.replace('(','[') ;
+ s = s.replace(')',']') ;
+ return s ;
+
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/TextTestRunner.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/TextTestRunner.java
new file mode 100644
index 0000000..8dcf21e
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/TextTestRunner.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit;
+
+import java.util.function.Function;
+
+import org.apache.jena.arq.junit.manifest.Manifest;
+import org.apache.jena.arq.junit.manifest.ManifestEntry;
+import org.apache.jena.arq.junit.runners.AbstractRunnerOfTests;
+import org.apache.jena.arq.junit.runners.RunnerOneManifest;
+import org.apache.jena.atlas.junit.TextListenerLong;
+import org.apache.jena.sparql.expr.E_Function;
+import org.apache.jena.sparql.expr.NodeValue;
+import org.apache.jena.sparql.junit.EarlReport;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+
+public class TextTestRunner {
+
+ public static void runOne(String manifestFile, Function<ManifestEntry, Runnable> testMaker) {
+ runOne(null, manifestFile, testMaker);
+ }
+
+ public static void runOne(EarlReport report, String manifestFile, Function<ManifestEntry, Runnable> testMaker) {
+ Manifest manifest = Manifest.parse(manifestFile);
+ RunnerOneManifest top = AbstractRunnerOfTests.build(report, manifest, testMaker, null);
+
+ NodeValue.VerboseWarnings = false ;
+ E_Function.WarnOnUnknownFunction = false ;
+ // Better: silent warning error handler.
+ // Get rid of CheckerLiterals.WarnOnBadLiterals?
+ // CheckerLiterals.WarnOnBadLiterals = false ;
+
+ JUnitCore junitCore = new JUnitCore();
+ junitCore.addListener(new TextListenerLong(System.out));
+ //junit.addListener(new TextListenerDots(System.out));
+ Result result = junitCore.run(top);
+ System.out.println("Run: "+result.getRunCount());
+ System.out.println("Failures: "+result.getFailureCount());
+ }
+}
+
diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/web/TS_Web.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/ExTestSetup.java
similarity index 71%
copy from jena-arq/src/test/java/org/apache/jena/atlas/web/TS_Web.java
copy to jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/ExTestSetup.java
index af639c2..c9ea569 100644
--- a/jena-arq/src/test/java/org/apache/jena/atlas/web/TS_Web.java
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/ExTestSetup.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -16,17 +16,13 @@
* limitations under the License.
*/
-package org.apache.jena.atlas.web;
+package org.apache.jena.arq.junit.manifest;
-import org.junit.runner.RunWith ;
-import org.junit.runners.Suite ;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
- TestContentNegotiation.class
-} )
-public class TS_Web
+public class ExTestSetup extends RuntimeException
{
-
+ public ExTestSetup() { super() ; }
+ public ExTestSetup(Throwable cause) { super(cause) ; }
+ public ExTestSetup(String msg) { super(msg) ; }
+ public ExTestSetup(String msg, Throwable cause) { super(msg, cause) ; }
}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/Label.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/Label.java
new file mode 100644
index 0000000..fd70ed4
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/Label.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+package org.apache.jena.arq.junit.manifest;
+
+import java.lang.annotation.*;
+
+/** Test suite title */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface Label {
+ public String value();
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/Manifest.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/Manifest.java
new file mode 100644
index 0000000..df769f3
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/Manifest.java
@@ -0,0 +1,270 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit.manifest;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.function.Consumer;
+
+import org.apache.jena.rdf.model.* ;
+import org.apache.jena.riot.RDFDataMgr;
+import org.apache.jena.riot.system.IRIResolver;
+import org.apache.jena.vocabulary.RDF ;
+import org.apache.jena.vocabulary.RDFS ;
+import org.apache.jena.vocabulary.TestManifest ;
+import org.apache.jena.vocabulary.TestManifestX ;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A "Manifest" is the includes and entries for a single file.
+ */
+public class Manifest
+{
+ private static Logger log = LoggerFactory.getLogger(Manifest.class) ;
+ private Model manifest ;
+ private String manifestName ;
+ private String filename ;
+ private List<String> includedFiles = new ArrayList<>() ;
+ private List<ManifestEntry> entries = new ArrayList<>() ;
+ private Resource manifestRes = null ;
+
+ public static Manifest parse(String manifestFile) {
+ Manifest manifest = new Manifest(manifestFile);
+ return manifest;
+ }
+
+ public static void walk(Manifest manifest, Consumer<Manifest> actionManifest, Consumer<ManifestEntry> actionEntry) {
+ actionManifest.accept(manifest);
+ Iterator<String> sub = manifest.includedManifests();
+ while(sub.hasNext() ) {
+ String mf = sub.next();
+ Manifest manifestSub = Manifest.parse(mf);
+ walk(manifestSub, actionManifest, actionEntry);
+ }
+ for ( ManifestEntry entry : manifest.entries() ) {
+ actionEntry.accept(entry);
+ }
+ }
+
+
+ private Manifest(String fn) {
+ filename = IRIResolver.resolveFileURL(fn) ;
+ manifest = RDFDataMgr.loadModel(filename) ;
+ parseManifest() ;
+ parseIncludes() ;
+ parseEntries() ;
+ }
+
+ public String getName() { return manifestName ; }
+ public String getFileName() { return filename ; }
+
+ public Iterator<String> includedManifests() { return includedFiles.iterator() ; }
+
+ public List<ManifestEntry> entries() { return entries ; }
+
+ private void parseManifest()
+ {
+ StmtIterator manifestStmts = manifest.listStatements(null, RDF.type, TestManifest.Manifest);
+ if ( !manifestStmts.hasNext() ) {
+ log.warn("No manifest in manifest file: "+filename) ;
+ return ;
+ }
+
+ Statement manifestItemStmt = manifestStmts.nextStatement();
+ if ( manifestStmts.hasNext() ) {
+ log.warn("Multiple manifests in manifest file: "+filename) ;
+ return ;
+ }
+
+ manifestRes = manifestItemStmt.getSubject();
+ manifestName = getLiteral(manifestRes, RDFS.label) ;
+ if ( manifestName == null )
+ manifestName = getLiteral(manifestRes, RDFS.comment) ;
+ if ( manifestName == null )
+ manifestName = getLiteral(manifestRes, TestManifest.name) ;
+ manifestStmts.close();
+ }
+
+ private void parseEntries() {
+ StmtIterator manifestStmts = manifest.listStatements(null, RDF.type, TestManifest.Manifest);
+
+ for (; manifestStmts.hasNext();)
+ {
+ Statement manifestItemStmt = manifestStmts.nextStatement();
+ Resource manifestRes = manifestItemStmt.getSubject();
+
+ // For each item in this manifest
+ StmtIterator listIter = manifestRes.listProperties(TestManifest.entries);
+ for (; listIter.hasNext();)
+ {
+ //List head
+ Resource listItem = listIter.nextStatement().getResource();
+ for (; !listItem.equals(RDF.nil);)
+ {
+ Resource entry = listItem.getRequiredProperty(RDF.first).getResource();
+ String testName = getLiteral(entry, TestManifest.name) ;
+ Resource action = getResource(entry, TestManifest.action) ;
+ Resource result = getResource(entry, TestManifest.result) ;
+ Resource testType = getResource(entry, RDF.type);
+ ManifestEntry manifestEntry = new ManifestEntry(this, entry, testName, testType, action, result);
+ entries.add(manifestEntry);
+ // Move to next list item
+ listItem = listItem.getRequiredProperty(RDF.rest).getResource();
+ }
+ }
+ listIter.close();
+ }
+ manifestStmts.close();
+ }
+
+ // -------- included manifests
+ private void parseIncludes()
+ {
+ parseIncludes(TestManifest.include) ;
+ parseIncludes(TestManifestX.include) ;
+ }
+
+ private void parseIncludes(Property property)
+ {
+ StmtIterator includeStmts = manifest.listStatements(null, property, (RDFNode)null) ;
+
+ for (; includeStmts.hasNext(); )
+ {
+ Statement s = includeStmts.nextStatement() ;
+ if ( ! ( s.getObject() instanceof Resource ) )
+ {
+ log.warn("Include: not a Resource"+s) ;
+ continue ;
+ }
+ Resource r = s.getResource() ;
+ parseOneIncludesList(r) ;
+ }
+ includeStmts.close() ;
+ }
+
+ private void parseOneIncludesList(Resource r)
+ {
+ if ( r == null )
+ return ;
+
+ if ( r.equals(RDF.nil) )
+ return ;
+
+
+ if ( ! r.isAnon() )
+ {
+ String uri = r.getURI() ;
+ if ( includedFiles.contains(uri) )
+ return ;
+ includedFiles.add(r.getURI()) ;
+ return ;
+ }
+
+ // BNnode => list
+ Resource listItem = r ;
+ while(!listItem.equals(RDF.nil))
+ {
+ r = listItem.getRequiredProperty(RDF.first).getResource();
+ parseOneIncludesList(r) ;
+ // Move on
+ listItem = listItem.getRequiredProperty(RDF.rest).getResource();
+ }
+ }
+
+ private static Resource getResource(Resource r, Property p)
+ {
+ if ( r == null )
+ return null ;
+ if ( ! r.hasProperty(p) )
+ return null ;
+
+ RDFNode n = r.getProperty(p).getObject() ;
+ if ( n instanceof Resource )
+ return (Resource)n ;
+
+ throw new ExTestSetup("Manifest problem (not a Resource): "+n+" => "+p) ;
+ }
+
+ private static Collection<Resource> listResources(Resource r, Property p)
+ {
+ if ( r == null )
+ return null ;
+ List<Resource> x = new ArrayList<>() ;
+ StmtIterator sIter = r.listProperties(p) ;
+ for ( ; sIter.hasNext() ; ) {
+ RDFNode n = sIter.next().getObject() ;
+ if ( ! ( n instanceof Resource ) )
+ throw new ExTestSetup("Manifest problem (not a Resource): "+n+" => "+p) ;
+ x.add((Resource)n) ;
+ }
+ return x ;
+ }
+
+ private static String getLiteral(Resource r, Property p)
+ {
+ if ( r == null )
+ return null ;
+ if ( ! r.hasProperty(p) )
+ return null ;
+
+ RDFNode n = r.getProperty(p).getObject() ;
+ if ( n instanceof Literal )
+ return ((Literal)n).getLexicalForm() ;
+
+ throw new ExTestSetup("Manifest problem (not a Literal): "+n+" => "+p) ;
+ }
+
+ private static String getLiteralOrURI(Resource r, Property p)
+ {
+ if ( r == null )
+ return null ;
+
+ if ( ! r.hasProperty(p) )
+ return null ;
+
+ RDFNode n = r.getProperty(p).getObject() ;
+ if ( n instanceof Literal )
+ return ((Literal)n).getLexicalForm() ;
+
+ if ( n instanceof Resource )
+ {
+ Resource r2 = (Resource)n ;
+ if ( ! r2.isAnon() )
+ return r2.getURI() ;
+ }
+
+ throw new ExTestSetup("Manifest problem: "+n+" => "+p) ;
+ }
+
+ private static String safeName(String s)
+ {
+ // Safe from Eclipse
+ s = s.replace('(','[') ;
+ s = s.replace(')',']') ;
+ return s ;
+ }
+
+ @Override
+ public String toString() {
+ return "manifest["+filename+"]";
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/ManifestEntry.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/ManifestEntry.java
new file mode 100644
index 0000000..bb08a9a
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/ManifestEntry.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit.manifest;
+
+import org.apache.jena.rdf.model.Resource;
+
+public class ManifestEntry {
+ private final Manifest manifest;
+ private final Resource entry;
+ private final String name;
+ private final Resource testType;
+ private final Resource action;
+ private final Resource result;
+
+ public ManifestEntry(Manifest manifest, Resource entry, String name, Resource testType, Resource action, Resource result) {
+ super();
+ this.manifest = manifest;
+ this.entry = entry;
+ this.name = name;
+ this.testType = testType;
+ this.action = action;
+ this.result = result;
+ }
+
+ public Manifest getManifest() {
+ return manifest;
+ }
+
+ public Resource getEntry() {
+ return entry;
+ }
+
+ public String getURI() {
+ return entry.getURI();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Resource getTestType() {
+ return testType;
+ }
+
+ public Resource getAction() {
+ return action;
+ }
+
+ public Resource getResult() {
+ return result;
+ }
+}
+
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/Manifests.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/Manifests.java
new file mode 100644
index 0000000..65b2714
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/Manifests.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+package org.apache.jena.arq.junit.manifest;
+
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface Manifests {
+ public String[] value();
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/Prefix.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/Prefix.java
new file mode 100644
index 0000000..538a3ad
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/manifest/Prefix.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+package org.apache.jena.arq.junit.manifest;
+
+import java.lang.annotation.*;
+
+/** Optional prefix for each test name */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface Prefix {
+ public String value();
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/Parse.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/Parse.java
new file mode 100644
index 0000000..0058760
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/Parse.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit.riot;
+
+import org.apache.jena.riot.Lang;
+import org.apache.jena.riot.RDFParser;
+import org.apache.jena.riot.system.ErrorHandler;
+import org.apache.jena.riot.system.ErrorHandlerFactory;
+import org.apache.jena.riot.system.StreamRDF;
+
+public class Parse {
+
+ private static ErrorHandler errorHandlerTestStrict = ErrorHandlerFactory.errorHandlerStrictSilent();
+
+ public static void parse(StreamRDF destination, String uri, Lang lang) {
+ parse(destination, uri, uri, lang);
+ }
+
+ public static void parse(StreamRDF destination, String uri, String base, Lang lang) {
+ RDFParser.create()
+ .errorHandler(errorHandlerTestStrict)
+ .strict(true)
+ .forceLang(lang)
+ .source(uri)
+ .base(base)
+ .build()
+ .parse(destination);
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotEvalTest.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotEvalTest.java
new file mode 100644
index 0000000..f79cc70
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotEvalTest.java
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit.riot;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.jena.arq.junit.manifest.ManifestEntry;
+import org.apache.jena.graph.Graph;
+import org.apache.jena.riot.*;
+import org.apache.jena.riot.system.ErrorHandlerFactory;
+import org.apache.jena.riot.system.StreamRDF;
+import org.apache.jena.riot.system.StreamRDFLib;
+import org.apache.jena.sparql.core.DatasetGraph ;
+import org.apache.jena.sparql.core.DatasetGraphFactory ;
+import org.apache.jena.sparql.graph.GraphFactory;
+import org.apache.jena.sparql.util.IsoMatcher ;
+
+public class RiotEvalTest implements Runnable {
+ final private boolean expectLegalSyntax;
+ final private ManifestEntry testEntry;
+ final private Lang lang;
+ final private String filename;
+
+ String baseIRI;
+ String input;
+ String output;
+
+ public RiotEvalTest(ManifestEntry entry, String base, Lang lang, boolean positiveTest) {
+ this.testEntry = entry;
+ this.expectLegalSyntax = positiveTest;
+ this.filename = entry.getAction().getURI();
+ this.lang = lang;
+ // -- Old world.
+ //new UnitTestEval(testName, item.getURI(), input.getURI(), result.getURI(), null, RDFLanguages.NTRIPLES, report)
+ baseIRI = base;
+ input = entry.getAction().getURI();
+ output = positiveTest ? entry.getResult().getURI() : null;
+ }
+
+ @Override
+ public void run()
+ {
+ // Could generalise run4() to cover both cases.
+ // run3() predates dataset reading and is more tested.
+ if ( RDFLanguages.isTriples(lang) )
+ run3() ;
+ else
+ run4() ;
+ }
+
+ // Triples test.
+ private void run3() {
+ Graph graph = GraphFactory.createDefaultGraph();
+ StreamRDF dest = StreamRDFLib.graph(graph);
+ try {
+ if ( baseIRI != null )
+ Parse.parse(dest, input, baseIRI, lang);
+ else
+ Parse.parse(dest, input, lang);
+
+ if ( ! expectLegalSyntax )
+ fail("Passed bad syntax eval test");
+
+ Lang outLang = RDFLanguages.filenameToLang(output, Lang.NQUADS) ;
+
+ Graph results = GraphFactory.createDefaultGraph() ;
+ try {
+ RDFParser.create().errorHandler(ErrorHandlerFactory.errorHandlerNoWarnings)
+ .base(baseIRI)
+ .forceLang(outLang)
+ .source(output)
+ .parse(results);
+ } catch (RiotException ex) {
+ fail("Failed to read results: "+ex.getMessage()) ;
+ }
+
+ boolean b = graph.isIsomorphicWith(results) ;
+
+ if ( !b ) {
+ //model.isIsomorphicWith(results) ;
+ System.out.println("---- Parsed");
+ RDFDataMgr.write(System.out, graph, Lang.TURTLE) ;
+ System.out.println("---- Expected");
+ RDFDataMgr.write(System.out, results, Lang.TURTLE) ;
+ System.out.println("--------");
+ }
+
+ assertTrue("Graphs not isomorphic", b) ;
+ } catch (RiotException ex) {
+ if ( expectLegalSyntax )
+ throw ex;
+ }
+ }
+
+ private void run4() {
+ DatasetGraph dsg = DatasetGraphFactory.create() ;
+ StreamRDF dest = StreamRDFLib.dataset(dsg);
+ try {
+ if ( baseIRI != null )
+ Parse.parse(dest, input, baseIRI, lang) ;
+ else
+ Parse.parse(dest, input, lang) ;
+ if ( ! expectLegalSyntax )
+ fail("Passed bad syntax eval test");
+
+ Lang outLang = RDFLanguages.filenameToLang(output, Lang.NQUADS) ;
+
+ DatasetGraph results = DatasetGraphFactory.create() ;
+ try {
+ RDFParser.create().errorHandler(ErrorHandlerFactory.errorHandlerNoWarnings)
+ .base(baseIRI)
+ .forceLang(outLang)
+ .source(output)
+ .parse(results);
+ } catch (RiotException ex) {
+ fail("Failed to read results: "+ex.getMessage()) ;
+ }
+
+ boolean b = isomorphic(dsg, results) ;
+
+ if ( !b )
+ {
+ System.out.println("**** Test: "+testEntry.getName()) ;
+ System.out.println("---- Parsed");
+ RDFDataMgr.write(System.out, dsg, Lang.TRIG) ;
+ System.out.println("---- Expected");
+ RDFDataMgr.write(System.out, results, Lang.TRIG) ;
+ System.out.println("--------");
+ }
+
+ assertTrue("Datasets not isomorphic", b) ;
+ } catch (RiotException ex) {
+ if ( expectLegalSyntax )
+ throw ex;
+ }
+ }
+
+ private boolean isomorphic(DatasetGraph dsg1, DatasetGraph dsg2) {
+ return IsoMatcher.isomorphic(dsg1, dsg2) ;
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotSyntaxTest.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotSyntaxTest.java
new file mode 100644
index 0000000..e22c065
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotSyntaxTest.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit.riot;
+
+import static org.junit.Assert.fail;
+
+import org.apache.jena.arq.junit.manifest.ManifestEntry;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RiotException;
+import org.apache.jena.riot.system.StreamRDF;
+import org.apache.jena.riot.system.StreamRDFLib;
+
+public class RiotSyntaxTest implements Runnable {
+
+ final private boolean expectLegalSyntax;
+ final private ManifestEntry testEntry;
+ final private Lang lang;
+ final private String filename;
+
+ public RiotSyntaxTest(ManifestEntry entry, Lang lang, boolean positiveTest) {
+ this.testEntry = entry;
+ this.expectLegalSyntax = positiveTest;
+ this.filename = entry.getAction().getURI();
+ this.lang = lang;
+ }
+
+ @Override
+ public void run() {
+ StreamRDF stream = StreamRDFLib.sinkNull();
+ try {
+ // XXX Errors to exceptions.
+ Parse.parse(stream, filename, lang);
+ if (! expectLegalSyntax )
+ fail("Parsing suceeded in a bad syntax test");
+ } catch(RiotException ex) {
+ if ( expectLegalSyntax )
+ fail("Parse error: "+ex.getMessage());
+ }
+ }
+
+// if ( RDFLanguages.isTriples(lang) )
+// run3();
+// else
+// run4();
+// }
+//
+// private void run3() {
+// Graph graph = GraphFactory.createDefaultGraph();
+// Parse.parse(graph, filename, lang);
+// }
+//
+// private void run4() {
+// DatasetGraph dsg = DatasetGraphFactory.createGeneral();
+// Parse.parse(dsg, filename, lang);
+// }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotTests.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotTests.java
new file mode 100644
index 0000000..3d0f626
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotTests.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit.riot ;
+
+import org.apache.jena.arq.junit.LibTestSetup;
+import org.apache.jena.arq.junit.manifest.ManifestEntry;
+import org.apache.jena.rdf.model.Resource ;
+import org.apache.jena.riot.RDFLanguages ;
+import org.apache.jena.riot.RiotException ;
+import org.apache.jena.vocabulary.RDF ;
+
+public class RiotTests
+{
+ public static String assumedRootURIex = "http://example/base/" ;
+ public static String assumedRootURITurtle = "http://www.w3.org/2013/TurtleTests/" ;
+ public static String assumedRootURITriG = "http://www.w3.org/2013/TriGTests/" ;
+
+ public static Runnable makeRIOTTest(ManifestEntry entry) {
+
+ //Resource manifest = entry.getManifest();
+ Resource item = entry.getEntry();
+ String testName = entry.getName();
+ Resource action = entry.getAction();
+ Resource result = entry.getResult();
+
+ String labelPrefix = "[RIOT]";
+ Resource dftTestType = null;
+
+ try
+ {
+ Resource testType = LibTestSetup.getResource(item, RDF.type) ;
+ if ( testType == null )
+ testType = dftTestType ;
+ if ( testType == null )
+ throw new RiotException("Can't determine the test type") ;
+
+ if ( labelPrefix != null )
+ testName = labelPrefix+testName ;
+
+ // In Turtle tests, the action directly names the file to process.
+ Resource input = action ;
+ Resource output = result ;
+
+ if ( testType.equals(VocabLangRDF.TestPositiveSyntaxTTL) )
+ return new RiotSyntaxTest(entry, RDFLanguages.TURTLE, true) ;
+ if ( testType.equals(VocabLangRDF.TestNegativeSyntaxTTL) )
+ return new RiotSyntaxTest(entry, RDFLanguages.TURTLE, false) ;
+
+ if ( testType.equals(VocabLangRDF.TestPositiveSyntaxTriG) )
+ return new RiotSyntaxTest(entry, RDFLanguages.TRIG, true) ;
+ if ( testType.equals(VocabLangRDF.TestNegativeSyntaxTriG) )
+ return new RiotSyntaxTest(entry, RDFLanguages.TRIG, false) ;
+
+ if ( testType.equals(VocabLangRDF.TestPositiveSyntaxNT) )
+ return new RiotSyntaxTest(entry, RDFLanguages.NTRIPLES, true) ;
+ if ( testType.equals(VocabLangRDF.TestNegativeSyntaxNT) )
+ return new RiotSyntaxTest(entry, RDFLanguages.NTRIPLES, false) ;
+
+ if ( testType.equals(VocabLangRDF.TestPositiveSyntaxNQ) )
+ return new RiotSyntaxTest(entry, RDFLanguages.NQUADS, true) ;
+ if ( testType.equals(VocabLangRDF.TestNegativeSyntaxNQ) )
+ return new RiotSyntaxTest(entry, RDFLanguages.NQUADS, false) ;
+
+ if ( testType.equals(VocabLangRDF.TestPositiveSyntaxRJ) )
+ return new RiotSyntaxTest(entry, RDFLanguages.RDFJSON, true) ;
+ if ( testType.equals(VocabLangRDF.TestNegativeSyntaxRJ) )
+ return new RiotSyntaxTest(entry, RDFLanguages.RDFJSON, false) ;
+
+ if ( testType.equals(VocabLangRDF.TestSurpressed ))
+ return new SurpressedTest() ;
+
+ // Eval.
+
+ if ( testType.equals(VocabLangRDF.TestEvalTTL) ) {
+ String base = rebase(input, assumedRootURITurtle);
+ return new RiotEvalTest(entry, base, RDFLanguages.TURTLE, true);
+ }
+ if ( testType.equals(VocabLangRDF.TestNegativeEvalTTL) ) {
+ String base = rebase(input, assumedRootURITurtle) ;
+ return new RiotEvalTest(entry, base, RDFLanguages.TURTLE, false) ;
+ }
+
+ if ( testType.equals(VocabLangRDF.TestEvalTriG) ) {
+ String base = rebase(input, assumedRootURITriG) ;
+ return new RiotEvalTest(entry, base, RDFLanguages.TRIG, true) ;
+ }
+ if ( testType.equals(VocabLangRDF.TestNegativeEvalTriG) ) {
+ String base = rebase(input, assumedRootURITriG) ;
+ return new RiotEvalTest(entry, base, RDFLanguages.TRIG, false) ;
+ }
+
+ if ( testType.equals(VocabLangRDF.TestEvalNT) ) {
+ String base = entry.getAction().getURI();//rebase(input, assumedRootURI) ;
+ return new RiotEvalTest(entry, base, RDFLanguages.NTRIPLES, true) ;
+ }
+ if ( testType.equals(VocabLangRDF.TestNegativeEvalNT) ) {
+ String base = entry.getAction().getURI();//rebase(input, assumedRootURI) ;
+ return new RiotEvalTest(entry, base, RDFLanguages.NTRIPLES, false) ;
+ }
+
+ if ( testType.equals(VocabLangRDF.TestEvalRJ) ) {
+ String base = rebase(input, assumedRootURIex) ;
+ return new RiotEvalTest(entry, base, RDFLanguages.RDFJSON, true);
+ }
+// if ( testType.equals(VocabLangRDF.TestNegativeEvalRJ) ) {
+// String base = rebase(input, assumedRootURIex) ;
+// return new EvalTest(entry, base, RDFLanguages.RDFJSON, false);
+// }
+
+ System.err.println("Unrecognized test : ("+testType+")" + testName) ;
+ return new SurpressedTest() ;
+
+ } catch (Exception ex)
+ {
+ ex.printStackTrace(System.err) ;
+ System.err.println("Failed to grok test : " + testName) ;
+ return null ;
+ }
+ }
+
+ private static String rebase(Resource input, String baseIRI) {
+ String x = input.getLocalName() ;
+ // Yuk, yuk, yuk.
+ baseIRI = baseIRI+x ;
+ return baseIRI ;
+ }
+}
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TS_ScriptsTDB2.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/SurpressedTest.java
similarity index 79%
rename from jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TS_ScriptsTDB2.java
rename to jena-arq/src/test/java/org/apache/jena/arq/junit/riot/SurpressedTest.java
index 73c2094..a38b0f9 100644
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TS_ScriptsTDB2.java
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/SurpressedTest.java
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -16,14 +16,14 @@
* limitations under the License.
*/
-package org.apache.jena.tdb2;
+package org.apache.jena.arq.junit.riot;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+public class SurpressedTest implements Runnable
+{
+ public SurpressedTest()
+ { }
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
- TestScriptsTDB2.class
-})
-
-public class TS_ScriptsTDB2 {}
+ @Override
+ public void run()
+ { }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/VocabLangRDF.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/VocabLangRDF.java
new file mode 100644
index 0000000..642fb35
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/VocabLangRDF.java
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit.riot;
+
+import org.apache.jena.rdf.model.Model ;
+import org.apache.jena.rdf.model.ModelFactory ;
+import org.apache.jena.rdf.model.Resource ;
+
+public class VocabLangRDF
+{
+ public static String assumedBaseURI = "http://example/base/" ;
+
+ /** <p>The RDF model that holds the vocabulary terms</p> */
+ private static Model m_model = ModelFactory.createDefaultModel();
+
+ /** <p>The namespace of the vocabulary as a string</p> */
+ public static final String NS = "http://www.w3.org/ns/rdftest#" ;
+
+ /** <p>The namespace of the vocabulary as a string</p>
+ * @see #NS */
+ public static String getURI() {return NS;}
+
+ /** <p>The namespace of the vocabulary as a resource</p> */
+ public static final Resource NAMESPACE = m_model.createResource( NS );
+
+ public static final Resource TestPositiveSyntaxTTL = m_model.createResource( NS+"TestTurtlePositiveSyntax" );
+
+ public static final Resource TestNegativeSyntaxTTL = m_model.createResource( NS+"TestTurtleNegativeSyntax" );
+
+ public static final Resource TestEvalTTL = m_model.createResource( NS+"TestTurtleEval" );
+
+ public static final Resource TestNegativeEvalTTL = m_model.createResource( NS+"TestTurtleNegativeEval" );
+
+ public static final Resource TestPositiveSyntaxNT = m_model.createResource( NS+"TestNTriplesPositiveSyntax" );
+
+ public static final Resource TestNegativeSyntaxNT = m_model.createResource( NS+"TestNTriplesNegativeSyntax" );
+
+ public static final Resource TestEvalNT = m_model.createResource( NS+"TestNTriplesEval" );
+
+ public static final Resource TestNegativeEvalNT = m_model.createResource( NS+"TestNTriplesNegativeEval" );
+
+ public static final Resource TestPositiveSyntaxRJ = m_model.createResource( NS+"TestRDFJSONPositiveSyntax" );
+
+ public static final Resource TestNegativeSyntaxRJ = m_model.createResource( NS+"TestRDFJSONNegativeSyntax" );
+
+ public static final Resource TestEvalRJ = m_model.createResource( NS+"TestRDFJSONEval" );
+
+ public static final Resource TestNegativeEvalRJ = m_model.createResource( NS+"TestRDFJSONNegativeEval" );
+
+ public static final Resource TestPositiveSyntaxNQ = m_model.createResource( NS+"TestNQuadsPositiveSyntax" );
+
+ public static final Resource TestNegativeSyntaxNQ = m_model.createResource( NS+"TestNQuadsNegativeSyntax" );
+
+ public static final Resource TestEvalNQ = m_model.createResource( NS+"TestNQuadsEval" );
+
+ public static final Resource TestNegativeEvalNQ = m_model.createResource( NS+"TestNQuadsNegativeEval" );
+
+ public static final Resource TestPositiveSyntaxTriG = m_model.createResource( NS+"TestTrigPositiveSyntax" );
+
+ public static final Resource TestNegativeSyntaxTriG = m_model.createResource( NS+"TestTrigNegativeSyntax" );
+
+ public static final Resource TestEvalTriG = m_model.createResource( NS+"TestTrigEval" );
+
+ public static final Resource TestNegativeEvalTriG = m_model.createResource( NS+"TestTrigNegativeEval" );
+
+ public static final Resource TestSurpressed = m_model.createResource( NS+"Test" );
+}
+
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/AbstractRunnerOfTests.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/AbstractRunnerOfTests.java
new file mode 100644
index 0000000..c1ee961
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/AbstractRunnerOfTests.java
@@ -0,0 +1,175 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+package org.apache.jena.arq.junit.runners;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.function.Function;
+
+import org.apache.jena.arq.junit.manifest.*;
+import org.apache.jena.atlas.io.IndentedWriter;
+import org.apache.jena.sparql.junit.EarlReport;
+import org.junit.runner.Description;
+import org.junit.runner.Runner;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.ParentRunner;
+import org.junit.runners.model.InitializationError;
+
+/**
+ * Common super class for {@code @Runner(....)}.
+ * <p>
+ * Creates a runner for a manifest that has children for each included manifest and
+ * each test defined in the manifest. It follow included manifests Annotations
+ * supported:
+ * <ul>
+ * <li><tt>@Label("Some name")</tt></li>
+ * <li><tt>@Manifests({"manifest1","manifest2",...})</tt></li>
+ * </ul>
+ * This class sorts out the annotations, including providing before/after class, then
+ * creates a hierarchy of tests to run.
+ *
+ * @see RunnerOneTest
+ */
+public abstract class AbstractRunnerOfTests extends ParentRunner<Runner> {
+ private Description description;
+ private List<Runner> children = new ArrayList<>();
+
+ // Need unique names.
+
+ public AbstractRunnerOfTests(Class<? > klass, Function<ManifestEntry, Runnable> maker) throws InitializationError {
+ super(klass);
+ String label = getLabel(klass);
+ if ( label == null )
+ label = klass.getName();
+ String prefix = getPrefix(klass);
+ String[] manifests = getManifests(klass);
+ if ( manifests.length == 0 )
+ //System.err.println("No manifests: "+label);
+ throw new InitializationError("No manifests");
+ description = Description.createSuiteDescription(label);
+
+ for ( String manifestFile : manifests ) {
+ //System.out.println("** "+klass.getSimpleName()+" -- "+manifestFile);
+ if ( PrintManifests ) {
+ out.println("** "+klass.getSimpleName()+" -- "+manifestFile);
+ out.incIndent();
+ }
+ Manifest manifest = Manifest.parse(manifestFile);
+ if ( PrintManifests ) {
+ // Record manifests.
+ Manifest.walk(manifest, m->out.println(m.getFileName()+" :: "+m.getName()), e->{});
+ }
+ Runner runner = build(null, manifest, maker, prefix);
+ description.addChild(runner.getDescription());
+ children.add(runner);
+ if ( PrintManifests )
+ out.decIndent();
+ }
+ if ( PrintManifests )
+ out.flush();
+ }
+
+ // Print all manifests, top level and included.
+ private static boolean PrintManifests = false;
+ private static IndentedWriter out = IndentedWriter.stdout;
+
+ /**
+ * Do one level of tests. test are {@link Runnable Runnables} that each succeed or fail with an exception.
+ */
+ public static RunnerOneManifest build(EarlReport report, Manifest manifest, Function<ManifestEntry, Runnable> maker, String prefix) {
+ Description description = Description.createSuiteDescription(manifest.getName());
+ if ( PrintManifests )
+ out.println(manifest.getFileName()+" :: "+manifest.getName());
+ RunnerOneManifest thisLevel = new RunnerOneManifest(manifest, description);
+
+ Iterator<String> sub = manifest.includedManifests();
+ while(sub.hasNext() ) {
+ if ( PrintManifests )
+ out.incIndent();
+
+ String mf = sub.next();
+ Manifest manifestSub = Manifest.parse(mf);
+ Runner runner = build(report, manifestSub, maker, prefix);
+ thisLevel.add(runner);
+ if ( PrintManifests )
+ out.decIndent();
+ }
+ prepareTests(report, thisLevel, manifest, maker, prefix);
+ return thisLevel;
+ }
+
+ public static void prepareTests(EarlReport report, RunnerOneManifest level, Manifest manifest, Function<ManifestEntry, Runnable> maker, String prefix) {
+ manifest.entries().forEach(entry->{
+ String label = entry.getName();
+ label = fixupName(label);
+ if ( prefix != null )
+ label = prefix+label;
+ Runnable runnable = maker.apply(entry);
+ if ( runnable != null ) {
+ Runner r = new RunnerOneTest(label, runnable, entry.getURI(), report);
+ level.add(r);
+ }
+ });
+ }
+
+ // Keep Eclipse happy.
+ public static String fixupName(String string) {
+ string = string.replace('(', '[');
+ string = string.replace(')', ']');
+ return string;
+ }
+
+ private static String getLabel(Class<? > klass) {
+ Label annotation = klass.getAnnotation(Label.class);
+ return ( annotation == null ) ? null : annotation.value();
+ }
+
+ private static String getPrefix(Class<? > klass) {
+ Prefix annotation = klass.getAnnotation(Prefix.class);
+ return ( annotation == null ) ? null : annotation.value();
+ }
+
+ private static String[] getManifests(Class<? > klass) throws InitializationError {
+ Manifests annotation = klass.getAnnotation(Manifests.class);
+ if ( annotation == null ) {
+ throw new InitializationError(String.format("class '%s' must have a @Manifests annotation", klass.getName()));
+ }
+ return annotation.value();
+ }
+
+ @Override
+ public Description getDescription() {
+ return description;
+ }
+
+ @Override
+ protected List<Runner> getChildren() {
+ return children;
+ }
+
+ @Override
+ protected Description describeChild(Runner child) {
+ return child.getDescription();
+ }
+
+ @Override
+ protected void runChild(Runner child, RunNotifier notifier) {
+ child.run(notifier);
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/RunnerOneManifest.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/RunnerOneManifest.java
new file mode 100644
index 0000000..3559b0e
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/RunnerOneManifest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit.runners;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.jena.arq.junit.manifest.Manifest;
+import org.junit.runner.Description;
+import org.junit.runner.Runner;
+import org.junit.runner.notification.RunNotifier;
+
+/** Runner for a manifest - children are added by "RunnerOfTests" */
+public class RunnerOneManifest extends Runner {
+ private Description description;
+ private List<Runner> tests = new ArrayList<>();
+ private Manifest manifest;
+
+ public RunnerOneManifest(Manifest manifest, Description description) {
+ this.manifest = manifest;
+ this.description = description;
+ }
+
+ @Override
+ public Description getDescription() {
+ return description;
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ //System.out.println("Manifest: "+getDescription().getDisplayName());
+ notifier.fireTestStarted(description);
+ tests.forEach(r -> r.run(notifier));
+ notifier.fireTestFinished(description);
+ }
+
+ public void add(Runner runner) {
+ description.addChild(runner.getDescription());
+ tests.add(runner);
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/RunnerOneTest.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/RunnerOneTest.java
new file mode 100644
index 0000000..c15044d
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/RunnerOneTest.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+package org.apache.jena.arq.junit.runners;
+
+import org.apache.jena.sparql.junit.EarlReport;
+import org.junit.AssumptionViolatedException;
+import org.junit.runner.Description;
+import org.junit.runner.Runner;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunNotifier;
+
+/**
+ * Run a single test.
+ */
+public class RunnerOneTest extends Runner
+{
+ static int count = 0;
+ private final Description description;
+ private final EarlReport report; // Optional.
+ private final Runnable testCase;
+ private final String testURI;
+ private final String name;
+
+ public RunnerOneTest(String name, Runnable test) {
+ this(name, test, null, null);
+ }
+
+ public RunnerOneTest(String name, Runnable test, String testURI, EarlReport report) {
+ this.name = name;
+ int count$ = (++count);
+ testCase = test;
+ // Names must be unique else Eclipse will not report them.
+ description = Description.createSuiteDescription("T-"+count$+": "+name);
+
+ // Optional.
+ this.testURI = testURI;
+ this.report = report;
+ }
+
+ @Override
+ public Description getDescription() {
+ return description;
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ notifier.fireTestStarted(description);
+ try {
+ testCase.run();
+ if ( report != null )
+ report.success(testURI);
+ } catch (AssumptionViolatedException e) {
+ notifier.fireTestAssumptionFailed(new Failure(description, e));
+// } catch (AssertionFailedError ex) {
+// // JUnit assertion or fail()
+// if ( report != null )
+// report.failure(testURI);
+// notifier.fireTestFailure(new Failure(description, ex));
+ } catch (Throwable ex) {
+ if ( report != null )
+ report.failure(testURI);
+ notifier.fireTestFailure(new Failure(description, ex));
+ } finally {
+ notifier.fireTestFinished(description);
+ }
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/RunnerRIOT.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/RunnerRIOT.java
new file mode 100644
index 0000000..a392eb8
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/RunnerRIOT.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+package org.apache.jena.arq.junit.runners;
+
+import org.apache.jena.arq.junit.riot.RiotTests;
+import org.junit.runners.model.InitializationError;
+
+/**
+ * Runner for SPARQL Manifests. Annotations supported:
+ * <ul>
+ * <li><tt>@Label("Some name")</tt></li>
+ * <li><tt>@Manifests({"manifest1","manifest2",...})</tt></li>
+ * </ul>
+ * This class sorts out the annotations, including providing before/after class, then
+ * creates a hierarchy of tests to run.
+ *
+ * @see RunnerOneTest
+ */
+public class RunnerRIOT extends AbstractRunnerOfTests {
+ public RunnerRIOT(Class<? > klass) throws InitializationError {
+ super(klass, RiotTests::makeRIOTTest);
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/RunnerSPARQL.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/RunnerSPARQL.java
new file mode 100644
index 0000000..aee59b5
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/runners/RunnerSPARQL.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+package org.apache.jena.arq.junit.runners;
+
+import org.apache.jena.arq.junit.sparql.SparqlTests;
+import org.junit.runners.model.InitializationError;
+
+/**
+ * Runner for SPARQL Manifests. Annotations supported:
+ * <ul>
+ * <li><tt>@Label("Some name")</tt></li>
+ * <li><tt>@Manifests({"manifest1","manifest2",...})</tt></li>
+ * </ul>
+ * This class sorts out the annotations, including providing before/after class, then
+ * creates a hierarchy of tests to run.
+ *
+ * @see RunnerOneTest
+ */
+public class RunnerSPARQL extends AbstractRunnerOfTests {
+
+ public RunnerSPARQL(Class<? > klass) throws InitializationError {
+ super(klass, SparqlTests::makeSPARQLTest);
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/SparqlTests.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/SparqlTests.java
new file mode 100644
index 0000000..cfe1069
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/SparqlTests.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit.sparql;
+
+import org.apache.jena.arq.junit.manifest.ManifestEntry;
+import org.apache.jena.arq.junit.sparql.tests.*;
+import org.apache.jena.atlas.lib.Creator;
+import org.apache.jena.atlas.logging.Log;
+import org.apache.jena.query.Dataset;
+import org.apache.jena.query.Syntax;
+import org.apache.jena.rdf.model.Resource;
+import org.apache.jena.sparql.junit.QueryTestException;
+import org.apache.jena.sparql.vocabulary.TestManifest;
+import org.apache.jena.sparql.vocabulary.TestManifestUpdate_11;
+import org.apache.jena.sparql.vocabulary.TestManifestX;
+import org.apache.jena.sparql.vocabulary.TestManifest_11;
+
+public class SparqlTests {
+
+ static public Runnable makeSPARQLTest(ManifestEntry entry) {
+ if ( entry.getAction() == null )
+ {
+ System.out.println("Null action: "+entry) ;
+ return null ;
+ }
+
+ // Defaults.
+ Syntax querySyntax = Syntax.syntaxSPARQL_11; // TestQueryUtils.getQuerySyntax(manifest) ;
+
+ if ( querySyntax != null )
+ {
+ if ( ! querySyntax.equals(Syntax.syntaxARQ) &&
+ ! querySyntax.equals(Syntax.syntaxSPARQL_10) &&
+ ! querySyntax.equals(Syntax.syntaxSPARQL_11) )
+ throw new QueryTestException("Unknown syntax: "+querySyntax) ;
+ }
+
+ Resource testType = entry.getTestType() ;
+ if ( testType == null )
+ testType = TestManifest.QueryEvaluationTest;
+
+ if ( testType != null )
+ {
+ // == Good syntax
+ if ( testType.equals(TestManifest.PositiveSyntaxTest) )
+ return new QuerySyntaxTest(entry, querySyntax, true);
+ if ( testType.equals(TestManifest_11.PositiveSyntaxTest11) )
+ return new QuerySyntaxTest(entry, Syntax.syntaxSPARQL_11, true) ;
+ if ( testType.equals(TestManifestX.PositiveSyntaxTestARQ) )
+ return new QuerySyntaxTest(entry, Syntax.syntaxARQ, true) ;
+
+ // == Bad
+ if ( testType.equals(TestManifest.NegativeSyntaxTest) )
+ return new QuerySyntaxTest(entry, querySyntax, false) ;
+ if ( testType.equals(TestManifest_11.NegativeSyntaxTest11) )
+ return new QuerySyntaxTest(entry, Syntax.syntaxSPARQL_11, false) ;
+ if ( testType.equals(TestManifestX.NegativeSyntaxTestARQ) )
+ return new QuerySyntaxTest(entry, Syntax.syntaxARQ, false) ;
+
+ // ---- Update tests
+ if ( testType.equals(TestManifest_11.PositiveUpdateSyntaxTest11) )
+ return new UpdateSyntaxTest(entry, querySyntax, true) ;
+ if ( testType.equals(TestManifestX.PositiveUpdateSyntaxTestARQ) )
+ return new UpdateSyntaxTest(entry, Syntax.syntaxARQ, true) ;
+
+ if ( testType.equals(TestManifest_11.NegativeUpdateSyntaxTest11) )
+ return new UpdateSyntaxTest(entry, querySyntax, false) ;
+ if ( testType.equals(TestManifestX.NegativeUpdateSyntaxTestARQ) )
+ return new UpdateSyntaxTest(entry, Syntax.syntaxARQ, false) ;
+
+ //---- Query Evaluation Tests
+ if ( testType.equals(TestManifest.QueryEvaluationTest) )
+ return new QueryExecTest(entry) ;
+ if ( testType.equals(TestManifestX.TestQuery) )
+ return new QueryExecTest(entry) ;
+
+ // ---- Update Evaluation tests
+ if ( testType.equals(TestManifestUpdate_11.UpdateEvaluationTest) )
+ return new UpdateExecTest(entry);
+ if ( testType.equals(TestManifest_11.UpdateEvaluationTest) )
+ return new UpdateExecTest(entry);
+
+ // ---- Other
+
+ if ( testType.equals(TestManifestX.TestSerialization) )
+ return new SerializationTest(entry) ;
+
+ // Reduced is funny.
+ if ( testType.equals(TestManifest.ReducedCardinalityTest) )
+ return new QueryExecTest(entry);
+
+ if ( testType.equals(TestManifestX.TestSurpressed) )
+ return new SurpressedTest(entry);
+
+ if ( testType.equals(TestManifest_11.CSVResultFormatTest) )
+ {
+ Log.warn("Tests", "Skip CSV test: "+entry.getName()) ;
+ return null ;
+ }
+
+ System.err.println("Test type '"+testType+"' not recognized") ;
+ }
+ // Default.
+ System.err.println("Warning: test has not test type : "+entry.getURI());
+ return new QueryExecTest(entry);
+ }
+
+ /** Make tests, execution only */
+ static public Runnable makeSPARQLTestExecOnly(ManifestEntry entry, Creator<Dataset> maker) {
+ Resource testType = entry.getTestType() ;
+ if ( testType == null )
+ testType = TestManifest.QueryEvaluationTest;
+
+ if ( testType != null )
+ {
+ //-- Query Evaluation Tests
+ if ( testType.equals(TestManifest.QueryEvaluationTest) )
+ return new QueryExecTest(entry, maker) ;
+ if ( testType.equals(TestManifestX.TestQuery) )
+ return new QueryExecTest(entry, maker) ;
+
+// // -- Update Evaluation tests
+// if ( testType.equals(TestManifestUpdate_11.UpdateEvaluationTest) )
+// return new UpdateExecTest(entry, maker);
+// if ( testType.equals(TestManifest_11.UpdateEvaluationTest) )
+// return new UpdateExecTest(entry, maker);
+// if ( testType.equals(TestManifestX.TestSurpressed) )
+// return new SurpressedTest(entry);
+ }
+ return null;
+
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/QueryExecTest.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/QueryExecTest.java
new file mode 100644
index 0000000..40f51c2
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/QueryExecTest.java
@@ -0,0 +1,457 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit.sparql.tests;
+
+import static org.apache.jena.arq.junit.sparql.tests.SparqlTestLib.setupFailure;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.jena.arq.junit.manifest.ManifestEntry;
+import org.apache.jena.atlas.lib.Creator;
+import org.apache.jena.atlas.logging.Log;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.NodeFactory;
+import org.apache.jena.query.*;
+import org.apache.jena.rdf.model.*;
+import org.apache.jena.riot.Lang;
+import org.apache.jena.riot.RDFDataMgr;
+import org.apache.jena.riot.system.IRIResolver;
+import org.apache.jena.shared.JenaException;
+import org.apache.jena.sparql.SystemARQ;
+import org.apache.jena.sparql.core.Var;
+import org.apache.jena.sparql.engine.QueryIterator;
+import org.apache.jena.sparql.engine.ResultSetStream;
+import org.apache.jena.sparql.engine.binding.Binding;
+import org.apache.jena.sparql.engine.binding.BindingFactory;
+import org.apache.jena.sparql.engine.binding.BindingMap;
+import org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper;
+import org.apache.jena.sparql.expr.nodevalue.NodeFunctions;
+import org.apache.jena.sparql.junit.QueryTestException;
+import org.apache.jena.sparql.resultset.ResultSetCompare;
+import org.apache.jena.sparql.resultset.SPARQLResult;
+import org.apache.jena.sparql.util.IsoMatcher;
+import org.apache.jena.sparql.vocabulary.ResultSetGraphVocab;
+import org.apache.jena.sparql.vocabulary.TestManifest;
+import org.apache.jena.system.Txn;
+import org.apache.jena.util.FileUtils;
+import org.apache.jena.vocabulary.RDF;
+
+public class QueryExecTest implements Runnable {
+
+ private final ManifestEntry testEntry;
+ private final SPARQLResult results;
+ private final QueryTestItem testItem;
+ private final Creator<Dataset> creator;
+
+ public QueryExecTest(ManifestEntry entry, Creator<Dataset> maker) {
+ testEntry = entry;
+ testItem = QueryTestItem.create(testEntry.getEntry(), TestManifest.QueryEvaluationTest);
+ results = testItem.getResults();
+ creator = maker;
+ }
+
+ public QueryExecTest(ManifestEntry entry) {
+ this(entry, ()->DatasetFactory.createGeneral());
+ }
+
+ @Override
+ public void run() {
+ Query query;
+ try {
+ try {
+ query = SparqlTestLib.queryFromEntry(testEntry);
+ } catch (QueryException qEx) {
+ qEx.printStackTrace(System.err);
+ setupFailure("Parse failure: " + qEx.getMessage());
+ throw qEx;
+ }
+
+ Dataset dataset = setUpDataset(query, testItem);
+ if ( dataset == null && !doesQueryHaveDataset(query) )
+ setupFailure("No dataset for query");
+
+ if ( dataset != null )
+ Txn.executeRead(dataset, ()->execute(dataset,query));
+ else
+ execute(null,query);
+ } catch (NullPointerException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ ex.printStackTrace(System.err);
+ setupFailure("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
+ }
+ }
+
+ private void execute(Dataset dataset, Query query) {
+ try (QueryExecution qe = (dataset == null)
+ ? QueryExecutionFactory.create(query)
+ : QueryExecutionFactory.create(query, dataset)) {
+ if ( query.isSelectType() )
+ runTestSelect(query, qe);
+ else if ( query.isConstructType() )
+ runTestConstruct(query, qe);
+ else if ( query.isDescribeType() )
+ runTestDescribe(query, qe);
+ else if ( query.isAskType() )
+ runTestAsk(query, qe);
+ else if ( query.isJsonType() )
+ throw new UnsupportedOperationException("JSON {} queries not supported");
+ }
+ }
+
+ protected Dataset setUpDataset(Query query, QueryTestItem testItem) {
+ try {
+ // testItem.requiresTextIndex()
+
+ if ( doesQueryHaveDataset(query) && doesTestItemHaveDataset(testItem) ) {
+ // Only warn if there are results to test
+ // Syntax tests may have FROM etc and a manifest data file.
+ if ( testItem.getResultFile() != null )
+ Log.warn(this, testItem.getName() + " : query data source and also in test file");
+ }
+
+ // In test file?
+ if ( doesTestItemHaveDataset(testItem) )
+ // Not specified in the query - get from test item and load
+ return createDataset(testItem.getDefaultGraphURIs(), testItem.getNamedGraphURIs());
+
+ if ( !doesQueryHaveDataset(query) )
+ setupFailure("No dataset");
+
+ // Left to query
+ return null;
+
+ } catch (JenaException jEx) {
+ setupFailure("JenaException creating data source: " + jEx.getMessage());
+ return null;
+ }
+ }
+
+ protected Dataset createEmptyDataset() {
+ return creator.create();
+ }
+
+ private static boolean doesTestItemHaveDataset(QueryTestItem testItem) {
+ boolean r = (testItem.getDefaultGraphURIs() != null && testItem.getDefaultGraphURIs().size() > 0)
+ || (testItem.getNamedGraphURIs() != null && testItem.getNamedGraphURIs().size() > 0);
+ return r;
+ }
+
+ private static boolean doesQueryHaveDataset(Query query) {
+ return query.hasDatasetDescription();
+ }
+
+ private Dataset createDataset(List<String> defaultGraphURIs, List<String> namedGraphURIs) {
+ // Allow "qt:data" to be quads in defaultGraphURIs.
+ SystemARQ.UsePlainGraph = true;
+ try {
+ Dataset ds = createEmptyDataset();
+ Txn.executeWrite(ds, ()->{
+ if ( defaultGraphURIs != null ) {
+ for ( String sourceURI : defaultGraphURIs ) {
+ SparqlTestLib.parser(sourceURI).parse(ds);
+ }
+ }
+ if ( namedGraphURIs != null ) {
+ for ( String sourceURI : namedGraphURIs ) {
+ String absSourceURI = IRIResolver.resolveString(sourceURI);
+ SystemARQ.UsePlainGraph = true;
+ Model m = ds.getNamedModel(absSourceURI);
+ SparqlTestLib.parser(sourceURI).parse(m);
+ }
+ }
+ });
+ return ds;
+ }
+ finally {
+ SystemARQ.UsePlainGraph = false;
+ }
+
+ }
+
+ private void runTestSelect(Query query, QueryExecution qe) {
+ QueryTestItem testItem = QueryTestItem.create(testEntry.getEntry(), TestManifest.QueryEvaluationTest);
+ // Do the query!
+ ResultSetRewindable resultsActual = ResultSetFactory.makeRewindable(qe.execSelect());
+
+ qe.close();
+
+ if ( results == null )
+ return;
+
+ // Assumes resultSetCompare can cope with full isomorphism possibilities.
+ ResultSetRewindable resultsExpected;
+ if ( results.isResultSet() )
+ resultsExpected = ResultSetFactory.makeRewindable(results.getResultSet());
+ else if ( results.isModel() )
+ resultsExpected = ResultSetFactory.makeRewindable(results.getModel());
+ else {
+ fail("Wrong result type for SELECT query");
+ resultsExpected = null; // Keep the compiler happy
+ }
+
+ if ( query.isReduced() ) {
+ // Reduced - best we can do is DISTINCT
+ resultsExpected = unique(resultsExpected);
+ resultsActual = unique(resultsActual);
+ }
+
+ // Hack for CSV : tests involving bNodes need manually checking.
+ if ( testItem.getResultFile().endsWith(".csv") ) {
+ resultsActual = convertToStrings(resultsActual);
+ resultsActual.reset();
+
+ int nActual = ResultSetFormatter.consume(resultsActual);
+ int nExpected = ResultSetFormatter.consume(resultsExpected);
+ resultsActual.reset();
+ resultsExpected.reset();
+ assertEquals("CSV: Different number of rows", nExpected, nActual);
+ boolean b = resultSetEquivalent(query, resultsExpected, resultsActual);
+ if ( !b )
+ System.out.println("Manual check of CSV results required: " + testItem.getName());
+ return;
+ }
+
+ boolean b = resultSetEquivalent(query, resultsExpected, resultsActual);
+
+ if ( !b ) {
+ resultsExpected.reset();
+ resultsActual.reset();
+ boolean b2 = resultSetEquivalent(query, resultsExpected, resultsActual);
+ printFailedResultSetTest(query, qe, resultsExpected, resultsActual);
+ }
+ assertTrue("Results do not match", b);
+
+ return;
+ }
+
+ private ResultSetRewindable convertToStrings(ResultSetRewindable resultsActual) {
+ List<Binding> bindings = new ArrayList<>();
+ while (resultsActual.hasNext()) {
+ Binding b = resultsActual.nextBinding();
+ BindingMap b2 = BindingFactory.create();
+
+ for ( String vn : resultsActual.getResultVars() ) {
+ Var v = Var.alloc(vn);
+ Node n = b.get(v);
+ String s;
+ if ( n == null )
+ s = "";
+ else if ( n.isBlank() )
+ s = "_:" + n.getBlankNodeLabel();
+ else
+ s = NodeFunctions.str(n);
+ b2.add(v, NodeFactory.createLiteral(s));
+ }
+ bindings.add(b2);
+ }
+ ResultSet rs = new ResultSetStream(resultsActual.getResultVars(), null, new QueryIterPlainWrapper(bindings.iterator()));
+ return ResultSetFactory.makeRewindable(rs);
+ }
+
+ private static ResultSetRewindable unique(ResultSetRewindable results) {
+ // VERY crude. Utilises the fact that bindings have value equality.
+ List<Binding> x = new ArrayList<>();
+ Set<Binding> seen = new HashSet<>();
+
+ for ( ; results.hasNext() ; ) {
+ Binding b = results.nextBinding();
+ if ( seen.contains(b) )
+ continue;
+ seen.add(b);
+ x.add(b);
+ }
+ QueryIterator qIter = new QueryIterPlainWrapper(x.iterator());
+ ResultSet rs = new ResultSetStream(results.getResultVars(), ModelFactory.createDefaultModel(), qIter);
+ return ResultSetFactory.makeRewindable(rs);
+ }
+
+ private static boolean resultSetEquivalent(Query query, ResultSetRewindable resultsExpected, ResultSetRewindable resultsActual) {
+ final boolean testByValue = true;
+ if ( testByValue ) {
+ if ( query.isOrdered() )
+ return ResultSetCompare.equalsByValueAndOrder(resultsExpected, resultsActual);
+ else
+ return ResultSetCompare.equalsByValue(resultsExpected, resultsActual);
+ } else {
+ if ( query.isOrdered() )
+ return ResultSetCompare.equalsByTermAndOrder(resultsExpected, resultsActual);
+ else
+ return ResultSetCompare.equalsByTerm(resultsExpected, resultsActual);
+ }
+ }
+
+ private void runTestConstruct(Query query, QueryExecution qe) {
+ // Do the query!
+ if ( query.isConstructQuad() ) {
+ Dataset resultActual = qe.execConstructDataset();
+ compareDatasetResults(resultActual, query);
+ } else {
+ Model resultsActual = qe.execConstruct();
+ compareGraphResults(resultsActual, query);
+ }
+ }
+
+ private void compareGraphResults(Model resultsActual, Query query) {
+ if ( results != null ) {
+ try {
+ if ( !results.isGraph() )
+ SparqlTestLib.testFailure("Expected results are not a graph: " + testItem.getName());
+
+ Model resultsExpected = results.getModel();
+ if ( !resultsExpected.isIsomorphicWith(resultsActual) ) {
+ printFailedModelTest(query, resultsExpected, resultsActual);
+ fail("Results do not match: " + testItem.getName());
+ }
+ } catch (Exception ex) {
+ String typeName = (query.isConstructType() ? "construct" : "describe");
+ SparqlTestLib.testFailure("Exception in result testing (" + typeName + "): " + ex);
+ }
+ }
+ }
+
+ private void compareDatasetResults(Dataset resultsActual, Query query) {
+ if ( results != null ) {
+ try {
+ if ( !results.isDataset() )
+ SparqlTestLib.testFailure("Expected results are not a graph: " + testItem.getName());
+
+ Dataset resultsExpected = results.getDataset();
+ if ( !IsoMatcher.isomorphic(resultsExpected.asDatasetGraph(), resultsActual.asDatasetGraph()) ) {
+ printFailedDatasetTest(query, resultsExpected, resultsActual);
+ fail("Results do not match: " + testItem.getName());
+ }
+ } catch (Exception ex) {
+ String typeName = (query.isConstructType() ? "construct" : "describe");
+ fail("Exception in result testing (" + typeName + "): " + ex);
+ }
+ }
+ }
+
+ private void runTestDescribe(Query query, QueryExecution qe) {
+ Model resultsActual = qe.execDescribe();
+ compareGraphResults(resultsActual, query);
+ }
+
+ private void runTestAsk(Query query, QueryExecution qe) {
+ boolean result = qe.execAsk();
+ if ( results != null ) {
+ if ( results.isBoolean() ) {
+ boolean b = results.getBooleanResult();
+ assertEquals("ASK test results do not match", b, result);
+ } else {
+ Model resultsAsModel = results.getModel();
+ StmtIterator sIter = results.getModel().listStatements(null, RDF.type, ResultSetGraphVocab.ResultSet);
+ if ( !sIter.hasNext() )
+ throw new QueryTestException("Can't find the ASK result");
+ Statement s = sIter.nextStatement();
+ if ( sIter.hasNext() )
+ throw new QueryTestException("Too many result sets in ASK result");
+ Resource r = s.getSubject();
+ Property p = resultsAsModel.createProperty(ResultSetGraphVocab.getURI() + "boolean");
+
+ boolean x = r.getRequiredProperty(p).getBoolean();
+ if ( x != result )
+ assertEquals("ASK test results do not match", x, result);
+ }
+ }
+ return;
+ }
+
+ private void printFailedResultSetTest(Query query, QueryExecution qe, ResultSetRewindable qrExpected, ResultSetRewindable qrActual) {
+ PrintStream out = System.out;
+ out.println();
+ out.println("=======================================");
+ out.println("Failure: " + description());
+ out.println("Query: \n" + query);
+ if ( qe != null && qe.getDataset() != null ) {
+ out.println("Data:");
+ RDFDataMgr.write(out, qe.getDataset(), Lang.TRIG);
+ }
+ out.println("Got: " + qrActual.size() + " --------------------------------");
+ qrActual.reset();
+ ResultSetFormatter.out(out, qrActual, query.getPrefixMapping());
+ qrActual.reset();
+ out.flush();
+
+ out.println("Expected: " + qrExpected.size() + " -----------------------------");
+ qrExpected.reset();
+ ResultSetFormatter.out(out, qrExpected, query.getPrefixMapping());
+ qrExpected.reset();
+
+ out.println();
+ out.flush();
+ }
+
+ private void printFailedModelTest(Query query, Model expected, Model results) {
+ PrintWriter out = FileUtils.asPrintWriterUTF8(System.out);
+ out.println("=======================================");
+ out.println("Failure: " + description());
+ results.write(out, "TTL");
+ out.println("---------------------------------------");
+ expected.write(out, "TTL");
+ out.println();
+ }
+
+ private void printFailedDatasetTest(Query query, Dataset expected, Dataset results) {
+ System.out.println("=======================================");
+ System.out.println("Failure: " + description());
+ RDFDataMgr.write(System.out, results, Lang.TRIG);
+ System.out.println("---------------------------------------");
+ RDFDataMgr.write(System.out, expected, Lang.TRIG);
+ System.out.println();
+ }
+
+ @Override
+ public String toString() {
+ if ( testItem.getName() != null )
+ return testItem.getName();
+ return testEntry.getName();
+ }
+
+ // Cache
+ private String description() {
+ String tmp = "";
+ if ( testItem.getDefaultGraphURIs() != null ) {
+ for ( String s : testItem.getDefaultGraphURIs() ) {
+ tmp = tmp + s;
+ }
+ }
+ if ( testItem.getNamedGraphURIs() != null ) {
+ for ( String s : testItem.getNamedGraphURIs() ) {
+ tmp = tmp + s;
+ }
+ }
+
+ String d = "Test " + testItem.getName();
+ // String d = "Test "+testNumber+" :: "+testItem.getName();
+ // +" :: QueryFile="+testItem.getQueryFile()+
+ // ", DataFile="+tmp+", ResultsFile="+testItem.getResultFile();
+ return d;
+ }
+
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/QuerySyntaxTest.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/QuerySyntaxTest.java
new file mode 100644
index 0000000..3327c3e
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/QuerySyntaxTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit.sparql.tests;
+
+import static org.junit.Assert.fail;
+
+import org.apache.jena.arq.junit.manifest.ManifestEntry;
+import org.apache.jena.query.Query;
+
+//import java.io.IOException;
+
+import org.apache.jena.query.QueryException;
+import org.apache.jena.query.Syntax;
+
+public class QuerySyntaxTest implements Runnable {
+ final boolean expectLegalSyntax;
+ final ManifestEntry testEntry;
+
+ public QuerySyntaxTest(ManifestEntry entry, Syntax defSyntax, boolean positiveTest) {
+ testEntry = entry;
+ expectLegalSyntax = positiveTest;
+ }
+
+ @Override
+ public void run() {
+ try {
+ Query query = SparqlTestLib.queryFromEntry(testEntry);
+ if ( !expectLegalSyntax )
+ fail("Expected parse failure");
+ } catch (QueryException qEx) {
+ if ( expectLegalSyntax )
+ throw qEx;
+ // Expected a failure.
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ fail("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
+ }
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/junit/TestItem.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/QueryTestItem.java
similarity index 86%
copy from jena-arq/src/test/java/org/apache/jena/sparql/junit/TestItem.java
copy to jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/QueryTestItem.java
index 9c3b43e..47707e5 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/junit/TestItem.java
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/QueryTestItem.java
@@ -16,34 +16,38 @@
* limitations under the License.
*/
-package org.apache.jena.sparql.junit ;
+package org.apache.jena.arq.junit.sparql.tests ;
import java.util.ArrayList;
import java.util.List;
+import org.apache.jena.arq.junit.LibTestSetup;
+import org.apache.jena.graph.Graph;
import org.apache.jena.query.Dataset;
import org.apache.jena.query.ResultSetFactory;
import org.apache.jena.query.Syntax;
import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.rdf.model.Statement;
import org.apache.jena.riot.RDFDataMgr;
+import org.apache.jena.sparql.graph.GraphFactory;
+import org.apache.jena.sparql.junit.QueryTestException;
import org.apache.jena.sparql.resultset.ResultsFormat;
import org.apache.jena.sparql.resultset.SPARQLResult;
import org.apache.jena.sparql.vocabulary.TestManifest;
import org.apache.jena.sparql.vocabulary.TestManifestX;
import org.apache.jena.sparql.vocabulary.VocabTestQuery;
import org.apache.jena.util.iterator.ClosableIterator;
-import org.apache.jena.util.junit.TestException;
-import org.apache.jena.util.junit.TestUtils;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
/**
- * Wrapper class for individual test items. Assumes it is a query test item,
- * using both the manifest vocabulary and the test query vocabulary.
+ * Parse out details for a query evaluation test.
+ * There are a lot of details so move out all
+ * the parse/extract details in this class.
*/
-public class TestItem
+public class QueryTestItem
{
static int counter = 0 ;
@@ -65,15 +69,15 @@
private String queryFile ;
private Syntax queryFileSyntax ;
- public static TestItem create(Resource entry, Resource defaultTestType) {
- return new TestItem(entry, defaultTestType) ;
+ public static QueryTestItem create(Resource entry, Resource defaultTestType) {
+ return new QueryTestItem(entry, defaultTestType) ;
}
- public static TestItem create(String _name, String _queryFile, String _dataFile, String _resultFile) {
- return new TestItem(_name, _queryFile, _dataFile, _resultFile) ;
+ public static QueryTestItem create(String _name, String _queryFile, String _dataFile, String _resultFile) {
+ return new QueryTestItem(_name, _queryFile, _dataFile, _resultFile) ;
}
- private TestItem(Resource entry, Resource defaultTestType) {
+ private QueryTestItem(Resource entry, Resource defaultTestType) {
testResource = entry ;
if ( !entry.hasProperty(TestManifest.name) )
@@ -84,7 +88,7 @@
throw new QueryTestException("TestItem '" + name + "' with no action") ;
// Assumes one type per test only.
- testType = TestUtils.getResource(entry, RDF.type) ;
+ testType = LibTestSetup.getResource(entry, RDF.type) ;
if ( testType == null )
testType = defaultTestType ;
@@ -99,7 +103,7 @@
buildLuceneIndex = _getTextIndex() ;
}
- private TestItem(String _name, String _queryFile, String _dataFile, String _resultFile) {
+ private QueryTestItem(String _name, String _queryFile, String _dataFile, String _resultFile) {
name = _name ;
queryFile = _queryFile ;
defaultGraphURIs = new ArrayList<>() ;
@@ -149,7 +153,10 @@
ResultsFormat format = ResultsFormat.guessSyntax(resultFile) ;
if ( ResultsFormat.isRDFGraphSyntax(format) ) {
- Model m = RDFDataMgr.loadModel(resultFile) ;
+ // Load plain.
+ Graph g = GraphFactory.createPlainGraph();
+ SparqlTestLib.parser(resultFile).parse(g);
+ Model m = ModelFactory.createModelForGraph(g);
return new SPARQLResult(m) ;
}
@@ -218,8 +225,8 @@
try {
// It's bnode in some update tests.
// The Update test code managed building the result.
- return TestUtils.getLiteralOrURI(testResource, TestManifest.result) ;
- } catch (TestException ex) { return null ; }
+ return LibTestSetup.getLiteralOrURI(testResource, TestManifest.result) ;
+ } catch (RuntimeException ex) { return null ; }
}
private String _getComment() {
@@ -290,7 +297,7 @@
Resource r = _getAction() ;
if ( r.hasProperty(VocabTestQuery.query) )
- return TestUtils.getLiteralOrURI(r, VocabTestQuery.query) ;
+ return LibTestSetup.getLiteralOrURI(r, VocabTestQuery.query) ;
// No query property - must be this action node
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/junit/TestSerialization.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/SerializationTest.java
similarity index 63%
rename from jena-arq/src/test/java/org/apache/jena/sparql/junit/TestSerialization.java
rename to jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/SerializationTest.java
index df37aac..34bdc0f 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/junit/TestSerialization.java
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/SerializationTest.java
@@ -16,93 +16,68 @@
* limitations under the License.
*/
-package org.apache.jena.sparql.junit;
+package org.apache.jena.arq.junit.sparql.tests;
+import org.apache.jena.arq.junit.manifest.ManifestEntry;
import org.apache.jena.atlas.io.IndentedLineBuffer ;
import org.apache.jena.query.Query ;
import org.apache.jena.query.Syntax ;
import org.apache.jena.sparql.sse.SSEParseException ;
import org.apache.jena.sparql.util.QueryUtils ;
-public class TestSerialization extends EarlTestCase
+public class SerializationTest implements Runnable
{
static int count = 0 ;
String queryString ;
- TestItem testItem ;
-
- public TestSerialization(String testName, EarlReport earl, TestItem t)
- {
- super(testName, t.getURI(), earl) ;
- testItem = t ;
- }
+ ManifestEntry testEntry;
-// public SerializerTest(String queryString)
-// {
-// this(queryString, queryString) ;
-// }
-//
-// public SerializerTest(String testName, String queryString)
-// {
-// super(testName) ;
-// setTest(testName, queryString) ;
-// }
-
- private void setTest(String testName, EarlReport earl, String _queryString)
- {
- super.setName(testName) ;
- this.queryString = _queryString ;
+ public SerializationTest(ManifestEntry entry) {
+ testEntry = entry ;
}
-
// A serialization test is:
// Read query in.
// Serialize to string.
// Parse again.
// Are they equal?
-
+
@Override
- protected void runTestForReal()
+ public void run()
{
- Query query = null ;
- if ( queryString == null )
- query = queryFromTestItem(testItem) ;
- else
- query = queryFromString(queryString) ;
-
+ Query query = SparqlTestLib.queryFromEntry(testEntry);
// Whatever was read in.
runTestWorker(query, query.getSyntax()) ;
}
-
+
protected void runTestWorker(Query query, Syntax syntax)
{
IndentedLineBuffer buff = new IndentedLineBuffer() ;
query.serialize(buff, syntax) ;
String baseURI = null ;
-
+
if ( ! query.explicitlySetBaseURI() )
- // Not in query - use the same one (e.g. file read from) .
+ // Not in query - use the same one (e.g. file read from) .
baseURI = query.getBaseURI() ;
-
- // Query syntax and algebra tests.
-
+
+ // Query syntax and algebra tests.
+
try {
QueryUtils.checkParse(query) ;
- }
+ }
catch (RuntimeException ex)
{
- System.err.println("**** Test: "+getName()) ;
+ System.err.println("**** Test: "+testEntry.getName()) ;
System.err.println("** "+ex.getMessage()) ;
System.err.println(query) ;
- throw ex ;
+ throw ex ;
}
try {
QueryUtils.checkOp(query, true) ;
} catch (SSEParseException ex)
{
- System.err.println("**** Test: "+getName()) ;
+ System.err.println("**** Test: "+testEntry.getName()) ;
System.err.println("** Algebra error: "+ex.getMessage()) ;
}
}
-
}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/SparqlTestLib.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/SparqlTestLib.java
new file mode 100644
index 0000000..850c9ea
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/SparqlTestLib.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit.sparql.tests;
+
+import org.apache.jena.arq.junit.LibTestSetup;
+import org.apache.jena.arq.junit.manifest.ManifestEntry;
+import org.apache.jena.query.Query;
+import org.apache.jena.query.QueryFactory;
+import org.apache.jena.query.Syntax;
+import org.apache.jena.rdf.model.Resource;
+import org.apache.jena.riot.RDFParser;
+import org.apache.jena.riot.RDFParserBuilder;
+import org.apache.jena.riot.system.ErrorHandlerFactory;
+import org.apache.jena.sparql.vocabulary.TestManifestX;
+import org.apache.jena.sparql.vocabulary.VocabTestQuery;
+import org.apache.jena.update.UpdateFactory;
+import org.apache.jena.update.UpdateRequest;
+
+/** Misc code to make the tests clearer */
+class SparqlTestLib {
+
+ // Data Parser - no warnings.
+ static RDFParserBuilder parser(String sourceURI) {
+ return RDFParser.create().source(sourceURI).errorHandler(ErrorHandlerFactory.errorHandlerNoWarnings);
+ }
+
+ static void setupFailure(String msg) {
+ throw new RuntimeException(msg);
+ }
+
+ static void testFailure(String msg) {
+ throw new AssertionError(msg);
+ }
+
+ static private String queryFile(ManifestEntry entry) {
+ Resource r = entry.getAction();
+
+ if ( r.hasProperty(VocabTestQuery.query) )
+ return LibTestSetup.getLiteralOrURI(r, VocabTestQuery.query) ;
+
+ // No query property - must be this action node
+
+ if ( r.isAnon() )
+ return "[]" ;
+ return r.getURI() ;
+ }
+
+ static Query queryFromEntry(ManifestEntry entry) {
+ if ( queryFile(entry) == null ) {
+ SparqlTestLib.setupFailure("Query test file is null");
+ return null;
+ }
+
+ Query query = QueryFactory.read(queryFile(entry), null, querySyntax(entry, null));
+ return query;
+ }
+
+ private static Syntax querySyntax(ManifestEntry entry, Syntax def) {
+ Resource r = entry.getAction();
+ if ( r.hasProperty(TestManifestX.querySyntax) ) {
+ Syntax x = Syntax.make(r.getProperty(TestManifestX.querySyntax).getResource().getURI()) ;
+ return x ;
+ }
+ Resource q = r.getPropertyResourceValue(VocabTestQuery.query);
+ if ( q == null )
+ q = entry.getAction();
+
+ if ( q == null ) {
+ System.err.println("No query");
+ // Default on manifest?
+ return Syntax.syntaxSPARQL_11;
+ }
+
+ String uri = q.getURI();
+ if ( uri != null ) {
+ Syntax synFileName = guessFileSyntax(uri) ;
+ if ( synFileName != null )
+ return synFileName ;
+ }
+ return def ;
+ }
+
+ // *.rq is strictly SPARQL 1.1 tests.
+ protected static Syntax guessFileSyntax(String filename) {
+ if ( filename.endsWith(".rq") )
+ return Syntax.syntaxSPARQL_11;
+ if ( filename.endsWith(".ru") )
+ return Syntax.syntaxSPARQL_11;
+
+ return Syntax.guessFileSyntax(filename);
+ }
+//
+// static UpdateRequest updateFromString(String str) {
+// return UpdateFactory.create(str);
+// }
+//
+ static UpdateRequest updateFromEntry(ManifestEntry entry) {
+ if ( queryFile(entry) == null ) {
+ SparqlTestLib.setupFailure("Query test file is null");
+ return null;
+ }
+ String fn = queryFile(entry);
+ Syntax syntax = guessFileSyntax(fn);
+
+ UpdateRequest request = UpdateFactory.read(fn, syntax);
+ return request;
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/TC_SPARQL11.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/SurpressedTest.java
similarity index 64%
copy from jena-arq/src/test/java/org/apache/jena/sparql/TC_SPARQL11.java
copy to jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/SurpressedTest.java
index 42dcec8..176e8d1 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/TC_SPARQL11.java
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/SurpressedTest.java
@@ -16,22 +16,21 @@
* limitations under the License.
*/
-package org.apache.jena.sparql;
+package org.apache.jena.arq.junit.sparql.tests;
-import junit.framework.TestSuite ;
+import org.apache.jena.arq.junit.manifest.ManifestEntry;
-/**
- * The test suite for all SPARQL (the second SPARQL working group) approved tests.
- * These are actually covered by TC_Scripted.
- */
-public class TC_SPARQL11 extends TestSuite
-{
- static public TestSuite suite() { return new TC_SPARQL11(); }
+public class SurpressedTest implements Runnable {
+ public static boolean verbose = true;
+ private ManifestEntry testEntry;
- // SPARQL 1.1 test suite (when ready)
+ public SurpressedTest(ManifestEntry entry) {
+ this.testEntry = entry;
+ }
- public TC_SPARQL11()
- {
- super(TC_SPARQL11.class.getName()) ;
+ @Override
+ public void run() {
+ if ( verbose )
+ System.out.print("** Surpressed: " + testEntry.getName());
}
}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/UpdateExecTest.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/UpdateExecTest.java
new file mode 100644
index 0000000..46655eb
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/UpdateExecTest.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit.sparql.tests;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList ;
+import java.util.List ;
+
+import org.apache.jena.arq.junit.manifest.ManifestEntry;
+import org.apache.jena.atlas.iterator.Iter ;
+import org.apache.jena.atlas.lib.Creator;
+import org.apache.jena.query.Dataset ;
+import org.apache.jena.query.DatasetFactory ;
+import org.apache.jena.query.Syntax ;
+import org.apache.jena.rdf.model.*;
+import org.apache.jena.sparql.vocabulary.TestManifestUpdate_11 ;
+import org.apache.jena.update.UpdateAction ;
+import org.apache.jena.update.UpdateFactory ;
+import org.apache.jena.update.UpdateRequest ;
+import org.apache.jena.util.iterator.ClosableIterator ;
+import org.apache.jena.vocabulary.RDFS ;
+
+public class UpdateExecTest implements Runnable
+{
+ private final ManifestEntry testEntry;
+ private final Creator<Dataset> creator;
+
+ public UpdateExecTest(ManifestEntry entry) {
+ this(entry, ()->DatasetFactory.create());
+ }
+
+ public UpdateExecTest(ManifestEntry entry, Creator<Dataset> maker) {
+ this.testEntry = entry;
+ this.creator = maker;
+ }
+
+ @Override
+ public void run() {
+ Dataset input = getDataset(creator.create(), testEntry.getAction()) ;
+ Dataset output = getDataset(DatasetFactory.create(), testEntry.getResult()) ;
+
+ String updateFile = testEntry.getAction().getProperty(TestManifestUpdate_11.request).getResource().getURI() ;
+
+ UpdateRequest request = UpdateFactory.read(updateFile, Syntax.syntaxSPARQL_11) ;
+ UpdateAction.execute(request, input) ;
+ boolean b = datasetSame(input, output, false) ;
+ if ( ! b )
+ {
+ System.out.println("---- "+testEntry.getName()) ;
+ System.out.println("---- Got: ") ;
+ System.out.println(input.asDatasetGraph()) ;
+ System.out.println("---- Expected") ;
+ System.out.println(output.asDatasetGraph()) ;
+ datasetSame(input, output, true) ;
+ System.out.println("----------------------------------------") ;
+ }
+
+ assertTrue("Datasets are different", b) ;
+ }
+
+ private static boolean datasetSame(Dataset ds1, Dataset ds2, boolean verbose)
+ {
+ List<String> names1 = Iter.toList(ds1.listNames()) ;
+ List<String> names2 = Iter.toList(ds2.listNames()) ;
+
+ if ( ! names1.equals(names2) )
+ {
+ if ( verbose )
+ {
+ System.out.println("Different named graphs") ;
+ System.out.println(" "+names1) ;
+ System.out.println(" "+names2) ;
+ }
+ return false ;
+ }
+ if ( !ds1.getDefaultModel().isIsomorphicWith(ds2.getDefaultModel()) )
+ {
+ if ( verbose )
+ System.out.println("Default graphs differ") ;
+ return false ;
+ }
+
+ for ( String gn : names1 )
+ {
+ Model m1 = ds1.getNamedModel(gn) ;
+ Model m2 = ds2.getNamedModel(gn) ;
+ if ( ! m1.isIsomorphicWith(m2) )
+ {
+ if ( verbose )
+ System.out.println("Different on named graph "+gn) ;
+ return false ;
+ }
+ }
+ return true ;
+ }
+
+ static Dataset getDataset(Dataset ds, Resource r)
+ {
+ List<String> dftData = getAll(r, TestManifestUpdate_11.data) ;
+ for ( String x : dftData )
+ SparqlTestLib.parser(x).parse(ds.getDefaultModel());
+
+ ClosableIterator<Statement> cIter = r.listProperties(TestManifestUpdate_11.graphData) ;
+ for ( ; cIter.hasNext() ; )
+ {
+ // An graphData entry can be a URI or a [ ut ... ; rdfs:label "foo" ] ;
+ Statement stmt = cIter.next() ;
+ Resource gn = stmt.getResource() ;
+ if ( gn.isAnon() )
+ {
+ if ( ! gn.hasProperty(TestManifestUpdate_11.graph) )
+ System.err.println("No data for graphData") ;
+
+ String fn = gn.getProperty(TestManifestUpdate_11.graph).getResource().getURI() ;
+ String name = gn.getProperty(RDFS.label).getString() ;
+ Model m = ModelFactory.createDefaultModel();
+ SparqlTestLib.parser(fn).parse(m);
+ ds.addNamedModel(name, m) ;
+ }
+ else
+ {
+ String x = gn.getURI() ;
+ Model m = ModelFactory.createDefaultModel();
+ SparqlTestLib.parser(x).parse(m);
+ ds.addNamedModel(x, m) ;
+ }
+ }
+ cIter.close() ;
+ return ds ;
+ }
+
+ static List<String> getAll(Resource r, Property p)
+ {
+ List<String> l = new ArrayList<>() ;
+ ClosableIterator<Statement> cIter = r.listProperties(p) ;
+ for ( ; cIter.hasNext() ; )
+ {
+ Statement stmt = cIter.next() ;
+ String df = stmt.getObject().asResource().getURI() ;
+ l.add(df) ;
+ }
+ cIter.close() ;
+ return l ;
+ }
+
+
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/UpdateSyntaxTest.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/UpdateSyntaxTest.java
new file mode 100644
index 0000000..4764d27
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/tests/UpdateSyntaxTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.arq.junit.sparql.tests;
+
+import static org.junit.Assert.fail;
+
+import org.apache.jena.arq.junit.manifest.ManifestEntry;
+import org.apache.jena.query.QueryException ;
+import org.apache.jena.query.Syntax;
+
+public class UpdateSyntaxTest implements Runnable
+{
+ static int count = 0 ;
+ final boolean expectLegalSyntax ;
+ final ManifestEntry testEntry ;
+
+ public UpdateSyntaxTest(ManifestEntry entry, Syntax defSyntax, boolean positiveTest) {
+ testEntry = entry;
+ expectLegalSyntax = positiveTest ;
+ }
+
+ @Override
+ public void run()
+ {
+ try {
+ SparqlTestLib.updateFromEntry(testEntry) ;
+ if ( ! expectLegalSyntax )
+ fail("Expected parse failure") ;
+ }
+ catch (QueryException qEx)
+ {
+ if ( expectLegalSyntax )
+ throw qEx ;
+ }
+
+ catch (Exception ex)
+ {
+ fail( "Exception: "+ex.getClass().getName()+": "+ex.getMessage()) ;
+ }
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/legacy/TC_Atlas_ARQ.java b/jena-arq/src/test/java/org/apache/jena/atlas/TC_Atlas_ARQ.java
similarity index 91%
rename from jena-arq/src/test/java/org/apache/jena/atlas/legacy/TC_Atlas_ARQ.java
rename to jena-arq/src/test/java/org/apache/jena/atlas/TC_Atlas_ARQ.java
index a923aa6..0251e78 100644
--- a/jena-arq/src/test/java/org/apache/jena/atlas/legacy/TC_Atlas_ARQ.java
+++ b/jena-arq/src/test/java/org/apache/jena/atlas/TC_Atlas_ARQ.java
@@ -16,13 +16,13 @@
* limitations under the License.
*/
-package org.apache.jena.atlas.legacy;
+package org.apache.jena.atlas;
import org.apache.jena.atlas.csv.TS_CSVParser;
import org.apache.jena.atlas.data.TS_Data ;
import org.apache.jena.atlas.event.TS_Event ;
import org.apache.jena.atlas.json.TS_JSON ;
-import org.apache.jena.atlas.web.TS_Web ;
+import org.apache.jena.atlas.web.TS_Altas_Web ;
import org.junit.runner.RunWith ;
import org.junit.runners.Suite ;
@@ -31,7 +31,7 @@
TS_Event.class
, TS_JSON.class
, TS_Data.class
- , TS_Web.class
+ , TS_Altas_Web.class
, TS_CSVParser.class
})
diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/data/TS_Data.java b/jena-arq/src/test/java/org/apache/jena/atlas/data/TS_Data.java
index a9ccff9..d7e4610 100644
--- a/jena-arq/src/test/java/org/apache/jena/atlas/data/TS_Data.java
+++ b/jena-arq/src/test/java/org/apache/jena/atlas/data/TS_Data.java
@@ -18,8 +18,6 @@
package org.apache.jena.atlas.data;
-import junit.framework.JUnit4TestAdapter ;
-
import org.junit.runner.RunWith ;
import org.junit.runners.Suite ;
import org.junit.runners.Suite.SuiteClasses ;
@@ -34,9 +32,4 @@
})
public class TS_Data
-{
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter(TS_Data.class) ;
- }
-}
+{}
diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/legacy/BaseTest2.java b/jena-arq/src/test/java/org/apache/jena/atlas/legacy/BaseTest2.java
index fdeb8ef..19d17b8 100644
--- a/jena-arq/src/test/java/org/apache/jena/atlas/legacy/BaseTest2.java
+++ b/jena-arq/src/test/java/org/apache/jena/atlas/legacy/BaseTest2.java
@@ -21,7 +21,7 @@
import java.util.ArrayDeque ;
import java.util.Deque ;
-import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.atlas.junit.AssertExtra ;
import org.apache.jena.atlas.logging.Log ;
import org.apache.jena.riot.system.ErrorHandler ;
import org.apache.jena.riot.system.ErrorHandlerFactory ;
@@ -48,7 +48,7 @@
{
if ( errorHandlers.size() == 0 )
{
- Log.warn(BaseTest.class, "ErrorHandler not set for testing") ;
+ Log.warn(AssertExtra.class, "ErrorHandler not set for testing") ;
ErrorHandlerFactory.setDefaultErrorHandler(ErrorHandlerFactory.errorHandlerStd) ; // Panic measures
return ;
}
diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/web/TS_Web.java b/jena-arq/src/test/java/org/apache/jena/atlas/web/TS_Altas_Web.java
similarity index 97%
rename from jena-arq/src/test/java/org/apache/jena/atlas/web/TS_Web.java
rename to jena-arq/src/test/java/org/apache/jena/atlas/web/TS_Altas_Web.java
index af639c2..dc9f56d 100644
--- a/jena-arq/src/test/java/org/apache/jena/atlas/web/TS_Web.java
+++ b/jena-arq/src/test/java/org/apache/jena/atlas/web/TS_Altas_Web.java
@@ -25,7 +25,7 @@
@Suite.SuiteClasses( {
TestContentNegotiation.class
} )
-public class TS_Web
+public class TS_Altas_Web
{
}
diff --git a/jena-arq/src/test/java/org/apache/jena/query/TS_ParamString.java b/jena-arq/src/test/java/org/apache/jena/query/TS_ParamString.java
deleted file mode 100644
index 866d066..0000000
--- a/jena-arq/src/test/java/org/apache/jena/query/TS_ParamString.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.query;
-
-import org.junit.runner.RunWith ;
-import org.junit.runners.Suite ;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
- TestParameterizedSparqlString.class
-})
-
-public class TS_ParamString
-{ }
-
diff --git a/jena-arq/src/test/java/org/apache/jena/query/TS_ResultSetFormatter.java b/jena-arq/src/test/java/org/apache/jena/query/TS_Query.java
similarity index 83%
rename from jena-arq/src/test/java/org/apache/jena/query/TS_ResultSetFormatter.java
rename to jena-arq/src/test/java/org/apache/jena/query/TS_Query.java
index 44947fb..83290e1 100644
--- a/jena-arq/src/test/java/org/apache/jena/query/TS_ResultSetFormatter.java
+++ b/jena-arq/src/test/java/org/apache/jena/query/TS_Query.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -23,8 +23,13 @@
@RunWith(Suite.class)
@Suite.SuiteClasses( {
- TestResultSetFormatter.class
+ TestParameterizedSparqlString.class
+ , TestResultSetFormatter.class
+ , TestQueryCloningEssentials.class
+ , TestQueryCloningCornerCases.class
})
-public class TS_ResultSetFormatter {
+
+public class TS_Query {
}
+
diff --git a/jena-arq/src/test/java/org/apache/jena/query/TestQueryCloningEssentials.java b/jena-arq/src/test/java/org/apache/jena/query/TestQueryCloningEssentials.java
index 282b780..07d6bb5 100644
--- a/jena-arq/src/test/java/org/apache/jena/query/TestQueryCloningEssentials.java
+++ b/jena-arq/src/test/java/org/apache/jena/query/TestQueryCloningEssentials.java
@@ -18,12 +18,7 @@
package org.apache.jena.query;
import java.io.IOException;
-import java.nio.file.FileVisitResult;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.PathMatcher;
-import java.nio.file.Paths;
-import java.nio.file.SimpleFileVisitor;
+import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Arrays;
@@ -31,6 +26,9 @@
import java.util.List;
import java.util.stream.Collectors;
+import org.apache.jena.sparql.expr.E_Function;
+import org.apache.jena.sparql.expr.NodeValue;
+import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -68,6 +66,23 @@
this.query = query;
}
+ private static boolean bVerboseWarnings;
+ private static boolean bWarnOnUnknownFunction;
+
+ //@BeforeClass -- call earlier
+ public static void beforeClass() {
+ bVerboseWarnings = NodeValue.VerboseWarnings;
+ bWarnOnUnknownFunction = E_Function.WarnOnUnknownFunction;
+ NodeValue.VerboseWarnings = false;
+ E_Function.WarnOnUnknownFunction = false;
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ NodeValue.VerboseWarnings = bVerboseWarnings;
+ E_Function.WarnOnUnknownFunction = bWarnOnUnknownFunction;
+ }
+
@Test
public void runTest() {
checkedClone(query);
@@ -76,9 +91,10 @@
@Parameters(name = "Query.clone {0}")
public static Collection<Object[]> generateTestParams() throws Exception
{
+ beforeClass();
List<String> exclusions = Arrays.asList(/* no exclusions as all test cases work */);
- Path startPath = Paths.get("./testing").toAbsolutePath().normalize();
+ Path startPath = Paths.get("./testing/ARQ").toAbsolutePath().normalize();
PathMatcher pathMatcher = startPath.getFileSystem().getPathMatcher("glob:**/*.rq");
List<Object[]> testParams = new ArrayList<>();
diff --git a/jena-arq/src/test/java/org/apache/jena/rdf_star/TS_RDF_Star.java b/jena-arq/src/test/java/org/apache/jena/rdf_star/TS_RDF_Star.java
index fdb6d84..c331eef 100644
--- a/jena-arq/src/test/java/org/apache/jena/rdf_star/TS_RDF_Star.java
+++ b/jena-arq/src/test/java/org/apache/jena/rdf_star/TS_RDF_Star.java
@@ -30,7 +30,9 @@
TestSPARQLStarParse.class,
TestSPARQLStarExtra.class
- //See also TC_Scripted SPARQL-Star/manifest.ttl which run from JUnit3-centric ARQTestSuite
+ // See also Scripts_ARQ SPARQL-Star/manifest.ttl
+ // and
+
})
public class TS_RDF_Star {
}
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/TS_LangSuite.java b/jena-arq/src/test/java/org/apache/jena/riot/Scripts_LangSuite.java
similarity index 65%
rename from jena-arq/src/test/java/org/apache/jena/riot/TS_LangSuite.java
rename to jena-arq/src/test/java/org/apache/jena/riot/Scripts_LangSuite.java
index 630badd..f4e9867 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/TS_LangSuite.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/Scripts_LangSuite.java
@@ -18,24 +18,20 @@
package org.apache.jena.riot;
-import junit.framework.TestSuite ;
-import org.apache.jena.riot.langsuite.FactoryTestRiot ;
-import org.apache.jena.sys.JenaSystem ;
+import org.apache.jena.arq.junit.manifest.Label;
+import org.apache.jena.arq.junit.manifest.Manifests;
+import org.apache.jena.arq.junit.runners.RunnerRIOT;
import org.junit.runner.RunWith ;
-import org.junit.runners.AllTests ;
/** The test suites - these are driven by a manifest file and use external files for tests */
-@RunWith(AllTests.class)
-public class TS_LangSuite
-{
- private static final String manifest1 = "testing/RIOT/Lang/manifest-all.ttl" ;
+@RunWith(RunnerRIOT.class)
+@Label("RIOT")
+@Manifests({
+ "testing/RIOT/Lang/manifest-all.ttl",
+ "testing/ARQ/RDF-Star/Turtle-Star/manifest.ttl"
+})
- static public TestSuite suite()
- {
- JenaSystem.init() ;
- TestSuite ts = new TestSuite(TS_LangSuite.class.getName()) ;
- ts.addTest(FactoryTestRiot.make(manifest1)) ;
- return ts ;
- }
-}
+public class Scripts_LangSuite
+{}
+
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/TC_Riot.java b/jena-arq/src/test/java/org/apache/jena/riot/TC_Riot.java
index 35bebc3..c4ad293 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/TC_Riot.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/TC_Riot.java
@@ -20,7 +20,6 @@
import org.apache.jena.riot.adapters.TS_RIOTAdapters ;
import org.apache.jena.riot.lang.TS_Lang ;
-import org.apache.jena.riot.lang.extra.TS_LangExtra;
import org.apache.jena.riot.out.TS_Out ;
import org.apache.jena.riot.process.TS_Process ;
import org.apache.jena.riot.resultset.TS_ResultSetRIOT ;
@@ -38,8 +37,6 @@
TS_Tokens.class
, TS_Out.class
, TS_Lang.class
- , TS_LangSuite.class
- , TS_LangExtra.class
, TS_RiotGeneral.class
, TS_IO2.class
, TS_RIOTAdapters.class
@@ -49,6 +46,8 @@
, TS_RiotWeb.class
, TS_ResultSetRIOT.class
, TS_RDFThrift.class
+
+ , Scripts_LangSuite.class
})
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/TS_RiotGeneral.java b/jena-arq/src/test/java/org/apache/jena/riot/TS_RiotGeneral.java
index 098ff26..914bb21 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/TS_RiotGeneral.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/TS_RiotGeneral.java
@@ -18,6 +18,7 @@
package org.apache.jena.riot;
+import org.apache.jena.riot.writer.TestJsonLDWriter;
import org.junit.runner.RunWith ;
import org.junit.runners.Suite ;
import org.junit.runners.Suite.SuiteClasses ;
@@ -35,6 +36,9 @@
, TestParserRegistry.class
, TestRDFWriter.class
, TestParseURISchemeBases.class
+
+ , TestJsonLDReader.class
+ , TestJsonLDWriter.class
})
public class TS_RiotGeneral
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/TestJsonLDReader.java b/jena-arq/src/test/java/org/apache/jena/riot/TestJsonLDReader.java
index ac4a72b..3e6c2b3 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/TestJsonLDReader.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/TestJsonLDReader.java
@@ -39,7 +39,8 @@
public class TestJsonLDReader {
- @Test public final void simpleReadTest() {
+ @Test
+ public final void simpleReadTest() {
try {
String jsonld = someSchemaDorOrgJsonld();
Model m = ModelFactory.createDefaultModel();
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTuples.java b/jena-arq/src/test/java/org/apache/jena/riot/lang/AbstractTestLangNTuples.java
similarity index 99%
rename from jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTuples.java
rename to jena-arq/src/test/java/org/apache/jena/riot/lang/AbstractTestLangNTuples.java
index cf25202..d9fd15a 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTuples.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/lang/AbstractTestLangNTuples.java
@@ -41,7 +41,7 @@
import org.junit.Test ;
/** Test of syntax by a tuples parser (does not include node validitiy checking) */
-abstract public class TestLangNTuples
+abstract public class AbstractTestLangNTuples
{
// Test streaming interface.
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNQuads.java b/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNQuads.java
index 2c11dea..8453db6 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNQuads.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNQuads.java
@@ -28,7 +28,7 @@
/** Test of syntax by a quads parser (does not include node validitiy checking) */
-public class TestLangNQuads extends TestLangNTuples
+public class TestLangNQuads extends AbstractTestLangNTuples
{
@Override
protected Lang getLang() {
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTriples.java b/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTriples.java
index c831046..1113bc4 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTriples.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTriples.java
@@ -37,7 +37,7 @@
/** Test of syntax by a triples parser (does not include node validitiy checking) */
-public class TestLangNTriples extends TestLangNTuples
+public class TestLangNTriples extends AbstractTestLangNTuples
{
// Test streaming interface.
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/lang/extra/FactoryTestTurtleJavacc.java b/jena-arq/src/test/java/org/apache/jena/riot/lang/extra/FactoryTestTurtleJavacc.java
deleted file mode 100644
index 58adb0a..0000000
--- a/jena-arq/src/test/java/org/apache/jena/riot/lang/extra/FactoryTestTurtleJavacc.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.riot.lang.extra ;
-
-import junit.framework.Test ;
-import junit.framework.TestSuite ;
-import org.apache.jena.rdf.model.Resource ;
-import org.apache.jena.riot.Lang;
-import org.apache.jena.riot.RiotException ;
-import org.apache.jena.riot.langsuite.*;
-import org.apache.jena.sparql.junit.EarlReport ;
-import org.apache.jena.util.junit.TestFactoryManifest ;
-import org.apache.jena.util.junit.TestUtils ;
-import org.apache.jena.vocabulary.RDF ;
-
-public class FactoryTestTurtleJavacc extends TestFactoryManifest
-{
- public static String assumedRootURIex = "http://example/base/" ;
- public static String assumedRootURITurtle = "http://www.w3.org/2013/TurtleTests/" ;
- public static String assumedRootURITriG = "http://www.w3.org/2013/TriGTests/" ;
-
- public static EarlReport report = null ;
-
- public static TestSuite make(String manifest, Resource dftTestType, String labelPrefix)
- {
- return new FactoryTestTurtleJavacc(dftTestType, labelPrefix).process(manifest) ;
- }
-
- private Resource dftTestType ;
- private String labelPrefix ;
-
- public FactoryTestTurtleJavacc(Resource dftTestType, String labelPrefix)
- {
- this.dftTestType = dftTestType ;
- this.labelPrefix = labelPrefix ;
- }
-
- @Override
- public Test makeTest(Resource manifest, Resource item, String testName, Resource action, Resource result)
- {
- Lang lang = TurtleJavaccReaderRIOT.lang;
-
- try
- {
- Resource r = TestUtils.getResource(item, RDF.type) ;
- if ( r == null )
- r = dftTestType ;
- if ( r == null )
- throw new RiotException("Can't determine the test type") ;
-
- if ( labelPrefix != null )
- testName = labelPrefix+testName ;
-
- // In Turtle tests, the action directly names the file to process.
- Resource input = action ;
- Resource output = result ;
-
- if ( r.equals(VocabLangRDF.TestPositiveSyntaxTTL) )
- return new UnitTestSyntax(testName, item.getURI(), input.getURI(), lang, report) ;
-
- if ( r.equals(VocabLangRDF.TestNegativeSyntaxTTL) )
- return new UnitTestBadSyntax(testName, item.getURI(), input.getURI(), lang, report) ;
-
- // Eval.
-
- if ( r.equals(VocabLangRDF.TestEvalTTL) ) {
- String base = rebase(input, assumedRootURITurtle) ;
- return new UnitTestEval(testName, item.getURI(), input.getURI(), result.getURI(), base, lang, report) ;
- }
- if ( r.equals(VocabLangRDF.TestNegativeEvalTTL) )
- return new UnitTestBadEval(testName, item.getURI(), input.getURI(), lang, report) ;
-
- System.err.println("Unrecognized turtle test : ("+r+")" + testName) ;
- return null ;
-
- } catch (Exception ex)
- {
- ex.printStackTrace(System.err) ;
- System.err.println("Failed to grok test : " + testName) ;
- return null ;
- }
- }
-
- private static String rebase(Resource input, String baseIRI) {
- String x = input.getLocalName() ;
- baseIRI = baseIRI+x ;
- return baseIRI ;
- }
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/lang/extra/TS_LangExtra.java b/jena-arq/src/test/java/org/apache/jena/riot/lang/extra/TS_LangExtra.java
deleted file mode 100644
index 16aa029..0000000
--- a/jena-arq/src/test/java/org/apache/jena/riot/lang/extra/TS_LangExtra.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.riot.lang.extra;
-
-import junit.framework.TestSuite;
-import org.apache.jena.sys.JenaSystem;
-import org.junit.runner.RunWith;
-import org.junit.runners.AllTests;
-
-/** Tests for "lang.extra" such as the JavaCC version of the Turtle parser */
-
-@RunWith(AllTests.class)
-public class TS_LangExtra
-{
- private static final String manifest1 = "testing/RIOT/Lang/TurtleStd/manifest.ttl";
- private static final String manifest2 = "testing/RIOT/Lang/Turtle2/manifest.ttl";
- private static final String manifest3 = "testing/RIOT/Lang/TurtleSubm/manifest.ttl";
-
- static public TestSuite suite()
- {
- JenaSystem.init();
- TurtleJavaccReaderRIOT.register();
-
- TestSuite ts = new TestSuite(TS_LangExtra.class.getName());
- ts.addTest(FactoryTestTurtleJavacc.make(manifest1, null, null));
- ts.addTest(FactoryTestTurtleJavacc.make(manifest2, null, null));
- ts.addTest(FactoryTestTurtleJavacc.make(manifest3, null, null));
- return ts;
- }
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/FactoryTestRiot.java b/jena-arq/src/test/java/org/apache/jena/riot/langsuite/FactoryTestRiot.java
deleted file mode 100644
index 0d44933..0000000
--- a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/FactoryTestRiot.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.riot.langsuite ;
-
-import junit.framework.Test ;
-import junit.framework.TestSuite ;
-import org.apache.jena.rdf.model.Resource ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.riot.RiotException ;
-import org.apache.jena.sparql.junit.EarlReport ;
-import org.apache.jena.util.junit.TestFactoryManifest ;
-import org.apache.jena.util.junit.TestUtils ;
-import org.apache.jena.vocabulary.RDF ;
-
-public class FactoryTestRiot extends TestFactoryManifest
-{
- public static String assumedRootURIex = "http://example/base/" ;
- public static String assumedRootURITurtle = "http://www.w3.org/2013/TurtleTests/" ;
- public static String assumedRootURITriG = "http://www.w3.org/2013/TriGTests/" ;
-
- public static EarlReport report = null ;
-
- public static TestSuite make(String manifest) {
- return make(manifest, null, null);
- }
-
- public static TestSuite make(String manifest, Resource dftTestType, String labelPrefix) {
- return new FactoryTestRiot(dftTestType, labelPrefix).process(manifest);
- }
-
- private Resource dftTestType ;
- private String labelPrefix ;
-
- public FactoryTestRiot(Resource dftTestType, String labelPrefix)
- {
- this.dftTestType = dftTestType ;
- this.labelPrefix = labelPrefix ;
- }
-
- @Override
- public Test makeTest(Resource manifest, Resource item, String testName, Resource action, Resource result)
- {
- try
- {
- Resource r = TestUtils.getResource(item, RDF.type) ;
- if ( r == null )
- r = dftTestType ;
- if ( r == null )
- throw new RiotException("Can't determine the test type") ;
-
- if ( labelPrefix != null )
- testName = labelPrefix+testName ;
-
- // In Turtle tests, the action directly names the file to process.
- Resource input = action ;
- Resource output = result ;
-
- if ( r.equals(VocabLangRDF.TestPositiveSyntaxTTL) )
- return new UnitTestSyntax(testName, item.getURI(), input.getURI(), RDFLanguages.TURTLE, report) ;
-
- if ( r.equals(VocabLangRDF.TestNegativeSyntaxTTL) )
- return new UnitTestBadSyntax(testName, item.getURI(), input.getURI(), RDFLanguages.TURTLE, report) ;
-
- if ( r.equals(VocabLangRDF.TestPositiveSyntaxTriG) )
- return new UnitTestSyntax(testName, item.getURI(), input.getURI(), RDFLanguages.TRIG, report) ;
-
- if ( r.equals(VocabLangRDF.TestNegativeSyntaxTriG) )
- return new UnitTestBadSyntax(testName, item.getURI(), input.getURI(), RDFLanguages.TRIG, report) ;
-
- if ( r.equals(VocabLangRDF.TestPositiveSyntaxNT) )
- return new UnitTestSyntax(testName, item.getURI(), input.getURI(), RDFLanguages.NTRIPLES, report) ;
-
- if ( r.equals(VocabLangRDF.TestNegativeSyntaxNT) )
- return new UnitTestBadSyntax(testName, item.getURI(), input.getURI(), RDFLanguages.NTRIPLES, report) ;
-
- if ( r.equals(VocabLangRDF.TestPositiveSyntaxNQ) )
- return new UnitTestSyntax(testName, item.getURI(), input.getURI(), RDFLanguages.NQUADS, report) ;
-
- if ( r.equals(VocabLangRDF.TestNegativeSyntaxNQ) )
- return new UnitTestBadSyntax(testName, item.getURI(), input.getURI(), RDFLanguages.NQUADS, report) ;
-
- if ( r.equals(VocabLangRDF.TestPositiveSyntaxRJ) )
- return new UnitTestSyntax(testName, item.getURI(), input.getURI(), RDFLanguages.RDFJSON, report) ;
-
- if ( r.equals(VocabLangRDF.TestNegativeSyntaxRJ) )
- return new UnitTestBadSyntax(testName, item.getURI(), input.getURI(), RDFLanguages.RDFJSON, report) ;
-
- if ( r.equals(VocabLangRDF.TestSurpressed ))
- return new UnitTestSurpressed(testName, item.getURI(), report) ;
-
- // Eval.
-
- if ( r.equals(VocabLangRDF.TestEvalTTL) ) {
- String base = rebase(input, assumedRootURITurtle) ;
- return new UnitTestEval(testName, item.getURI(), input.getURI(), result.getURI(), base, RDFLanguages.TURTLE, report) ;
- }
-
- if ( r.equals(VocabLangRDF.TestEvalTriG) ) {
- String base = rebase(input, assumedRootURITriG) ;
- return new UnitTestEval(testName, item.getURI(), input.getURI(), result.getURI(), base, RDFLanguages.TRIG, report) ;
- }
-
- if ( r.equals(VocabLangRDF.TestNegativeEvalTTL) )
- return new UnitTestBadEval(testName, item.getURI(), input.getURI(), RDFLanguages.TURTLE, report) ;
-
- if ( r.equals(VocabLangRDF.TestNegativeEvalTriG) )
- return new UnitTestBadEval(testName, item.getURI(), input.getURI(), RDFLanguages.TRIG, report) ;
-
- if ( r.equals(VocabLangRDF.TestEvalNT) )
- return new UnitTestEval(testName, item.getURI(), input.getURI(), result.getURI(), null, RDFLanguages.NTRIPLES, report) ;
-
- if ( r.equals(VocabLangRDF.TestNegativeEvalNT) )
- return new UnitTestBadEval(testName, item.getURI(), input.getURI(), RDFLanguages.NTRIPLES, report) ;
-
- if ( r.equals(VocabLangRDF.TestEvalRJ) ) {
- String base = rebase(input, assumedRootURIex) ;
- return new UnitTestEval(testName, item.getURI(), input.getURI(), result.getURI(), base, RDFLanguages.RDFJSON, report) ;
- }
-
- if ( r.equals(VocabLangRDF.TestNegativeEvalRJ) )
- return new UnitTestBadEval(testName, item.getURI(), input.getURI(), RDFLanguages.RDFJSON, report) ;
-
- System.err.println("Unrecognized turtle test : ("+r+")" + testName) ;
- return null ;
-
- } catch (Exception ex)
- {
- ex.printStackTrace(System.err) ;
- System.err.println("Failed to grok test : " + testName) ;
- return null ;
- }
- }
-
- private static String rebase(Resource input, String baseIRI) {
- String x = input.getLocalName() ;
- // Yuk, yuk, yuk.
- baseIRI = baseIRI+x ;
- return baseIRI ;
- }
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/LangTestCase.java b/jena-arq/src/test/java/org/apache/jena/riot/langsuite/LangTestCase.java
deleted file mode 100644
index 9fb9e42..0000000
--- a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/LangTestCase.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.riot.langsuite;
-
-import org.apache.jena.atlas.legacy.BaseTest2 ;
-import org.apache.jena.riot.SysRIOT ;
-import org.apache.jena.riot.system.ErrorHandlerFactory ;
-import org.apache.jena.sparql.junit.EarlReport ;
-import org.apache.jena.sparql.junit.EarlTestCase ;
-
-public abstract class LangTestCase extends EarlTestCase
-{
- protected LangTestCase(String name, String testURI, EarlReport earl)
- { super(name, testURI, earl) ; }
-
- protected abstract void _setUp() ;
- protected abstract void _tearDown() ;
-
- protected boolean sysRIOT_strictMode ;
-
- @Override
- final public void setUpTest()
- {
- // The W3C Turtle and TriG test suites contain IRIs that generate warnings.
- // They are bad NFC for the version of UTF-8 that Java6 understands.
- BaseTest2.setTestLogging(ErrorHandlerFactory.errorHandlerNoWarnings) ;
-
- // If the test suite is sloppy, with IRIs that are not good practice, you may need
- // to run with warnings as not-errors ....
- //BaseTest.setTestLogging(ErrorHandlerFactory.errorHandlerStd) ;
- sysRIOT_strictMode = SysRIOT.isStrictMode() ;
- SysRIOT.setStrictMode(true) ;
- _setUp() ;
- }
-
- @Override
- final public void tearDownTest()
- {
- _tearDown() ;
- SysRIOT.setStrictMode(sysRIOT_strictMode) ;
- BaseTest2.unsetTestLogging() ;
- }
-
-}
-
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestBadEval.java b/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestBadEval.java
deleted file mode 100644
index 695e41e..0000000
--- a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestBadEval.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.riot.langsuite;
-
-
-import org.apache.jena.graph.Graph;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.riot.system.ErrorHandler ;
-import org.apache.jena.riot.system.ErrorHandlerFactory ;
-import org.apache.jena.shared.JenaException ;
-import org.apache.jena.sparql.core.DatasetGraph;
-import org.apache.jena.sparql.core.DatasetGraphFactory;
-import org.apache.jena.sparql.graph.GraphFactory;
-import org.apache.jena.sparql.junit.EarlReport ;
-import org.junit.After ;
-import org.junit.Before ;
-
-public class UnitTestBadEval extends LangTestCase
-{
- private final String uri ;
- private final Lang lang ;
-
- public UnitTestBadEval(String name, String testURI, String uri, Lang lang, EarlReport earl)
- {
- super(name, testURI, earl) ;
- this.uri = uri ;
- this.lang = lang ;
- }
-
- protected ErrorHandler installed ;
-
- @Override
- @Before
- public void _setUp()
- {
- installed = ErrorHandlerFactory.getDefaultErrorHandler() ;
- ErrorHandlerFactory.setDefaultErrorHandler(ErrorHandlerFactory.errorHandlerStrictSilent()) ;
- }
-
- @Override
- @After
- public void _tearDown()
- {
- ErrorHandlerFactory.setDefaultErrorHandler(installed) ;
- }
-
-
- @Override
- public void runTestForReal()
- {
- if ( RDFLanguages.isTriples(lang) )
- run3() ;
- else
- run4() ;
- }
-
-
- private void run3()
- {
- Graph graph = GraphFactory.createDefaultGraph();
- try {
- Parse.parse(graph, uri, lang);
- fail("Managed to read a bad evaluation test without error") ;
- }
- catch (JenaException ex) {}
- catch (RuntimeException ex)
- {
- ex.printStackTrace(System.err) ;
- throw ex ; }
- }
-
- private void run4()
- {
- DatasetGraph dsg = DatasetGraphFactory.createGeneral() ;
- try {
- Parse.parse(dsg, uri, lang);
- fail("Managed to read a bad evaluation test without error") ;
- }
- catch (JenaException ex) {}
- catch (RuntimeException ex)
- {
- ex.printStackTrace(System.err) ;
- throw ex ; }
- }
-
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestBadSyntax.java b/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestBadSyntax.java
deleted file mode 100644
index c77919d..0000000
--- a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestBadSyntax.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.riot.langsuite;
-
-import static org.apache.jena.riot.SysRIOT.fmtMessage ;
-
-import org.apache.jena.atlas.legacy.BaseTest2 ;
-import org.apache.jena.graph.Graph;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.riot.RiotException ;
-import org.apache.jena.riot.system.ErrorHandler ;
-import org.apache.jena.riot.system.ErrorHandlerFactory ;
-import org.apache.jena.sparql.core.DatasetGraph;
-import org.apache.jena.sparql.core.DatasetGraphFactory;
-import org.apache.jena.sparql.graph.GraphFactory;
-import org.apache.jena.sparql.junit.EarlReport ;
-
-public class UnitTestBadSyntax extends LangTestCase
-{
- private final String uri ;
- private final Lang lang ;
-
- public UnitTestBadSyntax(String name, String testURI, String uri, Lang lang, EarlReport earl)
- {
- super(name, testURI, earl) ;
- this.uri = uri ;
- this.lang = lang ;
- }
-
- /** An error handler that throw exceptions on warnings and errors */
- private static ErrorHandler errorHandlerTestStrict = new ErrorHandler()
- {
- /** report a warning - do not carry on */
- @Override
- public void warning(String message, long line, long col)
- {
- throw new RiotException(fmtMessage(message, line, col)) ;
- }
-
- /** report an error - do not carry on */
- @Override
- public void error(String message, long line, long col)
- {
- throw new RiotException(fmtMessage(message, line, col)) ;
- }
-
- @Override
- public void fatal(String message, long line, long col)
- {
- throw new RiotException(fmtMessage(message, line, col)) ;
- }
- } ;
-
- @Override
- protected void _setUp() { BaseTest2.setTestLogging(ErrorHandlerFactory.errorHandlerStrictNoLogging) ; }
-
- @Override
- protected void _tearDown() { BaseTest2.unsetTestLogging() ; }
-
- @Override
- public void runTestForReal()
- {
- if ( RDFLanguages.isTriples(lang) )
- run3() ;
- else
- run4() ;
- }
-
- private void run3() {
- Graph graph = GraphFactory.createDefaultGraph();
- try {
- Parse.parse(graph, uri, lang);
- }
- catch (RiotException ex) { return ; }
- catch (RuntimeException ex) {
- ex.printStackTrace(System.err) ;
- fail("Unexpected exception") ;
- }
- fail("Bad syntax test succeed in parsing the file") ;
- }
-
- private void run4() {
- DatasetGraph dsg = DatasetGraphFactory.createGeneral() ;
- try {
- Parse.parse(dsg, uri, lang) ;
- } catch (RiotException ex) { return ; }
- catch (RuntimeException ex) {
- ex.printStackTrace(System.err) ;
- fail("Unexpected exception") ;
- }
- fail("Bad syntax test succeed in parsing the file") ;
- }
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestEval.java b/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestEval.java
deleted file mode 100644
index f5b4baa..0000000
--- a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestEval.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.riot.langsuite;
-
-import org.apache.jena.rdf.model.Model ;
-import org.apache.jena.rdf.model.ModelFactory ;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFDataMgr ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.riot.RiotException ;
-import org.apache.jena.sparql.core.DatasetGraph ;
-import org.apache.jena.sparql.core.DatasetGraphFactory ;
-import org.apache.jena.sparql.junit.EarlReport ;
-import org.apache.jena.sparql.util.IsoMatcher ;
-
-public class UnitTestEval extends LangTestCase
-{
- String input ;
- String output ;
- String baseIRI ;
- Lang lang ;
-
- public UnitTestEval(String name, String testURI, String input, String output, String baseIRI, Lang lang, EarlReport earl)
- {
- super(name, testURI, earl) ;
- this.input = input ;
- this.output = output ;
- this.baseIRI = baseIRI ;
- this.lang = lang ;
- }
-
- @Override
- protected void _setUp()
- {}
-
- @Override
- protected void _tearDown()
- {}
-
- @Override
- public void runTestForReal()
- {
- // Could generalise run4() to cover both cases.
- // run3() predates dataset reading and is more tested.
- if ( RDFLanguages.isTriples(lang) )
- run3() ;
- else
- run4() ;
- }
-
- private void run4() {
- DatasetGraph dsg = DatasetGraphFactory.create() ;
- try {
- if ( baseIRI != null )
- Parse.parse(dsg, input, baseIRI, lang) ;
- else
- Parse.parse(dsg, input, lang) ;
-
- Lang outLang = RDFLanguages.filenameToLang(output, Lang.NQUADS) ;
-
- DatasetGraph results = DatasetGraphFactory.create() ;
- try {
- RDFDataMgr.read(results, output, outLang) ;
- } catch (RiotException ex) {
- fail("Failed to read results: "+ex.getMessage()) ;
- }
-
- boolean b = isomorphic(dsg, results) ;
-
- if ( !b )
- {
- System.out.println("**** Test: "+getName()) ;
- System.out.println("---- Parsed");
- RDFDataMgr.write(System.out, dsg, Lang.TRIG) ;
- System.out.println("---- Expected");
- RDFDataMgr.write(System.out, results, Lang.TRIG) ;
- System.out.println("--------");
- }
-
- assertTrue("Datasets not isomorphic", b) ;
- } catch (RiotException ex)
- {
- // Catch and rethrow - debugging.
- throw ex ;
- }
- catch (RuntimeException ex)
- {
- ex.printStackTrace(System.err) ;
- throw ex ; }
- }
-
- private boolean isomorphic(DatasetGraph dsg1, DatasetGraph dsg2) {
- return IsoMatcher.isomorphic(dsg1, dsg2) ;
- }
-
- // Triples test.
- private void run3() {
- Model model = ModelFactory.createDefaultModel() ;
- try {
- if ( baseIRI != null )
- RDFDataMgr.read(model, input, baseIRI, lang) ;
- else
- RDFDataMgr.read(model, input, lang) ;
-
- Lang outLang = RDFLanguages.filenameToLang(output, Lang.NQUADS) ;
-
- Model results = ModelFactory.createDefaultModel() ;
- try {
- RDFDataMgr.read(results, output, outLang) ;
- } catch (RiotException ex) {
- fail("Failed to read results: "+ex.getMessage()) ;
- }
-
- boolean b = model.isIsomorphicWith(results) ;
-
- if ( !b )
- {
- //model.isIsomorphicWith(results) ;
- System.out.println("---- Parsed");
- model.write(System.out, "TTL") ;
- System.out.println("---- Expected");
- results.write(System.out, "TTL") ;
- System.out.println("--------");
- }
-
- assertTrue("Models not isomorphic", b) ;
- } catch (RiotException ex)
- {
- // Catch and rethrow - debugging.
- throw ex ;
- }
- catch (RuntimeException ex)
- {
- ex.printStackTrace(System.err) ;
- throw ex ; }
- }
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestSurpressed.java b/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestSurpressed.java
deleted file mode 100644
index d567081..0000000
--- a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestSurpressed.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.riot.langsuite;
-
-import org.apache.jena.sparql.junit.EarlReport ;
-
-public class UnitTestSurpressed extends LangTestCase
-{
- public UnitTestSurpressed(String name, String testURI, EarlReport earl)
- { super(name, testURI, earl) ; }
-
- @Override
- public void runTestForReal()
- { }
-
- @Override
- protected void _setUp()
- {}
-
- @Override
- protected void _tearDown()
- {}
-}
-
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestSyntax.java b/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestSyntax.java
deleted file mode 100644
index aaa3771..0000000
--- a/jena-arq/src/test/java/org/apache/jena/riot/langsuite/UnitTestSyntax.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.riot.langsuite;
-
-import org.apache.jena.graph.Graph;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.sparql.core.DatasetGraph;
-import org.apache.jena.sparql.core.DatasetGraphFactory;
-import org.apache.jena.sparql.graph.GraphFactory;
-import org.apache.jena.sparql.junit.EarlReport ;
-
-public class UnitTestSyntax extends LangTestCase
-{
- private final String uri ;
- private final Lang lang ;
-
- public UnitTestSyntax(String name, String testURI, String uri, Lang lang, EarlReport earl)
- {
- super(name, testURI, earl) ;
- this.uri = uri ;
- this.lang = lang ;
- }
-
- @Override
- public void runTestForReal()
- {
- if ( RDFLanguages.isTriples(lang) )
- run3() ;
- else
- run4() ;
- }
-
- private void run3()
- {
- Graph graph = GraphFactory.createDefaultGraph();
- Parse.parse(graph, uri, lang);
- }
-
- private void run4()
- {
- DatasetGraph dsg = DatasetGraphFactory.createGeneral() ;
- Parse.parse(dsg, uri, lang);
- }
-
- @Override
- protected void _setUp()
- {}
-
- @Override
- protected void _tearDown()
- {}
-
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/writer/TestJsonLDWriter.java b/jena-arq/src/test/java/org/apache/jena/riot/writer/TestJsonLDWriter.java
index d2cba46..966e099 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/writer/TestJsonLDWriter.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/writer/TestJsonLDWriter.java
@@ -250,9 +250,10 @@
/**
* Checks that one can pass a context defined by its URI
*
- * -- well NO, this doesn't work
+ * -- well NO, this doesn't work in a test setup.
*/
- @Test public final void testContextByUri() {
+ //@Test
+ public final void testContextByUri() {
Model m = ModelFactory.createDefaultModel();
String ns = "http://schema.org/";
Resource s = m.createResource();
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/ARQTestSuite.java b/jena-arq/src/test/java/org/apache/jena/sparql/ARQTestSuite.java
deleted file mode 100644
index 0da5b58..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/ARQTestSuite.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.sparql;
-
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.TestSuite;
-import org.apache.jena.atlas.legacy.BaseTest2;
-import org.apache.jena.atlas.legacy.TC_Atlas_ARQ;
-import org.apache.jena.common.TC_Common;
-import org.apache.jena.riot.TC_Riot;
-import org.apache.jena.sparql.engine.main.QueryEngineMain;
-import org.apache.jena.sparql.engine.ref.QueryEngineRef;
-import org.apache.jena.sparql.expr.E_Function;
-import org.apache.jena.sparql.expr.NodeValue;
-import org.apache.jena.sys.JenaSystem;
-import org.apache.jena.system.TS_System;
-import org.apache.jena.web.TS_Web;
-
-/**
- * All the ARQ tests
- */
-
-public class ARQTestSuite extends TestSuite {
- public static final String testDirARQ = "testing/ARQ";
- public static final String testDirUpdate = "testing/Update";
-
- public static final String log4jPropertiesResourceName = "log4j2.properties";
- static {
- JenaSystem.init();
- }
-
- static public TestSuite suite() {
- // We have to do things JUnit3 style in order to
- // have scripted tests, which use JUnit3-style dynamic test building.
- // This does not seem to be possible in org.junit.*
- TestSuite ts = new ARQTestSuite();
-
- // No warnings (e.g. bad lexical forms).
- BaseTest2.setTestLogging();
-
- // ARQ dependencies
- ts.addTest(new JUnit4TestAdapter(TC_Atlas_ARQ.class));
- ts.addTest(new JUnit4TestAdapter(TC_Common.class));
- ts.addTest(new JUnit4TestAdapter(TC_Riot.class));
-
- ts.addTest(new JUnit4TestAdapter(TS_Web.class));
- ts.addTest(new JUnit4TestAdapter(TS_System.class));
-
- // Main ARQ internal test suite.
- ts.addTest(new JUnit4TestAdapter(TC_General.class));
-
- ts.addTest(TC_Scripted.suite());
- ts.addTest(TC_DAWG.suite());
- // ts.addTest(TC_SPARQL11.suite()) ;
-
- // Fiddle around with the config if necessary
- if ( false ) {
- QueryEngineMain.unregister();
- QueryEngineRef.register();
- }
- return ts;
- }
-
- private ARQTestSuite() {
- super("All ARQ tests");
- NodeValue.VerboseWarnings = false;
- E_Function.WarnOnUnknownFunction = false;
- }
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_ARQ.java b/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_ARQ.java
new file mode 100644
index 0000000..01415d6
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_ARQ.java
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.sparql;
+
+import org.apache.jena.arq.junit.manifest.Label;
+import org.apache.jena.arq.junit.manifest.Manifests;
+import org.apache.jena.arq.junit.runners.RunnerSPARQL;
+import org.apache.jena.sparql.expr.E_Function;
+import org.apache.jena.sparql.expr.NodeValue;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+
+
+@RunWith(RunnerSPARQL.class)
+@Label("ARQ")
+@Manifests({
+ "testing/ARQ/Syntax/manifest-syntax.ttl" ,
+ "testing/ARQ/manifest-arq.ttl" ,
+ "testing/ARQ/Serialization/manifest.ttl" ,
+ "testing/ARQ/RDF-Star/SPARQL-Star/manifest.ttl"
+ //"testing/ARQ/Examples/manifest.ttl"
+})
+public class Scripts_ARQ
+{
+ private static boolean bVerboseWarnings;
+ private static boolean bWarnOnUnknownFunction;
+
+ @BeforeClass
+ public static void beforeClass() {
+ bVerboseWarnings = NodeValue.VerboseWarnings;
+ bWarnOnUnknownFunction = E_Function.WarnOnUnknownFunction;
+ NodeValue.VerboseWarnings = false;
+ E_Function.WarnOnUnknownFunction = false;
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ NodeValue.VerboseWarnings = bVerboseWarnings;
+ E_Function.WarnOnUnknownFunction = bWarnOnUnknownFunction;
+ }
+
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_DAWG.java b/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_DAWG.java
new file mode 100644
index 0000000..ccdbcff
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_DAWG.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.sparql;
+
+import org.apache.jena.arq.junit.manifest.Label;
+import org.apache.jena.arq.junit.manifest.Manifests;
+import org.apache.jena.arq.junit.runners.RunnerSPARQL;
+import org.apache.jena.sparql.expr.E_Function ;
+import org.apache.jena.sparql.expr.NodeValue ;
+import org.junit.AfterClass ;
+import org.junit.BeforeClass ;
+import org.junit.runner.RunWith;
+
+/** The test suite for all DAWG (the first SPARQL working group) approved tests.
+ * Many are the same as or overlap with ARQ tests (because the ARQ ones were
+ * contributed to DAWG or developed in response the feature design within DAWG)
+ * but we keep this set here as a reference.
+ */
+@RunWith(RunnerSPARQL.class)
+@Label("DAWG")
+@Manifests({
+ // One test, dawg-optional-filter-005-simplified or dawg-optional-filter-005-not-simplified
+ // must fail because it's the same query and data with different interpretations of the
+ // spec. ARQ implements dawg-optional-filter-005-not-simplified.
+
+ "testing/DAWG-Final/manifest-syntax.ttl",
+ "testing/DAWG-Final/manifest-evaluation.ttl",
+
+ "testing/DAWG/Misc/manifest.n3",
+ "testing/DAWG/Syntax/manifest.n3",
+ "testing/DAWG/examples/manifest.n3",
+})
+
+public class Scripts_DAWG
+{
+ private static boolean bVerboseWarnings;
+ private static boolean bWarnOnUnknownFunction;
+
+ @BeforeClass
+ public static void beforeClass() {
+ bVerboseWarnings = NodeValue.VerboseWarnings;
+ bWarnOnUnknownFunction = E_Function.WarnOnUnknownFunction;
+ NodeValue.VerboseWarnings = false;
+ E_Function.WarnOnUnknownFunction = false;
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ NodeValue.VerboseWarnings = bVerboseWarnings;
+ E_Function.WarnOnUnknownFunction = bWarnOnUnknownFunction;
+ }
+}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/ARQTestRefEngine.java b/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_RefEngine.java
similarity index 64%
rename from jena-arq/src/test/java/org/apache/jena/sparql/ARQTestRefEngine.java
rename to jena-arq/src/test/java/org/apache/jena/sparql/Scripts_RefEngine.java
index cb99d61..f19d4bd 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/ARQTestRefEngine.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_RefEngine.java
@@ -18,34 +18,35 @@
package org.apache.jena.sparql;
-import junit.framework.TestCase ;
-import junit.framework.TestSuite ;
+import org.apache.jena.arq.junit.manifest.Label;
+import org.apache.jena.arq.junit.manifest.Manifests;
+import org.apache.jena.arq.junit.runners.RunnerSPARQL;
import org.apache.jena.sparql.engine.ref.QueryEngineRef ;
import org.apache.jena.sparql.expr.E_Function ;
import org.apache.jena.sparql.expr.NodeValue ;
-import org.apache.jena.sparql.junit.ScriptTestSuiteFactory ;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
-public class ARQTestRefEngine extends TestCase
+@RunWith(RunnerSPARQL.class)
+@Label("ARQTestRefEngine")
+@Manifests({
+ "testing/ARQ/manifest-ref-arq.ttl"
+})
+public class Scripts_RefEngine
{
- public static TestSuite suite()
- {
+ @BeforeClass
+ public static void beforeClass() {
NodeValue.VerboseWarnings = false ;
E_Function.WarnOnUnknownFunction = false ;
- return suiteRef() ;
- }
-
- private static TestSuite suiteRef()
- {
QueryEngineRef.register() ;
- TestSuite ts = suiteMaker() ;
- //QueryEngineRef.unregister() ;
- return ts ;
}
-
- private static TestSuite suiteMaker()
- {
- return ScriptTestSuiteFactory.make("testing/ARQ/manifest-ref-arq.ttl") ;
+
+ @AfterClass
+ public static void afterClass() {
+ NodeValue.VerboseWarnings = true;
+ E_Function.WarnOnUnknownFunction = true;
+ QueryEngineRef.unregister() ;
}
-
}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/TC_SPARQL11.java b/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_SPARQL11.java
similarity index 78%
rename from jena-arq/src/test/java/org/apache/jena/sparql/TC_SPARQL11.java
rename to jena-arq/src/test/java/org/apache/jena/sparql/Scripts_SPARQL11.java
index 42dcec8..13d3c6d 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/TC_SPARQL11.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_SPARQL11.java
@@ -18,20 +18,13 @@
package org.apache.jena.sparql;
-import junit.framework.TestSuite ;
-
/**
* The test suite for all SPARQL (the second SPARQL working group) approved tests.
* These are actually covered by TC_Scripted.
*/
-public class TC_SPARQL11 extends TestSuite
-{
- static public TestSuite suite() { return new TC_SPARQL11(); }
+//@RunWith(RunnerSPARQL.class)
+//@Label("ARQ")
+//@Manifests({
+//});
+public class Scripts_SPARQL11 {}
- // SPARQL 1.1 test suite (when ready)
-
- public TC_SPARQL11()
- {
- super(TC_SPARQL11.class.getName()) ;
- }
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/TC_General.java b/jena-arq/src/test/java/org/apache/jena/sparql/TC_ARQ.java
similarity index 80%
rename from jena-arq/src/test/java/org/apache/jena/sparql/TC_General.java
rename to jena-arq/src/test/java/org/apache/jena/sparql/TC_ARQ.java
index d04750e..d401b2c 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/TC_General.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/TC_ARQ.java
@@ -19,7 +19,8 @@
package org.apache.jena.sparql;
-import org.apache.jena.query.TS_ParamString ;
+import org.apache.jena.query.TS_Query;
+import org.apache.jena.rdf_star.TS_RDF_Star;
import org.apache.jena.sparql.algebra.TS_Algebra ;
import org.apache.jena.sparql.algebra.optimize.TS_Optimization ;
import org.apache.jena.sparql.api.TS_API ;
@@ -38,6 +39,7 @@
import org.apache.jena.sparql.function.user.TS_UserFunctions ;
import org.apache.jena.sparql.graph.TS_Graph ;
import org.apache.jena.sparql.lang.TS_Lang ;
+import org.apache.jena.sparql.lib.TS_SparqlLib;
import org.apache.jena.sparql.modify.TS_Update ;
import org.apache.jena.sparql.negation.TS_Negation ;
import org.apache.jena.sparql.path.TS_Path ;
@@ -47,7 +49,9 @@
import org.apache.jena.sparql.sse.TS_SSE;
import org.apache.jena.sparql.syntax.TS_Syntax ;
import org.apache.jena.sparql.transaction.TS_Transaction ;
+import org.apache.jena.sparql.util.TS_DyadicDatasetGraphs;
import org.apache.jena.sparql.util.TS_Util ;
+import org.apache.jena.sparql.util.compose.TS_DatasetCollectors;
import org.junit.AfterClass ;
import org.junit.BeforeClass ;
import org.junit.runner.RunWith ;
@@ -57,7 +61,10 @@
@Suite.SuiteClasses( {
TS_SSE.class
, TS_Lang.class
+
, TS_Graph.class
+ , TS_DyadicDatasetGraphs.class
+ , TS_DatasetCollectors.class
, TS_Util.class
, TS_Expr.class
@@ -82,19 +89,30 @@
, TS_Assembler.class
, TS_DatasetTxnMem.class
, TS_Path.class
- , TS_ParamString.class
+ , TS_Query.class
, TS_Update.class
, TS_Transaction.class
+ , TS_SparqlLib.class
+
+ , TS_RDF_Star.class
})
-public class TC_General
+public class TC_ARQ
{
+ private static boolean bVerboseWarnings;
+ private static boolean bWarnOnUnknownFunction;
+
@BeforeClass
public static void beforeClass() {
+ bVerboseWarnings = NodeValue.VerboseWarnings;
+ bWarnOnUnknownFunction = E_Function.WarnOnUnknownFunction;
NodeValue.VerboseWarnings = false;
E_Function.WarnOnUnknownFunction = false;
}
@AfterClass
- public static void afterClass() { }
+ public static void afterClass() {
+ NodeValue.VerboseWarnings = bVerboseWarnings;
+ E_Function.WarnOnUnknownFunction = bWarnOnUnknownFunction;
+ }
}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/TC_DAWG.java b/jena-arq/src/test/java/org/apache/jena/sparql/TC_DAWG.java
deleted file mode 100644
index de48dfb..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/TC_DAWG.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.sparql;
-
-import junit.framework.TestSuite ;
-import org.apache.jena.sparql.expr.E_Function ;
-import org.apache.jena.sparql.expr.NodeValue ;
-import org.apache.jena.sparql.junit.ScriptTestSuiteFactory ;
-import org.junit.AfterClass ;
-import org.junit.BeforeClass ;
-
-/** The test suite for all DAWG (the first SPARQL working group) approved tests.
- * Many are the same as or overlap with ARQ tests (because the ARQ ones were
- * contributed to DAWG or developed in response the feature design within DAWG)
- * but we keep this set here as a reference.
- *
- * */
-public class TC_DAWG extends TestSuite
-{
- static final String testSetNameDAWG = "DAWG - Misc" ;
-
- static final public String testDirDAWG = "testing/DAWG" ;
- static final public String testDirWGApproved = "testing/DAWG-Final" ;
-// static final public String testDirWGPending = "testing/DAWG-Pending" ;
-
- private static boolean bVerboseWarnings ;
- private static boolean bWarnOnUnknownFunction ;
-
- @BeforeClass public static void beforeClass()
- {
- bVerboseWarnings = NodeValue.VerboseWarnings ;
- bWarnOnUnknownFunction = E_Function.WarnOnUnknownFunction ;
- NodeValue.VerboseWarnings = false ;
- E_Function.WarnOnUnknownFunction = false ;
- }
-
- @AfterClass public static void afterClass()
- {
- NodeValue.VerboseWarnings = bVerboseWarnings ;
- E_Function.WarnOnUnknownFunction = bWarnOnUnknownFunction ;
- }
-
- // Above does not work yet (Junit3/Junit4) ism.
- static
- {
- // Switch warnings off for thigns that do occur in the scripted test suites
- NodeValue.VerboseWarnings = false ;
- E_Function.WarnOnUnknownFunction = false ;
- }
-
- static public TestSuite suite() { return new TC_DAWG(); }
-
- public TC_DAWG()
- {
- super(TC_DAWG.class.getName()) ;
-
- // One test, dawg-optional-filter-005-simplified or dawg-optional-filter-005-not-simplified
- // must fail because it's the same query and data with different interpretations of the
- // spec. ARQ implements dawg-optional-filter-005-not-simplified.
-
- TestSuite ts1 = new TestSuite("Approved") ;
- ts1.addTest(ScriptTestSuiteFactory.make(testDirWGApproved+"/manifest-evaluation.ttl")) ;
-
- // These merely duplicate ARQ's syntax tests because Andy wrote the DAWG syntax tests,
- // but they are quick so include the snapshot
- // Eclipse can get confused and may mark them as not run (but they have).
- ts1.addTest(ScriptTestSuiteFactory.make(testDirWGApproved+"/manifest-syntax.ttl")) ;
- addTest(ts1) ;
-
- TestSuite ts3 = new TestSuite("Misc") ;
- // Others in DAWG-Final::
- ts3.addTest(ScriptTestSuiteFactory.make(testDirDAWG+"/Misc/manifest.n3")) ;
- ts3.addTest(ScriptTestSuiteFactory.make(testDirDAWG+"/Syntax/manifest.n3")) ;
- ts3.addTest(ScriptTestSuiteFactory.make(testDirDAWG+"/regex/manifest.n3")) ;
- ts3.addTest(ScriptTestSuiteFactory.make(testDirDAWG+"/examples/manifest.n3")) ; // Value testing examples
- //In DAWG-Final:: ts3.addTest(QueryTestSuiteFactory.make(testDirDAWG+"/i18n/manifest.ttl")) ;
- addTest(ts3) ;
- }
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/TC_Scripted.java b/jena-arq/src/test/java/org/apache/jena/sparql/TC_Scripted.java
deleted file mode 100644
index c9a6351..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/TC_Scripted.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.sparql;
-
-import junit.framework.TestSuite ;
-import org.apache.jena.riot.langsuite.FactoryTestRiot;
-import org.apache.jena.sparql.expr.E_Function ;
-import org.apache.jena.sparql.expr.NodeValue ;
-import org.apache.jena.sparql.junit.ScriptTestSuiteFactory ;
-
-public class TC_Scripted extends TestSuite
-{
- static public TestSuite suite()
- {
- TestSuite ts = new TC_Scripted() ;
- ts.addTest(ScriptTestSuiteFactory.make(ARQTestSuite.testDirARQ+"/Syntax/manifest-syntax.ttl")) ;
- ts.addTest(ScriptTestSuiteFactory.make(ARQTestSuite.testDirARQ+"/manifest-arq.ttl")) ;
- ts.addTest(ScriptTestSuiteFactory.make(ARQTestSuite.testDirARQ+"/Serialization/manifest.ttl")) ;
-
- String testDirRDFStar = "testing/ARQ/RDF-Star";
- ts.addTest(FactoryTestRiot.make(testDirRDFStar+"/Turtle-Star/manifest.ttl"));
- ts.addTest(ScriptTestSuiteFactory.make(testDirRDFStar+"/SPARQL-Star/manifest.ttl")) ;
-
- return ts ;
- }
-
- public TC_Scripted()
- {
- super("Scripted") ;
- NodeValue.VerboseWarnings = false ;
- E_Function.WarnOnUnknownFunction = false ;
- }
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/AbstractDatasetGraphFind.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/AbstractDatasetGraphFind.java
index 9c4f878..86c031f 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/AbstractDatasetGraphFind.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/AbstractDatasetGraphFind.java
@@ -21,7 +21,7 @@
import static org.apache.jena.atlas.iterator.Iter.asStream ;
import static org.apache.jena.atlas.iterator.Iter.toList;
import static org.apache.jena.atlas.iterator.Iter.toSet;
-import static org.apache.jena.atlas.junit.BaseTest.assertEqualsUnordered;
+import static org.apache.jena.atlas.junit.AssertExtra.assertEqualsUnordered;
import static org.junit.Assert.assertEquals ;
import static org.junit.Assert.assertFalse ;
import static org.junit.Assert.assertNotNull;
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/AbstractDatasetGraphFindPatterns.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/AbstractDatasetGraphFindPatterns.java
index 533a8a0..582745c 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/AbstractDatasetGraphFindPatterns.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/AbstractDatasetGraphFindPatterns.java
@@ -26,7 +26,7 @@
import java.util.List ;
import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.atlas.junit.AssertExtra ;
import org.apache.jena.graph.Node ;
import org.apache.jena.sparql.sse.SSE ;
import org.junit.Test ;
@@ -96,7 +96,7 @@
assertNotNull("find()", quads1);
List<Quad> quads2 = toList(dsg.find(null, null, null, null)) ;
assertNotNull("find(null,null,null,null)", quads2);
- BaseTest.assertEqualsUnordered("find()", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find()", quads1, quads2);
}
@Test public void find_pattern_gspo() {
@@ -104,49 +104,49 @@
List<Quad> quads1 = toList(dsg.find(node(":g"), node(":s"), node(":p"), node(":o"))) ;
assertNotNull("find(g,s,p,o)", quads1);
List<Quad> quads2 = Arrays.asList(q) ;
- BaseTest.assertEqualsUnordered("find(gspo)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(gspo)", quads1, quads2);
}
@Test public void find_pattern_g() {
DatasetGraph dsg = create(dataPattern) ;
List<Quad> quads1 = Iter.toList(dsg.find(node(":gx"), null, null, null)) ;
List<Quad> quads2 = Arrays.asList(q_g, q_gs, q_gp, q_go, q_gsp, q_gso, q_gpo, q_gspo) ;
- BaseTest.assertEqualsUnordered("find(g)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(g)", quads1, quads2);
}
@Test public void find_pattern_s() {
DatasetGraph dsg = create(dataPattern) ;
List<Quad> quads1 = Iter.toList(dsg.find(null, node(":sx"), null, null)) ;
List<Quad> quads2 = Arrays.asList(q_s, q_gs, q_sp, q_so, q_gsp, q_gso, q_spo, q_gspo) ;
- BaseTest.assertEqualsUnordered("find(s)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(s)", quads1, quads2);
}
@Test public void find_pattern_p() {
DatasetGraph dsg = create(dataPattern) ;
List<Quad> quads1 = Iter.toList(dsg.find(null, null, node(":px"), null)) ;
List<Quad> quads2 = Arrays.asList(q_p, q_gp, q_sp, q_po, q_gsp, q_gpo, q_spo, q_gspo) ;
- BaseTest.assertEqualsUnordered("find(p)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(p)", quads1, quads2);
}
@Test public void find_pattern_o() {
DatasetGraph dsg = create(dataPattern) ;
List<Quad> quads1 = Iter.toList(dsg.find(null, null, null, node(":ox"))) ;
List<Quad> quads2 = Arrays.asList(q_o, q_go, q_so, q_po, q_gpo, q_gso, q_spo, q_gspo) ;
- BaseTest.assertEqualsUnordered("find(o)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(o)", quads1, quads2);
}
@Test public void find_pattern_gs() {
DatasetGraph dsg = create(dataPattern) ;
List<Quad> quads1 = Iter.toList(dsg.find(node(":gx"), node(":sx"), null, null)) ;
List<Quad> quads2 = Arrays.asList(q_gs, q_gsp, q_gso, q_gspo) ;
- BaseTest.assertEqualsUnordered("find(gs)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(gs)", quads1, quads2);
}
@Test public void find_pattern_gp() {
DatasetGraph dsg = create(dataPattern) ;
List<Quad> quads1 = Iter.toList(dsg.find(node(":gx"), null, node(":px"), null)) ;
List<Quad> quads2 = Arrays.asList(q_gp, q_gsp, q_gpo, q_gspo) ;
- BaseTest.assertEqualsUnordered("find(gp)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(gp)", quads1, quads2);
}
@@ -154,54 +154,54 @@
DatasetGraph dsg = create(dataPattern) ;
List<Quad> quads1 = Iter.toList(dsg.find(node(":gx"), null, null, node(":ox"))) ;
List<Quad> quads2 = Arrays.asList(q_go, q_gpo, q_gso, q_gspo) ;
- BaseTest.assertEqualsUnordered("find(go)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(go)", quads1, quads2);
}
@Test public void find_pattern_sp() {
DatasetGraph dsg = create(dataPattern) ;
List<Quad> quads1 = Iter.toList(dsg.find(null, node(":sx"), node(":px"), null)) ;
List<Quad> quads2 = Arrays.asList(q_sp, q_gsp, q_spo, q_gspo) ;
- BaseTest.assertEqualsUnordered("find(sp)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(sp)", quads1, quads2);
}
@Test public void find_pattern_so() {
DatasetGraph dsg = create(dataPattern) ;
List<Quad> quads1 = Iter.toList(dsg.find(null, node(":sx"), null, node(":ox"))) ;
List<Quad> quads2 = Arrays.asList(q_so, q_gso, q_spo, q_gspo) ;
- BaseTest.assertEqualsUnordered("find(so)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(so)", quads1, quads2);
}
@Test public void find_pattern_po() {
DatasetGraph dsg = create(dataPattern) ;
List<Quad> quads1 = Iter.toList(dsg.find(null, null, node(":px"), node(":ox"))) ;
List<Quad> quads2 = Arrays.asList(q_po, q_gpo, q_spo, q_gspo) ;
- BaseTest.assertEqualsUnordered("find(po)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(po)", quads1, quads2);
}
@Test public void find_pattern_gsp() {
DatasetGraph dsg = create(dataPattern) ;
List<Quad> quads1 = Iter.toList(dsg.find(node(":gx"), node(":sx"), node(":px"), null)) ;
List<Quad> quads2 = Arrays.asList(q_gsp, q_gspo) ;
- BaseTest.assertEqualsUnordered("find(gsp)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(gsp)", quads1, quads2);
}
@Test public void find_pattern_gpo() {
DatasetGraph dsg = create(dataPattern) ;
List<Quad> quads1 = Iter.toList(dsg.find(node(":gx"), null, node(":px"), node(":ox"))) ;
List<Quad> quads2 = Arrays.asList(q_gpo, q_gspo) ;
- BaseTest.assertEqualsUnordered("find(gpo)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(gpo)", quads1, quads2);
}
@Test public void find_pattern_gso() {
DatasetGraph dsg = create(dataPattern) ;
List<Quad> quads1 = Iter.toList(dsg.find(node(":gx"), null, node(":px"), node(":ox"))) ;
List<Quad> quads2 = Arrays.asList(q_gpo, q_gspo) ;
- BaseTest.assertEqualsUnordered("find(gso)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(gso)", quads1, quads2);
}
@Test public void find_pattern_spo() {
DatasetGraph dsg = create(dataPattern) ;
List<Quad> quads1 = Iter.toList(dsg.find(null, node(":sx"), node(":px"), node(":ox"))) ;
List<Quad> quads2 = Arrays.asList(q_spo, q_gspo) ;
- BaseTest.assertEqualsUnordered("find(spo)", quads1, quads2);
+ AssertExtra.assertEqualsUnordered("find(spo)", quads1, quads2);
}
}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/TS_Core.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/TS_Core.java
index 088c2c9..b39190e 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/TS_Core.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/TS_Core.java
@@ -29,6 +29,7 @@
, TestDatasetGeneral.class
, TestDynamicDatasetMem.class
, TestDatasetGraphsRegular.class
+ , TestDatasetGraphLink.class
, TestDatasetGraphCopyAdd.class
, TestGraphOverDatasetMem.class
, TestDatasetGraphViewGraphs.class
@@ -36,7 +37,6 @@
, TestDatasetMonitor.class
, TestDatasetGraphBaseFind_General.class
- , TestDatasetGraphBaseFind_General.class
, TestDatasetGraphBaseFind_Mem.class
, TestDatasetGraphBaseFindPattern_General.class
, TestDatasetGraphBaseFindPattern_Mem.class
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TS_DatasetTxnMem.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TS_DatasetTxnMem.java
index 75ab451..2fa0f60 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TS_DatasetTxnMem.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TS_DatasetTxnMem.java
@@ -35,7 +35,7 @@
TestDatasetGraphInMemoryBasic.class,
TestDatasetGraphInMemoryViews.class,
TestDatasetGraphInMemoryLock.class,
- //TestDatasetGraphInMemoryThreading.class,
+ TestDatasetGraphInMemoryThreading.class,
TestDatasetGraphInMemoryTransactions.class,
TestDatasetGraphInMemoryFind.class,
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/engine/binding/TestBindingStreams.java b/jena-arq/src/test/java/org/apache/jena/sparql/engine/binding/TestBindingStreams.java
index 2e1d381..b37c7d0 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/engine/binding/TestBindingStreams.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/engine/binding/TestBindingStreams.java
@@ -48,14 +48,14 @@
public class TestBindingStreams
{
- @BeforeClass public static void beforeClass()
- {
- BaseTest2.setTestLogging() ;
+ @BeforeClass
+ public static void beforeClass() {
+ BaseTest2.setTestLogging();
}
- @AfterClass public static void afterClass()
- {
- BaseTest2.unsetTestLogging() ;
+ @AfterClass
+ public static void afterClass() {
+ BaseTest2.unsetTestLogging();
}
static Binding b12 = build("(?a 1) (?b 2)") ;
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/engine/iterator/TS_QueryIterators.java b/jena-arq/src/test/java/org/apache/jena/sparql/engine/iterator/TS_QueryIterators.java
index 4050f4e..5b380a1 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/engine/iterator/TS_QueryIterators.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/engine/iterator/TS_QueryIterators.java
@@ -29,6 +29,7 @@
, TestDistinctDataBagLimited.class
, TestDataBagDistinctOrder.class
, TestCancelDistinct.class
+ , TestSortedDataBagCancellation.class
})
public class TS_QueryIterators {
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/expr/TS_Expr.java b/jena-arq/src/test/java/org/apache/jena/sparql/expr/TS_Expr.java
index b9c3716..5ada19b 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/expr/TS_Expr.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/expr/TS_Expr.java
@@ -18,6 +18,7 @@
package org.apache.jena.sparql.expr;
+import org.apache.jena.sparql.expr.nodevalue.TestNodeValueSortKey;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@@ -45,6 +46,8 @@
, TestExprTransform.class
, TestCustomAggregates.class
, TestStatisticsAggregates.class
+ , TestFunctionDynamic.class
+ , TestNodeValueSortKey.class
})
public class TS_Expr
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/expr/nodevalue/TestNodeFunctions.java b/jena-arq/src/test/java/org/apache/jena/sparql/expr/nodevalue/TestNodeFunctions.java
deleted file mode 100644
index 0c09ab4..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/expr/nodevalue/TestNodeFunctions.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.sparql.expr.nodevalue;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.jena.sparql.expr.NodeValue;
-import org.junit.Test;
-
-/**
- * Tests for {@link NodeFunctions}.
- */
-public class TestNodeFunctions {
-
- @Test
- public void testSortKeyNodeValue() {
- NodeValue noveValue = NodeValue.makeString("Casa");
- NodeValue nv = NodeFunctions.sortKey(noveValue, "es");
- assertTrue(nv instanceof NodeValueSortKey);
- assertEquals("es", nv.getSortKey().getCollation());
- }
-
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/expr/nodevalue/TestNodeValueSortKey.java b/jena-arq/src/test/java/org/apache/jena/sparql/expr/nodevalue/TestNodeValueSortKey.java
index 3478745..26dd69d 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/expr/nodevalue/TestNodeValueSortKey.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/expr/nodevalue/TestNodeValueSortKey.java
@@ -23,6 +23,7 @@
import static org.junit.Assert.assertTrue;
import org.apache.jena.graph.Node;
+import org.apache.jena.sparql.expr.NodeValue;
import org.junit.Test;
/**
@@ -31,6 +32,14 @@
public class TestNodeValueSortKey {
@Test
+ public void testSortKeyNodeValue() {
+ NodeValue noveValue = NodeValue.makeString("Casa");
+ NodeValue nv = NodeFunctions.sortKey(noveValue, "es");
+ assertTrue(nv instanceof NodeValueSortKey);
+ assertEquals("es", nv.getSortKey().getCollation());
+ }
+
+ @Test
public void testCreateNodeValueSortKey() {
NodeValueSortKey nv = new NodeValueSortKey("", null);
assertTrue(nv.isSortKey());
@@ -76,7 +85,6 @@
public void testCompareTo() {
final String languageTag = "pt";
NodeValueSortKey nv = new NodeValueSortKey("Bonito", languageTag);
- assertEquals(0, nv.compareTo(null));
assertEquals(1, nv.compareTo(new NodeValueSortKey("Bonita", languageTag)));
assertEquals(-1, nv.compareTo(new NodeValueSortKey("Bonitos", languageTag)));
// comparing string, regardless of the collations
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/function/js/TestSPARQL_JS.java b/jena-arq/src/test/java/org/apache/jena/sparql/function/js/TestSPARQL_JS.java
index dd2ed64..f35dab8 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/function/js/TestSPARQL_JS.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/function/js/TestSPARQL_JS.java
@@ -18,32 +18,36 @@
package org.apache.jena.sparql.function.js;
-import junit.framework.TestSuite;
+import org.apache.jena.arq.junit.manifest.Label;
+import org.apache.jena.arq.junit.manifest.Manifests;
+import org.apache.jena.arq.junit.runners.RunnerSPARQL;
import org.apache.jena.query.ARQ;
-import org.apache.jena.sparql.junit.ScriptTestSuiteFactory;
import org.apache.jena.sparql.util.Context;
-import org.apache.jena.sys.JenaSystem;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.runner.RunWith;
-import org.junit.runners.AllTests;
-@RunWith(AllTests.class)
+@RunWith(RunnerSPARQL.class)
+@Label("SPARQL-JS")
+@Manifests({
+ "testing/ARQ/JS/manifest.ttl"
+})
public class TestSPARQL_JS {
- static final String MANIFEST = "testing/ARQ/JS/manifest.ttl";
static final String JS_LIB_FILE = "testing/ARQ/JS/test-library.js";
- private static void setupJS() {
+ @BeforeClass
+ public static void setupJS() {
Context cxt = ARQ.getContext();
cxt.set(ARQ.symJavaScriptLibFile, JS_LIB_FILE);
cxt.set(ARQ.symJavaScriptFunctions, "function inc(x) { return x+1 }");
EnvJavaScript.reset();
}
- static public TestSuite suite() {
- JenaSystem.init();
- setupJS();
- TestSuite ts = new TestSuite(TestSPARQL_JS.class.getName());
- TestSuite ts2 = ScriptTestSuiteFactory.make(MANIFEST);
- ts.addTest(ts2);
- return ts;
+ @AfterClass
+ public static void unsetupJS() {
+ Context cxt = ARQ.getContext();
+ cxt.remove(ARQ.symJavaScriptLibFile);
+ cxt.remove(ARQ.symJavaScriptFunctions);
+ //EnvJavaScript.reset();
}
}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/junit/EarlTestCase.java b/jena-arq/src/test/java/org/apache/jena/sparql/junit/EarlTestCase.java
deleted file mode 100644
index 2f81729..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/junit/EarlTestCase.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.sparql.junit;
-
-import junit.framework.AssertionFailedError ;
-import junit.framework.TestCase ;
-import org.apache.jena.query.Query ;
-import org.apache.jena.query.QueryFactory ;
-import org.apache.jena.query.Syntax ;
-import org.apache.jena.sparql.ARQException ;
-import org.apache.jena.update.UpdateFactory ;
-import org.apache.jena.update.UpdateRequest ;
-
-
-public abstract class EarlTestCase extends TestCase
-{
- protected EarlReport report = null ;
- protected String testURI = null ;
- private boolean resultRecorded = false ;
-
- protected EarlTestCase(String name, String testURI, EarlReport earl)
- {
- super(name) ;
- this.report = earl ;
- this.testURI = testURI ;
- }
-
- public void setEARL(EarlReport earl)
- {
- this.report = earl ;
- }
-
- protected Query queryFromString(String qStr)
- {
- Query query = QueryFactory.create(qStr) ;
- return query ;
- }
-
- protected Query queryFromTestItem(TestItem testItem)
- {
- if ( testItem.getQueryFile() == null )
- {
- fail("Query test file is null") ;
- return null ;
- }
-
- Query query = QueryFactory.read(testItem.getQueryFile(), null, testItem.getFileSyntax()) ;
- return query ;
- }
-
- protected UpdateRequest updateFromString(String str)
- {
- return UpdateFactory.create(str) ;
- }
-
- protected UpdateRequest updateFromTestItem(TestItem testItem)
- {
- if ( testItem.getQueryFile() == null )
- {
- fail("Query test file is null") ;
- return null ;
- }
-
- String fn = testItem.getQueryFile();
- Syntax syntax = ( fn.endsWith(".aru") )? Syntax.syntaxARQ : Syntax.syntaxSPARQL_11;
-
- UpdateRequest request = UpdateFactory.read(fn, syntax);
- return request ;
- }
-
- @Override
- final protected void runTest() throws Throwable
- {
- try {
- runTestForReal() ;
- if ( ! resultRecorded )
- success() ;
- } catch (AssertionFailedError ex)
- {
- if ( ! resultRecorded )
- failure() ;
- throw ex ;
- }
- }
-
- protected abstract void runTestForReal() throws Throwable ;
-
- // Increase visibility.
- @Override
- protected void setUp() {
- setUpTest() ;
- }
-
- @Override
- protected void tearDown() {
- tearDownTest() ;
- }
-
- // Decouple from JUnit3.
- public void setUpTest() {}
- public void tearDownTest() {}
-
- protected void success()
- {
- note() ;
- if ( report == null ) return ;
- report.success(testURI) ;
- }
-
- protected void failure()
- {
- note() ;
- if ( report == null ) return ;
- report.failure(testURI) ;
- }
-
- protected void notApplicable()
- {
- note() ;
- if ( report == null ) return ;
- report.notApplicable(testURI) ;
- }
-
- protected void notTested()
- {
- resultRecorded = true ;
- if ( report == null ) return ;
- report.notTested(testURI) ;
- }
-
- private void note()
- {
- if ( resultRecorded )
- throw new ARQException("Duplictaed test results: "+getName()) ;
- resultRecorded = true ;
- }
-
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/junit/ScriptTestSuiteFactory.java b/jena-arq/src/test/java/org/apache/jena/sparql/junit/ScriptTestSuiteFactory.java
deleted file mode 100644
index 78b06d9..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/junit/ScriptTestSuiteFactory.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.sparql.junit;
-
-import junit.framework.Test ;
-import junit.framework.TestCase ;
-import junit.framework.TestSuite ;
-import org.apache.jena.atlas.logging.Log ;
-import org.apache.jena.query.Syntax ;
-import org.apache.jena.rdf.model.Resource ;
-import org.apache.jena.sparql.vocabulary.TestManifest ;
-import org.apache.jena.sparql.vocabulary.TestManifestUpdate_11 ;
-import org.apache.jena.sparql.vocabulary.TestManifestX ;
-import org.apache.jena.sparql.vocabulary.TestManifest_11 ;
-import org.apache.jena.util.junit.TestFactoryManifest ;
-import org.apache.jena.util.junit.TestUtils ;
-
-public class ScriptTestSuiteFactory extends TestFactoryManifest
-{
- // Set (and retrieve) externally.
- public static EarlReport results = null ;
-
- /** Make a test suite from a manifest file */
- static public TestSuite make(String filename)
- {
- ScriptTestSuiteFactory tFact = new ScriptTestSuiteFactory() ;
- return tFact.process(filename) ;
- }
-
- /** Make a single test */
- static public TestSuite make(String query, String data, String result)
- {
- TestItem item = TestItem.create(query, query, data, result) ;
- QueryTest t = new QueryTest(item.getName(), null, item) ;
- TestSuite ts = new TestSuite() ;
- ts.setName(TestUtils.safeName(query)) ;
- ts.addTest(t) ;
- return ts ;
- }
-
- @Override
- public Test makeTest(Resource manifest, Resource entry, String testName, Resource action, Resource result)
- {
- if ( action == null )
- {
- System.out.println("Null action: "+entry) ;
- return null ;
- }
-
- // Defaults.
- Syntax querySyntax = TestQueryUtils.getQuerySyntax(manifest) ;
-
- if ( querySyntax != null )
- {
- if ( ! querySyntax.equals(Syntax.syntaxARQ) &&
- ! querySyntax.equals(Syntax.syntaxSPARQL_10) &&
- ! querySyntax.equals(Syntax.syntaxSPARQL_11) )
- throw new QueryTestException("Unknown syntax: "+querySyntax) ;
- }
-
- TestItem item = TestItem.create(entry, TestManifest.QueryEvaluationTest) ;
- Resource testType = item.getTestType() ;
- TestCase test = null ;
-
- // Frankly this all needs rewriting.
- // Drop the idea of testItem. pass entry/action/result to subclass.
- // Library for parsing entries.
-
- if ( testType != null )
- {
- // == Good syntax
- if ( testType.equals(TestManifest.PositiveSyntaxTest) )
- return new SyntaxTest(testName, results, item) ;
- if ( testType.equals(TestManifest_11.PositiveSyntaxTest11) )
- return new SyntaxTest(testName, results, item) ;
- if ( testType.equals(TestManifestX.PositiveSyntaxTestARQ) )
- return new SyntaxTest(testName, results, item) ;
-
- // == Bad
- if ( testType.equals(TestManifest.NegativeSyntaxTest) )
- return new SyntaxTest(testName, results, item, false) ;
- if ( testType.equals(TestManifest_11.NegativeSyntaxTest11) )
- return new SyntaxTest(testName, results, item, false) ;
- if ( testType.equals(TestManifestX.NegativeSyntaxTestARQ) )
- return new SyntaxTest(testName, results, item, false) ;
-
- // ---- Update tests
- if ( testType.equals(TestManifest_11.PositiveUpdateSyntaxTest11) )
- return new SyntaxUpdateTest(testName, results, item, true) ;
- if ( testType.equals(TestManifestX.PositiveUpdateSyntaxTestARQ) )
- return new SyntaxUpdateTest(testName, results, item, true) ;
-
- if ( testType.equals(TestManifest_11.NegativeUpdateSyntaxTest11) )
- return new SyntaxUpdateTest(testName, results, item, false) ;
- if ( testType.equals(TestManifestX.NegativeUpdateSyntaxTestARQ) )
- return new SyntaxUpdateTest(testName, results, item, false) ;
-
- // Two names for same thing.
- // Note item is not passed down.
- if ( testType.equals(TestManifestUpdate_11.UpdateEvaluationTest) )
- return UpdateTest.create(testName, results, entry, action, result) ;
- if ( testType.equals(TestManifest_11.UpdateEvaluationTest) )
- return UpdateTest.create(testName, results, entry, action, result) ;
-
- // ----
-
- if ( testType.equals(TestManifestX.TestSerialization) )
- return new TestSerialization(testName, results, item) ;
-
- if ( testType.equals(TestManifest.QueryEvaluationTest)
- || testType.equals(TestManifestX.TestQuery)
- )
- return new QueryTest(testName, results, item) ;
-
- // Reduced is funny.
- if ( testType.equals(TestManifest.ReducedCardinalityTest) )
- return new QueryTest(testName, results, item) ;
-
- if ( testType.equals(TestManifestX.TestSurpressed) )
- return new SurpressedTest(testName, results, item) ;
-
- if ( testType.equals(TestManifest_11.CSVResultFormatTest) )
- {
- Log.warn("Tests", "Skip CSV test: "+testName) ;
- return null ;
- }
-
- System.err.println("Test type '"+testType+"' not recognized") ;
- }
- // Default
- test = new QueryTest(testName, results, item) ;
- return test ;
- }
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/junit/SyntaxTest.java b/jena-arq/src/test/java/org/apache/jena/sparql/junit/SyntaxTest.java
deleted file mode 100644
index 84a2e4a..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/junit/SyntaxTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.sparql.junit;
-
-//import java.io.IOException;
-
-import org.apache.jena.query.QueryException ;
-
-
-public class SyntaxTest extends EarlTestCase
-{
- static int count = 0 ;
- String queryString ;
- boolean expectLegalSyntax ;
- TestItem testItem ;
-
- public SyntaxTest(String testName, EarlReport earl, TestItem t)
- {
- this(testName, earl, t, true) ;
- }
-
- public SyntaxTest(String testName, EarlReport earl, TestItem t, boolean positiveTest)
- {
- super(testName, t.getURI(), earl) ;
- testItem = t ;
- expectLegalSyntax = positiveTest ;
- }
-
- public SyntaxTest(String testName, EarlReport earl, String queryString, boolean positiveTest)
- {
- super(testName, TestItem.fakeURI(), earl) ;
- setTest(testName, queryString, positiveTest) ;
- }
-
- private void setTest(String testName, String _queryString, boolean positiveTest)
- {
- super.setName(testName) ;
- this.queryString = _queryString ;
- expectLegalSyntax = positiveTest ;
- }
-
-
- @Override
- protected void runTestForReal()
- {
- try {
- if ( queryString == null )
- queryFromTestItem(testItem) ;
- else
- queryFromString(queryString) ;
-
- if ( ! expectLegalSyntax )
- fail("Expected parse failure") ;
- }
- catch (QueryException qEx)
- {
- if ( expectLegalSyntax )
- throw qEx ;
- }
-
- catch (Exception ex)
- {
- fail( "Exception: "+ex.getClass().getName()+": "+ex.getMessage()) ;
- }
- }
-
-
-
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/junit/SyntaxUpdateTest.java b/jena-arq/src/test/java/org/apache/jena/sparql/junit/SyntaxUpdateTest.java
deleted file mode 100644
index eec627d..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/junit/SyntaxUpdateTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.sparql.junit;
-
-import org.apache.jena.query.QueryException ;
-
-
-public class SyntaxUpdateTest extends EarlTestCase
-{
- static int count = 0 ;
- String updateString ;
- boolean expectLegalSyntax ;
- TestItem testItem ;
-
- public SyntaxUpdateTest(String testName, EarlReport earl, TestItem t)
- {
- this(testName, earl, t, true) ;
- }
-
- public SyntaxUpdateTest(String testName, EarlReport earl, TestItem t, boolean positiveTest)
- {
- super(testName, t.getURI(), earl) ;
- testItem = t ;
- expectLegalSyntax = positiveTest ;
- }
-
- public SyntaxUpdateTest(String testName, EarlReport earl, String queryString, boolean positiveTest)
- {
- super(testName, TestItem.fakeURI(), earl) ;
- setTest(testName, queryString, positiveTest) ;
- }
-
- private void setTest(String testName, String _queryString, boolean positiveTest)
- {
- super.setName(testName) ;
- this.updateString = _queryString ;
- expectLegalSyntax = positiveTest ;
- }
-
-
- @Override
- protected void runTestForReal()
- {
- try {
- if ( updateString == null )
- updateFromTestItem(testItem) ;
- else
- updateFromString(updateString) ;
-
- if ( ! expectLegalSyntax )
- fail("Expected parse failure") ;
- }
- catch (QueryException qEx)
- {
- if ( expectLegalSyntax )
- throw qEx ;
- }
-
- catch (Exception ex)
- {
- fail( "Exception: "+ex.getClass().getName()+": "+ex.getMessage()) ;
- }
- }
-
-
-
-}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/lib/TS_Lib.java b/jena-arq/src/test/java/org/apache/jena/sparql/lib/TS_SparqlLib.java
similarity index 97%
rename from jena-arq/src/test/java/org/apache/jena/sparql/lib/TS_Lib.java
rename to jena-arq/src/test/java/org/apache/jena/sparql/lib/TS_SparqlLib.java
index b91cb6c..6212dab 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/lib/TS_Lib.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/lib/TS_SparqlLib.java
@@ -26,6 +26,6 @@
@SuiteClasses( {
TestRDFTerm2Json.class
})
-public class TS_Lib {
+public class TS_SparqlLib {
}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/modify/AbstractTestUpdateBase.java b/jena-arq/src/test/java/org/apache/jena/sparql/modify/AbstractTestUpdateBase.java
index f6a634c..9955868 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/modify/AbstractTestUpdateBase.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/modify/AbstractTestUpdateBase.java
@@ -18,11 +18,11 @@
package org.apache.jena.sparql.modify ;
+import org.apache.jena.arq.ARQTestSuite;
import org.apache.jena.graph.Graph ;
import org.apache.jena.graph.GraphUtil ;
import org.apache.jena.graph.Node ;
import org.apache.jena.graph.Triple ;
-import org.apache.jena.sparql.ARQTestSuite ;
import org.apache.jena.sparql.core.DatasetGraph ;
import org.apache.jena.sparql.graph.GraphFactory ;
import org.apache.jena.update.UpdateAction ;
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/path/TestPathPF.java b/jena-arq/src/test/java/org/apache/jena/sparql/path/TestPathPF.java
index 594f582..38e47ec 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/path/TestPathPF.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/path/TestPathPF.java
@@ -24,7 +24,7 @@
import java.util.List ;
import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.atlas.junit.AssertExtra ;
import org.apache.jena.graph.Factory ;
import org.apache.jena.graph.Graph ;
import org.apache.jena.graph.Node ;
@@ -157,6 +157,6 @@
private static void check(Iterator<Node> iter, List<Node> expected) {
List<Node> x = Iter.toList(iter) ;
- BaseTest.assertEqualsUnordered(expected,x) ;
+ AssertExtra.assertEqualsUnordered(expected,x) ;
}
}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/resultset/TS_ResultSet.java b/jena-arq/src/test/java/org/apache/jena/sparql/resultset/TS_ResultSet.java
index 877658f..f3292f0 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/resultset/TS_ResultSet.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/resultset/TS_ResultSet.java
@@ -26,7 +26,6 @@
TestResultSet.class
, TestResultSetFormat1.class
, TestResultSetFormat2.class
- //, TestResultSetCompare.class
})
public class TS_ResultSet
{
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/solver/TestSolverLib.java b/jena-arq/src/test/java/org/apache/jena/sparql/solver/SolverLibTest.java
similarity index 98%
rename from jena-arq/src/test/java/org/apache/jena/sparql/solver/TestSolverLib.java
rename to jena-arq/src/test/java/org/apache/jena/sparql/solver/SolverLibTest.java
index 93b2b3e..b0014ad 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/solver/TestSolverLib.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/solver/SolverLibTest.java
@@ -25,7 +25,7 @@
import org.apache.jena.sparql.sse.Item ;
import org.apache.jena.sparql.sse.SSE ;
-public class TestSolverLib
+public class SolverLibTest
{
public static BasicPattern bgp(String str)
{
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/solver/TestReorder.java b/jena-arq/src/test/java/org/apache/jena/sparql/solver/TestReorder.java
index b184d0c..2ae5e6d 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/solver/TestReorder.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/solver/TestReorder.java
@@ -18,9 +18,9 @@
package org.apache.jena.sparql.solver;
-import static org.apache.jena.sparql.solver.TestSolverLib.bgp ;
-import static org.apache.jena.sparql.solver.TestSolverLib.matcher ;
-import static org.apache.jena.sparql.solver.TestSolverLib.triple ;
+import static org.apache.jena.sparql.solver.SolverLibTest.bgp ;
+import static org.apache.jena.sparql.solver.SolverLibTest.matcher ;
+import static org.apache.jena.sparql.solver.SolverLibTest.triple ;
import static org.junit.Assert.assertEquals;
import org.apache.jena.graph.Triple ;
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/util/TestDyadicDatasetGraph.java b/jena-arq/src/test/java/org/apache/jena/sparql/util/AbstractTestDyadicDatasetGraph.java
similarity index 99%
rename from jena-arq/src/test/java/org/apache/jena/sparql/util/TestDyadicDatasetGraph.java
rename to jena-arq/src/test/java/org/apache/jena/sparql/util/AbstractTestDyadicDatasetGraph.java
index 2b2fefe..3918a92 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/util/TestDyadicDatasetGraph.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/util/AbstractTestDyadicDatasetGraph.java
@@ -33,7 +33,7 @@
import org.apache.jena.sparql.core.DatasetGraphZero;
import org.junit.Test;
-public abstract class TestDyadicDatasetGraph {
+public abstract class AbstractTestDyadicDatasetGraph {
public abstract DatasetGraph testInstance(DatasetGraph left, DatasetGraph right, Context c);
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/util/TS_DyadicDatasetGraphs.java b/jena-arq/src/test/java/org/apache/jena/sparql/util/TS_DyadicDatasetGraphs.java
index 643b41b..438a9b5 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/util/TS_DyadicDatasetGraphs.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/util/TS_DyadicDatasetGraphs.java
@@ -23,6 +23,9 @@
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({ TestIntersectionDatasetGraph.class, TestDifferenceDatasetGraph.class, TestUnionDatasetGraph.class })
+@SuiteClasses({
+ TestIntersectionDatasetGraph.class,
+ TestDifferenceDatasetGraph.class,
+ TestUnionDatasetGraph.class })
public class TS_DyadicDatasetGraphs {}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/util/TS_Util.java b/jena-arq/src/test/java/org/apache/jena/sparql/util/TS_Util.java
index 40f108d..05d7212 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/util/TS_Util.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/util/TS_Util.java
@@ -18,8 +18,6 @@
package org.apache.jena.sparql.util;
-import org.apache.jena.atlas.lib.TestDateTimeUtils ;
-import org.apache.jena.sparql.util.compose.TS_DatasetCollectors;
import org.junit.runner.RunWith ;
import org.junit.runners.Suite ;
import org.junit.runners.Suite.SuiteClasses ;
@@ -28,10 +26,8 @@
@SuiteClasses( {
TestDateTimeParsing.class ,
TestList.class ,
- TestDateTimeUtils.class ,
TestFmtUtils.class,
- TS_DyadicDatasetGraphs.class,
- TS_DatasetCollectors.class
+ TestVersion.class
})
public class TS_Util
{ }
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/util/TestDifferenceDatasetGraph.java b/jena-arq/src/test/java/org/apache/jena/sparql/util/TestDifferenceDatasetGraph.java
index 68ac50a..93588cd 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/util/TestDifferenceDatasetGraph.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/util/TestDifferenceDatasetGraph.java
@@ -27,7 +27,7 @@
import org.apache.jena.sparql.core.DatasetGraphFactory;
import org.junit.Test;
-public class TestDifferenceDatasetGraph extends TestDyadicDatasetGraph {
+public class TestDifferenceDatasetGraph extends AbstractTestDyadicDatasetGraph {
@Override
public DifferenceDatasetGraph testInstance(DatasetGraph left, DatasetGraph right, Context c) {
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/util/TestIntersectionDatasetGraph.java b/jena-arq/src/test/java/org/apache/jena/sparql/util/TestIntersectionDatasetGraph.java
index 909ac33..8c12618 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/util/TestIntersectionDatasetGraph.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/util/TestIntersectionDatasetGraph.java
@@ -27,7 +27,7 @@
import org.apache.jena.sparql.core.DatasetGraphFactory;
import org.junit.Test;
-public class TestIntersectionDatasetGraph extends TestDyadicDatasetGraph {
+public class TestIntersectionDatasetGraph extends AbstractTestDyadicDatasetGraph {
@Override
public IntersectionDatasetGraph testInstance(DatasetGraph left, DatasetGraph right, Context c) {
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/util/TestList.java b/jena-arq/src/test/java/org/apache/jena/sparql/util/TestList.java
index e72e923..adbfead 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/util/TestList.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/util/TestList.java
@@ -29,7 +29,7 @@
import java.util.List ;
import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.atlas.junit.AssertExtra ;
import org.apache.jena.datatypes.xsd.XSDDatatype ;
import org.apache.jena.graph.* ;
import org.apache.jena.rdf.model.Model ;
@@ -250,7 +250,7 @@
private static void check(List<Node> z, Node...expected) {
List<Node> x = Arrays.asList(expected) ;
- BaseTest.assertEqualsUnordered(x, z);
+ AssertExtra.assertEqualsUnordered(x, z);
}
}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/util/TestUnionDatasetGraph.java b/jena-arq/src/test/java/org/apache/jena/sparql/util/TestUnionDatasetGraph.java
index 7129bab..6af517e 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/util/TestUnionDatasetGraph.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/util/TestUnionDatasetGraph.java
@@ -28,7 +28,7 @@
import org.junit.Assert;
import org.junit.Test;
-public class TestUnionDatasetGraph extends TestDyadicDatasetGraph {
+public class TestUnionDatasetGraph extends AbstractTestDyadicDatasetGraph {
@Override
public DatasetGraph testInstance(DatasetGraph left, DatasetGraph right, Context c) {
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TestDatasetCollector.java b/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/AbstractTestDatasetCollector.java
similarity index 93%
rename from jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TestDatasetCollector.java
rename to jena-arq/src/test/java/org/apache/jena/sparql/util/compose/AbstractTestDatasetCollector.java
index 2d2bfd3..5860189 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TestDatasetCollector.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/AbstractTestDatasetCollector.java
@@ -20,17 +20,19 @@
import static org.apache.jena.rdf.model.ModelFactory.createModelForGraph;
import static org.apache.jena.sparql.sse.SSE.parseGraph;
+import static org.junit.Assert.assertTrue;
import java.util.stream.Stream;
-import org.apache.jena.graph.*;
+import org.apache.jena.graph.Graph;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.NodeFactory;
import org.apache.jena.query.Dataset;
import org.apache.jena.query.DatasetFactory;
import org.apache.jena.rdf.model.Model;
-import org.junit.Assert;
import org.junit.Test;
-public abstract class TestDatasetCollector extends Assert {
+public abstract class AbstractTestDatasetCollector {
public abstract DatasetCollector testInstance();
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TS_DatasetCollectors.java b/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TS_DatasetCollectors.java
index 2087686..f45417f 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TS_DatasetCollectors.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TS_DatasetCollectors.java
@@ -23,6 +23,9 @@
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({ TestIntersectionDatasetCollector.class, TestUnionDatasetCollector.class })
+@SuiteClasses({
+ TestIntersectionDatasetCollector.class
+ , TestUnionDatasetCollector.class
+ })
public class TS_DatasetCollectors {
}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TestIntersectionDatasetCollector.java b/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TestIntersectionDatasetCollector.java
index 6de3e16..98c808e 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TestIntersectionDatasetCollector.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TestIntersectionDatasetCollector.java
@@ -21,6 +21,7 @@
import static org.apache.jena.graph.NodeFactory.createBlankNode;
import static org.apache.jena.rdf.model.ModelFactory.createModelForGraph;
import static org.apache.jena.sparql.sse.SSE.parseGraph;
+import static org.junit.Assert.assertTrue;
import java.util.stream.Stream;
@@ -29,7 +30,7 @@
import org.apache.jena.rdf.model.Model;
import org.junit.Test;
-public class TestIntersectionDatasetCollector extends TestDatasetCollector {
+public class TestIntersectionDatasetCollector extends AbstractTestDatasetCollector {
@Override
public DatasetCollector testInstance() {
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TestUnionDatasetCollector.java b/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TestUnionDatasetCollector.java
index 7c053d9..4c1df0f 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TestUnionDatasetCollector.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/util/compose/TestUnionDatasetCollector.java
@@ -20,6 +20,8 @@
import static org.apache.jena.rdf.model.ModelFactory.createModelForGraph;
import static org.apache.jena.sparql.sse.SSE.parseGraph;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.List;
import java.util.stream.Stream;
@@ -34,7 +36,7 @@
import org.junit.Assert;
import org.junit.Test;
-public class TestUnionDatasetCollector extends TestDatasetCollector {
+public class TestUnionDatasetCollector extends AbstractTestDatasetCollector {
@Override
public DatasetCollector testInstance() {
diff --git a/jena-arq/testing/ARQ/BlankNodes/manifest.ttl b/jena-arq/testing/ARQ/BlankNodes/manifest.ttl
deleted file mode 100644
index 1103f0e..0000000
--- a/jena-arq/testing/ARQ/BlankNodes/manifest.ttl
+++ /dev/null
@@ -1,33 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
-@prefix mfx: <http://jena.hpl.hp.com/2005/05/test-manifest-extra#> .
-@prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> .
-
-<> rdf:type mf:Manifest ;
- rdfs:label "Blank Node tests" ;
- mf:entries
- (
- [ mf:name "Blank nodes in BGP" ;
- rdf:type mfx:TestQuery ;
- mf:action
- [ qt:query <blank-bgp-01.rq> ;
- qt:data <data.ttl> ] ;
- mf:result <blank-bgp-result-01.srx>
- ]
- ).
diff --git a/jena-arq/testing/ARQ/Planning/README b/jena-arq/testing/ARQ/Planning/README
new file mode 100644
index 0000000..eb60bb6
--- /dev/null
+++ b/jena-arq/testing/ARQ/Planning/README
@@ -0,0 +1,8 @@
+## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+Run Planning/manifest.ttl which is set for the text-modefixed reording applies
+in StageGeneratorGeneric
+
+Do not run in test suite:
+ Planning/manifest-no-reorder.ttl
+ Planning/manifest-reorder.ttl
diff --git a/jena-arq/testing/DAWG/Misc/manifest-dawg.n3 b/jena-arq/testing/DAWG/Misc/manifest-dawg.n3
deleted file mode 100644
index a8b3d71..0000000
--- a/jena-arq/testing/DAWG/Misc/manifest-dawg.n3
+++ /dev/null
@@ -1,53 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
-@prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> .
-
-<> rdf:type mf:Manifest ;
- rdfs:comment "Some DAWG test cases" ;
- mf:entries
- (
- [ mf:name "dawg-query-001" ;
- rdfs:comment
- "Optional triples: single optional triple case." ;
- mf:action
- [ qt:query <dawg-query-001.rq> ;
- qt:data <dawg-data-01.n3> ] ;
- mf:result <dawg-result-001.n3>
- ]
-
- [ mf:name "dawg-query-002" ;
- rdfs:comment
- "Optional triples: multiple triples in one optional clause. Must find a name for each person known." ;
- mf:action
- [ qt:query <dawg-query-002.rq> ;
- qt:data <dawg-data-01.n3> ] ;
- mf:result <dawg-result-002.n3>
- ]
-
- [ mf:name "dawg-query-003" ;
- rdfs:comment
- "Optional triples: multiple optional clauses." ;
- mf:action
- [ qt:query <dawg-query-003.rq> ;
- qt:data <dawg-data-01.n3> ] ;
- mf:result <dawg-result-003.n3>
- ]
-
- # End of tests
- ).
diff --git a/jena-arq/testing/DAWG/i18n/LICENSE b/jena-arq/testing/DAWG/i18n/LICENSE
deleted file mode 100644
index 5f88e1c..0000000
--- a/jena-arq/testing/DAWG/i18n/LICENSE
+++ /dev/null
@@ -1,49 +0,0 @@
-The test materials in this directory are licensed under
-
-http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
-
-
-W3C Software Notice and License
-
-This work (and included software, documentation such as READMEs, or other
-related items) is being provided by the copyright holders under the
-following license. License
-
-By obtaining, using and/or copying this work, you (the licensee) agree that
-you have read, understood, and will comply with the following terms and
-conditions.
-
-Permission to copy, modify, and distribute this software and its
-documentation, with or without modification, for any purpose and without
-fee or royalty is hereby granted, provided that you include the following
-on ALL copies of the software and documentation or portions thereof,
-including modifications:
-
-* The full text of this NOTICE in a location viewable to users of the
- redistributed or derivative work.
-
-* Any pre-existing intellectual property disclaimers, notices, or terms and
- conditions. If none exist, the W3C Software Short Notice should be
- included (hypertext is preferred, text is permitted) within the body of
- any redistributed or derivative code.
-
-* Notice of any changes or modifications to the files, including the date
- changes were made. (We recommend you provide URIs to the location from
- which the code is derived.)
-
-Disclaimers
-
-THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
-MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT
-NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
-PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE
-ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
-
-COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
-DOCUMENTATION.
-
-The name and trademarks of copyright holders may NOT be used in advertising
-or publicity pertaining to the software without specific, written prior
-permission. Title to copyright in this software and any associated
-documentation will at all times remain with copyright holders.
diff --git a/jena-arq/testing/DAWG/i18n/kanji-01-results.ttl b/jena-arq/testing/DAWG/i18n/kanji-01-results.ttl
deleted file mode 100644
index 12401c9..0000000
--- a/jena-arq/testing/DAWG/i18n/kanji-01-results.ttl
+++ /dev/null
@@ -1,22 +0,0 @@
-@prefix 食: <http://www.w3.org/2001/sw/DataAccess/tests/data/i18n/kangi.ttl#> .
-@prefix rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix foaf: <http://xmlns.com/foaf/0.1/> .
-
-[] rdf:type rs:ResultSet ;
- rs:resultVariable "food" ;
- rs:resultVariable "name" ;
- rs:solution [ rs:binding [ rs:value "Bob" ;
- rs:variable "name"
- ] ;
- rs:binding [ rs:value 食:海老 ;
- rs:variable "food"
- ]
- ] ;
- rs:solution [ rs:binding [ rs:value "Alice" ;
- rs:variable "name"
- ] ;
- rs:binding [ rs:value 食:納豆 ;
- rs:variable "food"
- ]
- ] .
diff --git a/jena-arq/testing/DAWG/i18n/kanji-01.rq b/jena-arq/testing/DAWG/i18n/kanji-01.rq
deleted file mode 100644
index 0d7494a..0000000
--- a/jena-arq/testing/DAWG/i18n/kanji-01.rq
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Id: kanji-01.rq,v 1.1 2005/10/25 17:26:57 andy_seaborne Exp $
-# test kanji QNames
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX 食: <http://www.w3.org/2001/sw/DataAccess/tests/data/i18n/kangi.ttl#>
-SELECT ?name ?food WHERE {
- [ foaf:name ?name ;
- 食:食べる ?food ] . }
diff --git a/jena-arq/testing/DAWG/i18n/kanji-02-results.ttl b/jena-arq/testing/DAWG/i18n/kanji-02-results.ttl
deleted file mode 100644
index 2613753..0000000
--- a/jena-arq/testing/DAWG/i18n/kanji-02-results.ttl
+++ /dev/null
@@ -1,11 +0,0 @@
-@prefix 食: <http://www.w3.org/2001/sw/DataAccess/tests/data/i18n/kangi.ttl#> .
-@prefix rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix foaf: <http://xmlns.com/foaf/0.1/> .
-
-[] rdf:type rs:ResultSet ;
- rs:resultVariable "name" ;
- rs:solution [ rs:binding [ rs:value "Bob" ;
- rs:variable "name"
- ]
- ] .
diff --git a/jena-arq/testing/DAWG/i18n/kanji-02.rq b/jena-arq/testing/DAWG/i18n/kanji-02.rq
deleted file mode 100644
index 7e0a56a..0000000
--- a/jena-arq/testing/DAWG/i18n/kanji-02.rq
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Id: kanji-02.rq,v 1.1 2005/10/25 17:26:57 andy_seaborne Exp $
-# test wide spaces
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX 食: <http://www.w3.org/2001/sw/DataAccess/tests/data/i18n/kangi.ttl#>
-SELECT ?name WHERE {
- [ foaf:name ?name ;
- 食:食べる 食:海老 ] . }
diff --git a/jena-arq/testing/DAWG/i18n/kanji.ttl b/jena-arq/testing/DAWG/i18n/kanji.ttl
deleted file mode 100644
index b05b564..0000000
--- a/jena-arq/testing/DAWG/i18n/kanji.ttl
+++ /dev/null
@@ -1,20 +0,0 @@
-# $Id: kanji.ttl,v 1.1 2005/10/25 17:26:57 andy_seaborne Exp $
-# See DOCUMENT INFO below.
-
-# NAMESPACES
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix owl: <http://www.w3.org/2002/07/owl#> .
-@prefix foaf: <http://xmlns.com/foaf/0.1/> .
-@prefix 食: <http://www.w3.org/2001/sw/DataAccess/tests/data/i18n/kangi.ttl#> .
-
-# DOCUMENT INFO
-<> rdfs:comment "test kanji with and without wide spaces" ;
- owl:versionInfo "$Id: kanji.ttl,v 1.1 2005/10/25 17:26:57 andy_seaborne Exp $".
-
-# DOCUMENT
-[ foaf:name "Alice" ;
- 食:食べる 食:納豆 ] .
-
-[ foaf:name "Bob" ;
- 食:食べる 食:海老 ] .
-
diff --git a/jena-arq/testing/DAWG/i18n/manifest.ttl b/jena-arq/testing/DAWG/i18n/manifest.ttl
deleted file mode 100644
index 07d1144..0000000
--- a/jena-arq/testing/DAWG/i18n/manifest.ttl
+++ /dev/null
@@ -1,76 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# $Id: manifest.ttl,v 1.1 2005/10/25 17:26:57 andy_seaborne Exp $
-
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix dawgt: <http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#> .
-@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
-@prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> .
-
-<> rdf:type mf:Manifest ;
- rdfs:comment "BASE IRI Resolution" ;
- mf:entries
- (
-
-
-
- [ mf:name "kanji-01" ;
- mf:action
- [ qt:data <kanji.ttl> ;
- qt:query <kanji-01.rq> ] ;
- mf:result <kanji-01-results.ttl> ;
- ]
-
- [ mf:name "kanji-02" ;
- mf:action
- [ qt:data <kanji.ttl> ;
- qt:query <kanji-02.rq> ] ;
- mf:result <kanji-02-results.ttl> ;
- ]
-
-
- [ mf:name "normalization-01" ;
- mf:action
- [ qt:data <normalization-01.ttl> ;
- qt:query <normalization-01.rq> ] ;
- mf:result <normalization-01-results.ttl> ;
- ]
-
- [ mf:name "normalization-02" ;
- rdfs:comment
- "Example 1 from http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096" ;
- mf:action
- [ qt:data <normalization-02.ttl> ;
- qt:query <normalization-02.rq> ] ;
- mf:result <normalization-02-results.ttl> ;
- dawgt:approval dawgt:Approved ;
- dawgt:approvedBy <http://www.w3.org/2005/07/26-dawg-minutes>
- ]
-
- [ mf:name "normalization-03" ;
- rdfs:comment
- "Example 2 from http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096" ;
- mf:action
- [ qt:data <normalization-03.ttl> ;
- qt:query <normalization-03.rq> ] ;
- mf:result <normalization-03-results.ttl> ;
- dawgt:approval dawgt:Approved ;
- dawgt:approvedBy <http://www.w3.org/2005/07/26-dawg-minutes>
- ]
-
- # End of tests
- ).
diff --git a/jena-arq/testing/DAWG/i18n/normalization-01-results.ttl b/jena-arq/testing/DAWG/i18n/normalization-01-results.ttl
deleted file mode 100644
index d4bd306..0000000
--- a/jena-arq/testing/DAWG/i18n/normalization-01-results.ttl
+++ /dev/null
@@ -1,15 +0,0 @@
-@prefix HR: <http://www.w3.org/2001/sw/DataAccess/tests/data/i18n/normalization.ttl#> .
-@prefix rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix foaf: <http://xmlns.com/foaf/0.1/> .
-
-[] rdf:type rs:ResultSet ;
- rs:resultVariable "name" ;
- rs:solution [ rs:binding [ rs:value "Eve" ;
- rs:variable "name"
- ]
- ] ;
- rs:solution [ rs:binding [ rs:value "Bob" ;
- rs:variable "name"
- ]
- ] .
diff --git a/jena-arq/testing/DAWG/i18n/normalization-01.rq b/jena-arq/testing/DAWG/i18n/normalization-01.rq
deleted file mode 100644
index b003b0c..0000000
--- a/jena-arq/testing/DAWG/i18n/normalization-01.rq
+++ /dev/null
@@ -1,6 +0,0 @@
-# Figure out what happens with normalization form C.
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX HR: <http://www.w3.org/2001/sw/DataAccess/tests/data/i18n/normalization.ttl#>
-SELECT ?name
- WHERE { [ foaf:name ?name;
- HR:resumé ?resume ] . }
diff --git a/jena-arq/testing/DAWG/i18n/normalization-01.ttl b/jena-arq/testing/DAWG/i18n/normalization-01.ttl
deleted file mode 100644
index 132978c..0000000
--- a/jena-arq/testing/DAWG/i18n/normalization-01.ttl
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id: normalization-01.ttl,v 1.1 2005/10/25 17:26:57 andy_seaborne Exp $
-# See DOCUMENT INFO below.
-
-# NAMESPACES
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix owl: <http://www.w3.org/2002/07/owl#> .
-@prefix foaf: <http://xmlns.com/foaf/0.1/> .
-@prefix HR: <http://www.w3.org/2001/sw/DataAccess/tests/data/i18n/normalization.ttl#> .
-
-# DOCUMENT INFO
-<> rdfs:comment "Normalized and non-normalized IRIs" ;
- owl:versionInfo "$Id: normalization-01.ttl,v 1.1 2005/10/25 17:26:57 andy_seaborne Exp $".
-
-# DOCUMENT
-[ foaf:name "Alice" ;
- HR:resumé "Alice's normalized resumé" ] .
-
-[ foaf:name "Bob" ;
- HR:resumé "Bob's non-normalized resumé" ] .
-
-[ foaf:name "Eve" ;
- HR:resumé "Eve's normalized resumé" ;
- HR:resumé "Eve's non-normalized resumé" ] .
diff --git a/jena-arq/testing/DAWG/i18n/normalization-02-results.ttl b/jena-arq/testing/DAWG/i18n/normalization-02-results.ttl
deleted file mode 100644
index b4a46ad..0000000
--- a/jena-arq/testing/DAWG/i18n/normalization-02-results.ttl
+++ /dev/null
@@ -1,14 +0,0 @@
-# Example 1 from
-# http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096
-# $Id: normalization-02-results.ttl,v 1.1 2005/10/25 17:26:57 andy_seaborne Exp $
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> .
-
-[] <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
- rs:ResultSet ;
- rs:resultVariable
- "S" ;
- rs:solution [ rs:binding [ rs:value <http://example/vocab#s2> ;
- rs:variable "S"
- ]
- ] .
diff --git a/jena-arq/testing/DAWG/i18n/normalization-02.rq b/jena-arq/testing/DAWG/i18n/normalization-02.rq
deleted file mode 100644
index 1b1df8a..0000000
--- a/jena-arq/testing/DAWG/i18n/normalization-02.rq
+++ /dev/null
@@ -1,8 +0,0 @@
-# Example 1 from
-# http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096
-# $Id: normalization-02.rq,v 1.1 2005/10/25 17:26:57 andy_seaborne Exp $
-PREFIX : <http://example/vocab#>
-PREFIX p1: <eXAMPLE://a/./b/../b/%63/%7bfoo%7d#>
-
-SELECT ?S WHERE { ?S :p p1:xyz }
-
diff --git a/jena-arq/testing/DAWG/i18n/normalization-02.ttl b/jena-arq/testing/DAWG/i18n/normalization-02.ttl
deleted file mode 100644
index b6e8ded..0000000
--- a/jena-arq/testing/DAWG/i18n/normalization-02.ttl
+++ /dev/null
@@ -1,8 +0,0 @@
-# Example 1 from
-# http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096
-# $Id: normalization-02.ttl,v 1.1 2005/10/25 17:26:57 andy_seaborne Exp $
-@prefix : <http://example/vocab#>.
-
-:s1 :p <example://a/b/c/%7Bfoo%7D#xyz>.
-:s2 :p <eXAMPLE://a/./b/../b/%63/%7bfoo%7d#xyz>.
-
diff --git a/jena-arq/testing/DAWG/i18n/normalization-03-results.ttl b/jena-arq/testing/DAWG/i18n/normalization-03-results.ttl
deleted file mode 100644
index 9ef731c..0000000
--- a/jena-arq/testing/DAWG/i18n/normalization-03-results.ttl
+++ /dev/null
@@ -1,14 +0,0 @@
-# Example 1 from
-# http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096
-# $Id: normalization-03-results.ttl,v 1.1 2005/10/25 17:26:57 andy_seaborne Exp $
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> .
-
-[] <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
- rs:ResultSet ;
- rs:resultVariable
- "S" ;
- rs:solution [ rs:binding [ rs:value <http://example/vocab#s3> ;
- rs:variable "S"
- ]
- ] .
diff --git a/jena-arq/testing/DAWG/i18n/normalization-03.rq b/jena-arq/testing/DAWG/i18n/normalization-03.rq
deleted file mode 100644
index 72d453e..0000000
--- a/jena-arq/testing/DAWG/i18n/normalization-03.rq
+++ /dev/null
@@ -1,8 +0,0 @@
-# Example 2 from
-# http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096
-# $Id: normalization-03.rq,v 1.1 2005/10/25 17:26:57 andy_seaborne Exp $
-PREFIX : <http://example/vocab#>
-PREFIX p2: <http://example.com:80/#>
-
-SELECT ?S WHERE { ?S :p p2:abc }
-
diff --git a/jena-arq/testing/DAWG/i18n/normalization-03.ttl b/jena-arq/testing/DAWG/i18n/normalization-03.ttl
deleted file mode 100644
index 5cdf4bf..0000000
--- a/jena-arq/testing/DAWG/i18n/normalization-03.ttl
+++ /dev/null
@@ -1,9 +0,0 @@
-# Example 1 from
-# http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096
-# $Id: normalization-03.ttl,v 1.1 2005/10/25 17:26:57 andy_seaborne Exp $
-@prefix : <http://example/vocab#>.
-
-:s3 :p <http://example.com:80/#abc>.
-:s4 :p <http://example.com/#abc>.
-:s5 :p <http://example.com/#abc>.
-
diff --git a/jena-arq/testing/DAWG/regex/LICENSE b/jena-arq/testing/DAWG/regex/LICENSE
deleted file mode 100644
index 5f88e1c..0000000
--- a/jena-arq/testing/DAWG/regex/LICENSE
+++ /dev/null
@@ -1,49 +0,0 @@
-The test materials in this directory are licensed under
-
-http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
-
-
-W3C Software Notice and License
-
-This work (and included software, documentation such as READMEs, or other
-related items) is being provided by the copyright holders under the
-following license. License
-
-By obtaining, using and/or copying this work, you (the licensee) agree that
-you have read, understood, and will comply with the following terms and
-conditions.
-
-Permission to copy, modify, and distribute this software and its
-documentation, with or without modification, for any purpose and without
-fee or royalty is hereby granted, provided that you include the following
-on ALL copies of the software and documentation or portions thereof,
-including modifications:
-
-* The full text of this NOTICE in a location viewable to users of the
- redistributed or derivative work.
-
-* Any pre-existing intellectual property disclaimers, notices, or terms and
- conditions. If none exist, the W3C Software Short Notice should be
- included (hypertext is preferred, text is permitted) within the body of
- any redistributed or derivative code.
-
-* Notice of any changes or modifications to the files, including the date
- changes were made. (We recommend you provide URIs to the location from
- which the code is derived.)
-
-Disclaimers
-
-THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
-MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT
-NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
-PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE
-ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
-
-COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
-DOCUMENTATION.
-
-The name and trademarks of copyright holders may NOT be used in advertising
-or publicity pertaining to the software without specific, written prior
-permission. Title to copyright in this software and any associated
-documentation will at all times remain with copyright holders.
diff --git a/jena-arq/testing/DAWG/regex/manifest.n3 b/jena-arq/testing/DAWG/regex/manifest.n3
deleted file mode 100644
index 174b580..0000000
--- a/jena-arq/testing/DAWG/regex/manifest.n3
+++ /dev/null
@@ -1,58 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
-@prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> .
-
-<> rdf:type mf:Manifest ;
- rdfs:comment "SPARQL regex tests" ;
- mf:entries (
- [ mf:name "regex-query-001" ;
- rdfs:comment
- "Simple unanchored match test" ;
- mf:action
- [ qt:query <regex-query-001.rq> ;
- qt:data <regex-data-01.n3> ] ;
- mf:result <regex-result-001.n3>
- ]
- [ mf:name "regex-query-002" ;
- rdfs:comment
- "Case insensitive unanchored match test" ;
- mf:action
- [ qt:query <regex-query-002.rq> ;
- qt:data <regex-data-01.n3> ] ;
- mf:result <regex-result-002.n3>
- ]
- [ mf:name "regex-query-003" ;
- rdfs:comment
- "Use/mention test" ;
- mf:action
- [ qt:query <regex-query-003.rq> ;
- qt:data <regex-data-01.n3> ] ;
- mf:result <regex-result-003.n3>
- ]
- [ mf:name "regex-query-004" ;
- rdfs:comment
- "str()+URI test" ;
- mf:action
- [ qt:query <regex-query-004.rq> ;
- qt:data <regex-data-01.n3> ] ;
- mf:result <regex-result-004.n3>
- ]
-
- # End of tests
- ).
diff --git a/jena-arq/testing/DAWG/regex/regex-data-01.n3 b/jena-arq/testing/DAWG/regex/regex-data-01.n3
deleted file mode 100644
index 930f1b7..0000000
--- a/jena-arq/testing/DAWG/regex/regex-data-01.n3
+++ /dev/null
@@ -1,5 +0,0 @@
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix ex: <http://example.com/#> .
-
-ex:foo rdf:value "abcDEFghiJKL" , "ABCdefGHIjkl", "0123456789",
- <http://example.com/uri>, "http://example.com/literal" .
diff --git a/jena-arq/testing/DAWG/regex/regex-query-001.rq b/jena-arq/testing/DAWG/regex/regex-query-001.rq
deleted file mode 100644
index 3c8f661..0000000
--- a/jena-arq/testing/DAWG/regex/regex-query-001.rq
+++ /dev/null
@@ -1,8 +0,0 @@
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX ex: <http://example.com/#>
-
-SELECT ?val
-WHERE {
- ex:foo rdf:value ?val .
- FILTER regex(?val, "GHI")
-}
diff --git a/jena-arq/testing/DAWG/regex/regex-query-002.rq b/jena-arq/testing/DAWG/regex/regex-query-002.rq
deleted file mode 100644
index b0bb7fd..0000000
--- a/jena-arq/testing/DAWG/regex/regex-query-002.rq
+++ /dev/null
@@ -1,8 +0,0 @@
-PREFIX ex: <http://example.com/#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-
-SELECT ?val
-WHERE {
- ex:foo rdf:value ?val .
- FILTER regex(?val, "DeFghI", "i")
-}
diff --git a/jena-arq/testing/DAWG/regex/regex-query-003.rq b/jena-arq/testing/DAWG/regex/regex-query-003.rq
deleted file mode 100644
index 384da9b..0000000
--- a/jena-arq/testing/DAWG/regex/regex-query-003.rq
+++ /dev/null
@@ -1,8 +0,0 @@
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX ex: <http://example.com/#>
-
-SELECT ?val
-WHERE {
- ex:foo rdf:value ?val .
- FILTER regex(?val, "example\\.com")
-}
diff --git a/jena-arq/testing/DAWG/regex/regex-query-004.rq b/jena-arq/testing/DAWG/regex/regex-query-004.rq
deleted file mode 100644
index 1635291..0000000
--- a/jena-arq/testing/DAWG/regex/regex-query-004.rq
+++ /dev/null
@@ -1,7 +0,0 @@
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX ex: <http://example.com/#>
-SELECT ?val
-WHERE {
- ex:foo rdf:value ?val .
- FILTER regex(str(?val), "example\\.com")
-}
diff --git a/jena-arq/testing/DAWG/regex/regex-result-001.n3 b/jena-arq/testing/DAWG/regex/regex-result-001.n3
deleted file mode 100644
index fe8ad33..0000000
--- a/jena-arq/testing/DAWG/regex/regex-result-001.n3
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> .
-
-[] <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
- rs:ResultSet ;
- rs:resultVariable
- "val" ;
- rs:solution [ rs:binding [ rs:value "ABCdefGHIjkl" ;
- rs:variable "val"
- ] ;
- ] .
diff --git a/jena-arq/testing/DAWG/regex/regex-result-002.n3 b/jena-arq/testing/DAWG/regex/regex-result-002.n3
deleted file mode 100644
index afe3844..0000000
--- a/jena-arq/testing/DAWG/regex/regex-result-002.n3
+++ /dev/null
@@ -1,14 +0,0 @@
-@prefix rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> .
-
-[] <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
- rs:ResultSet ;
- rs:resultVariable
- "val" ;
- rs:solution [ rs:binding [ rs:value "ABCdefGHIjkl" ;
- rs:variable "val"
- ] ;
- ] ;
- rs:solution [ rs:binding [ rs:value "abcDEFghiJKL" ;
- rs:variable "val"
- ] ;
- ] .
diff --git a/jena-arq/testing/DAWG/regex/regex-result-003.n3 b/jena-arq/testing/DAWG/regex/regex-result-003.n3
deleted file mode 100644
index 8db3958..0000000
--- a/jena-arq/testing/DAWG/regex/regex-result-003.n3
+++ /dev/null
@@ -1,10 +0,0 @@
-@prefix rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> .
-
-[] <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
- rs:ResultSet ;
- rs:resultVariable
- "val" ;
- rs:solution [ rs:binding [ rs:value "http://example.com/literal" ;
- rs:variable "val"
- ] ;
- ] .
diff --git a/jena-arq/testing/DAWG/regex/regex-result-004.n3 b/jena-arq/testing/DAWG/regex/regex-result-004.n3
deleted file mode 100644
index 18b66bd..0000000
--- a/jena-arq/testing/DAWG/regex/regex-result-004.n3
+++ /dev/null
@@ -1,14 +0,0 @@
-@prefix rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> .
-
-[] <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
- rs:ResultSet ;
- rs:resultVariable
- "val" ;
- rs:solution [ rs:binding [ rs:value "http://example.com/literal" ;
- rs:variable "val"
- ] ;
- ] ;
- rs:solution [ rs:binding [ rs:value <http://example.com/uri> ;
- rs:variable "val"
- ] ;
- ] .
diff --git a/jena-base/src/test/java/org/apache/jena/atlas/junit/BaseTest.java b/jena-base/src/test/java/org/apache/jena/atlas/junit/AssertExtra.java
similarity index 98%
rename from jena-base/src/test/java/org/apache/jena/atlas/junit/BaseTest.java
rename to jena-base/src/test/java/org/apache/jena/atlas/junit/AssertExtra.java
index ba950af..86b685f 100644
--- a/jena-base/src/test/java/org/apache/jena/atlas/junit/BaseTest.java
+++ b/jena-base/src/test/java/org/apache/jena/atlas/junit/AssertExtra.java
@@ -24,7 +24,7 @@
import org.apache.jena.atlas.lib.ListUtils ;
import org.junit.Assert ;
-public class BaseTest {
+public class AssertExtra {
public static void assertEqualsIgnoreCase(String a, String b) {
a = a.toLowerCase(Locale.ROOT) ;
b = b.toLowerCase(Locale.ROOT) ;
diff --git a/jena-cmds/src/main/java/arq/wwwenc.java b/jena-cmds/src/main/java/arq/wwwenc.java
index 089f412..047ff6c 100644
--- a/jena-cmds/src/main/java/arq/wwwenc.java
+++ b/jena-cmds/src/main/java/arq/wwwenc.java
@@ -30,37 +30,42 @@
* ! * " ' ( ) ; : @ & = + $ , / ? % # [ ]
* %21 %2A %22 %27 %28 %29 %3B %3A %40 %26 %3D %2B %24 %2C %2F %3F %25 %23 %5B %5D
* These loose any reserved meaning if encoded.
- *
+ *
* Other common, but unreserved, characters after percent-encoding
* < > ~ . { } | \ - ` _ ^
* %3C %3E %7E %2E %7B %7D %7C %5C %2D %60 %5F %5E
*
- * Unreserved characters treated equivalent to their unencoded form.
- *
- *
+ * Unreserved characters treated equivalent to their un-encoded form.
*/
public static void main(String...args) throws IOException
{
- // Reserved characters + space
- char reserved[] =
- {' ',
- '\n','\t',
- '!', '*', '"', '\'', '(', ')', ';', ':', '@', '&',
- '=', '+', '$', ',', '/', '?', '%', '#', '[', ']'} ;
-
- char[] other = {'<', '>', '~', '.', '{', '}', '|', '\\', '-', '`', '_', '^'} ;
+// RFC3986:
+// unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+// reserved = gen-delims / sub-delims
+// gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
+// sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+// / "*" / "+" / "," / ";" / "="
+ char encode[] =
+ {' ', '\n','\t',
+ // gen-delims
+ ':' , '/' , '?' , '#' , '[' , ']' , '@',
+ // sub-delims
+ '!' , '$' , '&' , '\'' , '(' , ')',
+ '*' , '+' , ',' , ';' , '=',
+ // general trouble
+ '<', '>', '{', '}', '|', '\\', '`', '^'
+ } ;
if ( args.length == 0 ) {
String x = IO.readWholeFileAsUTF8(System.in);
- String y = StrUtils.encodeHex(x, '%', reserved) ;
+ String y = StrUtils.encodeHex(x, '%', encode) ;
System.out.println(y) ;
return;
}
for ( String x : args) {
// Not URLEncoder which does www-form-encoding.
- String y = StrUtils.encodeHex(x, '%', reserved) ;
+ String y = StrUtils.encodeHex(x, '%', encode) ;
System.out.println(y) ;
-
// String s2 = URLEncoder.encode(s, "utf-8") ;
// System.out.println(s2) ;
diff --git a/jena-cmds/src/test/java/arq/qtest.java b/jena-cmds/src/test/java/arq/qtest.java
index bc81d7a..105cd15 100644
--- a/jena-cmds/src/test/java/arq/qtest.java
+++ b/jena-cmds/src/test/java/arq/qtest.java
@@ -18,26 +18,22 @@
package arq;
-import java.io.File ;
-
import arq.cmdline.CmdARQ ;
import arq.cmdline.ModEngine ;
import jena.cmd.ArgDecl;
import jena.cmd.CmdException;
import jena.cmd.TerminationException;
-import junit.framework.TestSuite ;
+import org.apache.jena.arq.junit.TextTestRunner;
+import org.apache.jena.arq.junit.sparql.SparqlTests;
import org.apache.jena.atlas.lib.Lib ;
import org.apache.jena.graph.Node ;
import org.apache.jena.query.ARQ ;
import org.apache.jena.rdf.model.Literal ;
import org.apache.jena.rdf.model.Model ;
import org.apache.jena.rdf.model.Resource ;
-import org.apache.jena.sparql.ARQTestSuite ;
-import org.apache.jena.sparql.expr.E_Function ;
-import org.apache.jena.sparql.expr.NodeValue ;
+import org.apache.jena.riot.Lang;
+import org.apache.jena.riot.RDFDataMgr;
import org.apache.jena.sparql.junit.EarlReport ;
-import org.apache.jena.sparql.junit.ScriptTestSuiteFactory ;
-import org.apache.jena.sparql.junit.SimpleTestRunner ;
import org.apache.jena.sparql.util.NodeFactoryExtra ;
import org.apache.jena.sparql.vocabulary.DOAP ;
import org.apache.jena.sparql.vocabulary.FOAF ;
@@ -62,16 +58,10 @@
{
protected ArgDecl allDecl = new ArgDecl(ArgDecl.NoValue, "all") ;
protected ArgDecl wgDecl = new ArgDecl(ArgDecl.NoValue, "wg", "dawg") ;
- protected ArgDecl queryDecl = new ArgDecl(ArgDecl.HasValue, "query") ;
- protected ArgDecl dataDecl = new ArgDecl(ArgDecl.HasValue, "data") ;
- protected ArgDecl resultDecl = new ArgDecl(ArgDecl.HasValue, "result") ;
protected ArgDecl earlDecl = new ArgDecl(ArgDecl.NoValue, "earl") ;
protected ModEngine modEngine = null ;
- protected TestSuite suite = null;
- protected boolean execAllTests = false;
- protected boolean execDAWGTests = false;
protected String testfile = null;
protected boolean createEarlReport = false;
@@ -89,17 +79,6 @@
modEngine = setModEngine() ;
addModule(modEngine) ;
-
- getUsage().startCategory("Tests (single query)") ;
- add(queryDecl, "--query", "run the given query") ;
- add(dataDecl, "--data", "data file to be queried") ;
- add(resultDecl, "--result", "file that specifies the expected result") ;
-
- getUsage().startCategory("Tests (built-in tests)") ;
- add(allDecl, "--all", "run all built-in tests") ;
- add(wgDecl, "--dawg", "run working group tests") ;
-
- getUsage().startCategory("Tests (execute test manifest)") ;
getUsage().addUsage("<manifest>", "run the tests specified in the given manifest") ;
add(earlDecl, "--earl", "create EARL report") ;
}
@@ -119,36 +98,10 @@
protected void processModulesAndArgs()
{
super.processModulesAndArgs() ;
+ if ( ! hasPositional() )
+ throw new CmdException("No manifest file") ;
- if ( contains(queryDecl) || contains(dataDecl) || contains(resultDecl) )
- {
- if ( ! ( contains(queryDecl) && contains(dataDecl) && contains(resultDecl) ) )
- throw new CmdException("Must give query, data and result to run a single test") ;
-
- String query = getValue(queryDecl) ;
- String data = getValue(dataDecl) ;
- String result = getValue(resultDecl) ;
-
- suite = ScriptTestSuiteFactory.make(query, data, result) ;
- }
- else if ( contains(allDecl) )
- {
- execAllTests = true ;
- }
- else if ( contains(wgDecl) )
- {
- execDAWGTests = true ;
- }
- else
- {
- // OK - running a manifest
-
- if ( ! hasPositional() )
- throw new CmdException("No manifest file") ;
-
- testfile = getPositionalArg(0) ;
- createEarlReport = contains(earlDecl) ;
- }
+ testfile = getPositionalArg(0) ;
}
@Override
@@ -157,19 +110,7 @@
if ( cmdStrictMode )
ARQ.setStrictMode() ;
- if ( suite != null )
- SimpleTestRunner.runAndReport(suite) ;
- else if ( execAllTests )
- allTests() ;
- else if ( execDAWGTests )
- dawgTests() ;
- else
- {
- // running a manifest
-
- NodeValue.VerboseWarnings = false ;
- E_Function.WarnOnUnknownFunction = false ;
-
+ for ( String manifest : super.getPositional() ) {
if ( createEarlReport )
oneManifestEarl(testfile) ;
else
@@ -179,10 +120,7 @@
static void oneManifest(String testManifest)
{
- TestSuite suite = ScriptTestSuiteFactory.make(testManifest) ;
-
- //junit.textui.TestRunner.run(suite) ;
- SimpleTestRunner.runAndReport(suite) ;
+ TextTestRunner.runOne(testManifest, SparqlTests::makeSPARQLTest) ;
}
static void oneManifestEarl(String testManifest)
@@ -195,7 +133,8 @@
// Include information later.
EarlReport report = new EarlReport(systemURI, name, version, homepage) ;
- ScriptTestSuiteFactory.results = report ;
+
+ TextTestRunner.runOne(report, testManifest, SparqlTests::makeSPARQLTest);
Model model = report.getModel() ;
model.setNsPrefix("dawg", TestManifest.getURI()) ;
@@ -235,39 +174,6 @@
release.addProperty(DOAP.created, today) ;
release.addProperty(DOAP.name, releaseName) ; // Again
- TestSuite suite = ScriptTestSuiteFactory.make(testManifest) ;
- SimpleTestRunner.runSilent(suite) ;
-
- ScriptTestSuiteFactory.results.getModel().write(System.out, "TTL") ;
-
- }
-
- static void allTests()
- {
- // This should load all the built in tests.
- // Check to see if expected directories are present or not.
-
- ensureDirExists("testing") ;
- ensureDirExists("testing/ARQ") ;
- ensureDirExists("testing/DAWG") ;
-
- TestSuite ts = ARQTestSuite.suite() ;
- junit.textui.TestRunner.run(ts) ;
- //SimpleTestRunner.runAndReport(ts) ;
- }
-
- static void dawgTests()
- {
- System.err.println("DAWG tests not packaged up yet") ;
- }
-
- static void ensureDirExists(String dirname)
- {
- File f = new File(dirname) ;
- if ( ! f.exists() || !f.isDirectory() )
- {
- System.err.println("Can't find required directory: '"+dirname+"'") ;
- throw new TerminationException(8) ;
- }
+ RDFDataMgr.write(System.out, model, Lang.TTL);
}
}
diff --git a/jena-cmds/src/test/java/jena/cmd/Test_schemagen.java b/jena-cmds/src/test/java/jena/cmd/Test_schemagen.java
index ff65b56..daf0d69 100644
--- a/jena-cmds/src/test/java/jena/cmd/Test_schemagen.java
+++ b/jena-cmds/src/test/java/jena/cmd/Test_schemagen.java
@@ -21,6 +21,11 @@
package jena.cmd;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
// Imports
///////////////
import java.io.*;
@@ -30,7 +35,6 @@
import jena.schemagen;
import jena.schemagen.SchemagenOptionsImpl;
-import junit.framework.TestCase;
import org.apache.jena.rdf.model.* ;
import org.apache.jena.util.FileUtils ;
import org.junit.Test ;
@@ -44,7 +48,6 @@
* </p>
*/
public class Test_schemagen
- extends TestCase
{
// Constants
//////////////////////////////////
diff --git a/jena-cmds/src/test/java/riotcmd/rdflangtest.java b/jena-cmds/src/test/java/riotcmd/rdflangtest.java
index df63e72..d0b0af1 100644
--- a/jena-cmds/src/test/java/riotcmd/rdflangtest.java
+++ b/jena-cmds/src/test/java/riotcmd/rdflangtest.java
@@ -18,13 +18,14 @@
package riotcmd;
-import arq.cmdline.ModEngine ;
import arq.cmdline.ModContext ;
+import arq.cmdline.ModEngine ;
import jena.cmd.ArgDecl ;
import jena.cmd.CmdException ;
import jena.cmd.CmdGeneral ;
import jena.cmd.TerminationException ;
-import junit.framework.TestSuite ;
+import org.apache.jena.arq.junit.TextTestRunner;
+import org.apache.jena.arq.junit.riot.RiotTests;
import org.apache.jena.atlas.legacy.BaseTest2 ;
import org.apache.jena.atlas.lib.Lib ;
import org.apache.jena.graph.Node ;
@@ -34,12 +35,11 @@
import org.apache.jena.rdf.model.Resource ;
import org.apache.jena.riot.Lang ;
import org.apache.jena.riot.RDFDataMgr ;
-import org.apache.jena.riot.langsuite.FactoryTestRiot ;
+import org.apache.jena.riot.SysRIOT;
import org.apache.jena.riot.langsuite.VocabLangRDF ;
import org.apache.jena.sparql.expr.E_Function ;
import org.apache.jena.sparql.expr.NodeValue ;
import org.apache.jena.sparql.junit.EarlReport ;
-import org.apache.jena.sparql.junit.SimpleTestRunner ;
import org.apache.jena.sparql.util.NodeFactoryExtra ;
import org.apache.jena.sparql.vocabulary.DOAP ;
import org.apache.jena.sparql.vocabulary.FOAF ;
@@ -110,16 +110,15 @@
@Override
protected void exec()
{
- // Paradoxical naming - the boolean is a visibility flag.
BaseTest2.setTestLogging() ;
-// if ( contains(strictDecl) ) {
-// // Always done in test setups.
-// cmdStrictMode = true ;
-// // Which will apply to reading the manifest!
-// ARQ.setStrictMode() ;
-// SysRIOT.setStrictMode(true) ;
-// }
+ if ( contains(strictDecl) ) {
+ // Always done in test setups.
+ cmdStrictMode = true ;
+ // Which will apply to reading the manifest!
+ ARQ.setStrictMode() ;
+ SysRIOT.setStrictMode(true) ;
+ }
NodeValue.VerboseWarnings = false ;
E_Function.WarnOnUnknownFunction = false ;
@@ -138,10 +137,7 @@
static void oneManifest(String testManifest)
{
- TestSuite suite = FactoryTestRiot.make(testManifest) ;
-
- //junit.textui.TestRunner.run(suite) ;
- SimpleTestRunner.runAndReport(suite) ;
+ TextTestRunner.runOne(testManifest, RiotTests::makeRIOTTest);
}
static String name = "Apache Jena RIOT" ;
@@ -154,9 +150,8 @@
static void oneManifestEarl(String testManifest)
{
EarlReport report = new EarlReport(systemURI, name, version, homepage) ;
- FactoryTestRiot.report = report ;
- TestSuite suite = FactoryTestRiot.make(testManifest) ;
- SimpleTestRunner.runSilent(suite) ;
+
+ TextTestRunner.runOne(report, testManifest, RiotTests::makeRIOTTest);
Model model = report.getModel() ;
model.setNsPrefix("rdft", VocabLangRDF.getURI()) ;
diff --git a/jena-core/src/test/java/org/apache/jena/n3/turtle/TurtleTestFactory.java b/jena-core/src/test/java/org/apache/jena/n3/turtle/TurtleTestFactory.java
index ca3cc30..b959185 100644
--- a/jena-core/src/test/java/org/apache/jena/n3/turtle/TurtleTestFactory.java
+++ b/jena-core/src/test/java/org/apache/jena/n3/turtle/TurtleTestFactory.java
@@ -21,12 +21,12 @@
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.jena.rdf.model.Resource ;
-import org.apache.jena.util.junit.TestFactoryManifest ;
+import org.apache.jena.util.junit.TestFactoryManifestOld ;
import org.apache.jena.util.junit.TestUtils ;
import org.apache.jena.vocabulary.RDF ;
-public class TurtleTestFactory extends TestFactoryManifest
+public class TurtleTestFactory extends TestFactoryManifestOld
{
public static TestSuite make(String filename)
diff --git a/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java b/jena-core/src/test/java/org/apache/jena/util/junit/ManifestOld.java
similarity index 96%
rename from jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
rename to jena-core/src/test/java/org/apache/jena/util/junit/ManifestOld.java
index 45afcdc..02c2f83 100644
--- a/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
+++ b/jena-core/src/test/java/org/apache/jena/util/junit/ManifestOld.java
@@ -33,12 +33,13 @@
/**
* A test manifest for a single manifest file.
+ * Exists solely while the old Turtle/N3 parsers is test in jena-core.
*/
-public class Manifest
+public class ManifestOld
{
// This class does not know about JUnit.
- private static Logger log = LoggerFactory.getLogger(Manifest.class) ;
+ private static Logger log = LoggerFactory.getLogger(ManifestOld.class) ;
Model manifest ;
String manifestName ;
String filename ;
@@ -47,7 +48,7 @@
@SuppressWarnings("deprecation")
- public Manifest(String fn)
+ public ManifestOld(String fn)
{
log.debug("Manifest = "+fn ) ;
filename = org.apache.jena.n3.N3IRIResolver.resolveGlobal(fn) ;
@@ -88,7 +89,7 @@
}
// For every test item (does not recurse)
- public void apply(ManifestItemHandler gen)
+ public void apply(ManifestOldItemHandler gen)
{
StmtIterator manifestStmts =
diff --git a/jena-core/src/test/java/org/apache/jena/util/junit/ManifestItemHandler.java b/jena-core/src/test/java/org/apache/jena/util/junit/ManifestOldItemHandler.java
similarity index 96%
rename from jena-core/src/test/java/org/apache/jena/util/junit/ManifestItemHandler.java
rename to jena-core/src/test/java/org/apache/jena/util/junit/ManifestOldItemHandler.java
index 27038d3..5065ce3 100644
--- a/jena-core/src/test/java/org/apache/jena/util/junit/ManifestItemHandler.java
+++ b/jena-core/src/test/java/org/apache/jena/util/junit/ManifestOldItemHandler.java
@@ -21,7 +21,7 @@
import org.apache.jena.rdf.model.Resource ;
-public interface ManifestItemHandler
+public interface ManifestOldItemHandler
{
/** Handle an item in a manifest */
public boolean processManifestItem(Resource manifest ,
diff --git a/jena-core/src/test/java/org/apache/jena/util/junit/TestException.java b/jena-core/src/test/java/org/apache/jena/util/junit/TestException.java
index e588d95..e5ff57a 100644
--- a/jena-core/src/test/java/org/apache/jena/util/junit/TestException.java
+++ b/jena-core/src/test/java/org/apache/jena/util/junit/TestException.java
@@ -22,7 +22,6 @@
* not a failure of the test itself (e.g. manifest problems)
*/
-
public class TestException extends RuntimeException
{
public TestException() { super() ; }
diff --git a/jena-core/src/test/java/org/apache/jena/util/junit/TestFactoryManifest.java b/jena-core/src/test/java/org/apache/jena/util/junit/TestFactoryManifestOld.java
similarity index 89%
rename from jena-core/src/test/java/org/apache/jena/util/junit/TestFactoryManifest.java
rename to jena-core/src/test/java/org/apache/jena/util/junit/TestFactoryManifestOld.java
index aa39589..3516201 100644
--- a/jena-core/src/test/java/org/apache/jena/util/junit/TestFactoryManifest.java
+++ b/jena-core/src/test/java/org/apache/jena/util/junit/TestFactoryManifestOld.java
@@ -26,12 +26,12 @@
import org.slf4j.LoggerFactory;
-public abstract class TestFactoryManifest implements ManifestItemHandler
+public abstract class TestFactoryManifestOld implements ManifestOldItemHandler
{
private TestSuite currentTestSuite = null ;
private TestSuite testSuite = null ;
- public TestFactoryManifest() {}
+ public TestFactoryManifestOld() {}
public TestSuite process(String filename)
{
@@ -41,12 +41,12 @@
private TestSuite oneManifest(String filename)
{
TestSuite ts1 = new TestSuite() ;
- Manifest m = null ;
+ ManifestOld m = null ;
try {
- m = new Manifest(filename) ;
+ m = new ManifestOld(filename) ;
} catch (JenaException ex)
{
- LoggerFactory.getLogger(TestFactoryManifest.class).warn("Failed to load: "+filename+"\n"+ex.getMessage(), ex) ;
+ LoggerFactory.getLogger(TestFactoryManifestOld.class).warn("Failed to load: "+filename+"\n"+ex.getMessage(), ex) ;
ts1.setName("BROKEN") ;
return ts1 ;
}
diff --git a/jena-db/jena-tdb2/pom.xml b/jena-db/jena-tdb2/pom.xml
index b8b75a3..4fd49fc 100644
--- a/jena-db/jena-tdb2/pom.xml
+++ b/jena-db/jena-tdb2/pom.xml
@@ -108,7 +108,8 @@
<artifactId>maven-surefire-report-plugin</artifactId>
<configuration>
<includes>
- <include>**/TC_*.java</include>
+ <include>**/TS_*.java</include>
+ <include>**/Scripts_*.java</include>
</includes>
</configuration>
</plugin>
diff --git a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/LoaderFactory.java b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/LoaderFactory.java
index 3b28c61..ddb0f15 100644
--- a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/LoaderFactory.java
+++ b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/LoaderFactory.java
@@ -122,7 +122,7 @@
* This loader will use all available resources of the machine,
* making other actions on the machine unresponsive.
* <p>
- * * The dataset can not be used for other operations - the code will block other transactions
+ * The dataset can not be used for other operations - the code will block other transactions
* as necessary and release then when loading has finished.
* <p>
* Supply a {@link MonitorOutput} for the desirable progress and summary output messages
@@ -163,7 +163,7 @@
* This loader will use all available resources of the machine,
* making other actions on the machine unresponsive.
* <p>
- * * The dataset can not be used for other operations - the code will block other transactions
+ * The dataset can not be used for other operations - the code will block other transactions
* as necessary and release then when loading has finished.
* <p>
* Supply a {@link MonitorOutput} for the desirable progress and summary output messages
diff --git a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/main/InputStage.java b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/main/InputStage.java
index 7d8996e..d605de3 100644
--- a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/main/InputStage.java
+++ b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/main/InputStage.java
@@ -22,8 +22,8 @@
* The first phase, parsing to at least one index each of triples and quads
* can be done in several ways.
* <ul>
- * <li> {@code MULTI} - one thread parsing (caller), one for nodetable/tuples, and one for each index
- * <li> {@code PARSE_NODE} - one thread parsing (caller) and one for nodetable/tuples, and one for each index
+ * <li> {@code MULTI} - one thread parsing (caller), one for nodetable/tuples, and one for each primary index
+ * <li> {@code PARSE_NODE} - one thread parsing (caller) and the nodetable/tuples, and one for each primary index
* <li> {@code PARSE_NODE_INDEX} - use the caller thread for all operations
* </ul>
* {@code MULTI} is fastest when hardware allows.
diff --git a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/main/LoaderMain.java b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/main/LoaderMain.java
index 7cd25e7..a5310dc 100644
--- a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/main/LoaderMain.java
+++ b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/loader/main/LoaderMain.java
@@ -81,8 +81,8 @@
* which uses on thread for both parsing and node table
* {@code DataToTuplesInline -> Indexer+}.
* </p><p>
- * The third alternative {@link InputStage#PARSE_NODE}, provided by {@code executeDataOneThread},
- * which do doesa all input stage operations on the calling parser thread.
+ * The third alternative {@link InputStage#PARSE_NODE_INDEX}, provided by {@code executeDataOneThread},
+ * which does do all input stage operations on the calling parser thread.
* </p>
* <p><b>Index Phase</b></p>
* <p>
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/Scripts_TDB2.java b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/Scripts_TDB2.java
new file mode 100644
index 0000000..f892852
--- /dev/null
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/Scripts_TDB2.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+package org.apache.jena.tdb2;
+
+import org.apache.jena.arq.junit.manifest.Label;
+import org.apache.jena.arq.junit.manifest.Manifests;
+import org.apache.jena.arq.junit.manifest.Prefix;
+import org.apache.jena.query.ARQ;
+import org.apache.jena.sparql.expr.E_Function;
+import org.apache.jena.sparql.expr.NodeValue;
+import org.apache.jena.tdb2.junit.RunnerSPARQL_TDB2;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+
+@RunWith(RunnerSPARQL_TDB2.class)
+@Label("SPARQL [TDB2]")
+@Prefix("TDB2-")
+@Manifests
+({
+ "testing/manifest.ttl",
+ "../../jena-arq/testing/ARQ/RDF-Star/SPARQL-Star/manifest.ttl"
+})
+
+public class Scripts_TDB2
+{
+ @BeforeClass static public void beforeClass() {
+ ARQ.setNormalMode();
+ NodeValue.VerboseWarnings = false;
+ E_Function.WarnOnUnknownFunction = false;
+ }
+
+ @AfterClass static public void afterClass() {
+ NodeValue.VerboseWarnings = true;
+ E_Function.WarnOnUnknownFunction = true;
+ }
+}
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TC_TDB2.java b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TC_TDB2.java
index c4a26ae..340c4fa 100644
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TC_TDB2.java
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TC_TDB2.java
@@ -55,7 +55,7 @@
, TS_TDBAssembler.class
, TS_Sys.class
, TS_Loader.class
- , TS_ScriptsTDB2.class
+ , Scripts_TDB2.class
} )
public class TC_TDB2
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TestScriptsTDB2.java b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TestScriptsTDB2.java
deleted file mode 100644
index 5e44bde..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/TestScriptsTDB2.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.tdb2;
-
-import junit.framework.TestSuite ;
-import org.apache.jena.tdb2.junit.TestFactoryTDB2;
-import org.junit.runner.RunWith ;
-import org.junit.runners.AllTests ;
-
-/** Scripted test generation */
-
-@RunWith(AllTests.class)
-public class TestScriptsTDB2 extends TestSuite
-{
- static final String ARQ_DIR = "../../jena-arq/testing/ARQ";
- static public TestSuite suite() { return new TestScriptsTDB2(); }
-
- private TestScriptsTDB2()
- {
- super("TDB-Scripts") ;
- String manifestMain1 = ConfigTest.getTestingDataRoot()+"/manifest.ttl";
- TestFactoryTDB2.make(this, manifestMain1, "TDB2-");
-
- // From ARQ
- String manifestMain2 = ARQ_DIR + "/RDF-Star/SPARQL-Star/manifest.ttl";
- TestFactoryTDB2.make(this, manifestMain2, "TDB2-");
- }
-}
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/assembler/TS_TDBAssembler.java b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/assembler/TS_TDBAssembler.java
index 14b775c..e750084 100644
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/assembler/TS_TDBAssembler.java
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/assembler/TS_TDBAssembler.java
@@ -18,7 +18,6 @@
package org.apache.jena.tdb2.assembler;
-import org.apache.jena.tdb2.junit.Base_TS;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -27,5 +26,5 @@
TestTDBAssembler.class
})
-public class TS_TDBAssembler extends Base_TS
+public class TS_TDBAssembler
{}
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/AbstractTestGraphTDB.java b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/AbstractTestGraphTDB.java
deleted file mode 100644
index 64b901c..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/AbstractTestGraphTDB.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.tdb2.junit;
-
-import org.apache.jena.graph.test.AbstractTestGraph;
-
-public abstract class AbstractTestGraphTDB extends AbstractTestGraph
-{
- public AbstractTestGraphTDB(String name)
- {
- super(name);
- }
-
- @Override public void testIsomorphismFile() {}
-
- // Meaning less - graphs (and hence models) are not independent of their datasets.
- @Override public void testCloseSetsIsClosed() {}
-}
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/Base_TS.java b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/Base_TS.java
deleted file mode 100644
index 7521086..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/Base_TS.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.tdb2.junit;
-
-import org.apache.jena.atlas.logging.LogCtl;
-import org.apache.jena.sparql.engine.optimizer.reorder.ReorderLib;
-import org.apache.jena.sparql.engine.optimizer.reorder.ReorderTransformation;
-import org.apache.jena.tdb2.sys.SystemTDB;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-public class Base_TS
-{
- static String level = null ;
- static ReorderTransformation rt = null ;
-
- @BeforeClass static public void beforeClass()
- {
- rt = SystemTDB.getDefaultReorderTransform();
- level = LogCtl.getLevel("org.apache.jena.tdb.info") ;
- LogCtl.setLevel("org.apache.jena.tdb.info", "FATAL");
- LogCtl.setLevel("org.apache.jena.tdb2.info", "FATAL");
-
- SystemTDB.setDefaultReorderTransform(ReorderLib.identity());
- }
-
- @AfterClass static public void afterClass()
- {
- if ( level != null ) {
- LogCtl.setLevel("org.apache.jena.tdb.info", level);
- LogCtl.setLevel("org.apache.jena.tdb2.info", level);
- }
- SystemTDB.setDefaultReorderTransform(rt);
- }
-}
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/BuildTestLib.java b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/BuildTestLib.java
index fe11738..613b2b2 100644
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/BuildTestLib.java
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/BuildTestLib.java
@@ -67,6 +67,5 @@
String filename = loc.getPath(name);
return new BinaryDataFileRandomAccess(filename);
}
-
}
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/QueryTestTDB2.java b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/QueryTestTDB2.java
deleted file mode 100644
index 1b78db6..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/QueryTestTDB2.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.tdb2.junit;
-
-import java.util.List;
-
-import org.apache.jena.query.*;
-import org.apache.jena.riot.RDFDataMgr;
-import org.apache.jena.sparql.SystemARQ;
-import org.apache.jena.sparql.engine.QueryEngineFactory;
-import org.apache.jena.sparql.engine.QueryExecutionBase;
-import org.apache.jena.sparql.engine.ref.QueryEngineRef;
-import org.apache.jena.sparql.junit.EarlReport;
-import org.apache.jena.sparql.junit.EarlTestCase;
-import org.apache.jena.sparql.junit.TestItem;
-import org.apache.jena.sparql.resultset.ResultSetCompare;
-import org.apache.jena.sparql.resultset.SPARQLResult;
-import org.apache.jena.system.Txn;
-import org.apache.jena.tdb2.TDB2Factory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class QueryTestTDB2 extends EarlTestCase
-{
- // Changed to using in-memory graphs/datasets because this is testing the query
- // processing. Physical graph/datsets is in package "store".
-
- private static Logger log = LoggerFactory.getLogger(QueryTestTDB2.class);
- private Dataset dataset = null;
-
- boolean skipThisTest = false;
-
- final List<String> defaultGraphURIs;
- final List<String> namedGraphURIs;
- final String queryFile;
- final SPARQLResult results;
-
- // Track what's currently loaded in the GraphLocation
- private static List<String> currentDefaultGraphs = null;
- private static List<String> currentNamedGraphs = null;
-
- // Old style (Junit3)
- public QueryTestTDB2(String testName, EarlReport report, TestItem item)
- {
- this(testName, report, item.getURI(),
- item.getDefaultGraphURIs(), item.getNamedGraphURIs(),
- item.getResults(), item.getQueryFile()
- );
- }
-
- public QueryTestTDB2(String testName, EarlReport report,
- String uri,
- List<String> dftGraphs,
- List<String> namedGraphs,
- SPARQLResult rs,
- String queryFile
- )
- {
- super(testName, uri, report);
- this.defaultGraphURIs = dftGraphs;
- this.namedGraphURIs = namedGraphs;
- this.queryFile = queryFile;
- this.results = rs;
- }
-
- boolean oldValueUsePlainGraph = SystemARQ.UsePlainGraph;
-
- @Override public void setUpTest() {
- dataset = TDB2Factory.createDataset();
- Txn.executeWrite(dataset, ()->{
- setupData();
- });
- // Make sure a plain, no sameValueAs graph is used.
- oldValueUsePlainGraph = SystemARQ.UsePlainGraph;
- SystemARQ.UsePlainGraph = true;
- }
-
- @Override public void tearDownTest()
- {
- if ( dataset != null )
- {
- dataset.close();
- dataset = null;
- }
- SystemARQ.UsePlainGraph = oldValueUsePlainGraph;
- }
-
- public void setupData()
- {
- if ( compareLists(defaultGraphURIs, currentDefaultGraphs) &&
- compareLists(namedGraphURIs, currentNamedGraphs) )
- return;
-
- if ( defaultGraphURIs == null )
- throw new TDBTestException("No default graphs given");
-
- //graphLocation.clear();
-
- // Allow "qt:data" to be quads in defaultGraphURIs.
- for ( String fn : defaultGraphURIs )
- RDFDataMgr.read(dataset, fn);
-
- for ( String fn : namedGraphURIs )
- RDFDataMgr.read(dataset.getNamedModel(fn), fn) ;
- }
-
-
- @Override
- protected void runTestForReal() throws Throwable
- {
- if ( skipThisTest )
- {
- log.info(this.getName()+" : Skipped");
- return;
- }
-
- Query query = QueryFactory.read(queryFile);
-
- Dataset ds = DatasetFactory.create();
- for ( String fn : defaultGraphURIs )
- RDFDataMgr.read(ds, fn); // Allow quads
- for ( String fn : namedGraphURIs )
- RDFDataMgr.read(ds.getNamedModel(fn), fn) ;
-
- // ---- First, get the expected results by executing in-memory or from a results file.
-
- ResultSetRewindable rs1;
- String expectedLabel;
- if ( results != null )
- {
- rs1 = ResultSetFactory.makeRewindable(results.getResultSet());
- expectedLabel = "Results file";
- }
- else
- {
- QueryEngineFactory f = QueryEngineRef.getFactory();
- try(QueryExecution qExec1 = new QueryExecutionBase(query, ds, null, f)) {
- rs1 = ResultSetFactory.makeRewindable(qExec1.execSelect());
- }
- expectedLabel = "Standard engine";
- }
- // Effectively final.
- // ---- Second, execute in persistent graph
-
- Dataset ds2 = dataset; //DatasetFactory.create(model) ;
- Txn.executeRead(ds2, ()->{
- try(QueryExecution qExec2 = QueryExecutionFactory.create(query, ds2)) {
- ResultSet rs = qExec2.execSelect();
- ResultSetRewindable rs2 = ResultSetFactory.makeRewindable(rs);
-
- // See if the same.
- boolean b = ResultSetCompare.equalsByValue(rs1, rs2);
- if ( !b )
- {
- rs1.reset();
- rs2.reset();
- System.out.println("------------------- "+this.getName());
- System.out.printf("**** Expected (%s)", expectedLabel);
- ResultSetFormatter.out(System.out, rs1);
- System.out.println("**** Got (TDB)");
- ResultSetFormatter.out(System.out, rs2);
- }
-
- assertTrue("Results sets not the same", b);
- }
- });
- }
-
- private static boolean compareLists(List<String> list1, List<String> list2)
- {
- if ( list1 == null )
- return ( list2 == null );
- return list1.equals(list2);
- }
-}
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/RunnerSPARQL_TDB2.java b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/RunnerSPARQL_TDB2.java
new file mode 100644
index 0000000..dae2e03
--- /dev/null
+++ b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/RunnerSPARQL_TDB2.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.tdb2.junit;
+
+import java.util.function.Function;
+
+import org.apache.jena.arq.junit.manifest.ManifestEntry;
+import org.apache.jena.arq.junit.runners.AbstractRunnerOfTests;
+import org.apache.jena.arq.junit.sparql.SparqlTests;
+import org.apache.jena.atlas.lib.Creator;
+import org.apache.jena.query.Dataset;
+import org.apache.jena.tdb2.TDB2Factory;
+import org.junit.runners.model.InitializationError;
+
+public class RunnerSPARQL_TDB2 extends AbstractRunnerOfTests {
+
+ public RunnerSPARQL_TDB2(Class<? > klass) throws InitializationError {
+ super(klass, testMaker());
+ }
+
+ private static Function<ManifestEntry, Runnable> testMaker() {
+ Creator<Dataset> creator = ()->TDB2Factory.createDataset();
+ return
+ (manifestEntry) ->
+ SparqlTests.makeSPARQLTestExecOnly(manifestEntry, creator);
+ }
+}
+
diff --git a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/TestFactoryTDB2.java b/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/TestFactoryTDB2.java
deleted file mode 100644
index 4a77800..0000000
--- a/jena-db/jena-tdb2/src/test/java/org/apache/jena/tdb2/junit/TestFactoryTDB2.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.tdb2.junit;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.jena.sparql.junit.EarlReport;
-import org.apache.jena.sparql.junit.SurpressedTest;
-import org.apache.jena.sparql.junit.TestItem;
-import org.apache.jena.sparql.vocabulary.TestManifestX;
-import org.apache.jena.util.junit.TestFactoryManifest;
-
-public class TestFactoryTDB2 extends TestFactoryManifest
-{
- public static EarlReport report = null;
-
- public static void make(TestSuite ts, String manifestFile, String testRootName)
- {
- // for each graph type do
- TestSuite ts2 = makeSuite(manifestFile, testRootName);
- ts.addTest(ts2);
- }
-
- public static TestSuite makeSuite(String manifestFile, String testRootName)
- {
- TestFactoryTDB2 f = new TestFactoryTDB2(testRootName);
- TestSuite ts = f.process(manifestFile);
- if ( testRootName != null )
- ts.setName(testRootName+ts.getName());
- return ts;
- }
-
- // Factory
-
- public String testRootName;
-
- public TestFactoryTDB2(String testRootName)
- {
- this.testRootName = testRootName;
- }
-
- @Override
- protected Test makeTest(Resource manifest, Resource entry, String testName, Resource action, Resource result)
- {
- if ( testRootName != null )
- testName = testRootName+testName;
-
- TestItem testItem = TestItem.create(entry, null);
-
- TestCase test = null;
-
- if ( testItem.getTestType() != null )
- {
- if ( testItem.getTestType().equals(TestManifestX.TestQuery) )
- test = new QueryTestTDB2(testName, report, testItem);
-
- if ( testItem.getTestType().equals(TestManifestX.TestSurpressed) )
- test = new SurpressedTest(testName, report, testItem);
-
- // Ignore syntax tests
- if ( testItem.getTestType().equals(TestManifestX.PositiveSyntaxTestARQ) )
- // Ignore
- return null;
- if ( testItem.getTestType().equals(TestManifestX.NegativeSyntaxTestARQ) )
- // Ignore
- return null;
- if ( testItem.getTestType().equals(TestManifestX.PositiveUpdateSyntaxTestARQ) )
- // Ignore
- return null;
- if ( testItem.getTestType().equals(TestManifestX.NegativeUpdateSyntaxTestARQ) )
- // Ignore
- return null;
-
-
- if ( test == null )
- System.err.println("Unrecognized test type: "+testItem.getTestType());
- }
- // Default
- if ( test == null )
- test = new QueryTestTDB2(testName, report, testItem);
-
- return test;
- }
-
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestAdmin.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestAdmin.java
index 9f6fdb1..6b07ea0 100644
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestAdmin.java
+++ b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestAdmin.java
@@ -42,7 +42,7 @@
import org.apache.jena.atlas.json.JsonArray;
import org.apache.jena.atlas.json.JsonObject;
import org.apache.jena.atlas.json.JsonValue;
-import org.apache.jena.atlas.junit.BaseTest;
+import org.apache.jena.atlas.junit.AssertExtra;
import org.apache.jena.atlas.lib.Lib;
import org.apache.jena.atlas.web.HttpException;
import org.apache.jena.atlas.web.TypedInputStream;
@@ -410,7 +410,7 @@
private static JsonValue getDatasetDescription(String dsName) {
try (TypedInputStream in = execHttpGet(ServerCtl.urlRoot() + "$/" + opDatasets + "/" + dsName)) {
- BaseTest.assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
+ AssertExtra.assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
JsonValue v = JSON.parse(in);
return v;
}
@@ -637,14 +637,14 @@
private static JsonValue execGetJSON(String url) {
try ( TypedInputStream in = execHttpGet(url) ) {
- BaseTest.assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
+ AssertExtra.assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
return JSON.parse(in);
}
}
private static JsonValue execPostJSON(String url) {
try ( TypedInputStream in = execHttpPostStream(url, null, null, null) ) {
- BaseTest.assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
+ AssertExtra.assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
return JSON.parse(in);
}
}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestDatasetOps.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestDatasetOps.java
index fd72e73..307c950 100644
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestDatasetOps.java
+++ b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestDatasetOps.java
@@ -24,7 +24,7 @@
import org.apache.http.HttpEntity;
import org.apache.http.entity.EntityTemplate;
-import org.apache.jena.atlas.junit.BaseTest;
+import org.apache.jena.atlas.junit.AssertExtra;
import org.apache.jena.atlas.lib.StrUtils;
import org.apache.jena.atlas.web.HttpException;
import org.apache.jena.atlas.web.TypedInputStream;
@@ -117,7 +117,7 @@
// Do manually so the test can validate the expected ContentType
try (TypedInputStream in = HttpOp.execHttpGet(urlDataset, acceptheader)) {
- BaseTest.assertEqualsIgnoreCase(contentTypeResponse, in.getContentType());
+ AssertExtra.assertEqualsIgnoreCase(contentTypeResponse, in.getContentType());
Lang lang = RDFLanguages.contentTypeToLang(in.getContentType());
DatasetGraph dsg = DatasetGraphFactory.create();
StreamRDF dest = StreamRDFLib.dataset(dsg);
diff --git a/jena-sdb/pom.xml b/jena-sdb/pom.xml
index 801b5c7..d5925fe 100644
--- a/jena-sdb/pom.xml
+++ b/jena-sdb/pom.xml
@@ -144,7 +144,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
- <!-- Requires HSQL and Apache Derbey to be set in
+ <!-- Requires HSQL and Apache Derby to be set in
store-list.ttl and store-list-simple.ttl
-->
<include>org/apache/jena/sdb/test/SDBTestAll.java</include>
diff --git a/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit/QueryTestSDB.java b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit/QueryTestSDB.java
index 7bdd621..93e55d6 100644
--- a/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit/QueryTestSDB.java
+++ b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit/QueryTestSDB.java
@@ -21,25 +21,24 @@
import java.util.ArrayList ;
import java.util.List ;
+import junit.framework.TestCase;
import org.apache.jena.query.* ;
import org.apache.jena.sdb.Store ;
import org.apache.jena.sdb.StoreDesc ;
import org.apache.jena.sdb.engine.QueryEngineSDB ;
import org.apache.jena.sdb.sql.SDBConnection ;
import org.apache.jena.sdb.store.DatasetStore ;
+import org.apache.jena.sdb.test.junit2.TestItem;
import org.apache.jena.sdb.util.StoreUtils ;
import org.apache.jena.sparql.SystemARQ ;
import org.apache.jena.sparql.engine.QueryEngineFactory ;
import org.apache.jena.sparql.engine.QueryExecutionBase ;
import org.apache.jena.sparql.engine.ref.QueryEngineRef ;
-import org.apache.jena.sparql.junit.EarlReport ;
-import org.apache.jena.sparql.junit.EarlTestCase ;
-import org.apache.jena.sparql.junit.TestItem ;
import org.apache.jena.sparql.resultset.ResultSetCompare ;
import org.slf4j.Logger ;
import org.slf4j.LoggerFactory ;
-public class QueryTestSDB extends EarlTestCase
+public class QueryTestSDB extends TestCase
{
public static boolean VERBOSE = false ;
StoreDesc storeDesc ;
@@ -47,9 +46,9 @@
TestItem item ;
private static Logger log = LoggerFactory.getLogger(QueryTestSDB.class) ;
- public QueryTestSDB(StoreDesc desc, String testName, EarlReport report, TestItem item)
+ public QueryTestSDB(StoreDesc desc, String testName, TestItem item)
{
- super(testName, item.getURI(), report) ;
+ super(testName) ;
this.storeDesc = desc ;
this.item = item ;
}
@@ -132,7 +131,7 @@
}
@Override
- public void runTestForReal()
+ public void runTest()
{
if ( skipThisTest )
{
diff --git a/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit/QueryTestSDBFactory.java b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit/QueryTestSDBFactory.java
index c6f3bdd..d6e57c2 100644
--- a/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit/QueryTestSDBFactory.java
+++ b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit/QueryTestSDBFactory.java
@@ -18,25 +18,21 @@
package org.apache.jena.sdb.test.junit;
-import static org.apache.jena.sparql.junit.TestQueryUtils.getQuerySyntax ;
import junit.framework.Test ;
import junit.framework.TestCase ;
import junit.framework.TestSuite ;
import org.apache.jena.query.Syntax ;
import org.apache.jena.rdf.model.Resource ;
import org.apache.jena.sdb.StoreDesc ;
+import org.apache.jena.sdb.test.junit2.SurpressedTest;
+import org.apache.jena.sdb.test.junit2.TestItem;
import org.apache.jena.sdb.util.Pair ;
-import org.apache.jena.sparql.junit.EarlReport ;
import org.apache.jena.sparql.junit.QueryTestException ;
-import org.apache.jena.sparql.junit.SurpressedTest ;
-import org.apache.jena.sparql.junit.TestItem ;
import org.apache.jena.sparql.vocabulary.TestManifestX ;
-import org.apache.jena.util.junit.TestFactoryManifest ;
+import org.apache.jena.util.junit.TestFactoryManifestOld ;
-public class QueryTestSDBFactory extends TestFactoryManifest
+public class QueryTestSDBFactory extends TestFactoryManifestOld
{
- public static EarlReport results = null ;
-
public static TestSuite makeSuite(String storeListFile, String manifestFile)
{
TestSuite ts = new TestSuite() ;
@@ -79,7 +75,7 @@
public Test makeTest(Resource manifest, Resource entry, String testName, Resource action, Resource result)
{
// Defaults.
- Syntax querySyntax = getQuerySyntax(manifest) ;
+ Syntax querySyntax = Syntax.syntaxARQ ;
if ( testRootName != null )
testName = testRootName+testName ;
@@ -95,10 +91,10 @@
TestCase test = null ;
if ( testItem.getTestType().equals(TestManifestX.TestQuery) )
- test = new QueryTestSDB(storeDesc, testName, results, testItem) ;
+ test = new QueryTestSDB(storeDesc, testName, testItem) ;
if ( testItem.getTestType().equals(TestManifestX.TestSurpressed) )
- test = new SurpressedTest(testName, results, testItem) ;
+ test = new SurpressedTest(testName, testItem) ;
if ( test == null )
System.err.println("Unrecognized test type: "+testItem.getTestType()) ;
diff --git a/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/EarlTestCase.java b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/EarlTestCase.java
new file mode 100644
index 0000000..e0e4c4f
--- /dev/null
+++ b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/EarlTestCase.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.sdb.test.junit2;
+
+public abstract class EarlTestCase{}
+
+//public abstract class EarlTestCase extends TestCase
+//{
+// protected EarlReport report = null ;
+// protected String testURI = null ;
+// private boolean resultRecorded = false ;
+//
+// protected EarlTestCase(String name, String testURI, EarlReport earl)
+// {
+// super(name) ;
+// this.report = earl ;
+// this.testURI = testURI ;
+// }
+//
+// public void setEARL(EarlReport earl)
+// {
+// this.report = earl ;
+// }
+//
+// protected Query queryFromString(String qStr)
+// {
+// Query query = QueryFactory.create(qStr) ;
+// return query ;
+// }
+//
+// protected Query queryFromTestItem(TestItem testItem)
+// {
+// if ( testItem.getQueryFile() == null )
+// {
+// fail("Query test file is null") ;
+// return null ;
+// }
+//
+// Query query = QueryFactory.read(testItem.getQueryFile(), null, testItem.getFileSyntax()) ;
+// return query ;
+// }
+//
+// protected UpdateRequest updateFromString(String str)
+// {
+// return UpdateFactory.create(str) ;
+// }
+//
+// protected UpdateRequest updateFromTestItem(TestItem testItem)
+// {
+// if ( testItem.getQueryFile() == null )
+// {
+// fail("Query test file is null") ;
+// return null ;
+// }
+//
+// String fn = testItem.getQueryFile();
+// Syntax syntax = ( fn.endsWith(".aru") )? Syntax.syntaxARQ : Syntax.syntaxSPARQL_11;
+//
+// UpdateRequest request = UpdateFactory.read(fn, syntax);
+// return request ;
+// }
+//
+// @Override
+// final protected void runTest() throws Throwable
+// {
+// try {
+// runTestForReal() ;
+// if ( ! resultRecorded )
+// success() ;
+// } catch (AssertionFailedError ex)
+// {
+// if ( ! resultRecorded )
+// failure() ;
+// throw ex ;
+// }
+// }
+//
+// protected abstract void runTestForReal() throws Throwable ;
+//
+// // Increase visibility.
+// @Override
+// protected void setUp() {
+// setUpTest() ;
+// }
+//
+// @Override
+// protected void tearDown() {
+// tearDownTest() ;
+// }
+//
+// // Decouple from JUnit3.
+// public void setUpTest() {}
+// public void tearDownTest() {}
+//
+// protected void success()
+// {
+// note() ;
+// if ( report == null ) return ;
+// report.success(testURI) ;
+// }
+//
+// protected void failure()
+// {
+// note() ;
+// if ( report == null ) return ;
+// report.failure(testURI) ;
+// }
+//
+// protected void notApplicable()
+// {
+// note() ;
+// if ( report == null ) return ;
+// report.notApplicable(testURI) ;
+// }
+//
+// protected void notTested()
+// {
+// resultRecorded = true ;
+// if ( report == null ) return ;
+// report.notTested(testURI) ;
+// }
+//
+// private void note()
+// {
+// if ( resultRecorded )
+// throw new ARQException("Duplictaed test results: "+getName()) ;
+// resultRecorded = true ;
+// }
+//
+//}
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/junit/QueryTest.java b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/QueryTest.java
similarity index 92%
rename from jena-arq/src/test/java/org/apache/jena/sparql/junit/QueryTest.java
rename to jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/QueryTest.java
index 1de9b23..dea65b8 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/junit/QueryTest.java
+++ b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/QueryTest.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.jena.sparql.junit;
+package org.apache.jena.sdb.test.junit2;
import java.io.IOException;
import java.io.PrintStream;
@@ -26,29 +26,14 @@
import java.util.List;
import java.util.Set;
+import junit.framework.TestCase;
import org.apache.jena.atlas.logging.Log;
import org.apache.jena.graph.Node;
import org.apache.jena.graph.NodeFactory;
-import org.apache.jena.query.Dataset;
-import org.apache.jena.query.DatasetFactory;
-import org.apache.jena.query.Query;
-import org.apache.jena.query.QueryException;
-import org.apache.jena.query.QueryExecution;
-import org.apache.jena.query.QueryExecutionFactory;
-import org.apache.jena.query.ResultSet;
-import org.apache.jena.query.ResultSetFactory;
-import org.apache.jena.query.ResultSetFormatter;
-import org.apache.jena.query.ResultSetRewindable;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.ModelFactory;
-import org.apache.jena.rdf.model.Property;
-import org.apache.jena.rdf.model.RDFNode;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.jena.rdf.model.Statement;
-import org.apache.jena.rdf.model.StmtIterator;
+import org.apache.jena.query.*;
+import org.apache.jena.rdf.model.*;
import org.apache.jena.riot.Lang;
import org.apache.jena.riot.RDFDataMgr;
-import org.apache.jena.riot.checker.CheckerLiterals;
import org.apache.jena.riot.system.IRIResolver;
import org.apache.jena.shared.JenaException;
import org.apache.jena.sparql.SystemARQ;
@@ -69,46 +54,43 @@
import org.apache.jena.util.junit.TestUtils;
import org.apache.jena.vocabulary.RDF;
-public class QueryTest extends EarlTestCase
+public class QueryTest extends TestCase
{
private static int testCounter = 1 ;
private int testNumber = testCounter++ ;
- private TestItem testItem ;
+ private final TestItem testItem ;
private SPARQLResult results = null ; // Maybe null if no testing of results
+ private final String testURI;
// If supplied with a model, the test will load that model with data from the source
// If no model is supplied one is created or attached (e.g. a database)
- public QueryTest(String testName, EarlReport earl, TestItem t)
+ public QueryTest(String testName, TestItem t)
{
- super(TestUtils.safeName(testName), t.getURI(), earl) ;
- testItem = t ;
+ super(TestUtils.safeName(testName)) ;
+ this.testItem = t ;
+ this.testURI = testItem.getURI();
}
+
private boolean oldWarningFlag ;
private boolean oldPlainGraphFlag ;
@Override
- public void setUpTest()
+ public void setUp()
{
- super.setUpTest() ;
// SPARQL and ARQ tests are done with no value matching (for query execution and results testing)
oldPlainGraphFlag = SystemARQ.UsePlainGraph ;
SystemARQ.UsePlainGraph = true ;
- // Turn parser warnings off for the test data.
- oldWarningFlag = CheckerLiterals.WarnOnBadLiterals ;
- CheckerLiterals.WarnOnBadLiterals = false ;
// Sort out results.
results = testItem.getResults() ;
}
@Override
- public void tearDownTest()
+ public void tearDown()
{
SystemARQ.UsePlainGraph = oldPlainGraphFlag ;
- CheckerLiterals.WarnOnBadLiterals = oldWarningFlag ;
- super.tearDownTest() ;
}
private Dataset setUpDataset(Query query, TestItem testItem)
@@ -176,7 +158,7 @@
}
@Override
- protected void runTestForReal() throws Throwable
+ protected void runTest() throws Throwable
{
Query query = null ;
try {
@@ -523,6 +505,18 @@
System.out.println() ;
}
+ protected Query queryFromTestItem(TestItem testItem)
+ {
+ if ( testItem.getQueryFile() == null )
+ {
+ fail("Query test file is null") ;
+ return null ;
+ }
+
+ Query query = QueryFactory.read(testItem.getQueryFile(), null, testItem.getFileSyntax()) ;
+ return query ;
+ }
+
@Override
public String toString()
{
diff --git a/jena-arq/src/test/java/org/apache/jena/atlas/web/TS_Web.java b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/QueryTestException.java
similarity index 61%
copy from jena-arq/src/test/java/org/apache/jena/atlas/web/TS_Web.java
copy to jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/QueryTestException.java
index af639c2..91506ac 100644
--- a/jena-arq/src/test/java/org/apache/jena/atlas/web/TS_Web.java
+++ b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/QueryTestException.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -16,17 +16,17 @@
* limitations under the License.
*/
-package org.apache.jena.atlas.web;
+package org.apache.jena.sdb.test.junit2;
-import org.junit.runner.RunWith ;
-import org.junit.runners.Suite ;
+/**
+ * QueryTestException is root exception for all (intentional) exceptions in tests
+ * setup, not a failure of the test itself (e.g. manifest problems)
+ */
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
- TestContentNegotiation.class
-} )
-public class TS_Web
+public class QueryTestException extends RuntimeException
{
-
+ public QueryTestException() { super() ; }
+ public QueryTestException(Throwable cause) { super(cause) ; }
+ public QueryTestException(String msg) { super(msg) ; }
+ public QueryTestException(String msg, Throwable cause) { super(msg, cause) ; }
}
-
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/junit/SimpleTestRunner.java b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/SimpleTestRunner.java
similarity index 98%
rename from jena-arq/src/test/java/org/apache/jena/sparql/junit/SimpleTestRunner.java
rename to jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/SimpleTestRunner.java
index b61810c..ff96bdd 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/junit/SimpleTestRunner.java
+++ b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/SimpleTestRunner.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.jena.sparql.junit;
+package org.apache.jena.sdb.test.junit2;
import java.io.PrintStream ;
import java.util.Enumeration ;
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/junit/SurpressedTest.java b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/SurpressedTest.java
similarity index 80%
rename from jena-arq/src/test/java/org/apache/jena/sparql/junit/SurpressedTest.java
rename to jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/SurpressedTest.java
index 4a4d0a8..06bf949 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/junit/SurpressedTest.java
+++ b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/SurpressedTest.java
@@ -16,24 +16,24 @@
* limitations under the License.
*/
-package org.apache.jena.sparql.junit;
+package org.apache.jena.sdb.test.junit2;
+import junit.framework.TestCase;
-public class SurpressedTest extends EarlTestCase
+public class SurpressedTest extends TestCase
{
public static boolean verbose = true ;
String comment ;
- public SurpressedTest(String testName, EarlReport report, TestItem testItem)
+ public SurpressedTest(String testName, TestItem testItem)
{
- super(testName, testItem.getURI(), report) ;
+ super(testName) ;
this.comment = testItem.getComment() ;
}
@Override
- protected void runTestForReal()
+ protected void runTest()
{
- super.notTested() ;
if ( verbose )
{
System.out.print("** Surpressed: "+getName()) ;
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/junit/TestItem.java b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/TestItem.java
similarity index 98%
rename from jena-arq/src/test/java/org/apache/jena/sparql/junit/TestItem.java
rename to jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/TestItem.java
index 9c3b43e..6fc01a5 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/junit/TestItem.java
+++ b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/TestItem.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.jena.sparql.junit ;
+package org.apache.jena.sdb.test.junit2 ;
import java.util.ArrayList;
import java.util.List;
@@ -152,13 +152,13 @@
Model m = RDFDataMgr.loadModel(resultFile) ;
return new SPARQLResult(m) ;
}
-
+
if ( ResultsFormat.isDatasetSyntax(format) ) {
Dataset d = RDFDataMgr.loadDataset(resultFile) ;
return new SPARQLResult(d) ;
}
- // Attempt to handle as a resultset or boolean result.s
+ // Attempt to handle as a resulset or boolean result.s
SPARQLResult x = ResultSetFactory.result(resultFile) ;
return x ;
}
@@ -195,12 +195,12 @@
return Syntax.syntaxSPARQL_11;
if ( filename.endsWith(".ru") )
return Syntax.syntaxSPARQL_11;
-
+
return Syntax.guessFileSyntax(filename);
}
private String _getName() {
-
+
Statement s = testResource.getProperty(TestManifest.name) ;
String ln = s.getSubject().getLocalName();
if ( s == null )
@@ -235,7 +235,7 @@
/**
* Get the data file (default graph): maybe unknown if part for the query
* (FROM)
- *
+ *
* @return List
*/
@@ -258,7 +258,7 @@
/**
* Get the named graphs : maybe unknown if part for the query (FROM NAMED)
- *
+ *
* @return List
*/
@@ -282,7 +282,7 @@
/**
* Get the query file: either it is the action (data in query) or it is
* specified within the bNode as a query/data pair.
- *
+ *
* @return
*/
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/junit/TestQueryUtils.java b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/TestQueryUtils.java
similarity index 96%
rename from jena-arq/src/test/java/org/apache/jena/sparql/junit/TestQueryUtils.java
rename to jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/TestQueryUtils.java
index d2f439c..28e2f8f 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/junit/TestQueryUtils.java
+++ b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/TestQueryUtils.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.jena.sparql.junit;
+package org.apache.jena.sdb.test.junit2;
import org.apache.jena.query.Syntax ;
import org.apache.jena.rdf.model.Resource ;
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/junit/TextListenerOneLine.java b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/TextListenerOneLine.java
similarity index 98%
rename from jena-arq/src/test/java/org/apache/jena/sparql/junit/TextListenerOneLine.java
rename to jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/TextListenerOneLine.java
index cbe39ed..6ae9345 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/junit/TextListenerOneLine.java
+++ b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/TextListenerOneLine.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.jena.sparql.junit;
+package org.apache.jena.sdb.test.junit2;
import java.io.PrintStream ;
import java.text.NumberFormat ;
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/junit/UpdateTest.java b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/UpdateTest.java
similarity index 87%
rename from jena-arq/src/test/java/org/apache/jena/sparql/junit/UpdateTest.java
rename to jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/UpdateTest.java
index d8e2985..4100bb6 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/junit/UpdateTest.java
+++ b/jena-sdb/src/test/java/org/apache/jena/sdb/test/junit2/UpdateTest.java
@@ -16,11 +16,12 @@
* limitations under the License.
*/
-package org.apache.jena.sparql.junit;
+package org.apache.jena.sdb.test.junit2;
import java.util.ArrayList ;
import java.util.List ;
+import junit.framework.TestCase;
import org.apache.jena.atlas.iterator.Iter ;
import org.apache.jena.query.Dataset ;
import org.apache.jena.query.DatasetFactory ;
@@ -30,7 +31,6 @@
import org.apache.jena.rdf.model.Resource ;
import org.apache.jena.rdf.model.Statement ;
import org.apache.jena.riot.RDFDataMgr;
-import org.apache.jena.riot.checker.CheckerLiterals ;
import org.apache.jena.sparql.core.DatasetGraph ;
import org.apache.jena.sparql.core.DatasetGraphFactory ;
import org.apache.jena.sparql.vocabulary.TestManifestUpdate_11 ;
@@ -42,7 +42,7 @@
import org.apache.jena.vocabulary.RDFS ;
-public class UpdateTest extends EarlTestCase
+public class UpdateTest extends TestCase
{
private Resource action ;
private Resource result ;
@@ -50,22 +50,25 @@
private String updateFile ;
private Dataset input ;
private Dataset output ;
+ private final String testURI;
+
- public static UpdateTest create(String testName, EarlReport earl, Resource entry, Resource action, Resource result)
+ public static UpdateTest create(String testName, Resource entry, Resource action, Resource result)
{
if ( ! action.hasProperty(TestManifestUpdate_11.request) )
{
System.err.println("No request in action: "+testName) ;
return null ;
}
- return new UpdateTest(testName, earl, entry, action, result) ;
+ return new UpdateTest(testName, entry, action, result) ;
}
- private UpdateTest(String testName, EarlReport earl, Resource entry, Resource action, Resource result)
+ private UpdateTest(String testName, Resource entry, Resource action, Resource result)
{
- super(TestUtils.safeName(testName), entry.getURI(), earl) ;
+ super(TestUtils.safeName(testName)) ;
this.action = action ;
this.result = result ;
+ this.testURI = entry.getURI();
/*
* mf:action [ ut:query <insert-data-spo1.rq> ;
ut:data <empty.ttl>
@@ -81,29 +84,23 @@
private boolean oldWarningFlag ;
@Override
- public void setUpTest()
+ public void setUp()
{
- super.setUpTest() ;
- // Turn parser warnings off for the test data.
- oldWarningFlag = CheckerLiterals.WarnOnBadLiterals ;
- //CheckerLiterals.WarnOnBadLiterals = false ;
input = getDataset(action) ;
output = getDataset(result) ;
}
@Override
- public void tearDownTest()
+ public void tearDown()
{
// if ( resetNeeded )
// ARQ.setFalse(ARQ.strictGraph) ;
- CheckerLiterals.WarnOnBadLiterals = oldWarningFlag ;
input = null ;
output = null ;
- super.tearDownTest() ;
}
@Override
- protected void runTestForReal()
+ protected void runTest()
{
try {
UpdateRequest request = UpdateFactory.read(updateFile, Syntax.syntaxSPARQL_11) ;
diff --git a/jena-sdb/src/test/java/sdb/sdbtest.java b/jena-sdb/src/test/java/sdb/sdbtest.java
index a7ccb1f..1664eea 100644
--- a/jena-sdb/src/test/java/sdb/sdbtest.java
+++ b/jena-sdb/src/test/java/sdb/sdbtest.java
@@ -20,22 +20,11 @@
import java.util.List ;
-import jena.cmd.ArgDecl;
import junit.framework.TestSuite ;
-
import org.apache.jena.atlas.lib.Lib ;
import org.apache.jena.query.ARQ ;
-import org.apache.jena.rdf.model.Model ;
-import org.apache.jena.rdf.model.Resource ;
import org.apache.jena.sdb.SDB ;
import org.apache.jena.sdb.test.junit.QueryTestSDBFactory ;
-import org.apache.jena.sparql.junit.EarlReport ;
-import org.apache.jena.sparql.junit.ScriptTestSuiteFactory ;
-import org.apache.jena.sparql.junit.SimpleTestRunner ;
-import org.apache.jena.sparql.vocabulary.FOAF ;
-import org.apache.jena.vocabulary.DC ;
-import org.apache.jena.vocabulary.DCTerms ;
-
import sdb.cmd.CmdArgsDB ;
/** Run a test suite
@@ -49,9 +38,7 @@
public class sdbtest extends CmdArgsDB
{
- public static final String usage = "sdbtest --sdb <SPEC> [--earl] [--direct] [manifest]" ;
- static ArgDecl earlDecl = new ArgDecl(ArgDecl.NoValue, "earl") ;
- boolean earlReport = false ;
+ public static final String usage = "sdbtest --sdb <SPEC> manifest" ;
public static void main (String... argv)
{
@@ -63,32 +50,24 @@
protected sdbtest(String... args)
{
super(args);
- add(earlDecl, "--earl", "Generate an EARL report (RDF)") ;
}
@Override
protected String getCommandName() { return Lib.className(this) ; }
@Override
- protected String getSummary() { return Lib.className(this)+" <SPEC> [--earl] [--direct] [manifest]" ; }
+ protected String getSummary() { return Lib.className(this)+" <SPEC> manifest" ; }
@Override
- protected void processModulesAndArgs()
- {
+ protected void processModulesAndArgs() {
if ( getPositional().size() == 0 )
- cmdError("No manifest to run") ;
- earlReport = contains(earlDecl) ;
+ cmdError("No manifest to run");
}
-
- @Override
- protected void execCmd(List<String> positionalArgs)
- {
- for ( String x : positionalArgs )
- {
- if ( earlReport )
- execOneManifestEarl(x) ;
- else
- execOneManifest(x) ;
+
+ @Override
+ protected void execCmd(List<String> positionalArgs) {
+ for ( String x : positionalArgs ) {
+ execOneManifest(x);
}
}
@@ -108,37 +87,6 @@
// PostgreSQL gets upset with comments in comments??
ARQ.getContext().setFalse(SDB.annotateGeneratedSQL) ;
- SimpleTestRunner.runAndReport(ts) ;
- }
-
- static void execOneManifestEarl(String testManifest)
- {
- // Include information later.
- EarlReport report = new EarlReport("http://jena.apache.org/#sdb", "SDB", SDB.VERSION, "http://jena.apahe.org/") ;
- ScriptTestSuiteFactory.results = report ;
-
- Model model = report.getModel() ;
-
- // Update the EARL report.
- Resource jena = model.createResource()
- .addProperty(FOAF.homepage, model.createResource("http://jena.apahe.org/")) ;
-
- // SDB is part of Jena.
- Resource arq = report.getSystem()
- .addProperty(DCTerms.isPartOf, jena) ;
-
- // Andy wrote the test software (updates the thing being tested as well as they are the same).
- Resource who = model.createResource(FOAF.Person)
- .addProperty(FOAF.name, "Andy Seaborne")
- .addProperty(FOAF.homepage,
- model.createResource("http://people.apache.org/~andy")) ;
- Resource reporter = report.getReporter() ;
- reporter.addProperty(DC.creator, who) ;
-
- TestSuite suite = ScriptTestSuiteFactory.make(testManifest) ;
- SimpleTestRunner.runSilent(suite) ;
-
- ScriptTestSuiteFactory.results.getModel().write(System.out, "TTL") ;
-
+ org.apache.jena.sdb.test.junit2.SimpleTestRunner.runAndReport(ts) ;
}
}
diff --git a/jena-tdb/pom.xml b/jena-tdb/pom.xml
index 24fc114..556fa5c 100644
--- a/jena-tdb/pom.xml
+++ b/jena-tdb/pom.xml
@@ -113,6 +113,7 @@
<configuration>
<includes>
<include>**/TS_*.java</include>
+ <include>**/Scripts_*.java</include>
</includes>
</configuration>
</plugin>
diff --git a/jena-tdb/src/test/java/org/apache/jena/tdb/Scripts_TDB1.java b/jena-tdb/src/test/java/org/apache/jena/tdb/Scripts_TDB1.java
new file mode 100644
index 0000000..c98d7f6
--- /dev/null
+++ b/jena-tdb/src/test/java/org/apache/jena/tdb/Scripts_TDB1.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+package org.apache.jena.tdb;
+
+import org.apache.jena.arq.junit.manifest.Label;
+import org.apache.jena.arq.junit.manifest.Manifests;
+import org.apache.jena.arq.junit.manifest.Prefix;
+import org.apache.jena.query.ARQ;
+import org.apache.jena.sparql.expr.E_Function;
+import org.apache.jena.sparql.expr.NodeValue;
+import org.apache.jena.tdb.junit.RunnerSPARQL_TDB1;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+
+@RunWith(RunnerSPARQL_TDB1.class)
+@Label("SPARQL [TDB1]")
+@Prefix("TDB1-")
+@Manifests
+({
+ "testing/manifest.ttl",
+ "../jena-arq/testing/ARQ/RDF-Star/SPARQL-Star/manifest.ttl"
+})
+
+public class Scripts_TDB1
+{
+ @BeforeClass static public void beforeClass() {
+ ARQ.setNormalMode();
+ NodeValue.VerboseWarnings = false;
+ E_Function.WarnOnUnknownFunction = false;
+ }
+
+ @AfterClass static public void afterClass() {
+ NodeValue.VerboseWarnings = true;
+ E_Function.WarnOnUnknownFunction = true;
+ }
+}
diff --git a/jena-tdb/src/test/java/org/apache/jena/tdb/TC_TDB.java b/jena-tdb/src/test/java/org/apache/jena/tdb/TC_TDB.java
index e8c8821..b9e81b8 100644
--- a/jena-tdb/src/test/java/org/apache/jena/tdb/TC_TDB.java
+++ b/jena-tdb/src/test/java/org/apache/jena/tdb/TC_TDB.java
@@ -61,7 +61,7 @@
, TS_TDBAssembler.class
, TS_TransactionTDB.class
, TS_ObjectFile.class
- , TS_ScriptsTDB1.class
+ , Scripts_TDB1.class
} )
public class TC_TDB
diff --git a/jena-tdb/src/test/java/org/apache/jena/tdb/TS_ScriptsTDB1.java b/jena-tdb/src/test/java/org/apache/jena/tdb/TS_ScriptsTDB1.java
deleted file mode 100644
index 92beb39..0000000
--- a/jena-tdb/src/test/java/org/apache/jena/tdb/TS_ScriptsTDB1.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.tdb;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
- TestScriptsTDB1.class
-})
-
-public class TS_ScriptsTDB1 {}
diff --git a/jena-tdb/src/test/java/org/apache/jena/tdb/TestScriptsTDB1.java b/jena-tdb/src/test/java/org/apache/jena/tdb/TestScriptsTDB1.java
deleted file mode 100644
index a49fa9d..0000000
--- a/jena-tdb/src/test/java/org/apache/jena/tdb/TestScriptsTDB1.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.tdb;
-
-import junit.framework.TestSuite ;
-import org.apache.jena.tdb.junit.TestFactoryTDB ;
-import org.junit.runner.RunWith ;
-import org.junit.runners.AllTests ;
-
-/** Scripted test generation */
-
-@RunWith(AllTests.class)
-public class TestScriptsTDB1 extends TestSuite
-{
- static final String ARQ_DIR = "../jena-arq/testing/ARQ";
-
- static public TestSuite suite() { return new TestScriptsTDB1() ; }
-
- private TestScriptsTDB1()
- {
- super("TDB-Scripts") ;
- String manifestMain1 = ConfigTest.getTestingDataRoot()+"/manifest.ttl" ;
- TestFactoryTDB.make(this, manifestMain1, "TDB-") ;
-
- // From ARQ
- String manifestMain2 = ARQ_DIR + "/RDF-Star/SPARQL-Star/manifest.ttl";
- TestFactoryTDB.make(this, manifestMain2, "TDB-");
- }
-}
diff --git a/jena-tdb/src/test/java/org/apache/jena/tdb/assembler/TS_TDBAssembler.java b/jena-tdb/src/test/java/org/apache/jena/tdb/assembler/TS_TDBAssembler.java
index 99605a1..2e9e12e 100644
--- a/jena-tdb/src/test/java/org/apache/jena/tdb/assembler/TS_TDBAssembler.java
+++ b/jena-tdb/src/test/java/org/apache/jena/tdb/assembler/TS_TDBAssembler.java
@@ -18,7 +18,6 @@
package org.apache.jena.tdb.assembler;
-import org.apache.jena.tdb.junit.Base_TS ;
import org.junit.runner.RunWith ;
import org.junit.runners.Suite ;
@@ -27,5 +26,5 @@
TestTDBAssembler.class
})
-public class TS_TDBAssembler extends Base_TS
+public class TS_TDBAssembler
{}
diff --git a/jena-tdb/src/test/java/org/apache/jena/tdb/junit/AbstractTestGraphTDB.java b/jena-tdb/src/test/java/org/apache/jena/tdb/junit/AbstractTestGraphTDB.java
deleted file mode 100644
index b0a7eb0..0000000
--- a/jena-tdb/src/test/java/org/apache/jena/tdb/junit/AbstractTestGraphTDB.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.tdb.junit;
-
-import org.apache.jena.graph.test.AbstractTestGraph ;
-
-public abstract class AbstractTestGraphTDB extends AbstractTestGraph
-{
- public AbstractTestGraphTDB(String name)
- {
- super(name) ;
- }
-
- @Override public void testIsomorphismFile() {}
-
- // Meaning less - graphs (and hence models) are not indpenedent of their datasets.
- @Override public void testCloseSetsIsClosed() {}
-}
diff --git a/jena-tdb/src/test/java/org/apache/jena/tdb/junit/Base_TS.java b/jena-tdb/src/test/java/org/apache/jena/tdb/junit/Base_TS.java
deleted file mode 100644
index e783ed1..0000000
--- a/jena-tdb/src/test/java/org/apache/jena/tdb/junit/Base_TS.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.tdb.junit;
-
-import org.apache.jena.atlas.logging.LogCtl;
-import org.apache.jena.sparql.engine.optimizer.reorder.ReorderLib ;
-import org.apache.jena.sparql.engine.optimizer.reorder.ReorderTransformation ;
-import org.apache.jena.tdb.sys.SystemTDB ;
-import org.junit.AfterClass ;
-import org.junit.BeforeClass ;
-
-public class Base_TS
-{
- static String level = null ;
- static ReorderTransformation rt = null ;
-
- @BeforeClass static public void beforeClass()
- {
- rt = SystemTDB.defaultReorderTransform ;
- level = LogCtl.getLevel("org.apache.jena.tdb.info") ;
- LogCtl.setLevel("org.apache.jena.tdb.info", "FATAL");
- SystemTDB.defaultReorderTransform = ReorderLib.identity() ;
- rt = SystemTDB.defaultReorderTransform ;
- }
-
- @AfterClass static public void afterClass()
- {
- LogCtl.setLevel("org.apache.jena.tdb.info", level) ;
- SystemTDB.defaultReorderTransform = rt ;
- }
-}
diff --git a/jena-tdb/src/test/java/org/apache/jena/tdb/junit/QueryTestTDB1.java b/jena-tdb/src/test/java/org/apache/jena/tdb/junit/QueryTestTDB1.java
deleted file mode 100644
index f1ab67c..0000000
--- a/jena-tdb/src/test/java/org/apache/jena/tdb/junit/QueryTestTDB1.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.tdb.junit;
-
-import java.util.List ;
-
-import org.apache.jena.query.* ;
-import org.apache.jena.riot.RDFDataMgr;
-import org.apache.jena.sparql.SystemARQ ;
-import org.apache.jena.sparql.engine.QueryEngineFactory ;
-import org.apache.jena.sparql.engine.QueryExecutionBase ;
-import org.apache.jena.sparql.engine.ref.QueryEngineRef ;
-import org.apache.jena.sparql.junit.EarlReport ;
-import org.apache.jena.sparql.junit.EarlTestCase ;
-import org.apache.jena.sparql.junit.TestItem ;
-import org.apache.jena.sparql.resultset.ResultSetCompare ;
-import org.apache.jena.sparql.resultset.SPARQLResult ;
-import org.apache.jena.system.Txn;
-import org.apache.jena.tdb.TDBFactory ;
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
-
-public class QueryTestTDB1 extends EarlTestCase
-{
- // Changed to using in-memory graphs/datasets because this is testing the query
- // processing. Physical graph/datsets is in package "store".
-
- private static Logger log = LoggerFactory.getLogger(QueryTestTDB1.class) ;
- private Dataset dataset = null ;
-
- boolean skipThisTest = false ;
-
- final List<String> defaultGraphURIs ;
- final List<String> namedGraphURIs ;
- final String queryFile ;
- final SPARQLResult results ;
-
- // Track what's currently loaded in the GraphLocation
- private static List<String> currentDefaultGraphs = null ;
- private static List<String> currentNamedGraphs = null ;
-
- // Old style (Junit3)
- public QueryTestTDB1(String testName, EarlReport report, TestItem item)
- {
- this(testName, report, item.getURI(),
- item.getDefaultGraphURIs(), item.getNamedGraphURIs(),
- item.getResults(), item.getQueryFile()
- ) ;
- }
-
- public QueryTestTDB1(String testName, EarlReport report,
- String uri,
- List<String> dftGraphs,
- List<String> namedGraphs,
- SPARQLResult rs,
- String queryFile
- )
- {
- super(testName, uri, report) ;
- this.defaultGraphURIs = dftGraphs ;
- this.namedGraphURIs = namedGraphs ;
- this.queryFile = queryFile ;
- this.results = rs ;
- }
-
- boolean oldValueUsePlainGraph = SystemARQ.UsePlainGraph ;
-
- @Override public void setUpTest()
- {
- dataset = TDBFactory.createDataset() ;
- // Make sure a plain, no sameValueAs graph is used.
- oldValueUsePlainGraph = SystemARQ.UsePlainGraph ;
- SystemARQ.UsePlainGraph = true ;
- setupData() ;
- }
-
- @Override public void tearDownTest()
- {
- if ( dataset != null )
- {
- dataset.close() ;
- dataset = null ;
- }
- SystemARQ.UsePlainGraph = oldValueUsePlainGraph ;
- }
-
- public void setupData()
- {
- if ( compareLists(defaultGraphURIs, currentDefaultGraphs) &&
- compareLists(namedGraphURIs, currentNamedGraphs) )
- return ;
-
- if ( defaultGraphURIs == null )
- throw new TDBTestException("No default graphs given") ;
-
- //graphLocation.clear() ;
-
- // Allow "qt:data" to be quads in defaultGraphURIs.
- for ( String fn : defaultGraphURIs )
- RDFDataMgr.read(dataset, fn);
-
- for ( String fn : namedGraphURIs )
- RDFDataMgr.read(dataset.getNamedModel(fn), fn) ;
- }
-
-
- @Override
- protected void runTestForReal()
- {
- if ( skipThisTest )
- {
- log.info(this.getName()+" : Skipped") ;
- return ;
- }
-
- Query query = QueryFactory.read(queryFile) ;
- Dataset ds = DatasetFactory.create();
- for ( String fn : defaultGraphURIs )
- RDFDataMgr.read(ds, fn); // Allow quads
- for ( String fn : namedGraphURIs )
- RDFDataMgr.read(ds.getNamedModel(fn), fn) ;
-
- // ---- First, get the expected results by executing in-memory or from a results file.
-
- ResultSetRewindable rs1;
- String expectedLabel;
- if ( results != null )
- {
- rs1 = ResultSetFactory.makeRewindable(results.getResultSet()) ;
- expectedLabel = "Results file" ;
- }
- else
- {
- QueryEngineFactory f = QueryEngineRef.getFactory() ;
- try(QueryExecution qExec1 = new QueryExecutionBase(query, ds, null, f)) {
- rs1 = ResultSetFactory.makeRewindable(qExec1.execSelect()) ;
- }
- expectedLabel = "Standard engine" ;
- }
-
- // ---- Second, execute in persistent graph
-
- Dataset ds2 = dataset ;
- Txn.executeRead(ds2, ()->{
- QueryExecution qExec2 = QueryExecutionFactory.create(query, ds2) ;
- ResultSet rs = qExec2.execSelect() ;
- ResultSetRewindable rs2 = ResultSetFactory.makeRewindable(rs) ;
-
- // See if the same.
- boolean b = ResultSetCompare.equalsByValue(rs1, rs2) ;
- if ( !b )
- {
- rs1.reset() ;
- rs2.reset() ;
- System.out.println("------------------- "+this.getName());
- System.out.printf("**** Expected (%s)", expectedLabel) ;
- ResultSetFormatter.out(System.out, rs1) ;
- System.out.println("**** Got (TDB)") ;
- ResultSetFormatter.out(System.out, rs2) ;
- }
- assertTrue("Results sets not the same", b) ;
- });
-
- }
-
- private static boolean compareLists(List<String> list1, List<String> list2)
- {
- if ( list1 == null )
- return ( list2 == null ) ;
- return list1.equals(list2) ;
- }
-}
diff --git a/jena-tdb/src/test/java/org/apache/jena/tdb/junit/RunnerSPARQL_TDB1.java b/jena-tdb/src/test/java/org/apache/jena/tdb/junit/RunnerSPARQL_TDB1.java
new file mode 100644
index 0000000..94ac1cd
--- /dev/null
+++ b/jena-tdb/src/test/java/org/apache/jena/tdb/junit/RunnerSPARQL_TDB1.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.tdb.junit;
+
+import java.util.function.Function;
+
+import org.apache.jena.arq.junit.manifest.ManifestEntry;
+import org.apache.jena.arq.junit.runners.AbstractRunnerOfTests;
+import org.apache.jena.arq.junit.sparql.SparqlTests;
+import org.apache.jena.atlas.lib.Creator;
+import org.apache.jena.query.Dataset;
+import org.apache.jena.tdb.TDBFactory;
+import org.junit.runners.model.InitializationError;
+
+public class RunnerSPARQL_TDB1 extends AbstractRunnerOfTests {
+
+ public RunnerSPARQL_TDB1(Class<? > klass) throws InitializationError {
+ super(klass, testMaker());
+ }
+
+ private static Function<ManifestEntry, Runnable> testMaker() {
+ Creator<Dataset> creator = ()->TDBFactory.createDataset();
+ return
+ (manifestEntry) ->
+ SparqlTests.makeSPARQLTestExecOnly(manifestEntry, creator);
+ }
+}
+
diff --git a/jena-tdb/src/test/java/org/apache/jena/tdb/junit/TestFactoryTDB.java b/jena-tdb/src/test/java/org/apache/jena/tdb/junit/TestFactoryTDB.java
deleted file mode 100644
index a8baa0a..0000000
--- a/jena-tdb/src/test/java/org/apache/jena/tdb/junit/TestFactoryTDB.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.tdb.junit;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.jena.sparql.junit.EarlReport;
-import org.apache.jena.sparql.junit.SurpressedTest;
-import org.apache.jena.sparql.junit.TestItem;
-import org.apache.jena.sparql.vocabulary.TestManifestX;
-import org.apache.jena.util.junit.TestFactoryManifest;
-
-public class TestFactoryTDB extends TestFactoryManifest
-{
- public static EarlReport report = null;
-
- public static void make(TestSuite ts, String manifestFile, String testRootName) {
- // for each graph type do
- TestSuite ts2 = makeSuite(manifestFile, testRootName);
- ts.addTest(ts2);
- }
-
- public static TestSuite makeSuite(String manifestFile, String testRootName) {
- TestFactoryTDB f = new TestFactoryTDB(testRootName);
- TestSuite ts = f.process(manifestFile);
- if ( testRootName != null )
- ts.setName(testRootName + ts.getName());
- return ts;
- }
-
- // Factory
-
- public String testRootName;
-
- public TestFactoryTDB(String testRootName) {
- this.testRootName = testRootName;
- }
-
- @Override
- protected Test makeTest(Resource manifest, Resource entry, String testName, Resource action, Resource result)
- {
- if ( testRootName != null )
- testName = testRootName+testName;
-
- TestItem testItem = TestItem.create(entry, null);
-
- TestCase test = null;
-
- if ( testItem.getTestType() != null )
- {
- if ( testItem.getTestType().equals(TestManifestX.TestQuery) )
- test = new QueryTestTDB1(testName, report, testItem);
-
- if ( testItem.getTestType().equals(TestManifestX.TestSurpressed) )
- test = new SurpressedTest(testName, report, testItem);
-
- // Ignore syntax tests
- if ( testItem.getTestType().equals(TestManifestX.PositiveSyntaxTestARQ) )
- // Ignore
- return null;
- if ( testItem.getTestType().equals(TestManifestX.NegativeSyntaxTestARQ) )
- // Ignore
- return null;
- if ( testItem.getTestType().equals(TestManifestX.PositiveUpdateSyntaxTestARQ) )
- // Ignore
- return null;
- if ( testItem.getTestType().equals(TestManifestX.NegativeUpdateSyntaxTestARQ) )
- // Ignore
- return null;
-
- if ( test == null )
- System.err.println("Unrecognized test type: "+testItem.getTestType());
- }
- // Default
- if ( test == null )
- test = new QueryTestTDB1(testName, report, testItem);
-
- return test;
- }
-
-}
diff --git a/jena-text/src/test/java/org/apache/jena/query/text/TestTextNonTxnTDB1.java b/jena-text/src/test/java/org/apache/jena/query/text/TestTextNonTxnTDB1.java
index 7ed2da9..71eb7b1 100644
--- a/jena-text/src/test/java/org/apache/jena/query/text/TestTextNonTxnTDB1.java
+++ b/jena-text/src/test/java/org/apache/jena/query/text/TestTextNonTxnTDB1.java
@@ -25,7 +25,7 @@
import java.util.List ;
import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.atlas.junit.AssertExtra ;
import org.apache.jena.atlas.lib.StrUtils ;
import org.apache.jena.query.* ;
import org.apache.jena.rdf.model.Model ;
@@ -39,7 +39,7 @@
import org.junit.Test ;
/** Text dataset tests using TDB1 non-transactionally, including context unionDefaultGraph */
-public class TestTextNonTxnTDB1 extends BaseTest
+public class TestTextNonTxnTDB1 extends AssertExtra
{
private static Dataset create() {
Dataset ds1 = TDBFactory.createDataset() ;