jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cla...@apache.org
Subject svn commit: r1525287 [5/6] - in /jena/Experimental/new-test/src/test: java/com/hp/hpl/jena/rdf/model/ java/com/hp/hpl/jena/rdf/model/temp/ java/com/hp/hpl/jena/testing_framework/ resources/ resources/com/hp/hpl/jena/rdf/ resources/com/hp/hpl/jena/rdf/m...
Date Sat, 21 Sep 2013 20:12:00 GMT
Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelGraphInterfaceContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelGraphInterfaceContractTests.java?rev=1525287&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelGraphInterfaceContractTests.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelGraphInterfaceContractTests.java Sat Sep 21 20:11:59 2013
@@ -0,0 +1,98 @@
+package com.hp.hpl.jena.rdf.model;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.NodeFactory;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.graph.test.NodeCreateUtils;
+
+public abstract class AbstractModelGraphInterfaceContractTests {
+	
+	private static Logger log = LoggerFactory
+			.getLogger(AbstractModelGraphInterfaceContractTests.class);
+
+
+	abstract protected ModelGraphInterface getModelGraphInterface();
+	
+	
+	@Test
+	public void testAsRDFNode()
+	{
+		// check URI resource
+		RDFNode r = getModelGraphInterface().asRDFNode( NodeCreateUtils.create("A") );
+		
+		assertTrue( "Should have been a URI resource", r.isURIResource() );
+		assertEquals( "Does not have the proper resource", "eh:/A", r.asResource().getURI());
+		
+		// check literal
+		r = getModelGraphInterface().asRDFNode( NodeFactory.createLiteral("A"));
+		
+		assertTrue( "Should have been a literal resource", r.isLiteral() );
+		assertEquals( "Does not have the proper literal value", "A", r.asLiteral().getString());
+		
+		// check anonymous
+		Node n = NodeFactory.createAnon();
+		r = getModelGraphInterface().asRDFNode( n );
+		
+		assertTrue( "Should have been an anonymous resource", r.isAnon() );
+		assertEquals( "Does not have the proper literal value", n.getBlankNodeId(), r.asResource().getId());
+
+		
+		AnonId anonId = AnonId.create("foo");
+		r = getModelGraphInterface().asRDFNode(  NodeFactory.createAnon( anonId ) );
+		
+		assertTrue( "Should have been an anonymous resource", r.isAnon() );
+		assertEquals( "Does not have the proper literal value", anonId, r.asResource().getId());
+
+	}
+	
+	@Test
+	public void testAsStatement()
+	{
+		Triple t = new Triple( NodeFactory.createAnon(), NodeCreateUtils.create("A"), NodeFactory.createLiteral("B"));
+		
+		Statement s = getModelGraphInterface().asStatement( t );
+		
+		assertEquals( t.getSubject(), s.getSubject().asNode());
+		assertEquals( t.getPredicate(), s.getPredicate().asNode());
+		assertEquals( t.getObject(), s.getObject().asNode());
+	}
+	
+	@Test
+	public void testGetGraph()
+	{
+		assertNotNull( getModelGraphInterface().getGraph() );
+		
+	}
+	
+	@Test
+	public void testWrapAsResource()
+	{
+		// check URI resource
+		Resource r = getModelGraphInterface().wrapAsResource( NodeCreateUtils.create("A") );
+		
+		assertTrue( "Should have been a URI resource", r.isURIResource() );
+		assertEquals( "Does not have the proper resource", "eh:/A", r.asResource().getURI());
+				
+		// check anonymous
+		Node n = NodeFactory.createAnon();
+		r = getModelGraphInterface().wrapAsResource( n );
+		
+		assertTrue( "Should have been an anonymous resource", r.isAnon() );
+		assertEquals( "Does not have the proper literal value", n.getBlankNodeId(), r.asResource().getId());
+
+		
+		AnonId anonId = AnonId.create("foo");
+		r = getModelGraphInterface().wrapAsResource(  NodeFactory.createAnon( anonId ) );
+		
+		assertTrue( "Should have been an anonymous resource", r.isAnon() );
+		assertEquals( "Does not have the proper literal value", anonId, r.asResource().getId());
+
+	}
+	
+}

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

Copied: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFListContractTests.java (from r1523135, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFListTest.java)
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFListContractTests.java?p2=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFListContractTests.java&p1=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFListTest.java&r1=1523135&r2=1525287&rev=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFListTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFListContractTests.java Sat Sep 21 20:11:59 2013
@@ -59,7 +59,7 @@ import org.slf4j.LoggerFactory;
  * 
  * 
  */
