jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cla...@apache.org
Subject svn commit: r1532898 - in /jena/Experimental/new-test: ./ .settings/ src/test/java/com/hp/hpl/jena/graph/ src/test/java/com/hp/hpl/jena/graph/impl/ src/test/java/com/hp/hpl/jena/rdf/model/ src/test/java/com/hp/hpl/jena/rdf/model/impl/ src/test/java/com...
Date Wed, 16 Oct 2013 20:42:34 GMT
Author: claude
Date: Wed Oct 16 20:42:33 2013
New Revision: 1532898

URL: http://svn.apache.org/r1532898
Log:
Cleaned up code
No compile errors

Added:
    jena/Experimental/new-test/.settings/org.jboss.ide.eclipse.as.core.prefs   (with props)
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/PropertyContractTest.java
      - copied, changed from r1530718, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractPropertyTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/IResourceProducer.java   (with props)
Removed:
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractPropertyTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/FindPropertiesTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ReifiedStatementTest.java
Modified:
    jena/Experimental/new-test/.classpath
    jena/Experimental/new-test/.settings/org.eclipse.core.resources.prefs
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/GraphContractTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelContractSuite.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/LiteralContractTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelConContractTests.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelContractTests.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelFactoryTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFListContractTests.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFReaderFContractTests.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFWriterFContractTests.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ResourceContractTests.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/impl/PropertyImplTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/AltMethodsTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/BagMethodsTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/LiteralTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelGraphInterfaceTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelSuite.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/RDFListTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ResourceNodeTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/SeqMethodsTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/RandomOrderGraphTest.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphHelper.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/IContainerProducer.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/util/iterator/ExtendedIteratorContractTests.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/util/iterator/WrappedIteratorTest.java

Modified: jena/Experimental/new-test/.classpath
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/.classpath?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/.classpath (original)
+++ jena/Experimental/new-test/.classpath Wed Oct 16 20:42:33 2013
@@ -12,7 +12,8 @@
 			<attribute name="maven.pomderived" value="true"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="src" path="src/test/resources"/>
+	<classpathentry including="**/*.java" kind="src" path="src/test/resources"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/jena-core"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
 		<attributes>
 			<attribute name="maven.pomderived" value="true"/>

Modified: jena/Experimental/new-test/.settings/org.eclipse.core.resources.prefs
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/.settings/org.eclipse.core.resources.prefs?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/.settings/org.eclipse.core.resources.prefs (original)
+++ jena/Experimental/new-test/.settings/org.eclipse.core.resources.prefs Wed Oct 16 20:42:33 2013
@@ -1,3 +1,5 @@
 eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
 encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
 encoding/<project>=UTF-8

Added: jena/Experimental/new-test/.settings/org.jboss.ide.eclipse.as.core.prefs
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/.settings/org.jboss.ide.eclipse.as.core.prefs?rev=1532898&view=auto
==============================================================================
--- jena/Experimental/new-test/.settings/org.jboss.ide.eclipse.as.core.prefs (added)
+++ jena/Experimental/new-test/.settings/org.jboss.ide.eclipse.as.core.prefs Wed Oct 16 20:42:33 2013
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.jboss.ide.eclipse.as.core.singledeployable.deployableList=src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelTest.java\n

Propchange: jena/Experimental/new-test/.settings/org.jboss.ide.eclipse.as.core.prefs
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/GraphContractTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/GraphContractTest.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/GraphContractTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/GraphContractTest.java Wed Oct 16 20:42:33 2013
@@ -469,7 +469,7 @@ public abstract class GraphContractTest 
 				graph.contains(triple("S2 P2 O2")));
 		assertTrue("Graph should contain <S3 P3 O3>",
 				graph.contains(triple("S3 P3 O3")));
