You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2015/11/18 21:53:17 UTC

[4/5] jena git commit: Rename test classes and put tests into top level classes.

Rename test classes and put tests into top level classes.

JENA-624
AbstractTest* for the abstract test classes.
TS_ for the test suites.
Collect each TS_* into test suite collection TC_General


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/da8950e2
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/da8950e2
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/da8950e2

Branch: refs/heads/master
Commit: da8950e293de6b668a9ae9799e382b7d0a200154
Parents: b1a4674
Author: Andy Seaborne <an...@apache.org>
Authored: Wed Nov 18 10:23:19 2015 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Wed Nov 18 20:51:24 2015 +0000

----------------------------------------------------------------------
 .../java/org/apache/jena/sparql/TC_General.java |   6 +
 .../org/apache/jena/sparql/core/TS_Core.java    |   9 +-
 .../sparql/core/assembler/TS_Assembler.java     |  27 ++
 .../sparql/core/assembler/TestAssembler.java    |  27 --
 .../sparql/core/journaling/TS_Journaling.java   |  27 ++
 .../sparql/core/journaling/TestJournaling.java  |  27 --
 .../sparql/core/mem/AbstractTestQuadTable.java  |  50 ++++
 .../core/mem/AbstractTestTripleTable.java       |  56 ++++
 .../sparql/core/mem/AbstractTestTupleTable.java | 112 ++++++++
 .../core/mem/AbstractTestTupleTableForms.java   |  73 +++++
 .../jena/sparql/core/mem/QuadTableTest.java     |  50 ----
 .../jena/sparql/core/mem/TS_DatasetTxnMem.java  |  34 +++
 .../core/mem/TestDatasetGraphInMemory.java      | 283 -------------------
 .../core/mem/TestDatasetGraphInMemoryBasic.java | 111 ++++++++
 .../core/mem/TestDatasetGraphInMemoryLock.java  |  30 ++
 .../mem/TestDatasetGraphInMemoryThreading.java  | 161 +++++++++++
 .../TestDatasetGraphInMemoryTransactions.java   |  31 ++
 .../core/mem/TestDatasetGraphInMemoryViews.java |  31 ++
 .../jena/sparql/core/mem/TestHexTable.java      |   2 +-
 .../jena/sparql/core/mem/TestInMemory.java      |  32 ---
 .../sparql/core/mem/TestQuadTableForms.java     |   8 +-
 .../jena/sparql/core/mem/TestTriTable.java      |   2 +-
 .../sparql/core/mem/TestTripleTableForms.java   |   8 +-
 .../jena/sparql/core/mem/TripleTableTest.java   |  56 ----
 .../sparql/core/mem/TupleTableFormsTest.java    |  73 -----
 .../jena/sparql/core/mem/TupleTableTest.java    | 112 --------
 26 files changed, 762 insertions(+), 676 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/TC_General.java
----------------------------------------------------------------------
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_General.java
index 429387e..8aca4d5 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_General.java
@@ -24,6 +24,9 @@ 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 ;
 import org.apache.jena.sparql.core.TS_Core ;
+import org.apache.jena.sparql.core.assembler.TS_Assembler ;
+import org.apache.jena.sparql.core.journaling.TS_Journaling ;
+import org.apache.jena.sparql.core.mem.TS_DatasetTxnMem ;
 import org.apache.jena.sparql.engine.TS_Engine ;
 import org.apache.jena.sparql.engine.join.TS_Join ;
 import org.apache.jena.sparql.expr.E_Function ;
@@ -68,6 +71,9 @@ import org.junit.runners.Suite ;
     , TS_Syntax.class
     , TS_API.class
     , TS_Core.class
+    , TS_Assembler.class
+    , TS_Journaling.class
+    , TS_DatasetTxnMem.class
     , TS_Path.class
     , TS_ParamString.class
     , TS_Update.class

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/TS_Core.java
----------------------------------------------------------------------
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 9e0499d..c0e2b1d 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
@@ -18,9 +18,9 @@
 
 package org.apache.jena.sparql.core;
 
-import org.apache.jena.sparql.core.assembler.TestAssembler;
-import org.apache.jena.sparql.core.journaling.TestJournaling;
-import org.apache.jena.sparql.core.mem.TestInMemory;
+import org.apache.jena.sparql.core.assembler.TS_Assembler;
+import org.apache.jena.sparql.core.journaling.TS_Journaling;
+import org.apache.jena.sparql.core.mem.TS_DatasetTxnMem;
 import org.junit.runner.RunWith ;
 import org.junit.runners.Suite ;
 
@@ -36,9 +36,6 @@ import org.junit.runners.Suite ;
     , TestDatasetGraphViewGraphs.class
     , TestDatasetMonitor.class
     , TestDatasetGraphWithLock.class
