Skip to content

Commit

Permalink
Merge pull request apache#1974 from afs/run-rdf-tests
Browse files Browse the repository at this point in the history
Update test manifest execution for GH/w3c/rdf-tests/rdf/rdf11 setup
  • Loading branch information
afs authored Jul 30, 2023
2 parents 905f40d + e0a045b commit 7d4b62b
Show file tree
Hide file tree
Showing 23 changed files with 165 additions and 305 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,67 +19,64 @@
package org.apache.jena.sparql.vocabulary ;

/* CVS $Id: $ */

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.Resource ;

/**
* Vocabulary definitions from test-manifest-x.ttl
* @author Auto-generated by schemagen on 13 May 2010 14:22
*/

/** More TestManifest */
public class TestManifestX {
/** <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://jena.hpl.hp.com/2005/05/test-manifest-extra#";

/** <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 );

/** <p>Syntax of the query</p> */
public static final Property dataSyntax = m_model.createProperty( "http://jena.hpl.hp.com/2005/05/test-manifest-extra#dataSyntax" );

/** <p>Default type of a test</p> */
public static final Property defaultTestType = m_model.createProperty( "http://jena.hpl.hp.com/2005/05/test-manifest-extra#defaultTestType" );

/** <p>Include another manifest file.</p> */
public static final Property include = m_model.createProperty( "http://jena.hpl.hp.com/2005/05/test-manifest-extra#include" );

/** <p>Option for an action</p> */
public static final Property option = m_model.createProperty( "http://jena.hpl.hp.com/2005/05/test-manifest-extra#option" );

/** <p>Syntax of the query</p> */
public static final Property querySyntax = m_model.createProperty( "http://jena.hpl.hp.com/2005/05/test-manifest-extra#querySyntax" );

/** <p>Whether to create a text index</p> */
public static final Property textIndex = m_model.createProperty( "http://jena.hpl.hp.com/2005/05/test-manifest-extra#textIndex" );

/** <p>Syntax tests which expect a parse failure</p> */
public static final Resource NegativeSyntaxTestARQ = m_model.createResource( "http://jena.hpl.hp.com/2005/05/test-manifest-extra#NegativeSyntaxTestARQ" );

/** <p>Syntax tests (query)</p> */
public static final Resource PositiveSyntaxTestARQ = m_model.createResource( "http://jena.hpl.hp.com/2005/05/test-manifest-extra#PositiveSyntaxTestARQ" );

/** <p>Syntax tests which expect a parse failure</p> */
public static final Resource NegativeUpdateSyntaxTestARQ = m_model.createResource( "http://jena.hpl.hp.com/2005/05/test-manifest-extra#NegativeUpdateSyntaxTestARQ" );

/** <p>Syntax tests (query)</p> */
public static final Resource PositiveUpdateSyntaxTestARQ = m_model.createResource( "http://jena.hpl.hp.com/2005/05/test-manifest-extra#PositiveUpdateSyntaxTestARQ" );

/** <p>The class of test that are Query tests (query, data, results)</p> */
public static final Resource TestQuery = m_model.createResource( "http://jena.hpl.hp.com/2005/05/test-manifest-extra#TestQuery" );

/** <p>Query serialization tests</p> */
public static final Resource TestSerialization = m_model.createResource( "http://jena.hpl.hp.com/2005/05/test-manifest-extra#TestSerialization" );

/** <p>Query test not to be run</p> */
public static final Resource TestSurpressed = m_model.createResource( "http://jena.hpl.hp.com/2005/05/test-manifest-extra#TestSurpressed" );

}
34 changes: 34 additions & 0 deletions jena-arq/src/test/java/org/apache/jena/arq/junit/SkipTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* 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 org.apache.jena.arq.junit.manifest.ManifestEntry;

/** Ignore a test */
public class SkipTest implements Runnable
{
private ManifestEntry testEntry;

public SkipTest(ManifestEntry entry) {
this.testEntry = entry;
}

@Override
public void run() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@

import org.apache.jena.arq.junit.manifest.ManifestEntry;

public class SurpressedTest implements Runnable
public class SurpressedTest extends SkipTest
{
public static boolean verbose = true;
public final boolean verbose;
private ManifestEntry testEntry;

public SurpressedTest(ManifestEntry entry) {
this.testEntry = entry;
super(entry);
this.verbose = false;
}

public SurpressedTest(ManifestEntry entry, boolean verbose) {
super(entry);
this.verbose = verbose;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@

import org.apache.jena.rdf.model.* ;
import org.apache.jena.riot.RDFDataMgr;
import org.apache.jena.sparql.vocabulary.TestManifestX;
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.apache.jena.vocabulary.TestManifest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -41,6 +41,8 @@ public class Manifest
private static Logger log = LoggerFactory.getLogger(Manifest.class) ;
private Model manifest ;
private String manifestName ;
// Assumed base URI for the tests - this makes downloded manifest that assume theiroriginal location work.
private String manifestTestBase ;
private String filename ;
private List<String> includedFiles = new ArrayList<>() ;
private List<ManifestEntry> entries = new ArrayList<>() ;
Expand Down Expand Up @@ -74,32 +76,37 @@ private Manifest(String fn) {

public String getName() { return manifestName ; }
public String getFileName() { return filename ; }
public String getTestBase() { return manifestTestBase; }

public Iterator<String> includedManifests() { return includedFiles.iterator() ; }

public List<ManifestEntry> entries() { return entries ; }

private void parseManifest()
{
private void parseManifest() {
StmtIterator manifestStmts = manifest.listStatements(null, RDF.type, TestManifest.Manifest);
if ( !manifestStmts.hasNext() ) {
log.warn("No manifest in manifest file: "+filename) ;
return ;
}
try {
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 ;
}
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();
manifestRes = manifestItemStmt.getSubject();
manifestName = getLiteral(manifestRes, RDFS.label);
if ( manifestName == null )
manifestName = getLiteral(manifestRes, RDFS.comment);
if ( manifestName == null )
manifestName = getLiteral(manifestRes, TestManifest.name);
manifestTestBase = getLiteralOrURI(manifestRes, TestManifest.assumedTestBase);
}
finally {
manifestStmts.close();
}
}

private void parseEntries() {
Expand Down Expand Up @@ -188,8 +195,7 @@ private void parseOneIncludesList(Resource r)
}
}

public static Resource getResource(Resource r, Property p)
{
public static Resource getResource(Resource r, Property p) {
if ( r == null )
return null ;
if ( ! r.hasProperty(p) )
Expand All @@ -198,8 +204,8 @@ public static Resource getResource(Resource r, Property p)
RDFNode n = r.getProperty(p).getObject() ;
if ( n instanceof Resource )
return (Resource)n ;

throw new ExTestSetup("Manifest problem (not a Resource): "+n+" => "+p) ;
// Ignore. Tests need to check for correct required properties.
return null;
}

private static Collection<Resource> listResources(Resource r, Property p)
Expand Down
Loading

0 comments on commit 7d4b62b

Please sign in to comment.