-		GL.assertEmpty();
+		GL.assertHas( "delete", graph, new Triple( node("S2"), node("P2"), Node.ANY) );
 	}
 
 	@Test

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphTest.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphTest.java Wed Oct 16 20:42:33 2013
@@ -39,10 +39,21 @@ import org.xenei.junit.contract.IProduce
 @ContractImpl(WrappedGraph.class)
 public class WrappedGraphTest {
 
-	protected IProducer<WrappedGraph> graphProducer = new WrappedGraphSuite.GraphProducer();
+	protected IProducer<? extends WrappedGraph> graphProducer;
+
+	public WrappedGraphTest()
+	{
+		this( new WrappedGraphSuite.GraphProducer() );
+	}
+	
+	protected WrappedGraphTest( IProducer<? extends WrappedGraph> producer )
+	{
+		graphProducer = producer;
+	}
+	
 
 	@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
-	public IProducer<WrappedGraph> getGraphProducer() {
+	public IProducer<? extends WrappedGraph> getGraphProducer() {
 		return graphProducer;
 	}
 

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelContractSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelContractSuite.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelContractSuite.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelContractSuite.java Wed Oct 16 20:42:33 2013
@@ -1,12 +1,9 @@
 package com.hp.hpl.jena.rdf.model;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Set;
 import java.util.StringTokenizer;
 
-import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 import org.xenei.junit.contract.Contract;
@@ -14,17 +11,12 @@ import org.xenei.junit.contract.Contract
 import org.xenei.junit.contract.ContractSuite;
 import org.xenei.junit.contract.Contract.Inject;
 
-import static com.hp.hpl.jena.testing_framework.GraphHelper.arrayToSet;
 import static com.hp.hpl.jena.testing_framework.ModelHelper.*;
-import static org.junit.Assert.assertEquals;
-
-import com.hp.hpl.jena.shared.PrefixMapping;
 import com.hp.hpl.jena.testing_framework.IContainerProducer;
 import com.hp.hpl.jena.testing_framework.AbstractModelProducer;
 import com.hp.hpl.jena.testing_framework.INodeProducer;
+import com.hp.hpl.jena.testing_framework.IResourceProducer;
 import com.hp.hpl.jena.testing_framework.IStatementProducer;
-import com.hp.hpl.jena.util.iterator.ExtendedIterator;
-import com.hp.hpl.jena.util.iterator.WrappedIterator;
 import com.hp.hpl.jena.util.iterator.ExtendedIteratorContractTests.IteratorProducer;
 import com.hp.hpl.jena.vocabulary.RDF;
 
@@ -32,14 +24,13 @@ import com.hp.hpl.jena.vocabulary.RDF;
 		AbstractModelContractSuite.AltMethodsTests.class,
 		AbstractModelContractSuite.BagMethodsTests.class,
 		AbstractModelContractSuite.SeqMethodsTests.class,
-		// AbstractModelContractSuite.RDFNodeTests.class,
 		AbstractModelContractSuite.ResourceTests.class,
 		AbstractModelContractSuite.StatementTests.class,
 		AbstractModelContractSuite.StatementIterTests.class,
 		AbstractModelContractSuite.NodeIterTests.class,
 		AbstractModelContractSuite.NameSpaceIteratorTests.class,
 		AbstractModelContractSuite.ReifiedStatementIteratorTests.class})
-// @RunWith( ContractSuite.class )
+
 public abstract class AbstractModelContractSuite {
 
 	static protected AbstractModelProducer<Model> modelProducer;
@@ -103,6 +94,11 @@ public abstract class AbstractModelContr
 			public Class<? extends Container> getContainerClass() {
 				return Alt.class;
 			}
+
+			@Override
+			public boolean supportsAnonymous() {
+				return true;
+			}
 		};
 
 		@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
@@ -155,6 +151,11 @@ public abstract class AbstractModelContr
 			public Class<? extends Container> getContainerClass() {
 				return Bag.class;
 			}
+
+			@Override
+			public boolean supportsAnonymous() {
+				return true;
+			}
 		};
 
 		@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
@@ -205,6 +206,11 @@ public abstract class AbstractModelContr
 			public Class<? extends Container> getContainerClass() {
 				return Seq.class;
 			}
+
+			@Override
+			public boolean supportsAnonymous() {
+				return true;
+			}
 		};
 
 		@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
@@ -330,6 +336,7 @@ public abstract class AbstractModelContr
 					statement( "s p o4" ) };
 			
 			
+			@Override
 			public List<Statement> getList() {
 				return Arrays.asList( objs );
 			}
@@ -388,6 +395,7 @@ public abstract class AbstractModelContr
 					rdfNode("p3"), rdfNode("o3"),
 					rdfNode("o4" ) };
 			
+			@Override
 			public List<RDFNode> getList() {
 				return Arrays.asList( objs );
 			}
@@ -451,6 +459,7 @@ public abstract class AbstractModelContr
 					"http://example.com/five/",
 					RDF.type.getNameSpace()};
 			
+			@Override
 			public List<String> getList() {
 				return Arrays.asList( uris );
 			}
@@ -523,6 +532,7 @@ public abstract class AbstractModelContr
 			List<ReifiedStatement> stmts;
 		
 			
+			@Override
 			public List<ReifiedStatement> getList() {
 				return stmts;
 			}
@@ -571,4 +581,55 @@ public abstract class AbstractModelContr
 		}
 
 	}
+	
+	public interface P extends Property{}
+	@RunWith(ContractSuite.class)
+	@ContractImpl(P.class)
+	public static class PropertyTests {
+		IResourceProducer<Property> producer = new IResourceProducer<Property>() {
+			
+			private Model m = null;
+			
+			@Override
+			public Property newInstance() {
+				return getModel().createProperty("");
+			}
+
+			@Override
+			public void cleanUp() {
+				if (m!= null)
+				{
+					m.close();
+					m = null;
+				}
+			}
+
+			@Override
+			public Property newInstance(String uri) {
+				return getModel().createProperty( uri );
+			}
+
+			@Override
+			public Model getModel() {
+				if (m == null)
+				{
+					m = modelProducer.newInstance();
+				}
+				return m;
+			}
+
+			@Override
+			public boolean supportsAnonymous() {
+				// TODO Auto-generated method stub
+				return false;
+			}
+
+		};
+
+		@Inject("com.hp.hpl.jena.testing_framework.IResourceProducer<%s>")
+		public IResourceProducer<Property> getIteratorProducer() {
+			return producer;
+		}
+
+	}
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/LiteralContractTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/LiteralContractTest.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/LiteralContractTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/LiteralContractTest.java Wed Oct 16 20:42:33 2013
@@ -22,12 +22,8 @@ import static com.hp.hpl.jena.testing_fr
 import static org.junit.Assert.*;
 
 import com.hp.hpl.jena.datatypes.DatatypeFormatException;
