Author: claude
Date: Sat Sep  7 21:07:47 2013
New Revision: 1520810

URL: http://svn.apache.org/r1520810
Log:
First completely working test suite
Added documentation.

Added:
    
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/package-info.java
   (with props)
    jena/Experimental/new-test/src/test/resources/ontology/
    jena/Experimental/new-test/src/test/resources/ontology/README_LICENSE
    jena/Experimental/new-test/src/test/resources/ontology/list0.rdf
Modified:
    
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractEventManagerTest.java
    
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphSuite.java
    
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphMatchWithInference.java
    jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestNode.java
    
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceSuite.java
    
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceTest.java
    
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DisjointUnionTest.java
    
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphSuite.java
    
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphSuite2.java
    
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphEventManagerProducerInterface.java
    
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerInterface.java
    
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerUserInterface.java
    
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphTestUtils.java

Modified: 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractEventManagerTest.java
URL: 
http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractEventManagerTest.java?rev=1520810&r1=1520809&r2=1520810&view=diff
==============================================================================
--- 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractEventManagerTest.java
 (original)
+++ 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractEventManagerTest.java
 Sat Sep  7 21:07:47 2013
@@ -33,9 +33,11 @@ import com.hp.hpl.jena.testing_framework
 import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
 
 /**
- * AbstractTestGraph provides a bunch of basic tests for something that 
purports
- * to be a Graph. The abstract method getGraph must be overridden in subclasses
- * to deliver a Graph of interest.
+ * An abstract test that tests EventManager implementations to ensure they 
comply with
+ * the EventManager contract.
+ * 
+ *  Subclasses of this class must implement the getEventManagerProducer() 
method to create
+ *  a new instance of the EventManager for testing.
  */
 
 public abstract class AbstractEventManagerTest {
@@ -44,7 +46,9 @@ public abstract class AbstractEventManag
 
        protected static final Triple[] tripleArray = tripleArray("S P O; A R 
B; X Q Y");
 
+       // the grah that is used as the source of the events.
        private Graph mockGraph;
+       // The event manager we are working with.
        private GraphEventManager gem;
 
        @Before
@@ -54,6 +58,9 @@ public abstract class AbstractEventManag
                L = new RecordingListener();
        }
 
+       /**
+        * Test that when a listener is registered the same EventManager is 
returned.
+        */
        @Test
        public void testEventRegister() {
                assertSame(gem, gem.register(new RecordingListener()));
@@ -71,8 +78,15 @@ public abstract class AbstractEventManag
         * Handy triple for test purposes.
         */
        protected Triple SPO = NodeCreateUtils.createTriple("S P O");
+       
+       /**
+        * The RecordingListener that reports all the events sent from the 
EventManager.
+        */
        protected RecordingListener L;
 
+       /**
+        * Test that adding a triple is reported.
+        */
        @Test
        public void testAddTriple() {
                gem.register(L);
@@ -80,6 +94,9 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] { "add", mockGraph, SPO });
        }
 
+       /**
+        * Test that deleting a triple is reported.
+        */
        @Test
        public void testDeleteTriple() {
                gem.register(L);
@@ -87,6 +104,9 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] { "delete", mockGraph, SPO });
        }
 
+       /**
+        * Test that when 2 listeners are added both receive events.
+        */
        @Test
        public void testTwoListeners() {
                RecordingListener L1 = new RecordingListener();
@@ -97,6 +117,10 @@ public abstract class AbstractEventManag
                L1.assertHas(new Object[] { "add", mockGraph, SPO });
        }
 
+       /**
+        * Test that unregistering a listener after registering it results in 
it not 
+        * receiving messages.
+        */
        @Test
        public void testUnregisterWorks() {
                gem.register(L).unregister(L);
@@ -104,6 +128,10 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] {});
        }
 
+       /**
+        * Test that registering a listener twice results in the listener 
receiving the
+        * events twice.
+        */
        @Test
        public void testRegisterTwice() {
                gem.register(L).register(L);
@@ -111,6 +139,10 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] { "add", mockGraph, SPO, "add", 
mockGraph, SPO });
        }
 