-    , TestJournaling.class
-    , TestInMemory.class
-    , TestAssembler.class
 })
 
 public class TS_Core

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/assembler/TS_Assembler.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/assembler/TS_Assembler.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/assembler/TS_Assembler.java
new file mode 100644
index 0000000..3dbe1bd
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/assembler/TS_Assembler.java
@@ -0,0 +1,27 @@
+/*
+ * 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.core.assembler;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({ TestInMemDatasetAssembler.class })
+public class TS_Assembler {}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/assembler/TestAssembler.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/assembler/TestAssembler.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/assembler/TestAssembler.java
deleted file mode 100644
index 2adb5e7..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/assembler/TestAssembler.java
+++ /dev/null
@@ -1,27 +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.core.assembler;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses({ TestInMemDatasetAssembler.class })
-public class TestAssembler {}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/journaling/TS_Journaling.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/journaling/TS_Journaling.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/journaling/TS_Journaling.java
new file mode 100644
index 0000000..9741a39
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/journaling/TS_Journaling.java
@@ -0,0 +1,27 @@
+/**
+ * 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.core.journaling;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({ TestQuadOperation.class, TestListBackedOperationRecord.class, TestDatasetGraphWithRecord.class })
+public class TS_Journaling {}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/journaling/TestJournaling.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/journaling/TestJournaling.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/journaling/TestJournaling.java
deleted file mode 100644
index eabc679..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/journaling/TestJournaling.java
+++ /dev/null
@@ -1,27 +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.core.journaling;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses({ TestQuadOperation.class, TestListBackedOperationRecord.class, TestDatasetGraphWithRecord.class })
-public class TestJournaling {}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestQuadTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestQuadTable.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestQuadTable.java
new file mode 100644
index 0000000..cfbc4b2
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestQuadTable.java
@@ -0,0 +1,50 @@
+/*
+ * 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.core.mem;
+
+import static java.util.EnumSet.allOf;
+import static org.apache.jena.ext.com.google.common.collect.Sets.powerSet;
+import static org.apache.jena.graph.NodeFactory.createURI;
+
+import java.util.Set;
+import java.util.stream.Stream;
+
+import org.apache.jena.graph.Node;
+import org.apache.jena.sparql.core.Quad;
+
+public abstract class AbstractTestQuadTable extends AbstractTestTupleTable<Quad, QuadTable> {
+
+	protected static final Node sampleNode = createURI("info:test");
+	private static final Quad q = Quad.create(sampleNode, sampleNode, sampleNode, sampleNode);
+
+	@Override
+	protected Quad testTuple() {
+		return q;
+	}
+
+	@Override
+	public Stream<Set<TupleSlot>> queryPatterns() {
+		return quadQueryPatterns();
+	}
+
+	static Stream<Set<TupleSlot>> quadQueryPatterns() {
+		return powerSet(allOf(TupleSlot.class)).stream();
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestTripleTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestTripleTable.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestTripleTable.java
new file mode 100644
index 0000000..f153c33
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestTripleTable.java
@@ -0,0 +1,56 @@
+/*
+ * 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.core.mem;
+
+import static org.apache.jena.graph.Node.ANY;
+import static org.apache.jena.graph.NodeFactory.createURI;
+import static org.apache.jena.sparql.core.mem.AbstractTestQuadTable.quadQueryPatterns;
+import static org.apache.jena.sparql.core.mem.TupleSlot.GRAPH;
+
+import java.util.Set;
+import java.util.stream.Stream;
+
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.Triple;
+
+public abstract class AbstractTestTripleTable extends AbstractTestTupleTable<Triple, TripleTable> {
+
+	private static final Node sampleNode = createURI("info:test");
+
+	private static final Triple testTriple = Triple.create(sampleNode, sampleNode, sampleNode);
+
+	@Override
+	protected Triple testTuple() {
+		return testTriple;
+	}
+
+	@Override
+	protected Stream<Triple> tuples() {
+		return table().find(ANY, ANY, ANY);
+	}
+
+	@Override
+	public Stream<Set<TupleSlot>> queryPatterns() {
+		return tripleQueryPatterns();
+	}
+
+	static Stream<Set<TupleSlot>> tripleQueryPatterns() {
+		return quadQueryPatterns().filter(s -> !s.contains(GRAPH));
+	}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestTupleTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestTupleTable.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestTupleTable.java
new file mode 100644
index 0000000..74a5c7f
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestTupleTable.java
@@ -0,0 +1,112 @@
+/*
+ * 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.core.mem;
+
+import static java.util.stream.Collectors.toSet;
+import static org.apache.jena.ext.com.google.common.collect.ImmutableSet.of;
+import static org.apache.jena.query.ReadWrite.READ;
+import static org.apache.jena.query.ReadWrite.WRITE;
+
+import java.util.Set;
+import java.util.stream.Stream;
+
+import org.apache.jena.ext.com.google.common.collect.ImmutableSet;
+import org.junit.Assert;
+import org.junit.Test;
+
+public abstract class AbstractTestTupleTable<TupleType, TupleTableType extends TupleTable<TupleType>> extends Assert {
+
+	protected abstract TupleType testTuple();
+
+	protected abstract TupleTableType table();
+
+	protected abstract Stream<TupleType> tuples();
+
+	protected abstract Stream<Set<TupleSlot>> queryPatterns();
+
+	protected static final Set<TupleSlot> allWildcardQuery = of();
+
+	@Test
+	public void addAndRemoveSomeTuples() {
+
+		// simple add-and-delete
+		table().begin(WRITE);
+		assertTrue(table().isInTransaction());
+		table().add(testTuple());
+		Set<TupleType> contents = tuples().collect(toSet());
+		assertEquals(ImmutableSet.of(testTuple()), contents);
+		table().delete(testTuple());
+		contents = tuples().collect(toSet());
+		assertTrue(contents.isEmpty());
+		table().end();
+		assertFalse(table().isInTransaction());
+
+		// add, abort, then check to see that nothing was persisted
+		table().begin(WRITE);
+		assertTrue(table().isInTransaction());
+		table().add(testTuple());
+		contents = tuples().collect(toSet());
+		assertEquals(ImmutableSet.of(testTuple()), contents);
+		table().abort();
+		assertFalse(table().isInTransaction());
+		table().begin(READ);
+		assertTrue(table().isInTransaction());
+		try {
+			contents = tuples().collect(toSet());
+			assertTrue(contents.isEmpty());
+		} finally {
+			table().end();
+			assertFalse(table().isInTransaction());
+		}
+
+		// add, commit, and check to see that persistence occurred
+		table().begin(WRITE);
+		assertTrue(table().isInTransaction());
+		table().add(testTuple());
+		contents = tuples().collect(toSet());
+		assertEquals(ImmutableSet.of(testTuple()), contents);
+		table().commit();
+		assertFalse(table().isInTransaction());
+		table().begin(READ);
+		assertTrue(table().isInTransaction());
+		try {
+			contents = tuples().collect(toSet());
+			assertEquals(ImmutableSet.of(testTuple()), contents);
+		} finally {
+			table().end();
+			assertFalse(table().isInTransaction());
+		}
+		// remove the test tuple and check to see that it is gone
+		table().begin(WRITE);
+		assertTrue(table().isInTransaction());
+		table().clear();
+		contents = tuples().collect(toSet());
+		assertTrue(contents.isEmpty());
+		table().commit();
+		table().begin(READ);
+		assertTrue(table().isInTransaction());
+		try {
+			contents = tuples().collect(toSet());
+			assertTrue(contents.isEmpty());
+		} finally {
+			table().end();
+			assertFalse(table().isInTransaction());
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestTupleTableForms.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestTupleTableForms.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestTupleTableForms.java
new file mode 100644
index 0000000..7139dfb
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/AbstractTestTupleTableForms.java
@@ -0,0 +1,73 @@
+/*
+ * 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.core.mem;
+
+import static java.util.stream.Collectors.toSet;
+import static org.apache.jena.sparql.core.mem.AbstractTestTupleTable.allWildcardQuery;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public abstract class AbstractTestTupleTableForms<TableForm extends Predicate<Set<TupleSlot>>> extends Assert {
+
+	protected abstract Stream<TableForm> tableForms();
+
+	protected abstract Stream<Set<TupleSlot>> queryPatterns();
+
+	@Test
+	public void anAllWildcardQueryCannotAvoidTraversal() {
+		assertTrue(tableForms().noneMatch(form -> form.test(allWildcardQuery)));
+	}
+
+	@Test
+	public void anyIndexCanAnswerAnEntirelyConcretePattern() {
+		tableForms().allMatch(form -> form.test(allWildcardQuery));
+	}
+
+	protected boolean canAvoidTraversal(final Set<TupleSlot> pattern) {
+		return tableForms().anyMatch(form -> form.test(pattern));
+	}
+
+	@Test
+	public void allQueriesWithAtLeastOneConcreteNodeCanAvoidTraversal() {
+		assertTrue(queryPatterns().filter(p -> !allWildcardQuery.equals(p)).allMatch(this::canAvoidTraversal));
+	}
+
+	protected void avoidsTraversal(final Predicate<Set<TupleSlot>> indexForm,
+			final Set<Set<TupleSlot>> correctAnswers) {
+		final Set<Set<TupleSlot>> answers = queryPatterns().filter(indexForm::test).collect(toSet());
+		assertEquals(correctAnswers, answers);
+	}
+
+	@Test
+	public void aCorrectIndexIsChosenForEachPattern() {
+		answerKey().forEach((sample, correctAnswers) -> {
+			assertTrue(correctAnswers.contains(chooseFrom(sample)));
+		});
+	}
+
+	protected abstract TableForm chooseFrom(Set<TupleSlot> sample);
+
+	protected abstract Map<Set<TupleSlot>, Set<TableForm>> answerKey();
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/QuadTableTest.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/QuadTableTest.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/QuadTableTest.java
deleted file mode 100644
index ca4ecc5..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/QuadTableTest.java
+++ /dev/null
@@ -1,50 +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.core.mem;
-
-import static java.util.EnumSet.allOf;
-import static org.apache.jena.ext.com.google.common.collect.Sets.powerSet;
-import static org.apache.jena.graph.NodeFactory.createURI;
-
-import java.util.Set;
-import java.util.stream.Stream;
-
-import org.apache.jena.graph.Node;
-import org.apache.jena.sparql.core.Quad;
-
-public abstract class QuadTableTest extends TupleTableTest<Quad, QuadTable> {
-
-	protected static final Node sampleNode = createURI("info:test");
-	private static final Quad q = Quad.create(sampleNode, sampleNode, sampleNode, sampleNode);
-
-	@Override
-	protected Quad testTuple() {
-		return q;
-	}
-
-	@Override
-	public Stream<Set<TupleSlot>> queryPatterns() {
-		return quadQueryPatterns();
-	}
-
-	static Stream<Set<TupleSlot>> quadQueryPatterns() {
-		return powerSet(allOf(TupleSlot.class)).stream();
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TS_DatasetTxnMem.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..9e3bafd
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TS_DatasetTxnMem.java
@@ -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.sparql.core.mem;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * Tests for in-memory Dataset and its default implementation.
+ *
+ */
+@RunWith(Suite.class)
+@SuiteClasses({ TestQuadTableForms.class, TestTripleTableForms.class,
+		TestHexTable.class, TestTriTable.class, TestDatasetGraphInMemoryBasic.class, TestDatasetGraphInMemoryViews.class,
+        TestDatasetGraphInMemoryLock.class, TestDatasetGraphInMemoryThreading.class,
+        TestDatasetGraphInMemoryTransactions.class })
+public class TS_DatasetTxnMem {}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemory.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemory.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemory.java
deleted file mode 100644
index 4a28dfb..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemory.java
+++ /dev/null
@@ -1,283 +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.core.mem;
-
-import static com.jayway.awaitility.Awaitility.await;
-import static java.lang.System.err;
-import static org.apache.jena.atlas.iterator.Iter.iter;
-import static org.apache.jena.atlas.iterator.Iter.some;
-import static org.apache.jena.graph.Node.ANY;
-import static org.apache.jena.graph.NodeFactory.createBlankNode;
-import static org.apache.jena.graph.NodeFactory.createURI;
-import static org.apache.jena.query.ReadWrite.READ;
-import static org.apache.jena.query.ReadWrite.WRITE;
-import static org.apache.jena.sparql.core.Quad.unionGraph;
-import static org.apache.jena.sparql.graph.GraphFactory.createGraphMem;
-import static org.apache.jena.sparql.sse.SSE.*;
-import static org.junit.Assert.*;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Iterator;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.jena.atlas.iterator.Iter;
-import org.apache.jena.graph.Node;
-import org.apache.jena.graph.Triple;
-import org.apache.jena.query.Dataset;
-import org.apache.jena.query.DatasetFactory;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.sparql.core.AbstractDatasetGraphTests;
-import org.apache.jena.sparql.core.DatasetGraph;
-import org.apache.jena.sparql.core.DatasetGraphFactory;
-import org.apache.jena.sparql.core.Quad;
-import org.apache.jena.sparql.core.TestDatasetGraphViewGraphs;
-import org.apache.jena.sparql.core.TestDatasetGraphWithLock;
-import org.apache.jena.sparql.core.mem.TestDatasetGraphInMemory.TestDatasetGraphInMemoryBasic;
-import org.apache.jena.sparql.core.mem.TestDatasetGraphInMemory.TestDatasetGraphInMemoryLock;
-import org.apache.jena.sparql.core.mem.TestDatasetGraphInMemory.TestDatasetGraphInMemoryThreading;
-import org.apache.jena.sparql.core.mem.TestDatasetGraphInMemory.TestDatasetGraphInMemoryTransactions;
-import org.apache.jena.sparql.core.mem.TestDatasetGraphInMemory.TestDatasetGraphInMemoryViews;
-import org.apache.jena.sparql.transaction.AbstractTestTransaction;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-import org.slf4j.Logger;
-
-@RunWith(Suite.class)
-@SuiteClasses({ TestDatasetGraphInMemoryBasic.class, TestDatasetGraphInMemoryViews.class,
-		TestDatasetGraphInMemoryLock.class, TestDatasetGraphInMemoryThreading.class,
-		TestDatasetGraphInMemoryTransactions.class })
-public class TestDatasetGraphInMemory {
-
-	public static class TestDatasetGraphInMemoryThreading extends Assert {
-
-		Logger log = getLogger(TestDatasetGraphInMemoryThreading.class);
-
-		Quad q = Quad.create(createBlankNode(), createBlankNode(), createBlankNode(), createBlankNode());
-
-		@Test
-		public void abortedChangesNeverBecomeVisible() {
-			final DatasetGraphInMemory dsg = new DatasetGraphInMemory();
-			// flags with which to interleave threads
-			final AtomicBoolean addedButNotAborted = new AtomicBoolean(false);
-			final AtomicBoolean addedCheckedButNotAborted = new AtomicBoolean(false);
-			final AtomicBoolean aborted = new AtomicBoolean(false);
-
-			dsg.begin(READ);
-			assertTrue(dsg.isEmpty()); // no quads present
-			dsg.end();
-
-			// we introduce a Writer thread
-			new Thread() {
-
-				@Override
-				public void run() {
-					dsg.begin(WRITE);
-					log.debug("Writer: Added test quad.");
-					dsg.add(q);
-					assertFalse(dsg.isEmpty()); // quad has appeared in this transaction
-					addedButNotAborted.set(true);
-					log.debug("Writer: Waiting to abort addition of test quad.");
-					await().untilTrue(addedCheckedButNotAborted);
-					assertFalse(dsg.isEmpty()); // quad has appeared, but only inside this transaction
-					log.debug("Writer: Aborting test quad.");
-					dsg.abort();
-					log.debug("Writer: Aborted test quad.");
-					aborted.set(true);
-				}
-			}.start();
-			// back to Reader code
-			log.debug("Reader: Waiting for test quad to be added in Writer thread.");
-			await().untilTrue(addedButNotAborted);
-			dsg.begin(READ);
-			assertTrue(dsg.isEmpty()); // no quads present to Reader
-			dsg.end();
-			log.debug("Reader: Checked to see test quad is not visible.");
-			addedCheckedButNotAborted.set(true);
-			log.debug("Reader: Waiting to see Writer transaction aborted.");
-			await().untilTrue(aborted);
-			dsg.begin(READ);
-			assertTrue(dsg.isEmpty()); // no quads have appeared
-			dsg.end();
-		}
-
-		@Test
-		public void snapshotsShouldBeIsolated() {
-			final DatasetGraphInMemory dsg = new DatasetGraphInMemory();
-			// flags with which to interleave threads
-			final AtomicBoolean addedButNotCommitted = new AtomicBoolean(false);
-			final AtomicBoolean addedCheckedButNotCommitted = new AtomicBoolean(false);
-			final AtomicBoolean committed = new AtomicBoolean(false);
-
-			dsg.begin(READ);
-			assertTrue(dsg.isEmpty()); // no quads present
-			dsg.end();
-
-			// we introduce a Writer thread
-			new Thread() {
-
-				@Override
-				public void run() {
-					dsg.begin(WRITE);
-					log.debug("Writer: Added test quad.");
-					dsg.add(q);
-					assertFalse(dsg.isEmpty()); // quad has appeared, but only in this transaction
-					addedButNotCommitted.set(true);
-					log.debug("Writer: Waiting to commit test quad.");
-					await().untilTrue(addedCheckedButNotCommitted);
-					log.debug("Writer: Committing test quad.");
-					dsg.commit();
-					log.debug("Writer: Committed test quad.");
-					committed.set(true);
-				}
-			}.start();
-			// back to Reader code
-			log.debug("Reader: Waiting for test quad to be added in Writer thread.");
-			await().untilTrue(addedButNotCommitted);
-
-			dsg.begin(READ);
-			assertTrue(dsg.isEmpty()); // still no quads present, because Reader and Writer are isolated
-			log.debug("Reader: Checked to see test quad is not yet visible.");
-			addedCheckedButNotCommitted.set(true);
-			log.debug("Reader: Waiting to see test quad committed.");
-			await().untilTrue(committed);
-			assertTrue(dsg.isEmpty()); // still no quads present, because Reader and Writer are isolated
-			dsg.end();
-			// but a new transaction should see the results of Writer's action
-			dsg.begin(READ);
-			assertFalse(dsg.isEmpty()); // quad has appeared, for new transaction
-			dsg.end();
-		}
-
-		@Test
-		public void locksAreCorrectlyDistributed() {
-			final DatasetGraphInMemory dsg = new DatasetGraphInMemory();
-			final AtomicBoolean readLockCaptured = new AtomicBoolean(false);
-			final AtomicBoolean writeLockCaptured = new AtomicBoolean(false);
-
-			dsg.begin(WRITE); // acquire the write lock: no other Thread can now acquire it until it is released
-
-			new Thread() {
-
-				@Override
-				public void run() {
-					dsg.begin(READ); // a read lock should always be available except during a commit
-					readLockCaptured.set(true);
-					dsg.end();
-
-					dsg.begin(WRITE); // this should block until the write lock is released
-					writeLockCaptured.set(true);
-				}
-			}.start();
-			await().untilTrue(readLockCaptured);
-			if (writeLockCaptured.get()) fail("Write lock captured by two threads at once!");
-
-			dsg.end(); // release the write lock to competitor
-			await().untilTrue(writeLockCaptured);
-			assertTrue("Lock was not handed over to waiting thread!", writeLockCaptured.get());
-		}
-	}
-
-	public static class TestDatasetGraphInMemoryBasic extends AbstractDatasetGraphTests {
-
-		@Test
-		public void orderingOfNodesFromFindIsCorrect() {
-			final DatasetGraph dsg = DatasetGraphFactory.createTxnMem() ;
-
-	        final Node p = parseNode(":p") ;
-	        final Triple triple = parseTriple("(:s :p :o)");
-			dsg.getDefaultGraph().add(triple);
-	        final Iterator<Triple> iter = dsg.getDefaultGraph().find(null, p, null) ;
-	        assertTrue(some(iter, triple::equals));
-
-
-	        final Node p1 = parseNode(":p1") ;
-	        final Quad quad = parseQuad("(:g1 :s1 :p1 :o1)");
-			dsg.add(quad) ;
-
-	        final Iterator<Quad> iter2 = dsg.find(null, null, p1, null) ;
-
-	        assertTrue(some(iter2, quad::equals));
-	        Iter.print(err,iter2);
-		}
-
-		@Test
-		public void prefixesAreManaged() {
-			final Node graphName = createURI("http://example/g");
-			final DatasetGraph dsg = emptyDataset();
-			dsg.addGraph(graphName, createGraphMem());
-			final Dataset dataset = DatasetFactory.create(dsg);
-			Model model = dataset.getNamedModel(graphName.getURI());
-			final String testPrefix = "example";
-			final String testURI = "http://example/";
-			model.setNsPrefix(testPrefix, testURI);
-			assertEquals(testURI, model.getNsPrefixURI(testPrefix));
-			model.close();
-			model = dataset.getNamedModel(graphName.getURI());
-			final String nsURI = dataset.getNamedModel(graphName.getURI()).getNsPrefixURI(testPrefix);
-			assertNotNull(nsURI);
-			assertEquals(testURI, nsURI);
-		}
-
-		@Test
-		public void unionGraphWorksProperly() {
-		    DatasetGraph dsg = emptyDataset();
-			// quads from named graphs should appear in union
-			Quad q = Quad.create(createBlankNode(), createBlankNode(), createBlankNode(), createBlankNode());
-			dsg.add(q);
-			// Expected in the union graph
-			Quad q2 = Quad.create(unionGraph, q.asTriple());
-			assertTrue(iter(dsg.find(unionGraph, ANY, ANY, ANY)).some(q2::equals));
-			// no triples from default graph should appear in union
-			Triple t = Triple.create(createBlankNode(), createBlankNode(), createBlankNode());
-			dsg.getDefaultGraph().add(t);
-			assertFalse(iter(dsg.find(unionGraph, ANY, ANY, ANY)).some(Quad::isDefaultGraph)) ;
-		}
-
-		@Override
-		protected DatasetGraph emptyDataset() {
-			return DatasetGraphFactory.createTxnMem();
-		}
-	}
-
-	public static class TestDatasetGraphInMemoryLock extends TestDatasetGraphWithLock {
-		@Override
-		protected Dataset createFixed() {
-			return DatasetFactory.createTxnMem();
-		}
-	}
-
-	public static class TestDatasetGraphInMemoryViews extends TestDatasetGraphViewGraphs {
-
-		@Override
-		protected DatasetGraph createBaseDSG() {
-			return DatasetGraphFactory.createTxnMem();
-		}
-	}
-
-	public static class TestDatasetGraphInMemoryTransactions extends AbstractTestTransaction {
-
-		@Override
-		protected Dataset create() {
-			return DatasetFactory.createTxnMem();
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryBasic.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryBasic.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryBasic.java
new file mode 100644
index 0000000..816ef8f
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryBasic.java
@@ -0,0 +1,111 @@
+/**
+ * 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.core.mem;
+
+import static java.lang.System.err ;
+import static org.apache.jena.atlas.iterator.Iter.iter ;
+import static org.apache.jena.atlas.iterator.Iter.some ;
+import static org.apache.jena.graph.Node.ANY ;
+import static org.apache.jena.graph.NodeFactory.createBlankNode ;
+import static org.apache.jena.graph.NodeFactory.createURI ;
+import static org.apache.jena.sparql.core.Quad.unionGraph ;
+import static org.apache.jena.sparql.graph.GraphFactory.createGraphMem ;
+import static org.apache.jena.sparql.sse.SSE.parseNode ;
+import static org.apache.jena.sparql.sse.SSE.parseQuad ;
+import static org.apache.jena.sparql.sse.SSE.parseTriple ;
+import static org.junit.Assert.assertEquals ;
+import static org.junit.Assert.assertFalse ;
+import static org.junit.Assert.assertNotNull ;
+import static org.junit.Assert.assertTrue ;
+
+import java.util.Iterator ;
+
+import org.apache.jena.atlas.iterator.Iter ;
+import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.Triple ;
+import org.apache.jena.query.Dataset ;
+import org.apache.jena.query.DatasetFactory ;
+import org.apache.jena.rdf.model.Model ;
+import org.apache.jena.sparql.core.AbstractDatasetGraphTests ;
+import org.apache.jena.sparql.core.DatasetGraph ;
+import org.apache.jena.sparql.core.DatasetGraphFactory ;
+import org.apache.jena.sparql.core.Quad ;
+import org.junit.Test ;
+
+public class TestDatasetGraphInMemoryBasic extends AbstractDatasetGraphTests {
+
+	@Test
+	public void orderingOfNodesFromFindIsCorrect() {
+		final DatasetGraph dsg = DatasetGraphFactory.createTxnMem() ;
+
+        final Node p = parseNode(":p") ;
+        final Triple triple = parseTriple("(:s :p :o)");
+		dsg.getDefaultGraph().add(triple);
+        final Iterator<Triple> iter = dsg.getDefaultGraph().find(null, p, null) ;
+        assertTrue(some(iter, triple::equals));
+
+
+        final Node p1 = parseNode(":p1") ;
+        final Quad quad = parseQuad("(:g1 :s1 :p1 :o1)");
+		dsg.add(quad) ;
+
+        final Iterator<Quad> iter2 = dsg.find(null, null, p1, null) ;
+
+        assertTrue(some(iter2, quad::equals));
+        Iter.print(err,iter2);
+	}
+
+	@Test
+	public void prefixesAreManaged() {
+		final Node graphName = createURI("http://example/g");
+		final DatasetGraph dsg = emptyDataset();
+		dsg.addGraph(graphName, createGraphMem());
+		final Dataset dataset = DatasetFactory.create(dsg);
+		Model model = dataset.getNamedModel(graphName.getURI());
+		final String testPrefix = "example";
+		final String testURI = "http://example/";
+		model.setNsPrefix(testPrefix, testURI);
+		assertEquals(testURI, model.getNsPrefixURI(testPrefix));
+		model.close();
+		model = dataset.getNamedModel(graphName.getURI());
+		final String nsURI = dataset.getNamedModel(graphName.getURI()).getNsPrefixURI(testPrefix);
+		assertNotNull(nsURI);
+		assertEquals(testURI, nsURI);
+	}
+
+	@Test
+	public void unionGraphWorksProperly() {
+	    DatasetGraph dsg = emptyDataset();
+		// quads from named graphs should appear in union
+		Quad q = Quad.create(createBlankNode(), createBlankNode(), createBlankNode(), createBlankNode());
+		dsg.add(q);
+		// Expected in the union graph
+		Quad q2 = Quad.create(unionGraph, q.asTriple());
+		assertTrue(iter(dsg.find(unionGraph, ANY, ANY, ANY)).some(q2::equals));
+		// no triples from default graph should appear in union
+		Triple t = Triple.create(createBlankNode(), createBlankNode(), createBlankNode());
+		dsg.getDefaultGraph().add(t);
+		assertFalse(iter(dsg.find(unionGraph, ANY, ANY, ANY)).some(Quad::isDefaultGraph)) ;
+	}
+
+	@Override
+	protected DatasetGraph emptyDataset() {
+		return DatasetGraphFactory.createTxnMem();
+	}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryLock.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryLock.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryLock.java
new file mode 100644
index 0000000..37623b0
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryLock.java
@@ -0,0 +1,30 @@
+/**
+ * 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.core.mem;
+
+import org.apache.jena.query.Dataset ;
+import org.apache.jena.query.DatasetFactory ;
+import org.apache.jena.sparql.core.TestDatasetGraphWithLock ;
+
+public class TestDatasetGraphInMemoryLock extends TestDatasetGraphWithLock {
+	@Override
+	protected Dataset createFixed() {
+		return DatasetFactory.createTxnMem();
+	}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryThreading.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryThreading.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryThreading.java
new file mode 100644
index 0000000..7cb1051
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryThreading.java
@@ -0,0 +1,161 @@
+/**
+ * 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.core.mem;
+
+import static com.jayway.awaitility.Awaitility.await ;
+import static org.apache.jena.graph.NodeFactory.createBlankNode ;
+import static org.apache.jena.query.ReadWrite.READ ;
+import static org.apache.jena.query.ReadWrite.WRITE ;
+import static org.slf4j.LoggerFactory.getLogger ;
+
+import java.util.concurrent.atomic.AtomicBoolean ;
+
+import org.apache.jena.sparql.core.Quad ;
+import org.junit.Assert ;
+import org.junit.Test ;
+import org.slf4j.Logger ;
+
+public class TestDatasetGraphInMemoryThreading extends Assert {
+
+	Logger log = getLogger(TestDatasetGraphInMemoryThreading.class);
+
+	Quad q = Quad.create(createBlankNode(), createBlankNode(), createBlankNode(), createBlankNode());
+
+	@Test
+	public void abortedChangesNeverBecomeVisible() {
+		final DatasetGraphInMemory dsg = new DatasetGraphInMemory();
+		// flags with which to interleave threads
+		final AtomicBoolean addedButNotAborted = new AtomicBoolean(false);
+		final AtomicBoolean addedCheckedButNotAborted = new AtomicBoolean(false);
+		final AtomicBoolean aborted = new AtomicBoolean(false);
+
+		dsg.begin(READ);
+		assertTrue(dsg.isEmpty()); // no quads present
+		dsg.end();
+
+		// we introduce a Writer thread
+		new Thread() {
+
+			@Override
+			public void run() {
+				dsg.begin(WRITE);
+				log.debug("Writer: Added test quad.");
+				dsg.add(q);
+				assertFalse(dsg.isEmpty()); // quad has appeared in this transaction
+				addedButNotAborted.set(true);
+				log.debug("Writer: Waiting to abort addition of test quad.");
+				await().untilTrue(addedCheckedButNotAborted);
+				assertFalse(dsg.isEmpty()); // quad has appeared, but only inside this transaction
+				log.debug("Writer: Aborting test quad.");
+				dsg.abort();
+				log.debug("Writer: Aborted test quad.");
+				aborted.set(true);
+			}
+		}.start();
+		// back to Reader code
+		log.debug("Reader: Waiting for test quad to be added in Writer thread.");
+		await().untilTrue(addedButNotAborted);
+		dsg.begin(READ);
+		assertTrue(dsg.isEmpty()); // no quads present to Reader
+		dsg.end();
+		log.debug("Reader: Checked to see test quad is not visible.");
+		addedCheckedButNotAborted.set(true);
+		log.debug("Reader: Waiting to see Writer transaction aborted.");
+		await().untilTrue(aborted);
+		dsg.begin(READ);
+		assertTrue(dsg.isEmpty()); // no quads have appeared
+		dsg.end();
+	}
+
+	@Test
+	public void snapshotsShouldBeIsolated() {
+		final DatasetGraphInMemory dsg = new DatasetGraphInMemory();
+		// flags with which to interleave threads
+		final AtomicBoolean addedButNotCommitted = new AtomicBoolean(false);
+		final AtomicBoolean addedCheckedButNotCommitted = new AtomicBoolean(false);
+		final AtomicBoolean committed = new AtomicBoolean(false);
+
+		dsg.begin(READ);
+		assertTrue(dsg.isEmpty()); // no quads present
+		dsg.end();
+
+		// we introduce a Writer thread
+		new Thread() {
+
+			@Override
+			public void run() {
+				dsg.begin(WRITE);
+				log.debug("Writer: Added test quad.");
+				dsg.add(q);
+				assertFalse(dsg.isEmpty()); // quad has appeared, but only in this transaction
+				addedButNotCommitted.set(true);
+				log.debug("Writer: Waiting to commit test quad.");
+				await().untilTrue(addedCheckedButNotCommitted);
+				log.debug("Writer: Committing test quad.");
+				dsg.commit();
+				log.debug("Writer: Committed test quad.");
+				committed.set(true);
+			}
+		}.start();
+		// back to Reader code
+		log.debug("Reader: Waiting for test quad to be added in Writer thread.");
+		await().untilTrue(addedButNotCommitted);
+
+		dsg.begin(READ);
+		assertTrue(dsg.isEmpty()); // still no quads present, because Reader and Writer are isolated
+		log.debug("Reader: Checked to see test quad is not yet visible.");
+		addedCheckedButNotCommitted.set(true);
+		log.debug("Reader: Waiting to see test quad committed.");
+		await().untilTrue(committed);
+		assertTrue(dsg.isEmpty()); // still no quads present, because Reader and Writer are isolated
+		dsg.end();
+		// but a new transaction should see the results of Writer's action
+		dsg.begin(READ);
+		assertFalse(dsg.isEmpty()); // quad has appeared, for new transaction
+		dsg.end();
+	}
+
+	@Test
+	public void locksAreCorrectlyDistributed() {
+		final DatasetGraphInMemory dsg = new DatasetGraphInMemory();
+		final AtomicBoolean readLockCaptured = new AtomicBoolean(false);
+		final AtomicBoolean writeLockCaptured = new AtomicBoolean(false);
+
+		dsg.begin(WRITE); // acquire the write lock: no other Thread can now acquire it until it is released
+
+		new Thread() {
+
+			@Override
+			public void run() {
+				dsg.begin(READ); // a read lock should always be available except during a commit
+				readLockCaptured.set(true);
+				dsg.end();
+
+				dsg.begin(WRITE); // this should block until the write lock is released
+				writeLockCaptured.set(true);
+			}
+		}.start();
+		await().untilTrue(readLockCaptured);
+		if (writeLockCaptured.get()) fail("Write lock captured by two threads at once!");
+
+		dsg.end(); // release the write lock to competitor
+		await().untilTrue(writeLockCaptured);
+		assertTrue("Lock was not handed over to waiting thread!", writeLockCaptured.get());
+	}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryTransactions.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryTransactions.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryTransactions.java
new file mode 100644
index 0000000..e7f1e3e
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryTransactions.java
@@ -0,0 +1,31 @@
+/**
+ * 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.core.mem;
+
+import org.apache.jena.query.Dataset ;
+import org.apache.jena.query.DatasetFactory ;
+import org.apache.jena.sparql.transaction.AbstractTestTransaction ;
+
+public class TestDatasetGraphInMemoryTransactions extends AbstractTestTransaction {
+
+	@Override
+	protected Dataset create() {
+		return DatasetFactory.createTxnMem();
+	}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryViews.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryViews.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryViews.java
new file mode 100644
index 0000000..8f2b5d0
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestDatasetGraphInMemoryViews.java
@@ -0,0 +1,31 @@
+/**
+ * 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.core.mem;
+
+import org.apache.jena.sparql.core.DatasetGraph ;
+import org.apache.jena.sparql.core.DatasetGraphFactory ;
+import org.apache.jena.sparql.core.TestDatasetGraphViewGraphs ;
+
+public class TestDatasetGraphInMemoryViews extends TestDatasetGraphViewGraphs {
+
+	@Override
+	protected DatasetGraph createBaseDSG() {
+		return DatasetGraphFactory.createTxnMem();
+	}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestHexTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestHexTable.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestHexTable.java
index 43b5f5c..e200524 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestHexTable.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestHexTable.java
@@ -32,7 +32,7 @@ import org.apache.jena.graph.Node;
 import org.apache.jena.sparql.core.Quad;
 import org.junit.Test;
 
-public class TestHexTable extends QuadTableTest {
+public class TestHexTable extends AbstractTestQuadTable {
 
 	@Test
 	public void testListGraphNodes() {

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestInMemory.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestInMemory.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestInMemory.java
deleted file mode 100644
index 1f7be0d..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestInMemory.java
+++ /dev/null
@@ -1,32 +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.core.mem;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-/**
- * Tests for in-memory Dataset and its default implementation.
- *
- */
-@RunWith(Suite.class)
-@SuiteClasses({ TestDatasetGraphInMemory.class, TestQuadTableForms.class, TestTripleTableForms.class,
-		TestHexTable.class, TestTriTable.class })
-public class TestInMemory {}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestQuadTableForms.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestQuadTableForms.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestQuadTableForms.java
index 8bd5898..a147f1f 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestQuadTableForms.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestQuadTableForms.java
@@ -31,7 +31,7 @@ import java.util.stream.Stream;
 import org.apache.jena.sparql.core.Quad;
 import org.junit.Test;
 
-public class TestQuadTableForms extends TupleTableFormsTest<QuadTableForm> {
+public class TestQuadTableForms extends AbstractTestTupleTableForms<QuadTableForm> {
 
 	@Override
 	protected Stream<QuadTableForm> tableForms() {
@@ -40,7 +40,7 @@ public class TestQuadTableForms extends TupleTableFormsTest<QuadTableForm> {
 
 	@Override
 	protected Stream<Set<TupleSlot>> queryPatterns() {
-		return QuadTableTest.quadQueryPatterns();
+		return AbstractTestQuadTable.quadQueryPatterns();
 	}
 
 	private static Map<Set<TupleSlot>, Set<QuadTableForm>> answerKey = new HashMap<Set<TupleSlot>, Set<QuadTableForm>>() {
@@ -66,7 +66,7 @@ public class TestQuadTableForms extends TupleTableFormsTest<QuadTableForm> {
 
 	@Test
 	public void addAndRemoveSomeQuads() {
-		tableForms().map(QuadTableForm::get).map(table -> new QuadTableTest() {
+		tableForms().map(QuadTableForm::get).map(table -> new AbstractTestQuadTable() {
 
 			@Override
 			protected QuadTable table() {
@@ -77,7 +77,7 @@ public class TestQuadTableForms extends TupleTableFormsTest<QuadTableForm> {
 			protected Stream<Quad> tuples() {
 				return table.find(ANY, ANY, ANY, ANY);
 			}
-		}).forEach(TupleTableTest::addAndRemoveSomeTuples);
+		}).forEach(AbstractTestTupleTable::addAndRemoveSomeTuples);
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestTriTable.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestTriTable.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestTriTable.java
index fa09d83..cea1e5a 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestTriTable.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestTriTable.java
@@ -18,7 +18,7 @@
 
 package org.apache.jena.sparql.core.mem;
 
-public class TestTriTable extends TripleTableTest {
+public class TestTriTable extends AbstractTestTripleTable {
 
 	TriTable testTable = new TriTable();
 

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestTripleTableForms.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestTripleTableForms.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestTripleTableForms.java
index 36cb652..becd836 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestTripleTableForms.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TestTripleTableForms.java
@@ -31,11 +31,11 @@ import java.util.stream.Stream;
 import org.apache.jena.graph.Triple;
 import org.junit.Test;
 
-public class TestTripleTableForms extends TupleTableFormsTest<TripleTableForm> {
+public class TestTripleTableForms extends AbstractTestTupleTableForms<TripleTableForm> {
 
 	@Override
 	public Stream<Set<TupleSlot>> queryPatterns() {
-		return TripleTableTest.tripleQueryPatterns();
+		return AbstractTestTripleTable.tripleQueryPatterns();
 	}
 
 	@Override
@@ -45,7 +45,7 @@ public class TestTripleTableForms extends TupleTableFormsTest<TripleTableForm> {
 
 	@Test
 	public void addAndRemoveSomeTriples() {
-		tableForms().map(TripleTableForm::get).map(table -> new TripleTableTest() {
+		tableForms().map(TripleTableForm::get).map(table -> new AbstractTestTripleTable() {
 
 			@Override
 			protected TripleTable table() {
@@ -56,7 +56,7 @@ public class TestTripleTableForms extends TupleTableFormsTest<TripleTableForm> {
 			protected Stream<Triple> tuples() {
 				return table.find(ANY, ANY, ANY);
 			}
-		}).forEach(TupleTableTest::addAndRemoveSomeTuples);
+		}).forEach(AbstractTestTupleTable::addAndRemoveSomeTuples);
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TripleTableTest.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TripleTableTest.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TripleTableTest.java
deleted file mode 100644
index 9882466..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TripleTableTest.java
+++ /dev/null
@@ -1,56 +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.core.mem;
-
-import static org.apache.jena.graph.Node.ANY;
-import static org.apache.jena.graph.NodeFactory.createURI;
-import static org.apache.jena.sparql.core.mem.QuadTableTest.quadQueryPatterns;
-import static org.apache.jena.sparql.core.mem.TupleSlot.GRAPH;
-
-import java.util.Set;
-import java.util.stream.Stream;
-
-import org.apache.jena.graph.Node;
-import org.apache.jena.graph.Triple;
-
-public abstract class TripleTableTest extends TupleTableTest<Triple, TripleTable> {
-
-	private static final Node sampleNode = createURI("info:test");
-
-	private static final Triple testTriple = Triple.create(sampleNode, sampleNode, sampleNode);
-
-	@Override
-	protected Triple testTuple() {
-		return testTriple;
-	}
-
-	@Override
-	protected Stream<Triple> tuples() {
-		return table().find(ANY, ANY, ANY);
-	}
-
-	@Override
-	public Stream<Set<TupleSlot>> queryPatterns() {
-		return tripleQueryPatterns();
-	}
-
-	static Stream<Set<TupleSlot>> tripleQueryPatterns() {
-		return quadQueryPatterns().filter(s -> !s.contains(GRAPH));
-	}
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TupleTableFormsTest.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TupleTableFormsTest.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TupleTableFormsTest.java
deleted file mode 100644
index 2cc2d3a..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TupleTableFormsTest.java
+++ /dev/null
@@ -1,73 +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.core.mem;
-
-import static java.util.stream.Collectors.toSet;
-import static org.apache.jena.sparql.core.mem.TupleTableTest.allWildcardQuery;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.function.Predicate;
-import java.util.stream.Stream;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public abstract class TupleTableFormsTest<TableForm extends Predicate<Set<TupleSlot>>> extends Assert {
-
-	protected abstract Stream<TableForm> tableForms();
-
-	protected abstract Stream<Set<TupleSlot>> queryPatterns();
-
-	@Test
-	public void anAllWildcardQueryCannotAvoidTraversal() {
-		assertTrue(tableForms().noneMatch(form -> form.test(allWildcardQuery)));
-	}
-
-	@Test
-	public void anyIndexCanAnswerAnEntirelyConcretePattern() {
-		tableForms().allMatch(form -> form.test(allWildcardQuery));
-	}
-
-	protected boolean canAvoidTraversal(final Set<TupleSlot> pattern) {
-		return tableForms().anyMatch(form -> form.test(pattern));
-	}
-
-	@Test
-	public void allQueriesWithAtLeastOneConcreteNodeCanAvoidTraversal() {
-		assertTrue(queryPatterns().filter(p -> !allWildcardQuery.equals(p)).allMatch(this::canAvoidTraversal));
-	}
-
-	protected void avoidsTraversal(final Predicate<Set<TupleSlot>> indexForm,
-			final Set<Set<TupleSlot>> correctAnswers) {
-		final Set<Set<TupleSlot>> answers = queryPatterns().filter(indexForm::test).collect(toSet());
-		assertEquals(correctAnswers, answers);
-	}
-
-	@Test
-	public void aCorrectIndexIsChosenForEachPattern() {
-		answerKey().forEach((sample, correctAnswers) -> {
-			assertTrue(correctAnswers.contains(chooseFrom(sample)));
-		});
-	}
-
-	protected abstract TableForm chooseFrom(Set<TupleSlot> sample);
-
-	protected abstract Map<Set<TupleSlot>, Set<TableForm>> answerKey();
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/da8950e2/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TupleTableTest.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TupleTableTest.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TupleTableTest.java
deleted file mode 100644
index 965f366..0000000
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/mem/TupleTableTest.java
+++ /dev/null
@@ -1,112 +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.core.mem;
-
-import static java.util.stream.Collectors.toSet;
-import static org.apache.jena.ext.com.google.common.collect.ImmutableSet.of;
-import static org.apache.jena.query.ReadWrite.READ;
-import static org.apache.jena.query.ReadWrite.WRITE;
-
-import java.util.Set;
-import java.util.stream.Stream;
-
-import org.apache.jena.ext.com.google.common.collect.ImmutableSet;
-import org.junit.Assert;
-import org.junit.Test;
-
-public abstract class TupleTableTest<TupleType, TupleTableType extends TupleTable<TupleType>> extends Assert {
-
-	protected abstract TupleType testTuple();
-
-	protected abstract TupleTableType table();
-
-	protected abstract Stream<TupleType> tuples();
-
-	protected abstract Stream<Set<TupleSlot>> queryPatterns();
-
-	protected static final Set<TupleSlot> allWildcardQuery = of();
-
-	@Test
-	public void addAndRemoveSomeTuples() {
-
-		// simple add-and-delete
-		table().begin(WRITE);
-		assertTrue(table().isInTransaction());
-		table().add(testTuple());
-		Set<TupleType> contents = tuples().collect(toSet());
-		assertEquals(ImmutableSet.of(testTuple()), contents);
-		table().delete(testTuple());
-		contents = tuples().collect(toSet());
-		assertTrue(contents.isEmpty());
-		table().end();
-		assertFalse(table().isInTransaction());
-
-		// add, abort, then check to see that nothing was persisted
-		table().begin(WRITE);
-		assertTrue(table().isInTransaction());
-		table().add(testTuple());
-		contents = tuples().collect(toSet());
-		assertEquals(ImmutableSet.of(testTuple()), contents);
-		table().abort();
-		assertFalse(table().isInTransaction());
-		table().begin(READ);
-		assertTrue(table().isInTransaction());
-		try {
-			contents = tuples().collect(toSet());
-			assertTrue(contents.isEmpty());
-		} finally {
-			table().end();
-			assertFalse(table().isInTransaction());
-		}
-
-		// add, commit, and check to see that persistence occurred
-		table().begin(WRITE);
-		assertTrue(table().isInTransaction());
-		table().add(testTuple());
-		contents = tuples().collect(toSet());
-		assertEquals(ImmutableSet.of(testTuple()), contents);
-		table().commit();
-		assertFalse(table().isInTransaction());
-		table().begin(READ);
-		assertTrue(table().isInTransaction());
-		try {
-			contents = tuples().collect(toSet());
-			assertEquals(ImmutableSet.of(testTuple()), contents);
-		} finally {
-			table().end();
-			assertFalse(table().isInTransaction());
-		}
-		// remove the test tuple and check to see that it is gone
-		table().begin(WRITE);
-		assertTrue(table().isInTransaction());
-		table().clear();
-		contents = tuples().collect(toSet());
-		assertTrue(contents.isEmpty());
-		table().commit();
-		table().begin(READ);
-		assertTrue(table().isInTransaction());
-		try {
-			contents = tuples().collect(toSet());
-			assertTrue(contents.isEmpty());
-		} finally {
-			table().end();
-			assertFalse(table().isInTransaction());
-		}
-	}
-}