-import com.hp.hpl.jena.datatypes.TypeMapper;
 import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
-import com.hp.hpl.jena.graph.impl.AdhocDatatype;
 import com.hp.hpl.jena.rdf.model.Literal;
-import com.hp.hpl.jena.rdf.model.LiteralRequiredException;
-import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.shared.BadBooleanException;
 import com.hp.hpl.jena.shared.BadCharLiteralException;
 import com.hp.hpl.jena.testing_framework.INodeProducer;

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelConContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelConContractTests.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelConContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelConContractTests.java Wed Oct 16 20:42:33 2013
@@ -19,7 +19,6 @@
 package com.hp.hpl.jena.rdf.model;
 
 import static com.hp.hpl.jena.testing_framework.ModelHelper.*;
-import static com.hp.hpl.jena.testing_framework.TestUtils.assertInstanceOf;
 import static org.junit.Assert.*;
 import java.util.Arrays;
 import java.util.Calendar;
@@ -42,7 +41,6 @@ import com.hp.hpl.jena.graph.NodeFactory
 import com.hp.hpl.jena.graph.impl.AdhocDatatype;
 import com.hp.hpl.jena.rdf.model.impl.StmtIteratorImpl;
 import org.xenei.junit.contract.IProducer;
-import com.hp.hpl.jena.testing_framework.ModelHelper;
 import com.hp.hpl.jena.testing_framework.NodeCreateUtils;
 import com.hp.hpl.jena.vocabulary.RDF;
 
@@ -72,7 +70,7 @@ public abstract class ModelConContractTe
 		if (modelCon instanceof Model) {
 			model = (Model) modelCon;
 		} else {
-			// hould be empty so this won't matter.
+			// should be empty so this won't matter.
 			model = modelCon.remove(null, null, null);
 		}
 		SL = new RecordingModelListener();