-public class AbstractRDFListTest extends
+public class AbstractRDFListContractTests extends
 AbstractModelProducerUser  {
 	
 	@Override
@@ -71,7 +71,7 @@ AbstractModelProducerUser  {
 	private Model model;
 	
 	@Before
-	public void setupAbstractRDFListTest()
+	final public void setupAbstractRDFListTest()
 	{
 		model = getModelProducer().newModel();	
 	}
@@ -85,7 +85,7 @@ AbstractModelProducerUser  {
 	protected static void iteratorTest( final Iterator<?> i,
 			final Object[] expected )
 	{
-		final Logger logger = LoggerFactory.getLogger(AbstractRDFListTest.class);
+		final Logger logger = LoggerFactory.getLogger(AbstractRDFListContractTests.class);
 		final List<Object> expList = new ArrayList<Object>();
 		for (final Object element : expected)
 		{
@@ -186,11 +186,11 @@ AbstractModelProducerUser  {
 
 	protected RDFList getListRoot( final Model m )
 	{
-		final Resource root = m.getResource(AbstractRDFListTest.NS + "root");
+		final Resource root = m.getResource(AbstractRDFListContractTests.NS + "root");
 		Assert.assertNotNull("Root resource should not be null", root);
 
 		final Resource listHead = root.getRequiredProperty(
-				m.getProperty(AbstractRDFListTest.NS + "p")).getResource();
+				m.getProperty(AbstractRDFListContractTests.NS + "p")).getResource();
 
 		final RDFList l = listHead.as(RDFList.class);
 		Assert.assertNotNull("as(RDFList) should not return null for root", l);
@@ -202,18 +202,18 @@ AbstractModelProducerUser  {
 	public void testAdd()
 	{
 
-		final Resource root = model.createResource(AbstractRDFListTest.NS + "root");
-		final Property p = model.createProperty(AbstractRDFListTest.NS, "p");
+		final Resource root = model.createResource(AbstractRDFListContractTests.NS + "root");
+		final Property p = model.createProperty(AbstractRDFListContractTests.NS, "p");
 
 		final Resource nil = model.getResource(RDF.nil.getURI());
 		RDFList list = nil.as(RDFList.class);
 
 		final Resource[] toAdd = new Resource[] {
-				model.createResource(AbstractRDFListTest.NS + "a"),
-				model.createResource(AbstractRDFListTest.NS + "b"),
-				model.createResource(AbstractRDFListTest.NS + "c"),
-				model.createResource(AbstractRDFListTest.NS + "d"),
-				model.createResource(AbstractRDFListTest.NS + "e"), };
+				model.createResource(AbstractRDFListContractTests.NS + "a"),
+				model.createResource(AbstractRDFListContractTests.NS + "b"),
+				model.createResource(AbstractRDFListContractTests.NS + "c"),
+				model.createResource(AbstractRDFListContractTests.NS + "d"),
+				model.createResource(AbstractRDFListContractTests.NS + "e"), };
 
 		// add each of these resources onto the end of the list
 		for (final Resource element : toAdd)
@@ -247,7 +247,7 @@ AbstractModelProducerUser  {
 		final Resource nil = model.getResource(RDF.nil.getURI());
 		RDFList list = nil.as(RDFList.class);
 
-		final Resource r = model.createResource(AbstractRDFListTest.NS + "foo");
+		final Resource r = model.createResource(AbstractRDFListContractTests.NS + "foo");
 
 		// create a list of foos
 		for (int i = 0; i < 5; i++)
@@ -313,7 +313,7 @@ AbstractModelProducerUser  {
 		final Resource nil = model.getResource(RDF.nil.getURI());
 		RDFList list = nil.as(RDFList.class);
 
-		final Resource r = model.createResource(AbstractRDFListTest.NS + "foo");
+		final Resource r = model.createResource(AbstractRDFListContractTests.NS + "foo");
 
 		// create a list of foos
 		for (int i = 0; i < 5; i++)
@@ -344,14 +344,14 @@ AbstractModelProducerUser  {
 	{
 		model.read(getFileName("ontology/list5.rdf"));
 
-		final Resource a = model.createResource(AbstractRDFListTest.NS + "a");
+		final Resource a = model.createResource(AbstractRDFListContractTests.NS + "a");
 
 		// create a list of foos
 		final Resource[] rs = new Resource[] {
-				model.createResource(AbstractRDFListTest.NS + "b"),
-				model.createResource(AbstractRDFListTest.NS + "c"),
-				model.createResource(AbstractRDFListTest.NS + "d"),
-				model.createResource(AbstractRDFListTest.NS + "e") };
+				model.createResource(AbstractRDFListContractTests.NS + "b"),
+				model.createResource(AbstractRDFListContractTests.NS + "c"),
+				model.createResource(AbstractRDFListContractTests.NS + "d"),
+				model.createResource(AbstractRDFListContractTests.NS + "e") };
 
 		final RDFList aList = model.createList().cons(a);
 		final RDFList rsList = model.createList(rs);
@@ -368,18 +368,18 @@ AbstractModelProducerUser  {
 	@Test
 	public void testCons()
 	{
-		final Resource root = model.createResource(AbstractRDFListTest.NS + "root");
-		final Property p = model.createProperty(AbstractRDFListTest.NS, "p");
+		final Resource root = model.createResource(AbstractRDFListContractTests.NS + "root");
+		final Property p = model.createProperty(AbstractRDFListContractTests.NS, "p");
 
 		final Resource nil = model.getResource(RDF.nil.getURI());
 		RDFList list = nil.as(RDFList.class);
 
 		final Resource[] toAdd = new Resource[] {
-				model.createResource(AbstractRDFListTest.NS + "e"),
-				model.createResource(AbstractRDFListTest.NS + "d"),
-				model.createResource(AbstractRDFListTest.NS + "c"),
-				model.createResource(AbstractRDFListTest.NS + "b"),
-				model.createResource(AbstractRDFListTest.NS + "a"), };
+				model.createResource(AbstractRDFListContractTests.NS + "e"),
+				model.createResource(AbstractRDFListContractTests.NS + "d"),
+				model.createResource(AbstractRDFListContractTests.NS + "c"),
+				model.createResource(AbstractRDFListContractTests.NS + "b"),
+				model.createResource(AbstractRDFListContractTests.NS + "a"), };
 
 		// cons each of these resources onto the front of the list
 		for (final Resource element : toAdd)
@@ -428,7 +428,7 @@ AbstractModelProducerUser  {
 		final String[] names = { "a", "b", "c", "d", "e" };
 		for (final String name : names)
 		{
-			Assert.assertEquals("head of list has incorrect URI", AbstractRDFListTest.NS
+			Assert.assertEquals("head of list has incorrect URI", AbstractRDFListContractTests.NS
 					+ name, ((Resource) l0.getHead()).getURI());
 			l0 = l0.getTail();
 		}
@@ -440,11 +440,11 @@ AbstractModelProducerUser  {
 		model.read(getFileName("ontology/list5.rdf"));
 
 		final Resource[] toGet = new Resource[] {
-				model.createResource(AbstractRDFListTest.NS + "a"),
-				model.createResource(AbstractRDFListTest.NS + "b"),
-				model.createResource(AbstractRDFListTest.NS + "c"),
-				model.createResource(AbstractRDFListTest.NS + "d"),
-				model.createResource(AbstractRDFListTest.NS + "e"), };
+				model.createResource(AbstractRDFListContractTests.NS + "a"),
+				model.createResource(AbstractRDFListContractTests.NS + "b"),
+				model.createResource(AbstractRDFListContractTests.NS + "c"),
+				model.createResource(AbstractRDFListContractTests.NS + "d"),
+				model.createResource(AbstractRDFListContractTests.NS + "e"), };
 
 		final RDFList l1 = getListRoot(model);
 
@@ -465,7 +465,7 @@ AbstractModelProducerUser  {
 		final Resource nil = model.getResource(RDF.nil.getURI());
 		RDFList list = nil.as(RDFList.class);
 
-		final Resource r = model.createResource(AbstractRDFListTest.NS + "a");
+		final Resource r = model.createResource(AbstractRDFListContractTests.NS + "a");
 
 		// cons each a's onto the front of the list
 		for (int i = 0; i < 10; i++)
@@ -490,36 +490,36 @@ AbstractModelProducerUser  {
 
 		// create a list of foos
 		final Resource[] r0 = new Resource[] {
-				model.createResource(AbstractRDFListTest.NS + "a"), // canonical
-				model.createResource(AbstractRDFListTest.NS + "b"),
-				model.createResource(AbstractRDFListTest.NS + "c"),
-				model.createResource(AbstractRDFListTest.NS + "d"),
-				model.createResource(AbstractRDFListTest.NS + "e") };
+				model.createResource(AbstractRDFListContractTests.NS + "a"), // canonical
+				model.createResource(AbstractRDFListContractTests.NS + "b"),
+				model.createResource(AbstractRDFListContractTests.NS + "c"),
+				model.createResource(AbstractRDFListContractTests.NS + "d"),
+				model.createResource(AbstractRDFListContractTests.NS + "e") };
 		final Resource[] r1 = new Resource[] {
-				model.createResource(AbstractRDFListTest.NS + "a"), // same
-				model.createResource(AbstractRDFListTest.NS + "b"),
-				model.createResource(AbstractRDFListTest.NS + "c"),
-				model.createResource(AbstractRDFListTest.NS + "d"),
-				model.createResource(AbstractRDFListTest.NS + "e") };
+				model.createResource(AbstractRDFListContractTests.NS + "a"), // same
+				model.createResource(AbstractRDFListContractTests.NS + "b"),
+				model.createResource(AbstractRDFListContractTests.NS + "c"),
+				model.createResource(AbstractRDFListContractTests.NS + "d"),
+				model.createResource(AbstractRDFListContractTests.NS + "e") };
 		final Resource[] r2 = new Resource[] {
-				model.createResource(AbstractRDFListTest.NS + "a"), // one shorter
-				model.createResource(AbstractRDFListTest.NS + "b"),
-				model.createResource(AbstractRDFListTest.NS + "c"),
-				model.createResource(AbstractRDFListTest.NS + "d") };
+				model.createResource(AbstractRDFListContractTests.NS + "a"), // one shorter
+				model.createResource(AbstractRDFListContractTests.NS + "b"),
+				model.createResource(AbstractRDFListContractTests.NS + "c"),
+				model.createResource(AbstractRDFListContractTests.NS + "d") };
 		final Resource[] r3 = new Resource[] {
-				model.createResource(AbstractRDFListTest.NS + "a"), // elements
+				model.createResource(AbstractRDFListContractTests.NS + "a"), // elements
 				// swapped
-				model.createResource(AbstractRDFListTest.NS + "b"),
-				model.createResource(AbstractRDFListTest.NS + "d"),
-				model.createResource(AbstractRDFListTest.NS + "c"),
-				model.createResource(AbstractRDFListTest.NS + "e") };
+				model.createResource(AbstractRDFListContractTests.NS + "b"),
+				model.createResource(AbstractRDFListContractTests.NS + "d"),
+				model.createResource(AbstractRDFListContractTests.NS + "c"),
+				model.createResource(AbstractRDFListContractTests.NS + "e") };
 		final Resource[] r4 = new Resource[] {
-				model.createResource(AbstractRDFListTest.NS + "a"), // different
+				model.createResource(AbstractRDFListContractTests.NS + "a"), // different
 				// name
-				model.createResource(AbstractRDFListTest.NS + "b"),
-				model.createResource(AbstractRDFListTest.NS + "c"),
-				model.createResource(AbstractRDFListTest.NS + "D"),
-				model.createResource(AbstractRDFListTest.NS + "e") };
+				model.createResource(AbstractRDFListContractTests.NS + "b"),
+				model.createResource(AbstractRDFListContractTests.NS + "c"),
+				model.createResource(AbstractRDFListContractTests.NS + "D"),
+				model.createResource(AbstractRDFListContractTests.NS + "e") };
 
 		final Object[][] testSpec = new Object[][] { { r0, r1, Boolean.TRUE },
 				{ r0, r2, Boolean.FALSE }, { r0, r3, Boolean.FALSE },
@@ -548,11 +548,11 @@ AbstractModelProducerUser  {
 		model.read(getFileName("ontology/list5.rdf"));
 
 		final Resource[] toGet = new Resource[] {
-				model.createResource(AbstractRDFListTest.NS + "a"),
-				model.createResource(AbstractRDFListTest.NS + "b"),
-				model.createResource(AbstractRDFListTest.NS + "c"),
-				model.createResource(AbstractRDFListTest.NS + "d"),
-				model.createResource(AbstractRDFListTest.NS + "e"), };
+				model.createResource(AbstractRDFListContractTests.NS + "a"),
+				model.createResource(AbstractRDFListContractTests.NS + "b"),
+				model.createResource(AbstractRDFListContractTests.NS + "c"),
+				model.createResource(AbstractRDFListContractTests.NS + "d"),
+				model.createResource(AbstractRDFListContractTests.NS + "e"), };
 
 		final RDFList l1 = getListRoot(model);
 
@@ -585,7 +585,7 @@ AbstractModelProducerUser  {
 		model.read(getFileName("ontology/list5.rdf"));
 
 		final RDFList root = getListRoot(model);
-		AbstractRDFListTest.iteratorTest(root.mapWith(new Map1<RDFNode, String>() {
+		AbstractRDFListContractTests.iteratorTest(root.mapWith(new Map1<RDFNode, String>() {
 			@Override
 			public String map1( final RDFNode x )
 			{
@@ -623,9 +623,9 @@ AbstractModelProducerUser  {
 		RDFList list0 = nil.as(RDFList.class);
 		RDFList list1 = nil.as(RDFList.class);
 
-		final Resource r0 = model.createResource(AbstractRDFListTest.NS + "x");
-		final Resource r1 = model.createResource(AbstractRDFListTest.NS + "y");
-		final Resource r2 = model.createResource(AbstractRDFListTest.NS + "z");
+		final Resource r0 = model.createResource(AbstractRDFListContractTests.NS + "x");
+		final Resource r1 = model.createResource(AbstractRDFListContractTests.NS + "y");
+		final Resource r2 = model.createResource(AbstractRDFListContractTests.NS + "z");
 
 		for (int i = 0; i < 10; i++)
 		{
@@ -716,8 +716,8 @@ AbstractModelProducerUser  {
 	public void testSetHead()
 	{
 
-		final Resource root = model.createResource(AbstractRDFListTest.NS + "root");
-		final Property p = model.createProperty(AbstractRDFListTest.NS, "p");
+		final Resource root = model.createResource(AbstractRDFListContractTests.NS + "root");
+		final Property p = model.createProperty(AbstractRDFListContractTests.NS, "p");
 
 		// a list of the nil object, but not typed
 		final Resource nil = RDF.nil;
@@ -747,8 +747,8 @@ AbstractModelProducerUser  {
 	{
 		final Model m = ModelFactory.createDefaultModel();
 
-		final Resource root = m.createResource(AbstractRDFListTest.NS + "root");
-		final Property p = m.createProperty(AbstractRDFListTest.NS, "p");
+		final Resource root = m.createResource(AbstractRDFListContractTests.NS + "root");
+		final Property p = m.createProperty(AbstractRDFListContractTests.NS, "p");
 
 		final Resource nil = RDF.nil;
 		m.add(nil, RDF.type, RDF.List);
@@ -809,8 +809,8 @@ AbstractModelProducerUser  {
 	public void testValidity()
 	{
 
-		final Resource root = model.createResource(AbstractRDFListTest.NS + "root");
-		final Property p = model.createProperty(AbstractRDFListTest.NS, "p");
+		final Resource root = model.createResource(AbstractRDFListContractTests.NS + "root");
+		final Property p = model.createProperty(AbstractRDFListContractTests.NS, "p");
 
 		// a list of the nil object, but not typed
 		final Resource nil = RDF.nil;

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFReaderFContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFReaderFContractTests.java?rev=1525287&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFReaderFContractTests.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFReaderFContractTests.java Sat Sep 21 20:11:59 2013
@@ -0,0 +1,132 @@
+package com.hp.hpl.jena.rdf.model;
+
+import java.io.InputStream;
+import java.io.Reader;
+
+import org.junit.Test;
+import com.hp.hpl.jena.shared.NoReaderForLangException;
+import com.hp.hpl.jena.testing_framework.TestFileData;
+import static org.junit.Assert.*;
+import static com.hp.hpl.jena.testing_framework.ModelHelper.*;
+
+public abstract class AbstractRDFReaderFContractTests {
+	
+	protected abstract RDFReaderF getRDFReaderF();
+	
+	@Test
+	public void testGetReader() throws Exception
+	{
+		RDFReader reader = getRDFReaderF().getReader();
+		
+		Model model = ModelFactory.createDefaultModel();
+		// read the RDF file just to make sure we can
+		
+		txnBegin( model );
+		reader.read(model, TestFileData.getRDFName());
+		txnCommit( model );
+	}
+	
+	@Test
+	public void testGetReader_String() throws Exception
+	{
+		/*
+		RDF/XML - default
+		RDF/XML-ABBREV
+		N-TRIPLE
+		N3
+		*/
+		Model model = ModelFactory.createDefaultModel();
+		RDFReader reader = getRDFReaderF().getReader( "RDF/XML");		
+		// read the RDF file just to make sure we can
+		txnBegin( model );
+		reader.read(model, TestFileData.getRDFName());
+		txnCommit( model );
+		
+		
+		model = ModelFactory.createDefaultModel();
+		reader = getRDFReaderF().getReader( "RDF/XML-ABBREV");		
+		// read the RDF file just to make sure we can
+		txnBegin( model );
+		reader.read(model, TestFileData.getRDFName());
+		txnCommit( model );
+		
+		model = ModelFactory.createDefaultModel();
+		reader = getRDFReaderF().getReader( "N-TRIPLE");		
+		// read the RDF file just to make sure we can
+		txnBegin( model );
+		reader.read(model, TestFileData.getTTLName());
+		txnCommit( model );
+		
+		model = ModelFactory.createDefaultModel();
+		reader = getRDFReaderF().getReader( "N3");		
+		// read the RDF file just to make sure we can
+		txnBegin( model );
+		reader.read(model, TestFileData.getTTLName());
+		txnCommit( model );
+		
+		// try invalid value
+		try {
+			reader = getRDFReaderF().getReader( "foo");	
+		}
+		catch (NoReaderForLangException expected)
+		{
+			// expected
+		}
+		
+	}
+	
+	@Test
+	public void testSetReaderClassName() throws Exception
+	{
+		
+		String before = getRDFReaderF().setReaderClassName("foo", DummyReader.class.getName());
+		
+		assertNull( "Should not be an existing name", before );
+		
+		RDFReader reader = getRDFReaderF().getReader("foo");
+		assertEquals( "Wrong reader type", DummyReader.class, reader.getClass());
+		
+		// FIXME add test when remove reader is available
+		//String s2 = getRDFReaderF().setReaderClassName("foo", null);
+		//assertEquals(  DummyReader.class.getCanonicalName(), s2 );
+		
+		//reader = getRDFReaderF().getReader("foo");
+		//assertNull( "should not return a reder", reader );
+
+	}
+	
+	public static class DummyReader implements RDFReader {
+
+		@Override
+		public void read(Model model, Reader r, String base) {
+			// TODO Auto-generated method stub
+			
+		}
+
+		@Override
+		public void read(Model model, InputStream r, String base) {
+			// TODO Auto-generated method stub
+			
+		}
+
+		@Override
+		public void read(Model model, String url) {
+			// TODO Auto-generated method stub
+			
+		}
+
+		@Override
+		public Object setProperty(String propName, Object propValue) {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		@Override
+		public RDFErrorHandler setErrorHandler(RDFErrorHandler errHandler) {
+			// TODO Auto-generated method stub
+			return null;
+		}
+		
+	}
+
+}

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFWriterFContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFWriterFContractTests.java?rev=1525287&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFWriterFContractTests.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFWriterFContractTests.java Sat Sep 21 20:11:59 2013
@@ -0,0 +1,118 @@
+package com.hp.hpl.jena.rdf.model;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.io.Writer;
+
+import org.junit.Test;
+import com.hp.hpl.jena.shared.NoWriterForLangException;
+import com.hp.hpl.jena.testing_framework.TestFileData;
+import static org.junit.Assert.*;
+
+public abstract class AbstractRDFWriterFContractTests {
+	
+	protected abstract RDFWriterF getRDFWriterF();
+	
+	private Model model = ModelFactory.createModelForGraph( TestFileData.getGraph() );
+	
+	@Test
+	public void testGetWriter() throws Exception
+	{
+		RDFWriter writer = getRDFWriterF().getWriter();
+		
+		// write the RDF file just to make sure we can
+		writer.write(model, new ByteArrayOutputStream(), "http://example.com/base/");
+	}
+	
+	@Test
+	public void testGetWriter_String() throws Exception
+	{
+		/*
+		RDF/XML - default
+		RDF/XML-ABBREV
+		N-TRIPLE
+		N3
+		*/
+		Model model = ModelFactory.createDefaultModel();
+		RDFWriter writer = getRDFWriterF().getWriter( "RDF/XML");		
+		// read the RDF file just to make sure we can
+		writer.write(model, new ByteArrayOutputStream(), "http://example.com/base/");
+		
+		
+		
+		model = ModelFactory.createDefaultModel();
+		writer = getRDFWriterF().getWriter( "RDF/XML-ABBREV");		
+		// read the RDF file just to make sure we can
+		writer.write(model, new ByteArrayOutputStream(), "http://example.com/base/");
+		
+		model = ModelFactory.createDefaultModel();
+		writer = getRDFWriterF().getWriter( "N-TRIPLE");		
+		// read the RDF file just to make sure we can
+		writer.write(model, new ByteArrayOutputStream(), "http://example.com/base/");
+		
+		model = ModelFactory.createDefaultModel();
+		writer = getRDFWriterF().getWriter( "N3");		
+		// read the RDF file just to make sure we can
+		writer.write(model, new ByteArrayOutputStream(), "http://example.com/base/");
+		
+		// try invalid value
+		try {
+			writer = getRDFWriterF().getWriter( "foo");	
+		}
+		catch (NoWriterForLangException expected)
+		{
+			// expected
+		}
+		
+	}
+	
+	@Test
+	public void testSetWriterClassName() throws Exception
+	{
+		
+		String before = getRDFWriterF().setWriterClassName("foo", DummyWriter.class.getName());
+		
+		assertNull( "Should not be an existing name", before );
+		
+		RDFWriter writer = getRDFWriterF().getWriter("foo");
+		assertEquals( "Wrong reader type", DummyWriter.class, writer.getClass());
+		
+		// FIXME add test when remove reader is available
+//		String s2 = getRDFWriterF().setWriterClassName("foo", null);
+//		assertEquals(  DummyWriter.class.getCanonicalName(), s2 );
+//		
+//		writer = getRDFWriterF().getWriter("foo");
+//		assertNull( "should not return a reder", writer );
+
+	}
+	
+	public static class DummyWriter implements RDFWriter {
+
+		@Override
+		public void write(Model model, Writer out, String base) {
+			// TODO Auto-generated method stub
+			
+		}
+
+		@Override
+		public void write(Model model, OutputStream out, String base) {
+			// TODO Auto-generated method stub
+			
+		}
+
+		@Override
+		public Object setProperty(String propName, Object propValue) {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		@Override
+		public RDFErrorHandler setErrorHandler(RDFErrorHandler errHandler) {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		
+	}
+
+}

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

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractReifiedStatementsTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractReifiedStatementsTest.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractReifiedStatementsTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractReifiedStatementsTest.java Sat Sep 21 20:11:59 2013
@@ -69,7 +69,7 @@ public abstract class AbstractReifiedSta
 	}
 
 	@Before
-	public void setupAbstractTestReifiedStatements() {
+	final public void setupAbstractTestReifiedStatements() {
 		model = getModelProducer().newModel();
 		final Resource S2 = model
 				.createResource(AbstractReifiedStatementsTest.anchor

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractSeqMethodsTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractSeqMethodsTest.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractSeqMethodsTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractSeqMethodsTest.java Sat Sep 21 20:11:59 2013
@@ -84,7 +84,7 @@ public abstract class AbstractSeqMethods
 	}
 
 	@Before
-	public void setUpSeqMethodsTest() throws Exception {
+	final public void setUpSeqMethodsTest() throws Exception {
 		aLitTestObj = new LitTestObj(12345);
 		tvLiteral = model.createLiteral("test 12 string 2");
 		tvResource = model.createResource();

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractStatementTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractStatementTest.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractStatementTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractStatementTest.java Sat Sep 21 20:11:59 2013
@@ -18,6 +18,8 @@
 
 package com.hp.hpl.jena.rdf.model;
 
+import java.util.StringTokenizer;
+
 import com.hp.hpl.jena.graph.FrontsTriple;
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.Property;
@@ -31,17 +33,37 @@ import static com.hp.hpl.jena.testing_fr
 import com.hp.hpl.jena.vocabulary.RDF;
 
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 
 public abstract class AbstractStatementTest extends AbstractModelProducerUser {
 	
+	private Model model;
+	
+	@Before
+	final public void setupAbstractStatementTest()
+	{
+		model = getModelProducer().newModel();
+	}
+	
+	
+	private Statement createModelStatement( String fact )
+	{
+		StringTokenizer st = new StringTokenizer(fact);
+		Resource sub = resource( st.nextToken());
+		Property pred = property( st.nextToken());
+		RDFNode obj = rdfNode( st.nextToken());
+		return model.createStatement(sub, pred, obj);
+	}
+	
 	@Test
 	public void testHasWellFormedXML()
 	{
-		Assert.assertFalse(statement("s P 1").hasWellFormedXML());
-		Assert.assertFalse(statement("S P '<x>/x>'rdf:XMLLiteral")
+		
+		Assert.assertFalse(createModelStatement("s P 1").hasWellFormedXML());
+		Assert.assertFalse(createModelStatement("S P '<x>/x>'rdf:XMLLiteral")
 				.hasWellFormedXML());
-		Assert.assertTrue(statement("S P '<x></x>'rdf:XMLLiteral")
+		Assert.assertTrue(createModelStatement("S P '<x></x>'rdf:XMLLiteral")
 				.hasWellFormedXML());
 	}
 
@@ -78,9 +100,8 @@ public abstract class AbstractStatementT
 	@Test
 	public void testPortingBlankNodes()
 	{
-		final Model B = getModelProducer().newModel();
 		final Resource anon = resource(); //model.createResource();
-		final Resource bAnon = anon.inModel(B);
+		final Resource bAnon = anon.inModel(model);
 		Assert.assertTrue("moved resource should still be blank",
 				bAnon.isAnon());
 		Assert.assertEquals("move resource should equal original", anon, bAnon);
@@ -89,17 +110,16 @@ public abstract class AbstractStatementT
 	@Test
 	public void testSet()
 	{
-		final Model A = getModelProducer().newModel();
-		final Resource S = A.createResource("jena:S");
-		A.createResource("jena:R");
-		final Property P = A.createProperty("jena:P");
-		final RDFNode O = A.createResource("jena:O");
-		final Statement spo = A.createStatement(S, P, O);
-		A.add(spo);
-		final Statement sps = A.createStatement(S, P, S);
+		final Resource S = model.createResource("jena:S");
+		model.createResource("jena:R");
+		final Property P = model.createProperty("jena:P");
+		final RDFNode O = model.createResource("jena:O");
+		final Statement spo = model.createStatement(S, P, O);
+		model.add(spo);
+		final Statement sps = model.createStatement(S, P, S);
 		Assert.assertEquals(sps, spo.changeObject(S));
-		Assert.assertFalse(A.contains(spo));
-		Assert.assertTrue(A.contains(sps));
+		Assert.assertFalse(model.contains(spo));
+		Assert.assertTrue(model.contains(sps));
 	}
 
 	/**
@@ -113,7 +133,6 @@ public abstract class AbstractStatementT
 		final String fakeURI = "fake:URI";
 		final Resource S = resource();
 		final Property P = property( "PP");
-		Model model = getModelProducer().newModel();
 		final RDFNode O = model.createTypedLiteral("42", fakeURI);
 		final Statement st = model.createStatement(S, P, O);
 		Assert.assertTrue(st.toString().indexOf(fakeURI) > 0);
@@ -122,7 +141,7 @@ public abstract class AbstractStatementT
 	@Test
 	public void testStatmentMap1Selectors()
 	{
-		Statement s = statement(getModelProducer().newModel(), "sub pred obj");
+		Statement s = createModelStatement("sub pred obj");
 		Assert.assertEquals(resource("sub"),
 				Statement.Util.getSubject.map1(s));
 		Assert.assertEquals(resource("pred"),
@@ -153,7 +172,7 @@ public abstract class AbstractStatementT
 	public void testTripleWrapper()
 	{
 		assertInstanceOf(FrontsTriple.class,
-				statement(getModelProducer().newModel(), "s p o"));
+				createModelStatement( "s p o"));
 	}
 
 	

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/DefaultModelTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/DefaultModelTest.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/DefaultModelTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/DefaultModelTest.java Sat Sep 21 20:11:59 2013
@@ -19,11 +19,13 @@
 package com.hp.hpl.jena.rdf.model;
 
 
+import org.junit.Test;
+
 import com.hp.hpl.jena.testing_framework.AbstractModelProducer;
 import com.hp.hpl.jena.testing_framework.ModelProducerInterface;
 
 
-public class DefaultModelTest extends AbstractModelTest
+public class DefaultModelTest extends AbstractModelContractTests
     {
 
     ModelProducerInterface producer = new AbstractModelProducer(){
@@ -39,6 +41,14 @@ public class DefaultModelTest extends Ab
 	@Override
 	public ModelProducerInterface getModelProducer() {
 		return producer;
+	}
+
+
+	@Override
+	@Test
+	public void testIndependent() {
+		// TODO Auto-generated method stub
+		
 	}   
 
     }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RecordingModelListener.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RecordingModelListener.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RecordingModelListener.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RecordingModelListener.java Sat Sep 21 20:11:59 2013
@@ -23,6 +23,7 @@ import static com.hp.hpl.jena.testing_fr
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 
 import org.junit.Assert;
@@ -85,7 +86,7 @@ public class RecordingModelListener impl
 		}
 	}
 
-    List<Object> history = new ArrayList<Object>();
+    private List<Object> history = new ArrayList<Object>();
     
     @Override
     public void addedStatement( Statement s )
@@ -137,14 +138,22 @@ public void removedStatement( Statement 
     protected void record( String tag, Object info )
         { history.add( tag ); history.add( info ); }
         
-    public boolean has( Object [] things ) 
+    public boolean has( Object ... things ) 
         { return history.equals( Arrays.asList( things ) ); }
         
-    public void assertHas( Object [] things )
+    public void assertHas( Object ... things )
         {
         if (has( things ) == false)
             Assert.fail( "expected " + Arrays.asList( things ) + " but got " + history );
-        }    
+        }   
+    
+    public void assertEmpty()
+    {
+    	if (history.size() > 0)
+    	{
+    		Assert.fail( "Should be no history but got "+history );
+    	}
+    }
     
     public boolean has( List<?> things )
             { return history.equals( things ); } 
@@ -157,14 +166,17 @@ public void removedStatement( Statement 
     
     public void assertHas( List<?> things )
         { if (has( things ) == false) Assert.fail( "expected " + things + " but got " + history ); }  
-    
-    public void assertHasStart( Object [] start )
+
+    public void assertContains( Object... things )
+    { if (contains( things ) == false) Assert.fail( "expected " + things + " but got " + history ); }  
+
+    public void assertHasStart( Object... start )
         { 
         List<Object> L = Arrays.asList( start );
         if (hasStart( L ) == false) Assert.fail( "expected " + L + " at the beginning of " + history );
         }
     
-    public void assertHasEnd( Object [] end )
+    public void assertHasEnd( Object... end )
         {
         List<Object> L = Arrays.asList( end );
         if (hasEnd( L ) == false) Assert.fail( "expected " + L + " at the end of " + history );        
@@ -173,4 +185,42 @@ public void removedStatement( Statement 
     public void clear()
     { history.clear(); }
 
+    public boolean contains( Object ...objects )
+    {
+    	for (int i=0;i<history.size();i++)
+    	{
+    		if (history.get(i).equals( objects[0]))
+    		{
+    			boolean found = true;
+    			for (int j=1;j<objects.length;j++)
+    			{
+    				if (i+j >=  history.size())
+    				{
+    					found = false;
+    					break;
+    				}
+    				if (! history.get(i+j).equals(objects[j]))
+    				{
+    					found = false;
+    					break;
+    				}
+    			}
+    			if (found)
+    			{
+    				return true;
+    			}
+    		}
+    	
+    	}
+    	return false;
+    
+    	}
+    
+    public Iterator<Object> from( Object start )
+    {
+    	Iterator<Object> iter = history.iterator();
+    	while (iter.hasNext() && !iter.next().equals( start ))
+    		; // loop
+    	return iter;
+    }
     }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/IteratorTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/IteratorTest.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/IteratorTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/IteratorTest.java Sat Sep 21 20:11:59 2013
@@ -1,7 +1,7 @@
 package com.hp.hpl.jena.rdf.model.temp;
 
 import com.hp.hpl.jena.rdf.model.AbstractIteratorTest;
-import com.hp.hpl.jena.rdf.model.AbstractModelTest;
+import com.hp.hpl.jena.rdf.model.AbstractModelContractTests;
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
 import com.hp.hpl.jena.testing_framework.AbstractModelProducer;

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/LiteralTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/LiteralTest.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/LiteralTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/LiteralTest.java Sat Sep 21 20:11:59 2013
@@ -1,7 +1,7 @@
 package com.hp.hpl.jena.rdf.model.temp;
 
 import com.hp.hpl.jena.rdf.model.AbstractLiteralTest;
-import com.hp.hpl.jena.rdf.model.AbstractModelTest;
+import com.hp.hpl.jena.rdf.model.AbstractModelContractTests;
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
 import com.hp.hpl.jena.testing_framework.AbstractModelProducer;

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelConTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelConTest.java?rev=1525287&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelConTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelConTest.java Sat Sep 21 20:11:59 2013
@@ -0,0 +1,30 @@
+package com.hp.hpl.jena.rdf.model.temp;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.rdf.model.AbstractModelConContractTests;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.testing_framework.AbstractModelProducer;
+import com.hp.hpl.jena.testing_framework.ModelProducerInterface;
+
+
+
+public class ModelConTest extends AbstractModelConContractTests {
+
+	AbstractModelProducer producer = new AbstractModelProducer()
+	{
+
+		@Override
+		protected Model createNewModel() {
+			return ModelFactory.createDefaultModel();
+		}
+		
+	};
+	
+	@Override
+	public ModelProducerInterface getModelProducer() {
+		return producer;
+	}
+
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelConTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelGraphInterfaceTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelGraphInterfaceTest.java?rev=1525287&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelGraphInterfaceTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelGraphInterfaceTest.java Sat Sep 21 20:11:59 2013
@@ -0,0 +1,46 @@
+package com.hp.hpl.jena.rdf.model.temp;
+
+import org.junit.After;
+import org.junit.Test;
+
+import com.hp.hpl.jena.rdf.model.AbstractModelConContractTests;
+import com.hp.hpl.jena.rdf.model.AbstractModelGraphInterfaceContractTests;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.ModelGraphInterface;
+import com.hp.hpl.jena.testing_framework.AbstractModelProducer;
+import com.hp.hpl.jena.testing_framework.ModelProducerInterface;
+
+
+
+public class ModelGraphInterfaceTest extends AbstractModelGraphInterfaceContractTests {
+
+	AbstractModelProducer producer = new AbstractModelProducer()
+	{
+
+		@Override
+		protected Model createNewModel() {
+			return ModelFactory.createDefaultModel();
+		}
+		
+	};
+	
+	private Model model;
+	
+	
+	@After
+	final public void afterModelGraphInterfaceTest() {
+		producer.closeModels();
+		model = null;
+	}
+
+	@Override
+	protected ModelGraphInterface getModelGraphInterface() {
+		if (model == null)
+		{
+			model = producer.newModel();
+		}
+		return model;
+	}
+
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelGraphInterfaceTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelListStatementTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelListStatementTest.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelListStatementTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelListStatementTest.java Sat Sep 21 20:11:59 2013
@@ -1,7 +1,7 @@
 package com.hp.hpl.jena.rdf.model.temp;
 
 import com.hp.hpl.jena.rdf.model.AbstractListStatementsTest;
-import com.hp.hpl.jena.rdf.model.AbstractModelTest;
+import com.hp.hpl.jena.rdf.model.AbstractModelContractTests;
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
 import com.hp.hpl.jena.testing_framework.AbstractModelProducer;

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelListSubjectsTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelListSubjectsTest.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelListSubjectsTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelListSubjectsTest.java Sat Sep 21 20:11:59 2013
@@ -1,7 +1,7 @@
 package com.hp.hpl.jena.rdf.model.temp;
 
 import com.hp.hpl.jena.rdf.model.AbstractListSubjectsTest;
-import com.hp.hpl.jena.rdf.model.AbstractModelTest;
+import com.hp.hpl.jena.rdf.model.AbstractModelContractTests;
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
 import com.hp.hpl.jena.testing_framework.AbstractModelProducer;

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelLockTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelLockTest.java?rev=1525287&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelLockTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelLockTest.java Sat Sep 21 20:11:59 2013
@@ -0,0 +1,30 @@
+package com.hp.hpl.jena.rdf.model.temp;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.rdf.model.AbstractLockContractTests;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.testing_framework.AbstractModelProducer;
+import com.hp.hpl.jena.testing_framework.ModelProducerInterface;
+
+
+
+public class ModelLockTest extends AbstractLockContractTests {
+
+	AbstractModelProducer producer = new AbstractModelProducer()
+	{
+
+		@Override
+		protected Model createNewModel() {
+			return ModelFactory.createDefaultModel();
+		}
+		
+	};
+	
+	@Override
+	public ModelProducerInterface getModelProducer() {
+		return producer;
+	}
+
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelLockTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelPrefixMappingTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelPrefixMappingTest.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelPrefixMappingTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelPrefixMappingTest.java Sat Sep 21 20:11:59 2013
@@ -1,7 +1,7 @@
 package com.hp.hpl.jena.rdf.model.temp;
 
 import com.hp.hpl.jena.rdf.model.AbstractModelPrefixMappingTest;
-import com.hp.hpl.jena.rdf.model.AbstractModelTest;
+import com.hp.hpl.jena.rdf.model.AbstractModelContractTests;
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
 import com.hp.hpl.jena.testing_framework.AbstractModelProducer;

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelSuite.java?rev=1525287&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelSuite.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelSuite.java Sat Sep 21 20:11:59 2013
@@ -0,0 +1,27 @@
+package com.hp.hpl.jena.rdf.model.temp;
+
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import com.hp.hpl.jena.rdf.model.AbstractModelContractSuite;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.testing_framework.AbstractModelProducer;
+
+
+@RunWith(Suite.class)
+public class ModelSuite extends AbstractModelContractSuite {
+
+	@BeforeClass
+	public static void beforeClass() {
+		setModelProducer(new ModelProducer());
+	}
+
+	public static class ModelProducer extends AbstractModelProducer {
+		@Override
+		protected Model createNewModel() {
+			return ModelFactory.createDefaultModel();
+		}
+	}
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelSuite.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelTest.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelTest.java Sat Sep 21 20:11:59 2013
@@ -1,6 +1,8 @@
 package com.hp.hpl.jena.rdf.model.temp;
 
-import com.hp.hpl.jena.rdf.model.AbstractModelTest;
+import org.junit.Test;
+
+import com.hp.hpl.jena.rdf.model.AbstractModelContractTests;
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
 import com.hp.hpl.jena.testing_framework.AbstractModelProducer;
@@ -8,7 +10,7 @@ import com.hp.hpl.jena.testing_framework
 
 
 
-public class ModelTest extends AbstractModelTest {
+public class ModelTest extends AbstractModelContractTests {
 
 	AbstractModelProducer producer = new AbstractModelProducer()
 	{
@@ -24,4 +26,11 @@ public class ModelTest extends AbstractM
 	public ModelProducerInterface getModelProducer() {
 		return producer;
 	}
+
+	@Override
+	@Test
+	public void testIndependent() {
+		// TODO Auto-generated method stub
+		
+	}
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFListTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFListTest.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFListTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFListTest.java Sat Sep 21 20:11:59 2013
@@ -1,6 +1,6 @@
 package com.hp.hpl.jena.rdf.model.temp;
 
-import com.hp.hpl.jena.rdf.model.AbstractRDFListTest;
+import com.hp.hpl.jena.rdf.model.AbstractRDFListContractTests;
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
 import com.hp.hpl.jena.testing_framework.AbstractModelProducer;
@@ -8,7 +8,7 @@ import com.hp.hpl.jena.testing_framework
 
 
 
-public class RDFListTest extends AbstractRDFListTest {
+public class RDFListTest extends AbstractRDFListContractTests {
 
 	AbstractModelProducer producer = new AbstractModelProducer()
 	{

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFReaderFTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFReaderFTest.java?rev=1525287&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFReaderFTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFReaderFTest.java Sat Sep 21 20:11:59 2013
@@ -0,0 +1,46 @@
+package com.hp.hpl.jena.rdf.model.temp;
+
+import org.junit.After;
+import org.junit.Test;
+
+import com.hp.hpl.jena.rdf.model.AbstractModelConContractTests;
+import com.hp.hpl.jena.rdf.model.AbstractRDFReaderFContractTests;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.RDFReaderF;
+import com.hp.hpl.jena.testing_framework.AbstractModelProducer;
+import com.hp.hpl.jena.testing_framework.ModelProducerInterface;
+
+
+
+public class RDFReaderFTest extends AbstractRDFReaderFContractTests {
+
+	Model model = null;
+	AbstractModelProducer producer = new AbstractModelProducer()
+	{
+
+		@Override
+		protected Model createNewModel() {
+			return ModelFactory.createDefaultModel();
+		}
+		
+	};
+	
+	@Override
+	protected RDFReaderF getRDFReaderF() {
+		// TODO Auto-generated method stub
+		if (model == null)
+		{
+			model = producer.newModel();
+		}
+		return model;
+	}
+	
+	@After
+	public final void afterRDFReaderFTest()
+	{
+		producer.closeModels();
+		model = null;
+	}
+
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFReaderFTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFWriterFTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFWriterFTest.java?rev=1525287&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFWriterFTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFWriterFTest.java Sat Sep 21 20:11:59 2013
@@ -0,0 +1,48 @@
+package com.hp.hpl.jena.rdf.model.temp;
+
+import org.junit.After;
+import org.junit.Test;
+
+import com.hp.hpl.jena.rdf.model.AbstractModelConContractTests;
+import com.hp.hpl.jena.rdf.model.AbstractRDFReaderFContractTests;
+import com.hp.hpl.jena.rdf.model.AbstractRDFWriterFContractTests;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.RDFReaderF;
+import com.hp.hpl.jena.rdf.model.RDFWriterF;
+import com.hp.hpl.jena.testing_framework.AbstractModelProducer;
+import com.hp.hpl.jena.testing_framework.ModelProducerInterface;
+
+
+
+public class RDFWriterFTest extends AbstractRDFWriterFContractTests {
+
+	Model model = null;
+	AbstractModelProducer producer = new AbstractModelProducer()
+	{
+
+		@Override
+		protected Model createNewModel() {
+			return ModelFactory.createDefaultModel();
+		}
+		
+	};
+	
+	@Override
+	protected RDFWriterF getRDFWriterF() {
+		// TODO Auto-generated method stub
+		if (model == null)
+		{
+			model = producer.newModel();
+		}
+		return model;
+	}
+	
+	@After
+	public final void afterRDFWriterFTest()
+	{
+		producer.closeModels();
+		model = null;
+	}
+
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFWriterFTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ReifiedStatementTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ReifiedStatementTest.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ReifiedStatementTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ReifiedStatementTest.java Sat Sep 21 20:11:59 2013
@@ -1,6 +1,6 @@
 package com.hp.hpl.jena.rdf.model.temp;
 
-import com.hp.hpl.jena.rdf.model.AbstractModelTest;
+import com.hp.hpl.jena.rdf.model.AbstractModelContractTests;
 import com.hp.hpl.jena.rdf.model.AbstractReifiedStatementsTest;
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.ModelFactory;

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/ModelHelper.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/ModelHelper.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/ModelHelper.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/ModelHelper.java Sat Sep 21 20:11:59 2013
@@ -18,6 +18,7 @@
 
 package com.hp.hpl.jena.testing_framework;
 
+import com.hp.hpl.jena.graph.Graph;
 import com.hp.hpl.jena.graph.Node;
 import com.hp.hpl.jena.rdf.model.Literal;
 import com.hp.hpl.jena.rdf.model.Model;
@@ -31,6 +32,9 @@ import com.hp.hpl.jena.rdf.model.StmtIte
 import com.hp.hpl.jena.shared.PrefixMapping;
 import com.hp.hpl.jena.util.CollectionFactory;
 
+import static com.hp.hpl.jena.testing_framework.ModelHelper.modelAdd;
+import static com.hp.hpl.jena.testing_framework.ModelHelper.txnBegin;
+import static com.hp.hpl.jena.testing_framework.ModelHelper.txnCommit;
 import static org.junit.Assert.*;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -68,24 +72,6 @@ public class ModelHelper extends GraphHe
 		return nice(n.asNode());
 	}
 
-	/**
-	 * create a Statement in a given Model with (S, P, O) extracted by parsing a
-	 * string.
-	 * 
-	 * @param lockModel
-	 *            the model the statement is attached to
-	 * @param an
-	 *            "S P O" string.
-	 * @return model.createStatement(S, P, O)
-	 */
-	public static Statement statement(Model m, String fact) {
-		StringTokenizer st = new StringTokenizer(fact);
-		Resource sub = resource(st.nextToken());
-		Property pred = property(st.nextToken());
-		RDFNode obj = rdfNode(st.nextToken());
-		return m.createStatement(sub, pred, obj);
-	}
-
 	public static Statement statement( String fact )
 	{ 
 		StringTokenizer st = new StringTokenizer(fact);
@@ -95,6 +81,11 @@ public class ModelHelper extends GraphHe
 		return builderModel.createStatement(sub, pred, obj);
 	}
 	
+	public static Statement statement( Resource s, Property p, RDFNode o )
+	{ 
+		return builderModel.createStatement(s, p, o);
+	}
+	
 	public static RDFNode rdfNode(Model m, String s) {
 		return m.asRDFNode(NodeCreateUtils.create(s));
 	}
@@ -114,9 +105,9 @@ public class ModelHelper extends GraphHe
 	 public static Resource resource( String s )
 	 { return (Resource) rdfNode(s); }
 
-	public static Resource resource(Model m, String s) {
-		return (Resource) rdfNode(m, s);
-	}
+//	public static Resource resource(Model m, String s) {
+//		return (Resource) rdfNode(m, s);
+//	}
 
 	public static Property property( String s )
 	 { return rdfNode(s).as(Property.class); }
@@ -125,26 +116,31 @@ public class ModelHelper extends GraphHe
 		return rdfNode(m, s).as(Property.class);
 	}
 
+	public static Literal literal(String s, String lang)
+	{
+		return builderModel.createLiteral(s, lang);
+	}
+	
 	public static Literal literal(String s) {
 		return rdfNode(s).as(Literal.class);
 	}
 
-	/**
-	 * Create an array of Statements parsed from a semi-separated string.
-	 * 
-	 * @param lockModel
-	 *            a model to serve as a statement factory
-	 * @param facts
-	 *            a sequence of semicolon-separated "S P O" facts
-	 * @return a Statement[] of the (S P O) statements from the string
-	 */
-	public static Statement[] statements(Model m, String facts) {
-		ArrayList<Statement> sl = new ArrayList<Statement>();
-		StringTokenizer st = new StringTokenizer(facts, ";");
-		while (st.hasMoreTokens())
-			sl.add(statement(m, st.nextToken()));
-		return sl.toArray(new Statement[sl.size()]);
-	}
+//	/**
+//	 * Create an array of Statements parsed from a semi-separated string.
+//	 * 
+//	 * @param lockModel
+//	 *            a model to serve as a statement factory
+//	 * @param facts
+//	 *            a sequence of semicolon-separated "S P O" facts
+//	 * @return a Statement[] of the (S P O) statements from the string
+//	 */
+//	public static Statement[] statements(Model m, String facts) {
+//		ArrayList<Statement> sl = new ArrayList<Statement>();
+//		StringTokenizer st = new StringTokenizer(facts, ";");
+//		while (st.hasMoreTokens())
+//			sl.add(statement(m, st.nextToken()));
+//		return sl.toArray(new Statement[sl.size()]);
+//	}
 	
 	/**
 	 * Create an array of Statements parsed from a semi-separated string.
@@ -194,7 +190,9 @@ public class ModelHelper extends GraphHe
 	/**
 	 * add to a model all the statements expressed by a string.
 	 * 
-	 * @param lockModel
+	 * Does not do any transaction manipulation.
+	 * 
+	 * @param m
 	 *            the model to be updated
 	 * @param facts
 	 *            a sequence of semicolon-separated "S P O" facts
@@ -202,31 +200,74 @@ public class ModelHelper extends GraphHe
 	 */
 	public static Model modelAdd(Model m, String facts) {
 		StringTokenizer semis = new StringTokenizer(facts, ";");
-		while (semis.hasMoreTokens())
-			m.add(statement(semis.nextToken()));
+		
+		while (semis.hasMoreTokens()) {
+			StringTokenizer st = new StringTokenizer(semis.nextToken());
+			Resource sub = resource( st.nextToken());
+			Property pred = property( st.nextToken());
+			RDFNode obj = rdfNode( st.nextToken());
+			m.add(sub,pred,obj);
+		}
+		
 		return m;
 	}
+	
+	/**
+	 * create a memory based model with extended prefixes and initialises it with statements
+	 * parsed from a string.
+	 * 
+	 * does all insertions in a transaction.
+	 * 
+	 * @param facts
+	 * @return
+	 */
+	public static Model memModel( String facts ) {
+		Model model = ModelFactory.createMemModelMaker().createFreshModel();
+		model.setNsPrefixes(PrefixMapping.Extended);
+		 txnBegin( model );
+		 modelAdd(model, facts);
+		 txnCommit( model );
+		 return model;
+	}
 
 	/**
-	 * makes a model with a given reiifcation style, initialised with statements
+	 * Creates a model with extended prefixes and initialises it with statements
 	 * parsed from a string.
 	 * 
+	 * does all insertions in a transaction.
+	 * 
 	 * @param facts
 	 *            a string in semicolon-separated "S P O" format
 	 * @return a model containing those facts
 	 */
 	public static Model modelWithStatements(ModelProducerInterface producer,
 			String facts) {
-		return modelAdd(createModel(producer), facts);
+		Model m = createModel(producer);
+		txnBegin( m );
+		modelAdd( m, facts );
+		txnCommit( m );
+		return m;
 	}
 	
+	/**
+	 * Creates a model with extended prefixes and initialises it with statements
+	 * parsed from the statement iterator.
+	 * 
+	 * does all insertions in a transaction.
+	 * 
+	 * @param facts
+	 *            a string in semicolon-separated "S P O" format
+	 * @return a model containing those facts
+	 */
 	public static Model modelWithStatements( ModelProducerInterface producer, final StmtIterator it )
 	{
-		final Model m = producer.newModel();
+		Model m = createModel(producer);
+		txnBegin( m );
 		while (it.hasNext())
 		{
 			m.add(it.nextStatement());
 		}
+		txnCommit( m );
 		return m;
 	}
 
@@ -240,15 +281,6 @@ public class ModelHelper extends GraphHe
 	}
 
 	/**
-	 * Answer a default model; it exists merely to abbreviate the rather long
-	 * explicit invocation.
-	 * 
-	 * @return a new default [aka memory-based] model
-	 */
-	// public static Model createMemModel()
-	// { return ModelFactory.createDefaultModel(); }
-
-	/**
 	 * test that two models are isomorphic and fail if they are not.
 	 * 
 	 * @param title
@@ -339,4 +371,41 @@ public class ModelHelper extends GraphHe
 			return "[" + Long.toString(content) + "]";
 		}
 	}
+	
+	/**
+	 * Begin a transaction on the model if transactions are supported.
+	 * 
+	 * @param m
+	 */
+	public static Model txnBegin(Model m) {
+		if (m.supportsTransactions()) {
+			return m.begin();
+		}
+		return m;
+	}
+
+	/**
+	 * Commit the transaction on the model if transactions are supported.
+	 * 
+	 * @param m
+	 */
+	public static Model txnCommit(Model m) {
+		if (m.supportsTransactions()) {
+			return m.commit();
+		}
+		return m;
+	}
+
+	/**
+	 * Rollback (abort) the transaction on the model if transactions are
+	 * supported.
+	 * 
+	 * @param m
+	 */
+	public static Model txnRollback(Model m) {
+		if (m.supportsTransactions()) {
+			return m.abort();
+		}
+		return m;
+	}
 }

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestFileData.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestFileData.java?rev=1525287&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestFileData.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestFileData.java Sat Sep 21 20:11:59 2013
@@ -0,0 +1,205 @@
+package com.hp.hpl.jena.testing_framework;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.NodeFactory;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.rdf.model.AnonId;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.Statement;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+
+
+/**
+ * Class that produces RDF and TTL data, a Graph and a Model that all contain the same data.
+ * This is used for various tests where files are read/written
+ *
+ */
+public class TestFileData {
+	private static String ttlStr()
+	{
+		String[] lines = {
+			"<http://example.com/subject> <http://example.com/predicate> <http://example.com/object> .",
+        	"<e> <p5> 'verify base works' ."
+		};
+		return  toDataString( lines );
+	}
+	
+	private static String rdfStr()
+	{
+		String[] lines = {
+		"<rdf:RDF",
+	    "  xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"",
+	    "  xmlns:ex=\"http://example.com/\">",
+	    "  <rdf:Description rdf:about=\"http://example.com/subject\">",
+	    "    <ex:predicate rdf:resource=\"http://example.com/object\"/>",
+	    "  </rdf:Description>",
+	    "  <rdf:Description rdf:about=\"e\">",
+	    "    <ex:p5>verify base works</ex:p5>",
+	    "  </rdf:Description>",
+	    "</rdf:RDF>"
+		};
+		return  toDataString( lines );
+	}
+	
+	private static String toDataString( String[] lines )
+	{
+		String eol = System.getProperty("line.separator");
+		StringBuilder sb = new StringBuilder();
+		for (String l : lines)
+		{
+			sb.append( l ).append(eol);
+		}
+		return sb.toString();
+	}
+	
+	public static Graph getGraph()
+	{
+		Graph g = GraphFactory.createGraphMem();
+		
+		g.add( new Triple( NodeFactory.createURI( "http://example.com/subject"),
+				NodeFactory.createURI( "http://example.com/predicate"),
+				NodeFactory.createURI( "http://example.com/object")
+				) );
+
+		g.add( new Triple( NodeFactory.createAnon( AnonId.create("a")),
+				NodeFactory.createURI( "http://example.com/p1"),
+				NodeFactory.createAnon( AnonId.create("b"))
+				) );
+
+		g.add( new Triple( NodeFactory.createAnon( AnonId.create("b")),
+				NodeFactory.createURI( "http://example.com/p2"),
+				NodeFactory.createLiteral( "foo" )
+				) );
+		
+		g.add( new Triple( NodeFactory.createURI( "http://example.com/ns/e"),
+				NodeFactory.createURI( "http://example.com/ns/p5"),
+				NodeFactory.createLiteral( "verify base works")
+				) );
+		
+		return g;
+	}
+	
+	public static Model getModel()
+	{
+		return ModelFactory.createModelForGraph(getGraph());
+	}
+	
+	public static InputStream getRDFInput()
+	{
+		return new ByteArrayInputStream( rdfStr().getBytes() );
+	}
+	
+	public static InputStream getTTLInput()
+	{
+		return new ByteArrayInputStream( ttlStr().getBytes() );
+	}
+	
+	public static Reader getRDFReader()
+	{
+		return new StringReader( rdfStr() );
+	}
+  
+	public static Reader getTTLReader()
+	{
+		return new StringReader( ttlStr() );
+	}
+	
+	public static String getRDFName() throws IOException
+	{
+		File f = File.createTempFile("tfd", ".rdf");
+		f.deleteOnExit();
+		FileOutputStream fos = new FileOutputStream( f );
+		fos.write( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>".getBytes());
+		fos.write( System.getProperty("line.separator").getBytes() );
+		fos.write( rdfStr().getBytes() );
+		fos.close();
+		
+		return f.toURI().toURL().toExternalForm();
+	}
+	
+	public static String getTTLName() throws IOException
+	{
+		File f = File.createTempFile("tfd", ".ttl");
+		f.deleteOnExit();
+		FileOutputStream fos = new FileOutputStream( f );
+		fos.write( ttlStr().getBytes() );
+		fos.close();
+		
+		return f.toURI().toURL().toExternalForm();
+	}
+	
+	@Test
+	public void testEquality()
+	{
+		Model ttl = ModelFactory.createDefaultModel().read( getTTLInput(), "http://example/ns/", "TTL");
+		Model rdf = ModelFactory.createDefaultModel().read( getRDFInput(), "http://example/ns/", "RDF/XML-ABBREV");
+		
+		assertTrue( ttl.isIsomorphicWith( rdf ));
+		assertTrue( rdf.isIsomorphicWith( ttl ));
+	}
+	
+  public static void main(String ... argv) throws Exception
+  {
+//      //Model model = ModelFactory.createDefaultModel() ;
+//      //String x = "<s> <p> 'verify it works' ." ;
+//     
+//      
+//      //Reader sr = getTTLReader();
+//      //model.read(sr, "http://example/", "TTL") ;
+//      //model.read(sr, "", "TTL") ;
+//      //model.read( getRDFInput() );
+//	  Model ttl = ModelFactory.createDefaultModel().read( getTTLInput(), "", "TTL");
+//	  Model rdf = ModelFactory.createDefaultModel().read( getRDFInput(), "", "RDF/XML-ABBREV");
+//		
+//      ttl.write(System.out, "RDF/XML-ABBREV") ;
+//      System.out.println("-----") ;
+//     // model.setNsPrefix("ex", "http://example/") ;
+//      rdf.write(System.out, "N-TRIPLES") ;
+//      System.out.println("-----") ;
+//      System.out.println( getTTLName() );
+//      System.out.println( "ttl iso rdf: "+ttl.isIsomorphicWith(rdf));
+//      
+//      System.out.println( getRDFName() );
+//      System.out.println( "rdf iso ttl: "+rdf.isIsomorphicWith(ttl));
+	  
+	  String[] lines = {
+				"<rdf:RDF",
+			    "  xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">",
+			    "  <rdf:Description rdf:about=\"e\">",
+			    "    <p5>verify base works</p5>",
+			    "  </rdf:Description>",
+			    "</rdf:RDF>"
+				};
+	  
+	  String eol = System.getProperty("line.separator");
+		StringBuilder sb = new StringBuilder();
+		for (String l : lines)
+		{
+			sb.append( l ).append(eol);
+		}
+
+	  Model model = ModelFactory.createDefaultModel() ;
+	    
+	    StringReader sr = new StringReader(sb.toString()) ;
+	    model.read(sr, "http://example/") ;
+	    model.write(System.out, "N-TRIPLES") ;
+	    System.out.println("-----") ;
+	    model.setNsPrefix("ex", "http://example/") ;
+	    model.write(System.out, "RDF/XML-ABBREV", "http://another/") ;
+  }
+
+
+}

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

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestUtils.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestUtils.java?rev=1525287&r1=1525286&r2=1525287&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestUtils.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestUtils.java Sat Sep 21 20:11:59 2013
@@ -21,15 +21,20 @@ package com.hp.hpl.jena.testing_framewor
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
-import java.lang.reflect.*;
+import java.lang.reflect.Constructor;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
 
 import static org.junit.Assert.*;
-import java.util.*;
 
 import com.hp.hpl.jena.util.CollectionFactory;
-import com.hp.hpl.jena.util.iterator.*;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+import com.hp.hpl.jena.util.iterator.WrappedIterator;
 
 /**
  * A basis for Jena test cases which provides assertFalse and assertDiffer.
@@ -213,7 +218,7 @@ public class TestUtils {
 
 	private static URL getURL( String fn )
 	{
-		URL u = GraphHelper.class.getClassLoader().getResource(fn);
+		URL u = TestUtils.class.getClassLoader().getResource(fn);
 		if (u == null) {
 			throw new RuntimeException(new FileNotFoundException(fn));
 		}

Added: jena/Experimental/new-test/src/test/resources/Copy of TestReaders.rdf
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/resources/Copy%20of%20TestReaders.rdf?rev=1525287&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/resources/Copy of TestReaders.rdf (added)
+++ jena/Experimental/new-test/src/test/resources/Copy of TestReaders.rdf Sat Sep 21 20:11:59 2013
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<rdf:RDF
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
+
+<rdfs:Class rdf:ID="Resource">
+  <rdfs:label xml:lang="en">Resource</rdfs:label>
+  <rdfs:label xml:lang="fr">Ressource</rdfs:label>
+  <rdfs:comment>The most general class</rdfs:comment>
+</rdfs:Class>
+
+<rdf:Property rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
+  <rdfs:label xml:lang="en">type</rdfs:label>
+  <rdfs:label xml:lang="fr">type</rdfs:label>
+  <rdfs:comment>Indicates membership of a class</rdfs:comment>
+  <rdfs:range rdf:resource="#Class"/>
+</rdf:Property>
+
+<rdf:Property rdf:ID="comment">
+  <rdfs:label xml:lang="en">comment</rdfs:label>
+  <rdfs:label xml:lang="fr">commentaire</rdfs:label>
+  <rdfs:domain rdf:resource="#Resource"/>
+  <rdfs:comment>Use this for descriptions</rdfs:comment>
+  <rdfs:range rdf:resource="#Literal"/>
+</rdf:Property>
+
+<rdf:Property rdf:ID="label">
+ <rdfs:label xml:lang="en">label</rdfs:label>
+ <rdfs:label xml:lang="fr">label</rdfs:label>
+ <rdfs:domain rdf:resource="#Resource"/>
+ <rdfs:comment>Provides a human-readable version of a rdf:resource name.</rdfs:comment>
+ <rdfs:range rdf:resource="#Literal"/>
+</rdf:Property>
+
+<rdfs:Class rdf:ID="Class">
+  <rdfs:label xml:lang="en">Class</rdfs:label>
+  <rdfs:label xml:lang="fr">Classe</rdfs:label>
+  <rdfs:comment>The concept of Class</rdfs:comment>
+  <rdfs:subClassOf rdf:resource="#Resource"/>
+</rdfs:Class>
+
+<rdf:Property rdf:ID="subClassOf">
+  <rdfs:label xml:lang="en">subClassOf</rdfs:label>
+  <rdfs:label xml:lang="fr">sousClasseDe</rdfs:label>
+  <rdfs:comment>Indicates membership of a class</rdfs:comment>
+  <rdfs:range rdf:resource="#Class"/>
+  <rdfs:domain rdf:resource="#Class"/>
+</rdf:Property>
+
+<rdf:Property rdf:ID="subPropertyOf">
+  <rdfs:label xml:lang="en">subPropertyOf</rdfs:label>
+  <rdfs:label xml:lang="fr">sousPropri├ęt├ęDe</rdfs:label>
+  <rdfs:comment>Indicates specialization of properties</rdfs:comment>
+  <rdfs:range rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
+  <rdfs:domain rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
+</rdf:Property>
+
+<rdf:Property rdf:ID="seeAlso">
+  <rdfs:label xml:lang="en">seeAlso</rdfs:label>
+  <rdfs:label xml:lang="fr">voirAussi</rdfs:label>
+  <rdfs:comment>Indicates a rdf:resource that provides information rdf:about the subject rdf:resource.</rdfs:comment>
+  <rdfs:range rdf:resource="#Resource"/>
+  <rdfs:domain rdf:resource="#Resource"/>
+</rdf:Property>
+
+<rdf:Property rdf:ID="isDefinedBy">
+  <rdfs:subPropertyOf rdf:resource="#seeAlso"/>
+  <rdfs:label xml:lang="en">isDefinedBy</rdfs:label>
+  <rdfs:label xml:lang="fr">esD&#233;finiPar</rdfs:label>
+  <rdfs:comment>Indicates a rdf:resource containing and defining the subject rdf:resource.</rdfs:comment>
+  <rdfs:range rdf:resource="#Resource"/>
+  <rdfs:domain rdf:resource="#Resource"/>
+</rdf:Property>
+
+<rdfs:Class rdf:ID="ConstraintResource">
+  <rdfs:label xml:lang="en">ConstraintResource</rdfs:label>
+  <rdfs:label xml:lang="fr">RessourceContrainte</rdfs:label>
+  <rdfs:subClassOf rdf:resource="#Resource"/>
+  <rdfs:comment>Resources used to express RDF Schema constraints.</rdfs:comment>
+</rdfs:Class>
+
+<rdfs:Class rdf:ID="ConstraintProperty">
+  <rdfs:label xml:lang="en">ConstraintProperty</rdfs:label>
+  <rdfs:label xml:lang="fr">Propri&#233;t&#233;Contrainte</rdfs:label>
+  <rdfs:subClassOf rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
+  <rdfs:subClassOf rdf:resource="#ConstraintResource"/>
+  <rdfs:comment>Properties used to express RDF Schema constraints.</rdfs:comment>
+</rdfs:Class>
+
+<rdfs:ConstraintProperty rdf:ID="domain">
+  <rdfs:label xml:lang="en">domain</rdfs:label>
+  <rdfs:label xml:lang="fr">domaine</rdfs:label>
+  <rdfs:comment>This is how we associate a class with properties that its instances can have</rdfs:comment>
+</rdfs:ConstraintProperty>
+
+<rdfs:ConstraintProperty rdf:ID="range">
+  <rdfs:label xml:lang="en">range</rdfs:label>
+  <rdfs:label xml:lang="fr">&#233;tendue</rdfs:label>
+  <rdfs:comment>Properties that can be used in a schema to provide constraints</rdfs:comment>
+  <rdfs:range rdf:resource="#Class"/>
+  <rdfs:domain rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
+</rdfs:ConstraintProperty>
+
+<rdfs:Class rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property">
+  <rdfs:label xml:lang="en">Property</rdfs:label>
+  <rdfs:label xml:lang="fr">Propri&#233;t&#233;</rdfs:label>
+  <rdfs:comment>The concept of a property.</rdfs:comment>
+  <rdfs:subClassOf rdf:resource="#Resource"/>
+</rdfs:Class>
+
+<rdfs:Class rdf:ID="Literal">
+  <rdfs:label xml:lang="en">Literal</rdfs:label>
+  <rdfs:label xml:lang="fr">Litt&#233;ral</rdfs:label>
+  <rdfs:comment>This represents the set of atomic values, eg. textual strings.</rdfs:comment>
+</rdfs:Class>
+
+<rdfs:Class rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement">
+  <rdfs:label xml:lang="en">Statement</rdfs:label>
+  <rdfs:label xml:lang="fr">D&#233;claration</rdfs:label>
+  <rdfs:subClassOf rdf:resource="#Resource"/>
+  <rdfs:comment>This represents the set of reified statements.</rdfs:comment>
+</rdfs:Class>
+
+<rdf:Property rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#subject">
+  <rdfs:label xml:lang="en">subject</rdfs:label>
+  <rdfs:label xml:lang="fr">sujet</rdfs:label>
+  <rdfs:domain rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/>
+  <rdfs:range rdf:resource="#Resource"/>
+</rdf:Property>
+
+<rdf:Property rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate">
+  <rdfs:label xml:lang="en">predicate</rdfs:label>
+  <rdfs:label xml:lang="fr">pr&#233;dicat</rdfs:label>
+  <rdfs:domain rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/>
+  <rdfs:range rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
+</rdf:Property>
+
+<rdf:Property rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#object">
+  <rdfs:label xml:lang="en">object</rdfs:label>
+  <rdfs:label xml:lang="fr">objet</rdfs:label>
+  <rdfs:domain rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/>
+</rdf:Property>
+
+<rdfs:Class rdf:ID="Container">
+  <rdfs:label xml:lang="en">Container</rdfs:label>
+  <rdfs:label xml:lang="fr">Enveloppe</rdfs:label>
+  <rdfs:subClassOf rdf:resource="#Resource"/>
+  <rdfs:comment>This represents the set Containers.</rdfs:comment>
+</rdfs:Class>
+
+<rdfs:Class rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag">
+  <rdfs:label xml:lang="en">Bag</rdfs:label>
+  <rdfs:label xml:lang="fr">Ensemble</rdfs:label>
+  <rdfs:subClassOf rdf:resource="#Container"/>
+</rdfs:Class>
+
+<rdfs:Class rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq">
+  <rdfs:label xml:lang="en">Sequence</rdfs:label>
+  <rdfs:label xml:lang="fr">S&#233;quence</rdfs:label>
+  <rdfs:subClassOf rdf:resource="#Container"/>
+</rdfs:Class>
+
+<rdfs:Class rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt">
+  <rdfs:label xml:lang="en">Alt</rdfs:label>
+  <rdfs:label xml:lang="fr">Choix</rdfs:label>
+  <rdfs:subClassOf rdf:resource="#Container"/>
+</rdfs:Class>
+
+<rdfs:Class rdf:ID="ContainerMembershipProperty">
+  <rdfs:label xml:lang="en">ContainerMembershipProperty</rdfs:label>
+  <rdfs:subClassOf rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
+</rdfs:Class>
+
+<rdf:Property rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#value">
+  <rdfs:label xml:lang="en">object</rdfs:label>
+  <rdfs:label xml:lang="fr">value</rdfs:label>
+</rdf:Property>
+
+<rdf:Description rdf:about="http://www.w3.org/2000/01/rdf-schema#">
+  <rdfs:seeAlso rdf:resource="http://www.w3.org/2000/01/rdf-schema-more"/>
+</rdf:Description>
+
+</rdf:RDF>

Added: jena/Experimental/new-test/src/test/resources/TestReaders.nt
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/resources/TestReaders.nt?rev=1525287&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/resources/TestReaders.nt (added)
+++ jena/Experimental/new-test/src/test/resources/TestReaders.nt Sat Sep 21 20:11:59 2013
@@ -0,0 +1,20 @@
+         
+# comment at the beginning of a line
+
+                # comment in the middle of a line
+
+# comments on
+# consecutive lines       
+         
+
+
+<http://subject> <http://predicate> <http://object> .
+_:a <http://test/p1> _:b .
+
+_:b <http://test/p2> "foo" .
+
+_:c <http://test/p3> "foo\"\\\n\r\tbar" .
+
+_:d <http://test/p4> "foo\u000Abar" .
+
+<e> <p5> "verify base works" .



Mime
View raw message