+       /**
+        * Test that registering a listener twice and unregistering it once 
will result in
+        * the listener receiving each event one time.
+        */
        @Test
        public void testUnregisterOnce() {
                gem.register(L).register(L).unregister(L);
@@ -118,6 +150,9 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] { "delete", mockGraph, SPO });
        }
 
+       /**
+        * Test that adding an array is reported as adding an array.
+        */
        @Test
        public void testAddArray() {
                gem.register(L);
@@ -125,6 +160,9 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] { "add[]", mockGraph, tripleArray });
        }
 
+       /**
+        * Test that adding a list is reported as adding a list
+        */
        @Test
        public void testAddList() {
                gem.register(L);
@@ -133,6 +171,9 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] { "addList", mockGraph, elems });
        }
 
+       /**
+        * Test that deleting an array is reported as deleting an array.
+        */
        @Test
        public void testDeleteArray() {
                gem.register(L);
@@ -140,6 +181,9 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] { "delete[]", mockGraph, tripleArray 
});
        }
 
+       /**
+        * Test that deleting a list is reported as deleting a list.
+        */
        @Test
        public void testDeleteList() {
                gem.register(L);
@@ -148,6 +192,9 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] { "deleteList", mockGraph, elems });
        }
 
+       /**
+        * Test that adding a list as an iterator is reported as an add 
iterator.
+        */
        @Test
        public void testAddListAsIterator() {
                gem.register(L);
@@ -156,6 +203,9 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] { "addIterator", mockGraph, elems });
        }
 
+       /**
+        * Test that adding an iterator is reported as adding an iterator.
+        */
        @Test
        public void testAddIterator() {
                gem.register(L);
@@ -164,6 +214,9 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] { "addIterator", mockGraph, elems });
        }
 
+       /**
+        * Test that deleting an iterator is reported as a deleting an iterator.
+        */
        @Test
        public void testDeleteIterator() {
                gem.register(L);
@@ -172,6 +225,9 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] { "deleteIterator", mockGraph, elems 
});
        }
 
+       /**
+        * Test that deleting a list as an iterator is reported as deleting an 
iterator.
+        */
        @Test
        public void testDeleteListAsIterator() {
                gem.register(L);
@@ -180,6 +236,9 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] { "deleteIterator", mockGraph, elems 
});
        }
 
+       /**
+        * Test that adding a graph is reported as adding a graph.
+        */
        @Test
        public void testAddGraph() {
                gem.register(L);
@@ -188,6 +247,9 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] { "addGraph", mockGraph, other });
        }
 
+       /**
+        * Test that deleting a graph is reported as deleting a graph.
+        */
        @Test
        public void testDeleteGraph() {
                gem.register(L);
@@ -196,6 +258,9 @@ public abstract class AbstractEventManag
                L.assertHas(new Object[] { "deleteGraph", mockGraph, other });
        }
 
