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 [6/6] - in
/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena: datatypes/xsd/
graph/ graph/compose/ graph/impl/ shared/ testing_framework/
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/LiteralLabelsTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/LiteralLabelsTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/LiteralLabelsTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/LiteralLabelsTest.java Sat Sep 7 18:58:59 2013
@@ -18,7 +18,6 @@
package com.hp.hpl.jena.graph.impl;
-
import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
import static org.junit.Assert.*;
@@ -29,99 +28,93 @@ import com.hp.hpl.jena.datatypes.RDFData
import com.hp.hpl.jena.graph.impl.LiteralLabel;
import com.hp.hpl.jena.graph.impl.LiteralLabelFactory;
+public class LiteralLabelsTest {
+ private void assertEq(LiteralLabel ll1, LiteralLabel ll2) {
+ assertEquivalent(ll1, ll2);
+ assertTrue(ll1.sameValueAs(ll2));
+ }
+
+ @Test
+ public void testBlankLanguageEquality() {
+ assertEq(LiteralLabelFactory.create("test", "", null),
+ LiteralLabelFactory.create("test", "", null));
+ }
+
+ @Test
+ public void testBase64BinaryEquality() {
+ assertEq(node("'0123'http://www.w3.org/2001/XMLSchema#base64Binary")
+ .getLiteral(),
+ node("'0123'http://www.w3.org/2001/XMLSchema#base64Binary")
+ .getLiteral());
+ }
+
+ @Test
+ public void testIllegalBase64BinaryEquality() {
+ assertEq(node("'illgeal'http://www.w3.org/2001/XMLSchema#base64Binary")
+ .getLiteral(),
+ node("'illgeal'http://www.w3.org/2001/XMLSchema#base64Binary")
+ .getLiteral());
+ }
+
+ @Test
+ public void testHexBinaryEquality() {
+ assertEq(node("'0123'http://www.w3.org/2001/XMLSchema#hexBinary")
+ .getLiteral(),
+ node("'0123'http://www.w3.org/2001/XMLSchema#hexBinary")
+ .getLiteral());
+ }
+
+ @Test
+ public void testIllegalHexBinaryEquality() {
+ assertEq(node("'illegal'http://www.w3.org/2001/XMLSchema#hexBinary")
+ .getLiteral(),
+ node("'illegal'http://www.w3.org/2001/XMLSchema#hexBinary")
+ .getLiteral());
+ }
+
+ @Test
+ public void testDatatypeIsEqualsNotCalledIfSecondOperandIsNotTyped() {
+ RDFDatatype d = new BaseDatatype("eh:/FakeDataType") {
+ @Override
+ public boolean isEqual(LiteralLabel ll1, LiteralLabel ll2) {
+ fail("RDFDatatype::isEquals should not be called if B has no datatype");
+ return false;
+ }
+ };
+ LiteralLabel ll1 = LiteralLabelFactory.create("17", "", d);
+ LiteralLabel ll2 = LiteralLabelFactory.create("17", "", null);
+ assertFalse(ll1.sameValueAs(ll2));
+ }
+
+ @Test
+ public void testStringEquality() {
+ assertEq(LiteralLabelFactory.create("xyz"),
+ LiteralLabelFactory.create("xyz"));
+ }
+
+ @Test
+ public void testDifferentCaseStringInequality() {
+ LiteralLabel ll1 = LiteralLabelFactory.create("xyz");
+ LiteralLabel ll2 = LiteralLabelFactory.create("XYZ");
+
+ assertFalse(ll1.equals(ll2));
+ assertFalse(ll1.sameValueAs(ll2));
+ }
+
+ @Test
+ public void testDifferentLanguageStringInequality() {
+ LiteralLabel ll1 = LiteralLabelFactory.create("xyz", "en-us");
+ LiteralLabel ll2 = LiteralLabelFactory.create("xyz", "en-uk");
+ assertFalse(ll1.equals(ll2));
+ assertFalse(ll1.sameValueAs(ll2));
+ }
+
+ @Test
+ public void testDifferentLanguageStringCaseInequality() {
+ LiteralLabel ll1 = LiteralLabelFactory.create("xyz", "en-UK");
+ LiteralLabel ll2 = LiteralLabelFactory.create("xyz", "en-uk");
+ assertFalse(ll1.equals(ll2));
+ assertTrue(ll1.sameValueAs(ll2));
+ }
-public class LiteralLabelsTest
-{
- private void assertEq( LiteralLabel ll1, LiteralLabel ll2)
- {
- assertEquivalent( ll1, ll2 );
- assertTrue(ll1.sameValueAs(ll2)) ;
- }
-
- @Test
- public void testBlankLanguageEquality()
- {
- assertEq( LiteralLabelFactory.create("test", "", null),
- LiteralLabelFactory.create("test", "", null)) ;
- }
-
- @Test
- public void testBase64BinaryEquality()
- {
- assertEq( node("'0123'http://www.w3.org/2001/XMLSchema#base64Binary").getLiteral() ,
- node("'0123'http://www.w3.org/2001/XMLSchema#base64Binary").getLiteral() );
- }
-
- @Test
- public void testIllegalBase64BinaryEquality()
- {
- assertEq( node("'illgeal'http://www.w3.org/2001/XMLSchema#base64Binary").getLiteral() ,
- node("'illgeal'http://www.w3.org/2001/XMLSchema#base64Binary").getLiteral() );
- }
-
- @Test
- public void testHexBinaryEquality()
- {
- assertEq( node("'0123'http://www.w3.org/2001/XMLSchema#hexBinary").getLiteral() ,
- node("'0123'http://www.w3.org/2001/XMLSchema#hexBinary").getLiteral() );
- }
-
- @Test
- public void testIllegalHexBinaryEquality()
- {
- assertEq( node("'illegal'http://www.w3.org/2001/XMLSchema#hexBinary").getLiteral() ,
- node("'illegal'http://www.w3.org/2001/XMLSchema#hexBinary").getLiteral() ) ;
- }
-
- @Test
- public void testDatatypeIsEqualsNotCalledIfSecondOperandIsNotTyped()
- {
- RDFDatatype d = new BaseDatatype("eh:/FakeDataType") {
- @Override
- public boolean isEqual(LiteralLabel ll1, LiteralLabel ll2)
- {
- fail("RDFDatatype::isEquals should not be called if B has no datatype") ;
- return false ;
- }
- } ;
- LiteralLabel ll1 = LiteralLabelFactory.create("17", "", d) ;
- LiteralLabel ll2 = LiteralLabelFactory.create("17", "", null) ;
- assertFalse(ll1.sameValueAs(ll2)) ;
- }
-
- @Test
- public void testStringEquality()
- {
- assertEq( LiteralLabelFactory.create("xyz"),
- LiteralLabelFactory.create("xyz") ) ;
- }
-
- @Test
- public void testDifferentCaseStringInequality()
- {
- LiteralLabel ll1 = LiteralLabelFactory.create("xyz");
- LiteralLabel ll2 = LiteralLabelFactory.create("XYZ");
-
- assertFalse(ll1.equals(ll2)) ;
- assertFalse(ll1.sameValueAs(ll2)) ;
- }
-
- @Test
- public void testDifferentLanguageStringInequality()
- {
- LiteralLabel ll1 = LiteralLabelFactory.create("xyz", "en-us") ;
- LiteralLabel ll2 = LiteralLabelFactory.create("xyz", "en-uk") ;
- assertFalse(ll1.equals(ll2)) ;
- assertFalse(ll1.sameValueAs(ll2)) ;
- }
-
- @Test
- public void testDifferentLanguageStringCaseInequality()
- {
- LiteralLabel ll1 = LiteralLabelFactory.create("xyz", "en-UK") ;
- LiteralLabel ll2 = LiteralLabelFactory.create("xyz", "en-uk") ;
- assertFalse(ll1.equals(ll2)) ;
- assertTrue(ll1.sameValueAs(ll2)) ;
- }
-
}
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/SimpleGraphMakerTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/SimpleGraphMakerTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/SimpleGraphMakerTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/SimpleGraphMakerTest.java Sat Sep 7 18:58:59 2013
@@ -18,20 +18,17 @@
package com.hp.hpl.jena.graph.impl;
-
import com.hp.hpl.jena.graph.AbstractGraphMakerTest;
import com.hp.hpl.jena.graph.GraphMaker;
-import com.hp.hpl.jena.graph.impl.*;
-
/**
- Test the SimpleGraphFactory by extending AbstractTestGraphFactory
- and supplying new SimplGraphFactorys via getGraph.
-*/
-public class SimpleGraphMakerTest extends AbstractGraphMakerTest
- {
-
- @Override
- public GraphMaker getGraphMaker()
- { return new SimpleGraphMaker(); }
- }
+ * Test the SimpleGraphFactory by extending AbstractTestGraphFactory and
+ * supplying new SimplGraphFactorys via getGraph.
+ */
+public class SimpleGraphMakerTest extends AbstractGraphMakerTest {
+
+ @Override
+ public GraphMaker getGraphMaker() {
+ return new SimpleGraphMaker();
+ }
+}
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphSuite.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphSuite.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphSuite.java Sat Sep 7 18:58:59 2013
@@ -18,18 +18,21 @@
package com.hp.hpl.jena.graph.impl;
+import org.junit.runners.Suite;
/**
Tests that check GraphMem and WrappedGraph for correctness against the Graph
and reifier test suites.
*/
import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
import com.hp.hpl.jena.graph.AbstractGraphSuite;
import com.hp.hpl.jena.graph.Graph;
import com.hp.hpl.jena.graph.impl.WrappedGraph;
import com.hp.hpl.jena.sparql.graph.GraphFactory;
import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+@RunWith(Suite.class)
public class WrappedGraphSuite extends AbstractGraphSuite {
@BeforeClass
public static void beforeClass() {
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphTest.java Sat Sep 7 18:58:59 2013
@@ -1,84 +1,59 @@
-///*
-// * 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.impl;
-//
-///**
-// Tests that check GraphMem and WrappedGraph for correctness against the Graph
-// and reifier test suites.
-// */
-//
-//import org.junit.Test;
-//
-//import com.hp.hpl.jena.graph.AbstractGraphSuite;
-//import com.hp.hpl.jena.graph.AbstractGraphTest;
-//import com.hp.hpl.jena.graph.Factory;
-//import com.hp.hpl.jena.graph.Graph;
-//import com.hp.hpl.jena.graph.GraphProducerInterface;
-//import com.hp.hpl.jena.graph.impl.WrappedGraph;
-//import com.hp.hpl.jena.mem.GraphMem;
-//import com.hp.hpl.jena.sparql.graph.GraphFactory;
-//
-//public class WrappedGraphTest extends AbstractGraphSuite {
-// public WrappedGraphTest(String name) {
-// super(name);
-// }
-//
-// /**
-// * Answer a test suite that runs the Graph tests on GraphMem and on
-// * WrappedGraphMem, the latter standing in for testing WrappedGraph.
-// */
-// public static TestSuite suite() {
-// 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);
-// return result;
-// }
-//
-// public static TestSuite suite(Class<? extends Test> classWithTests,
-// Class<? extends Graph> graphClass) {
-// return MetaTestGraph.suite(classWithTests, graphClass);
-// }
-//
-// /**
-// * Trivial [incomplete] test that a Wrapped graph pokes through to the
-// * underlying graph. Really want something using mock classes. Will think
-// * about it.
-// */
-// @Test
-// public void testWrappedSame() {
-// Graph m = Factory.createGraphMem();
-// Graph w = new WrappedGraph(m);
-// graphAdd(m, "a trumps b; c eats d");
-// assertIsomorphic(m, w);
-// graphAdd(w, "i write this; you read that");
-// assertIsomorphic(w, m);
-// }
-//
-// public static class GraphProducer implements GraphProducerInterface {
-// @Override
-// public Graph newGraph() {
-// return new WrappedGraph(GraphFactory.createGraphMem());
-// }
-// }
-//
-//}
+/*
+ * 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.impl;
+
+/**
+ Tests that check GraphMem and WrappedGraph for correctness against the Graph
+ and reifier test suites.
+ */
+
+import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
+import org.junit.Test;
+
+import com.hp.hpl.jena.graph.AbstractGraphTest;
+import com.hp.hpl.jena.graph.Factory;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.impl.WrappedGraph;
+import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+
+public class WrappedGraphTest extends AbstractGraphTest {
+
+ GraphProducerInterface graphProducer = new WrappedGraphSuite.GraphProducer();
+
+ @Override
+ public GraphProducerInterface getGraphProducer() {
+ return graphProducer;
+ }
+
+ /**
+ * Trivial [incomplete] test that a Wrapped graph pokes through to the
+ * underlying graph. Really want something using mock classes. Will think
+ * about it.
+ */
+ @Test
+ public void testWrappedSame() {
+ Graph m = Factory.createGraphMem();
+ Graph w = new WrappedGraph(m);
+ graphAdd(m, "a trumps b; c eats d");
+ assertIsomorphic(m, w);
+ graphAdd(w, "i write this; you read that");
+ assertIsomorphic(w, m);
+ }
+
+}
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/package-info.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/package-info.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/package-info.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/package-info.java Sat Sep 7 18:58:59 2013
@@ -1,19 +1,32 @@
+/*
+ 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.impl;
-/**
-
-<h3>Missing Tests</h3>
-<ul>
-<li>AdhocDataType</li>
-<li>GraphMatcher</li>
-<li>GraphWithPerofrm</li>
-</ul>
-
+/**
-*/
-
+ <h3>Missing Tests</h3>
+ <ul>
+ <li>AdhocDataType</li>
+ <li>GraphMatcher</li>
+ <li>GraphWithPerofrm</li>
+ </ul>
-
+ */
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/package-info.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/package-info.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/package-info.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/package-info.java Sat Sep 7 18:58:59 2013
@@ -1,99 +1,112 @@
+/*
+ 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;
+
/**
* General tests for Graph implementations
*
-Testing guidelines/suggestions
-
-Interface tests are built so that developers may test that implementations meet the contract
-set out in the interface and accompanying documentation.
-
-The major items under test use an instance of the GraphProducerInterface to create the graph
-being tested. An implementation of GraphProducerInterface must track all the tests created
-during the test and close all of them when requested. There is an AbstractGrapProducer that
-handles most of that functionality but requires a createNewGraph() implementation.
-
-TESTS
-=====
-
-Interface tests are noted as Abstract(INTERFACENAME)Test. Tests generally extend the
-AbstractGraphProducerUser class. This class handles cleaning up all the graphs at the end of
-the tests and provides a hook for implementers to plug in their GraphProducerInterface.
-
-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.
-<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>
-SUITES
-======
-
-Test suites are named as Abstract(INTERFACENAME)Suite. Suites contain several tests that
-excersize all of the tests for the components of the object under test. For example the graph
-suite includes tests for the graph iteself, the reifier, finding literals, recursive subgraph
-extraction, event manager, and transactions. Running the suites is a bit more complicated then
-running the tests.
-
-Suites are created using the JUnit 4 @RunWith(Suite.class) and @Suite.SuiteClasses({ })
-annotations. This has several effects that the developer should know about:
-1. The suite class does not get instantiated during the run.
-2. The test class names must be known at coding time (not run time) as they are listed in the
- annotation.
-3. Configuration of the tests has to occur during the static initialization phase of class
- loading.
-
-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.
-
-<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>
-
-Note 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.
-
-*/
-
+ Testing guidelines/suggestions
+ Interface tests are built so that developers may test that implementations meet the contract
+ set out in the interface and accompanying documentation.
+ The major items under test use an instance of the GraphProducerInterface to create the graph
+ being tested. An implementation of GraphProducerInterface must track all the tests created
+ during the test and close all of them when requested. There is an AbstractGrapProducer that
+ handles most of that functionality but requires a createNewGraph() implementation.
+
+ TESTS
+ =====
+
+ Interface tests are noted as Abstract(INTERFACENAME)Test. Tests generally extend the
+ AbstractGraphProducerUser class. This class handles cleaning up all the graphs at the end of
+ the tests and provides a hook for implementers to plug in their GraphProducerInterface.
+
+ 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.
+ <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>
+ SUITES
+ ======
+
+ Test suites are named as Abstract(INTERFACENAME)Suite. Suites contain several tests that
+ excersize all of the tests for the components of the object under test. For example the graph
+ suite includes tests for the graph iteself, the reifier, finding literals, recursive subgraph
+ extraction, event manager, and transactions. Running the suites is a bit more complicated then
+ running the tests.
+
+ Suites are created using the JUnit 4 @RunWith(Suite.class) and @Suite.SuiteClasses({ })
+ annotations. This has several effects that the developer should know about:
+ 1. The suite class does not get instantiated during the run.
+ 2. The test class names must be known at coding time (not run time) as they are listed in the
+ annotation.
+ 3. Configuration of the tests has to occur during the static initialization phase of class
+ loading.
+
+ 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.
+
+ <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>
+
+ Note 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.
-
+ */
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/AbstractPrefixMappingTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/AbstractPrefixMappingTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/AbstractPrefixMappingTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/AbstractPrefixMappingTest.java Sat Sep 7 18:58:59 2013
@@ -27,492 +27,442 @@ import java.util.Map;
import org.junit.Test;
-
/**
- Test prefix mappings - subclass this test and override getMapping() to
- deliver the prefixMapping to be tested.
-*/
-
-public abstract class AbstractPrefixMappingTest
- {
-
-
- /**
- Subclasses implement to return a new, empty prefixMapping of their
- preferred kind.
- */
- abstract protected PrefixMapping getMapping();
-
- public static final String crispURI = "http://crisp.nosuch.net/";
- public static final String ropeURI = "scheme:rope/string#";
- public static final String butterURI = "ftp://ftp.nowhere.at.all/cream#";
-
- /**
- The empty prefix is specifically allowed [for the default namespace].
- */
- @Test
- public void testEmptyPrefix()
- {
- PrefixMapping pm = getMapping();
- pm.setNsPrefix( "", crispURI );
- assertEquals( crispURI, pm.getNsPrefixURI( "" ) );
- }
-
- static final String [] badNames =
- {
- "<hello>",
- "foo:bar",
- "with a space",
- "-argument"
- };
-
- /**
- Test that various illegal names are trapped.
- */
- @Test
- public void testCheckNames()
- {
- PrefixMapping ns = getMapping();
- for (int i = 0; i < badNames.length; i += 1)
- {
- String bad = badNames[i];
- try
- {
- ns.setNsPrefix( bad, crispURI );
- fail( "'" + bad + "' is an illegal prefix and should be trapped" );
- }
- catch (PrefixMapping.IllegalPrefixException e) {
- // expected
- }
- }
- }
- @Test
- public void testNullURITrapped()
- {
- try
- {
- getMapping().setNsPrefix( "xy", null );
- fail( "shouild trap null URI in setNsPrefix" );
- }
- catch (NullPointerException e)
- {
- // expected
- }
- }
-
- /**
- test that a PrefixMapping maps names to URIs. The names and URIs are
- all fully distinct - overlapping names/uris are dealt with in other tests.
- */
- @Test
- public void testPrefixMappingMapping()
- {
- String toast = "ftp://ftp.nowhere.not/";
- assertDiffer( "crisp and toast must differ", crispURI, toast );
- /* */
- PrefixMapping ns = getMapping();
- assertEquals( "crisp should be unset", null, ns.getNsPrefixURI( "crisp" ) );
- assertEquals( "toast should be unset", null, ns.getNsPrefixURI( "toast" ) );
- assertEquals( "butter should be unset", null, ns.getNsPrefixURI( "butter" ) );
- /* */
- ns.setNsPrefix( "crisp", crispURI );
- assertEquals( "crisp should be set", crispURI, ns.getNsPrefixURI( "crisp" ) );
- assertEquals( "toast should still be unset", null, ns.getNsPrefixURI( "toast" ) );
- assertEquals( "butter should still be unset", null, ns.getNsPrefixURI( "butter" ) );
- /* */
- ns.setNsPrefix( "toast", toast );
- assertEquals( "crisp should be set", crispURI, ns.getNsPrefixURI( "crisp" ) );
- assertEquals( "toast should be set", toast, ns.getNsPrefixURI( "toast" ) );
- assertEquals( "butter should still be unset", null, ns.getNsPrefixURI( "butter" ) );
- }
-
- /**
- Test that we can run the prefix mapping in reverse - from URIs to prefixes.
- uriB is a prefix of uriA to try and ensure that the ordering of the map doesn't matter.
- */
- @Test
- public void testReversePrefixMapping()
- {
- PrefixMapping ns = getMapping();
- String uriA = "http://jena.hpl.hp.com/A#", uriB = "http://jena.hpl.hp.com/";
- String uriC = "http://jena.hpl.hp.com/Csharp/";
- String prefixA = "aa", prefixB = "bb";
- ns.setNsPrefix( prefixA, uriA ).setNsPrefix( prefixB, uriB );
- assertEquals( null, ns.getNsURIPrefix( uriC) );
- assertEquals( prefixA, ns.getNsURIPrefix( uriA ) );
- assertEquals( prefixB, ns.getNsURIPrefix( uriB ) );
- }
-
- /**
- test that we can extract a proper Map from a PrefixMapping
- */
- @Test
- public void testPrefixMappingMap()
- {
- PrefixMapping ns = getCrispyRope();
- Map<String, String> map = ns.getNsPrefixMap();
- assertEquals( "map should have two elements", 2, map.size() );
- assertEquals( crispURI, map.get( "crisp" ) );
- assertEquals( "scheme:rope/string#", map.get( "rope" ) );
- }
-
- /**
- test that the Map returned by getNsPrefixMap does not alias (parts of)
- the secret internal map of the PrefixMapping
- */
- @Test
- public void testPrefixMappingSecret()
- {
- PrefixMapping ns = getCrispyRope();
- Map<String, String> map = ns.getNsPrefixMap();
- /* */
- map.put( "crisp", "with/onions" );
- map.put( "sandwich", "with/cheese" );
- assertEquals( crispURI, ns.getNsPrefixURI( "crisp" ) );
- assertEquals( ropeURI, ns.getNsPrefixURI( "rope" ) );
- assertEquals( null, ns.getNsPrefixURI( "sandwich" ) );
- }
-
- private PrefixMapping getCrispyRope()
- {
- PrefixMapping ns = getMapping();
- ns.setNsPrefix( "crisp", crispURI);
- ns.setNsPrefix( "rope", ropeURI );
- return ns;
- }
-
- /**
- these are strings that should not change when they are prefix-expanded
- with crisp and rope as legal prefixes.
- */
- static final String [] dontChange =
- {
- "",
- "http://www.somedomain.something/whatever#",
- "crispy:cabbage",
- "cris:isOnInfiniteEarths",
- "rop:tangled/web",
- "roped:abseiling"
- };
-
- /**
- these are the required mappings which the test cases below should
- satisfy: an array of 2-arrays, where element 0 is the string to expand
- and element 1 is the string it should expand to.
- */
- static final String [][] expansions =
- {
- { "crisp:pathPart", crispURI + "pathPart" },
- { "rope:partPath", ropeURI + "partPath" },
- { "crisp:path:part", crispURI + "path:part" },
- };
-
- @Test
- public void testExpandPrefix()
- {
- PrefixMapping ns = getMapping();
- ns.setNsPrefix( "crisp", crispURI );
- ns.setNsPrefix( "rope", ropeURI );
- /* */
- for (int i = 0; i < dontChange.length; i += 1)
- assertEquals
- (
- "should be unchanged",
- dontChange[i],
- ns.expandPrefix( dontChange[i] )
- );
- /* */
- for (int i = 0; i < expansions.length; i += 1)
- assertEquals
- (
- "should expand correctly",
- expansions[i][1],
- ns.expandPrefix( expansions[i][0] )
- );
- }
-
- @Test
- public void testUseEasyPrefix()
- {
- testUseEasyPrefix( "prefix mapping impl", getMapping() );
- testShortForm( "prefix mapping impl", getMapping() );
- }
-
- public static void testUseEasyPrefix( String title, PrefixMapping ns )
- {
- testShortForm( title, ns );
- }
-
- public static void testShortForm( String title, PrefixMapping ns )
- {
- ns.setNsPrefix( "crisp", crispURI );
- ns.setNsPrefix( "butter", butterURI );
- assertEquals( title, "", ns.shortForm( "" ) );
- assertEquals( title, ropeURI, ns.shortForm( ropeURI ) );
- assertEquals( title, "crisp:tail", ns.shortForm( crispURI + "tail" ) );
- assertEquals( title, "butter:here:we:are", ns.shortForm( butterURI + "here:we:are" ) );
- }
-
- @Test
- public void testEasyQName()
- {
- PrefixMapping ns = getMapping();
- String alphaURI = "http://seasonal.song/preamble/";
- ns.setNsPrefix( "alpha", alphaURI );
- assertEquals( "alpha:rowboat", ns.qnameFor( alphaURI + "rowboat" ) );
- }
-
- @Test
- public void testNoQNameNoPrefix()
- {
- PrefixMapping ns = getMapping();
- String alphaURI = "http://seasonal.song/preamble/";
- ns.setNsPrefix( "alpha", alphaURI );
- assertEquals( null, ns.qnameFor( "eg:rowboat" ) );
- }
-
- @Test
- public void testNoQNameBadLocal()
- {
- PrefixMapping ns = getMapping();
- String alphaURI = "http://seasonal.song/preamble/";
- ns.setNsPrefix( "alpha", alphaURI );
- assertEquals( null, ns.qnameFor( alphaURI + "12345" ) );
- }
-
- /**
- The tests implied by the email where Chris suggested adding qnameFor;
- shortForm generates illegal qnames but qnameFor does not.
- */
- @Test
- public void testQnameFromEmail()
- {
- String uri = "http://some.long.uri/for/a/namespace#";
- PrefixMapping ns = getMapping();
- ns.setNsPrefix( "x", uri );
- assertEquals( null, ns.qnameFor( uri ) );
- assertEquals( null, ns.qnameFor( uri + "non/fiction" ) );
- }
-
-
- /**
- test that we can add the maplets from another PrefixMapping without
- losing our own.
- */
- @Test
- public void testAddOtherPrefixMapping()
- {
- PrefixMapping a = getMapping();
- PrefixMapping b = getMapping();
- assertFalse( "must have two diffferent maps", a == b );
- a.setNsPrefix( "crisp", crispURI );
- a.setNsPrefix( "rope", ropeURI );
- b.setNsPrefix( "butter", butterURI );
- assertEquals( null, b.getNsPrefixURI( "crisp") );
- assertEquals( null, b.getNsPrefixURI( "rope") );
- b.setNsPrefixes( a );
- checkContainsMapping( b );
- }
-
- private void checkContainsMapping( PrefixMapping b )
- {
- assertEquals( crispURI, b.getNsPrefixURI( "crisp") );
- assertEquals( ropeURI, b.getNsPrefixURI( "rope") );
- assertEquals( butterURI, b.getNsPrefixURI( "butter") );
- }
-
- /**
- as for testAddOtherPrefixMapping, except that it's a plain Map
- we're adding.
- */
- @Test
- public void testAddMap()
- {
- PrefixMapping b = getMapping();
- Map<String, String> map = new HashMap<String, String>();
- map.put( "crisp", crispURI );
- map.put( "rope", ropeURI );
- b.setNsPrefix( "butter", butterURI );
- b.setNsPrefixes( map );
- checkContainsMapping( b );
- }
-
- @Test
- public void testAddDefaultMap()
- {
- PrefixMapping pm = getMapping();
- PrefixMapping root = PrefixMapping.Factory.create();
- pm.setNsPrefix( "a", "aPrefix:" );
- pm.setNsPrefix( "b", "bPrefix:" );
- root.setNsPrefix( "a", "pootle:" );
- root.setNsPrefix( "z", "bPrefix:" );
- root.setNsPrefix( "c", "cootle:" );
- assertSame( pm, pm.withDefaultMappings( root ) );
- assertEquals( "aPrefix:", pm.getNsPrefixURI( "a" ) );
- assertEquals( null, pm.getNsPrefixURI( "z" ) );
- assertEquals( "bPrefix:", pm.getNsPrefixURI( "b" ) );
- assertEquals( "cootle:", pm.getNsPrefixURI( "c" ) );
- }
-
-
- @Test
- public void testSecondPrefixRetainsExistingMap()
- {
- PrefixMapping A = getMapping();
- A.setNsPrefix( "a", crispURI );
- A.setNsPrefix( "b", crispURI );
- assertEquals( crispURI, A.getNsPrefixURI( "a" ) );
- assertEquals( crispURI, A.getNsPrefixURI( "b" ) );
- }
-
- @Test
- public void testSecondPrefixReplacesReverseMap()
- {
- PrefixMapping A = getMapping();
- A.setNsPrefix( "a", crispURI );
- A.setNsPrefix( "b", crispURI );
- assertEquals( "b", A.getNsURIPrefix( crispURI ) );
- }
-
- @Test
- public void testSecondPrefixDeletedUncoversPreviousMap()
- {
- PrefixMapping A = getMapping();
- A.setNsPrefix( "x", crispURI );
- A.setNsPrefix( "y", crispURI );
- A.removeNsPrefix( "y" );
- assertEquals( "x", A.getNsURIPrefix( crispURI ) );
- }
-
- /**
- Test that the empty prefix does not wipe an existing prefix for the same URI.
- */
- @Test
- public void testEmptyDoesNotWipeURI()
- {
- PrefixMapping pm = getMapping();
- pm.setNsPrefix( "frodo", ropeURI );
- pm.setNsPrefix( "", ropeURI );
- assertEquals( ropeURI, pm.getNsPrefixURI( "frodo" ) );
- }
-
- /**
- Test that adding a new prefix mapping for U does not throw away a default
- mapping for U.
- */
- @Test
- public void testSameURIKeepsDefault()
- {
- PrefixMapping A = getMapping();
- A.setNsPrefix( "", crispURI );
- A.setNsPrefix( "crisp", crispURI );
- assertEquals( crispURI, A.getNsPrefixURI( "" ) );
- }
-
- @Test
- public void testReturnsSelf()
- {
- PrefixMapping A = getMapping();
- assertSame( A, A.setNsPrefix( "crisp", crispURI ) );
- assertSame( A, A.setNsPrefixes( A ) );
- assertSame( A, A.setNsPrefixes( new HashMap<String, String>() ) );
- assertSame( A, A.removeNsPrefix( "rhubarb" ) );
- }
-
- @Test
- public void testRemovePrefix()
- {
- String hURI = "http://test.remove.prefixes/prefix#";
- String bURI = "http://other.test.remove.prefixes/prefix#";
- PrefixMapping A = getMapping();
- A.setNsPrefix( "hr", hURI );
- A.setNsPrefix( "br", bURI );
- A.removeNsPrefix( "hr" );
- assertEquals( null, A.getNsPrefixURI( "hr" ) );
- assertEquals( bURI, A.getNsPrefixURI( "br" ) );
- }
-
- @Test
- public void testEquality()
- {
- testEquals( "" );
- testEquals( "", "x=a", false );
- testEquals( "x=a", "", false );
- testEquals( "x=a" );
- testEquals( "x=a y=b", "y=b x=a", true );
- testEquals( "x=a x=b", "x=b x=a", false );
- }
-
-
- protected void testEquals( String S )
- { testEquals( S, S, true ); }
-
-
- protected void testEquals( String S, String T, boolean expected )
- {
- testEqualsBase( S, T, expected );
- testEqualsBase( T, S, expected );
- }
-
-
- protected void testEqualsBase( String S, String T, boolean expected )
- {
- testEquals( S, T, expected, getMapping(), getMapping() );
- testEquals( S, T, expected, PrefixMapping.Factory.create(), getMapping() );
- }
-
-
- protected void testEquals( String S, String T, boolean expected, PrefixMapping A, PrefixMapping B )
- {
- fill( A, S );
- fill( B, T );
- String title = "usual: '" + S + "', testing: '" + T + "', should be " + (expected ? "equal" : "different");
- assertEquals( title, expected, A.samePrefixMappingAs( B ) );
- assertEquals( title, expected, B.samePrefixMappingAs( A ) );
- }
-
-
- protected void fill( PrefixMapping pm, String settings )
- {
- List<String> L = listOfStrings( settings );
- for (int i = 0; i < L.size(); i += 1)
- {
- String setting = L.get(i);
- int eq = setting.indexOf( '=' );
- pm.setNsPrefix( setting.substring( 0, eq ), setting.substring( eq + 1 ) );
- }
- }
-
- @Test
- public void testAllowNastyNamespace()
- { // we now allow namespaces to end with non-punctuational characters
- getMapping().setNsPrefix( "abc", "def" );
- }
-
- @Test
- public void testLock()
- {
- PrefixMapping A = getMapping();
- assertSame( A, A.lock() );
- /* */
- try { A.setNsPrefix( "crisp", crispURI ); fail( "mapping should be frozen" ); }
- catch (PrefixMapping.JenaLockedException e) {
- // expected
- }
- /* */
- try { A.setNsPrefixes( A ); fail( "mapping should be frozen" ); }
- catch (PrefixMapping.JenaLockedException e) {
- // expected
- }
- /* */
- try { A.setNsPrefixes( new HashMap<String, String>() ); fail( "mapping should be frozen" ); }
- catch (PrefixMapping.JenaLockedException e) {
- // expected
- }
- /* */
- try { A.removeNsPrefix( "toast" ); fail( "mapping should be frozen" ); }
- catch (PrefixMapping.JenaLockedException e) {
- // expected
- }
- }
- }
+ * Test prefix mappings - subclass this test and override getMapping() to
+ * deliver the prefixMapping to be tested.
+ */
+
+public abstract class AbstractPrefixMappingTest {
+
+ /**
+ * Subclasses implement to return a new, empty prefixMapping of their
+ * preferred kind.
+ */
+ abstract protected PrefixMapping getMapping();
+
+ public static final String crispURI = "http://crisp.nosuch.net/";
+ public static final String ropeURI = "scheme:rope/string#";
+ public static final String butterURI = "ftp://ftp.nowhere.at.all/cream#";
+
+ /**
+ * The empty prefix is specifically allowed [for the default namespace].
+ */
+ @Test
+ public void testEmptyPrefix() {
+ PrefixMapping pm = getMapping();
+ pm.setNsPrefix("", crispURI);
+ assertEquals(crispURI, pm.getNsPrefixURI(""));
+ }
+
+ static final String[] badNames = { "<hello>", "foo:bar", "with a space",
+ "-argument" };
+
+ /**
+ * Test that various illegal names are trapped.
+ */
+ @Test
+ public void testCheckNames() {
+ PrefixMapping ns = getMapping();
+ for (int i = 0; i < badNames.length; i += 1) {
+ String bad = badNames[i];
+ try {
+ ns.setNsPrefix(bad, crispURI);
+ fail("'" + bad + "' is an illegal prefix and should be trapped");
+ } catch (PrefixMapping.IllegalPrefixException e) {
+ // expected
+ }
+ }
+ }
+
+ @Test
+ public void testNullURITrapped() {
+ try {
+ getMapping().setNsPrefix("xy", null);
+ fail("shouild trap null URI in setNsPrefix");
+ } catch (NullPointerException e) {
+ // expected
+ }
+ }
+
+ /**
+ * test that a PrefixMapping maps names to URIs. The names and URIs are all
+ * fully distinct - overlapping names/uris are dealt with in other tests.
+ */
+ @Test
+ public void testPrefixMappingMapping() {
+ String toast = "ftp://ftp.nowhere.not/";
+ assertDiffer("crisp and toast must differ", crispURI, toast);
+ /* */
+ PrefixMapping ns = getMapping();
+ assertEquals("crisp should be unset", null, ns.getNsPrefixURI("crisp"));
+ assertEquals("toast should be unset", null, ns.getNsPrefixURI("toast"));
+ assertEquals("butter should be unset", null,
+ ns.getNsPrefixURI("butter"));
+ /* */
+ ns.setNsPrefix("crisp", crispURI);
+ assertEquals("crisp should be set", crispURI,
+ ns.getNsPrefixURI("crisp"));
+ assertEquals("toast should still be unset", null,
+ ns.getNsPrefixURI("toast"));
+ assertEquals("butter should still be unset", null,
+ ns.getNsPrefixURI("butter"));
+ /* */
+ ns.setNsPrefix("toast", toast);
+ assertEquals("crisp should be set", crispURI,
+ ns.getNsPrefixURI("crisp"));
+ assertEquals("toast should be set", toast, ns.getNsPrefixURI("toast"));
+ assertEquals("butter should still be unset", null,
+ ns.getNsPrefixURI("butter"));
+ }
+
+ /**
+ * Test that we can run the prefix mapping in reverse - from URIs to
+ * prefixes. uriB is a prefix of uriA to try and ensure that the ordering of
+ * the map doesn't matter.
+ */
+ @Test
+ public void testReversePrefixMapping() {
+ PrefixMapping ns = getMapping();
+ String uriA = "http://jena.hpl.hp.com/A#", uriB = "http://jena.hpl.hp.com/";
+ String uriC = "http://jena.hpl.hp.com/Csharp/";
+ String prefixA = "aa", prefixB = "bb";
+ ns.setNsPrefix(prefixA, uriA).setNsPrefix(prefixB, uriB);
+ assertEquals(null, ns.getNsURIPrefix(uriC));
+ assertEquals(prefixA, ns.getNsURIPrefix(uriA));
+ assertEquals(prefixB, ns.getNsURIPrefix(uriB));
+ }
+
+ /**
+ * test that we can extract a proper Map from a PrefixMapping
+ */
+ @Test
+ public void testPrefixMappingMap() {
+ PrefixMapping ns = getCrispyRope();
+ Map<String, String> map = ns.getNsPrefixMap();
+ assertEquals("map should have two elements", 2, map.size());
+ assertEquals(crispURI, map.get("crisp"));
+ assertEquals("scheme:rope/string#", map.get("rope"));
+ }
+
+ /**
+ * test that the Map returned by getNsPrefixMap does not alias (parts of)
+ * the secret internal map of the PrefixMapping
+ */
+ @Test
+ public void testPrefixMappingSecret() {
+ PrefixMapping ns = getCrispyRope();
+ Map<String, String> map = ns.getNsPrefixMap();
+ /* */
+ map.put("crisp", "with/onions");
+ map.put("sandwich", "with/cheese");
+ assertEquals(crispURI, ns.getNsPrefixURI("crisp"));
+ assertEquals(ropeURI, ns.getNsPrefixURI("rope"));
+ assertEquals(null, ns.getNsPrefixURI("sandwich"));
+ }
+
+ private PrefixMapping getCrispyRope() {
+ PrefixMapping ns = getMapping();
+ ns.setNsPrefix("crisp", crispURI);
+ ns.setNsPrefix("rope", ropeURI);
+ return ns;
+ }
+
+ /**
+ * these are strings that should not change when they are prefix-expanded
+ * with crisp and rope as legal prefixes.
+ */
+ static final String[] dontChange = { "",
+ "http://www.somedomain.something/whatever#", "crispy:cabbage",
+ "cris:isOnInfiniteEarths", "rop:tangled/web", "roped:abseiling" };
+
+ /**
+ * these are the required mappings which the test cases below should
+ * satisfy: an array of 2-arrays, where element 0 is the string to expand
+ * and element 1 is the string it should expand to.
+ */
+ static final String[][] expansions = {
+ { "crisp:pathPart", crispURI + "pathPart" },
+ { "rope:partPath", ropeURI + "partPath" },
+ { "crisp:path:part", crispURI + "path:part" }, };
+
+ @Test
+ public void testExpandPrefix() {
+ PrefixMapping ns = getMapping();
+ ns.setNsPrefix("crisp", crispURI);
+ ns.setNsPrefix("rope", ropeURI);
+ /* */
+ for (int i = 0; i < dontChange.length; i += 1)
+ assertEquals("should be unchanged", dontChange[i],
+ ns.expandPrefix(dontChange[i]));
+ /* */
+ for (int i = 0; i < expansions.length; i += 1)
+ assertEquals("should expand correctly", expansions[i][1],
+ ns.expandPrefix(expansions[i][0]));
+ }
+
+ @Test
+ public void testUseEasyPrefix() {
+ testUseEasyPrefix("prefix mapping impl", getMapping());
+ testShortForm("prefix mapping impl", getMapping());
+ }
+
+ public static void testUseEasyPrefix(String title, PrefixMapping ns) {
+ testShortForm(title, ns);
+ }
+
+ public static void testShortForm(String title, PrefixMapping ns) {
+ ns.setNsPrefix("crisp", crispURI);
+ ns.setNsPrefix("butter", butterURI);
+ assertEquals(title, "", ns.shortForm(""));
+ assertEquals(title, ropeURI, ns.shortForm(ropeURI));
+ assertEquals(title, "crisp:tail", ns.shortForm(crispURI + "tail"));
+ assertEquals(title, "butter:here:we:are",
+ ns.shortForm(butterURI + "here:we:are"));
+ }
+
+ @Test
+ public void testEasyQName() {
+ PrefixMapping ns = getMapping();
+ String alphaURI = "http://seasonal.song/preamble/";
+ ns.setNsPrefix("alpha", alphaURI);
+ assertEquals("alpha:rowboat", ns.qnameFor(alphaURI + "rowboat"));
+ }
+
+ @Test
+ public void testNoQNameNoPrefix() {
+ PrefixMapping ns = getMapping();
+ String alphaURI = "http://seasonal.song/preamble/";
+ ns.setNsPrefix("alpha", alphaURI);
+ assertEquals(null, ns.qnameFor("eg:rowboat"));
+ }
+
+ @Test
+ public void testNoQNameBadLocal() {
+ PrefixMapping ns = getMapping();
+ String alphaURI = "http://seasonal.song/preamble/";
+ ns.setNsPrefix("alpha", alphaURI);
+ assertEquals(null, ns.qnameFor(alphaURI + "12345"));
+ }
+
+ /**
+ * The tests implied by the email where Chris suggested adding qnameFor;
+ * shortForm generates illegal qnames but qnameFor does not.
+ */
+ @Test
+ public void testQnameFromEmail() {
+ String uri = "http://some.long.uri/for/a/namespace#";
+ PrefixMapping ns = getMapping();
+ ns.setNsPrefix("x", uri);
+ assertEquals(null, ns.qnameFor(uri));
+ assertEquals(null, ns.qnameFor(uri + "non/fiction"));
+ }
+
+ /**
+ * test that we can add the maplets from another PrefixMapping without
+ * losing our own.
+ */
+ @Test
+ public void testAddOtherPrefixMapping() {
+ PrefixMapping a = getMapping();
+ PrefixMapping b = getMapping();
+ assertFalse("must have two diffferent maps", a == b);
+ a.setNsPrefix("crisp", crispURI);
+ a.setNsPrefix("rope", ropeURI);
+ b.setNsPrefix("butter", butterURI);
+ assertEquals(null, b.getNsPrefixURI("crisp"));
+ assertEquals(null, b.getNsPrefixURI("rope"));
+ b.setNsPrefixes(a);
+ checkContainsMapping(b);
+ }
+
+ private void checkContainsMapping(PrefixMapping b) {
+ assertEquals(crispURI, b.getNsPrefixURI("crisp"));
+ assertEquals(ropeURI, b.getNsPrefixURI("rope"));
+ assertEquals(butterURI, b.getNsPrefixURI("butter"));
+ }
+
+ /**
+ * as for testAddOtherPrefixMapping, except that it's a plain Map we're
+ * adding.
+ */
+ @Test
+ public void testAddMap() {
+ PrefixMapping b = getMapping();
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("crisp", crispURI);
+ map.put("rope", ropeURI);
+ b.setNsPrefix("butter", butterURI);
+ b.setNsPrefixes(map);
+ checkContainsMapping(b);
+ }
+
+ @Test
+ public void testAddDefaultMap() {
+ PrefixMapping pm = getMapping();
+ PrefixMapping root = PrefixMapping.Factory.create();
+ pm.setNsPrefix("a", "aPrefix:");
+ pm.setNsPrefix("b", "bPrefix:");
+ root.setNsPrefix("a", "pootle:");
+ root.setNsPrefix("z", "bPrefix:");
+ root.setNsPrefix("c", "cootle:");
+ assertSame(pm, pm.withDefaultMappings(root));
+ assertEquals("aPrefix:", pm.getNsPrefixURI("a"));
+ assertEquals(null, pm.getNsPrefixURI("z"));
+ assertEquals("bPrefix:", pm.getNsPrefixURI("b"));
+ assertEquals("cootle:", pm.getNsPrefixURI("c"));
+ }
+
+ @Test
+ public void testSecondPrefixRetainsExistingMap() {
+ PrefixMapping A = getMapping();
+ A.setNsPrefix("a", crispURI);
+ A.setNsPrefix("b", crispURI);
+ assertEquals(crispURI, A.getNsPrefixURI("a"));
+ assertEquals(crispURI, A.getNsPrefixURI("b"));
+ }
+
+ @Test
+ public void testSecondPrefixReplacesReverseMap() {
+ PrefixMapping A = getMapping();
+ A.setNsPrefix("a", crispURI);
+ A.setNsPrefix("b", crispURI);
+ assertEquals("b", A.getNsURIPrefix(crispURI));
+ }
+
+ @Test
+ public void testSecondPrefixDeletedUncoversPreviousMap() {
+ PrefixMapping A = getMapping();
+ A.setNsPrefix("x", crispURI);
+ A.setNsPrefix("y", crispURI);
+ A.removeNsPrefix("y");
+ assertEquals("x", A.getNsURIPrefix(crispURI));
+ }
+
+ /**
+ * Test that the empty prefix does not wipe an existing prefix for the same
+ * URI.
+ */
+ @Test
+ public void testEmptyDoesNotWipeURI() {
+ PrefixMapping pm = getMapping();
+ pm.setNsPrefix("frodo", ropeURI);
+ pm.setNsPrefix("", ropeURI);
+ assertEquals(ropeURI, pm.getNsPrefixURI("frodo"));
+ }
+
+ /**
+ * Test that adding a new prefix mapping for U does not throw away a default
+ * mapping for U.
+ */
+ @Test
+ public void testSameURIKeepsDefault() {
+ PrefixMapping A = getMapping();
+ A.setNsPrefix("", crispURI);
+ A.setNsPrefix("crisp", crispURI);
+ assertEquals(crispURI, A.getNsPrefixURI(""));
+ }
+
+ @Test
+ public void testReturnsSelf() {
+ PrefixMapping A = getMapping();
+ assertSame(A, A.setNsPrefix("crisp", crispURI));
+ assertSame(A, A.setNsPrefixes(A));
+ assertSame(A, A.setNsPrefixes(new HashMap<String, String>()));
+ assertSame(A, A.removeNsPrefix("rhubarb"));
+ }
+
+ @Test
+ public void testRemovePrefix() {
+ String hURI = "http://test.remove.prefixes/prefix#";
+ String bURI = "http://other.test.remove.prefixes/prefix#";
+ PrefixMapping A = getMapping();
+ A.setNsPrefix("hr", hURI);
+ A.setNsPrefix("br", bURI);
+ A.removeNsPrefix("hr");
+ assertEquals(null, A.getNsPrefixURI("hr"));
+ assertEquals(bURI, A.getNsPrefixURI("br"));
+ }
+
+ @Test
+ public void testEquality() {
+ testEquals("");
+ testEquals("", "x=a", false);
+ testEquals("x=a", "", false);
+ testEquals("x=a");
+ testEquals("x=a y=b", "y=b x=a", true);
+ testEquals("x=a x=b", "x=b x=a", false);
+ }
+
+ protected void testEquals(String S) {
+ testEquals(S, S, true);
+ }
+
+ protected void testEquals(String S, String T, boolean expected) {
+ testEqualsBase(S, T, expected);
+ testEqualsBase(T, S, expected);
+ }
+
+ protected void testEqualsBase(String S, String T, boolean expected) {
+ testEquals(S, T, expected, getMapping(), getMapping());
+ testEquals(S, T, expected, PrefixMapping.Factory.create(), getMapping());
+ }
+
+ protected void testEquals(String S, String T, boolean expected,
+ PrefixMapping A, PrefixMapping B) {
+ fill(A, S);
+ fill(B, T);
+ String title = "usual: '" + S + "', testing: '" + T + "', should be "
+ + (expected ? "equal" : "different");
+ assertEquals(title, expected, A.samePrefixMappingAs(B));
+ assertEquals(title, expected, B.samePrefixMappingAs(A));
+ }
+
+ protected void fill(PrefixMapping pm, String settings) {
+ List<String> L = listOfStrings(settings);
+ for (int i = 0; i < L.size(); i += 1) {
+ String setting = L.get(i);
+ int eq = setting.indexOf('=');
+ pm.setNsPrefix(setting.substring(0, eq), setting.substring(eq + 1));
+ }
+ }
+
+ @Test
+ public void testAllowNastyNamespace() { // we now allow namespaces to end
+ // with non-punctuational characters
+ getMapping().setNsPrefix("abc", "def");
+ }
+
+ @Test
+ public void testLock() {
+ PrefixMapping A = getMapping();
+ assertSame(A, A.lock());
+ /* */
+ try {
+ A.setNsPrefix("crisp", crispURI);
+ fail("mapping should be frozen");
+ } catch (PrefixMapping.JenaLockedException e) {
+ // expected
+ }
+ /* */
+ try {
+ A.setNsPrefixes(A);
+ fail("mapping should be frozen");
+ } catch (PrefixMapping.JenaLockedException e) {
+ // expected
+ }
+ /* */
+ try {
+ A.setNsPrefixes(new HashMap<String, String>());
+ fail("mapping should be frozen");
+ } catch (PrefixMapping.JenaLockedException e) {
+ // expected
+ }
+ /* */
+ try {
+ A.removeNsPrefix("toast");
+ fail("mapping should be frozen");
+ } catch (PrefixMapping.JenaLockedException e) {
+ // expected
+ }
+ }
+}
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducer.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducer.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducer.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducer.java Sat Sep 7 18:58:59 2013
@@ -1,3 +1,20 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
package com.hp.hpl.jena.testing_framework;
import java.util.ArrayList;
@@ -6,12 +23,12 @@ import java.util.List;
import com.hp.hpl.jena.graph.Graph;
/**
- * An abstract implementation of the GraphProducerInterface.
+ * An abstract implementation of the GraphProducerInterface.
+ *
+ * This class handles tracking of the created graphs and closing them. It also
+ * provides a callback for the implementing class to perform extra cleanup when
+ * the graph is closed.
*
- * This class handles tracking of the created graphs and closing them.
- * It also provides a callback for the implementing class to perform extra cleanup when
- * the graph is closed.
- *
*/
public abstract class AbstractGraphProducer implements GraphProducerInterface {
@@ -21,39 +38,40 @@ public abstract class AbstractGraphProdu
protected List<Graph> graphList = new ArrayList<Graph>();
/**
- * The method to create a new graph.
+ * The method to create a new graph.
+ *
* @return a newly constructed graph of type under test.
*/
abstract protected Graph createNewGraph();
-
@Override
final public Graph newGraph() {
Graph retval = createNewGraph();
graphList.add(retval);
return retval;
}
-
+
/**
- * Method called after the graph is closed. This allows the implementer to
- * perform extra cleanup activities, like deleting the file associated with a
- * file based graph.
+ * Method called after the graph is closed. This allows the implementer to
+ * perform extra cleanup activities, like deleting the file associated with
+ * a file based graph.
* <p>
* By default this does nothing.
* </p>
*
- * @param g The graph that is closed
+ * @param g
+ * The graph that is closed
*/
- protected void afterClose( Graph g ) {};
+ protected void afterClose(Graph g) {
+ };
@Override
final public void closeGraphs() {
for (Graph g : graphList) {
- if (!g.isClosed())
- {
+ if (!g.isClosed()) {
g.close();
}
- afterClose( g );
+ afterClose(g);
}
graphList.clear();
}
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducerUser.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducerUser.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducerUser.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducerUser.java Sat Sep 7 18:58:59 2013
@@ -1,14 +1,31 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
package com.hp.hpl.jena.testing_framework;
import org.junit.After;
-
/**
- * An abstract class that provides the GraphProducerInterface implementation and
+ * An abstract class that provides the GraphProducerInterface implementation and
* handles closing all the graphs after a test is complete.
*
*/
-public abstract class AbstractGraphProducerUser implements GraphProducerUserInterface {
+public abstract class AbstractGraphProducerUser implements
+ GraphProducerUserInterface {
@After
final public void closeGraphs() {
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=1520788&r1=1520787&r2=1520788&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 18:58:59 2013
@@ -1,7 +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.testing_framework;
import com.hp.hpl.jena.graph.GraphEventManager;
-import com.hp.hpl.jena.graph.impl.TripleStore;
/**
* Creates the graph for testing
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=1520788&r1=1520787&r2=1520788&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 18:58:59 2013
@@ -1,26 +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.testing_framework;
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 should track the creation of
+ * graphs created with newGraph and close them when clodeGraphs is called.
*
*/
public interface GraphProducerInterface {
/**
- * Returns a new Graph to take part in the test.
+ * Returns a new Graph to take part in the test.
*
* @return The graph implementation to test.
*/
public abstract Graph newGraph();
/**
- * provides a hook to close down graphs.
- * When called all graphs created by the newGraph() method should be closed.
- * Note that some graphs may have been closed during the test, so graphs should
- * be tested for being closed prior to closing.
+ * provides a hook to close down graphs. When called all graphs created by
+ * the newGraph() method should be closed. Note that some graphs may have
+ * been closed during the test, so graphs should be tested for being closed
+ * prior to closing.
*/
public abstract void closeGraphs();
}
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=1520788&r1=1520787&r2=1520788&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 18:58:59 2013
@@ -1,8 +1,26 @@
+/*
+ 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;
public interface GraphProducerUserInterface {
/**
* The graph producer to use for the tests.
+ *
* @return
*/
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=1520788&r1=1520787&r2=1520788&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 18:58:59 2013
@@ -49,7 +49,8 @@ import com.hp.hpl.jena.util.IteratorColl
import com.hp.hpl.jena.util.iterator.ExtendedIterator;
public class GraphTestUtils extends TestUtils {
- protected static String getFileName(String fn) {
+
+ public static String getFileName(String fn) {
URL u = GraphTestUtils.class.getClassLoader().getResource(fn);
if (u == null) {
throw new RuntimeException(new FileNotFoundException(fn));
@@ -206,11 +207,10 @@ public class GraphTestUtils extends Test
return result;
}
-
- /**
- Answer a new memory-based graph with initial contents as described
- by <code>s</code> in the fashion of <code>graphAdd()</code>.
- Not over-ridable; do not use for abstraction.
+ /**
+ * Answer a new memory-based graph with initial contents as described by
+ * <code>s</code> in the fashion of <code>graphAdd()</code>. Not
+ * over-ridable; do not use for abstraction.
*/
public static Graph graphWith(String s) {
return graphWith(newGraph(), s);
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestUtils.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestUtils.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestUtils.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestUtils.java Sat Sep 7 18:58:59 2013
@@ -191,7 +191,7 @@ public class TestUtils {
assertEquals(o2, o1);
assertEquals(o1.hashCode(), o2.hashCode());
}
-
+
/**
* Tests o1.equals( o2 ) && o2.equals(o1) && o1.hashCode() == o2.hashCode()
*
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TripleStoreProducerInterface.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TripleStoreProducerInterface.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TripleStoreProducerInterface.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TripleStoreProducerInterface.java Sat Sep 7 18:58:59 2013
@@ -1,3 +1,20 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
package com.hp.hpl.jena.testing_framework;
import com.hp.hpl.jena.graph.impl.TripleStore;