Skip to content

Commit

Permalink
GH-2081 reorg sparql custom compliance tests as JUnit 4 Test suite
Browse files Browse the repository at this point in the history
- old suite left in deprecated
  • Loading branch information
abrokenjester committed May 30, 2022
1 parent f0eb270 commit c141201
Show file tree
Hide file tree
Showing 26 changed files with 3,317 additions and 108 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*******************************************************************************
* Copyright (c) 2022 Eclipse RDF4J contributors.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Distribution License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*******************************************************************************/
package org.eclipse.rdf4j.sail.lmdb;

import org.eclipse.rdf4j.repository.config.RepositoryImplConfig;
import org.eclipse.rdf4j.repository.sail.config.SailRepositoryConfig;
import org.eclipse.rdf4j.repository.sail.config.SailRepositoryFactory;
import org.eclipse.rdf4j.sail.lmdb.config.LmdbStoreFactory;
import org.eclipse.rdf4j.testsuite.sparql.RepositorySPARQLComplianceTestSuite;
import org.junit.AfterClass;
import org.junit.BeforeClass;

/**
* Test additional SPARQL functionality on LMDB store.
*
*/
public class LmdbSPARQLComplianceTest extends RepositorySPARQLComplianceTestSuite {

@BeforeClass
public static void setUpFactory() throws Exception {
setRepositoryFactory(new SailRepositoryFactory() {
@Override
public RepositoryImplConfig getConfig() {

return new SailRepositoryConfig(new LmdbStoreFactory().getConfig());
}
});
}

@AfterClass
public static void tearDownFactory() throws Exception {
setRepositoryFactory(null);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (c) 2022 Eclipse RDF4J contributors.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Distribution License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*******************************************************************************/
package org.eclipse.rdf4j.sail.memory;

import org.eclipse.rdf4j.repository.config.RepositoryImplConfig;
import org.eclipse.rdf4j.repository.sail.config.SailRepositoryConfig;
import org.eclipse.rdf4j.repository.sail.config.SailRepositoryFactory;
import org.eclipse.rdf4j.sail.memory.config.MemoryStoreFactory;
import org.eclipse.rdf4j.testsuite.sparql.RepositorySPARQLComplianceTestSuite;
import org.junit.AfterClass;
import org.junit.BeforeClass;

/**
* @author jeen
*/
public class MemorySPARQLComplianceTest extends RepositorySPARQLComplianceTestSuite {

@BeforeClass
public static void setUpFactory() throws Exception {
setRepositoryFactory(new SailRepositoryFactory() {
@Override
public RepositoryImplConfig getConfig() {
return new SailRepositoryConfig(new MemoryStoreFactory().getConfig());
}
});
}

@AfterClass
public static void tearDownFactory() throws Exception {
setRepositoryFactory(null);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*******************************************************************************
* Copyright (c) 2022 Eclipse RDF4J contributors.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Distribution License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*******************************************************************************/
package org.eclipse.rdf4j.sail.nativerdf;

import org.eclipse.rdf4j.repository.config.RepositoryImplConfig;
import org.eclipse.rdf4j.repository.sail.config.SailRepositoryConfig;
import org.eclipse.rdf4j.repository.sail.config.SailRepositoryFactory;
import org.eclipse.rdf4j.sail.nativerdf.config.NativeStoreFactory;
import org.eclipse.rdf4j.testsuite.sparql.RepositorySPARQLComplianceTestSuite;
import org.junit.AfterClass;
import org.junit.BeforeClass;

/**
* @author jeen
*/
public class NativeSPARQLComplianceTest extends RepositorySPARQLComplianceTestSuite {

@BeforeClass
public static void setUpFactory() throws Exception {
setRepositoryFactory(new SailRepositoryFactory() {
@Override
public RepositoryImplConfig getConfig() {

return new SailRepositoryConfig(new NativeStoreFactory().getConfig());
}
});
}

@AfterClass
public static void tearDownFactory() throws Exception {
setRepositoryFactory(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.eclipse.rdf4j.rio.RDFParseException;
import org.eclipse.rdf4j.rio.Rio;
import org.eclipse.rdf4j.testsuite.query.parser.sparql.manifest.SPARQL11ManifestTest;
import org.eclipse.rdf4j.testsuite.sparql.RepositorySPARQLComplianceTestSuite;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
Expand All @@ -75,8 +76,10 @@
* {@link SPARQL11ManifestTest} format. This includes tests on queries with non-deterministic output (e.g.
* GROUP_CONCAT).
*
* @deprecated use {@link RepositorySPARQLComplianceTestSuite} instead.
* @author Jeen Broekstra
*/
@Deprecated(since = "4.0.2", forRemoval = true)
public abstract class ComplexSPARQLQueryTest {

@BeforeClass
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*******************************************************************************
* Copyright (c) 2022 Eclipse RDF4J contributors.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Distribution License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*******************************************************************************/
package org.eclipse.rdf4j.testsuite.sparql;

import java.io.IOException;
import java.io.InputStream;

import org.eclipse.rdf4j.model.Resource;
import org.eclipse.rdf4j.model.vocabulary.DCTERMS;
import org.eclipse.rdf4j.model.vocabulary.FOAF;
import org.eclipse.rdf4j.repository.Repository;
import org.eclipse.rdf4j.repository.RepositoryConnection;
import org.eclipse.rdf4j.repository.RepositoryException;
import org.eclipse.rdf4j.rio.RDFParseException;
import org.eclipse.rdf4j.rio.Rio;
import org.eclipse.rdf4j.testsuite.sparql.vocabulary.EX;
import org.junit.After;
import org.junit.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Abstract base class for tests included in the {@link RepositorySPARQLComplianceTestSuite}.
*
* @author Jeen Broekstra
*
*/
public abstract class AbstractComplianceTest {

protected final Logger logger = LoggerFactory.getLogger(this.getClass());

protected Repository repo;
protected RepositoryConnection conn;

@Before
public void setUp() throws Exception {
repo = RepositorySPARQLComplianceTestSuite.getEmptyInitializedRepository(this.getClass());
conn = repo.getConnection();
}

@After
public void tearDown() throws Exception {
try {
conn.close();
} finally {
repo.shutDown();
}
}

protected void loadTestData(String dataFile, Resource... contexts)
throws RDFParseException, RepositoryException, IOException {
logger.debug("loading dataset {}", dataFile);
try (InputStream dataset = this.getClass().getResourceAsStream(dataFile)) {
conn.add(dataset, "", Rio.getParserFormatForFileName(dataFile).orElseThrow(Rio.unsupportedFormat(dataFile)),
contexts);
}
logger.debug("dataset loaded.");
}

/**
* Get a set of useful namespace prefix declarations.
*
* @return namespace prefix declarations for dc, foaf and ex.
*/
protected String getNamespaceDeclarations() {
return "PREFIX dc: <" + DCTERMS.NAMESPACE + "> \n" +
"PREFIX foaf: <" + FOAF.NAMESPACE + "> \n" +
"PREFIX ex: <" + EX.NAMESPACE + "> \n" +
"\n";
}
}
Loading

0 comments on commit c141201

Please sign in to comment.