+       /**
+        * Test that sending a general event is reported as an event and the 
value is saved.
+        */
        @Test
        public void testGeneralEvent() {
                gem.register(L);

Modified: 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphSuite.java
URL: 
http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphSuite.java?rev=1520810&r1=1520809&r2=1520810&view=diff
==============================================================================
--- 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphSuite.java
 (original)
+++ 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphSuite.java
 Sat Sep  7 21:07:47 2013
@@ -21,23 +21,12 @@ import static com.hp.hpl.jena.testing_fr
 import static com.hp.hpl.jena.testing_framework.GraphTestUtils.triple;
 import static org.junit.Assert.assertTrue;
 
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runners.Suite;
 import com.hp.hpl.jena.testing_framework.GraphEventManagerProducerInterface;
 import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
 import com.hp.hpl.jena.util.iterator.ExtendedIterator;
 
-/*
- TestSuite result = new TestSuite( WrappedGraphTest.class );
- result.addTest( suite( MetaTestGraph.class, GraphMem.class ) );
- result.addTest( suite( TestReifier.class, GraphMem.class ) );
- result.addTest( suite( MetaTestGraph.class, WrappedGraphMem.class ) );
- result.addTest( suite( TestReifier.class, WrappedGraphMem.class ) );
- result.addTest( TestGraphListener.suite() );
- result.addTestSuite( TestRegisterGraphListener.class );
- */
-
 @Suite.SuiteClasses({ AbstractGraphSuite.GraphTest.class,
                AbstractGraphSuite.ReifierTest.class,
                AbstractGraphSuite.FindLiterals.class,
@@ -47,7 +36,6 @@ import com.hp.hpl.jena.util.iterator.Ext
                AbstractGraphSuite.RegisterListenerTest.class,
                AbstractGraphSuite.ListenerTest.class,
                AbstractGraphSuite.PrefixMappingTest.class })
-@Ignore
 public abstract class AbstractGraphSuite {
 
        static protected GraphProducerInterface graphProducer;

Modified: 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphMatchWithInference.java
URL: 
http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphMatchWithInference.java?rev=1520810&r1=1520809&r2=1520810&view=diff
==============================================================================
--- 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphMatchWithInference.java
 (original)
+++ 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphMatchWithInference.java
 Sat Sep  7 21:07:47 2013
@@ -18,26 +18,22 @@
 
 package com.hp.hpl.jena.graph;
 
-import com.hp.hpl.jena.rdf.model.*;
-
-import junit.framework.*;
-
 /**
  * Test that an inferred graph and an identical concrete graph compare as 
equal.
  */
 // FIXME move this to model testing.
-public class TestGraphMatchWithInference {
-
-       @Test
-       public void testInferedIsomorphic() {
-               Model mrdfs = ModelFactory.createRDFSModel(ModelFactory
-                               .createDefaultModel());
-               Model concrete = ModelFactory.createDefaultModel();
-               concrete.add(mrdfs);
-
-               assertIsomorphic(concrete.getGraph(), mrdfs.getGraph());
-
-               assertIsomorphic(mrdfs.getGraph(), concrete.getGraph());
-       }
-
-}
+//public class TestGraphMatchWithInference {
+//
+//     @Test
+//     public void testInferedIsomorphic() {
+//             Model mrdfs = ModelFactory.createRDFSModel(ModelFactory
+//                             .createDefaultModel());
+//             Model concrete = ModelFactory.createDefaultModel();
+//             concrete.add(mrdfs);
+//
+//             assertIsomorphic(concrete.getGraph(), mrdfs.getGraph());
+//
+//             assertIsomorphic(mrdfs.getGraph(), concrete.getGraph());
+//     }
+//
+//}

Modified: 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestNode.java
URL: 
http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestNode.java?rev=1520810&r1=1520809&r2=1520810&view=diff
==============================================================================
--- 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestNode.java 
(original)
+++ 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestNode.java 
Sat Sep  7 21:07:47 2013
@@ -32,7 +32,6 @@ import com.hp.hpl.jena.shared.JenaExcept
 import com.hp.hpl.jena.shared.PrefixMapping;
 import com.hp.hpl.jena.testing_framework.GraphTestUtils;
 import com.hp.hpl.jena.testing_framework.TestUtils;
-import com.hp.hpl.jena.vocabulary.DC;
 import com.hp.hpl.jena.vocabulary.DC_11;
 import com.hp.hpl.jena.vocabulary.OWL;
 import com.hp.hpl.jena.vocabulary.RSS;

Modified: 
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=1520810&r1=1520809&r2=1520810&view=diff
==============================================================================
--- 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceSuite.java
 (original)
+++ 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceSuite.java
 Sat Sep  7 21:07:47 2013
@@ -17,7 +17,6 @@
  */
 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;
@@ -35,11 +34,7 @@ public class DifferenceSuite extends Abs
                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);
+                               return new 
Difference(GraphFactory.createGraphMem(), GraphFactory.createGraphMem());
                        }
 
                });

Modified: 
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=1520810&r1=1520809&r2=1520810&view=diff
==============================================================================
--- 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceTest.java
 (original)
+++ 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceTest.java
 Sat Sep  7 21:07:47 2013
@@ -34,9 +34,11 @@ public class DifferenceTest extends Abst
        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);
+                       //Graph g1 = graphWith(GraphFactory.createGraphMem(), 
"x R y; p R q");
+                       //Graph g2 = graphWith(GraphFactory.createGraphMem(), 
"r A s; x R y");
+                       //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(GraphFactory.createGraphMem(), 
GraphFactory.createGraphMem());
                }
 
        };

Modified: 
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=1520810&r1=1520809&r2=1520810&view=diff
==============================================================================
--- 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DisjointUnionTest.java
 (original)
