Skip to content

Commit

Permalink
WIP: Migrate JUnit4 test suites to JUnit5 nested tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erikgb committed Feb 25, 2023
1 parent 2fbb835 commit 6eaa402
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
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;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;

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

@BeforeClass
@BeforeAll
public static void setUpFactory() throws Exception {
setRepositoryFactory(new SailRepositoryFactory() {
@Override
Expand All @@ -34,7 +34,7 @@ public RepositoryImplConfig getConfig() {
});
}

@AfterClass
@AfterAll
public static void tearDownFactory() throws Exception {
setRepositoryFactory(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
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;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;

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

@BeforeClass
@BeforeAll
public static void setUpFactory() throws Exception {
setRepositoryFactory(new SailRepositoryFactory() {
@Override
Expand All @@ -33,7 +33,7 @@ public RepositoryImplConfig getConfig() {
});
}

@AfterClass
@AfterAll
public static void tearDownFactory() throws Exception {
setRepositoryFactory(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
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;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;

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

@BeforeClass
@BeforeAll
public static void setUpFactory() throws Exception {
setRepositoryFactory(new SailRepositoryFactory() {
@Override
Expand All @@ -34,7 +34,7 @@ public RepositoryImplConfig getConfig() {
});
}

@AfterClass
@AfterAll
public static void tearDownFactory() throws Exception {
setRepositoryFactory(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
import org.eclipse.rdf4j.repository.sail.config.SailRepositoryFactory;
import org.eclipse.rdf4j.sail.memory.config.MemoryStoreFactory;
import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;

public class MemoryOptimisticIsolationTest extends OptimisticIsolationTest {

@BeforeClass
@BeforeAll
public static void setUpClass() throws Exception {
System.setProperty("org.eclipse.rdf4j.repository.debug", "true");
setRepositoryFactory(new SailRepositoryFactory() {
Expand All @@ -31,7 +31,7 @@ public RepositoryImplConfig getConfig() {
});
}

@AfterClass
@AfterAll
public static void tearDown() throws Exception {
setRepositoryFactory(null);
System.setProperty("org.eclipse.rdf4j.repository.debug", "false");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,13 @@
import org.eclipse.rdf4j.repository.Repository;
import org.eclipse.rdf4j.repository.RepositoryConnection;
import org.eclipse.rdf4j.repository.config.RepositoryFactory;
import org.eclipse.rdf4j.testsuite.repository.optimistic.DeadLockTest;
import org.eclipse.rdf4j.testsuite.repository.optimistic.DeleteInsertTest;
import org.eclipse.rdf4j.testsuite.repository.optimistic.IsolationLevelTest;
import org.eclipse.rdf4j.testsuite.repository.optimistic.LinearTest;
import org.eclipse.rdf4j.testsuite.repository.optimistic.ModificationTest;
import org.eclipse.rdf4j.testsuite.repository.optimistic.MonotonicTest;
import org.eclipse.rdf4j.testsuite.repository.optimistic.RemoveIsolationTest;
import org.eclipse.rdf4j.testsuite.repository.optimistic.SerializableTest;
import org.eclipse.rdf4j.testsuite.repository.optimistic.SnapshotTest;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import org.junit.jupiter.api.Nested;

/**
* @author James Leigh
*/
@RunWith(Suite.class)
@SuiteClasses({ DeadLockTest.class, DeleteInsertTest.class, LinearTest.class, ModificationTest.class,
RemoveIsolationTest.class, IsolationLevelTest.class, MonotonicTest.class, SnapshotTest.class,
SerializableTest.class })
public abstract class OptimisticIsolationTest {

@BeforeAll
Expand Down Expand Up @@ -79,4 +64,40 @@ public static Repository getEmptyInitializedRepository(Class<?> caller) throws R
}
return repository;
}

@Nested
class DeadLockTest extends org.eclipse.rdf4j.testsuite.repository.optimistic.DeadLockTest {
}

@Nested
class DeleteInsertTest extends org.eclipse.rdf4j.testsuite.repository.optimistic.DeleteInsertTest {
}

@Nested
class LinearTest extends org.eclipse.rdf4j.testsuite.repository.optimistic.LinearTest {
}

@Nested
class ModificationTest extends org.eclipse.rdf4j.testsuite.repository.optimistic.ModificationTest {
}

@Nested
class RemoveIsolationTest extends org.eclipse.rdf4j.testsuite.repository.optimistic.RemoveIsolationTest {
}

@Nested
class IsolationLevelTest extends org.eclipse.rdf4j.testsuite.repository.optimistic.IsolationLevelTest {
}

@Nested
class MonotonicTest extends org.eclipse.rdf4j.testsuite.repository.optimistic.MonotonicTest {
}

@Nested
class SnapshotTest extends org.eclipse.rdf4j.testsuite.repository.optimistic.SnapshotTest {
}

@Nested
class SerializableTest extends org.eclipse.rdf4j.testsuite.repository.optimistic.SerializableTest {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,9 @@
import org.eclipse.rdf4j.repository.Repository;
import org.eclipse.rdf4j.repository.RepositoryConnection;
import org.eclipse.rdf4j.repository.config.RepositoryFactory;
import org.eclipse.rdf4j.testsuite.sparql.tests.AggregateTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.ArbitraryLengthPathTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.BasicTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.BindTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.BuiltinFunctionTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.ConstructTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.DefaultGraphTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.DescribeTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.ExistsTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.GroupByTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.InTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.MinusTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.OptionalTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.OrderByTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.PropertyPathTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.SubselectTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.UnionTest;
import org.eclipse.rdf4j.testsuite.sparql.tests.ValuesTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Nested;

/**
* A suite of custom compliance tests on SPARQL query functionality for RDF4J Repositories.
Expand All @@ -52,7 +32,7 @@
*
* <pre>
* <code>
* &#64;BeforeClass
* &#64;BeforeAll
public static void setUpFactory() throws Exception {
setRepositoryFactory(new SailRepositoryFactory() {
&#64;Override
Expand All @@ -62,7 +42,7 @@ public RepositoryImplConfig getConfig() {
});
}
&#64;AfterClass
&#64;AfterAll
public static void tearDownFactory() throws Exception {
setRepositoryFactory(null);
}
Expand All @@ -74,19 +54,14 @@ public static void tearDownFactory() throws Exception {
* make further improvements to its setup (including migrating to JUnit 5 when its suite support matures) in
* future minor releases.
*/
@RunWith(Suite.class)
@SuiteClasses({ AggregateTest.class, ArbitraryLengthPathTest.class, BasicTest.class, BindTest.class,
BuiltinFunctionTest.class, ConstructTest.class, DefaultGraphTest.class, DescribeTest.class, GroupByTest.class,
InTest.class, OptionalTest.class, PropertyPathTest.class, SubselectTest.class, UnionTest.class,
ValuesTest.class, OrderByTest.class, ExistsTest.class, MinusTest.class })
@Experimental
public abstract class RepositorySPARQLComplianceTestSuite {
@BeforeClass
@BeforeAll
public static void setUpClass() {
System.setProperty("org.eclipse.rdf4j.repository.debug", "true");
}

@AfterClass
@AfterAll
public static void tearDownClass() {
System.setProperty("org.eclipse.rdf4j.repository.debug", "false");
}
Expand Down Expand Up @@ -117,4 +92,76 @@ public static Repository getEmptyInitializedRepository(Class<?> caller) throws R
}
return repository;
}

@Nested
class AggregateTest extends org.eclipse.rdf4j.testsuite.sparql.tests.AggregateTest {
}

@Nested
class ArbitraryLengthPathTest extends org.eclipse.rdf4j.testsuite.sparql.tests.ArbitraryLengthPathTest {
}

@Nested
class BasicTest extends org.eclipse.rdf4j.testsuite.sparql.tests.BasicTest {
}

@Nested
class BindTest extends org.eclipse.rdf4j.testsuite.sparql.tests.BindTest {
}

@Nested
class BuiltinFunctionTest extends org.eclipse.rdf4j.testsuite.sparql.tests.BuiltinFunctionTest {
}

@Nested
class ConstructTest extends org.eclipse.rdf4j.testsuite.sparql.tests.ConstructTest {
}

@Nested
class DefaultGraphTest extends org.eclipse.rdf4j.testsuite.sparql.tests.DefaultGraphTest {
}

@Nested
class DescribeTest extends org.eclipse.rdf4j.testsuite.sparql.tests.DescribeTest {
}

@Nested
class GroupByTest extends org.eclipse.rdf4j.testsuite.sparql.tests.GroupByTest {
}

@Nested
class InTest extends org.eclipse.rdf4j.testsuite.sparql.tests.InTest {
}

@Nested
class OptionalTest extends org.eclipse.rdf4j.testsuite.sparql.tests.OptionalTest {
}

@Nested
class PropertyPathTest extends org.eclipse.rdf4j.testsuite.sparql.tests.PropertyPathTest {
}

@Nested
class SubselectTest extends org.eclipse.rdf4j.testsuite.sparql.tests.SubselectTest {
}

@Nested
class UnionTest extends org.eclipse.rdf4j.testsuite.sparql.tests.UnionTest {
}

@Nested
class ValuesTest extends org.eclipse.rdf4j.testsuite.sparql.tests.ValuesTest {
}

@Nested
class OrderByTest extends org.eclipse.rdf4j.testsuite.sparql.tests.OrderByTest {
}

@Nested
class ExistsTest extends org.eclipse.rdf4j.testsuite.sparql.tests.ExistsTest {
}

@Nested
class MinusTest extends org.eclipse.rdf4j.testsuite.sparql.tests.MinusTest {
}
}

0 comments on commit 6eaa402

Please sign in to comment.