You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by cl...@apache.org on 2014/01/05 12:28:05 UTC

svn commit: r1555482 [6/6] - in /jena/Experimental/new-test: ./ src/test/java/ src/test/java/com/hp/hpl/jena/graph/ src/test/java/com/hp/hpl/jena/graph/compose/ src/test/java/com/hp/hpl/jena/graph/impl/ src/test/java/com/hp/hpl/jena/mem/ src/test/java/...

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/PrefixMappingContractTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/PrefixMappingContractTest.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/PrefixMappingContractTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/PrefixMappingContractTest.java Sun Jan  5 11:28:03 2014
@@ -27,9 +27,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.junit.Ignore;
-import org.junit.Test;
 import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractTest;
 
 import org.xenei.junit.contract.IProducer;
 
@@ -39,10 +38,9 @@ import com.hp.hpl.jena.testing_framework
  * Test prefix mappings - subclass this test and override getProducer() to
  * deliver the IProducer<prefixMapping> to be tested.
  */
-@Ignore
 @Contract(PrefixMapping.class)
 public class PrefixMappingContractTest<T extends PrefixMapping> extends
-		ContractTemplate<T> {
+		ContractTemplate<IProducer<T>> {
 
 	public static boolean sameMapping(final PrefixMapping L,
 			final PrefixMapping R) {
@@ -74,7 +72,7 @@ public class PrefixMappingContractTest<T
 	/**
 	 * test that we can extract a proper Map from a PrefixMapping
 	 */
-	@Test
+	@ContractTest
 	public void testGetNsPrefixMap() {
 		PrefixMapping pm = getConfiguredMapping();
 		Map<String, String> map = pm.getNsPrefixMap();
@@ -103,7 +101,7 @@ public class PrefixMappingContractTest<T
 		return ns;
 	}
 
-	@Test
+	@ContractTest
 	public void testExpandPrefix_String() {
 
 		/**
@@ -136,7 +134,7 @@ public class PrefixMappingContractTest<T
 					ns.expandPrefix(expansions[i][0]));
 	}
 
-	@Test
+	@ContractTest
 	public void testShortForm_String() {
 		PrefixMapping ns = getConfiguredMapping();
 		assertEquals("", ns.shortForm(""));
@@ -155,7 +153,7 @@ public class PrefixMappingContractTest<T
 		}
 	}
 
-	@Test
+	@ContractTest
 	public void testQnameFor_String() {
 		PrefixMapping ns = getConfiguredMapping();
 
@@ -184,7 +182,7 @@ public class PrefixMappingContractTest<T
 		}
 	}
 
-	@Test
+	@ContractTest
 	public void testSetNsPrefixes_PrefixMapping() {
 		PrefixMapping a = getProducer().newInstance();
 		PrefixMapping b = getProducer().newInstance();
@@ -206,7 +204,7 @@ public class PrefixMappingContractTest<T
 
 	}
 
-	@Test
+	@ContractTest
 	public void testGetNsPrefixURI_String() {
 		PrefixMapping pm = getConfiguredMapping();
 		assertEquals(httpURI, pm.getNsPrefixURI(httpPrefix));
@@ -215,7 +213,7 @@ public class PrefixMappingContractTest<T
 				pm.getNsPrefixURI("missingPrefix"));
 	}
 
-	@Test
+	@ContractTest
 	public void testGetNsURIPrefix_String() {
 		PrefixMapping pm = getConfiguredMapping();
 		assertEquals(httpPrefix, pm.getNsURIPrefix(httpURI));
@@ -240,7 +238,7 @@ public class PrefixMappingContractTest<T
 	 * as for testAddOtherPrefixMapping, except that it's a plain Map we're
 	 * adding.
 	 */
-	@Test
+	@ContractTest
 	public void testSetNsPrefixes_Map() {
 		PrefixMapping b = getProducer().newInstance();
 		Map<String, String> map = new HashMap<String, String>();
@@ -255,7 +253,7 @@ public class PrefixMappingContractTest<T
 				b.getNsPrefixURI("over"));
 	}
 
-	@Test
+	@ContractTest
 	public void testWithDefaultMappings_PrefixMap() {
 		PrefixMapping pm = getProducer().newInstance();
 		PrefixMapping root = PrefixMapping.Factory.create();
@@ -272,7 +270,7 @@ public class PrefixMappingContractTest<T
 		assertEquals("cSecond/", pm.getNsPrefixURI("c"));
 	}
 
-	@Test
+	@ContractTest
 	public void testSecondPrefixRetainsExistingMap() {
 		PrefixMapping A = getProducer().newInstance();
 		A.setNsPrefix("a", httpURI);
@@ -281,7 +279,7 @@ public class PrefixMappingContractTest<T
 		assertEquals(httpURI, A.getNsPrefixURI("b"));
 	}
 
-	@Test
+	@ContractTest
 	public void testSecondPrefixReplacesReverseMap() {
 		PrefixMapping A = getProducer().newInstance();
 		A.setNsPrefix("a", httpURI);
@@ -289,7 +287,7 @@ public class PrefixMappingContractTest<T
 		assertEquals("b", A.getNsURIPrefix(httpURI));
 	}
 
-	@Test
+	@ContractTest
 	public void testRemoveNsPrefix_String() {
 
 		PrefixMapping pm = getConfiguredMapping();
@@ -318,7 +316,7 @@ public class PrefixMappingContractTest<T
 		assertEquals(null, pm.getNsPrefixURI(""));
 	}
 
-	@Test
+	@ContractTest
 	public void testSamePrefixMappingAs_PrefixMapping() {
 		testEquals("");
 		testEquals("", "x=a", false);
@@ -363,7 +361,7 @@ public class PrefixMappingContractTest<T
 		}
 	}
 
-	@Test
+	@ContractTest
 	public void testLock() {
 		PrefixMapping A = getProducer().newInstance();
 		assertSame(A, A.lock());
@@ -417,7 +415,7 @@ public class PrefixMappingContractTest<T
 		}
 	}
 
-	@Test
+	@ContractTest
 	public void testSetNsPrefix_String_String() {
 		PrefixMapping pm = getConfiguredMapping();
 		Map<String, String> before = null;

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=1555482&r1=1555481&r2=1555482&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 Sun Jan  5 11:28:03 2014
@@ -5,11 +5,11 @@ import static com.hp.hpl.jena.testing_fr
 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.ContractTest;
 import org.xenei.junit.contract.IProducer;
 
 import com.hp.hpl.jena.graph.Graph;
@@ -17,7 +17,6 @@ import com.hp.hpl.jena.graph.Node;
 import com.hp.hpl.jena.graph.Triple;
 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)
@@ -28,7 +27,7 @@ public class RandomOrderGraphTest extend
 		super(new Producer());
 	}
 
-	@Test
+	@ContractTest
 	public void testRandomFindTriple() {
 		Graph g = graphWith(graphProducer.newInstance(),
 				"a b 1; a b 2; a b 3; a b 4; a b 5; a b 6");
@@ -39,7 +38,7 @@ public class RandomOrderGraphTest extend
 		Assert.assertNotEquals("Lists should be different", l1, l2);
 	}
 