+++ 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DisjointUnionTest.java
 Sat Sep  7 21:07:47 2013
@@ -39,7 +39,6 @@ public class DisjointUnionTest extends A
                        return new DisjointUnion(GraphFactory.createGraphMem(),
                                        GraphFactory.createGraphMem());
                }
-
        };
 
        @Override
@@ -65,7 +64,6 @@ public class DisjointUnionTest extends A
                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);

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=1520810&r1=1520809&r2=1520810&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 21:07:47 2013
@@ -54,7 +54,7 @@ import com.hp.hpl.jena.util.FileUtils;
 public class FileGraphSuite {
 
        public static class GraphProducer extends AbstractGraphProducer {
-               private String suffix = ".ttl";
+               private String suffix = ".nt";
                private String prefix = "tfg";
                private boolean strict = true;
 

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=1520810&r1=1520809&r2=1520810&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 21:07:47 2013
@@ -18,15 +18,10 @@
 
 package com.hp.hpl.jena.graph.impl;
 
-import java.io.File;
 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.graph.impl.FileGraph;
-import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
-import com.hp.hpl.jena.util.FileUtils;
 
 /**
  * Test FileGraph by seeing if we can make some file graphs and then read them
@@ -37,46 +32,7 @@ public class FileGraphSuite2 extends Abs
 
        @BeforeClass
        public static void beforeClass() {
-               setGraphProducer(new GraphProducer());
-       }
-
-       public static class GraphProducer extends AbstractGraphProducer {
-               private String suffix = ".ttl";
-               private String prefix = "tfg";
-               private boolean strict = true;
-
-               public void setSuffix(String suffix) {
-                       this.suffix = suffix;
-               }
-
-               public void setPrefix(String prefix) {
-                       this.prefix = prefix;
-               }
-
-               public void setStrict(boolean strict) {
-                       this.strict = strict;
-               }
-
-               @Override
-               protected void afterClose(Graph g) {
-                       ((FileGraph) g).name.delete();
-               }
-
-               @Override
-               protected Graph createNewGraph() {
-                       File foo = FileUtils.tempFileName(prefix, suffix);
-                       foo.deleteOnExit();
-                       return new FileGraph(foo, true, strict);
-               }
-
-               final public FileGraph newGraph(FileGraph.NotifyOnClose 
notifyOnClose) {
-                       File foo = FileUtils.tempFileName(prefix, suffix);
-                       foo.deleteOnExit();
-                       FileGraph retval = new FileGraph(notifyOnClose, foo, 
true, strict);
-                       graphList.add(retval);
-                       return retval;
-               }
-
+               setGraphProducer(new FileGraphSuite.GraphProducer());
        }
 
 }

Modified: 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphEventManagerProducerInterface.java
URL: 
http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphEventManagerProducerInterface.java?rev=1520810&r1=1520809&r2=1520810&view=diff
==============================================================================
--- 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphEventManagerProducerInterface.java
 (original)
+++ 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphEventManagerProducerInterface.java
 Sat Sep  7 21:07:47 2013
@@ -20,16 +20,16 @@ package com.hp.hpl.jena.testing_framewor
 import com.hp.hpl.jena.graph.GraphEventManager;
 
 /**
- * Creates the graph for testing
+ * A producer for GraphEventManager testing.
  * 
  */
 public interface GraphEventManagerProducerInterface {
 
        /**
-        * Returns a TripleStore to take part in the test. Must be overridden 
in a
+        * Returns a GraphEventManager to take part in the test. Must be 
overridden in a
         * subclass.
         * 
-        * @return The TripleStore implementation to test.
+        * @return The GraphEventManager implementation to test.
         */
        public abstract GraphEventManager newEventManager();
 }

Modified: 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerInterface.java
URL: 
http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerInterface.java?rev=1520810&r1=1520809&r2=1520810&view=diff
==============================================================================
--- 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerInterface.java
 (original)
+++ 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerInterface.java
 Sat Sep  7 21:07:47 2013
@@ -20,8 +20,8 @@ package com.hp.hpl.jena.testing_framewor
 import com.hp.hpl.jena.graph.Graph;
 
 /**
- * Creates the graph for testing. Implementations should track the creation of
- * graphs created with newGraph and close them when clodeGraphs is called.
+ * Creates the graph for testing. Implementations must track the creation of
+ * graphs created with newGraph and close them when closeGraphs is called.
  * 
  */
 public interface GraphProducerInterface {

Modified: 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerUserInterface.java
URL: 
http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerUserInterface.java?rev=1520810&r1=1520809&r2=1520810&view=diff
==============================================================================
--- 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerUserInterface.java
 (original)
+++ 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphProducerUserInterface.java
 Sat Sep  7 21:07:47 2013
@@ -21,7 +21,7 @@ public interface GraphProducerUserInterf
        /**
         * The graph producer to use for the tests.
         * 
-        * @return
+        * @return The graph producer 
         */
        public GraphProducerInterface getGraphProducer();
 

Modified: 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphTestUtils.java
URL: 
http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphTestUtils.java?rev=1520810&r1=1520809&r2=1520810&view=diff
==============================================================================
--- 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphTestUtils.java
 (original)
+++ 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/GraphTestUtils.java
 Sat Sep  7 21:07:47 2013
@@ -19,7 +19,7 @@
 package com.hp.hpl.jena.testing_framework;
 
 /**
- An extension of JenaTestBase (which see) with Graph-specific methods.
+ * A set of static test helpers.  Generally included as a static.
  */
 
 import static org.junit.Assert.*;
@@ -185,6 +185,12 @@ public class GraphTestUtils extends Test
                return g;
        }
 
+       /**
+        * Like graphAdd but does it within a transaction if supported
+        * @param g The graph to add to
+        * @param s The string describing the graph
+        * @return The populated graph.
+        */
        public static Graph graphAddTxn(Graph g, String s) {
                txnBegin(g);
                StringTokenizer semis = new StringTokenizer(s, ";");
@@ -194,6 +200,12 @@ public class GraphTestUtils extends Test
                return g;
        }
 
+       /**
+        * Used to create a graph with values.
+        * @param g The newly created graph
+        * @param s The string representing the graph data.
+        * @return The populated graph
+        */
        public static Graph graphWith(Graph g, String s) {
                return graphAdd(g, s);
        }
@@ -455,21 +467,32 @@ public class GraphTestUtils extends Test
                }
        }
 
+       /**
+        * Begin a transaction on the graph if transactions are supported.
+        * @param g
+        */
        public static void txnBegin(Graph g) {
                if (g.getTransactionHandler().transactionsSupported()) {
                        g.getTransactionHandler().begin();
                }
        }
 
+       /**
+        *  Commit the transaction on the graph if transactions are supported.
+        * @param g
+        */
        public static void txnCommit(Graph g) {
                if (g.getTransactionHandler().transactionsSupported()) {
                        g.getTransactionHandler().commit();
                }
        }
-
+       /**
+        *  Rollback (abort) the transaction on the graph if transactions are 
supported.
+        * @param g
+        */
        public static void txnRollback(Graph g) {
                if (g.getTransactionHandler().transactionsSupported()) {
-                       g.getTransactionHandler().commit();
+                       g.getTransactionHandler().abort();
                }
        }
 }

Added: 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/package-info.java
URL: 
http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/package-info.java?rev=1520810&view=auto
==============================================================================
--- 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/package-info.java
 (added)
+++ 
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/package-info.java
 Sat Sep  7 21:07:47 2013
@@ -0,0 +1,109 @@
+/*
+    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;
+
+/**
+ * A set of classes providing support for testing.
+ * <p>
+ * Testing guidelines/suggestions.
+ * </p><p>
+ * Interface tests are built so that developers may test that implementations 
meet the contract
+ * set out in the interface and accompanying documentation.
+ * </p>
+ * <h4>Producers</h4>
+ * <p>
+ * The test and suites use an instance of the [INTERFACE]ProducerInterface to 
create an instance
+ * of the the Object being tested.   
+ * </p>
+ * <h4>Tests</h4>
+ * <p>
+ * Interface tests are noted as Abstract[INTERFACE]Test.  Implementations of 
[INTERFACE] should
+ * create a concrete implementation of Abstract[INTERFACE]Test with an 
[INTERFACE]Producer to create
+ * instances of the Object.  Passing the test indicates a compliance with the 
base interface 
+ * definition.
+ * </p><p>
+ * In general to implement a test requires a few lines of code as is noted in 
the example below
+ * where the new Foo graph implementation is being tested.</p>
+ * <pre><code>
+ * public class FooGraphTest extends AbstractGraphTest {
+ * 
+ *   // the graph producer to use while running
+ *   GraphProducerInterface graphProducer = new FooGraphTest.GraphProducer();
+ * 
+ *   @Override
+ *   protected GraphProducerInterface getGraphProducer() {
+ *     return graphProducer;
+ *   }
+ * 
+ *   // the implementation of the graph producer.
+ *   public static class GraphProducer extends AbstractGraphProducer {
+ * 
+ *     @Override
+ *     protected Graph createNewGraph() {
+ *       return new FooGraph();
+ *     }
+ *   }
+ * }
+ * </code></pre>
+ * <h4>Suites</h4>
+ * <p>
+ * Test suites are named as Abstract[INTERFACE]Suite.  Suites contain several 
tests (see above)
+ * that exercise all of the tests for the components of the object under test. 
 For example the 
+ * graph suite includes tests for the graph itself, the reifier, finding 
literals, recursive 
+ * subgraph extraction, event manager, and transactions.  Running the suites 
is a bit more 
+ * complicated then running the tests.
+ * </p>
+ * Suites are created using the JUnit 4 <code>@RunWith(Suite.class)</code and 
+ * <code>@Suite.SuiteClasses({ })</code> annotations.  This has several 
effects that the developer 
+ * should know about:</p>
+ * <ul>
+ * <li>The suite class does not get instantiated during the run.</li>
+ * <li>The test class names must be known at coding time (not run time) as 
they are listed in the
+ * annotation.</li>
+ * <li>Configuration of the tests has to occur during the static 
initialization phase of class 
+ * loading.</li>
+ * </ul>
+ * <p>
+ * To meet these requirements the AbstractGraphSuite has a static variable 
that holds the instance
+ * of the GraphProducerInterface and a number of local static implementations 
of the Abstract tests
+ * that implement the "getGraphProducer()" method by returning the static 
instance.  The names of 
+ * the local graphs are then used in the @Suite.SuiteClasses annotation.  This 
makes creating an
+ * instance of the AbstractGraphSuite for a graph implementation fairly simple 
as is noted below.
+ * </p>
+ * <pre><code>
+ * public class FooGraphSuite extends AbstractGraphSuite {
+ *   @BeforeClass
+ *   public static void beforeClass() {
+ *     setGraphProducer(new GraphProducer());
+ *   }
+ *   
+ *   public static class GraphProducer extends AbstractGraphProducer {
+ *     @Override
+ *     protected Graph createNewGraph() {
+ *       return new FooGraph();
+ *     }
+ *   }
+ * }
+ * </code></pre>
+ * <p>
+ * <b>Note:</b> that the beforeClass() method is annotated with @BeforeClass.  
the @BeforeClass 
+ * causes it to be run once before any of the test methods in the class. This 
will set the static
+ * instance of the graph producer before the suite is run so that it is 
provided to the enclosed
+ * tests.
+ * </p> 
+ */

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

Added: jena/Experimental/new-test/src/test/resources/ontology/README_LICENSE
URL: 
http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/resources/ontology/README_LICENSE?rev=1520810&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/resources/ontology/README_LICENSE 
(added)
+++ jena/Experimental/new-test/src/test/resources/ontology/README_LICENSE Sat 
Sep  7 21:07:47 2013
@@ -0,0 +1,16 @@
+The following statement applied to all files in this directory unless 
otherwise noted:
+
+   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.

Added: jena/Experimental/new-test/src/test/resources/ontology/list0.rdf
URL: 
http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/resources/ontology/list0.rdf?rev=1520810&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/resources/ontology/list0.rdf (added)
+++ jena/Experimental/new-test/src/test/resources/ontology/list0.rdf Sat Sep  7 
21:07:47 2013
@@ -0,0 +1,20 @@
+<?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;"
+    xml:base    ="uri:urn:x-rdf:test"
+    xmlns       ="uri:urn:x-rdf:test#"
+>
+
+<rdf:Description rdf:ID="root">
+   <p rdf:parseType="Collection">
+   </p>
+</rdf:Description>
+
+</rdf:RDF>


Reply via email to