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

svn commit: r1520788 [5/6] - in /jena/Experimental/new-test/src/test/java/com/hp/hpl/jena: datatypes/xsd/ graph/ graph/compose/ graph/impl/ shared/ testing_framework/

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/AbstractDyadicTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/AbstractDyadicTest.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/AbstractDyadicTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/AbstractDyadicTest.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hp.hpl.jena.graph.compose;
+
+import static org.junit.Assert.*;
+
+import java.util.StringTokenizer;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.AbstractGraphTest;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.graph.TripleMatch;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+import com.hp.hpl.jena.util.iterator.NiceIterator;
+
+public abstract class AbstractDyadicTest extends AbstractGraphTest {
+
+	static private NiceIterator<String> things(final String x) {
+		return new NiceIterator<String>() {
+			private StringTokenizer tokens = new StringTokenizer(x);
+
+			@Override
+			public boolean hasNext() {
+				return tokens.hasMoreTokens();
+			}
+
+			@Override
+			public String next() {
+				return tokens.nextToken();
+			}
+		};
+	}
+
+	@Test
+	public void testDyadic() {
+		ExtendedIterator<String> it1 = things("now is the time");
+		ExtendedIterator<String> it2 = things("now is the time");
+		ExtendedIterator<String> mt1 = things("");
+		ExtendedIterator<String> mt2 = things("");
+		assertEquals("mt1.hasNext()", false, mt1.hasNext());
+		assertEquals("mt2.hasNext()", false, mt2.hasNext());
+		assertEquals("andThen(mt1,mt2).hasNext()", false, mt1.andThen(mt2)
+				.hasNext());
+		assertEquals("butNot(it1,it2).hasNext()", false, CompositionBase
+				.butNot(it1, it2).hasNext());
+		assertEquals("x y z @butNot z", true,
+				CompositionBase.butNot(things("x y z"), things("z")).hasNext());
+		assertEquals("x y z @butNot a", true,
+				CompositionBase.butNot(things("x y z"), things("z")).hasNext());
+	}
+
+	@Test
+	public void testDyadicOperands() {
+		Graph g = getGraphProducer().newGraph(), h = getGraphProducer()
+				.newGraph();
+		Dyadic d = new Dyadic(g, h) {
+			@Override
+			protected ExtendedIterator<Triple> _graphBaseFind(TripleMatch m) {
+				return null;
+			}
+		};
+		assertSame(g, d.getL());
+		assertSame(h, d.getR());
+	}
+
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/AbstractDyadicTest.java
------------------------------------------------------------------------------
    svn:executable = *

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DeltaSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DeltaSuite.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DeltaSuite.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DeltaSuite.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,43 @@
+/*
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+ */
+package com.hp.hpl.jena.graph.compose;
+
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import com.hp.hpl.jena.graph.AbstractGraphSuite;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+
+@RunWith(Suite.class)
+public class DeltaSuite extends AbstractGraphSuite {
+
+	@BeforeClass
+	public static void beforeClass() {
+		setGraphProducer(new AbstractGraphProducer() {
+			@Override
+			protected Graph createNewGraph() {
+				return new Delta(GraphFactory.createGraphMem());
+			}
+
+		});
+	}
+
+}

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DeltaTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DeltaTest.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DeltaTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DeltaTest.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hp.hpl.jena.graph.compose;
+
+import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+
+public class DeltaTest extends AbstractDyadicTest {
+	private GraphProducerInterface graphProducer = new AbstractGraphProducer() {
+		@Override
+		protected Graph createNewGraph() {
+			return new Delta(GraphFactory.createGraphMem());
+		}
+
+	};
+
+	@Override
+	public GraphProducerInterface getGraphProducer() {
+		return graphProducer;
+	}
+
+	@Test
+	public void testDelta() {
+		Graph x = graphWithTxn("x R y");
+		assertContains("x", "x R y", x);
+		x.delete(triple("x R y"));
+		assertOmits("x", x, "x R y");
+		/* */
+		Graph base = graphWith("x R y; p S q; I like cheese; pins pop balloons");
+		Graph save = graphWith("x R y; p S q; I like cheese; pins pop balloons");
+		Delta delta = new Delta(base);
+		assertContainsAll("Delta", delta,
+				"x R y; p S q; I like cheese; pins pop balloons");
+		assertContainsAll("Delta", base,
+				"x R y; p S q; I like cheese; pins pop balloons");
+		/* */
+		delta.add(triple("pigs fly winglessly"));
+		delta.delete(triple("I like cheese"));
+		/* */
+		assertContainsAll("changed Delta", delta,
+				"x R y; p S q; pins pop balloons; pigs fly winglessly");
+		assertOmits("changed delta", delta, "I like cheese");
+		assertContains("delta additions", "pigs fly winglessly",
+				delta.getAdditions());
+		assertOmits("delta additions", delta.getAdditions(), "I like cheese");
+		assertContains("delta deletions", "I like cheese", delta.getDeletions());
+		assertOmits("delta deletions", delta.getDeletions(),
+				"pigs fly winglessly");
+	}
+
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DeltaTest.java
------------------------------------------------------------------------------
    svn:executable = *

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceSuite.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceSuite.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceSuite.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,47 @@
+/*
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+ */
+package com.hp.hpl.jena.graph.compose;
+
+import static com.hp.hpl.jena.testing_framework.GraphTestUtils.graphWith;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import com.hp.hpl.jena.graph.AbstractGraphSuite;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+
+@RunWith(Suite.class)
+public class DifferenceSuite extends AbstractGraphSuite {
+
+	@BeforeClass
+	public static void beforeClass() {
+		setGraphProducer(new AbstractGraphProducer() {
+			@Override
+			protected Graph createNewGraph() {
+				Graph g1 = graphWith(GraphFactory.createGraphMem(),
+						"x R y; p R q");
+				Graph g2 = graphWith(GraphFactory.createGraphMem(),
+						"r A s; x R y");
+				return new Difference(g1, g2);
+			}
+
+		});
+	}
+}

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceTest.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceTest.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hp.hpl.jena.graph.compose;
+
+import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.compose.Difference;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+
+@SuppressWarnings("deprecation")
+public class DifferenceTest extends AbstractDyadicTest {
+	private GraphProducerInterface graphProducer = new AbstractGraphProducer() {
+		@Override
+		protected Graph createNewGraph() {
+			Graph g1 = graphWith(GraphFactory.createGraphMem(), "x R y; p R q");
+			Graph g2 = graphWith(GraphFactory.createGraphMem(), "r A s; x R y");
+			return new Difference(g1, g2);
+		}
+
+	};
+
+	@Override
+	public GraphProducerInterface getGraphProducer() {
+		return graphProducer;
+	}
+
+	@Test
+	public void testDifference() {
+		Graph g1 = graphWith("x R y; p R q");
+		Graph g2 = graphWith("r A s; x R y");
+		Graph d = new Difference(g1, g2);
+		assertOmits("Difference", d, "x R y");
+		assertContains("Difference", "p R q", d);
+		assertOmits("Difference", d, "r A s");
+		if (d.size() != 1)
+			fail("oops: size of difference is not 1");
+		d.add(triple("cats eat cheese"));
+		assertContains("Difference.L", "cats eat cheese", g1);
+		assertOmits("Difference.R", g2, "cats eat cheese");
+	}
+
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceTest.java
------------------------------------------------------------------------------
    svn:executable = *

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DisjointUnionSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DisjointUnionSuite.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DisjointUnionSuite.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DisjointUnionSuite.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,44 @@
+/*
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+ */
+package com.hp.hpl.jena.graph.compose;
+
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import com.hp.hpl.jena.graph.AbstractGraphSuite;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+
+@RunWith(Suite.class)
+public class DisjointUnionSuite extends AbstractGraphSuite {
+
+	@BeforeClass
+	public static void beforeClass() {
+		setGraphProducer(new AbstractGraphProducer() {
+			@Override
+			protected Graph createNewGraph() {
+				return new DisjointUnion(GraphFactory.createGraphMem(),
+						GraphFactory.createGraphMem());
+
+			}
+
+		});
+	}
+}

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DisjointUnionTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DisjointUnionTest.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DisjointUnionTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DisjointUnionTest.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hp.hpl.jena.graph.compose;
+
+import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.compose.DisjointUnion;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+
+/**
+ * TestDisjointUnion - test that DisjointUnion works, as well as we can.
+ */
+public class DisjointUnionTest extends AbstractDyadicTest {
+	private GraphProducerInterface graphProducer = new AbstractGraphProducer() {
+		@Override
+		protected Graph createNewGraph() {
+			return new DisjointUnion(GraphFactory.createGraphMem(),
+					GraphFactory.createGraphMem());
+		}
+
+	};
+
+	@Override
+	public GraphProducerInterface getGraphProducer() {
+		return graphProducer;
+	}
+
+	@Test
+	public void testEmptyUnion() {
+		DisjointUnion du = new DisjointUnion(Graph.emptyGraph, Graph.emptyGraph);
+		assertEquals(true, du.isEmpty());
+	}
+
+	@Test
+	public void testLeftUnion() {
+		Graph g = graphWith("");
+		testSingleComponent(g, new DisjointUnion(g, Graph.emptyGraph));
+	}
+
+	@Test
+	public void testRightUnion() {
+		Graph g = graphWith("");
+		testSingleComponent(g, new DisjointUnion(Graph.emptyGraph, g));
+	}
+
+	@Test
+	protected void testSingleComponent(Graph g, DisjointUnion du) {
+		graphAdd(g, "x R y; a P b; x Q b");
+		assertIsomorphic(g, du);
+		graphAdd(g, "roses growOn you");
+		assertIsomorphic(g, du);
+		g.delete(triple("a P b"));
+		assertIsomorphic(g, du);
+	}
+
+	@Test
+	public void testBothComponents() {
+		Graph L = graphWith(""), R = graphWith("");
+		Graph du = new DisjointUnion(L, R);
+		assertIsomorphic(Graph.emptyGraph, du);
+		L.add(triple("x P y"));
+		assertIsomorphic(graphWith("x P y"), du);
+		R.add(triple("A rdf:type Route"));
+		assertIsomorphic(graphWith("x P y; A rdf:type Route"), du);
+	}
+
+	@Test
+	public void testRemoveBoth() {
+		Graph L = graphWith("x R y; a P b"), R = graphWith("x R y; p Q r");
+		Graph du = new DisjointUnion(L, R);
+		du.delete(triple("x R y"));
+		assertIsomorphic(graphWith("a P b"), L);
+		assertIsomorphic(graphWith("p Q r"), R);
+	}
+
+	@Test
+	public void testAddLeftOnlyIfNecessary() {
+		Graph L = graphWith(""), R = graphWith("x R y");
+		Graph du = new DisjointUnion(L, R);
+		graphAdd(du, "x R y");
+		assertEquals(true, L.isEmpty());
+		graphAdd(du, " a P b");
+		assertIsomorphic(graphWith("a P b"), L);
+		assertIsomorphic(graphWith("x R y"), R);
+	}
+}

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/IntersectionSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/IntersectionSuite.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/IntersectionSuite.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/IntersectionSuite.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,44 @@
+/*
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+ */
+package com.hp.hpl.jena.graph.compose;
+
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import com.hp.hpl.jena.graph.AbstractGraphSuite;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+
+@RunWith(Suite.class)
+public class IntersectionSuite extends AbstractGraphSuite {
+
+	@BeforeClass
+	public static void beforeClass() {
+		setGraphProducer(new AbstractGraphProducer() {
+			@SuppressWarnings("deprecation")
+			@Override
+			protected Graph createNewGraph() {
+				return new Intersection(GraphFactory.createGraphMem(),
+						GraphFactory.createGraphMem());
+			}
+
+		});
+	}
+}

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/IntersectionTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/IntersectionTest.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/IntersectionTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/IntersectionTest.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hp.hpl.jena.graph.compose;
+
+import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.GraphUtil;
+import com.hp.hpl.jena.graph.compose.Intersection;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+
+@SuppressWarnings("deprecation")
+public class IntersectionTest extends AbstractDyadicTest {
+	private GraphProducerInterface graphProducer = new AbstractGraphProducer() {
+		@Override
+		protected Graph createNewGraph() {
+			return new Intersection(GraphFactory.createGraphMem(),
+					GraphFactory.createGraphMem());
+		}
+
+	};
+
+	@Override
+	public GraphProducerInterface getGraphProducer() {
+		return graphProducer;
+	}
+
+	@Test
+	public void testIntersection() {
+		Graph g1 = graphWith(GraphFactory.createGraphMem(), "x R y; p R q");
+		Graph g2 = graphWith(GraphFactory.createGraphMem(), "r A s; x R y");
+		Intersection i = new Intersection(g1, g2);
+		assertContains("Intersection", "x R y", i);
+		assertOmits("Intersection", i, "p R q");
+		assertOmits("Intersection", i, "r A s");
+		if (i.size() != 1)
+			fail("oops: size of intersection is not 1");
+		i.add(triple("cats eat cheese"));
+		assertContains("Intersection.L", "cats eat cheese", g1);
+		assertContains("Intersection.R", "cats eat cheese", g2);
+	}
+
+	@Test
+	public void testDeleteDoesNotUpdateR() {
+		Graph L = graphWith("a pings b; b pings c; c pings a");
+		Graph R = graphWith("c pings a; b pings c; x captures y");
+		Graph join = new Intersection(L, R);
+		GraphUtil.deleteFrom(L, R);
+		assertIsomorphic("R should not change",
+				graphWith("c pings a; b pings c; x captures y"), R);
+		assertIsomorphic(graphWith("a pings b"), L);
+	}
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/IntersectionTest.java
------------------------------------------------------------------------------
    svn:executable = *

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionReifierTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionReifierTest.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionReifierTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionReifierTest.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hp.hpl.jena.graph.compose;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.AbstractReifierTest;
+import com.hp.hpl.jena.graph.Factory;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.GraphUtil;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.NodeCreateUtils;
+import com.hp.hpl.jena.graph.NodeFactory;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.graph.compose.MultiUnion;
+import com.hp.hpl.jena.rdf.model.impl.ReifierStd;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+import com.hp.hpl.jena.vocabulary.RDF;
+
+/**
+ * Test the reifier for multi-unions.
+ */
+public class MultiUnionReifierTest extends AbstractReifierTest {
+	private GraphProducerInterface graphProducer = new AbstractGraphProducer() {
+		@Override
+		protected Graph createNewGraph() {
+			Graph gBase = GraphFactory.createDefaultGraph();
+			Graph g1 = GraphFactory.createDefaultGraph();
+			Graph g2 = GraphFactory.createDefaultGraph();
+			MultiUnion poly = new MultiUnion(new Graph[] { gBase, g1, g2 });
+			poly.setBaseGraph(gBase);
+			return poly;
+
+		}
+
+	};
+
+	@Override
+	public GraphProducerInterface getGraphProducer() {
+		return graphProducer;
+	}
+
+	@Test
+	public void testX() {
+		List<Triple> triples = new ArrayList<Triple>();
+		triples.add(new Triple(NodeFactory.createURI("eh:/a"), NodeFactory
+				.createURI("eh:/P"), NodeFactory.createURI("eh:/b")));
+		triples.add(new Triple(Node.ANY, RDF.object.asNode(), NodeFactory
+				.createURI("eh:/d")));
+		triples.add(new Triple(Node.ANY, RDF.predicate.asNode(), NodeFactory
+				.createURI("eh:/R")));
+		triples.add(new Triple(Node.ANY, RDF.subject.asNode(), NodeFactory
+				.createURI("eh:/c")));
+		triples.add(new Triple(Node.ANY, RDF.type.asNode(), RDF.Statement
+				.asNode()));
+		triples.add(new Triple(Node.ANY, RDF.object.asNode(), NodeFactory
+				.createURI("eh:/c")));
+		triples.add(new Triple(Node.ANY, RDF.predicate.asNode(), NodeFactory
+				.createURI("eh:/Q")));
+		triples.add(new Triple(Node.ANY, RDF.subject.asNode(), NodeFactory
+				.createURI("eh:/b")));
+		triples.add(new Triple(Node.ANY, RDF.type.asNode(), RDF.Statement
+				.asNode()));
+		triples.add(new Triple(NodeFactory.createURI("eh:/b"), NodeFactory
+				.createURI("eh:/Q"), NodeFactory.createURI("eh:/c")));
+
+		MultiUnion mu = multi("a P b; !b Q c; ~c R d", "");
+		StringBuilder sb = new StringBuilder();
+		List<Triple> results = GraphUtil.findAll(mu).toList();
+		assertEquals(triples.size(), results.size());
+		for (Triple t : results) {
+			boolean found = false;
+			for (Triple t2 : triples) {
+				if (t2.matches(t)) {
+					triples.remove(t);
+					found = true;
+					break;
+				}
+			}
+			if (!found) {
+				sb.append("did not find " + t.toString());
+			}
+		}
+		if (sb.length() > 0) {
+			fail(sb.toString());
+		}
+
+	}
+
+	private MultiUnion multi(String a, String b) {
+		Graph A = graph(a), B = graph(b);
+		return new MultiUnion(new Graph[] { A, B });
+	}
+
+	static int count = 0;
+
+	private Graph graph(String facts) {
+		Graph result = Factory.createDefaultGraph();
+		String[] factArray = facts.split(";");
+		for (int i = 0; i < factArray.length; i += 1) {
+			String fact = factArray[i].trim();
+			if (fact.equals("")) {
+			} else if (fact.charAt(0) == '!') {
+				Triple t = NodeCreateUtils.createTriple(fact.substring(1));
+				result.add(t);
+				ReifierStd.reifyAs(result,
+						NodeCreateUtils.create("_r" + ++count), t);
+			} else if (fact.charAt(0) == '~') {
+				Triple t = NodeCreateUtils.createTriple(fact.substring(1));
+				ReifierStd.reifyAs(result,
+						NodeCreateUtils.create("_r" + ++count), t);
+			} else
+				result.add(NodeCreateUtils.createTriple(fact));
+		}
+		return result;
+	}
+
+}

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionSuite.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionSuite.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionSuite.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,48 @@
+/*
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+ */
+package com.hp.hpl.jena.graph.compose;
+
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import com.hp.hpl.jena.graph.AbstractGraphSuite;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+
+@RunWith(Suite.class)
+public class MultiUnionSuite extends AbstractGraphSuite {
+
+	@BeforeClass
+	public static void beforeClass() {
+		setGraphProducer(new AbstractGraphProducer() {
+			@Override
+			protected Graph createNewGraph() {
+				Graph gBase = GraphFactory.createDefaultGraph();
+				Graph g1 = GraphFactory.createDefaultGraph();
+				Graph g2 = GraphFactory.createDefaultGraph();
+				MultiUnion poly = new MultiUnion(new Graph[] { gBase, g1, g2 });
+				poly.setBaseGraph(gBase);
+				return poly;
+
+			}
+
+		});
+	}
+}

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionTest.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionTest.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,353 @@
+/*
+ * 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
+///////////////
+package com.hp.hpl.jena.graph.compose;
+
+// Imports
+///////////////
+import static org.junit.Assert.*;
+import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.AbstractGraphTest;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.GraphStatisticsHandler;
+import com.hp.hpl.jena.graph.compose.MultiUnion;
+import com.hp.hpl.jena.graph.compose.MultiUnion.MultiUnionStatisticsHandler;
+
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+
+/**
+ * <p>
+ * Unit tests for multi-union graph.
+ * </p>
+ */
+public class MultiUnionTest extends AbstractGraphTest {
+
+	@Override
+	public GraphProducerInterface getGraphProducer() {
+		return new AbstractGraphProducer() {
+			@Override
+			protected Graph createNewGraph() {
+				return new MultiUnion(new Graph[] {
+						GraphFactory.createGraphMem(),
+						GraphFactory.createGraphMem() });
+
+			}
+
+		};
+	}
+
+	// External signature methods
+	// ////////////////////////////////
+
+	@Test
+	public void testEmptyGraph() {
+		Graph m = new MultiUnion();
+		Graph g0 = graphWith("x p y");
+
+		assertEquals("Empty model should have size zero", 0, m.size());
+		assertFalse("Empty model should not contain another graph",
+				m.dependsOn(g0));
+	}
+
+	/**
+	 * A MultiUnion graph should have a MultiUnionStatisticsHandler, and that
+	 * handler should point right back to that graph.
+	 */
+	@Test
+	public void testMultiUnionHasMultiUnionStatisticsHandler() {
+		MultiUnion mu = new MultiUnion();
+		GraphStatisticsHandler sh = mu.getStatisticsHandler();
+		assertInstanceOf(MultiUnionStatisticsHandler.class, sh);
+		assertSame(mu, ((MultiUnionStatisticsHandler) sh).getUnion());
+	}
+
+	// public void testDeferredReifier()
+	// {
+	// Graph g1 = graphWith( "" ), g2 = graphWith( "" );
+	// MultiUnion m = new MultiUnion( new Graph[] {g1, g2} );
+	// m.setBaseGraph( g1 );
+	// assertSame( m.getReifier(), g1.getReifier() );
+	// }
+
+	@Test
+	public void testGraphSize1() {
+		Graph g0 = graphWith("x p y");
+		Graph g1 = graphWith("x p z; z p zz"); // disjoint with g0
+		Graph g2 = graphWith("x p y; z p a"); // intersects with g1
+
+		Graph m01 = new MultiUnion(new Graph[] { g0, g1 });
+		Graph m10 = new MultiUnion(new Graph[] { g1, g0 });
+		Graph m12 = new MultiUnion(new Graph[] { g1, g2 });
+		Graph m21 = new MultiUnion(new Graph[] { g2, g1 });
+		Graph m02 = new MultiUnion(new Graph[] { g0, g2 });
+		Graph m20 = new MultiUnion(new Graph[] { g2, g0 });
+
+		Graph m00 = new MultiUnion(new Graph[] { g0, g0 });
+
+		int s0 = g0.size();
+		int s1 = g1.size();
+		int s2 = g2.size();
+
+		assertEquals("Size of union of g0 and g1 not correct", s0 + s1,
+				m01.size());
+		assertEquals("Size of union of g1 and g0 not correct", s0 + s1,
+				m10.size());
+
+		assertEquals("Size of union of g1 and g2 not correct", s1 + s2,
+				m12.size());
+		assertEquals("Size of union of g2 and g1 not correct", s1 + s2,
+				m21.size());
+
+		assertEquals("Size of union of g0 and g2 not correct", s0 + s2 - 1,
+				m02.size());
+		assertEquals("Size of union of g2 and g0 not correct", s0 + s2 - 1,
+				m20.size());
+
+		assertEquals("Size of union of g0 with itself not correct", s0,
+				m00.size());
+	}
+
+	@Test
+	public void testGraphSize2() {
+		Graph g0 = graphWith("x p y");
+		Graph g1 = graphWith("x p z; z p zz"); // disjoint with g0
+		Graph g2 = graphWith("x p y; z p a"); // intersects with g1
+
+		Graph m01 = new MultiUnion(iterateOver(g0, g1));
+		Graph m10 = new MultiUnion(iterateOver(g1, g0));
+		Graph m12 = new MultiUnion(iterateOver(g1, g2));
+		Graph m21 = new MultiUnion(iterateOver(g2, g1));
+		Graph m02 = new MultiUnion(iterateOver(g0, g2));
+		Graph m20 = new MultiUnion(iterateOver(g2, g0));
+
+		Graph m00 = new MultiUnion(iterateOver(g0, g0));
+
+		int s0 = g0.size();
+		int s1 = g1.size();
+		int s2 = g2.size();
+
+		assertEquals("Size of union of g0 and g1 not correct", s0 + s1,
+				m01.size());
+		assertEquals("Size of union of g1 and g0 not correct", s0 + s1,
+				m10.size());
+
+		assertEquals("Size of union of g1 and g2 not correct", s1 + s2,
+				m12.size());
+		assertEquals("Size of union of g2 and g1 not correct", s1 + s2,
+				m21.size());
+
+		assertEquals("Size of union of g0 and g2 not correct", s0 + s2 - 1,
+				m02.size());
+		assertEquals("Size of union of g2 and g0 not correct", s0 + s2 - 1,
+				m20.size());
+
+		assertEquals("Size of union of g0 with itself not correct", s0,
+				m00.size());
+	}
+
+	@Test
+	public void testGraphAddSize() {
+		Graph g0 = graphWith("x p y");
+		Graph g1 = graphWith("x p z; z p zz"); // disjoint with g0
+		Graph g2 = graphWith("x p y; z p a"); // intersects with g1
+
+		int s0 = g0.size();
+		int s1 = g1.size();
+		int s2 = g2.size();
+
+		MultiUnion m0 = new MultiUnion(new Graph[] { g0 });
+
+		assertEquals("Size of union of g0 not correct", s0, m0.size());
+		m0.addGraph(g1);
+		assertEquals("Size of union of g1 and g0 not correct", s0 + s1,
+				m0.size());
+
+		m0.addGraph(g2);
+		assertEquals("Size of union of g0, g1 and g2 not correct", s0 + s1 + s2
+				- 1, m0.size());
+
+		m0.removeGraph(g1);
+		assertEquals("Size of union of g0 and g2 not correct", s0 + s2 - 1,
+				m0.size());
+
+		m0.removeGraph(g0);
+		assertEquals("Size of union of g2 not correct", s2, m0.size());
+
+		// remove again
+		m0.removeGraph(g0);
+		assertEquals("Size of union of g2 not correct", s2, m0.size());
+
+		m0.removeGraph(g2);
+		assertEquals("Size of empty union not correct", 0, m0.size());
+
+	}
+
+	@Test
+	public void testAdd() {
+		Graph g0 = graphWith("x p y");
+		Graph g1 = graphWith("x p z; z p zz"); // disjoint with g0
+		Graph g2 = graphWith("x p y; z p a"); // intersects with g1
+
+		MultiUnion m = new MultiUnion(new Graph[] { g0, g1 });
+
+		int s0 = g0.size();
+		int s1 = g1.size();
+		int s2 = g2.size();
+		int m0 = m.size();
+
+		// add a triple to the union
+		m.add(triple("a q b"));
+
+		assertEquals("m.size should have increased by one", m0 + 1, m.size());
+		assertEquals("g0.size should have increased by one", s0 + 1, g0.size());
+		assertEquals("g1 size should be constant", s1, g1.size());
+
+		// change the designated receiver and try again
+		m.setBaseGraph(g1);
+
+		s0 = g0.size();
+		s1 = g1.size();
+		s2 = g2.size();
+		m0 = m.size();
+
+		m.add(triple("a1 q b1"));
+
+		assertEquals("m.size should have increased by one", m0 + 1, m.size());
+		assertEquals("g0 size should be constant", s0, g0.size());
+		assertEquals("g1.size should have increased by one", s1 + 1, g1.size());
+
+		// check that we can't make g2 the designated updater
+		boolean expected = false;
+		try {
+			m.setBaseGraph(g2);
+		} catch (IllegalArgumentException e) {
+			expected = true;
+		}
+		assertTrue("Should not have been able to make g2 the updater", expected);
+	}
+
+	@Test
+	public void testDelete() {
+		Graph g0 = graphWith("x p y");
+		Graph g1 = graphWith("x p z; z p zz"); // disjoint with g0
+
+		MultiUnion m = new MultiUnion(new Graph[] { g0, g1 });
+
+		checkDeleteSizes(1, 2, 3, g0, g1, m);
+
+		m.delete(triple("x p y"));
+		checkDeleteSizes(0, 2, 2, g0, g1, m);
+
+		m.delete(triple("x p y"));
+		checkDeleteSizes(0, 2, 2, g0, g1, m);
+
+		m.setBaseGraph(g1);
+
+		m.delete(triple("x p z"));
+		checkDeleteSizes(0, 1, 1, g0, g1, m);
+
+		m.delete(triple("z p zz"));
+		checkDeleteSizes(0, 0, 0, g0, g1, m);
+	}
+
+	@Test
+	public void testContains() {
+		Graph g0 = graphWith("x p y");
+		Graph g1 = graphWith("x p z; z p zz"); // disjoint with g0
+
+		MultiUnion m = new MultiUnion(new Graph[] { g0, g1 });
+
+		assertTrue("m should contain triple", m.contains(triple("x p y ")));
+		assertTrue("m should contain triple", m.contains(triple("x p z ")));
+		assertTrue("m should contain triple", m.contains(triple("z p zz ")));
+
+		assertFalse("m should not contain triple",
+				m.contains(triple("zz p z ")));
+	}
+
+	/* Test using a model to wrap a multi union */
+	@Test
+	public void testModel() {
+		Graph g0 = graphWith("x p y");
+		MultiUnion u = new MultiUnion(new Graph[] { g0 });
+
+		Model m = ModelFactory.createModelForGraph(u);
+
+		assertEquals("Model size not correct", 1, m.size());
+
+		Graph g1 = graphWith("x p z; z p zz"); // disjoint with g0
+		u.addGraph(g1);
+
+		assertEquals("Model size not correct", 3, m.size());
+
+		// adds one more statement to the model
+		m.read(getFileName("ontology/list0.rdf"));
+		assertEquals("Model size not correct", 4, m.size());
+
+		// debug m.write( System.out );
+	}
+
+	// Internal implementation methods
+	// ////////////////////////////////
+
+	protected void checkDeleteSizes(int s0, int s1, int m0, Graph g0, Graph g1,
+			Graph m) {
+		assertEquals("Delete check: g0 size", s0, g0.size());
+		assertEquals("Delete check: g1 size", s1, g1.size());
+		assertEquals("Delete check: m size", m0, m.size());
+	}
+
+	protected <T> Iterator<T> iterateOver(T x0) {
+		List<T> l = new ArrayList<T>();
+		l.add(x0);
+		return l.iterator();
+	}
+
+	protected <T> Iterator<T> iterateOver(T x0, T x1) {
+		List<T> l = new ArrayList<T>();
+		l.add(x0);
+		l.add(x1);
+		return l.iterator();
+	}
+
+	protected <T> Iterator<T> iterateOver(T x0, T x1, T x2) {
+		List<T> l = new ArrayList<T>();
+		l.add(x0);
+		l.add(x1);
+		l.add(x2);
+		return l.iterator();
+	}
+
+	// ==============================================================================
+	// Inner class definitions
+	// ==============================================================================
+
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionTest.java
------------------------------------------------------------------------------
    svn:executable = *

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/PolyadicPrefixMappingTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/PolyadicPrefixMappingTest.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/PolyadicPrefixMappingTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/PolyadicPrefixMappingTest.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,186 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hp.hpl.jena.graph.compose;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.shared.AbstractPrefixMappingTest;
+import com.hp.hpl.jena.shared.PrefixMapping;
+import com.hp.hpl.jena.shared.impl.PrefixMappingImpl;
+
+public class PolyadicPrefixMappingTest extends AbstractPrefixMappingTest {
+	private Polyadic poly;
+	private Graph gBase;
+	private PrefixMapping gBaseMapping;
+	private Graph g1;
+	private PrefixMapping g1Mapping;
+	private Graph g2;
+	private PrefixMapping g2Mapping;
+	private PolyadicPrefixMappingImpl prefixMapping;
+
+	@Before
+	public void setup() {
+		gBase = mock(Graph.class);
+		gBaseMapping = mock(PrefixMapping.class);
+		when(gBase.getPrefixMapping()).thenReturn(gBaseMapping);
+		g1 = Mockito.mock(Graph.class);
+		g1Mapping = mock(PrefixMapping.class);
+		when(g1.getPrefixMapping()).thenReturn(g1Mapping);
+		g2 = Mockito.mock(Graph.class);
+		g2Mapping = mock(PrefixMapping.class);
+		when(g2.getPrefixMapping()).thenReturn(g2Mapping);
+		poly = mock(Polyadic.class);
+		when(poly.getBaseGraph()).thenReturn(gBase);
+		when(poly.getSubGraphs()).thenReturn(
+				Arrays.asList(new Graph[] { g1, g2 }));
+		prefixMapping = new PolyadicPrefixMappingImpl(poly);
+		when(poly.getPrefixMapping()).thenReturn(prefixMapping);
+
+	}
+
+	// PolyadicPrefixMappingImpl
+	@Override
+	protected PrefixMapping getMapping() {
+		PrefixMappingImpl pfx = new PrefixMappingImpl();
+		Graph gBase = mock(Graph.class);
+		when(gBase.getPrefixMapping()).thenReturn(new PrefixMappingImpl());
+		Graph g1 = Mockito.mock(Graph.class);
+		when(g1.getPrefixMapping()).thenReturn(new PrefixMappingImpl());
+		Graph g2 = Mockito.mock(Graph.class);
+		when(g2.getPrefixMapping()).thenReturn(new PrefixMappingImpl());
+		poly = mock(Polyadic.class);
+		when(poly.getBaseGraph()).thenReturn(gBase);
+		when(poly.getSubGraphs()).thenReturn(
+				Arrays.asList(new Graph[] { g1, g2 }));
+		return new PolyadicPrefixMappingImpl(poly);
+	}
+
+	protected static final String alpha = "something:alpha#";
+	protected static final String beta = "something:beta#";
+
+	/*
+	 * tests for polyadic prefix mappings (a) base mapping is the mutable one
+	 * (b) base mapping over-rides all others (c) non-overridden mappings in
+	 * other maps are visible
+	 */
+	@Test
+	public void testOnlyBaseMutated() {
+		prefixMapping.setNsPrefix("a", alpha);
+		verify(g1Mapping, times(0)).setNsPrefix(anyString(), anyString());
+		verify(g2Mapping, times(0)).setNsPrefix(anyString(), anyString());
+		verify(gBaseMapping, times(1)).setNsPrefix(anyString(), anyString());
+		verify(gBaseMapping, times(1)).setNsPrefix("a", alpha);
+	}
+
+	@Test
+	public void testUpdatesVisible() {
+		when(g1Mapping.getNsPrefixURI("a")).thenReturn(alpha);
+		when(g2Mapping.getNsPrefixURI("b")).thenReturn(beta);
+		assertEquals(alpha, prefixMapping.getNsPrefixURI("a"));
+		assertEquals(beta, prefixMapping.getNsPrefixURI("b"));
+		verify(gBaseMapping, times(1)).getNsPrefixURI("a");
+		verify(gBaseMapping, times(1)).getNsPrefixURI("b");
+	}
+
+	@Test
+	public void testUpdatesOverridden() {
+		when(g1Mapping.getNsPrefixURI("x")).thenReturn(alpha);
+		when(gBaseMapping.getNsPrefixURI("x")).thenReturn(beta);
+		assertEquals(beta, poly.getPrefixMapping().getNsPrefixURI("x"));
+	}
+
+	@Test
+	public void testQNameComponents() {
+		when(g1Mapping.qnameFor(alpha + "hoop")).thenReturn("x:hoop");
+		when(g2Mapping.qnameFor(beta + "lens")).thenReturn("y:lens");
+
+		assertEquals("x:hoop", poly.getPrefixMapping().qnameFor(alpha + "hoop"));
+		assertEquals("y:lens", poly.getPrefixMapping().qnameFor(beta + "lens"));
+	}
+
+	/**
+	 * Test that the default namespace of a sub-graph doesn't appear as a
+	 * default namespace of the polyadic graph.
+	 */
+	@Test
+	public void testSubgraphsDontPolluteDefaultPrefix() {
+		String imported = "http://imported#", local = "http://local#";
+
+		Map<String, String> g1Map = new HashMap<String, String>();
+		g1Map.put("", imported);
+
+		Map<String, String> g2Map = new HashMap<String, String>();
+		g2Map.put("", local);
+
+		when(g1Mapping.getNsPrefixMap()).thenReturn(g1Map);
+		when(gBaseMapping.getNsPrefixMap()).thenReturn(g2Map);
+
+		assertEquals(null, poly.getPrefixMapping().getNsURIPrefix(imported));
+	}
+
+	@Test
+	public void testPolyDoesntSeeImportedDefaultPrefix() {
+		String imported = "http://imported#";
+		Map<String, String> g1Map = new HashMap<String, String>();
+		g1Map.put("", imported);
+		when(g1Mapping.getNsPrefixMap()).thenReturn(g1Map);
+
+		assertEquals(null, poly.getPrefixMapping().getNsPrefixURI(""));
+	}
+
+	@Test
+	public void testPolyMapOverridesFromTheLeft() {
+		Map<String, String> g1Map = new HashMap<String, String>();
+		g1Map.put("a", "eh:/U1");
+
+		Map<String, String> g2Map = new HashMap<String, String>();
+		g2Map.put("a", "eh:/U2");
+
+		when(g1Mapping.getNsPrefixMap()).thenReturn(g1Map);
+		when(g2Mapping.getNsPrefixMap()).thenReturn(g2Map);
+
+		String a = poly.getPrefixMapping().getNsPrefixMap().get("a");
+		assertEquals("eh:/U1", a);
+	}
+
+	@Test
+	public void testPolyMapHandlesBase() {
+		Map<String, String> g1Map = new HashMap<String, String>();
+		g1Map.put("", "eh:/U1");
+
+		Map<String, String> g2Map = new HashMap<String, String>();
+		g2Map.put("", "eh:/U2");
+
+		when(g1Mapping.getNsPrefixMap()).thenReturn(g1Map);
+		when(g2Mapping.getNsPrefixMap()).thenReturn(g2Map);
+
+		String a = poly.getPrefixMapping().getNsPrefixMap().get("");
+		assertEquals(poly.getPrefixMapping().getNsPrefixURI(""), a);
+	}
+
+}

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/UnionTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/UnionTest.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/UnionTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/UnionTest.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hp.hpl.jena.graph.compose;
+
+import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.GraphStatisticsHandler;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.graph.TripleMatch;
+import com.hp.hpl.jena.graph.compose.Union;
+import com.hp.hpl.jena.graph.impl.GraphBase;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+
+public class UnionTest extends AbstractDyadicTest {
+	private GraphProducerInterface graphProducer = new AbstractGraphProducer() {
+		@Override
+		protected Graph createNewGraph() {
+			Graph g1 = GraphFactory.createGraphMem();
+			Graph g2 = GraphFactory.createGraphMem();
+			return new Union(g1, g2);
+		}
+
+	};
+
+	@Override
+	public GraphProducerInterface getGraphProducer() {
+		return graphProducer;
+	}
+
+	@Test
+	public void testUnion() {
+		Graph g1 = graphWith("x R y; p R q");
+		Graph g2 = graphWith("r A s; x R y");
+		Union u = new Union(g1, g2);
+		assertContains("Union", "x R y", u);
+		assertContains("Union", "p R q", u);
+		assertContains("Union", "r A s", u);
+		if (u.size() != 3)
+			fail("oops: size of union is not 3");
+		u.add(triple("cats eat cheese"));
+		assertContains("Union", "cats eat cheese", u);
+		if (contains(g1, "cats eat cheese") == false
+				&& contains(g2, "cats eat cheese") == false)
+			fail("oops: neither g1 nor g2 contains `cats eat cheese`");
+	}
+
+	static class AnInteger {
+		public int value = 0;
+
+		public AnInteger(int value) {
+			this.value = value;
+		}
+	}
+
+	@Test
+	public void testUnionValues() {
+		testUnion(0, 0, 0, 0);
+	}
+
+	@Test
+	public void testCopiesSingleNonZeroResult() {
+		testUnion(1, 1, 0, 0);
+		testUnion(1, 0, 1, 0);
+		testUnion(1, 0, 0, 1);
+		testUnion(1, 1, 0, 0);
+		testUnion(2, 0, 2, 0);
+		testUnion(4, 0, 0, 4);
+	}
+
+	@Test
+	public void testResultIsSumOfBaseResults() {
+		testUnion(3, 1, 2, 0);
+		testUnion(5, 1, 0, 4);
+		testUnion(6, 0, 2, 4);
+		testUnion(7, 1, 2, 4);
+		testUnion(3, 0, 2, 1);
+		testUnion(5, 4, 1, 0);
+		testUnion(6, 2, 2, 2);
+		testUnion(7, 6, 0, 1);
+	}
+
+	@Test
+	public void testUnknownOverrulesAll() {
+		testUnion(-1, -1, 0, 0);
+		testUnion(-1, 0, -1, 0);
+		testUnion(-1, 0, 0, -1);
+		testUnion(-1, -1, 1, 1);
+		testUnion(-1, 1, -1, 1);
+		testUnion(-1, 1, 1, -1);
+	}
+
+	/**
+	 * Asserts that the statistic obtained by probing the three-element union
+	 * with statistics <code>av</code>, <code>bv</code>, and <code>cv</code> is
+	 * <code>expected</code>.
+	 */
+	private void testUnion(int expected, int av, int bv, int cv) {
+		AnInteger a = new AnInteger(av), b = new AnInteger(bv), c = new AnInteger(
+				cv);
+		Graph g1 = graphWithGivenStatistic(a);
+		Graph g2 = graphWithGivenStatistic(b);
+		Graph g3 = graphWithGivenStatistic(c);
+		Graph[] graphs = new Graph[] { g1, g2, g3 };
+		MultiUnion mu = new MultiUnion(graphs);
+		GraphStatisticsHandler gs = new MultiUnion.MultiUnionStatisticsHandler(
+				mu);
+		assertEquals(expected, gs.getStatistic(Node.ANY, Node.ANY, Node.ANY));
+	}
+
+	static Graph graphWithGivenStatistic(final AnInteger x) {
+		return new GraphBase() {
+			@Override
+			protected ExtendedIterator<Triple> graphBaseFind(TripleMatch m) {
+				throw new RuntimeException("should never be called");
+			}
+
+			@Override
+			protected GraphStatisticsHandler createStatisticsHandler() {
+				return new GraphStatisticsHandler() {
+					@Override
+					public long getStatistic(Node S, Node P, Node O) {
+						return x.value;
+					}
+				};
+			}
+		};
+	}
+}

Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/UnionTest.java
------------------------------------------------------------------------------
    svn:executable = *

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

Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/package-info.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/package-info.java?rev=1520788&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/package-info.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/package-info.java Sat Sep  7 18:58:59 2013
@@ -0,0 +1,23 @@
+/*
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+ */
+package com.hp.hpl.jena.graph.compose;
+
+/**
+ * This package defines tests for the composed-graph package.
+ **/
+

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

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/CollectionGraphSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/CollectionGraphSuite.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/CollectionGraphSuite.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/CollectionGraphSuite.java Sat Sep  7 18:58:59 2013
@@ -21,6 +21,8 @@ package com.hp.hpl.jena.graph.impl;
 import java.util.HashSet;
 
 import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
 import com.hp.hpl.jena.graph.AbstractGraphSuite;
 import com.hp.hpl.jena.graph.Graph;
@@ -28,6 +30,7 @@ import com.hp.hpl.jena.graph.Triple;
 import com.hp.hpl.jena.graph.impl.CollectionGraph;
 import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
 
+@RunWith(Suite.class)
 public class CollectionGraphSuite extends AbstractGraphSuite {
 
 	@BeforeClass

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/CollectionGraphTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/CollectionGraphTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/CollectionGraphTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/CollectionGraphTest.java Sat Sep  7 18:58:59 2013
@@ -30,7 +30,7 @@ import com.hp.hpl.jena.testing_framework
 public class CollectionGraphTest extends AbstractGraphTest {
 
 	private GraphProducerInterface graphProducer = new GraphProducer();
-	
+
 	@Override
 	public GraphProducerInterface getGraphProducer() {
 		return graphProducer;

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphMakerTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphMakerTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphMakerTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphMakerTest.java Sat Sep  7 18:58:59 2013
@@ -42,9 +42,9 @@ public class FileGraphMakerTest extends 
 
 	@Override
 	public GraphMaker getGraphMaker() {
-			String scratch = FileUtils.getScratchDirectory(
-					"jena-test-FileGraphMaker").getPath();
-			return new FileGraphMaker(scratch, true);	
+		String scratch = FileUtils.getScratchDirectory(
+				"jena-test-FileGraphMaker").getPath();
+		return new FileGraphMaker(scratch, true);
 	}
 
 	@Test

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphSuite.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphSuite.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphSuite.java Sat Sep  7 18:58:59 2013
@@ -25,7 +25,6 @@ import java.util.List;
 
 import static org.junit.Assert.*;
 
-import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -34,10 +33,8 @@ import org.junit.runners.Parameterized.P
 
 import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
 
-import com.hp.hpl.jena.graph.AbstractGraphSuite;
 import com.hp.hpl.jena.graph.Graph;
 import com.hp.hpl.jena.graph.GraphUtil;
-import com.hp.hpl.jena.graph.MemGraphSuite.GraphProducer;
 import com.hp.hpl.jena.graph.impl.FileGraph;
 import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
@@ -50,13 +47,12 @@ import com.hp.hpl.jena.util.FileUtils;
  * Test FileGraph by seeing if we can make some file graphs and then read them
  * back.
  */
-@RunWith( Suite.class )
-@Suite.SuiteClasses({ 
-		FileGraphSuite.TestNames.class, FileGraphSuite.FileNameTests.class,
-		FileGraphSuite.FileNameTransactionTests.class 
-	})
-public class FileGraphSuite  {
-	
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ FileGraphSuite.TestNames.class,
+		FileGraphSuite.FileNameTests.class,
+		FileGraphSuite.FileNameTransactionTests.class })
+public class FileGraphSuite {
+
 	public static class GraphProducer extends AbstractGraphProducer {
 		private String suffix = ".ttl";
 		private String prefix = "tfg";
@@ -85,7 +81,7 @@ public class FileGraphSuite  {
 			foo.deleteOnExit();
 			return new FileGraph(foo, true, strict);
 		}
-		
+
 		final public FileGraph newGraph(FileGraph.NotifyOnClose notifyOnClose) {
 			File foo = FileUtils.tempFileName(prefix, suffix);
 			foo.deleteOnExit();
@@ -93,7 +89,7 @@ public class FileGraphSuite  {
 			graphList.add(retval);
 			return retval;
 		}
-		
+
 	}
 
 	/**
@@ -105,12 +101,12 @@ public class FileGraphSuite  {
 	@RunWith(Parameterized.class)
 	public static class TestNames extends AbstractGraphProducerUser {
 		private GraphProducer graphProducer = new GraphProducer();
-		
+
 		@Override
 		public GraphProducerInterface getGraphProducer() {
 			return graphProducer;
 		}
-		
+
 		// TODO want a wider variety of cases, now we've discovered how to
 		// abstract.
 		@Parameters(name = "TestNames: content '{'{0}'}' prefix {1} suffix {2}")
@@ -130,8 +126,8 @@ public class FileGraphSuite  {
 
 		public TestNames(String content, String prefix, String suffix) {
 			this.content = content;
-			((GraphProducer) graphProducer).setPrefix(prefix);
-			((GraphProducer) graphProducer).setSuffix(suffix);
+			graphProducer.setPrefix(prefix);
+			graphProducer.setSuffix(suffix);
 		}
 
 		@Test
@@ -145,12 +141,11 @@ public class FileGraphSuite  {
 			g2.close();
 		}
 
-		
 	}
 
 	public static class FileNameTests extends AbstractGraphProducerUser {
 		private GraphProducer graphProducer = new GraphProducer();
-		
+
 		@Override
 		public GraphProducerInterface getGraphProducer() {
 			return graphProducer;
@@ -184,15 +179,16 @@ public class FileGraphSuite  {
 		}
 	}
 
-	public static class FileNameTransactionTests extends AbstractGraphProducerUser {
-		
+	public static class FileNameTransactionTests extends
+			AbstractGraphProducerUser {
+
 		private GraphProducer graphProducer = new GraphProducer();
-		
+
 		@Override
 		public GraphProducerInterface getGraphProducer() {
 			return graphProducer;
 		}
-	
+
 		@Test
 		public void testTransactionCommit() {
 			Graph initial = graphWith(graphProducer.newGraph(),
@@ -244,8 +240,8 @@ public class FileGraphSuite  {
 					history.add(f);
 				}
 			};
-			((GraphProducer) graphProducer).setSuffix(".nt");
-			FileGraph g = ((GraphProducer) graphProducer).newGraph(n);
+			graphProducer.setSuffix(".nt");
+			FileGraph g = graphProducer.newGraph(n);
 			assertEquals(new ArrayList<File>(), history);
 			g.close();
 			assertEquals(oneElementList(g.name), history);

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphSuite2.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphSuite2.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphSuite2.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphSuite2.java Sat Sep  7 18:58:59 2013
@@ -19,46 +19,27 @@
 package com.hp.hpl.jena.graph.impl;
 
 import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.*;
-
 import org.junit.BeforeClass;
-import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
 import org.junit.runners.Suite;
-import org.junit.runners.Parameterized.Parameters;
-
-import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
-
 import com.hp.hpl.jena.graph.AbstractGraphSuite;
 import com.hp.hpl.jena.graph.Graph;
-import com.hp.hpl.jena.graph.GraphUtil;
-import com.hp.hpl.jena.graph.MemGraphSuite.GraphProducer;
 import com.hp.hpl.jena.graph.impl.FileGraph;
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.ModelFactory;
-import com.hp.hpl.jena.sparql.graph.GraphFactory;
 import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
-import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
 import com.hp.hpl.jena.util.FileUtils;
 
 /**
  * Test FileGraph by seeing if we can make some file graphs and then read them
  * back.
  */
-
-public class FileGraphSuite2  extends AbstractGraphSuite {
+@RunWith(Suite.class)
+public class FileGraphSuite2 extends AbstractGraphSuite {
 
 	@BeforeClass
 	public static void beforeClass() {
 		setGraphProducer(new GraphProducer());
 	}
 
-
 	public static class GraphProducer extends AbstractGraphProducer {
 		private String suffix = ".ttl";
 		private String prefix = "tfg";
@@ -87,7 +68,7 @@ public class FileGraphSuite2  extends Ab
 			foo.deleteOnExit();
 			return new FileGraph(foo, true, strict);
 		}
-		
+
 		final public FileGraph newGraph(FileGraph.NotifyOnClose notifyOnClose) {
 			File foo = FileUtils.tempFileName(prefix, suffix);
 			foo.deleteOnExit();
@@ -95,7 +76,7 @@ public class FileGraphSuite2  extends Ab
 			graphList.add(retval);
 			return retval;
 		}
-		
+
 	}
 
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphTest.java Sat Sep  7 18:58:59 2013
@@ -18,22 +18,8 @@
 
 package com.hp.hpl.jena.graph.impl;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestSuite;
-
-import com.hp.hpl.jena.graph.AbstractGraphSuite;
 import com.hp.hpl.jena.graph.AbstractGraphTest;
-import com.hp.hpl.jena.graph.Graph;
-import com.hp.hpl.jena.graph.GraphUtil;
-import com.hp.hpl.jena.graph.MemGraphSuite;
-import com.hp.hpl.jena.graph.impl.FileGraph;
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.ModelFactory;
 import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
-import com.hp.hpl.jena.util.FileUtils;
 
 /**
  * Test FileGraph by seeing if we can make some file graphs and then read them
@@ -48,148 +34,147 @@ public class FileGraphTest extends Abstr
 	public GraphProducerInterface getGraphProducer() {
 		return graphProducer;
 	}
-	
-
-//	
-//	// TODO want a wider variety of cases, now we've discovered how to abstract.
-//	public static TestSuite suite() {
-//		TestSuite result = new TestSuite(FileGraphTestSuite.class);
-//		result.addTest(new Case("x /R y", "xxxA", ".rdf"));
-//		result.addTest(new Case("x /R y", "xxxB", ".n3"));
-//		result.addTest(new Case("x /R y", "xxxC", ".nt"));
-//		result.addTest(new Case("x /R y; p /R q", "xxxD", ".rdf"));
-//		result.addTest(new Case("x /R y; p /R q", "xxxE", ".n3"));
-//		result.addTest(new Case("x /R y; p /R q", "xxxF", ".nt"));
-//		result.addTest(new Case("http://domain/S ftp:ftp/P O", "xxxG", ".rdf"));
-//		result.addTest(new Case("http://domain/S ftp:ftp/P O", "xxxH", ".nt"));
-//		result.addTest(new Case("http://domain/S ftp:ftp/P O", "xxxI", ".n3"));
-//		return result;
-//	}
-//
-//	public void testPlausibleGraphname() {
-//		assertTrue(FileGraph.isPlausibleGraphName("agnessi.rdf"));
-//		assertTrue(FileGraph.isPlausibleGraphName("parabola.nt"));
-//		assertTrue(FileGraph.isPlausibleGraphName("hyperbola.n3"));
-//		assertTrue(FileGraph.isPlausibleGraphName("chris.dollin.n3"));
-//		assertTrue(FileGraph.isPlausibleGraphName("hedgehog.spine.end.rdf"));
-//	}
-//
-//	public void testisPlausibleUppercaseGraphname() {
-//		assertTrue(FileGraph.isPlausibleGraphName("LOUDER.RDF"));
-//		assertTrue(FileGraph.isPlausibleGraphName("BRIDGE.NT"));
-//		assertTrue(FileGraph.isPlausibleGraphName("NOTN2.N3"));
-//		assertTrue(FileGraph.isPlausibleGraphName("chris.dollin.N3"));
-//		assertTrue(FileGraph.isPlausibleGraphName("hedgehog.spine.end.RDF"));
-//	}
-//
-//	public void testImPlausibleGraphName() {
-//		assertFalse(FileGraph.isPlausibleGraphName("undecorated"));
-//		assertFalse(FileGraph.isPlausibleGraphName("danger.exe"));
-//		assertFalse(FileGraph.isPlausibleGraphName("pretty.jpg"));
-//		assertFalse(FileGraph.isPlausibleGraphName("FileGraph.java"));
-//		assertFalse(FileGraph.isPlausibleGraphName("infix.rdf.c"));
-//	}
-//
-//	public void testTransactionCommit() {
-//		Graph initial = graphWithTxn("initial hasValue 42; also hasURI hello");
-//		Graph extra = graphWithTxn("extra hasValue 17; also hasURI world");
-//		File foo = FileUtils.tempFileName("fileGraph", ".nt");
-//
-//		Graph g = new FileGraph(foo, true, true);
-//		GraphUtil.addInto(g, initial);
-//		g.getTransactionHandler().begin();
-//		GraphUtil.addInto(g, extra);
-//		g.getTransactionHandler().commit();
-//		Graph union = graphWithTxn("");
-//		GraphUtil.addInto(union, initial);
-//		GraphUtil.addInto(union, extra);
-//		assertIsomorphic(union, g);
-//		Model inFile = ModelFactory.createDefaultModel();
-//		inFile.read("file:///" + foo, "N-TRIPLES");
-//		assertIsomorphic(union, inFile.getGraph());
-//	}
-//
-//	public void testTransactionAbort() {
-//		Graph initial = graphWithTxn("initial hasValue 42; also hasURI hello");
-//		Graph extra = graphWithTxn("extra hasValue 17; also hasURI world");
-//		File foo = FileUtils.tempFileName("fileGraph", ".n3");
-//		Graph g = new FileGraph(foo, true, true);
-//		GraphUtil.addInto(g, initial);
-//		g.getTransactionHandler().begin();
-//		GraphUtil.addInto(g, extra);
-//		g.getTransactionHandler().abort();
-//		assertIsomorphic(initial, g);
-//	}
-//
-//	public void testTransactionCommitThenAbort() {
-//		Graph initial = graphWithTxn("A pings B; B pings C");
-//		Graph extra = graphWithTxn("C pingedBy B; fileGraph rdf:type Graph");
-//		File foo = FileUtils.tempFileName("fileGraph", ".nt");
-//		Graph g = new FileGraph(foo, true, true);
-//		g.getTransactionHandler().begin();
-//		GraphUtil.addInto(g, initial);
-//		g.getTransactionHandler().commit();
-//		g.getTransactionHandler().begin();
-//		GraphUtil.addInto(g, extra);
-//		g.getTransactionHandler().abort();
-//		assertIsomorphic(initial, g);
-//		Model inFile = ModelFactory.createDefaultModel();
-//		inFile.read("file:///" + foo, "N-TRIPLES");
-//		assertIsomorphic(initial, inFile.getGraph());
-//	}
-//
-//	public void testClosingNotifys() {
-//		final List<File> history = new ArrayList<File>();
-//		FileGraph.NotifyOnClose n = new FileGraph.NotifyOnClose() {
-//			@Override
-//			public void notifyClosed(File f) {
-//				history.add(f);
-//			}
-//		};
-//		File file = FileUtils.tempFileName("fileGraph", ".nt");
-//		Graph g = new FileGraph(n, file, true, true);
-//		assertEquals(new ArrayList<File>(), history);
-//		g.close();
-//		assertEquals(oneElementList(file), history);
-//	}
-//
-//	protected List<Object> oneElementList(Object x) {
-//		List<Object> result = new ArrayList<Object>();
-//		result.add(x);
-//		return result;
-//	}
-//
-//	/**
-//	 * Test that the graph encoded as the test-string content can be written out
-//	 * to a temporary file generated from the prefix and suffix, and then read
-//	 * back correctly. The temporary files are marked as delete-on-exit to try
-//	 * and avoid cluttering the user's filespace ...
-//	 */
-//	private static class Case extends FileGraphTestSuite {
-//		String content;
-//		String prefix;
-//		String suffix;
-//
-//		Case(String content, String prefix, String suffix) {
-//			super("Case: " + content + " in " + prefix + "*" + suffix);
-//			this.content = content;
-//			this.prefix = prefix;
-//			this.suffix = suffix;
-//		}
-//
-//		@Override
-//		public void runTest() {
-//			File foo = FileUtils.tempFileName(prefix, suffix);
-//			Graph original = graphWithTxn(content);
-//			Graph g = new FileGraph(foo, true, true);
-//			GraphUtil.addInto(g, original);
-//			g.close();
-//			Graph g2 = new FileGraph(foo, false, true);
-//			assertIsomorphic(original, g2);
-//			g2.close();
-//		}
-//	}
 
-	
+	//
+	// // TODO want a wider variety of cases, now we've discovered how to
+	// abstract.
+	// public static TestSuite suite() {
+	// TestSuite result = new TestSuite(FileGraphTestSuite.class);
+	// result.addTest(new Case("x /R y", "xxxA", ".rdf"));
+	// result.addTest(new Case("x /R y", "xxxB", ".n3"));
+	// result.addTest(new Case("x /R y", "xxxC", ".nt"));
+	// result.addTest(new Case("x /R y; p /R q", "xxxD", ".rdf"));
+	// result.addTest(new Case("x /R y; p /R q", "xxxE", ".n3"));
+	// result.addTest(new Case("x /R y; p /R q", "xxxF", ".nt"));
+	// result.addTest(new Case("http://domain/S ftp:ftp/P O", "xxxG", ".rdf"));
+	// result.addTest(new Case("http://domain/S ftp:ftp/P O", "xxxH", ".nt"));
+	// result.addTest(new Case("http://domain/S ftp:ftp/P O", "xxxI", ".n3"));
+	// return result;
+	// }
+	//
+	// public void testPlausibleGraphname() {
+	// assertTrue(FileGraph.isPlausibleGraphName("agnessi.rdf"));
+	// assertTrue(FileGraph.isPlausibleGraphName("parabola.nt"));
+	// assertTrue(FileGraph.isPlausibleGraphName("hyperbola.n3"));
+	// assertTrue(FileGraph.isPlausibleGraphName("chris.dollin.n3"));
+	// assertTrue(FileGraph.isPlausibleGraphName("hedgehog.spine.end.rdf"));
+	// }
+	//
+	// public void testisPlausibleUppercaseGraphname() {
+	// assertTrue(FileGraph.isPlausibleGraphName("LOUDER.RDF"));
+	// assertTrue(FileGraph.isPlausibleGraphName("BRIDGE.NT"));
+	// assertTrue(FileGraph.isPlausibleGraphName("NOTN2.N3"));
+	// assertTrue(FileGraph.isPlausibleGraphName("chris.dollin.N3"));
+	// assertTrue(FileGraph.isPlausibleGraphName("hedgehog.spine.end.RDF"));
+	// }
+	//
+	// public void testImPlausibleGraphName() {
+	// assertFalse(FileGraph.isPlausibleGraphName("undecorated"));
+	// assertFalse(FileGraph.isPlausibleGraphName("danger.exe"));
+	// assertFalse(FileGraph.isPlausibleGraphName("pretty.jpg"));
+	// assertFalse(FileGraph.isPlausibleGraphName("FileGraph.java"));
+	// assertFalse(FileGraph.isPlausibleGraphName("infix.rdf.c"));
+	// }
+	//
+	// public void testTransactionCommit() {
+	// Graph initial = graphWithTxn("initial hasValue 42; also hasURI hello");
+	// Graph extra = graphWithTxn("extra hasValue 17; also hasURI world");
+	// File foo = FileUtils.tempFileName("fileGraph", ".nt");
+	//
+	// Graph g = new FileGraph(foo, true, true);
+	// GraphUtil.addInto(g, initial);
+	// g.getTransactionHandler().begin();
+	// GraphUtil.addInto(g, extra);
+	// g.getTransactionHandler().commit();
+	// Graph union = graphWithTxn("");
+	// GraphUtil.addInto(union, initial);
+	// GraphUtil.addInto(union, extra);
+	// assertIsomorphic(union, g);
+	// Model inFile = ModelFactory.createDefaultModel();
+	// inFile.read("file:///" + foo, "N-TRIPLES");
+	// assertIsomorphic(union, inFile.getGraph());
+	// }
+	//
+	// public void testTransactionAbort() {
+	// Graph initial = graphWithTxn("initial hasValue 42; also hasURI hello");
+	// Graph extra = graphWithTxn("extra hasValue 17; also hasURI world");
+	// File foo = FileUtils.tempFileName("fileGraph", ".n3");
+	// Graph g = new FileGraph(foo, true, true);
+	// GraphUtil.addInto(g, initial);
+	// g.getTransactionHandler().begin();
+	// GraphUtil.addInto(g, extra);
+	// g.getTransactionHandler().abort();
+	// assertIsomorphic(initial, g);
+	// }
+	//
+	// public void testTransactionCommitThenAbort() {
+	// Graph initial = graphWithTxn("A pings B; B pings C");
+	// Graph extra = graphWithTxn("C pingedBy B; fileGraph rdf:type Graph");
+	// File foo = FileUtils.tempFileName("fileGraph", ".nt");
+	// Graph g = new FileGraph(foo, true, true);
+	// g.getTransactionHandler().begin();
+	// GraphUtil.addInto(g, initial);
+	// g.getTransactionHandler().commit();
+	// g.getTransactionHandler().begin();
+	// GraphUtil.addInto(g, extra);
+	// g.getTransactionHandler().abort();
+	// assertIsomorphic(initial, g);
+	// Model inFile = ModelFactory.createDefaultModel();
+	// inFile.read("file:///" + foo, "N-TRIPLES");
+	// assertIsomorphic(initial, inFile.getGraph());
+	// }
+	//
+	// public void testClosingNotifys() {
+	// final List<File> history = new ArrayList<File>();
+	// FileGraph.NotifyOnClose n = new FileGraph.NotifyOnClose() {
+	// @Override
+	// public void notifyClosed(File f) {
+	// history.add(f);
+	// }
+	// };
+	// File file = FileUtils.tempFileName("fileGraph", ".nt");
+	// Graph g = new FileGraph(n, file, true, true);
+	// assertEquals(new ArrayList<File>(), history);
+	// g.close();
+	// assertEquals(oneElementList(file), history);
+	// }
+	//
+	// protected List<Object> oneElementList(Object x) {
+	// List<Object> result = new ArrayList<Object>();
+	// result.add(x);
+	// return result;
+	// }
+	//
+	// /**
+	// * Test that the graph encoded as the test-string content can be written
+	// out
+	// * to a temporary file generated from the prefix and suffix, and then read
+	// * back correctly. The temporary files are marked as delete-on-exit to try
+	// * and avoid cluttering the user's filespace ...
+	// */
+	// private static class Case extends FileGraphTestSuite {
+	// String content;
+	// String prefix;
+	// String suffix;
+	//
+	// Case(String content, String prefix, String suffix) {
+	// super("Case: " + content + " in " + prefix + "*" + suffix);
+	// this.content = content;
+	// this.prefix = prefix;
+	// this.suffix = suffix;
+	// }
+	//
+	// @Override
+	// public void runTest() {
+	// File foo = FileUtils.tempFileName(prefix, suffix);
+	// Graph original = graphWithTxn(content);
+	// Graph g = new FileGraph(foo, true, true);
+	// GraphUtil.addInto(g, original);
+	// g.close();
+	// Graph g2 = new FileGraph(foo, false, true);
+	// assertIsomorphic(original, g2);
+	// g2.close();
+	// }
+	// }
 
 }