@@ -961,8 +959,8 @@ public abstract class ModelConContractTe
 		
 
 		try {
-			final LitTestObj ra = new LitTestObj("rhubarb");
-			final LitTestObj rb = new LitTestObj("cottage");
+			final LitTestObj ra = new LitTestObj("r11");
+			final LitTestObj rb = new LitTestObj("r12");
 			Assert.assertNull("not expecting registered RDF Datatype",
 					TypeMapper.getInstance().getTypeByValue(ra));
 			txnBegin(model);

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelContractTests.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelContractTests.java Wed Oct 16 20:42:33 2013
@@ -18,10 +18,7 @@
 
 package com.hp.hpl.jena.rdf.model;
 
-import static com.hp.hpl.jena.testing_framework.GraphHelper.arrayToSet;
-import static com.hp.hpl.jena.testing_framework.GraphHelper.iteratorToSet;
 import static com.hp.hpl.jena.testing_framework.ModelHelper.*;
-import static com.hp.hpl.jena.testing_framework.TestUtils.assertInstanceOf;
 import static org.junit.Assert.*;
 import static org.mockito.Mockito.*;
 
@@ -37,8 +34,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
-
 import javax.xml.XMLConstants;
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.parsers.DocumentBuilder;

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelFactoryTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelFactoryTest.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelFactoryTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelFactoryTest.java Wed Oct 16 20:42:33 2013
@@ -18,8 +18,6 @@
 
 package com.hp.hpl.jena.rdf.model;
 
-import static com.hp.hpl.jena.testing_framework.ModelHelper.*;
-
 import com.hp.hpl.jena.graph.compose.Union;
 import com.hp.hpl.jena.rdf.model.InfModel;
 import com.hp.hpl.jena.rdf.model.Model;

Copied: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/PropertyContractTest.java (from r1530718, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractPropertyTest.java)
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/PropertyContractTest.java?p2=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/PropertyContractTest.java&p1=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractPropertyTest.java&r1=1530718&r2=1532898&rev=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractPropertyTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/PropertyContractTest.java Wed Oct 16 20:42:33 2013
@@ -19,15 +19,20 @@
 package com.hp.hpl.jena.rdf.model;
 
 import com.hp.hpl.jena.rdf.model.Property;
+import com.hp.hpl.jena.testing_framework.IResourceProducer;
 import com.hp.hpl.jena.vocabulary.RDF;
 import com.hp.hpl.jena.vocabulary.RDFS;
 
 import org.junit.Assert;
 import org.junit.Test;
+import org.xenei.junit.contract.Contract;
 
-public abstract class AbstractPropertyTest {
+@Contract(Property.class)
+public abstract class PropertyContractTest {
+
+	@Contract.Inject("com.hp.hpl.jena.testing_framework.IResourceProducer<%s>")
+	public abstract IResourceProducer<Property> getResourceProducer();
 
-	abstract protected Property createProperty(final String uri);
 
 	// {
 	// return new PropertyImpl(uri);
@@ -54,7 +59,7 @@ public abstract class AbstractPropertyTe
 	private void testOrdinalValue(final int i, final String URI) {
 		final String message = "property should have expected ordinal value for "
 				+ URI;
-		Assert.assertEquals(message, i, createProperty(URI).getOrdinal());
+		Assert.assertEquals(message, i, getResourceProducer().newInstance(URI).getOrdinal());
 	}
 
 	@Test

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFListContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFListContractTests.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFListContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFListContractTests.java Wed Oct 16 20:42:33 2013
@@ -33,7 +33,7 @@ import com.hp.hpl.jena.rdf.model.Propert
 import com.hp.hpl.jena.rdf.model.RDFList;
 import com.hp.hpl.jena.rdf.model.RDFNode;
 import com.hp.hpl.jena.rdf.model.Resource;
-import com.hp.hpl.jena.testing_framework.INodeProducer;
+import com.hp.hpl.jena.testing_framework.IResourceProducer;
 
 import com.hp.hpl.jena.util.iterator.Map1;
 import com.hp.hpl.jena.vocabulary.RDF;
@@ -63,7 +63,7 @@ import org.xenei.junit.contract.Contract
 public abstract class RDFListContractTests {
 
 	@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
-	abstract public INodeProducer<RDFList> getListProducer();
+	abstract public IResourceProducer<RDFList> getListProducer();
 
 	private Model model;
 

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFReaderFContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFReaderFContractTests.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFReaderFContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFReaderFContractTests.java Wed Oct 16 20:42:33 2013
@@ -3,6 +3,7 @@ package com.hp.hpl.jena.rdf.model;
 import java.io.InputStream;
 import java.io.Reader;
 
+import org.junit.Ignore;
 import org.junit.Test;
 import org.xenei.junit.contract.Contract;
 
@@ -15,7 +16,7 @@ import static com.hp.hpl.jena.testing_fr
 @Contract(RDFReaderF.class)
 public abstract class RDFReaderFContractTests {
 
-	@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+	@Contract.Inject("org.xenei.junit.contract.IProducer<%s>")
 	protected abstract IProducer<RDFReaderF> getRDFReaderFProducer();
 
 	@Test
@@ -74,25 +75,27 @@ public abstract class RDFReaderFContract
 
 	}
 
+	@Ignore("enable test when ability to remove reader is available")
 	@Test
 	public void testSetReaderClassName() throws Exception {
+		RDFReaderF readerF = getRDFReaderFProducer().newInstance();
 
-		String before = getRDFReaderFProducer().newInstance()
-				.setReaderClassName("foo", DummyReader.class.getName());
-
-		assertNull("Should not be an existing name", before);
-
-		RDFReader reader = getRDFReaderFProducer().newInstance().getReader(
-				"foo");
-		assertEquals("Wrong reader type", DummyReader.class, reader.getClass());
+		try {
+			String before = readerF.setReaderClassName("foo",
+					DummyReader.class.getName());
 
-		// FIXME add test when remove reader is available
-		// String s2 = getRDFReaderF().setReaderClassName("foo", null);
-		// assertEquals( DummyReader.class.getCanonicalName(), s2 );
+			assertNull("Should not be an existing name", before);
 
-		// reader = getRDFReaderF().getReader("foo");
-		// assertNull( "should not return a reder", reader );
+			RDFReader reader = readerF.getReader("foo");
+			assertEquals("Wrong reader type", DummyReader.class,
+					reader.getClass());
+		} finally {
+			String s2 = readerF.setReaderClassName("foo", null);
+			assertEquals(DummyReader.class.getCanonicalName(), s2);
 
+			RDFReader reader = readerF.getReader("foo");
+			assertNull("should not return a reader", reader);
+		}
 	}
 
 	public static class DummyReader implements RDFReader {

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFWriterFContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFWriterFContractTests.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFWriterFContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFWriterFContractTests.java Wed Oct 16 20:42:33 2013
@@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.OutputStream;
 import java.io.Writer;
 
+import org.junit.Ignore;
 import org.junit.Test;
 import org.xenei.junit.contract.Contract;
 
@@ -15,7 +16,7 @@ import static org.junit.Assert.*;
 @Contract(RDFWriterF.class)
 public abstract class RDFWriterFContractTests {
 
-	@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+	@Contract.Inject("org.xenei.junit.contract.IProducer<%s>")
 	protected abstract IProducer<RDFWriterF> getRDFWriterFProducer();
 
 	private Model model = ModelFactory.createModelForGraph(TestFileData
@@ -70,26 +71,27 @@ public abstract class RDFWriterFContract
 
 	}
 
+	@Ignore("enable test when remove reader is available")
 	@Test
 	public void testSetWriterClassName() throws Exception {
+		RDFWriterF writerF = getRDFWriterFProducer().newInstance();
+		try {
+			String before = writerF.setWriterClassName("foo",
+					DummyWriter.class.getName());
 
-		String before = getRDFWriterFProducer().newInstance()
-				.setWriterClassName("foo", DummyWriter.class.getName());
+			assertNull("Should not be an existing name", before);
 
-		assertNull("Should not be an existing name", before);
+			RDFWriter writer = writerF.getWriter("foo");
+			assertEquals("Wrong reader type", DummyWriter.class,
+					writer.getClass());
+		} finally {
 
-		RDFWriter writer = getRDFWriterFProducer().newInstance().getWriter(
-				"foo");
-		assertEquals("Wrong reader type", DummyWriter.class, writer.getClass());
+			String s2 = writerF.setWriterClassName("foo", null);
+			assertEquals(DummyWriter.class.getCanonicalName(), s2);
 
-		// FIXME add test when remove reader is available
-		// String s2 =
-		// getRDFWriterFProducer().newInstance().setWriterClassName("foo",
-		// null);
-		// assertEquals( DummyWriter.class.getCanonicalName(), s2 );
-		//
-		// writer = getRDFWriterFProducer().newInstance().getWriter("foo");
-		// assertNull( "should not return a reder", writer );
+			RDFWriter writer = writerF.getWriter("foo");
+			assertNull("should not return a reder", writer);
+		}
 
 	}
 

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ResourceContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ResourceContractTests.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ResourceContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ResourceContractTests.java Wed Oct 16 20:42:33 2013
@@ -26,7 +26,7 @@ import com.hp.hpl.jena.rdf.model.Literal
 import com.hp.hpl.jena.rdf.model.RDFNode;
 import com.hp.hpl.jena.rdf.model.Resource;
 import com.hp.hpl.jena.shared.PropertyNotFoundException;
-import com.hp.hpl.jena.testing_framework.INodeProducer;
+import com.hp.hpl.jena.testing_framework.IResourceProducer;
 
 import com.hp.hpl.jena.vocabulary.RDF;
 
@@ -53,8 +53,8 @@ public abstract class ResourceContractTe
 	private RecordingModelListener SL;
 	private Model model;
 
-	@Contract.Inject("com.hp.hpl.jena.testing_framework.INodeProducer<%s>")
-	public abstract INodeProducer<Resource> getResourceProducer();
+	@Contract.Inject("com.hp.hpl.jena.testing_framework.IResourceProducer<%s>")
+	public abstract IResourceProducer<Resource> getResourceProducer();
 
 	@Before
 	public final void setupAbstractResourceTests() {
@@ -459,7 +459,10 @@ public abstract class ResourceContractTe
 
 	@Test
 	public void testGetURI() {
-		assertNull(r.getURI());
+		if (getResourceProducer().supportsAnonymous())
+		{
+			assertNull(r.getURI());
+		}
 		assertEquals("http://example.com/foo",
 				model.createResource("http://example.com/foo").getURI());
 	}
@@ -805,4 +808,6 @@ public abstract class ResourceContractTe
 	// assertTrue(r.hasProperty(RDF.value,
 	// tvString, lang));
 	// }
+	
+	
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/impl/PropertyImplTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/impl/PropertyImplTest.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/impl/PropertyImplTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/impl/PropertyImplTest.java Wed Oct 16 20:42:33 2013
@@ -18,16 +18,64 @@
 
 package com.hp.hpl.jena.rdf.model.impl;
 
-import com.hp.hpl.jena.rdf.model.AbstractPropertyTest;
+import org.junit.runner.RunWith;
+import org.xenei.junit.contract.ContractImpl;
+import org.xenei.junit.contract.ContractSuite;
+import org.xenei.junit.contract.Contract.Inject;
+
+import com.hp.hpl.jena.rdf.model.PropertyContractTest;
 import com.hp.hpl.jena.rdf.model.Property;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.IResourceProducer;
 
 /**
  * Test ModelMakerImpl using a mock GraphMaker.
  */
-public class PropertyImplTest extends AbstractPropertyTest {
+@RunWith(ContractSuite.class)
+@ContractImpl( PropertyImpl.class )
+public class PropertyImplTest extends PropertyContractTest {
+
+	IResourceProducer<Property> producer = new IResourceProducer<Property>(){
+
+		ModelCom model = null;
+		
+		@Override
+		public Property newInstance() {
+			return new PropertyImpl("", getModel());
+		}
+
+		@Override
+		public void cleanUp() {
+			if (model != null)
+			{
+				model.close();
+				model = null;
+			}
+		}
+
+		@Override
+		public Property newInstance(String uri) {
+			return new PropertyImpl(uri, getModel());
+		}
+
+		@Override
+		public ModelCom getModel() {
+			if (model == null)
+			{
+				model = new ModelCom( GraphFactory.createDefaultGraph() );
+			}
+			return model;
+		}
 
+		@Override
+		public boolean supportsAnonymous() {
+			return false;
+		}};
+	
+	
 	@Override
-	protected Property createProperty(String uri) {
-		return new PropertyImpl(uri);
+	@Inject("com.hp.hpl.jena.testing_framework.IResourceProducer<%s>")
+	public IResourceProducer<Property> getResourceProducer() {
+		return producer;
 	}
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/AltMethodsTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/AltMethodsTest.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/AltMethodsTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/AltMethodsTest.java Wed Oct 16 20:42:33 2013
@@ -48,6 +48,11 @@ public class AltMethodsTest extends AltC
 		public Class<? extends Container> getContainerClass() {
 			return Alt.class;
 		}
+
+		@Override
+		public boolean supportsAnonymous() {
+			return false;
+		}
 	};
 
 	@Override

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/BagMethodsTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/BagMethodsTest.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/BagMethodsTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/BagMethodsTest.java Wed Oct 16 20:42:33 2013
@@ -48,6 +48,11 @@ public class BagMethodsTest extends BagC
 		public Class<? extends Container> getContainerClass() {
 			return Bag.class;
 		}
+		
+		@Override
+		public boolean supportsAnonymous() {
+			return false;
+		}
 	};
 
 	@Override

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=1532898&r1=1532897&r2=1532898&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 Wed Oct 16 20:42:33 2013
@@ -2,10 +2,8 @@ package com.hp.hpl.jena.rdf.model.temp;
 
 import com.hp.hpl.jena.rdf.model.Literal;
 import com.hp.hpl.jena.rdf.model.LiteralContractTest;
-import com.hp.hpl.jena.rdf.model.ModelContractTests;
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
-import com.hp.hpl.jena.testing_framework.AbstractModelProducer;
 
 public class LiteralTest extends LiteralContractTest {
 

Modified: 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=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelGraphInterfaceTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelGraphInterfaceTest.java Wed Oct 16 20:42:33 2013
@@ -1,41 +1,41 @@
 package com.hp.hpl.jena.rdf.model.temp;
 
 import org.junit.After;
-import org.junit.Test;
+import org.xenei.junit.contract.Contract.Inject;
+import org.xenei.junit.contract.IProducer;
 
-import com.hp.hpl.jena.rdf.model.ModelConContractTests;
 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;
 
 public class ModelGraphInterfaceTest extends
 		AbstractModelGraphInterfaceContractTests {
 
-	AbstractModelProducer producer = new AbstractModelProducer() {
+	IProducer<ModelGraphInterface> producer = new IProducer<ModelGraphInterface>() {
+
+		
 
 		@Override
-		protected Model createNewModel() {
+		public ModelGraphInterface newInstance() {
 			return ModelFactory.createDefaultModel();
 		}
 
+		@Override
+		public void cleanUp() {
+		}
+
 	};
 
-	private Model model;
 
 	@After
 	final public void afterModelGraphInterfaceTest() {
-		producer.closeModels();
-		model = null;
+		producer.cleanUp();
 	}
 
 	@Override
-	protected ModelGraphInterface getModelGraphInterface() {
-		if (model == null) {
-			model = producer.newModel();
-		}
-		return model;
+	@Inject("org.xenei.junit.contract.IProducer<%s>")
+	protected IProducer<ModelGraphInterface> getModelGraphInterfaceProducer() {
+		return producer;
 	}
 
 }

Modified: 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=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelSuite.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ModelSuite.java Wed Oct 16 20:42:33 2013
@@ -1,8 +1,10 @@
 package com.hp.hpl.jena.rdf.model.temp;
 
 import org.junit.runner.RunWith;
+import org.xenei.junit.contract.ContractImpl;
 import org.xenei.junit.contract.ContractSuite;
 
 @RunWith(ContractSuite.class)
+@ContractImpl(ModelSuite.class)
 public class ModelSuite extends ModelTest {
 }

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=1532898&r1=1532897&r2=1532898&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 Wed Oct 16 20:42:33 2013
@@ -1,23 +1,58 @@
 package com.hp.hpl.jena.rdf.model.temp;
 
+import org.xenei.junit.contract.Contract.Inject;
+
+import com.hp.hpl.jena.rdf.model.RDFList;
 import com.hp.hpl.jena.rdf.model.RDFListContractTests;
 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.IResourceProducer;
 
 public class RDFListTest extends RDFListContractTests {
 
-	AbstractModelProducer producer = new AbstractModelProducer() {
+	IResourceProducer<RDFList> producer = new IResourceProducer<RDFList>() {
+
+		Model model;
+		
+		@Override
+		public RDFList newInstance(String uri) {
+			return getModel().createResource( uri ).as( RDFList.class );
+		}
+
+		@Override
+		public Model getModel() {
+			if (model == null)
+			{
+				model = ModelFactory.createDefaultModel();
+			}
+			return model;
+		}
+
+		@Override
+		public RDFList newInstance() {
+			return getModel().createList();
+		}
+
+		@Override
+		public void cleanUp() {
+			if (model == null)
+			{
+				model.close();
+				model = null;
+			}
+		}
 
 		@Override
-		protected Model createNewModel() {
-			return ModelFactory.createDefaultModel();
+		public boolean supportsAnonymous() {
+			// TODO Auto-generated method stub
+			return false;
 		}
 
 	};
 
 	@Override
-	public ModelProducerInterface getModelProducer() {
+	@Inject("org.xenei.junit.contract.IProducer<%s>")
+	public IResourceProducer<RDFList> getListProducer() {
 		return producer;
 	}
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ResourceNodeTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ResourceNodeTest.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ResourceNodeTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/ResourceNodeTest.java Wed Oct 16 20:42:33 2013
@@ -6,11 +6,11 @@ import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.Resource;
 import com.hp.hpl.jena.rdf.model.ResourceContractTests;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
-import com.hp.hpl.jena.testing_framework.INodeProducer;
+import com.hp.hpl.jena.testing_framework.IResourceProducer;
 
 public class ResourceNodeTest extends ResourceContractTests {
 
-	INodeProducer<Resource> producer = new INodeProducer<Resource>() {
+	IResourceProducer<Resource> producer = new IResourceProducer<Resource>() {
 		Model model = null;
 
 		@Override
@@ -37,11 +37,16 @@ public class ResourceNodeTest extends Re
 			}
 			return model;
 		}
+
+		@Override
+		public boolean supportsAnonymous() {
+			return false;
+		}
 	};
 
 	@Override
 	@Inject("com.hp.hpl.jena.testing_framework.INodeProducer<%s>")
-	public INodeProducer<Resource> getResourceProducer() {
+	public IResourceProducer<Resource> getResourceProducer() {
 		return producer;
 	}
 

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/SeqMethodsTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/SeqMethodsTest.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/SeqMethodsTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/temp/SeqMethodsTest.java Wed Oct 16 20:42:33 2013
@@ -47,6 +47,11 @@ public class SeqMethodsTest extends SeqC
 		public Class<? extends Container> getContainerClass() {
 			return Seq.class;
 		}
+		
+		@Override
+		public boolean supportsAnonymous() {
+			return false;
+		}
 	};
 
 	@Override

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/RandomOrderGraphTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/RandomOrderGraphTest.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/RandomOrderGraphTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/RandomOrderGraphTest.java Wed Oct 16 20:42:33 2013
@@ -6,31 +6,31 @@ import java.util.List;
 
 import org.junit.Assert;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractSuite;
+import org.xenei.junit.contract.ContractImpl;
+import org.xenei.junit.contract.IProducer;
 
 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.graph.TripleMatch;
-import com.hp.hpl.jena.graph.impl.WrappedGraphSuite;
+import com.hp.hpl.jena.graph.impl.WrappedGraph;
 import com.hp.hpl.jena.graph.impl.WrappedGraphTest;
 import com.hp.hpl.jena.sparql.graph.GraphFactory;
 import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
 
+@RunWith(ContractSuite.class)
+@ContractImpl(RandomOrderGraph.class)
 public class RandomOrderGraphTest extends WrappedGraphTest {
 
 	public RandomOrderGraphTest() {
-		graphProducer = new AbstractGraphProducer() {
-
-			@Override
-			protected Graph createNewGraph() {
-				return new RandomOrderGraph(5, GraphFactory.createGraphMem());
-			}
-		};
+		super(  new Producer() );	
 	}
 
 	@Test
 	public void testRandomFindTriple() {
-		Graph g = graphWithTxn("a b 1; a b 2; a b 3; a b 4; a b 5; a b 6");
+		Graph g = graphWith( graphProducer.newInstance(), "a b 1; a b 2; a b 3; a b 4; a b 5; a b 6");
 		List<Triple> l1 = g.find(new Triple(node("a"), node("b"), Node.ANY))
 				.toList();
 		List<Triple> l2 = g.find(new Triple(node("a"), node("b"), Node.ANY))
@@ -40,10 +40,22 @@ public class RandomOrderGraphTest extend
 
 	@Test
 	public void testRandomFindNodes() {
-		Graph g = graphWithTxn("a b 1; a b 2; a b 3; a b 4; a b 5; a b 6");
+		Graph g = graphWith(graphProducer.newInstance(), "a b 1; a b 2; a b 3; a b 4; a b 5; a b 6");
 		List<Triple> l1 = g.find(node("a"), node("b"), Node.ANY).toList();
 		List<Triple> l2 = g.find(node("a"), node("b"), Node.ANY).toList();
 		Assert.assertNotEquals("Lists should be different", l1, l2);
 	}
 
+	@Override
+	@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+	public IProducer<? extends WrappedGraph> getGraphProducer() {
+		return super.getGraphProducer();
+	}
+	
+	private static class Producer extends AbstractGraphProducer<RandomOrderGraph> {
+		@Override
+		public RandomOrderGraph createNewGraph() {
+			return new RandomOrderGraph(5, GraphFactory.createGraphMem());
+		}
+	};
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphHelper.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphHelper.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphHelper.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphHelper.java Wed Oct 16 20:42:33 2013
@@ -34,9 +34,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.StringTokenizer;
 
-import org.xenei.junit.contract.IProducer;
-
-
 import com.hp.hpl.jena.graph.Factory;
 import com.hp.hpl.jena.graph.Graph;
 import com.hp.hpl.jena.graph.GraphUtil;
@@ -294,18 +291,18 @@ public class GraphHelper extends TestUti
 			b.append(nice(n));
 	}
 
-	protected static Graph graphWithTxn(IProducer<Graph> producer, String s) {
-		Graph g = producer.newInstance();
-		txnBegin(g);
-		try {
-			graphAdd(g, s);
-			txnCommit(g);
-		} catch (Exception e) {
-			txnRollback(g);
-			fail(e.getMessage());
-		}
-		return g;
-	}
+//	protected static Graph graphWithTxn(IProducer<? extends Graph> producer, String s) {
+//		Graph g = producer.newInstance();
+//		txnBegin(g);
+//		try {
+//			graphAdd(g, s);
+//			txnCommit(g);
+//		} catch (Exception e) {
+//			txnRollback(g);
+//			fail(e.getMessage());
+//		}
+//		return g;
+//	}
 
 	/**
 	 * Answer the "nice" representation of this node, the string returned by

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/IContainerProducer.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/IContainerProducer.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/IContainerProducer.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/IContainerProducer.java Wed Oct 16 20:42:33 2013
@@ -3,8 +3,7 @@ package com.hp.hpl.jena.testing_framewor
 import com.hp.hpl.jena.rdf.model.Container;
 import com.hp.hpl.jena.rdf.model.Resource;
 
-public interface IContainerProducer<T extends Container> extends
-		INodeProducer<T> {
+public interface IContainerProducer<T extends Container> extends IResourceProducer<T> {
 
 	/**
 	 * The Resource identifying the continer type. e.g. RDF.seq

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/IResourceProducer.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/IResourceProducer.java?rev=1532898&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/IResourceProducer.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/IResourceProducer.java Wed Oct 16 20:42:33 2013
@@ -0,0 +1,10 @@
+package com.hp.hpl.jena.testing_framework;
+
+import com.hp.hpl.jena.rdf.model.Resource;
+
+public interface IResourceProducer<X extends Resource> extends INodeProducer<X> {
+	/**
+	 * Returns true if the Resource implementation supports non URI values
+	 */
+	boolean supportsAnonymous();
+}
\ No newline at end of file

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

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/util/iterator/ExtendedIteratorContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/util/iterator/ExtendedIteratorContractTests.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/util/iterator/ExtendedIteratorContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/util/iterator/ExtendedIteratorContractTests.java Wed Oct 16 20:42:33 2013
@@ -4,17 +4,14 @@ import static org.junit.Assert.*;
 
 import java.util.ArrayList;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.jena.atlas.logging.Log;
 import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xenei.junit.contract.Contract;
-import org.xenei.junit.contract.IProducer;
 
 @Contract(ExtendedIterator.class)
 public abstract class ExtendedIteratorContractTests {
@@ -105,9 +102,9 @@ public abstract class ExtendedIteratorCo
 	 */
 	@Test
 	public void testAndThen() {
-		ExtendedIterator<Object> iter = (ExtendedIterator<Object>) getIteratorProducer()
+		ExtendedIterator<Object> iter = getIteratorProducer()
 				.newInstance();
-		ExtendedIterator<Object> iter2 = (ExtendedIterator<Object>) getIteratorProducer()
+		ExtendedIterator<Object> iter2 = getIteratorProducer()
 				.newInstance();
 
 		iter = iter.andThen(iter2);

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/util/iterator/WrappedIteratorTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/util/iterator/WrappedIteratorTest.java?rev=1532898&r1=1532897&r2=1532898&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/util/iterator/WrappedIteratorTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/util/iterator/WrappedIteratorTest.java Wed Oct 16 20:42:33 2013
@@ -4,17 +4,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.junit.runner.RunWith;
-import org.xenei.junit.contract.Contract;
 import org.xenei.junit.contract.Contract.Inject;
-import org.xenei.junit.contract.ContractImpl;
-import org.xenei.junit.contract.ContractSuite;
-import org.xenei.junit.contract.IProducer;
-
-import com.hp.hpl.jena.rdf.model.ModelContractTests;
-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.util.iterator.ExtendedIterator;
 import com.hp.hpl.jena.util.iterator.WrappedIterator;
 
@@ -25,6 +15,7 @@ public class WrappedIteratorTest extends
 		List<String> objs = new ArrayList<String>(
 				Arrays.asList(new String[]{ "one", "two", "three", "four" }) );
 		
+		@Override
 		public List<String> getList() {
 			return objs;
 		}



Mime
View raw message