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/07 09:48:52 UTC

svn commit: r1520740 [1/4] - in /jena/Experimental/new-test/src/test/java/com/hp/hpl/jena: graph/ graph/impl/ shared/ test/ testing_framework/

Author: claude
Date: Sat Sep  7 07:48:51 2013
New Revision: 1520740

URL: http://svn.apache.org/r1520740
Log:
first complete core/graph/test implementation

Added:
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphListenerTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphMakerTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphPrefixMappingTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractRegisterGraphListenerTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphListenerTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphPrefixMappingTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphRegisterListenerTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphReifierTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphMatchWithInference.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphUtils.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestLiteralLabels.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestNode.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestNodeToTriplesMap.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestSimpleGraphMaker.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestTriple.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestTripleField.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestTypedLiterals.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/AbstractPrefixMappingTest.java   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducer.java
      - copied, changed from r1519250, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphProducer.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducerUser.java
      - copied, changed from r1519250, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphProducerUser.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerInterface.java
      - copied, changed from r1519250, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/GraphProducerInterface.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerUserInterface.java   (with props)
Removed:
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphProducer.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphProducerUser.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/GraphProducerInterface.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/AbstractFindLiteralsTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphExtractTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphSuite.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/AbstractReifierTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractTransactionHandlerTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/GraphTestUtils.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
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/CollectionGraphSuite.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphSuite.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphSuite2.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/TestCollectionGraph.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/TestFileGraphMaker.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphSuite.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/test/TestUtils.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=1520740&r1=1520739&r2=1520740&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 07:48:51 2013
@@ -33,6 +33,7 @@ import com.hp.hpl.jena.graph.GraphListen
 import com.hp.hpl.jena.graph.GraphUtil;
 import com.hp.hpl.jena.graph.Node;
 import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducerUser;
 import com.hp.hpl.jena.util.CollectionFactory;
 import com.hp.hpl.jena.util.iterator.ExtendedIterator;
 import static com.hp.hpl.jena.graph.GraphTestUtils.*;

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractFindLiteralsTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractFindLiteralsTest.java?rev=1520740&r1=1520739&r2=1520740&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractFindLiteralsTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractFindLiteralsTest.java Sat Sep  7 07:48:51 2013
@@ -33,6 +33,7 @@ import org.junit.runners.Parameterized.P
 import com.hp.hpl.jena.graph.Graph;
 import com.hp.hpl.jena.graph.Node;
 import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
 import com.hp.hpl.jena.util.iterator.Map1;
 
 @RunWith(Parameterized.class)

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphExtractTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphExtractTest.java?rev=1520740&r1=1520739&r2=1520740&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphExtractTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphExtractTest.java Sat Sep  7 07:48:51 2013
@@ -23,6 +23,8 @@ import static org.junit.Assert.*;
 
 import org.junit.Test;
 
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducerUser;
+
 /**
  * Tests for recursive sub-graph extraction.
  */

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphListenerTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphListenerTest.java?rev=1520740&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphListenerTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphListenerTest.java Sat Sep  7 07:48:51 2013
@@ -0,0 +1,331 @@
+/*
+ * 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.graph;
+
+
+import static com.hp.hpl.jena.graph.GraphTestUtils.assertContainsAll;
+import static com.hp.hpl.jena.graph.GraphTestUtils.assertOmitsAll;
+import static com.hp.hpl.jena.graph.GraphTestUtils.graphAddTxn;
+import static com.hp.hpl.jena.graph.GraphTestUtils.node;
+import static com.hp.hpl.jena.graph.GraphTestUtils.triple;
+import static com.hp.hpl.jena.graph.GraphTestUtils.txnBegin;
+import static com.hp.hpl.jena.graph.GraphTestUtils.txnCommit;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays ;
+import java.util.Iterator ;
+import java.util.List ;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.impl.SimpleBulkUpdateHandler ;
+import com.hp.hpl.jena.mem.GraphMem ;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducerUser;
+import com.hp.hpl.jena.util.iterator.ClosableIterator;
+
+/**
+ * Version of graph tests that set up a listener that copies all changes
+ * and verifies that after every notification modified graph
+ * and original are isomorphic.
+ */
+public abstract class AbstractGraphListenerTest extends AbstractGraphProducerUser {
+  
+	private Graph base;
+	private CheckChanges checkChanges;
+	
+	@Before
+	public void setupListener()
+	{
+		base = getGraphProducer().newGraph();
+		checkChanges = new CheckChanges("", base, getGraphProducer().newGraph());
+		base.getEventManager().register( checkChanges );
+	}
+	
+	/**
+	 * A listener to check that a graph is being tracked
+	 * correctly by its events.
+	 */
+	protected class CheckChanges implements GraphListener {
+
+		private Graph copy, original;
+		private String desc;
+		
+		public CheckChanges(String description, Graph g, Graph c) {
+			original = g;
+			copy = c;
+		}
+		
+		public void setDescription( String desc )
+		{
+			this.desc = desc;
+		}
+
+
+		protected void verify() {
+			 GraphTestUtils.assertIsomorphic(desc+" has not been tracked correctly. [delegating,copy-from-listener]",
+					original, copy
+					);
+		}
+
+		@Override
+        public void notifyAddIterator(Graph g, Iterator<Triple> it) {
+			while (it.hasNext()) copy.add(it.next());
+			verify();		
+	    }
+
+		@Override
+        public void notifyAddTriple(Graph g, Triple t) {
+			copy.add(t);
+			verify();
+		}
+
+		@Override
+        public void notifyDeleteIterator(Graph g, Iterator<Triple> it) {
+			while (it.hasNext()) copy.delete(it.next());
+			verify();
+		}
+
+
+		@Override
+        public void notifyDeleteTriple(Graph g, Triple t) {
+			copy.delete(t);
+			verify();
+		}
+
+		@Override
+        public void notifyEvent(Graph source, Object value) {
+			if (value instanceof GraphEvents) {
+				if (GraphEvents.removeAll.equals(value)) {
+					notifyRemoveAll(source,Triple.ANY);
+				} else {
+					GraphEvents event = (GraphEvents)value;
+					if ("remove".equals(event.getTitle())) {
+						notifyRemoveAll(source,(Triple)event.getContent());
+					}
+				}
+			}
+			verify();
+		}
+
+		public void notifyRemoveAll(Graph source, Triple t) {
+			SimpleBulkUpdateHandler.removeAll(copy, t.getSubject(), t.getPredicate(), t.getObject());
+			verify();
+			
+		}
+
+
+		@Override
+        public void notifyAddList(Graph g, List<Triple> triples) {
+			notifyAddIterator(g, triples.iterator());
+		}
+
+
+		@Override
+        public void notifyDeleteArray(Graph g, Triple[] triples) {
+			notifyDeleteIterator(g,Arrays.asList(triples).iterator());
+		}
+
+		@Override
+        public void notifyAddArray(Graph g, Triple[] triples) {
+			notifyAddIterator(g,Arrays.asList(triples).iterator());
+		}
+		@Override
+        public void notifyAddGraph(Graph g, Graph added) {
+			notifyAddIterator(g,added.find(Triple.ANY));
+		}
+
+
+
+		@Override
+        public void notifyDeleteGraph(Graph g, Graph removed) {
+			notifyDeleteIterator(g,removed.find(Triple.ANY));
+		}
+
+
+
+		@Override
+        public void notifyDeleteList(Graph g, List<Triple> list) {
+			notifyDeleteIterator(g, list.iterator());
+		}
+
+
+	}
+	
+	@Test
+	public void testAddArray() {
+		Triple[] triples = {
+				triple( "a b c" ),
+				triple( "_a _b _c" ),
+				triple( "1 2 3" )
+		};
+		checkChanges.setDescription( "Add array");
+		BulkUpdateHandler buh = base.getBulkUpdateHandler();
+		buh.add(triples);
+	}
+	
+	@Test
+	public void testAddGraph() {
+		Graph arg = GraphFactory.createGraphMem();
+		GraphTestUtils.graphAdd(arg, "a b c; _a _b_ c; 1 2 3 ");
+	
+		checkChanges.setDescription( "Add graph");
+		BulkUpdateHandler buh = base.getBulkUpdateHandler();
+		buh.add(arg);
+	}
+	
+	@Test
+	public void testAddIterator() {
+		Triple[] triples = {
+				triple( "a b c" ),
+				triple( "_a _b _c" ),
+				triple( "1 2 3" )
+		};
+	
+		checkChanges.setDescription( "Add iterator");
+		BulkUpdateHandler buh = base.getBulkUpdateHandler();
+		buh.add( Arrays.asList(triples).iterator());
+	}
+	
+	@Test
+	public void testAddList() {
+		Triple[] triples = {
+				triple( "a b c" ),
+				triple( "_a _b _c" ),
+				triple( "1 2 3" )
+		};
+		
+		checkChanges.setDescription( "Add list");
+		BulkUpdateHandler buh = base.getBulkUpdateHandler();
+		buh.add( Arrays.asList(triples));
+	}
+	
+	@Test
+	public void testAddTriple() {
+		checkChanges.setDescription( "Add triple");
+		base.add( triple( "_a b 1"));
+	}
+	
+	@Test
+	public void deleteAddArray() {
+		Triple[] add = {
+				triple( "a b c" ),
+				triple( "_a _b _c" ),
+				triple( "1 2 3" ),
+				triple( "_a b 1")
+		};
+		Triple[] remove = {
+				triple( "a b c" ),
+				triple( "_a _b _c" ),
+				triple( "1 2 3" )
+		};
+		checkChanges.setDescription( "Delete array");
+		BulkUpdateHandler buh = base.getBulkUpdateHandler();
+		buh.add(add);
+		buh.delete( remove );	
+	}
+	
+	@Test
+	public void testRemoveGraph() {
+		Graph add = GraphFactory.createGraphMem();
+		GraphTestUtils.graphAdd(add, "a b c; _a _b_ c; 1 2 3; _a b 3");
+		Graph remove = GraphFactory.createGraphMem();
+		GraphTestUtils.graphAdd(remove, "a b c; _a _b_ c; 1 2 3 ");
+		checkChanges.setDescription( "Remove graph");
+		BulkUpdateHandler buh = base.getBulkUpdateHandler();
+		buh.add(add);
+		buh.delete( remove);
+	}
+	
+	@Test
+	public void testRemoveIterator() {
+		Triple[] add = {
+				triple( "a b c" ),
+				triple( "_a _b _c" ),
+				triple( "1 2 3" ),
+				triple( "_a b 1")
+		};
+		Triple[] remove = {
+				triple( "a b c" ),
+				triple( "_a _b _c" ),
+				triple( "1 2 3" )
+		};
+	
+		checkChanges.setDescription( "Remove iterator");
+		BulkUpdateHandler buh = base.getBulkUpdateHandler();
+		buh.add( add );
+		buh.add( Arrays.asList(remove).iterator());
+	}
+	
+	@Test
+	public void testRemoveList() {
+		
+		Triple[] add = {
+				triple( "a b c" ),
+				triple( "_a _b _c" ),
+				triple( "1 2 3" ),
+				triple( "_a b 1")
+		};
+		Triple[] remove = {
+				triple( "a b c" ),
+				triple( "_a _b _c" ),
+				triple( "1 2 3" )
+		};
+	
+		checkChanges.setDescription( "Remove list");
+		BulkUpdateHandler buh = base.getBulkUpdateHandler();
+		buh.add( add );
+		buh.add( Arrays.asList(remove));
+	}
+	
+	@Test
+	public void testRemoveTriple() {
+		checkChanges.setDescription( "Remove triple");
+		base.add( triple( "_a b 1"));
+		base.delete(triple( "_a b 1"));
+	}
+	
+	@Test
+	public void testRemoveTripleAsNodes() {
+		checkChanges.setDescription( "Remove triple");
+		base.add( triple( "_a b 1"));
+		base.remove( node("_a"), node("b"), node("1"));
+	}
+	
+	@Test
+	public void testRemoveAll() {
+		
+		Triple[] add = {
+				triple( "a b c" ),
+				triple( "_a _b _c" ),
+				triple( "1 2 3" ),
+				triple( "_a b 1")
+		};
+		
+	
+		checkChanges.setDescription( "Remove list");
+		BulkUpdateHandler buh = base.getBulkUpdateHandler();
+		buh.add( add );
+		base.clear();
+	}	
+	
+}

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphMakerTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphMakerTest.java?rev=1520740&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphMakerTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphMakerTest.java Sat Sep  7 07:48:51 2013
@@ -0,0 +1,279 @@
+/*
+ * 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.graph;
+
+import static org.junit.Assert.*;
+import java.util.Set;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.GraphMaker;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.shared.AlreadyExistsException;
+import com.hp.hpl.jena.shared.DoesNotExistException;
+import com.hp.hpl.jena.test.TestUtils;
+
+/**
+ * Abstract base class for testing graph factories. Subclasses define the method
+ * <code>getGraphFactory()</code> which supplies a new graph factory to be
+ * tested: ATGF invokes that during <code>setUp</code> and closes it in
+ * <code>tearDown</code>.
+ * <p>
+ * This bunch of tests is not remotely exhaustive, but it was sufficent to drive
+ * the development of the first full graph factory. (Although at the time it
+ * wasn't abstract.)
+ */
+
+public abstract class AbstractGraphMakerTest {
+
+	public abstract GraphMaker getGraphMaker();
+
+	private GraphMaker graphMaker;
+
+	@Before
+	public void setUp() {
+		graphMaker = getGraphMaker();
+	}
+
+	@After
+	public void tearDown() {
+		graphMaker.close();
+	}
+
+	/**
+	 * A trivial test that getGraph delivers a proper graph, not cheating with
+	 * null, and that getGraph() "always" delivers the same Graph.
+	 */
+	@Test
+	public void testGetGraph() {
+		Graph g1 = graphMaker.getGraph();
+		assertFalse("should deliver a Graph", g1 == null);
+		assertSame(g1, graphMaker.getGraph());
+		g1.close();
+	}
+
+	@Test
+	public void testCreateGraph() {
+		TestUtils.assertDiffer("each created graph must differ",
+				graphMaker.createGraph(), graphMaker.createGraph());
+	}
+
+	@Test
+	public void testAnyName() {
+		graphMaker.createGraph("plain").close();
+		graphMaker.createGraph("with.dot").close();
+		graphMaker.createGraph("http://electric-hedgehog.net/topic#marker").close();
+	}
+
+	/**
+	 * Test that we can't create a graph with the same name twice.
+	 */
+	@Test
+	public void testCannotCreateTwice() {
+		String name = jName("bonsai");
+		graphMaker.createGraph(name, true);
+		try {
+			graphMaker.createGraph(name, true);
+			fail("should not be able to create " + name + " twice");
+		} catch (AlreadyExistsException e) {
+		}
+	}
+
+	private String jName(String name) {
+		return "jena-test-AbstractTestGraphMaker-" + name;
+	}
+
+	@Test
+	public void testCanCreateTwice() {
+		String name = jName("bridge");
+		Graph g1 = graphMaker.createGraph(name, true);
+		Graph g2 = graphMaker.createGraph(name, false);
+		assertTrue("graphs should be the same", sameGraph(g1, g2));
+		Graph g3 = graphMaker.createGraph(name);
+		assertTrue("graphs should be the same", sameGraph(g1, g3));
+	}
+
+	/**
+	 * Test that we cannot open a graph that does not exist.
+	 */
+	@Test
+	public void testCannotOpenUncreated() {
+		String name = jName("noSuchGraph");
+		try {
+			graphMaker.openGraph(name, true);
+			fail(name + " should not exist");
+		} catch (DoesNotExistException e) {
+		}
+	}
+
+	/**
+	 * Test that we *can* open a graph that hasn't been created
+	 */
+	@Test
+	public void testCanOpenUncreated() {
+		String name = jName("willBeCreated");
+		Graph g1 = graphMaker.openGraph(name);
+		g1.close();
+		graphMaker.openGraph(name, true);
+	}
+
+	/**
+	 * Utility - test that a graph with the given name exists.
+	 */
+	private void testExists(String name) {
+		assertTrue(name + " should exist", graphMaker.hasGraph(name));
+	}
+
+	/**
+	 * Utility - test that no graph with the given name exists.
+	 */
+	private void testDoesNotExist(String name) {
+		assertFalse(name + " should exist", graphMaker.hasGraph(name));
+	}
+
+	/**
+	 * Test that we can find a graph once its been created. We need to know if
+	 * two graphs are "the same" here: we have a temporary work-around but it is
+	 * not sound.
+	 * 
+	 */
+	@Test
+	public void testCanFindCreatedGraph() {
+		String alpha = jName("alpha"), beta = jName("beta");
+		Graph g1 = graphMaker.createGraph(alpha, true);
+		Graph h1 = graphMaker.createGraph(beta, true);
+		Graph g2 = graphMaker.openGraph(alpha, true);
+		Graph h2 = graphMaker.openGraph(beta, true);
+		assertTrue("should find alpha", sameGraph(g1, g2));
+		assertTrue("should find beta", sameGraph(h1, h2));
+	}
+
+	/**
+	 * Weak test for "same graph": adding this to one is visible in t'other.
+	 * Stopgap for use in testCanFindCreatedGraph. TODO: clean that test up
+	 * (left over from RDB days)
+	 */
+	private boolean sameGraph(Graph g1, Graph g2) {
+		Node S = GraphTestUtils.node("S"), P = GraphTestUtils.node("P"), O = GraphTestUtils
+				.node("O");
+		g1.add(Triple.create(S, P, O));
+		g2.add(Triple.create(O, P, S));
+		return g2.contains(S, P, O) && g1.contains(O, P, S);
+	}
+
+	/**
+	 * Test that we can remove a graph from the factory without disturbing
+	 * another graph's binding.
+	 */
+	@Test
+	public void testCanRemoveGraph() {
+		String alpha = jName("bingo"), beta = jName("brillo");
+		graphMaker.createGraph(alpha, true);
+		graphMaker.createGraph(beta, true);
+		testExists(alpha);
+		testExists(beta);
+		graphMaker.removeGraph(alpha);
+		testExists(beta);
+		testDoesNotExist(alpha);
+	}
+
+	@Test
+	public void testHasnt() {
+		assertFalse("no such graph", graphMaker.hasGraph("john"));
+		assertFalse("no such graph", graphMaker.hasGraph("paul"));
+		assertFalse("no such graph", graphMaker.hasGraph("george"));
+		/* */
+		graphMaker.createGraph("john", true);
+		assertTrue("john now exists", graphMaker.hasGraph("john"));
+		assertFalse("no such graph", graphMaker.hasGraph("paul"));
+		assertFalse("no such graph", graphMaker.hasGraph("george"));
+		/* */
+		graphMaker.createGraph("paul", true);
+		assertTrue("john still exists", graphMaker.hasGraph("john"));
+		assertTrue("paul now exists", graphMaker.hasGraph("paul"));
+		assertFalse("no such graph", graphMaker.hasGraph("george"));
+		/* */
+		graphMaker.removeGraph("john");
+		assertFalse("john has been removed", graphMaker.hasGraph("john"));
+		assertTrue("paul still exists", graphMaker.hasGraph("paul"));
+		assertFalse("no such graph", graphMaker.hasGraph("george"));
+	}
+
+	@Test
+	public void testCarefulClose() {
+		Graph x = graphMaker.createGraph("x");
+		Graph y = graphMaker.openGraph("x");
+		x.add(GraphTestUtils.triple("a BB c"));
+		x.close();
+		y.add(GraphTestUtils.triple("p RR q"));
+		y.close();
+	}
+
+	/**
+	 * Test that a maker with no graphs lists no names.
+	 */
+	@Test
+	public void testListNoGraphs() {
+		Set<String> s = graphMaker.listGraphs().toSet();
+		if (s.size() > 0)
+			fail("found names from 'empty' graph maker: " + s);
+	}
+
+	/**
+	 * Test that a maker with three graphs inserted lists those three grapsh; we
+	 * don't mind what order they appear in. We also use funny names to ensure
+	 * that the spelling that goes in is the one that comes out [should really
+	 * be in a separate test].
+	 */
+	@Test
+	public void testListThreeGraphs() {
+		String x = "x", y = "y/sub", z = "z:boo";
+		Graph X = graphMaker.createGraph(x);
+		Graph Y = graphMaker.createGraph(y);
+		Graph Z = graphMaker.createGraph(z);
+		Set<String> wanted = TestUtils.setOfStrings(x + " " + y + " " + z);
+		assertEquals(wanted, GraphTestUtils.iteratorToSet(graphMaker.listGraphs()));
+		X.close();
+		Y.close();
+		Z.close();
+	}
+
+	/**
+	 * Test that a maker with some things put in and then some removed gets the
+	 * right things listed.
+	 */
+	@Test
+	public void testListAfterDelete() {
+		String x = "x_y", y = "y//zub", z = "a:b/c";
+		Graph X = graphMaker.createGraph(x);
+		Graph Y = graphMaker.createGraph(y);
+		Graph Z = graphMaker.createGraph(z);
+		graphMaker.removeGraph(x);
+		Set<String> s = GraphTestUtils.iteratorToSet(graphMaker.listGraphs());
+		assertEquals(TestUtils.setOfStrings(y + " " + z), s);
+		X.close();
+		Y.close();
+		Z.close();
+	}
+
+}

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphPrefixMappingTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphPrefixMappingTest.java?rev=1520740&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphPrefixMappingTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphPrefixMappingTest.java Sat Sep  7 07:48:51 2013
@@ -0,0 +1,57 @@
+/*
+ * 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.graph;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.Factory;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.shared.AbstractPrefixMappingTest;
+import com.hp.hpl.jena.shared.PrefixMapping;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.GraphProducerUserInterface;
+
+public abstract class AbstractGraphPrefixMappingTest extends AbstractPrefixMappingTest implements GraphProducerUserInterface
+    {
+	
+	@After
+	public void teardown()
+	{
+		getGraphProducer().closeGraphs();
+	}
+	
+	 protected PrefixMapping getMapping() {
+		 return getGraphProducer().newGraph().getPrefixMapping();
+	 }
+    
+	 @Test
+    public void testGraphPrefixMapping()
+        { 
+		 Graph g = getGraphProducer().newGraph();
+		 PrefixMapping pm = g.getPrefixMapping();
+	     pm.setNsPrefix( "crisp", crispURI );
+	     pm.setNsPrefix( "butter", butterURI );
+	     
+	     assertTrue( pm == g.getPrefixMapping() );
+        }
+    }

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

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphSuite.java?rev=1520740&r1=1520739&r2=1520740&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphSuite.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphSuite.java Sat Sep  7 07:48:51 2013
@@ -4,6 +4,8 @@ import org.junit.Ignore;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+
 
 /*
  TestSuite result = new TestSuite( WrappedGraphTest.class );
@@ -20,7 +22,10 @@ import org.junit.runners.Suite;
 		AbstractGraphSuite.FindLiterals.class,
 		AbstractGraphSuite.ExtractTest.class,
 		AbstractGraphSuite.EventManagerTest.class,
-		AbstractGraphSuite.TransactionTest.class, })
+		AbstractGraphSuite.TransactionTest.class,
+		AbstractGraphSuite.RegisterListenerTest.class,
+		AbstractGraphSuite.ListenerTest.class,
+		AbstractGraphSuite.PrefixMappingTest.class})
 @Ignore
 public abstract class AbstractGraphSuite {
 
@@ -32,15 +37,14 @@ public abstract class AbstractGraphSuite
 
 	public static class GraphTest extends AbstractGraphTest {
 		@Override
-		protected GraphProducerInterface getGraphProducer() {
+		public GraphProducerInterface getGraphProducer() {
 			return AbstractGraphSuite.graphProducer;
 		}
-
 	}
 
 	public static class ReifierTest extends AbstractReifierTest {
 		@Override
-		protected GraphProducerInterface getGraphProducer() {
+		public GraphProducerInterface getGraphProducer() {
 			return AbstractGraphSuite.graphProducer;
 		}
 	}
@@ -54,22 +58,44 @@ public abstract class AbstractGraphSuite
 
 	public static class ExtractTest extends AbstractGraphExtractTest {
 		@Override
-		protected GraphProducerInterface getGraphProducer() {
+		public GraphProducerInterface getGraphProducer() {
 			return AbstractGraphSuite.graphProducer;
 		}
 	}
 
 	public static class EventManagerTest extends AbstractEventManagerTest {
 		@Override
-		protected GraphProducerInterface getGraphProducer() {
+		public GraphProducerInterface getGraphProducer() {
 			return AbstractGraphSuite.graphProducer;
 		}
 	}
 
 	public static class TransactionTest extends AbstractTransactionHandlerTest {
 		@Override
-		protected GraphProducerInterface getGraphProducer() {
+		public GraphProducerInterface getGraphProducer() {
+			return AbstractGraphSuite.graphProducer;
+		}
+	}
+	
+	public static class RegisterListenerTest extends AbstractRegisterGraphListenerTest {
+		@Override
+		public GraphProducerInterface getGraphProducer() {
+			return AbstractGraphSuite.graphProducer;
+		}
+	}
+	
+	public static class ListenerTest extends AbstractGraphListenerTest {
+		@Override
+		public GraphProducerInterface getGraphProducer() {
+			return AbstractGraphSuite.graphProducer;
+		}
+	}
+	
+	public static class PrefixMappingTest extends AbstractGraphPrefixMappingTest {
+		@Override
+		public GraphProducerInterface getGraphProducer() {
 			return AbstractGraphSuite.graphProducer;
 		}
 	}
+	
 }

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=1520740&r1=1520739&r2=1520740&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 07:48:51 2013
@@ -44,6 +44,7 @@ import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
 import com.hp.hpl.jena.rdf.model.impl.ReifierStd;
 import com.hp.hpl.jena.shared.ClosedException;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducerUser;
 import com.hp.hpl.jena.util.CollectionFactory;
 import com.hp.hpl.jena.util.iterator.ClosableIterator;
 import com.hp.hpl.jena.util.iterator.ExtendedIterator;
@@ -122,16 +123,16 @@ public abstract class AbstractGraphTest 
 
 	@Test
 	public void testContainsConcrete() {
-		Graph g = graphWithTxn("s P o; _x p2 _y; x S 0");
-		assertTrue(g.contains(triple("s P o")));
-		assertTrue(g.contains(triple("_x p2 _y")));
-		assertTrue(g.contains(triple("x S 0")));
-		/* */
-		assertFalse(g.contains(triple("s P Oh")));
-		assertFalse(g.contains(triple("S P O")));
-		assertFalse(g.contains(triple("s p o")));
-		assertFalse(g.contains(triple("_x _r _y")));
-		assertFalse(g.contains(triple("x S 1")));
+		Graph g = graphWithTxn( "s P o; _x _R _y; x S 0" );
+        assertTrue( g.contains( triple( "s P o" ) ) );
+        assertTrue( g.contains( triple( "_x _R _y" ) ) );
+        assertTrue( g.contains( triple( "x S 0" ) ) );
+        /* */
+        assertFalse( g.contains( triple( "s P Oh" ) ) );
+        assertFalse( g.contains( triple( "S P O" ) ) );
+        assertFalse( g.contains( triple( "s p o" ) ) );
+        assertFalse( g.contains( triple( "_x _r _y" ) ) );
+        assertFalse( g.contains( triple( "x S 1" ) ) );
 	}
 
 	@Test

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractRegisterGraphListenerTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractRegisterGraphListenerTest.java?rev=1520740&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractRegisterGraphListenerTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractRegisterGraphListenerTest.java Sat Sep  7 07:48:51 2013
@@ -0,0 +1,183 @@
+/*
+ * 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.graph;
+
+import static org.junit.Assert.*;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.GraphListener;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducerUser;
+
+/**
+ * These tests are for listeners that add or delete
+ * other listeners.
+ * It motivates the use of, e.g. CopyOnWriteArrayList
+ * for storing listeners.
+ */
+public abstract class AbstractRegisterGraphListenerTest extends AbstractGraphProducerUser {
+
+	private ComeAndGoListener all[];
+	private Graph graph;	
+	
+	private static final class SimpleListener extends ComeAndGoListener {
+		@Override
+		void doSomeDamage() {}
+	}
+
+	@Before
+	public void setup()
+	{
+		graph = getGraphProducer().newGraph();
+	}
+	
+	abstract private static class ComeAndGoListener implements GraphListener {
+
+		// Was I registered when start() was called, and have not been unregistered.
+		boolean inPlay = false;
+		// currently registered or not.
+		boolean registered = false;
+		boolean notified = false;
+		void registerWith(Graph g) {
+			registered= true;
+		   g.getEventManager().register(this);	
+		}
+		void unregisterFrom(Graph g) {
+			registered = false;
+			inPlay = false;
+			g.getEventManager().unregister(this);
+		}
+		void start() {
+			if (registered) inPlay = true;
+		}
+		void check() {
+			if (inPlay && !notified) fail("listener that was in-play was not notified of adding triple.");
+		}
+		
+        @Override
+        final public void notifyAddTriple(Graph g, Triple t) {
+			notified = true;
+			doSomeDamage();
+		}
+		abstract void doSomeDamage();
+		
+		@Override
+        public void notifyAddArray(Graph g, Triple[] triples) {}
+		@Override
+        public void notifyAddGraph(Graph g, Graph added) {}
+		@Override
+        public void notifyAddIterator(Graph g, Iterator<Triple> it) {}
+		@Override
+        public void notifyAddList(Graph g, List<Triple> triples) {}
+		@Override
+        public void notifyDeleteArray(Graph g, Triple[] triples) {}
+		@Override
+        public void notifyDeleteGraph(Graph g, Graph removed) {}
+		@Override
+        public void notifyDeleteIterator(Graph g, Iterator<Triple> it) {}
+		@Override
+        public void notifyDeleteList(Graph g, List<Triple> L) {}
+		@Override
+        public void notifyDeleteTriple(Graph g, Triple t) {}
+		@Override
+        public void notifyEvent(Graph source, Object value) {}
+		
+	}
+	
+	
+	private void testAddingTriple(int addMe, ComeAndGoListener ...allx) {
+		all = allx;
+		for (int i=0;i<addMe;i++) {
+			all[i].registerWith(graph); 
+		} // 4 is unregistered.
+		for (ComeAndGoListener l:all) {
+			l.start();
+		}
+		graph.add(GraphTestUtils.triple("make a change" ));
+		for (ComeAndGoListener l:all) {
+			l.check();
+		}
+	}
+	
+	@Test
+	public void testAddOne() {
+		testAddingTriple(2,
+				new ComeAndGoListener(){
+					@Override
+					void doSomeDamage() {
+						all[2].registerWith(graph);
+					}},
+				new SimpleListener(),
+				new SimpleListener());
+	}
+	
+	@Test
+	public void testDelete2nd() {
+		testAddingTriple(3,
+				new ComeAndGoListener(){
+					@Override
+					void doSomeDamage() {
+						all[1].unregisterFrom(graph);
+					}},
+				new SimpleListener(),
+				new SimpleListener());
+	}
+	@Test
+	public void testDelete1st() {
+		testAddingTriple(3,
+				new SimpleListener(),
+				new ComeAndGoListener(){
+					@Override
+					void doSomeDamage() {
+						all[0].unregisterFrom(graph);
+					}},
+				new SimpleListener());
+	}
+	@Test
+	public void testDeleteSelf() {
+		testAddingTriple(3,
+				new ComeAndGoListener(){
+					@Override
+					void doSomeDamage() {
+						unregisterFrom(graph);
+					}},
+				new SimpleListener(),
+				new SimpleListener());
+	}
+	@Test
+	public void testDeleteAndAddSelf() {
+		testAddingTriple(3,
+				new ComeAndGoListener(){
+					@Override
+					void doSomeDamage() {
+						unregisterFrom(graph);
+						registerWith(graph);
+					}},
+				new SimpleListener(),
+				new SimpleListener());
+	}
+
+}

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

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractReifierTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractReifierTest.java?rev=1520740&r1=1520739&r2=1520740&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractReifierTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractReifierTest.java Sat Sep  7 07:48:51 2013
@@ -26,6 +26,7 @@ import org.junit.Test;
 import com.hp.hpl.jena.rdf.model.impl.ReifierStd;
 import com.hp.hpl.jena.shared.AlreadyReifiedException;
 import com.hp.hpl.jena.shared.CannotReifyException;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducerUser;
 import com.hp.hpl.jena.vocabulary.RDF;
 
 /**

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractTransactionHandlerTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractTransactionHandlerTest.java?rev=1520740&r1=1520739&r2=1520740&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractTransactionHandlerTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractTransactionHandlerTest.java Sat Sep  7 07:48:51 2013
@@ -32,6 +32,7 @@ import com.hp.hpl.jena.graph.Transaction
 import com.hp.hpl.jena.graph.Triple;
 import com.hp.hpl.jena.shared.Command;
 import com.hp.hpl.jena.shared.JenaException;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducerUser;
 import com.hp.hpl.jena.util.CollectionFactory;
 import com.hp.hpl.jena.util.FileUtils;
 import static com.hp.hpl.jena.graph.GraphTestUtils.*;

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/GraphTestUtils.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/GraphTestUtils.java?rev=1520740&r1=1520739&r2=1520740&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/GraphTestUtils.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/GraphTestUtils.java Sat Sep  7 07:48:51 2013
@@ -206,13 +206,13 @@ public class GraphTestUtils extends Test
 		return result;
 	}
 
-	//
-	// /**
-	// Answer a new memory-based graph with initial contents as described
-	// by <code>s</code> in the fashion of <code>graphAdd()</code>.
-	// Not over-ridable; do not use for abstraction.
-	// */
-	private static Graph graphWith(String s) {
+	
+	 /**
+	 Answer a new memory-based graph with initial contents as described
+	 by <code>s</code> in the fashion of <code>graphAdd()</code>.
+	 Not over-ridable; do not use for abstraction.
+	 */
+	public static Graph graphWith(String s) {
 		return graphWith(newGraph(), s);
 	}
 

Added: 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/graph/MemGraphListenerTest.java?rev=1520740&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphListenerTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphListenerTest.java Sat Sep  7 07:48:51 2013
@@ -0,0 +1,14 @@
+package com.hp.hpl.jena.graph;
+
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+
+public class MemGraphListenerTest extends AbstractGraphListenerTest {
+
+	GraphProducerInterface graphProducer = new MemGraphSuite.GraphProducer();
+
+	@Override
+	public GraphProducerInterface getGraphProducer() {
+		return graphProducer;
+	}
+
+}

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

Added: 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/graph/MemGraphPrefixMappingTest.java?rev=1520740&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphPrefixMappingTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphPrefixMappingTest.java Sat Sep  7 07:48:51 2013
@@ -0,0 +1,43 @@
+/*
+ * 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.graph;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.Factory;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.shared.AbstractPrefixMappingTest;
+import com.hp.hpl.jena.shared.PrefixMapping;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+
+public class MemGraphPrefixMappingTest extends AbstractGraphPrefixMappingTest
+    {
+		private GraphProducerInterface graphProducer = new MemGraphSuite.GraphProducer();
+
+	@Override
+	public GraphProducerInterface getGraphProducer() {
+		return graphProducer;
+	}
+	
+}

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

Added: 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/graph/MemGraphRegisterListenerTest.java?rev=1520740&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphRegisterListenerTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphRegisterListenerTest.java Sat Sep  7 07:48:51 2013
@@ -0,0 +1,14 @@
+package com.hp.hpl.jena.graph;
+
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+
+public class MemGraphRegisterListenerTest extends AbstractRegisterGraphListenerTest {
+
+	GraphProducerInterface graphProducer = new MemGraphSuite.GraphProducer();
+
+	@Override
+	public GraphProducerInterface getGraphProducer() {
+		return graphProducer;
+	}
+
+}

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

Added: 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/graph/MemGraphReifierTest.java?rev=1520740&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphReifierTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphReifierTest.java Sat Sep  7 07:48:51 2013
@@ -0,0 +1,47 @@
+/*
+ * 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.graph;
+
+import java.lang.reflect.Constructor ;
+
+import junit.framework.TestSuite ;
+
+import com.hp.hpl.jena.graph.Graph ;
+import com.hp.hpl.jena.mem.GraphMem ;
+import com.hp.hpl.jena.shared.JenaException ;
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+
+/**
+    This class tests the reifiers of ordinary GraphMem graphs.
+    Old test suite - kept to ensure compatibility for teh one and only Standard mode 
+*/
+
+public class MemGraphReifierTest extends AbstractReifierTest
+    {
+    
+	GraphProducerInterface graphProducer = new MemGraphSuite.GraphProducer();
+
+	@Override
+	public GraphProducerInterface getGraphProducer() {
+		return graphProducer;
+	}
+    
+        
+    
+}

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

Modified: 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/graph/MemGraphSuite.java?rev=1520740&r1=1520739&r2=1520740&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/graph/MemGraphSuite.java Sat Sep  7 07:48:51 2013
@@ -3,6 +3,7 @@ package com.hp.hpl.jena.graph;
 import org.junit.BeforeClass;
 
 import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
 
 public class MemGraphSuite extends AbstractGraphSuite {
 

Modified: 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/graph/MemGraphTest.java?rev=1520740&r1=1520739&r2=1520740&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/graph/MemGraphTest.java Sat Sep  7 07:48:51 2013
@@ -1,11 +1,13 @@
 package com.hp.hpl.jena.graph;
 
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+
 public class MemGraphTest extends AbstractGraphTest {
 
 	GraphProducerInterface graphProducer = new MemGraphSuite.GraphProducer();
 
 	@Override
-	protected GraphProducerInterface getGraphProducer() {
+	public GraphProducerInterface getGraphProducer() {
 		return graphProducer;
 	}
 

Added: 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=1520740&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphMatchWithInference.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphMatchWithInference.java Sat Sep  7 07:48:51 2013
@@ -0,0 +1,47 @@
+/*
+ * 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.graph;
+
+import com.hp.hpl.jena.rdf.model.*;
+
+import junit.framework.*;
+
+/**
+    Test that an inferred graph and an identical concrete graph 
+    compare as equal.
+*/
+// FIXME move this to model testing.
+public class TestGraphMatchWithInference 
+    {
+    
+        
+    @Test
+    public void testInferedIsomorphic()
+        {
+        Model mrdfs = ModelFactory.createRDFSModel(ModelFactory.createDefaultModel());
+        Model concrete = ModelFactory.createDefaultModel();
+        concrete.add(mrdfs);
+        
+        assertIsomorphic( concrete.getGraph(),  mrdfs.getGraph() );
+        
+        assertIsomorphic( mrdfs.getGraph(), concrete.getGraph() );
+        }
+    
+       
+    }

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphUtils.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphUtils.java?rev=1520740&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphUtils.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphUtils.java Sat Sep  7 07:48:51 2013
@@ -0,0 +1,58 @@
+/*
+ * 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.graph;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.impl.GraphBase;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+
+
+
+public class TestGraphUtils 
+    {
+        
+    private static class Bool 
+        {
+        boolean value;
+        Bool( boolean value ) { this.value = value; }
+        }
+        
+    @Test
+    public void testFindAll()
+        {
+        final Bool foundAll = new Bool( false );
+        Graph mock = new GraphBase() 
+            {
+            @Override public ExtendedIterator<Triple> graphBaseFind( TripleMatch m )
+                { 
+                Triple t = m.asTriple();
+                assertEquals( Node.ANY, t.getSubject() ); 
+                assertEquals( Node.ANY, t.getPredicate() );
+                assertEquals( Node.ANY, t.getObject() );
+                foundAll.value = true;
+                return null;
+                }
+            };
+        GraphUtil.findAll( mock );
+        assertTrue( "find(ANY, ANY, ANY) called", foundAll.value );
+        }
+    }

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestLiteralLabels.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestLiteralLabels.java?rev=1520740&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestLiteralLabels.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestLiteralLabels.java Sat Sep  7 07:48:51 2013
@@ -0,0 +1,127 @@
+/*
+ * 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.graph;
+
+
+import static com.hp.hpl.jena.graph.GraphTestUtils.*;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.datatypes.BaseDatatype;
+import com.hp.hpl.jena.datatypes.RDFDatatype;
+import com.hp.hpl.jena.graph.impl.LiteralLabel;
+import com.hp.hpl.jena.graph.impl.LiteralLabelFactory;
+
+
+public class TestLiteralLabels
+{
+	private void assertEq( LiteralLabel ll1, LiteralLabel ll2)
+	{
+		 assertEquivalent( ll1, ll2 );
+	     assertTrue(ll1.sameValueAs(ll2)) ;
+	}
+   
+	@Test
+    public void testBlankLanguageEquality()
+    {
+       assertEq( LiteralLabelFactory.create("test", "", null), 
+    		   LiteralLabelFactory.create("test", "", null)) ;
+    }
+
+	@Test
+    public void testBase64BinaryEquality()
+    {
+        assertEq( node("'0123'http://www.w3.org/2001/XMLSchema#base64Binary").getLiteral() ,
+        		node("'0123'http://www.w3.org/2001/XMLSchema#base64Binary").getLiteral() );
+    }
+
+	@Test
+    public void testIllegalBase64BinaryEquality()
+    {
+        assertEq( node("'illgeal'http://www.w3.org/2001/XMLSchema#base64Binary").getLiteral() ,
+        node("'illgeal'http://www.w3.org/2001/XMLSchema#base64Binary").getLiteral() );
+    }
+
+	@Test
+    public void testHexBinaryEquality()
+    {
+        assertEq( node("'0123'http://www.w3.org/2001/XMLSchema#hexBinary").getLiteral() ,
+          node("'0123'http://www.w3.org/2001/XMLSchema#hexBinary").getLiteral() );
+    }
+
+	@Test
+    public void testIllegalHexBinaryEquality()
+    {
+        assertEq( node("'illegal'http://www.w3.org/2001/XMLSchema#hexBinary").getLiteral() ,
+        		node("'illegal'http://www.w3.org/2001/XMLSchema#hexBinary").getLiteral() ) ;
+    }
+
+	@Test
+    public void testDatatypeIsEqualsNotCalledIfSecondOperandIsNotTyped()
+    {
+        RDFDatatype d = new BaseDatatype("eh:/FakeDataType") {
+            @Override
+            public boolean isEqual(LiteralLabel ll1, LiteralLabel ll2)
+            {
+                fail("RDFDatatype::isEquals should not be called if B has no datatype") ;
+                return false ;
+            }
+        } ;
+        LiteralLabel ll1 = LiteralLabelFactory.create("17", "", d) ;
+        LiteralLabel ll2 = LiteralLabelFactory.create("17", "", null) ;
+        assertFalse(ll1.sameValueAs(ll2)) ;
+    }
+
+	@Test
+    public void testStringEquality()
+    {
+        assertEq( LiteralLabelFactory.create("xyz"),
+         LiteralLabelFactory.create("xyz") ) ;
+    }
+    
+	@Test
+    public void testDifferentCaseStringInequality()
+    {
+        LiteralLabel ll1 = LiteralLabelFactory.create("xyz");
+        LiteralLabel ll2 = LiteralLabelFactory.create("XYZ");
+        
+        assertFalse(ll1.equals(ll2)) ;
+        assertFalse(ll1.sameValueAs(ll2)) ;
+    }
+
+	@Test
+    public void testDifferentLanguageStringInequality()
+    {
+		LiteralLabel ll1 = LiteralLabelFactory.create("xyz", "en-us") ;
+        LiteralLabel ll2 = LiteralLabelFactory.create("xyz", "en-uk") ;
+        assertFalse(ll1.equals(ll2)) ;
+        assertFalse(ll1.sameValueAs(ll2)) ;
+    }
+
+	@Test
+    public void testDifferentLanguageStringCaseInequality()
+    {
+		LiteralLabel ll1 = LiteralLabelFactory.create("xyz", "en-UK") ;
+        LiteralLabel ll2 = LiteralLabelFactory.create("xyz", "en-uk") ;
+        assertFalse(ll1.equals(ll2)) ;
+        assertTrue(ll1.sameValueAs(ll2)) ;
+    }
+    
+}

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