-	@Test
+	@ContractTest
 	public void testRandomFindNodes() {
 		Graph g = graphWith(graphProducer.newInstance(),
 				"a b 1; a b 2; a b 3; a b 4; a b 5; a b 6");
@@ -58,7 +57,17 @@ public class RandomOrderGraphTest extend
 			AbstractGraphProducer<RandomOrderGraph> {
 		@Override
 		public RandomOrderGraph createNewGraph() {
-			return new RandomOrderGraph(5, GraphFactory.createGraphMem());
+			return new RandomOrderGraph(5, memGraph());
+		}
+
+		@Override
+		public Graph[] getDependsOn(Graph g) {
+			return null;
+		}
+
+		@Override
+		public Graph[] getNotDependsOn(Graph g) {
+			return new Graph[] { newInstance() };
 		}
 	};
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/impl/PrefixMappingTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/impl/PrefixMappingTest.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/impl/PrefixMappingTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/impl/PrefixMappingTest.java Sun Jan  5 11:28:03 2014
@@ -19,11 +19,11 @@
 package com.hp.hpl.jena.shared.impl;
 
 import static org.junit.Assert.*;
-import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.xenei.junit.contract.Contract;
 import org.xenei.junit.contract.ContractImpl;
 import org.xenei.junit.contract.ContractSuite;
+import org.xenei.junit.contract.ContractTest;
 
 import com.hp.hpl.jena.assembler.JA;
 import com.hp.hpl.jena.shared.PrefixMapping;
@@ -61,12 +61,12 @@ public class PrefixMappingTest {
 		return producer;
 	}
 
-	@Test
+	@ContractTest
 	public void testStandard() {
 		testStandard(PrefixMapping.Standard);
 	}
 
-	@Test
+	@ContractTest
 	public void testExtended() {
 		testExtended(PrefixMapping.Extended);
 	}

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducer.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducer.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducer.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducer.java Sun Jan  5 11:28:03 2014
@@ -79,4 +79,26 @@ public abstract class AbstractGraphProdu
 		graphList.clear();
 	}
 
+	/**
+	 * Get a list of graphs that the created graph is dependent upon. The graph
+	 * must return true for each call to dependsOn() with one of the returned
+	 * graphs. Method may return null to disable the check.
+	 * 
+	 * @param g
+	 *            The graph we are looking for.
+	 * @return
+	 */
+	public abstract Graph[] getDependsOn(Graph g);
+
+	/**
+	 * Get a list of graphs that the created graph is not dependent upon. The
+	 * graph must return false for each call to dependsOn() with one of the
+	 * returned graphs. Method may return null to disable the check.
+	 * 
+	 * @param g
+	 *            The graph we are looking for.
+	 * @return
+	 */
+	public abstract Graph[] getNotDependsOn(Graph g);
+
 }

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractInfModelProducer.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractInfModelProducer.java?rev=1555482&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractInfModelProducer.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractInfModelProducer.java Sun Jan  5 11:28:03 2014
@@ -0,0 +1,91 @@
+/*
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+ */
+package com.hp.hpl.jena.testing_framework;
+
+import com.hp.hpl.jena.rdf.model.InfModel;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.Statement;
+import com.hp.hpl.jena.reasoner.Reasoner;
+
+/**
+ * An abstract implementation of the ModelProducerInterface.
+ * 
+ * This class handles tracking of the created models and closing them. It also
+ * provides a callback for the implementing class to perform extra cleanup when
+ * the model is closed.
+ * 
+ */
+public abstract class AbstractInfModelProducer<T extends InfModel> extends
+		AbstractModelProducer<T> {
+
+	
+	public boolean canBeEmpty( Model m ) 
+	{
+		return false;
+	}
+	/**
+	 * @return true if the models returned by this poducer are independent,
+	 *         false otherwise.
+	 * 
+	 */
+	abstract public Reasoner getReasoner();
+
+	/**
+	 * Returns the model that was used in the reasoner.bind() call.
+	 * 
+	 * @return
+	 */
+	abstract public Model getBoundModel();
+
+	/**
+	 * Populate the model with test data for the derivation test.
+	 * 
+	 * @param model
+	 */
+	abstract public void populateModel(InfModel model);
+
+	/**
+	 * Using the reasoner and the populated model, this statement should return
+	 * a derivation iterator when getDerivation() is called.
+	 * 
+	 * This is not a complete test but a simple test to show that the system
+	 * works in this specific case. A complete set of tests is left for later
+	 * development.
+	 * 
+	 * @return The Statement that should have at least one derivation.
+	 */
+	abstract public Statement getDerivationStatement();
+
+	/**
+	 * Using the reasoner and the populated model, this statement should return
+	 * an EMPTY derivation iterator when getDerivation() is called.
+	 * 
+	 * This is not a complete test but a simple test to show that the system
+	 * works in this specific case. A complete set of tests is left for later
+	 * development.
+	 * 
+	 * @return The Statement that should have no derivations.
+	 */
+	abstract public Statement getNoDerivationStatement();
+
+	/**
+	 * @return true if the InfModel supports the getDeductionsModel() call.
+	 */
+	abstract public boolean supportsDeductionsModel();
+
+}

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

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractModelProducer.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractModelProducer.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractModelProducer.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractModelProducer.java Sun Jan  5 11:28:03 2014
@@ -22,6 +22,7 @@ import java.util.List;
 
 import org.xenei.junit.contract.IProducer;
 
+import com.hp.hpl.jena.graph.Node;
 import com.hp.hpl.jena.rdf.model.Model;
 
 /**
@@ -73,7 +74,7 @@ public abstract class AbstractModelProdu
 	 * @param g
 	 *            The graph that is closed
 	 */
-	protected void afterClose(Model g) {
+	protected void afterClose(T g) {
 	};
 
 	@Override
@@ -82,9 +83,9 @@ public abstract class AbstractModelProdu
 			if (!m.isClosed()) {
 				m.close();
 			}
-			afterClose(m);
+			afterClose((T) m);
 		}
 		modelList.clear();
 	}
-
+	
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/ContractTemplate.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/ContractTemplate.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/ContractTemplate.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/ContractTemplate.java Sun Jan  5 11:28:03 2014
@@ -2,15 +2,15 @@ package com.hp.hpl.jena.testing_framewor
 
 import org.xenei.junit.contract.IProducer;
 
