You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by cl...@apache.org on 2013/09/08 01:50:10 UTC

svn commit: r1520822 - in /jena/Experimental/new-test/src/test/java/com/hp/hpl/jena: graph/ graph/compose/ mem/ testing_framework/

Author: claude
Date: Sat Sep  7 23:50:09 2013
New Revision: 1520822

URL: http://svn.apache.org/r1520822
Log:
Added core / mem tests

Added:
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractBunchMapTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractTripleBunchTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/ArrayTripleBunchTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemListenerTest.java
      - copied, changed from r1520788, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphListenerTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemPrefixMappingTest.java
      - copied, changed from r1520788, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphPrefixMappingTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemRegisterListenerTest.java
      - copied, changed from r1520788, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphRegisterListenerTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemReifierTest.java
      - copied, changed from r1520788, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphReifierTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemSuite.java
      - copied, changed from r1520788, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphSuite.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemTest.java
      - copied, changed from r1520788, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphTripleStoreTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashCommonTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedBunchMapTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedTripleBunchTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/TestStoreSpeed.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/WrappedHashMapTest.java   (with props)
Removed:
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphListenerTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphPrefixMappingTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphRegisterListenerTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphReifierTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphSuite.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphTest.java
Modified:
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractEventManagerTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphMatchWithInference.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceSuite.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphEventManagerProducerInterface.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerUserInterface.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphTestUtils.java

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractEventManagerTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractEventManagerTest.java?rev=1520822&r1=1520821&r2=1520822&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractEventManagerTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractEventManagerTest.java Sat Sep  7 23:50:09 2013
@@ -33,11 +33,11 @@ import com.hp.hpl.jena.testing_framework
 import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
 
 /**
- * An abstract test that tests EventManager implementations to ensure they comply with
- * the EventManager contract.
+ * An abstract test that tests EventManager implementations to ensure they
+ * comply with the EventManager contract.
  * 
- *  Subclasses of this class must implement the getEventManagerProducer() method to create
- *  a new instance of the EventManager for testing.
+ * Subclasses of this class must implement the getEventManagerProducer() method
+ * to create a new instance of the EventManager for testing.
  */
 
 public abstract class AbstractEventManagerTest {
@@ -59,7 +59,8 @@ public abstract class AbstractEventManag
 	}
 
 	/**
-	 * Test that when a listener is registered the same EventManager is returned.
+	 * Test that when a listener is registered the same EventManager is
+	 * returned.
 	 */
 	@Test
 	public void testEventRegister() {
@@ -78,9 +79,10 @@ public abstract class AbstractEventManag
 	 * Handy triple for test purposes.
 	 */
 	protected Triple SPO = NodeCreateUtils.createTriple("S P O");
-	
+
 	/**
-	 * The RecordingListener that reports all the events sent from the EventManager.
+	 * The RecordingListener that reports all the events sent from the
+	 * EventManager.
 	 */
 	protected RecordingListener L;
 
@@ -118,7 +120,7 @@ public abstract class AbstractEventManag
 	}
 
 	/**
-	 * Test that unregistering a listener after registering it results in it not 
+	 * Test that unregistering a listener after registering it results in it not
 	 * receiving messages.
 	 */
 	@Test
@@ -129,8 +131,8 @@ public abstract class AbstractEventManag
 	}
 
 	/**
-	 * Test that registering a listener twice results in the listener receiving the
-	 * events twice.
+	 * Test that registering a listener twice results in the listener receiving
+	 * the events twice.
 	 */
 	@Test
 	public void testRegisterTwice() {
@@ -140,8 +142,8 @@ public abstract class AbstractEventManag
 	}
 
 	/**
-	 * Test that registering a listener twice and unregistering it once will result in
-	 * the listener receiving each event one time.
+	 * Test that registering a listener twice and unregistering it once will
+	 * result in the listener receiving each event one time.
 	 */
 	@Test
 	public void testUnregisterOnce() {
@@ -226,7 +228,8 @@ public abstract class AbstractEventManag
 	}
 
 	/**
-	 * Test that deleting a list as an iterator is reported as deleting an iterator.
+	 * Test that deleting a list as an iterator is reported as deleting an
+	 * iterator.
 	 */
 	@Test
 	public void testDeleteListAsIterator() {
@@ -259,7 +262,8 @@ public abstract class AbstractEventManag
 	}
 
 	/**
-	 * Test that sending a general event is reported as an event and the value is saved.
+	 * Test that sending a general event is reported as an event and the value
+	 * is saved.
 	 */
 	@Test
 	public void testGeneralEvent() {

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphTest.java?rev=1520822&r1=1520821&r2=1520822&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphTest.java Sat Sep  7 23:50:09 2013
@@ -1051,5 +1051,143 @@ public abstract class AbstractGraphTest 
 	// //assertIsomorphic( initial, inFile.getGraph() );
 	// }
 	// }
+	@Test
+	public void testSizeAfterRemove() {
+		Graph g = graphWithTxn("x p y");
+		if (g.getCapabilities().iteratorRemoveAllowed()) {
+			ExtendedIterator<Triple> it = g.find(triple("x ?? ??"));
+			it.removeNext();
+			assertEquals(0, g.size());
+		}
+	}
+
+	@Test
+	public void testSingletonStatisticsWithSingleTriple() {
+
+		Graph g = graphWithTxn("a P b");
+		GraphStatisticsHandler h = g.getStatisticsHandler();
+		if (h != null) {
+			assertEquals(1L, h.getStatistic(node("a"), Node.ANY, Node.ANY));
+			assertEquals(0L, h.getStatistic(node("x"), Node.ANY, Node.ANY));
+			//
+			assertEquals(1L, h.getStatistic(Node.ANY, node("P"), Node.ANY));
+			assertEquals(0L, h.getStatistic(Node.ANY, node("Q"), Node.ANY));
+			//
+			assertEquals(1L, h.getStatistic(Node.ANY, Node.ANY, node("b")));
+			assertEquals(0L, h.getStatistic(Node.ANY, Node.ANY, node("y")));
+		}
+	}
+
+	@Test
+	public void testSingletonStatisticsWithSeveralTriples() {
+
+		Graph g = graphWithTxn("a P b; a P c; a Q b; x S y");
+		GraphStatisticsHandler h = g.getStatisticsHandler();
+		if (h != null) {
+			assertEquals(3L, h.getStatistic(node("a"), Node.ANY, Node.ANY));
+			assertEquals(1L, h.getStatistic(node("x"), Node.ANY, Node.ANY));
+			assertEquals(0L, h.getStatistic(node("y"), Node.ANY, Node.ANY));
+			//
+			assertEquals(2L, h.getStatistic(Node.ANY, node("P"), Node.ANY));
+			assertEquals(1L, h.getStatistic(Node.ANY, node("Q"), Node.ANY));
+			assertEquals(0L, h.getStatistic(Node.ANY, node("R"), Node.ANY));
+			//
+			assertEquals(2L, h.getStatistic(Node.ANY, Node.ANY, node("b")));
+			assertEquals(1L, h.getStatistic(Node.ANY, Node.ANY, node("c")));
+			assertEquals(0L, h.getStatistic(Node.ANY, Node.ANY, node("d")));
+		}
+	}
+
+	@Test
+	public void testDoubletonStatisticsWithTriples() {
+
+		Graph g = graphWithTxn("a P b; a P c; a Q b; x S y");
+		GraphStatisticsHandler h = g.getStatisticsHandler();
+		if (h != null) {
+			assertEquals(-1L, h.getStatistic(node("a"), node("P"), Node.ANY));
+			assertEquals(-1L, h.getStatistic(Node.ANY, node("P"), node("b")));
+			assertEquals(-1L, h.getStatistic(node("a"), Node.ANY, node("b")));
+			//
+			assertEquals(0L, h.getStatistic(node("no"), node("P"), Node.ANY));
+		}
+	}
+
+	@Test
+	public void testStatisticsWithOnlyVariables() {
+		testStatsWithAllVariables("");
+		testStatsWithAllVariables("a P b");
+		testStatsWithAllVariables("a P b; a P c");
+		testStatsWithAllVariables("a P b; a P c; a Q b; x S y");
+	}
+
+	private void testStatsWithAllVariables(String triples) {
+		Graph g = graphWithTxn(triples);
+		GraphStatisticsHandler h = g.getStatisticsHandler();
+		if (h != null) {
+			assertEquals(g.size(), h.getStatistic(Node.ANY, Node.ANY, Node.ANY));
+		}
+	}
+
+	@Test
+	public void testStatsWithConcreteTriple() {
+		testStatsWithConcreteTriple(0, "x P y", "");
+	}
+
+	private void testStatsWithConcreteTriple(int expect, String triple,
+			String graph) {
+		Graph g = graphWithTxn(graph);
+		GraphStatisticsHandler h = g.getStatisticsHandler();
+		if (h != null) {
+			Triple t = triple(triple);
+			assertEquals(
+					expect,
+					h.getStatistic(t.getSubject(), t.getPredicate(),
+							t.getObject()));
+		}
+	}
+
+	@Test
+	public void testBrokenIndexes() {
+		Graph g = graphWithTxn("x R y; x S z");
+		if (g.getCapabilities().iteratorRemoveAllowed()) {
+			ExtendedIterator<Triple> it = g.find(Node.ANY, Node.ANY, Node.ANY);
+			it.removeNext();
+			it.removeNext();
+			assertFalse(g.find(node("x"), Node.ANY, Node.ANY).hasNext());
+			assertFalse(g.find(Node.ANY, node("R"), Node.ANY).hasNext());
+			assertFalse(g.find(Node.ANY, Node.ANY, node("y")).hasNext());
+		}
+	}
+
+	@Test
+	public void testBrokenSubject() {
+		Graph g = graphWithTxn("x brokenSubject y");
+		if (g.getCapabilities().iteratorRemoveAllowed()) {
+			ExtendedIterator<Triple> it = g.find(node("x"), Node.ANY, Node.ANY);
+			it.removeNext();
+			assertFalse(g.find(Node.ANY, Node.ANY, Node.ANY).hasNext());
+		}
+	}
+
+	@Test
+	public void testBrokenPredicate() {
+		Graph g = graphWithTxn("x brokenPredicate y");
+		if (g.getCapabilities().iteratorRemoveAllowed()) {
+			ExtendedIterator<Triple> it = g.find(Node.ANY,
+					node("brokenPredicate"), Node.ANY);
+			it.removeNext();
+			assertFalse(g.find(Node.ANY, Node.ANY, Node.ANY).hasNext());
+		}
+	}
+
+	@Test
+	public void testBrokenObject() {
+		Graph g = graphWithTxn("x brokenObject y");
+		if (g.getCapabilities().iteratorRemoveAllowed()) {
+			ExtendedIterator<Triple> it = g.find(Node.ANY, Node.ANY, node("y"));
+			it.removeNext();
+			assertFalse(g.find(Node.ANY, Node.ANY, Node.ANY).hasNext());
+		}
+	}
 
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphMatchWithInference.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphMatchWithInference.java?rev=1520822&r1=1520821&r2=1520822&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphMatchWithInference.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphMatchWithInference.java Sat Sep  7 23:50:09 2013
@@ -36,4 +36,4 @@ package com.hp.hpl.jena.graph;
 //		assertIsomorphic(mrdfs.getGraph(), concrete.getGraph());
 //	}
 //
-//}
+// }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceSuite.java?rev=1520822&r1=1520821&r2=1520822&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceSuite.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceSuite.java Sat Sep  7 23:50:09 2013
@@ -34,7 +34,8 @@ public class DifferenceSuite extends Abs
 		setGraphProducer(new AbstractGraphProducer() {
 			@Override
 			protected Graph createNewGraph() {
-				return new Difference(GraphFactory.createGraphMem(), GraphFactory.createGraphMem());
+				return new Difference(GraphFactory.createGraphMem(),
+						GraphFactory.createGraphMem());
 			}
 
 		});

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceTest.java?rev=1520822&r1=1520821&r2=1520822&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceTest.java Sat Sep  7 23:50:09 2013
@@ -34,11 +34,16 @@ public class DifferenceTest extends Abst
 	private GraphProducerInterface graphProducer = new AbstractGraphProducer() {
 		@Override
 		protected Graph createNewGraph() {
-			//Graph g1 = graphWith(GraphFactory.createGraphMem(), "x R y; p R q");
-			//Graph g2 = graphWith(GraphFactory.createGraphMem(), "r A s; x R y");
-			//Graph g1 = graphWith(GraphFactory.createGraphMem(), "x R y; p R q");
-			//Graph g2 = graphWith(GraphFactory.createGraphMem(), "r A s; x R y");
-			return new Difference(GraphFactory.createGraphMem(), GraphFactory.createGraphMem());
+			// Graph g1 = graphWith(GraphFactory.createGraphMem(),
+			// "x R y; p R q");
+			// Graph g2 = graphWith(GraphFactory.createGraphMem(),
+			// "r A s; x R y");
+			// Graph g1 = graphWith(GraphFactory.createGraphMem(),
+			// "x R y; p R q");
+			// Graph g2 = graphWith(GraphFactory.createGraphMem(),
+			// "r A s; x R y");
+			return new Difference(GraphFactory.createGraphMem(),
+					GraphFactory.createGraphMem());
 		}
 
 	};

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractBunchMapTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractBunchMapTest.java?rev=1520822&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractBunchMapTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractBunchMapTest.java Sat Sep  7 23:50:09 2013
@@ -0,0 +1,142 @@
+/*
+ * 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 com.hp.hpl.jena.mem;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+
+/**
+ * Test triple bunch implementations - NOT YET FINISHED
+ */
+public abstract class AbstractBunchMapTest {
+
+	protected abstract BunchMap getBunchMap();
+
+	@Test
+	public void testClear() {
+		BunchMap map = getBunchMap();
+		for (int i = 0; i < 5; i++) {
+			map.put(i, mock(TripleBunch.class));
+		}
+		assertEquals(5, map.size());
+
+		map.clear();
+		assertEquals(0, map.size());
+	}
+
+	@Test
+	public void testSize() {
+		BunchMap map = getBunchMap();
+		assertEquals(0, map.size());
+		for (int i = 0; i < 5; i++) {
+			map.put(i, mock(TripleBunch.class));
+			assertEquals(i + 1, map.size());
+		}
+	}
+
+	@Test
+	public void testGet() {
+		BunchMap map = getBunchMap();
+		List<TripleBunch> lst = new ArrayList<TripleBunch>();
+		for (int i = 0; i < 5; i++) {
+			TripleBunch tb = mock(TripleBunch.class);
+			lst.add(tb);
+			map.put(i, tb);
+		}
+		for (int i = 0; i < 5; i++) {
+			assertEquals(lst.get(i), map.get(i));
+		}
+	}
+
+	@Test
+	public void testPut() {
+		BunchMap map = getBunchMap();
+		List<TripleBunch> lst = new ArrayList<TripleBunch>();
+		for (int i = 0; i < 5; i++) {
+			map.put(i, mock(TripleBunch.class));
+		}
+		for (int i = 0; i < 5; i++) {
+			TripleBunch tb = mock(TripleBunch.class);
+			lst.add(tb);
+			map.put(i, tb);
+		}
+		for (int i = 0; i < 5; i++) {
+			assertEquals(lst.get(i), map.get(i));
+		}
+	}
+
+	@Test
+	public void testRemove() {
+		BunchMap map = getBunchMap();
+		List<TripleBunch> lst = new ArrayList<TripleBunch>();
+		for (int i = 0; i < 5; i++) {
+			TripleBunch tb = mock(TripleBunch.class);
+			lst.add(tb);
+			map.put(i, tb);
+		}
+
+		map.remove(0);
+		assertNull(map.get(0));
+		for (int i = 1; i < 5; i++) {
+			assertEquals(lst.get(i), map.get(i));
+		}
+		assertEquals(4, map.size());
+
+		map.remove(2);
+		assertNull(map.get(0));
+		assertEquals(lst.get(1), map.get(1));
+		assertNull(map.get(2));
+		assertEquals(lst.get(3), map.get(3));
+		assertEquals(lst.get(4), map.get(4));
+		assertEquals(3, map.size());
+
+		map.remove(4);
+		assertNull(map.get(0));
+		assertEquals(lst.get(1), map.get(1));
+		assertNull(map.get(2));
+		assertEquals(lst.get(3), map.get(3));
+		assertNull(map.get(4));
+		assertEquals(2, map.size());
+
+	}
+
+	@Test
+	public void testKeyIterator() {
+		BunchMap map = getBunchMap();
+		List<Integer> lst = new ArrayList<Integer>();
+		for (int i = 0; i < 5; i++) {
+			lst.add(i);
+			map.put(i, mock(TripleBunch.class));
+		}
+		ExtendedIterator<Object> iter = map.keyIterator();
+		while (iter.hasNext()) {
+			assertFalse("List is empty", lst.isEmpty());
+			Integer i = (Integer) iter.next();
+			assertTrue("Missing index: " + i, lst.contains(i));
+			lst.remove(i);
+		}
+		assertTrue("List is not empty", lst.isEmpty());
+	}
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractBunchMapTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractTripleBunchTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractTripleBunchTest.java?rev=1520822&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractTripleBunchTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractTripleBunchTest.java Sat Sep  7 23:50:09 2013
@@ -0,0 +1,187 @@
+/*
+ * 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 com.hp.hpl.jena.mem;
+
+import static org.junit.Assert.*;
+import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
+
+import java.util.ArrayList;
+import java.util.ConcurrentModificationException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.NodeCreateUtils;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+
+/**
+ * Test triple bunch implementations - NOT YET FINISHED
+ */
+public abstract class AbstractTripleBunchTest {
+	protected static final TripleBunch emptyBunch = new ArrayBunch();
+	protected static final Triple tripleSPO = triple("s P o");
+	protected static final Triple tripleXQY = triple("x Q y");
+
+	protected abstract TripleBunch getBunch();
+
+	@Test
+	public void testEmptyBunch() {
+		TripleBunch b = getBunch();
+		assertEquals(0, b.size());
+		assertFalse(b.contains(tripleSPO));
+		assertFalse(b.contains(tripleXQY));
+		assertFalse(b.iterator().hasNext());
+	}
+
+	@Test
+	public void testAddElement() {
+		TripleBunch b = getBunch();
+		b.add(tripleSPO);
+		assertEquals(1, b.size());
+		assertTrue(b.contains(tripleSPO));
+		assertEquals(listOf(tripleSPO), iteratorToList(b.iterator()));
+	}
+
+	@Test
+	public void testAddElements() {
+		TripleBunch b = getBunch();
+		b.add(tripleSPO);
+		b.add(tripleXQY);
+		assertEquals(2, b.size());
+		assertTrue(b.contains(tripleSPO));
+		assertTrue(b.contains(tripleXQY));
+		assertEquals(setOf(tripleSPO, tripleXQY), iteratorToSet(b.iterator()));
+	}
+
+	@Test
+	public void testRemoveOnlyElement() {
+		TripleBunch b = getBunch();
+		b.add(tripleSPO);
+		b.remove(tripleSPO);
+		assertEquals(0, b.size());
+		assertFalse(b.contains(tripleSPO));
+		assertFalse(b.iterator().hasNext());
+	}
+
+	@Test
+	public void testRemoveFirstOfTwo() {
+		TripleBunch b = getBunch();
+		b.add(tripleSPO);
+		b.add(tripleXQY);
+		b.remove(tripleSPO);
+		assertEquals(1, b.size());
+		assertFalse(b.contains(tripleSPO));
+		assertTrue(b.contains(tripleXQY));
+		assertEquals(listOf(tripleXQY), iteratorToList(b.iterator()));
+	}
+
+	@Test
+	public void testTableGrows() {
+		TripleBunch b = getBunch();
+		b.add(tripleSPO);
+		b.add(tripleXQY);
+		b.add(triple("a I b"));
+		b.add(triple("c J d"));
+	}
+
+	@Test
+	public void testIterator() {
+		TripleBunch b = getBunch();
+		b.add(triple("a P b"));
+		b.add(triple("c Q d"));
+		b.add(triple("e R f"));
+		assertEquals(tripleSet("a P b; c Q d; e R f"), b.iterator().toSet());
+	}
+
+	@Test
+	public void testIteratorRemoveOneItem() {
+		TripleBunch b = getBunch();
+		b.add(triple("a P b"));
+		b.add(triple("c Q d"));
+		b.add(triple("e R f"));
+		ExtendedIterator<Triple> it = b.iterator();
+		while (it.hasNext())
+			if (it.next().equals(triple("c Q d")))
+				it.remove();
+		assertEquals(tripleSet("a P b; e R f"), b.iterator().toSet());
+	}
+
+	@Test
+	public void testIteratorRemoveAlltems() {
+		TripleBunch b = getBunch();
+		b.add(triple("a P b"));
+		b.add(triple("c Q d"));
+		b.add(triple("e R f"));
+		ExtendedIterator<Triple> it = b.iterator();
+		while (it.hasNext())
+			it.removeNext();
+		assertEquals(tripleSet(""), b.iterator().toSet());
+	}
+
+	protected List<Triple> listOf(Triple x) {
+		List<Triple> result = new ArrayList<Triple>();
+		result.add(x);
+		return result;
+	}
+
+	protected Set<Triple> setOf(Triple x, Triple y) {
+		Set<Triple> result = setOf(x);
+		result.add(y);
+		return result;
+	}
+
+	protected Set<Triple> setOf(Triple x) {
+		Set<Triple> result = new HashSet<Triple>();
+		result.add(x);
+		return result;
+	}
+
+	public void testAddThenNextThrowsCME() {
+		TripleBunch b = getBunch();
+		b.add(NodeCreateUtils.createTriple("a P b"));
+		b.add(NodeCreateUtils.createTriple("c Q d"));
+		ExtendedIterator<Triple> it = b.iterator();
+		it.next();
+		b.add(NodeCreateUtils.createTriple("change its state"));
+		try {
+			it.next();
+			fail("should have thrown ConcurrentModificationException");
+		} catch (ConcurrentModificationException e) {
+			// expected
+		}
+	}
+
+	public void testDeleteThenNextThrowsCME() {
+		TripleBunch b = getBunch();
+		b.add(NodeCreateUtils.createTriple("a P b"));
+		b.add(NodeCreateUtils.createTriple("c Q d"));
+		ExtendedIterator<Triple> it = b.iterator();
+		it.next();
+		b.remove(NodeCreateUtils.createTriple("a P b"));
+		try {
+			it.next();
+			fail("should have thrown ConcurrentModificationException");
+		} catch (ConcurrentModificationException e) {
+			// expected
+		}
+	}
+}
\ No newline at end of file

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractTripleBunchTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/ArrayTripleBunchTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/ArrayTripleBunchTest.java?rev=1520822&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/ArrayTripleBunchTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/ArrayTripleBunchTest.java Sat Sep  7 23:50:09 2013
@@ -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 com.hp.hpl.jena.mem;
+
+public class ArrayTripleBunchTest extends AbstractTripleBunchTest {
+
+	@Override
+	public TripleBunch getBunch() {
+		return new ArrayBunch();
+	}
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/ArrayTripleBunchTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemListenerTest.java (from r1520788, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphListenerTest.java)
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemListenerTest.java?p2=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemListenerTest.java&p1=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphListenerTest.java&r1=1520788&r2=1520822&rev=1520822&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphListenerTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemListenerTest.java Sat Sep  7 23:50:09 2013
@@ -15,13 +15,14 @@
     See the License for the specific language governing permissions and
     limitations under the License.
  */
-package com.hp.hpl.jena.graph;
+package com.hp.hpl.jena.mem;
 
+import com.hp.hpl.jena.graph.AbstractGraphListenerTest;
 import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
 
-public class MemGraphListenerTest extends AbstractGraphListenerTest {
+public class GraphMemListenerTest extends AbstractGraphListenerTest {
 
-	GraphProducerInterface graphProducer = new MemGraphSuite.GraphProducer();
+	GraphProducerInterface graphProducer = new GraphMemSuite.GraphProducer();
 
 	@Override
 	public GraphProducerInterface getGraphProducer() {

Copied: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemPrefixMappingTest.java (from r1520788, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphPrefixMappingTest.java)
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemPrefixMappingTest.java?p2=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemPrefixMappingTest.java&p1=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphPrefixMappingTest.java&r1=1520788&r2=1520822&rev=1520822&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphPrefixMappingTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemPrefixMappingTest.java Sat Sep  7 23:50:09 2013
@@ -16,12 +16,13 @@
  * limitations under the License.
  */
 
-package com.hp.hpl.jena.graph;
+package com.hp.hpl.jena.mem;
 
+import com.hp.hpl.jena.graph.AbstractGraphPrefixMappingTest;
 import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
 
-public class MemGraphPrefixMappingTest extends AbstractGraphPrefixMappingTest {
-	private GraphProducerInterface graphProducer = new MemGraphSuite.GraphProducer();
+public class GraphMemPrefixMappingTest extends AbstractGraphPrefixMappingTest {
+	private GraphProducerInterface graphProducer = new GraphMemSuite.GraphProducer();
 
 	@Override
 	public GraphProducerInterface getGraphProducer() {

Copied: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemRegisterListenerTest.java (from r1520788, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphRegisterListenerTest.java)
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemRegisterListenerTest.java?p2=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemRegisterListenerTest.java&p1=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphRegisterListenerTest.java&r1=1520788&r2=1520822&rev=1520822&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphRegisterListenerTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemRegisterListenerTest.java Sat Sep  7 23:50:09 2013
@@ -15,14 +15,15 @@
     See the License for the specific language governing permissions and
     limitations under the License.
  */
-package com.hp.hpl.jena.graph;
+package com.hp.hpl.jena.mem;
 
+import com.hp.hpl.jena.graph.AbstractRegisterGraphListenerTest;
 import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
 
-public class MemGraphRegisterListenerTest extends
+public class GraphMemRegisterListenerTest extends
 		AbstractRegisterGraphListenerTest {
 
-	GraphProducerInterface graphProducer = new MemGraphSuite.GraphProducer();
+	GraphProducerInterface graphProducer = new GraphMemSuite.GraphProducer();
 
 	@Override
 	public GraphProducerInterface getGraphProducer() {

Copied: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemReifierTest.java (from r1520788, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphReifierTest.java)
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemReifierTest.java?p2=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemReifierTest.java&p1=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphReifierTest.java&r1=1520788&r2=1520822&rev=1520822&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphReifierTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemReifierTest.java Sat Sep  7 23:50:09 2013
@@ -16,8 +16,9 @@
  * limitations under the License.
  */
 
-package com.hp.hpl.jena.graph;
+package com.hp.hpl.jena.mem;
 
+import com.hp.hpl.jena.graph.AbstractReifierTest;
 import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
 
 /**
@@ -25,9 +26,9 @@ import com.hp.hpl.jena.testing_framework
  * kept to ensure compatibility for teh one and only Standard mode
  */
 
-public class MemGraphReifierTest extends AbstractReifierTest {
+public class GraphMemReifierTest extends AbstractReifierTest {
 
-	GraphProducerInterface graphProducer = new MemGraphSuite.GraphProducer();
+	GraphProducerInterface graphProducer = new GraphMemSuite.GraphProducer();
 
 	@Override
 	public GraphProducerInterface getGraphProducer() {

Copied: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemSuite.java (from r1520788, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphSuite.java)
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemSuite.java?p2=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemSuite.java&p1=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphSuite.java&r1=1520788&r2=1520822&rev=1520822&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphSuite.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemSuite.java Sat Sep  7 23:50:09 2013
@@ -15,17 +15,18 @@
     See the License for the specific language governing permissions and
     limitations under the License.
  */
-package com.hp.hpl.jena.graph;
+package com.hp.hpl.jena.mem;
 
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 
-import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.graph.AbstractGraphSuite;
+import com.hp.hpl.jena.graph.Graph;
 import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
 
 @RunWith(Suite.class)
-public class MemGraphSuite extends AbstractGraphSuite {
+public class GraphMemSuite extends AbstractGraphSuite {
 
 	@BeforeClass
 	public static void beforeClass() {
@@ -35,7 +36,7 @@ public class MemGraphSuite extends Abstr
 	public static class GraphProducer extends AbstractGraphProducer {
 		@Override
 		protected Graph createNewGraph() {
-			return GraphFactory.createGraphMem();
+			return new GraphMem();
 		}
 	}
 

Copied: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemTest.java (from r1520788, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphTest.java)
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemTest.java?p2=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemTest.java&p1=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphTest.java&r1=1520788&r2=1520822&rev=1520822&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemTest.java Sat Sep  7 23:50:09 2013
@@ -15,17 +15,80 @@
     See the License for the specific language governing permissions and
     limitations under the License.
  */
-package com.hp.hpl.jena.graph;
+package com.hp.hpl.jena.mem;
 
+import static com.hp.hpl.jena.testing_framework.GraphTestUtils.graphAdd;
+import static com.hp.hpl.jena.testing_framework.GraphTestUtils.triple;
+import static org.junit.Assert.*;
+
+import java.util.Iterator;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.AbstractGraphTest;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.GraphStatisticsHandler;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Node_URI;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.graph.TripleMatch;
+import com.hp.hpl.jena.shared.JenaException;
 import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
 
-public class MemGraphTest extends AbstractGraphTest {
+public class GraphMemTest extends AbstractGraphTest {
 
-	GraphProducerInterface graphProducer = new MemGraphSuite.GraphProducer();
+	GraphProducerInterface graphProducer = new GraphMemSuite.GraphProducer();
 
 	@Override
 	public GraphProducerInterface getGraphProducer() {
 		return graphProducer;
 	}
 
+	@Test
+	public void testHasStatistics() {
+		GraphStatisticsHandler h = graphProducer.newGraph()
+				.getStatisticsHandler();
+		assertNotNull(h);
+	}
+
+	@Test
+	public void testContainsConcreteDoesntUseFind() {
+		Graph g = new GraphMemWithoutFind();
+		graphAdd(g, "x P y; a Q b");
+		assertTrue(g.contains(triple("x P y")));
+		assertTrue(g.contains(triple("a Q b")));
+		assertFalse(g.contains(triple("a P y")));
+		assertFalse(g.contains(triple("y R b")));
+	}
+
+	protected final class GraphMemWithoutFind extends GraphMem {
+		@Override
+		public ExtendedIterator<Triple> graphBaseFind(TripleMatch t) {
+			throw new JenaException("find is Not Allowed");
+		}
+	}
+
+	@Test
+	public void testUnnecessaryMatches() {
+		Node special = new Node_URI("eg:foo") {
+			@Override
+			public boolean matches(Node s) {
+				fail("Matched called superfluously.");
+				return true;
+			}
+		};
+		Graph g = graphWithTxn("x p y");
+		g.add(new Triple(special, special, special));
+		exhaust(g.find(special, Node.ANY, Node.ANY));
+		exhaust(g.find(Node.ANY, special, Node.ANY));
+		exhaust(g.find(Node.ANY, Node.ANY, special));
+
+	}
+
+	protected void exhaust(Iterator<?> it) {
+		while (it.hasNext())
+			it.next();
+	}
+
 }

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphTripleStoreTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphTripleStoreTest.java?rev=1520822&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphTripleStoreTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphTripleStoreTest.java Sat Sep  7 23:50:09 2013
@@ -0,0 +1,32 @@
+/*
+ * 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 com.hp.hpl.jena.mem;
+
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.impl.AbstractTripleStoreTest;
+import com.hp.hpl.jena.graph.impl.TripleStore;
+import com.hp.hpl.jena.mem.GraphTripleStore;
+
+public class GraphTripleStoreTest extends AbstractTripleStoreTest {
+
+	@Override
+	public TripleStore getTripleStore() {
+		return new GraphTripleStore(Graph.emptyGraph);
+	}
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphTripleStoreTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashCommonTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashCommonTest.java?rev=1520822&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashCommonTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashCommonTest.java Sat Sep  7 23:50:09 2013
@@ -0,0 +1,196 @@
+/*
+ * 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 com.hp.hpl.jena.mem;
+
+import static org.junit.Assert.*;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.mem.HashCommon;
+
+public class HashCommonTest {
+	protected static final Item item2X = new Item(2, "X");
+	protected static final Item item1Y = new Item(1, "Y");
+	protected static final Item item2Z = new Item(2, "Z");
+
+	static class ProbeHashCommon extends HashCommon<Object> {
+		protected ProbeHashCommon(int initialCapacity) {
+			super(initialCapacity);
+		}
+
+		protected void set(int index, Item object) {
+			keys[index] = object;
+		}
+
+		@Override
+		public Object removeFrom(int here) {
+			return super.removeFrom(here);
+		}
+
+		public int top() {
+			return capacity - 1;
+		}
+
+		public int capacity() {
+			return capacity;
+		}
+
+		/*
+		 * Leaving the hashcode alone makes testing simpler.
+		 */
+		@Override
+		protected int improveHashCode(int hashCode) {
+			return hashCode;
+		}
+
+		@Override
+		protected Object[] newKeyArray(int size) {
+			return new Object[size];
+		}
+	}
+
+	static class Item {
+		protected final int n;
+		protected final String s;
+
+		public Item(int n, String s) {
+			this.n = n;
+			this.s = s;
+		}
+
+		@Override
+		public int hashCode() {
+			return n;
+		}
+
+		@Override
+		public boolean equals(Object other) {
+			return other instanceof Item && s.equals(((Item) other).s);
+		}
+
+		@Override
+		public String toString() {
+			return s + "#" + n;
+		}
+	}
+
+	@Test
+	public void testSanityCheckTestDataConstruction() {
+		ProbeHashCommon h = probeWith("1:2:x 4:7:y -1:5:z");
+		assertEquals(new Item(2, "x"), h.getItemForTestingAt(1));
+		assertEquals(new Item(7, "y"), h.getItemForTestingAt(4));
+		assertEquals(new Item(5, "z"), h.getItemForTestingAt(h.top()));
+	}
+
+	@Test
+	public void testHashcodeUsedAsIndex() {
+		ProbeHashCommon htb = new ProbeHashCommon(10);
+		int limit = htb.capacity();
+		for (int i = 0; i < limit; i += 1) {
+			Item t = new Item(i, "s p o");
+			// assertEquals( i, htb.)
+			// assertSame( t, htb.getItemForTestingAt( i ) );
+		}
+	}
+
+	@Test
+	public void testRemoveNoMove() {
+		ProbeHashCommon h = probeWith("1:1:Y 2:2:Z");
+		Item moved = (Item) h.removeFrom(2);
+		assertSame(null, moved);
+		assertAlike(probeWith("1:1:Y"), h);
+	}
+
+	@Test
+	public void testRemoveSimpleMove() {
+		ProbeHashCommon h = probeWith("0:2:X 1:1:Y 2:2:Z");
+		assertSame(null, h.removeFrom(1));
+		assertAlike(probeWith("1:2:X 2:2:Z"), h);
+	}
+
+	@Test
+	public void testRemoveCircularMove() {
+		ProbeHashCommon h = probeWith("0:0:X 1:2:Y -1:2:Z");
+		Item moved = (Item) h.removeFrom(1);
+		assertAlike(probeWith("0:0:X 1:2:Z"), h);
+		assertEquals(new Item(2, "Z"), moved);
+	}
+
+	@Test
+	public void testKeyIterator() {
+		ProbeHashCommon h = probeWith("0:0:X");
+		Set<?> elements = h.keyIterator().toSet();
+		assertEquals(itemSet("0:X"), elements);
+	}
+
+	/**
+	 * Assert that the two probe HashCommon's are "alike", that is, that they
+	 * have key arrays of equal size and are element-by-element equal.
+	 * Otherwise, fail (preferably with an appropriate message).
+	 */
+	private void assertAlike(ProbeHashCommon desired, ProbeHashCommon got) {
+		assertEquals("capacities must be equal", desired.capacity(),
+				got.capacity());
+		for (int i = 0; i < desired.capacity(); i += 1)
+			assertEquals(desired.getItemForTestingAt(i),
+					got.getItemForTestingAt(i));
+	}
+
+	/**
+	 * Answer a probe with the specified items. <code>items</code> is a
+	 * space-separated string of item descriptions. Each description is a
+	 * colon-separated sequence <code>index:hash:label</code>: the item
+	 * <code>(hash, label)</code> will be placed at <code>index</code>. Negative
+	 * index values are interpreted as indexs from the <i>end</code> of the key
+	 * array, by adding the probe's capacity to them.
+	 */
+	protected ProbeHashCommon probeWith(String items) {
+		ProbeHashCommon result = new ProbeHashCommon(10);
+		StringTokenizer st = new StringTokenizer(items);
+		while (st.hasMoreTokens()) {
+			String item = st.nextToken();
+			StringTokenizer itemElements = new StringTokenizer(item, ":");
+			int index = Integer.parseInt(itemElements.nextToken());
+			int hash = Integer.parseInt(itemElements.nextToken());
+			String w = itemElements.nextToken();
+			result.set((index < 0 ? index + result.capacity() : index),
+					new Item(hash, w));
+		}
+		return result;
+	}
+
+	protected Set<Item> itemSet(String items) {
+		Set<Item> result = new HashSet<Item>();
+		StringTokenizer st = new StringTokenizer(items);
+		while (st.hasMoreTokens())
+			addItem(result, st.nextToken());
+		return result;
+	}
+
+	private void addItem(Set<Item> result, String item) {
+		StringTokenizer itemElements = new StringTokenizer(item, ":");
+		int hash = Integer.parseInt(itemElements.nextToken());
+		String w = itemElements.nextToken();
+		result.add(new Item(hash, w));
+	}
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashCommonTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedBunchMapTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedBunchMapTest.java?rev=1520822&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedBunchMapTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedBunchMapTest.java Sat Sep  7 23:50:09 2013
@@ -0,0 +1,28 @@
+/*
+ * 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 com.hp.hpl.jena.mem;
+
+public class HashedBunchMapTest extends AbstractBunchMapTest {
+
+	@Override
+	protected BunchMap getBunchMap() {
+		return new HashedBunchMap();
+	}
+
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedBunchMapTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedTripleBunchTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedTripleBunchTest.java?rev=1520822&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedTripleBunchTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedTripleBunchTest.java Sat Sep  7 23:50:09 2013
@@ -0,0 +1,171 @@
+/*
+ * 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 com.hp.hpl.jena.mem;
+
+import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
+
+public class HashedTripleBunchTest extends AbstractTripleBunchTest {
+
+	protected static class HTB extends HashedTripleBunch {
+		public HTB(TripleBunch b) {
+			super(b);
+		}
+
+		@Override
+		protected int improveHashCode(int hashCode) {
+			return hashCode;
+		}
+	}
+
+	@Override
+	public TripleBunch getBunch() {
+		return new HashedTripleBunch(emptyBunch);
+	}
+
+	HashedTripleBunch htb = new HTB(emptyBunch);
+
+	static class TripleWithHash extends Triple {
+		final int hash;
+
+		TripleWithHash(int hash, Node s, Node p, Node o) {
+			super(s, p, o);
+			this.hash = hash;
+		}
+
+		public static TripleWithHash create(int n, String s) {
+			Triple t = triple(s);
+			return new TripleWithHash(n, t.getSubject(), t.getPredicate(),
+					t.getObject());
+		}
+
+		@Override
+		public int hashCode() {
+			return hash;
+		}
+	}
+
+	@Test
+	public void testHashcodeUsedAsIndex() {
+		HashedTripleBunch htb = new HTB(emptyBunch);
+		int limit = htb.currentCapacity();
+		for (int i = 0; i < limit; i += 1) {
+			TripleWithHash t = TripleWithHash.create(i, "s p o");
+			htb.add(t);
+			assertSame(t, htb.getItemForTestingAt(i));
+		}
+	}
+
+	@Test
+	public void testRemovePerformsShiftFromTop() {
+		int capacity = htb.currentCapacity();
+		testRemovePerformsShift(capacity - 1, capacity);
+	}
+
+	@Test
+	public void testRemovePerformsShiftFromMiddle() {
+		int capacity = htb.currentCapacity();
+		testRemovePerformsShift(capacity - 3, capacity);
+	}
+
+	@Test
+	public void testRemovePerformsShiftWrappingLowestTwo() {
+		int capacity = htb.currentCapacity();
+		testRemovePerformsShift(0, capacity);
+	}
+
+	@Test
+	public void testRemovePerformsShiftWrappingLowest() {
+		int capacity = htb.currentCapacity();
+		testRemovePerformsShift(1, capacity);
+	}
+
+	private void testRemovePerformsShift(int most, int capacity) {
+		int next = most - 1;
+		if (next < 0)
+			next += capacity;
+		int least = most - 2;
+		if (least < 0)
+			least += capacity;
+		TripleWithHash t1 = TripleWithHash.create(most, "s p o");
+		TripleWithHash t2 = TripleWithHash.create(next, "a b c");
+		TripleWithHash t3 = TripleWithHash.create(most, "x y z");
+		htb.add(t1);
+		htb.add(t2);
+		htb.add(t3);
+		assertSame(t1, htb.getItemForTestingAt(most));
+		assertSame(t2, htb.getItemForTestingAt(next));
+		assertSame(t3, htb.getItemForTestingAt(least));
+		//
+		htb.remove(t1);
+		assertSame(t3, htb.getItemForTestingAt(most));
+		assertSame(t2, htb.getItemForTestingAt(next));
+		assertSame(null, htb.getItemForTestingAt(least));
+	}
+
+	@Test
+	public void testIteratorRemovePerformsShiftAndDeliversElementFromTop() {
+		int capacity = htb.currentCapacity();
+		testIteratorRemovePerformsShiftAndDeliversElement(capacity - 1,
+				capacity);
+	}
+
+	@Test
+	public void testIteratorRemovePerformsShiftAndDeliversElementFromMiddle() {
+		int capacity = htb.currentCapacity();
+		testIteratorRemovePerformsShiftAndDeliversElement(capacity - 3,
+				capacity);
+	}
+
+	// public void
+	// testIteratorRemovePerformsShiftAndDeliversElementWrappingLowest()
+	// {
+	// int capacity = htb.currentCapacity();
+	// testIteratorRemovePerformsShiftAndDeliversElement( 1, capacity );
+	// }
+	//
+	// public void
+	// testIteratorRemovePerformsShiftAndDeliversElementWrappingLowestTwo()
+	// {
+	// int capacity = htb.currentCapacity();
+	// testIteratorRemovePerformsShiftAndDeliversElement( 0, capacity );
+	// }
+
+	private void testIteratorRemovePerformsShiftAndDeliversElement(int most,
+			int capacity) {
+		// int next = most - 1; if (next < 0) next += capacity;
+		// int least = most - 2; if (least < 0) least += capacity;
+		// TripleWithHash t1 = TripleWithHash.create( most, "s p o" );
+		// TripleWithHash t2 = TripleWithHash.create( next, "a b c" );
+		// TripleWithHash t3 = TripleWithHash.create( most, "x y z" );
+		// htb.add( t1 );
+		// htb.add( t2 );
+		// htb.add( t3 );
+		// ExtendedIterator it = htb.iterator();
+		// assertSame( t1, it.next() );
+		// it.remove();
+		// assertSame( t3, it.next() );
+		// assertSame( t2, it.next() );
+	}
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedTripleBunchTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/TestStoreSpeed.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/TestStoreSpeed.java?rev=1520822&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/TestStoreSpeed.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/TestStoreSpeed.java Sat Sep  7 23:50:09 2013
@@ -0,0 +1,113 @@
+/*
+ * 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 com.hp.hpl.jena.mem;
+
+import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
+
+import com.hp.hpl.jena.graph.Factory;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.util.iterator.ClosableIterator;
+
+public class TestStoreSpeed {
+	private long began;
+
+	public static void main(String[] args) {
+		new TestStoreSpeed().gonzales("subject StoreMem",
+				Factory.createGraphMem());
+		new TestStoreSpeed().gonzales("normal StoreMem",
+				Factory.createGraphMem());
+		new TestStoreSpeed().gonzales("GraphMem", Factory.createGraphMem());
+		new TestStoreSpeed().gonzales("subject StoreMem",
+				Factory.createGraphMem());
+		new TestStoreSpeed().gonzales("normal StoreMem",
+				Factory.createGraphMem());
+		new TestStoreSpeed().gonzales("GraphMem", Factory.createGraphMem());
+		new TestStoreSpeed().gonzales("subject StoreMem",
+				Factory.createGraphMem());
+		new TestStoreSpeed().gonzales("normal StoreMem",
+				Factory.createGraphMem());
+		new TestStoreSpeed().gonzales("GraphMem", Factory.createGraphMem());
+	}
+
+	private void mark() {
+		began = System.currentTimeMillis();
+	}
+
+	static final int COUNT = 100000;
+
+	private Triple newt(int i) {
+		return new Triple(node("s" + (i % 1000)), node("p" + ((i + 11) % 20)),
+				node("s" + ((i + 131) % 1001)));
+	}
+
+	private void makeTriples() {
+		for (int i = 0; i < COUNT; i += 1)
+			newt(i);
+	}
+
+	private void fillGraph(Graph g) {
+		for (int i = 0; i < COUNT; i += 1)
+			g.add(newt(i));
+	}
+
+	private long ticktock(String title) {
+		long ticks = System.currentTimeMillis() - began;
+		System.err.println("+ " + title + " took: " + ticks + "ms.");
+		mark();
+		return ticks;
+	}
+
+	private void consumeAll(Graph g) {
+		int count = 0;
+		ClosableIterator<Triple> it = g.find(node("s500"), null, null);
+		while (it.hasNext()) {
+			it.next();
+			count += 1; /*
+						 * if (count %1000 == 0) System.err.print( (count /
+						 * 1000) %10 );
+						 */
+		}
+		// System.err.println( "| we have " + count + " triples." );
+		// assertEquals( g.size(), count );
+	}
+
+	private void gonzales(String title, Graph g) {
+		System.err.println("");
+		System.err.println("| gonzales: " + title);
+		mark();
+		makeTriples();
+		ticktock("generating triples");
+		makeTriples();
+		ticktock("generating triples again");
+		makeTriples();
+		long gen = ticktock("generating triples yet again");
+		fillGraph(g);
+		long fill = ticktock("filling graph");
+		System.err.println("> insertion time: " + (fill - gen));
+		fillGraph(g);
+		ticktock("adding the same triples again");
+		consumeAll(g);
+		ticktock("counting s500 triples");
+		consumeAll(g);
+		ticktock("counting s500 triples again");
+		consumeAll(g);
+		ticktock("counting s500 triples yet again");
+	}
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/TestStoreSpeed.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/WrappedHashMapTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/WrappedHashMapTest.java?rev=1520822&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/WrappedHashMapTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/WrappedHashMapTest.java Sat Sep  7 23:50:09 2013
@@ -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 com.hp.hpl.jena.mem;
+
+public class WrappedHashMapTest extends AbstractBunchMapTest {
+
+	@Override
+	public BunchMap getBunchMap() {
+		return new WrappedHashMap();
+	}
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/WrappedHashMapTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphEventManagerProducerInterface.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphEventManagerProducerInterface.java?rev=1520822&r1=1520821&r2=1520822&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphEventManagerProducerInterface.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphEventManagerProducerInterface.java Sat Sep  7 23:50:09 2013
@@ -26,8 +26,8 @@ import com.hp.hpl.jena.graph.GraphEventM
 public interface GraphEventManagerProducerInterface {
 
 	/**
-	 * Returns a GraphEventManager to take part in the test. Must be overridden in a
-	 * subclass.
+	 * Returns a GraphEventManager to take part in the test. Must be overridden
+	 * in a subclass.
 	 * 
 	 * @return The GraphEventManager implementation to test.
 	 */

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerUserInterface.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerUserInterface.java?rev=1520822&r1=1520821&r2=1520822&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerUserInterface.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerUserInterface.java Sat Sep  7 23:50:09 2013
@@ -21,7 +21,7 @@ public interface GraphProducerUserInterf
 	/**
 	 * The graph producer to use for the tests.
 	 * 
-	 * @return The graph producer 
+	 * @return The graph producer
 	 */
 	public GraphProducerInterface getGraphProducer();
 

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphTestUtils.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphTestUtils.java?rev=1520822&r1=1520821&r2=1520822&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphTestUtils.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphTestUtils.java Sat Sep  7 23:50:09 2013
@@ -187,8 +187,11 @@ public class GraphTestUtils extends Test
 
 	/**
 	 * Like graphAdd but does it within a transaction if supported
-	 * @param g The graph to add to
-	 * @param s The string describing the graph
+	 * 
+	 * @param g
+	 *            The graph to add to
+	 * @param s
+	 *            The string describing the graph
 	 * @return The populated graph.
 	 */
 	public static Graph graphAddTxn(Graph g, String s) {
@@ -202,8 +205,11 @@ public class GraphTestUtils extends Test
 
 	/**
 	 * Used to create a graph with values.
-	 * @param g The newly created graph
-	 * @param s The string representing the graph data.
+	 * 
+	 * @param g
+	 *            The newly created graph
+	 * @param s
+	 *            The string representing the graph data.
 	 * @return The populated graph
 	 */
 	public static Graph graphWith(Graph g, String s) {
@@ -469,6 +475,7 @@ public class GraphTestUtils extends Test
 
 	/**
 	 * Begin a transaction on the graph if transactions are supported.
+	 * 
 	 * @param g
 	 */
 	public static void txnBegin(Graph g) {
@@ -478,7 +485,8 @@ public class GraphTestUtils extends Test
 	}
 
 	/**
-	 *  Commit the transaction on the graph if transactions are supported.
+	 * Commit the transaction on the graph if transactions are supported.
+	 * 
 	 * @param g
 	 */
 	public static void txnCommit(Graph g) {
@@ -486,8 +494,11 @@ public class GraphTestUtils extends Test
 			g.getTransactionHandler().commit();
 		}
 	}
+
 	/**
-	 *  Rollback (abort) the transaction on the graph if transactions are supported.
+	 * Rollback (abort) the transaction on the graph if transactions are
+	 * supported.
+	 * 
 	 * @param g
 	 */
 	public static void txnRollback(Graph g) {