-public class ContractTemplate<T> {
+public class ContractTemplate<P extends IProducer<?>> {
 
-	private IProducer<T> producer;
+	private P producer;
 
-	public final void setProducer(IProducer<T> producer) {
+	public final void setProducer(P producer) {
 		this.producer = producer;
 	}
 
-	protected final IProducer<T> getProducer() {
+	protected final P getProducer() {
 		return producer;
 	}
 

Modified: 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=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestFileData.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestFileData.java Sun Jan  5 11:28:03 2014
@@ -29,177 +29,166 @@ import com.hp.hpl.jena.sparql.graph.Grap
 public class TestFileData {
 
 	public static final String NS = "uri:urn:x-rdf:test#";
-	
-	private static Map<String,String[]> rdfData = new HashMap<String,String[]>();
-	private static Map<String,String[]> ttlData = new HashMap<String,String[]>();
-	
+
+	private static Map<String, String[]> rdfData = new HashMap<String, String[]>();
+	private static Map<String, String[]> ttlData = new HashMap<String, String[]>();
+
 	static {
-		rdfData.put( "", // default set must be equiv to TTL default
+		rdfData.put(
+				"", // default set must be equiv to TTL default
 				new String[] {
-			"<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
-			"<rdf:RDF",
-			"  xmlns:u=\"uri:\"",
-			"  xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"",
-			String.format("  xmlns:ex=\"%s\">", NS ),
-			String.format("  <rdf:Description rdf:about=\"%ssubject\">", NS ),
-			String.format("    <ex:predicate rdf:resource=\"%sobject\"/>", NS ),
-			"  </rdf:Description>", "  <rdf:Description rdf:about=\"uri:e\">",
-			"    <u:p5>verify base works</u:p5>", "  </rdf:Description>",
-			"</rdf:RDF>" }			
-				);
-		rdfData.put( "realtiveURI", // has relative URI in description rdf:about
+						"<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
+						"<rdf:RDF",
+						"  xmlns:u=\"uri:\"",
+						"  xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"",
+						String.format("  xmlns:ex=\"%s\">", NS),
+						String.format(
+								"  <rdf:Description rdf:about=\"%ssubject\">",
+								NS),
+						String.format(
+								"    <ex:predicate rdf:resource=\"%sobject\"/>",
+								NS), "  </rdf:Description>",
+						"  <rdf:Description rdf:about=\"uri:e\">",
+						"    <u:p5>verify base works</u:p5>",
+						"  </rdf:Description>", "</rdf:RDF>" });
+		rdfData.put(
+				"realtiveURI", // has relative URI in description rdf:about
 				new String[] {
-			"<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
-			"<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>" }			
-				);
-		rdfData.put( "OntologyList0",
+						"<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
+						"<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>" });
+		rdfData.put(
+				"OntologyList0",
 				new String[] {
-				"<?xml version='1.0' encoding='ISO-8859-1'?>",
-				"<!DOCTYPE rdf:RDF [",
-				"    <!ENTITY rdf   'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>",
-				"    <!ENTITY rdfs  'http://www.w3.org/2000/01/rdf-schema#'>",
-				"]>",
-				"<rdf:RDF",
-				"    xmlns:rdf   =\"&rdf;\"",
-				"    xmlns:rdfs  =\"&rdfs;\"",
-				String.format("    xml:base    =\"%s\"", NS.substring(0,NS.length()-1) ),
-				String.format("    xmlns       =\"%s\"", NS ),
-				">",
-				"<rdf:Description rdf:ID=\"root\">",
-				"   <p rdf:parseType=\"Collection\">",
-				"   </p>",
-				"</rdf:Description>",
-				"</rdf:RDF>" }
-				);
-		rdfData.put( "OntologyList1",
+						"<?xml version='1.0' encoding='ISO-8859-1'?>",
+						"<!DOCTYPE rdf:RDF [",
+						"    <!ENTITY rdf   'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>",
+						"    <!ENTITY rdfs  'http://www.w3.org/2000/01/rdf-schema#'>",
+						"]>",
+						"<rdf:RDF",
+						"    xmlns:rdf   =\"&rdf;\"",
+						"    xmlns:rdfs  =\"&rdfs;\"",
+						String.format("    xml:base    =\"%s\"",
+								NS.substring(0, NS.length() - 1)),
+						String.format("    xmlns       =\"%s\"", NS), ">",
+						"<rdf:Description rdf:ID=\"root\">",
+						"   <p rdf:parseType=\"Collection\">", "   </p>",
+						"</rdf:Description>", "</rdf:RDF>" });
+		rdfData.put(
+				"OntologyList1",
 				new String[] {
-				"<?xml version='1.0' encoding='ISO-8859-1'?>",
-				"<!DOCTYPE rdf:RDF [",
-				"    <!ENTITY rdf   'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>",
-				"    <!ENTITY rdfs  'http://www.w3.org/2000/01/rdf-schema#'>",
-				"]>",
-				"<rdf:RDF",
-				"    xmlns:rdf   =\"&rdf;\"",
-				"    xmlns:rdfs  =\"&rdfs;\"",
-				String.format("    xml:base    =\"%s\"", NS.substring(0,NS.length()-1) ),
-				String.format("    xmlns       =\"%s\"", NS ),
-				">",
-				"<rdf:Description rdf:ID=\"root\">",
-				"   <p rdf:parseType=\"Collection\">",
-				"    <rdf:Description rdf:ID=\"a\" />",
-				"   </p>",
-				"</rdf:Description>",
-				"</rdf:RDF>"
-				}
-		);
-		rdfData.put( "OntologyList2",
+						"<?xml version='1.0' encoding='ISO-8859-1'?>",
+						"<!DOCTYPE rdf:RDF [",
+						"    <!ENTITY rdf   'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>",
+						"    <!ENTITY rdfs  'http://www.w3.org/2000/01/rdf-schema#'>",
+						"]>",
+						"<rdf:RDF",
+						"    xmlns:rdf   =\"&rdf;\"",
+						"    xmlns:rdfs  =\"&rdfs;\"",
+						String.format("    xml:base    =\"%s\"",
+								NS.substring(0, NS.length() - 1)),
+						String.format("    xmlns       =\"%s\"", NS), ">",
+						"<rdf:Description rdf:ID=\"root\">",
+						"   <p rdf:parseType=\"Collection\">",
+						"    <rdf:Description rdf:ID=\"a\" />", "   </p>",
+						"</rdf:Description>", "</rdf:RDF>" });
+		rdfData.put(
+				"OntologyList2",
 				new String[] {
-				"<?xml version='1.0' encoding='ISO-8859-1'?>",
-				"<!DOCTYPE rdf:RDF [",
-				"    <!ENTITY rdf   'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>",
-				"    <!ENTITY rdfs  'http://www.w3.org/2000/01/rdf-schema#'>",
-				"]>",
-				"<rdf:RDF",
-				"    xmlns:rdf   =\"&rdf;\"",
-				"    xmlns:rdfs  =\"&rdfs;\"",
-				String.format("    xml:base    =\"%s\"", NS.substring(0,NS.length()-1) ),
-				String.format("    xmlns       =\"%s\"", NS ),
-				">",
-				"<rdf:Description rdf:ID=\"root\">",
-				"   <p rdf:parseType=\"Collection\">",
-				"    <rdf:Description rdf:ID=\"a\" />",
-				"    <rdf:Description rdf:ID=\"b\" />",
-				"   </p>",
-				"</rdf:Description>",
-				"</rdf:RDF>"
-				}
-		);
-		rdfData.put( "OntologyList3",
+						"<?xml version='1.0' encoding='ISO-8859-1'?>",
+						"<!DOCTYPE rdf:RDF [",
+						"    <!ENTITY rdf   'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>",
+						"    <!ENTITY rdfs  'http://www.w3.org/2000/01/rdf-schema#'>",
+						"]>",
+						"<rdf:RDF",
+						"    xmlns:rdf   =\"&rdf;\"",
+						"    xmlns:rdfs  =\"&rdfs;\"",
+						String.format("    xml:base    =\"%s\"",
+								NS.substring(0, NS.length() - 1)),
+						String.format("    xmlns       =\"%s\"", NS), ">",
+						"<rdf:Description rdf:ID=\"root\">",
+						"   <p rdf:parseType=\"Collection\">",
+						"    <rdf:Description rdf:ID=\"a\" />",
+						"    <rdf:Description rdf:ID=\"b\" />", "   </p>",
+						"</rdf:Description>", "</rdf:RDF>" });
+		rdfData.put(
+				"OntologyList3",
 				new String[] {
-				"<?xml version='1.0' encoding='ISO-8859-1'?>",
-				"<!DOCTYPE rdf:RDF [",
-				"    <!ENTITY rdf   'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>",
-				"    <!ENTITY rdfs  'http://www.w3.org/2000/01/rdf-schema#'>",
-				"]>",
-				"<rdf:RDF",
-				"    xmlns:rdf   =\"&rdf;\"",
-				"    xmlns:rdfs  =\"&rdfs;\"",
-				String.format("    xml:base    =\"%s\"", NS.substring(0,NS.length()-1) ),
-				String.format("    xmlns       =\"%s\"", NS ),
-				">",
-				"<rdf:Description rdf:ID=\"root\">",
-				"   <p rdf:parseType=\"Collection\">",
-				"    <rdf:Description rdf:ID=\"a\" />",
-				"    <rdf:Description rdf:ID=\"b\" />",
-				"    <rdf:Description rdf:ID=\"c\" />",
-				"   </p>",
-				"</rdf:Description>",
-				"</rdf:RDF>"
-				}
-		);
-		rdfData.put( "OntologyList4",
+						"<?xml version='1.0' encoding='ISO-8859-1'?>",
+						"<!DOCTYPE rdf:RDF [",
+						"    <!ENTITY rdf   'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>",
+						"    <!ENTITY rdfs  'http://www.w3.org/2000/01/rdf-schema#'>",
+						"]>",
+						"<rdf:RDF",
+						"    xmlns:rdf   =\"&rdf;\"",
+						"    xmlns:rdfs  =\"&rdfs;\"",
+						String.format("    xml:base    =\"%s\"",
+								NS.substring(0, NS.length() - 1)),
+						String.format("    xmlns       =\"%s\"", NS), ">",
+						"<rdf:Description rdf:ID=\"root\">",
+						"   <p rdf:parseType=\"Collection\">",
+						"    <rdf:Description rdf:ID=\"a\" />",
+						"    <rdf:Description rdf:ID=\"b\" />",
+						"    <rdf:Description rdf:ID=\"c\" />", "   </p>",
+						"</rdf:Description>", "</rdf:RDF>" });
+		rdfData.put(
+				"OntologyList4",
 				new String[] {
-				"<?xml version='1.0' encoding='ISO-8859-1'?>",
-				"<!DOCTYPE rdf:RDF [",
-				"    <!ENTITY rdf   'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>",
-				"    <!ENTITY rdfs  'http://www.w3.org/2000/01/rdf-schema#'>",
-				"]>",
-				"<rdf:RDF",
-				"    xmlns:rdf   =\"&rdf;\"",
-				"    xmlns:rdfs  =\"&rdfs;\"",
-				String.format("    xml:base    =\"%s\"", NS.substring(0,NS.length()-1) ),
-				String.format("    xmlns       =\"%s\"", NS ),
-				">",
-				"<rdf:Description rdf:ID=\"root\">",
-				"   <p rdf:parseType=\"Collection\">",
-				"    <rdf:Description rdf:ID=\"a\" />",
-				"    <rdf:Description rdf:ID=\"b\" />",
-				"    <rdf:Description rdf:ID=\"c\" />",
-				"    <rdf:Description rdf:ID=\"d\" />",
-				"   </p>",
-				"</rdf:Description>",
-				"</rdf:RDF>"
-				}
-		);
-		rdfData.put( "OntologyList5",
+						"<?xml version='1.0' encoding='ISO-8859-1'?>",
+						"<!DOCTYPE rdf:RDF [",
+						"    <!ENTITY rdf   'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>",
+						"    <!ENTITY rdfs  'http://www.w3.org/2000/01/rdf-schema#'>",
+						"]>",
+						"<rdf:RDF",
+						"    xmlns:rdf   =\"&rdf;\"",
+						"    xmlns:rdfs  =\"&rdfs;\"",
+						String.format("    xml:base    =\"%s\"",
+								NS.substring(0, NS.length() - 1)),
+						String.format("    xmlns       =\"%s\"", NS), ">",
+						"<rdf:Description rdf:ID=\"root\">",
+						"   <p rdf:parseType=\"Collection\">",
+						"    <rdf:Description rdf:ID=\"a\" />",
+						"    <rdf:Description rdf:ID=\"b\" />",
+						"    <rdf:Description rdf:ID=\"c\" />",
+						"    <rdf:Description rdf:ID=\"d\" />", "   </p>",
+						"</rdf:Description>", "</rdf:RDF>" });
+		rdfData.put(
+				"OntologyList5",
 				new String[] {
-				"<?xml version='1.0' encoding='ISO-8859-1'?>",
-				"<!DOCTYPE rdf:RDF [",
-				"    <!ENTITY rdf   'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>",
-				"    <!ENTITY rdfs  'http://www.w3.org/2000/01/rdf-schema#'>",
-				"]>",
-				"<rdf:RDF",
-				"    xmlns:rdf   =\"&rdf;\"",
-				"    xmlns:rdfs  =\"&rdfs;\"",
-				String.format("    xml:base    =\"%s\"", NS.substring(0,NS.length()-1) ),
-				String.format("    xmlns       =\"%s\"", NS ),
-				">",
-				"<rdf:Description rdf:ID=\"root\">",
-				"   <p rdf:parseType=\"Collection\">",
-				"    <rdf:Description rdf:ID=\"a\" />",
-				"    <rdf:Description rdf:ID=\"b\" />",
-				"    <rdf:Description rdf:ID=\"c\" />",
-				"    <rdf:Description rdf:ID=\"d\" />",
-				"    <rdf:Description rdf:ID=\"e\" />",
-				"   </p>",
-				"</rdf:Description>",
-				"</rdf:RDF>"
-				}
-		);
-		
-		ttlData.put( "", // default set must be equiv to RDF default and must be parsable as N-TRIPLE
+						"<?xml version='1.0' encoding='ISO-8859-1'?>",
+						"<!DOCTYPE rdf:RDF [",
+						"    <!ENTITY rdf   'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>",
+						"    <!ENTITY rdfs  'http://www.w3.org/2000/01/rdf-schema#'>",
+						"]>",
+						"<rdf:RDF",
+						"    xmlns:rdf   =\"&rdf;\"",
+						"    xmlns:rdfs  =\"&rdfs;\"",
+						String.format("    xml:base    =\"%s\"",
+								NS.substring(0, NS.length() - 1)),
+						String.format("    xmlns       =\"%s\"", NS), ">",
+						"<rdf:Description rdf:ID=\"root\">",
+						"   <p rdf:parseType=\"Collection\">",
+						"    <rdf:Description rdf:ID=\"a\" />",
+						"    <rdf:Description rdf:ID=\"b\" />",
+						"    <rdf:Description rdf:ID=\"c\" />",
+						"    <rdf:Description rdf:ID=\"d\" />",
+						"    <rdf:Description rdf:ID=\"e\" />", "   </p>",
+						"</rdf:Description>", "</rdf:RDF>" });
+
+		ttlData.put(
+				"", // default set must be equiv to RDF default and must be
+					// parsable as N-TRIPLE
 				new String[] {
-				String.format("<%ssubject> <%spredicate> <%sobject> .", NS, NS, NS),
-				"<e> <p5> \"verify base works\" ." }
-				);
-		
+						String.format("<%ssubject> <%spredicate> <%sobject> .",
+								NS, NS, NS), "<e> <p5> \"verify base works\" ." });
+
 	}
 
 	private static String toDataString(String[] lines) {
@@ -236,66 +225,60 @@ public class TestFileData {
 	public static Model getModel() {
 		return ModelFactory.createModelForGraph(getGraph());
 	}
-	
-	public static Model populateRDFModel( Model model, String name ) throws IOException
-	{
-		ModelHelper.txnBegin( model );
-		model.read( getRDFInput( name ), "http://example.com/test/");
+
+	public static Model populateRDFModel(Model model, String name)
+			throws IOException {
+		ModelHelper.txnBegin(model);
+		model.read(getRDFInput(name), "http://example.com/test/");
 		ModelHelper.txnCommit(model);
 		return model;
 	}
-	
-	public static Model getRDFModel( String name ) throws IOException
-	{
-		return populateRDFModel( ModelFactory.createDefaultModel(), name );
+
+	public static Model getRDFModel(String name) throws IOException {
+		return populateRDFModel(ModelFactory.createDefaultModel(), name);
 	}
 
-	private static String[] getRDFData( String name ) throws IOException
-	{
-		String[] data = rdfData.get( name );
-		if (data == null)
-		{
-			throw new IOException( "Can not find RDF data "+name );
+	private static String[] getRDFData(String name) throws IOException {
+		String[] data = rdfData.get(name);
+		if (data == null) {
+			throw new IOException("Can not find RDF data " + name);
 		}
 		return data;
 	}
-	
-	public static InputStream getRDFInput( String name ) throws IOException
-	{
-		return new ByteArrayInputStream(toDataString(getRDFData(name)).getBytes());
+
+	public static InputStream getRDFInput(String name) throws IOException {
+		return new ByteArrayInputStream(toDataString(getRDFData(name))
+				.getBytes());
 	}
-	
+
 	public static InputStream getRDFInput() throws IOException {
-		return getRDFInput( "" );
+		return getRDFInput("");
 	}
 
-	private static String[] getTTLData( String name ) throws IOException
-	{
-		String[] data = ttlData.get( name );
-		if (data == null)
-		{
-			throw new IOException( "Can not find TTL data "+name );
+	private static String[] getTTLData(String name) throws IOException {
+		String[] data = ttlData.get(name);
+		if (data == null) {
+			throw new IOException("Can not find TTL data " + name);
 		}
 		return data;
 	}
-	
-	public static InputStream getTTLInput( String name ) throws IOException
-	{
-		return new ByteArrayInputStream(toDataString(getTTLData(name)).getBytes());
+
+	public static InputStream getTTLInput(String name) throws IOException {
+		return new ByteArrayInputStream(toDataString(getTTLData(name))
+				.getBytes());
 	}
-	
-	public static InputStream getTTLInput()  throws IOException{
+
+	public static InputStream getTTLInput() throws IOException {
 		return getTTLInput("");
 	}
 
-	
-	public static Reader getRDFReader(String name)  throws IOException{
-		
+	public static Reader getRDFReader(String name) throws IOException {
+
 		return new StringReader(toDataString(getRDFData(name)));
 	}
-	
-	public static Reader getRDFReader()  throws IOException{
-		
+
+	public static Reader getRDFReader() throws IOException {
+
 		return getRDFReader("");
 	}
 
@@ -303,45 +286,44 @@ public class TestFileData {
 		return getTTLReader("");
 	}
 
-	public static Reader getTTLReader(String name ) throws IOException {
+	public static Reader getTTLReader(String name) throws IOException {
 		return new StringReader(toDataString(getTTLData(name)));
 	}
-	
-	public static String getRDFName( String name ) throws IOException
-	{
-		return createFile( toDataString(getRDFData(name)), ".rdf");
+
+	public static String getRDFName(String name) throws IOException {
+		return createFile(toDataString(getRDFData(name)), ".rdf");
 	}
-	
+
 	public static String getRDFName() throws IOException {
-		return getRDFName( "");
+		return getRDFName("");
 	}
-	
-	private static String createFile( String data, String extension ) throws IOException
-	{
-		File f = File.createTempFile("tfd", extension );
+
+	private static String createFile(String data, String extension)
+			throws IOException {
+		File f = File.createTempFile("tfd", extension);
 		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("<?xml version=\"1.0\" encoding=\"UTF-8\"?>".getBytes());
+		// fos.write(System.getProperty("line.separator").getBytes());
 		fos.write(data.getBytes());
 		fos.close();
 		return f.toURI().toURL().toExternalForm();
 	}
 
 	public static String getTTLName() throws IOException {
-		return getTTLName( "" );
+		return getTTLName("");
 	}
-	
+
 	public static String getTTLName(String name) throws IOException {
-		return createFile( toDataString(getTTLData(name)), ".ttl" );
+		return createFile(toDataString(getTTLData(name)), ".ttl");
 	}
 
 	@Test
 	public void testEquality() throws Exception {
-		Model ttl = ModelFactory.createDefaultModel().read(getTTLInput(),
-				NS, "TTL");
-		Model rdf = ModelFactory.createDefaultModel().read(getRDFInput(),
-				NS, "RDF/XML-ABBREV");
+		Model ttl = ModelFactory.createDefaultModel().read(getTTLInput(), NS,
+				"TTL");
+		Model rdf = ModelFactory.createDefaultModel().read(getRDFInput(), NS,
+				"RDF/XML-ABBREV");
 
 		assertTrue(ttl.isIsomorphicWith(rdf));
 		assertTrue(rdf.isIsomorphicWith(ttl));

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=1555482&r1=1555481&r2=1555482&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 Sun Jan  5 11:28:03 2014
@@ -25,7 +25,6 @@ import java.lang.reflect.Constructor;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -35,16 +34,10 @@ import org.slf4j.LoggerFactory;
 
 import static org.junit.Assert.*;
 
-import com.hp.hpl.jena.rdf.model.Literal;
-import com.hp.hpl.jena.rdf.model.Property;
-import com.hp.hpl.jena.rdf.model.RDFNode;
-import com.hp.hpl.jena.rdf.model.Resource;
-import com.hp.hpl.jena.rdf.model.StmtIterator;
 import com.hp.hpl.jena.util.CollectionFactory;
 import com.hp.hpl.jena.util.iterator.ExtendedIterator;
 import com.hp.hpl.jena.util.iterator.WrappedIterator;
 
-
 /**
  * Foo basis for Jena test cases which provides assertFalse and assertDiffer.
  * Often the logic of the names is clearer than using a negation.
@@ -316,13 +309,12 @@ public class TestUtils {
 				.println(String.format("[%s WARNING] %s expected: %s got: %s",
 						clazz, msg, obj1, obj2));
 	}
-	
-    public static String safeName(String s)
-    {
-        // Safe from Eclipse
-        s = s.replace('(','[') ;
-        s = s.replace(')',']') ;
-        return s ;
 
-    }
+	public static String safeName(String s) {
+		// Safe from Eclipse
+		s = s.replace('(', '[');
+		s = s.replace(')', ']');
+		return s;
+
+	}
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/manifest/ManifestSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/manifest/ManifestSuite.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/manifest/ManifestSuite.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/manifest/ManifestSuite.java Sun Jan  5 11:28:03 2014
@@ -47,7 +47,7 @@ import com.hp.hpl.jena.shared.JenaExcept
  * <ol>
  * <li>Have a <code>ContractImpl</code> annotation specifying the implementation
  * being tested</li>
- * <li>Include a <code>@Contract.Injeect</code> annotated getter that returns an
+ * <li>Include a <code>@Contract.Inject</code> annotated getter that returns an
  * IProducer<x> where "x" is the class specified in the ContractImpl</li>
  * </ol>
  * <p>

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/tuples/TupleItem.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/tuples/TupleItem.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/tuples/TupleItem.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/tuples/TupleItem.java Sun Jan  5 11:28:03 2014
@@ -19,42 +19,66 @@
 package com.hp.hpl.jena.testing_framework.tuples;
 
 /**
- * The unit found in a line of a tuple.
- * Can be a string (quoted, possibly with the datatype, or unquoted) or a URI.
+ * The unit found in a line of a tuple. Can be a string (quoted, possibly with
+ * the datatype, or unquoted) or a URI.
  */
-public class TupleItem
-{
-    public static final int URI      = 0 ;
-    public static final int STRING   = 1 ;
-    public static final int UNKNOWN  = 2 ;
-    public static final int UNQUOTED = 3 ;
-    public static final int ANON     = 4 ;
-
-    String rep ;
-    String datatype ;
-    String asFound ;
-    int itemType ;
-
-    TupleItem(String value, String valAsFound, int type, String dt)
-    {
-        rep = value ;
-        asFound = valAsFound ;
-        itemType = type ;
-        datatype = dt ;
-    }
-
-    public int getType() { return itemType ; }
-
-    public boolean isURI()       { return itemType == URI ; }
-    public boolean isString()    { return itemType == STRING ; }
-    public boolean isUnknown()   { return itemType == UNKNOWN ; }
-    public boolean isUnquoted()  { return itemType == UNQUOTED ; }
-    public boolean isAnon()      { return itemType == ANON ; }
-
-    public String get() { return rep ; }
-    public String getDT() { return datatype ;
-    }
-    public String asQuotedString() { return asFound ; }
-    @Override
-    public String toString() { return rep ; }
+public class TupleItem {
+	public static final int URI = 0;
+	public static final int STRING = 1;
+	public static final int UNKNOWN = 2;
+	public static final int UNQUOTED = 3;
+	public static final int ANON = 4;
+
+	String rep;
+	String datatype;
+	String asFound;
+	int itemType;
+
+	TupleItem(String value, String valAsFound, int type, String dt) {
+		rep = value;
+		asFound = valAsFound;
+		itemType = type;
+		datatype = dt;
+	}
+
+	public int getType() {
+		return itemType;
+	}
+
+	public boolean isURI() {
+		return itemType == URI;
+	}
+
+	public boolean isString() {
+		return itemType == STRING;
+	}
+
+	public boolean isUnknown() {
+		return itemType == UNKNOWN;
+	}
+
+	public boolean isUnquoted() {
+		return itemType == UNQUOTED;
+	}
+
+	public boolean isAnon() {
+		return itemType == ANON;
+	}
+
+	public String get() {
+		return rep;
+	}
+
+	public String getDT() {
+		return datatype;
+	}
+
+	public String asQuotedString() {
+		return asFound;
+	}
+
+	@Override
+	public String toString() {
+		return rep;
+	}
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/tuples/TupleSet.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/tuples/TupleSet.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/tuples/TupleSet.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/tuples/TupleSet.java Sun Jan  5 11:28:03 2014
@@ -16,286 +16,259 @@
  * limitations under the License.
  */
 
-package com.hp.hpl.jena.testing_framework.tuples ;
+package com.hp.hpl.jena.testing_framework.tuples;
 
-import java.io.* ;
-import java.util.* ;
+import java.io.*;
+import java.util.*;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
-public class TupleSet implements Iterator<List<TupleItem>>
-{
-    BufferedReader in ;
-    public String line = null ;
-    public int lineNumber = 0 ;
-
-    static final char COMMENTCHAR = '#' ;
-    List<TupleItem> current = null ;
-    boolean finished = false ;
-
-    protected static Logger logger = LoggerFactory.getLogger( TupleSet.class );
-    
-    /** Creates new TupleSet */
-    public TupleSet(Reader r)
-    {
-        if ( ! ( r instanceof BufferedReader ) )
-            in = new BufferedReader(r) ;
-        else
-            in = (BufferedReader)r;
-    }
-
-    @Override
-    public boolean hasNext()
-    {
-        if ( finished ) return false ;
-
-        if ( current == null )
-            current = tuple() ;
-        return current != null ;
-    }
-
-    @Override
-    public List<TupleItem> next()
-    {
-        if ( hasNext() )
-        {
-            List<TupleItem> x = current ;
-            current = null ;
-            return x ;
-        }
-        else
-            return null ;
-    }
-
-
-    @Override
-    public void remove()
-    {
-        throw new java.lang.UnsupportedOperationException("TupleSet.remove") ;
-    }
-
-    private List<TupleItem> tuple()
-    {
-
-        try {
-            lineNumber ++ ;
-            line = in.readLine() ;
-        } catch (IOException e) {}
-
-        if ( line == null )
-        {
-            finished = true ;
-            return null ;
-        }
-
-        //System.out.println("Line: "+line) ;
-        List<TupleItem> tuple = new ArrayList<TupleItem>() ;
-        int i = 0 ;
-        int j = 0 ;
-        boolean errorFound = false ;
-
-     tupleLoop:
-        for (;;)
-        {
-            // Move to beginning of next item.
-            i = skipwhitespace(line, j) ;
-
-            if ( i < 0 )
-                break ;
-
-            int iStart = -2 ;       // Points to the beginning of the item as found
-            int jStart = -2 ;       // Points to the item without quotes
-            int iFinish = -2 ;      // Points after the end of the item as found
-            int jFinish = -2 ;      // Points after the end of the item without quotes
-            int dtStart = -2 ;      // Points to start of datatype (after < quote)
-            int dtFinish = -2 ;     // Points to end of datatype
-            int type = TupleItem.UNKNOWN;
-
-            switch (line.charAt(i))
-            {
-                case COMMENTCHAR:
-                    break tupleLoop ;
-                case '<':
-                    type = TupleItem.URI ;
-                    iStart = i ;
-                    jStart = i+1 ;
-                    int newPosn = parseURI(i, line) ;
-                    if (newPosn < 0)
-                    {
-                        errorFound = true;
-                        break tupleLoop;
-                    }
-                    j = newPosn ;
-                    
-                    iFinish = j+1 ;
-                    jFinish = j ;
-                    break ;
-                case '"':
-                    type = TupleItem.STRING ;
-                    iStart = i ;
-                    jStart = i+1 ;
-                    boolean inEscape = false ;
-                    for ( j = i+1 ; j < line.length() ; j++ )
-                    {
-                        char ch = line.charAt(j) ;
-                        if ( inEscape )
-                        {
-                        	// ToDo: escape
-                            inEscape = false ;
-                            continue ;
-                        }
-                        // Not an escape
-                        if ( ch == '"'  )
-                            break ;
-
-                        if ( ch == '\\' )
-                            inEscape = true ;
-                        if ( ch == '\n' || ch == '\r' )
-                        {
-                            errorFound = true ;
-                            break tupleLoop;
-                            
-                        }
-                    }
-                    
-                    // Malformed
-                    if ( j == line.length() )
-                    {
-                        errorFound = true ;
-                        break tupleLoop;
-                    }
-                    
-                    iFinish = j+1 ;
-                    jFinish = j ;
-                    // RDF literals may be followed by their type.
-                         
-                    if ( j < line.length()-3 
-                         && line.charAt(j+1) == '^'
-                         && line.charAt(j+2) == '^'
-                         && line.charAt(j+3) == '<' )
-                    {
-                        dtFinish = parseURI(j+3, line) ;
-                        dtStart = j+4 ;
-                        if (dtFinish < 0)
-                        {
-                            errorFound = true;
-                            break tupleLoop;
-                        }
-                        j = dtFinish+1 ;
-                        //String dt = line.substring(dtStart, dtFinish) ;
-                        //System.out.println("I see a datatype:"+dt) ;
-                    }
-                    
-                    break ;
-                case '_':
-                    type = TupleItem.ANON ;
-                    iStart = i ;
-                    for ( j = i+1 ; j < line.length() ; j++ )
-                    {
-                        char ch = line.charAt(j) ;
-                        if ( ch == ' '  || ch == '\t' || ch == '.' )
-                            break ;
-                        if ( ! Character.isLetterOrDigit(ch) && ! (ch == '_') && ! (ch == ':') )
-                        {
-                            errorFound = true ;
-                            break tupleLoop ;
-                        }
-                    }
-                    iFinish = j ;
-                    jStart = iStart ;
-                    jFinish = iFinish ;
-                    break ;
-                case '.':
-                case '\n':
-                case '\r':
-                    return tuple ;
-                default:
-                    type = TupleItem.UNQUOTED ;
-                    iStart = i ;
-                    jStart = i ;
-                    for ( j = i+1 ; j < line.length() ; j++ )
-                    {
-                        char ch = line.charAt(j) ;
-                        if ( ch == ' '  || ch == '\t' || ch == '.' )
-                            break ;
-
-                        //if ( ! Character.isLetterOrDigit(line.charAt(i)) )
-                        //{
-                        //    errorFound = true ;
-                        //    break tupleLoop;
-                        //}
-                    }
-                    // Malformed
-                    if ( j == line.length()+1 )
-                    {
-                        errorFound = true ;
-                        break tupleLoop;
-                    }
-                    iFinish = j ;
-                    jFinish = j ;
-                    break ;
-            }
-            String item = line.substring(jStart, jFinish) ;
-            String literal = line.substring(iStart, iFinish) ;
-            String dt = null ;
-            if ( dtStart > 0 )
-                dt = line.substring(dtStart, dtFinish) ;
-            
-            tuple.add(new TupleItem(item, literal, type, dt)) ;
-            j++ ;
-            // End of item.
-        }
-        //End of this line.
-        if ( errorFound )
-        {
-            logger.error( "Error in TupleSet.tuple: " + line );
-            
-            String s = "" ;
-            int k = 0 ;
-            for ( ; k < i ; k++ ) s = s+" " ;
-            s = s+"^" ;
-            for ( ; k < j-1 ; k++ ) s=s+" " ;
-            s = s+"^" ;
-            logger.error( s ) ;
-            return null ;
-        }
-
-        if ( tuple.size() == 0 )
-        {
-            // Nothing found : loop by tail recursion
-            return tuple() ;
-        }
-        return tuple ;
-    }
-
-    private int skipwhitespace(String s, int i)
-    {
-        for ( ; i < s.length() ; i++ )
-        {
-            char ch = s.charAt(i) ;
-            // Horizonal whitespace
-            if ( ch != ' ' && ch != '\t' )
-                return i ;
-        }
-        return -1 ;
-    }
-
-    private int parseURI(int i, String line)
-    {
-        int j;
-        for (j = i + 1; j < line.length(); j++)
-        {
-            char ch = line.charAt(j);
-            if (ch == '>')
-                break;
-            if (ch == '\n' || ch == '\r')
-                return -1;
-        }
-        // Malformed
-        if (j == line.length())
-            return -2;
-        return j ;
-    }
+public class TupleSet implements Iterator<List<TupleItem>> {
+	BufferedReader in;
+	public String line = null;
+	public int lineNumber = 0;
+
+	static final char COMMENTCHAR = '#';
+	List<TupleItem> current = null;
+	boolean finished = false;
+
+	protected static Logger logger = LoggerFactory.getLogger(TupleSet.class);
+
+	/** Creates new TupleSet */
+	public TupleSet(Reader r) {
+		if (!(r instanceof BufferedReader))
+			in = new BufferedReader(r);
+		else
+			in = (BufferedReader) r;
+	}
+
+	@Override
+	public boolean hasNext() {
+		if (finished)
+			return false;
+
+		if (current == null)
+			current = tuple();
+		return current != null;
+	}
+
+	@Override
+	public List<TupleItem> next() {
+		if (hasNext()) {
+			List<TupleItem> x = current;
+			current = null;
+			return x;
+		} else
+			return null;
+	}
+
+	@Override
+	public void remove() {
+		throw new java.lang.UnsupportedOperationException("TupleSet.remove");
+	}
+
+	private List<TupleItem> tuple() {
+
+		try {
+			lineNumber++;
+			line = in.readLine();
+		} catch (IOException e) {
+		}
+
+		if (line == null) {
+			finished = true;
+			return null;
+		}
+
+		// System.out.println("Line: "+line) ;
+		List<TupleItem> tuple = new ArrayList<TupleItem>();
+		int i = 0;
+		int j = 0;
+		boolean errorFound = false;
+
+		tupleLoop: for (;;) {
+			// Move to beginning of next item.
+			i = skipwhitespace(line, j);
+
+			if (i < 0)
+				break;
+
+			int iStart = -2; // Points to the beginning of the item as found
+			int jStart = -2; // Points to the item without quotes
+			int iFinish = -2; // Points after the end of the item as found
+			int jFinish = -2; // Points after the end of the item without quotes
+			int dtStart = -2; // Points to start of datatype (after < quote)
+			int dtFinish = -2; // Points to end of datatype
+			int type = TupleItem.UNKNOWN;
+
+			switch (line.charAt(i)) {
+			case COMMENTCHAR:
+				break tupleLoop;
+			case '<':
+				type = TupleItem.URI;
+				iStart = i;
+				jStart = i + 1;
+				int newPosn = parseURI(i, line);
+				if (newPosn < 0) {
+					errorFound = true;
+					break tupleLoop;
+				}
+				j = newPosn;
+
+				iFinish = j + 1;
+				jFinish = j;
+				break;
+			case '"':
+				type = TupleItem.STRING;
+				iStart = i;
+				jStart = i + 1;
+				boolean inEscape = false;
+				for (j = i + 1; j < line.length(); j++) {
+					char ch = line.charAt(j);
+					if (inEscape) {
+						// ToDo: escape
+						inEscape = false;
+						continue;
+					}
+					// Not an escape
+					if (ch == '"')
+						break;
+
+					if (ch == '\\')
+						inEscape = true;
+					if (ch == '\n' || ch == '\r') {
+						errorFound = true;
+						break tupleLoop;
+
+					}
+				}
+
+				// Malformed
+				if (j == line.length()) {
+					errorFound = true;
+					break tupleLoop;
+				}
+
+				iFinish = j + 1;
+				jFinish = j;
+				// RDF literals may be followed by their type.
+
+				if (j < line.length() - 3 && line.charAt(j + 1) == '^'
+						&& line.charAt(j + 2) == '^'
+						&& line.charAt(j + 3) == '<') {
+					dtFinish = parseURI(j + 3, line);
+					dtStart = j + 4;
+					if (dtFinish < 0) {
+						errorFound = true;
+						break tupleLoop;
+					}
+					j = dtFinish + 1;
+					// String dt = line.substring(dtStart, dtFinish) ;
+					// System.out.println("I see a datatype:"+dt) ;
+				}
+
+				break;
+			case '_':
+				type = TupleItem.ANON;
+				iStart = i;
+				for (j = i + 1; j < line.length(); j++) {
+					char ch = line.charAt(j);
+					if (ch == ' ' || ch == '\t' || ch == '.')
+						break;
+					if (!Character.isLetterOrDigit(ch) && !(ch == '_')
+							&& !(ch == ':')) {
+						errorFound = true;
+						break tupleLoop;
+					}
+				}
+				iFinish = j;
+				jStart = iStart;
+				jFinish = iFinish;
+				break;
+			case '.':
+			case '\n':
+			case '\r':
+				return tuple;
+			default:
+				type = TupleItem.UNQUOTED;
+				iStart = i;
+				jStart = i;
+				for (j = i + 1; j < line.length(); j++) {
+					char ch = line.charAt(j);
+					if (ch == ' ' || ch == '\t' || ch == '.')
+						break;
+
+					// if ( ! Character.isLetterOrDigit(line.charAt(i)) )
+					// {
+					// errorFound = true ;
+					// break tupleLoop;
+					// }
+				}
+				// Malformed
+				if (j == line.length() + 1) {
+					errorFound = true;
+					break tupleLoop;
+				}
+				iFinish = j;
+				jFinish = j;
+				break;
+			}
+			String item = line.substring(jStart, jFinish);
+			String literal = line.substring(iStart, iFinish);
+			String dt = null;
+			if (dtStart > 0)
+				dt = line.substring(dtStart, dtFinish);
+
+			tuple.add(new TupleItem(item, literal, type, dt));
+			j++;
+			// End of item.
+		}
+		// End of this line.
+		if (errorFound) {
+			logger.error("Error in TupleSet.tuple: " + line);
+
+			String s = "";
+			int k = 0;
+			for (; k < i; k++)
+				s = s + " ";
+			s = s + "^";
+			for (; k < j - 1; k++)
+				s = s + " ";
+			s = s + "^";
+			logger.error(s);
+			return null;
+		}
+
+		if (tuple.size() == 0) {
+			// Nothing found : loop by tail recursion
+			return tuple();
+		}
+		return tuple;
+	}
+
+	private int skipwhitespace(String s, int i) {
+		for (; i < s.length(); i++) {
+			char ch = s.charAt(i);
+			// Horizonal whitespace
+			if (ch != ' ' && ch != '\t')
+				return i;
+		}
+		return -1;
+	}
+
+	private int parseURI(int i, String line) {
+		int j;
+		for (j = i + 1; j < line.length(); j++) {
+			char ch = line.charAt(j);
+			if (ch == '>')
+				break;
+			if (ch == '\n' || ch == '\r')
+				return -1;
+		}
+		// Malformed
+		if (j == line.length())
+			return -2;
+		return j;
+	}
 }

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=1555482&r1=1555481&r2=1555482&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 Sun Jan  5 11:28:03 2014
@@ -9,15 +9,13 @@ import java.util.List;
 import java.util.Set;
 
 import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractTest;
 
 import com.hp.hpl.jena.testing_framework.IIteratorProducer;
 
-@Ignore
 @Contract(ExtendedIterator.class)
 public class ExtendedIteratorContractTests<T> {
 
@@ -83,7 +81,7 @@ public class ExtendedIteratorContractTes
 	/**
 	 * Answer the next object, and remove it. Equivalent to next(); remove().
 	 */
-	@Test
+	@ContractTest
 	public void testRemoveNext() {
 		List<T> lst = new ArrayList<T>(getIteratorProducer().newInstance()
 				.toList());
@@ -115,7 +113,7 @@ public class ExtendedIteratorContractTes
 	 * and then all the elements of the other iterator. Does not copy either
 	 * iterator; they are consumed as the result iterator is consumed.
 	 */
-	@Test
+	@ContractTest
 	public void testAndThen() {
 		ExtendedIterator<T> iter = getIteratorProducer().newInstance();
 		ExtendedIterator<T> iter2 = getIteratorProducer().newInstance();
@@ -136,7 +134,7 @@ public class ExtendedIteratorContractTes
 	 * the filter _f_. The order of the elements is preserved. Does not copy
 	 * _this_, which is consumed as the result is consumed.
 	 */
-	@Test
+	@ContractTest
 	public void testfilterKeep() {
 		ExtendedIterator<?> iter = getIteratorProducer().newInstance()
 				.filterKeep(new OddFilter());
@@ -154,7 +152,7 @@ public class ExtendedIteratorContractTes
 	 * rejected by the filter _f_. The order of the elements is preserved. Does
 	 * not copy _this_, which is consumed as the result is consumed.
 	 */
-	@Test
+	@ContractTest
 	public void testfilterDrop()
 
 	{
@@ -174,7 +172,7 @@ public class ExtendedIteratorContractTes
 	 * to the corresponding element of _this_. _this_ is not copied; it is
 	 * consumed as the result is consumed.
 	 */
-	@Test
+	@ContractTest
 	public void textMapWith() {
 		ExtendedIterator<Integer> iter = getIteratorProducer().newInstance()
 				.mapWith(new IntMap<T>());
@@ -190,7 +188,7 @@ public class ExtendedIteratorContractTes
 	 * Answer a list of the [remaining] elements of this iterator, in order,
 	 * consuming this iterator.
 	 */
-	@Test
+	@ContractTest
 	public void toList() {
 		List<T> lst1 = getIteratorProducer().newInstance().toList();
 		List<T> lst2 = new ArrayList<T>(getIteratorProducer().getList());
@@ -208,7 +206,7 @@ public class ExtendedIteratorContractTes
 	 * Answer a set of the [remaining] elements of this iterator, consuming this
 	 * iterator.
 	 */
-	@Test
+	@ContractTest
 	public void testToSet() {
 		Set<?> set1 = getIteratorProducer().newInstance().toSet();
 		List<?> lst2 = getIteratorProducer().getList();

Added: jena/Experimental/new-test/src/test/java/test.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/test.java?rev=1555482&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/test.java (added)
+++ jena/Experimental/new-test/src/test/java/test.java Sun Jan  5 11:28:03 2014
@@ -0,0 +1,69 @@
+
+
+import java.io.StringReader;
+
+import org.apache.jena.riot.system.IO_JenaReaders;
+
+import com.hp.hpl.jena.graph.Factory;
+import com.hp.hpl.jena.rdf.model.impl.ModelCom;
+import com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl;
+
+public class test {
+
+	public test() {
+		// TODO Auto-generated constructor stub
+	}
+
+	public static void main(String[] arg)
+	{
+		String[] lines = new String[] {
+				"<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
+				"<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>" };
+		
+		String eol = System.getProperty("line.separator");
+		StringBuilder sb = new StringBuilder();
+		for (String l : lines) {
+			sb.append(l).append(eol);
+		}
+		RDFReaderFImpl rrfi = new RDFReaderFImpl();
+		StringReader reader;
+		ModelCom model;
+		
+		System.out.println( "READER CLASS >>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+rrfi.getReader().getClass() );
+		reader = new StringReader( sb.toString() );
+		model = new ModelCom(Factory.createGraphMem());
+		try {
+		model.read(reader, null);
+		System.out.println( "Did not throw exception");
+		} catch( Exception expected ) {}
+		
+		IO_JenaReaders.wireIntoJena();
+		
+		System.out.println( "READER CLASS >>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+rrfi.getReader().getClass() );
+		reader = new StringReader( sb.toString() );
+		 model = new ModelCom(Factory.createGraphMem());
+		try {
+		model.read(reader, null);
+		System.out.println( "Did not throw exception");
+		} catch( Exception expected ) {}
+
+		rrfi.resetRDFReaderF();
+		
+		System.out.println( "READER CLASS >>>>>>>>>>>>>>>>>>>>>>>>>>>>> "+rrfi.getReader().getClass() );
+		reader = new StringReader( sb.toString() );
+		model = new ModelCom(Factory.createGraphMem());
+		try {
+		model.read(reader, null);
+		System.out.println( "Did not throw exception");
+		} catch( Exception expected ) {}
+
+	}
+}

Propchange: jena/Experimental/new-test/src/test/java/test.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain