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 [1/6] - in
/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena: datatypes/xsd/
graph/ graph/compose/ graph/impl/ shared/ testing_framework/
Author: claude
Date: Sat Sep 7 18:58:59 2013
New Revision: 1520788
URL: http://svn.apache.org/r1520788
Log:
Initial complete implementation of code / graph and sub directories.
Added:
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/AbstractDyadicTest.java (with props)
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DeltaSuite.java (with props)
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DeltaTest.java (with props)
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceSuite.java (with props)
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DifferenceTest.java (with props)
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DisjointUnionSuite.java (with props)
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/DisjointUnionTest.java (with props)
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/IntersectionSuite.java (with props)
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/IntersectionTest.java (with props)
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionReifierTest.java (with props)
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionSuite.java (with props)
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/MultiUnionTest.java (with props)
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/PolyadicPrefixMappingTest.java (with props)
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/UnionTest.java (with props)
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/compose/package-info.java (with props)
Modified:
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/datatypes/xsd/TestDateTime.java
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/AbstractFindLiteralsTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphListenerTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphMakerTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphPrefixMappingTest.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/AbstractGraphTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractRegisterGraphListenerTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphListenerTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphPrefixMappingTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphRegisterListenerTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphReifierTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphSuite.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphTest.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/TestGraphUtils.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/TestNodeToTriplesMap.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestTriple.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestTripleField.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestTypedLiterals.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/CollectionGraphSuite.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/CollectionGraphTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/FileGraphMakerTest.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/graph/impl/FileGraphTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/LiteralLabelsTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/SimpleGraphMakerTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphSuite.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/package-info.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/package-info.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/shared/AbstractPrefixMappingTest.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducer.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/AbstractGraphProducerUser.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
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TestUtils.java
jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/testing_framework/TripleStoreProducerInterface.java
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/datatypes/xsd/TestDateTime.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/datatypes/xsd/TestDateTime.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/datatypes/xsd/TestDateTime.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/datatypes/xsd/TestDateTime.java Sat Sep 7 18:58:59 2013
@@ -21,8 +21,6 @@ package com.hp.hpl.jena.datatypes.xsd;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.Calendar;
-import java.util.GregorianCalendar;
-
import org.junit.Test;
import com.hp.hpl.jena.datatypes.xsd.AbstractDateTime;
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=1520788&r1=1520787&r2=1520788&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 18:58:59 2013
@@ -19,10 +19,7 @@
package com.hp.hpl.jena.graph;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.List;
-import java.util.Set;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -31,17 +28,8 @@ import static org.junit.Assert.*;
import com.hp.hpl.jena.graph.Graph;
import com.hp.hpl.jena.graph.GraphEventManager;
-import com.hp.hpl.jena.graph.GraphEvents;
-import com.hp.hpl.jena.graph.GraphListener;
-import com.hp.hpl.jena.graph.GraphUtil;
-import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.graph.Triple;
-import com.hp.hpl.jena.sparql.graph.GraphFactory;
-import com.hp.hpl.jena.testing_framework.AbstractGraphProducerUser;
import com.hp.hpl.jena.testing_framework.GraphEventManagerProducerInterface;
-import com.hp.hpl.jena.util.CollectionFactory;
-import com.hp.hpl.jena.util.iterator.ExtendedIterator;
-
import static com.hp.hpl.jena.testing_framework.GraphTestUtils.*;
/**
@@ -58,15 +46,14 @@ public abstract class AbstractEventManag
private Graph mockGraph;
private GraphEventManager gem;
-
+
@Before
- public void startup()
- {
- mockGraph = Mockito.mock( Graph.class );
+ public void startup() {
+ mockGraph = Mockito.mock(Graph.class);
gem = getEventManagerProducer().newEventManager();
L = new RecordingListener();
}
-
+
@Test
public void testEventRegister() {
assertSame(gem, gem.register(new RecordingListener()));
@@ -86,30 +73,26 @@ public abstract class AbstractEventManag
protected Triple SPO = NodeCreateUtils.createTriple("S P O");
protected RecordingListener L;
-
-
@Test
public void testAddTriple() {
gem.register(L);
- gem.notifyAddTriple( mockGraph, SPO );
+ gem.notifyAddTriple(mockGraph, SPO);
L.assertHas(new Object[] { "add", mockGraph, SPO });
}
@Test
public void testDeleteTriple() {
gem.register(L);
- gem.notifyDeleteTriple( mockGraph, SPO );
+ gem.notifyDeleteTriple(mockGraph, SPO);
L.assertHas(new Object[] { "delete", mockGraph, SPO });
}
-
-
@Test
public void testTwoListeners() {
RecordingListener L1 = new RecordingListener();
RecordingListener L2 = new RecordingListener();
gem.register(L1).register(L2);
- gem.notifyAddTriple( mockGraph, SPO );
+ gem.notifyAddTriple(mockGraph, SPO);
L2.assertHas(new Object[] { "add", mockGraph, SPO });
L1.assertHas(new Object[] { "add", mockGraph, SPO });
}
@@ -117,96 +100,90 @@ public abstract class AbstractEventManag
@Test
public void testUnregisterWorks() {
gem.register(L).unregister(L);
- gem.notifyAddTriple( mockGraph, SPO );
+ gem.notifyAddTriple(mockGraph, SPO);
L.assertHas(new Object[] {});
}
@Test
public void testRegisterTwice() {
gem.register(L).register(L);
- gem.notifyAddTriple( mockGraph, SPO );
+ gem.notifyAddTriple(mockGraph, SPO);
L.assertHas(new Object[] { "add", mockGraph, SPO, "add", mockGraph, SPO });
}
@Test
public void testUnregisterOnce() {
gem.register(L).register(L).unregister(L);
- gem.notifyDeleteTriple( mockGraph, SPO );
+ gem.notifyDeleteTriple(mockGraph, SPO);
L.assertHas(new Object[] { "delete", mockGraph, SPO });
}
@Test
public void testAddArray() {
gem.register(L);
- gem.notifyAddArray( mockGraph, tripleArray);
+ gem.notifyAddArray(mockGraph, tripleArray);
L.assertHas(new Object[] { "add[]", mockGraph, tripleArray });
}
@Test
public void testAddList() {
gem.register(L);
- List<Triple> elems = Arrays
- .asList(tripleArray);
- gem.notifyAddList( mockGraph, elems);
+ List<Triple> elems = Arrays.asList(tripleArray);
+ gem.notifyAddList(mockGraph, elems);
L.assertHas(new Object[] { "addList", mockGraph, elems });
}
@Test
public void testDeleteArray() {
gem.register(L);
- gem.notifyDeleteArray( mockGraph, tripleArray );
+ gem.notifyDeleteArray(mockGraph, tripleArray);
L.assertHas(new Object[] { "delete[]", mockGraph, tripleArray });
}
@Test
public void testDeleteList() {
gem.register(L);
- List<Triple> elems = Arrays
- .asList(tripleArray);
- gem.notifyDeleteList( mockGraph, elems );
+ List<Triple> elems = Arrays.asList(tripleArray);
+ gem.notifyDeleteList(mockGraph, elems);
L.assertHas(new Object[] { "deleteList", mockGraph, elems });
}
@Test
public void testAddListAsIterator() {
gem.register(L);
- List<Triple> elems = Arrays
- .asList(tripleArray);
- gem.notifyAddIterator( mockGraph, elems );
+ List<Triple> elems = Arrays.asList(tripleArray);
+ gem.notifyAddIterator(mockGraph, elems);
L.assertHas(new Object[] { "addIterator", mockGraph, elems });
}
-
+
@Test
public void testAddIterator() {
gem.register(L);
- List<Triple> elems = Arrays
- .asList(tripleArray);
- gem.notifyAddIterator( mockGraph, elems.iterator() );
+ List<Triple> elems = Arrays.asList(tripleArray);
+ gem.notifyAddIterator(mockGraph, elems.iterator());
L.assertHas(new Object[] { "addIterator", mockGraph, elems });
}
@Test
public void testDeleteIterator() {
gem.register(L);
- List<Triple> elems = Arrays
- .asList(tripleArray);
- gem.notifyDeleteIterator( mockGraph, elems.iterator() );
+ List<Triple> elems = Arrays.asList(tripleArray);
+ gem.notifyDeleteIterator(mockGraph, elems.iterator());
L.assertHas(new Object[] { "deleteIterator", mockGraph, elems });
}
@Test
public void testDeleteListAsIterator() {
gem.register(L);
- List<Triple> elems = Arrays
- .asList(tripleArray);
- gem.notifyDeleteIterator( mockGraph, elems );
+ List<Triple> elems = Arrays.asList(tripleArray);
+ gem.notifyDeleteIterator(mockGraph, elems);
L.assertHas(new Object[] { "deleteIterator", mockGraph, elems });
}
-
+
@Test
public void testAddGraph() {
gem.register(L);
- Graph other = Mockito.mock( Graph.class );
+ Graph other = Mockito.mock(Graph.class);
gem.notifyAddGraph(mockGraph, other);
L.assertHas(new Object[] { "addGraph", mockGraph, other });
}
@@ -214,7 +191,7 @@ public abstract class AbstractEventManag
@Test
public void testDeleteGraph() {
gem.register(L);
- Graph other = Mockito.mock( Graph.class );
+ Graph other = Mockito.mock(Graph.class);
gem.notifyDeleteGraph(mockGraph, other);
L.assertHas(new Object[] { "deleteGraph", mockGraph, other });
}
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractFindLiteralsTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractFindLiteralsTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractFindLiteralsTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractFindLiteralsTest.java Sat Sep 7 18:58:59 2013
@@ -67,16 +67,15 @@ abstract public class AbstractFindLitera
@Test
public void testFind() {
Graph g = graphProducer.newGraph();
-
- if ( !reqLitType || g.getCapabilities().handlesLiteralTyping())
- {
+
+ if (!reqLitType || g.getCapabilities().handlesLiteralTyping()) {
graphWith(g, data);
-
+
Node literal = NodeCreateUtils.create(search);
//
assertEquals("graph has wrong size", size, g.size());
- Set<Node> got = g.find(Node.ANY, Node.ANY, literal).mapWith(getObject)
- .toSet();
+ Set<Node> got = g.find(Node.ANY, Node.ANY, literal)
+ .mapWith(getObject).toSet();
assertEquals(nodeSet(results), got);
}
}
@@ -86,13 +85,13 @@ abstract public class AbstractFindLitera
graphProducer.closeGraphs();
}
-
@Parameters(name = "TestFindLiterals: graph '{'{0}'}' size {1} search {2} expecting '{'{3}'}'")
public static Iterable<Object[]> data() {
Object[][] result = {
{ "a P 'simple'", 1, "'simple'", "'simple'", false },
- { "a P 'simple'xsd:string", 1, "'simple'", "'simple'xsd:string", true },
+ { "a P 'simple'xsd:string", 1, "'simple'",
+ "'simple'xsd:string", true },
{ "a P 'simple'", 1, "'simple'xsd:string", "'simple'", true },
{ "a P 'simple'xsd:string", 1, "'simple'xsd:string",
"'simple'xsd:string", false },
@@ -100,11 +99,13 @@ abstract public class AbstractFindLitera
{ "a P 'simple'; a P 'simple'xsd:string", 2, "'simple'",
"'simple' 'simple'xsd:string", true },
{ "a P 'simple'; a P 'simple'xsd:string", 2,
- "'simple'xsd:string", "'simple' 'simple'xsd:string", true },
+ "'simple'xsd:string", "'simple' 'simple'xsd:string",
+ true },
//
{ "a P 1", 1, "1", "1", false },
- { "a P '1'xsd:float", 1, "'1'xsd:float", "'1'xsd:float" , false},
- { "a P '1'xsd:double", 1, "'1'xsd:double", "'1'xsd:double", false },
+ { "a P '1'xsd:float", 1, "'1'xsd:float", "'1'xsd:float", false },
+ { "a P '1'xsd:double", 1, "'1'xsd:double", "'1'xsd:double",
+ false },
{ "a P '1'xsd:float", 1, "'1'xsd:float", "'1'xsd:float", false },
{ "a P '1.1'xsd:float", 1, "'1'xsd:float", "", false },
{ "a P '1'xsd:double", 1, "'1'xsd:int", "", false },
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphListenerTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphListenerTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphListenerTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphListenerTest.java Sat Sep 7 18:58:59 2013
@@ -18,110 +18,99 @@
package com.hp.hpl.jena.graph;
-
-import static com.hp.hpl.jena.testing_framework.GraphTestUtils.assertContainsAll;
-import static com.hp.hpl.jena.testing_framework.GraphTestUtils.assertOmitsAll;
-import static com.hp.hpl.jena.testing_framework.GraphTestUtils.graphAddTxn;
import static com.hp.hpl.jena.testing_framework.GraphTestUtils.node;
import static com.hp.hpl.jena.testing_framework.GraphTestUtils.triple;
-import static com.hp.hpl.jena.testing_framework.GraphTestUtils.txnBegin;
-import static com.hp.hpl.jena.testing_framework.GraphTestUtils.txnCommit;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Arrays ;
-import java.util.Iterator ;
-import java.util.List ;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
import org.junit.Before;
import org.junit.Test;
-import com.hp.hpl.jena.graph.impl.SimpleBulkUpdateHandler ;
-import com.hp.hpl.jena.mem.GraphMem ;
+import com.hp.hpl.jena.graph.impl.SimpleBulkUpdateHandler;
import com.hp.hpl.jena.sparql.graph.GraphFactory;
import com.hp.hpl.jena.testing_framework.AbstractGraphProducerUser;
import com.hp.hpl.jena.testing_framework.GraphTestUtils;
-import com.hp.hpl.jena.util.iterator.ClosableIterator;
/**
- * Version of graph tests that set up a listener that copies all changes
- * and verifies that after every notification modified graph
- * and original are isomorphic.
+ * Version of graph tests that set up a listener that copies all changes and
+ * verifies that after every notification modified graph and original are
+ * isomorphic.
*/
-public abstract class AbstractGraphListenerTest extends AbstractGraphProducerUser {
-
+public abstract class AbstractGraphListenerTest extends
+ AbstractGraphProducerUser {
+
private Graph base;
private CheckChanges checkChanges;
-
+
@Before
- public void setupListener()
- {
+ public void setupListener() {
base = getGraphProducer().newGraph();
checkChanges = new CheckChanges("", base, getGraphProducer().newGraph());
- base.getEventManager().register( checkChanges );
+ base.getEventManager().register(checkChanges);
}
-
+
/**
- * A listener to check that a graph is being tracked
- * correctly by its events.
+ * A listener to check that a graph is being tracked correctly by its
+ * events.
*/
protected class CheckChanges implements GraphListener {
private Graph copy, original;
private String desc;
-
+
public CheckChanges(String description, Graph g, Graph c) {
original = g;
copy = c;
}
-
- public void setDescription( String desc )
- {
+
+ public void setDescription(String desc) {
this.desc = desc;
}
-
protected void verify() {
- GraphTestUtils.assertIsomorphic(desc+" has not been tracked correctly. [delegating,copy-from-listener]",
- original, copy
- );
+ GraphTestUtils
+ .assertIsomorphic(
+ desc
+ + " has not been tracked correctly. [delegating,copy-from-listener]",
+ original, copy);
}
@Override
- public void notifyAddIterator(Graph g, Iterator<Triple> it) {
- while (it.hasNext()) copy.add(it.next());
- verify();
- }
+ public void notifyAddIterator(Graph g, Iterator<Triple> it) {
+ while (it.hasNext())
+ copy.add(it.next());
+ verify();
+ }
@Override
- public void notifyAddTriple(Graph g, Triple t) {
+ public void notifyAddTriple(Graph g, Triple t) {
copy.add(t);
verify();
}
@Override
- public void notifyDeleteIterator(Graph g, Iterator<Triple> it) {
- while (it.hasNext()) copy.delete(it.next());
+ public void notifyDeleteIterator(Graph g, Iterator<Triple> it) {
+ while (it.hasNext())
+ copy.delete(it.next());
verify();
}
-
@Override
- public void notifyDeleteTriple(Graph g, Triple t) {
+ public void notifyDeleteTriple(Graph g, Triple t) {
copy.delete(t);
verify();
}
@Override
- public void notifyEvent(Graph source, Object value) {
+ public void notifyEvent(Graph source, Object value) {
if (value instanceof GraphEvents) {
if (GraphEvents.removeAll.equals(value)) {
- notifyRemoveAll(source,Triple.ANY);
+ notifyRemoveAll(source, Triple.ANY);
} else {
- GraphEvents event = (GraphEvents)value;
+ GraphEvents event = (GraphEvents) value;
if ("remove".equals(event.getTitle())) {
- notifyRemoveAll(source,(Triple)event.getContent());
+ notifyRemoveAll(source, (Triple) event.getContent());
}
}
}
@@ -129,204 +118,164 @@ public abstract class AbstractGraphListe
}
public void notifyRemoveAll(Graph source, Triple t) {
- SimpleBulkUpdateHandler.removeAll(copy, t.getSubject(), t.getPredicate(), t.getObject());
+ SimpleBulkUpdateHandler.removeAll(copy, t.getSubject(),
+ t.getPredicate(), t.getObject());
verify();
-
- }
+ }
@Override
- public void notifyAddList(Graph g, List<Triple> triples) {
+ public void notifyAddList(Graph g, List<Triple> triples) {
notifyAddIterator(g, triples.iterator());
}
-
@Override
- public void notifyDeleteArray(Graph g, Triple[] triples) {
- notifyDeleteIterator(g,Arrays.asList(triples).iterator());
+ public void notifyDeleteArray(Graph g, Triple[] triples) {
+ notifyDeleteIterator(g, Arrays.asList(triples).iterator());
}
@Override
- public void notifyAddArray(Graph g, Triple[] triples) {
- notifyAddIterator(g,Arrays.asList(triples).iterator());
+ public void notifyAddArray(Graph g, Triple[] triples) {
+ notifyAddIterator(g, Arrays.asList(triples).iterator());
}
+
@Override
- public void notifyAddGraph(Graph g, Graph added) {
- notifyAddIterator(g,added.find(Triple.ANY));
+ public void notifyAddGraph(Graph g, Graph added) {
+ notifyAddIterator(g, added.find(Triple.ANY));
}
-
-
@Override
- public void notifyDeleteGraph(Graph g, Graph removed) {
- notifyDeleteIterator(g,removed.find(Triple.ANY));
+ public void notifyDeleteGraph(Graph g, Graph removed) {
+ notifyDeleteIterator(g, removed.find(Triple.ANY));
}
-
-
@Override
- public void notifyDeleteList(Graph g, List<Triple> list) {
+ public void notifyDeleteList(Graph g, List<Triple> list) {
notifyDeleteIterator(g, list.iterator());
}
-
}
-
+
@Test
public void testAddArray() {
- Triple[] triples = {
- triple( "a b c" ),
- triple( "_a _b _c" ),
- triple( "1 2 3" )
- };
- checkChanges.setDescription( "Add array");
+ Triple[] triples = { triple("a b c"), triple("_a _b _c"),
+ triple("1 2 3") };
+ checkChanges.setDescription("Add array");
BulkUpdateHandler buh = base.getBulkUpdateHandler();
buh.add(triples);
}
-
+
@Test
public void testAddGraph() {
Graph arg = GraphFactory.createGraphMem();
GraphTestUtils.graphAdd(arg, "a b c; _a _b_ c; 1 2 3 ");
-
- checkChanges.setDescription( "Add graph");
+
+ checkChanges.setDescription("Add graph");
BulkUpdateHandler buh = base.getBulkUpdateHandler();
buh.add(arg);
}
-
+
@Test
public void testAddIterator() {
- Triple[] triples = {
- triple( "a b c" ),
- triple( "_a _b _c" ),
- triple( "1 2 3" )
- };
-
- checkChanges.setDescription( "Add iterator");
+ Triple[] triples = { triple("a b c"), triple("_a _b _c"),
+ triple("1 2 3") };
+
+ checkChanges.setDescription("Add iterator");
BulkUpdateHandler buh = base.getBulkUpdateHandler();
- buh.add( Arrays.asList(triples).iterator());
+ buh.add(Arrays.asList(triples).iterator());
}
-
+
@Test
public void testAddList() {
- Triple[] triples = {
- triple( "a b c" ),
- triple( "_a _b _c" ),
- triple( "1 2 3" )
- };
-
- checkChanges.setDescription( "Add list");
+ Triple[] triples = { triple("a b c"), triple("_a _b _c"),
+ triple("1 2 3") };
+
+ checkChanges.setDescription("Add list");
BulkUpdateHandler buh = base.getBulkUpdateHandler();
- buh.add( Arrays.asList(triples));
+ buh.add(Arrays.asList(triples));
}
-
+
@Test
public void testAddTriple() {
- checkChanges.setDescription( "Add triple");
- base.add( triple( "_a b 1"));
+ checkChanges.setDescription("Add triple");
+ base.add(triple("_a b 1"));
}
-
+
@Test
public void deleteAddArray() {
- Triple[] add = {
- triple( "a b c" ),
- triple( "_a _b _c" ),
- triple( "1 2 3" ),
- triple( "_a b 1")
- };
- Triple[] remove = {
- triple( "a b c" ),
- triple( "_a _b _c" ),
- triple( "1 2 3" )
- };
- checkChanges.setDescription( "Delete array");
+ Triple[] add = { triple("a b c"), triple("_a _b _c"), triple("1 2 3"),
+ triple("_a b 1") };
+ Triple[] remove = { triple("a b c"), triple("_a _b _c"),
+ triple("1 2 3") };
+ checkChanges.setDescription("Delete array");
BulkUpdateHandler buh = base.getBulkUpdateHandler();
buh.add(add);
- buh.delete( remove );
+ buh.delete(remove);
}
-
+
@Test
public void testRemoveGraph() {
Graph add = GraphFactory.createGraphMem();
GraphTestUtils.graphAdd(add, "a b c; _a _b_ c; 1 2 3; _a b 3");
Graph remove = GraphFactory.createGraphMem();
GraphTestUtils.graphAdd(remove, "a b c; _a _b_ c; 1 2 3 ");
- checkChanges.setDescription( "Remove graph");
+ checkChanges.setDescription("Remove graph");
BulkUpdateHandler buh = base.getBulkUpdateHandler();
buh.add(add);
- buh.delete( remove);
+ buh.delete(remove);
}
-
+
@Test
public void testRemoveIterator() {
- Triple[] add = {
- triple( "a b c" ),
- triple( "_a _b _c" ),
- triple( "1 2 3" ),
- triple( "_a b 1")
- };
- Triple[] remove = {
- triple( "a b c" ),
- triple( "_a _b _c" ),
- triple( "1 2 3" )
- };
-
- checkChanges.setDescription( "Remove iterator");
+ Triple[] add = { triple("a b c"), triple("_a _b _c"), triple("1 2 3"),
+ triple("_a b 1") };
+ Triple[] remove = { triple("a b c"), triple("_a _b _c"),
+ triple("1 2 3") };
+
+ checkChanges.setDescription("Remove iterator");
BulkUpdateHandler buh = base.getBulkUpdateHandler();
- buh.add( add );
- buh.add( Arrays.asList(remove).iterator());
+ buh.add(add);
+ buh.add(Arrays.asList(remove).iterator());
}
-
+
@Test
public void testRemoveList() {
-
- Triple[] add = {
- triple( "a b c" ),
- triple( "_a _b _c" ),
- triple( "1 2 3" ),
- triple( "_a b 1")
- };
- Triple[] remove = {
- triple( "a b c" ),
- triple( "_a _b _c" ),
- triple( "1 2 3" )
- };
-
- checkChanges.setDescription( "Remove list");
+
+ Triple[] add = { triple("a b c"), triple("_a _b _c"), triple("1 2 3"),
+ triple("_a b 1") };
+ Triple[] remove = { triple("a b c"), triple("_a _b _c"),
+ triple("1 2 3") };
+
+ checkChanges.setDescription("Remove list");
BulkUpdateHandler buh = base.getBulkUpdateHandler();
- buh.add( add );
- buh.add( Arrays.asList(remove));
+ buh.add(add);
+ buh.add(Arrays.asList(remove));
}
-
+
@Test
public void testRemoveTriple() {
- checkChanges.setDescription( "Remove triple");
- base.add( triple( "_a b 1"));
- base.delete(triple( "_a b 1"));
+ checkChanges.setDescription("Remove triple");
+ base.add(triple("_a b 1"));
+ base.delete(triple("_a b 1"));
}
-
+
@Test
public void testRemoveTripleAsNodes() {
- checkChanges.setDescription( "Remove triple");
- base.add( triple( "_a b 1"));
- base.remove( node("_a"), node("b"), node("1"));
+ checkChanges.setDescription("Remove triple");
+ base.add(triple("_a b 1"));
+ base.remove(node("_a"), node("b"), node("1"));
}
-
+
@Test
public void testRemoveAll() {
-
- Triple[] add = {
- triple( "a b c" ),
- triple( "_a _b _c" ),
- triple( "1 2 3" ),
- triple( "_a b 1")
- };
-
-
- checkChanges.setDescription( "Remove list");
+
+ Triple[] add = { triple("a b c"), triple("_a _b _c"), triple("1 2 3"),
+ triple("_a b 1") };
+
+ checkChanges.setDescription("Remove list");
BulkUpdateHandler buh = base.getBulkUpdateHandler();
- buh.add( add );
+ buh.add(add);
base.clear();
- }
-
+ }
+
}
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphMakerTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphMakerTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphMakerTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphMakerTest.java Sat Sep 7 18:58:59 2013
@@ -83,7 +83,8 @@ public abstract class AbstractGraphMaker
public void testAnyName() {
graphMaker.createGraph("plain").close();
graphMaker.createGraph("with.dot").close();
- graphMaker.createGraph("http://electric-hedgehog.net/topic#marker").close();
+ graphMaker.createGraph("http://electric-hedgehog.net/topic#marker")
+ .close();
}
/**
@@ -253,7 +254,8 @@ public abstract class AbstractGraphMaker
Graph Y = graphMaker.createGraph(y);
Graph Z = graphMaker.createGraph(z);
Set<String> wanted = TestUtils.setOfStrings(x + " " + y + " " + z);
- assertEquals(wanted, GraphTestUtils.iteratorToSet(graphMaker.listGraphs()));
+ assertEquals(wanted,
+ GraphTestUtils.iteratorToSet(graphMaker.listGraphs()));
X.close();
Y.close();
Z.close();
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphPrefixMappingTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphPrefixMappingTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphPrefixMappingTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphPrefixMappingTest.java Sat Sep 7 18:58:59 2013
@@ -21,37 +21,33 @@ package com.hp.hpl.jena.graph;
import static org.junit.Assert.*;
import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
-import com.hp.hpl.jena.graph.Factory;
import com.hp.hpl.jena.graph.Graph;
import com.hp.hpl.jena.shared.AbstractPrefixMappingTest;
import com.hp.hpl.jena.shared.PrefixMapping;
-import com.hp.hpl.jena.sparql.graph.GraphFactory;
import com.hp.hpl.jena.testing_framework.GraphProducerUserInterface;
-public abstract class AbstractGraphPrefixMappingTest extends AbstractPrefixMappingTest implements GraphProducerUserInterface
- {
-
+public abstract class AbstractGraphPrefixMappingTest extends
+ AbstractPrefixMappingTest implements GraphProducerUserInterface {
+
@After
- public void teardown()
- {
+ public void teardown() {
getGraphProducer().closeGraphs();
}
-
- protected PrefixMapping getMapping() {
- return getGraphProducer().newGraph().getPrefixMapping();
- }
-
- @Test
- public void testGraphPrefixMapping()
- {
- Graph g = getGraphProducer().newGraph();
- PrefixMapping pm = g.getPrefixMapping();
- pm.setNsPrefix( "crisp", crispURI );
- pm.setNsPrefix( "butter", butterURI );
-
- assertTrue( pm == g.getPrefixMapping() );
- }
- }
+
+ @Override
+ protected PrefixMapping getMapping() {
+ return getGraphProducer().newGraph().getPrefixMapping();
+ }
+
+ @Test
+ public void testGraphPrefixMapping() {
+ Graph g = getGraphProducer().newGraph();
+ PrefixMapping pm = g.getPrefixMapping();
+ pm.setNsPrefix("crisp", crispURI);
+ pm.setNsPrefix("butter", butterURI);
+
+ assertTrue(pm == g.getPrefixMapping());
+ }
+}
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=1520788&r1=1520787&r2=1520788&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 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.graph;
import static com.hp.hpl.jena.testing_framework.GraphTestUtils.node;
@@ -6,16 +23,11 @@ import static org.junit.Assert.assertTru
import org.junit.Ignore;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.junit.runners.Suite;
-import org.mockito.Mockito;
-
-import com.hp.hpl.jena.graph.impl.SimpleEventManager;
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 ) );
@@ -25,7 +37,7 @@ import com.hp.hpl.jena.util.iterator.Ext
result.addTest( TestGraphListener.suite() );
result.addTestSuite( TestRegisterGraphListener.class );
*/
-@RunWith(Suite.class)
+
@Suite.SuiteClasses({ AbstractGraphSuite.GraphTest.class,
AbstractGraphSuite.ReifierTest.class,
AbstractGraphSuite.FindLiterals.class,
@@ -34,7 +46,7 @@ import com.hp.hpl.jena.util.iterator.Ext
AbstractGraphSuite.TransactionTest.class,
AbstractGraphSuite.RegisterListenerTest.class,
AbstractGraphSuite.ListenerTest.class,
- AbstractGraphSuite.PrefixMappingTest.class})
+ AbstractGraphSuite.PrefixMappingTest.class })
@Ignore
public abstract class AbstractGraphSuite {
@@ -59,7 +71,8 @@ public abstract class AbstractGraphSuite
}
public static class FindLiterals extends AbstractFindLiteralsTest {
- public FindLiterals(String data, int size, String search, String results, boolean litReq) {
+ public FindLiterals(String data, int size, String search,
+ String results, boolean litReq) {
super(data, size, search, results, litReq);
AbstractFindLiteralsTest.graphProducer = AbstractGraphSuite.graphProducer;
}
@@ -72,7 +85,6 @@ public abstract class AbstractGraphSuite
}
}
-
public static class EventManagerTest extends AbstractEventManagerTest {
@Override
protected GraphEventManagerProducerInterface getEventManagerProducer() {
@@ -80,11 +92,12 @@ public abstract class AbstractGraphSuite
@Override
public GraphEventManager newEventManager() {
- return AbstractGraphSuite.graphProducer.newGraph().getEventManager();
+ return AbstractGraphSuite.graphProducer.newGraph()
+ .getEventManager();
}
};
}
-
+
/**
* Utility: get a graph, register L with its manager, return the graph.
*/
@@ -93,7 +106,7 @@ public abstract class AbstractGraphSuite
g.getEventManager().register(gl);
return g;
}
-
+
@Test
public void testRemoveAllEvent() {
Graph g = getAndRegister(L);
@@ -109,9 +122,10 @@ public abstract class AbstractGraphSuite
Object event = GraphEvents.remove(S, P, O);
L.assertHas(new Object[] { "someEvent", g, event });
}
+
/**
- * Ensure that triples removed by calling .remove() on the iterator returned
- * by a find() will generate deletion notifications.
+ * Ensure that triples removed by calling .remove() on the iterator
+ * returned by a find() will generate deletion notifications.
*/
@Test
public void testEventDeleteByFind() {
@@ -136,26 +150,28 @@ public abstract class AbstractGraphSuite
return AbstractGraphSuite.graphProducer;
}
}
-
- public static class RegisterListenerTest extends AbstractRegisterGraphListenerTest {
+
+ public static class RegisterListenerTest extends
+ AbstractRegisterGraphListenerTest {
@Override
public GraphProducerInterface getGraphProducer() {
return AbstractGraphSuite.graphProducer;
}
}
-
+
public static class ListenerTest extends AbstractGraphListenerTest {
@Override
public GraphProducerInterface getGraphProducer() {
return AbstractGraphSuite.graphProducer;
}
}
-
- public static class PrefixMappingTest extends AbstractGraphPrefixMappingTest {
+
+ public static class PrefixMappingTest extends
+ AbstractGraphPrefixMappingTest {
@Override
public GraphProducerInterface getGraphProducer() {
return AbstractGraphSuite.graphProducer;
}
}
-
+
}
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractGraphTest.java Sat Sep 7 18:58:59 2013
@@ -124,16 +124,16 @@ public abstract class AbstractGraphTest
@Test
public void testContainsConcrete() {
- Graph g = graphWithTxn( "s P o; _x _R _y; x S 0" );
- assertTrue( g.contains( triple( "s P o" ) ) );
- assertTrue( g.contains( triple( "_x _R _y" ) ) );
- assertTrue( g.contains( triple( "x S 0" ) ) );
- /* */
- assertFalse( g.contains( triple( "s P Oh" ) ) );
- assertFalse( g.contains( triple( "S P O" ) ) );
- assertFalse( g.contains( triple( "s p o" ) ) );
- assertFalse( g.contains( triple( "_x _r _y" ) ) );
- assertFalse( g.contains( triple( "x S 1" ) ) );
+ Graph g = graphWithTxn("s P o; _x _R _y; x S 0");
+ assertTrue(g.contains(triple("s P o")));
+ assertTrue(g.contains(triple("_x _R _y")));
+ assertTrue(g.contains(triple("x S 0")));
+ /* */
+ assertFalse(g.contains(triple("s P Oh")));
+ assertFalse(g.contains(triple("S P O")));
+ assertFalse(g.contains(triple("s p o")));
+ assertFalse(g.contains(triple("_x _r _y")));
+ assertFalse(g.contains(triple("x S 1")));
}
@Test
@@ -568,7 +568,7 @@ public abstract class AbstractGraphTest
*/
@Test
public void testContainsNode() {
- Graph g = graphWithTxn( "a P b; _c p1 _D; a P2 12");
+ Graph g = graphWithTxn("a P b; _c p1 _D; a P2 12");
assertTrue(containsNode(g, node("a")));
assertTrue(containsNode(g, node("P")));
assertTrue(containsNode(g, node("b")));
@@ -576,7 +576,7 @@ public abstract class AbstractGraphTest
assertTrue(containsNode(g, node("p1")));
assertTrue(containsNode(g, node("_D")));
// assertTrue( qh.containsNode( node( "10" ) ) );
- //assertTrue(containsNode(g, node("11")));
+ // assertTrue(containsNode(g, node("11")));
assertTrue(containsNode(g, node("12")));
/* */
assertFalse(containsNode(g, node("x")));
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractRegisterGraphListenerTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractRegisterGraphListenerTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractRegisterGraphListenerTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/AbstractRegisterGraphListenerTest.java Sat Sep 7 18:58:59 2013
@@ -29,156 +29,173 @@ import org.junit.Test;
import com.hp.hpl.jena.graph.Graph;
import com.hp.hpl.jena.graph.GraphListener;
import com.hp.hpl.jena.graph.Triple;
-import com.hp.hpl.jena.sparql.graph.GraphFactory;
import com.hp.hpl.jena.testing_framework.AbstractGraphProducerUser;
import com.hp.hpl.jena.testing_framework.GraphTestUtils;
/**
- * These tests are for listeners that add or delete
- * other listeners.
- * It motivates the use of, e.g. CopyOnWriteArrayList
- * for storing listeners.
+ * These tests are for listeners that add or delete other listeners. It
+ * motivates the use of, e.g. CopyOnWriteArrayList for storing listeners.
*/
-public abstract class AbstractRegisterGraphListenerTest extends AbstractGraphProducerUser {
+public abstract class AbstractRegisterGraphListenerTest extends
+ AbstractGraphProducerUser {
private ComeAndGoListener all[];
- private Graph graph;
-
+ private Graph graph;
+
private static final class SimpleListener extends ComeAndGoListener {
@Override
- void doSomeDamage() {}
+ void doSomeDamage() {
+ }
}
@Before
- public void setup()
- {
+ public void setup() {
graph = getGraphProducer().newGraph();
}
-
+
abstract private static class ComeAndGoListener implements GraphListener {
- // Was I registered when start() was called, and have not been unregistered.
+ // Was I registered when start() was called, and have not been
+ // unregistered.
boolean inPlay = false;
// currently registered or not.
boolean registered = false;
boolean notified = false;
+
void registerWith(Graph g) {
- registered= true;
- g.getEventManager().register(this);
+ registered = true;
+ g.getEventManager().register(this);
}
+
void unregisterFrom(Graph g) {
registered = false;
inPlay = false;
g.getEventManager().unregister(this);
}
+
void start() {
- if (registered) inPlay = true;
+ if (registered)
+ inPlay = true;
}
+
void check() {
- if (inPlay && !notified) fail("listener that was in-play was not notified of adding triple.");
+ if (inPlay && !notified)
+ fail("listener that was in-play was not notified of adding triple.");
}
-
- @Override
- final public void notifyAddTriple(Graph g, Triple t) {
+
+ @Override
+ final public void notifyAddTriple(Graph g, Triple t) {
notified = true;
doSomeDamage();
}
+
abstract void doSomeDamage();
-
+
@Override
- public void notifyAddArray(Graph g, Triple[] triples) {}
+ public void notifyAddArray(Graph g, Triple[] triples) {
+ }
+
@Override
- public void notifyAddGraph(Graph g, Graph added) {}
+ public void notifyAddGraph(Graph g, Graph added) {
+ }
+
@Override
- public void notifyAddIterator(Graph g, Iterator<Triple> it) {}
+ public void notifyAddIterator(Graph g, Iterator<Triple> it) {
+ }
+
@Override
- public void notifyAddList(Graph g, List<Triple> triples) {}
+ public void notifyAddList(Graph g, List<Triple> triples) {
+ }
+
@Override
- public void notifyDeleteArray(Graph g, Triple[] triples) {}
+ public void notifyDeleteArray(Graph g, Triple[] triples) {
+ }
+
@Override
- public void notifyDeleteGraph(Graph g, Graph removed) {}
+ public void notifyDeleteGraph(Graph g, Graph removed) {
+ }
+
@Override
- public void notifyDeleteIterator(Graph g, Iterator<Triple> it) {}
+ public void notifyDeleteIterator(Graph g, Iterator<Triple> it) {
+ }
+
@Override
- public void notifyDeleteList(Graph g, List<Triple> L) {}
+ public void notifyDeleteList(Graph g, List<Triple> L) {
+ }
+
@Override
- public void notifyDeleteTriple(Graph g, Triple t) {}
+ public void notifyDeleteTriple(Graph g, Triple t) {
+ }
+
@Override
- public void notifyEvent(Graph source, Object value) {}
-
+ public void notifyEvent(Graph source, Object value) {
+ }
+
}
-
-
- private void testAddingTriple(int addMe, ComeAndGoListener ...allx) {
+
+ private void testAddingTriple(int addMe, ComeAndGoListener... allx) {
all = allx;
- for (int i=0;i<addMe;i++) {
- all[i].registerWith(graph);
+ for (int i = 0; i < addMe; i++) {
+ all[i].registerWith(graph);
} // 4 is unregistered.
- for (ComeAndGoListener l:all) {
+ for (ComeAndGoListener l : all) {
l.start();
}
- graph.add(GraphTestUtils.triple("make a change" ));
- for (ComeAndGoListener l:all) {
+ graph.add(GraphTestUtils.triple("make a change"));
+ for (ComeAndGoListener l : all) {
l.check();
}
}
-
+
@Test
public void testAddOne() {
- testAddingTriple(2,
- new ComeAndGoListener(){
- @Override
- void doSomeDamage() {
- all[2].registerWith(graph);
- }},
- new SimpleListener(),
- new SimpleListener());
+ testAddingTriple(2, new ComeAndGoListener() {
+ @Override
+ void doSomeDamage() {
+ all[2].registerWith(graph);
+ }
+ }, new SimpleListener(), new SimpleListener());
}
-
+
@Test
public void testDelete2nd() {
- testAddingTriple(3,
- new ComeAndGoListener(){
- @Override
- void doSomeDamage() {
- all[1].unregisterFrom(graph);
- }},
- new SimpleListener(),
- new SimpleListener());
+ testAddingTriple(3, new ComeAndGoListener() {
+ @Override
+ void doSomeDamage() {
+ all[1].unregisterFrom(graph);
+ }
+ }, new SimpleListener(), new SimpleListener());
}
+
@Test
public void testDelete1st() {
- testAddingTriple(3,
- new SimpleListener(),
- new ComeAndGoListener(){
- @Override
- void doSomeDamage() {
- all[0].unregisterFrom(graph);
- }},
- new SimpleListener());
+ testAddingTriple(3, new SimpleListener(), new ComeAndGoListener() {
+ @Override
+ void doSomeDamage() {
+ all[0].unregisterFrom(graph);
+ }
+ }, new SimpleListener());
}
+
@Test
public void testDeleteSelf() {
- testAddingTriple(3,
- new ComeAndGoListener(){
- @Override
- void doSomeDamage() {
- unregisterFrom(graph);
- }},
- new SimpleListener(),
- new SimpleListener());
+ testAddingTriple(3, new ComeAndGoListener() {
+ @Override
+ void doSomeDamage() {
+ unregisterFrom(graph);
+ }
+ }, new SimpleListener(), new SimpleListener());
}
+
@Test
public void testDeleteAndAddSelf() {
- testAddingTriple(3,
- new ComeAndGoListener(){
- @Override
- void doSomeDamage() {
- unregisterFrom(graph);
- registerWith(graph);
- }},
- new SimpleListener(),
- new SimpleListener());
+ testAddingTriple(3, new ComeAndGoListener() {
+ @Override
+ void doSomeDamage() {
+ unregisterFrom(graph);
+ registerWith(graph);
+ }
+ }, new SimpleListener(), new SimpleListener());
}
}
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphListenerTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphListenerTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphListenerTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphListenerTest.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.graph;
import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphPrefixMappingTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphPrefixMappingTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphPrefixMappingTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphPrefixMappingTest.java Sat Sep 7 18:58:59 2013
@@ -18,26 +18,14 @@
package com.hp.hpl.jena.graph;
-import static org.junit.Assert.*;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.hp.hpl.jena.graph.Factory;
-import com.hp.hpl.jena.graph.Graph;
-import com.hp.hpl.jena.shared.AbstractPrefixMappingTest;
-import com.hp.hpl.jena.shared.PrefixMapping;
-import com.hp.hpl.jena.sparql.graph.GraphFactory;
import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
-public class MemGraphPrefixMappingTest extends AbstractGraphPrefixMappingTest
- {
- private GraphProducerInterface graphProducer = new MemGraphSuite.GraphProducer();
+public class MemGraphPrefixMappingTest extends AbstractGraphPrefixMappingTest {
+ private GraphProducerInterface graphProducer = new MemGraphSuite.GraphProducer();
@Override
public GraphProducerInterface getGraphProducer() {
return graphProducer;
}
-
+
}
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphRegisterListenerTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphRegisterListenerTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphRegisterListenerTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphRegisterListenerTest.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.graph;
import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
-public class MemGraphRegisterListenerTest extends AbstractRegisterGraphListenerTest {
+public class MemGraphRegisterListenerTest extends
+ AbstractRegisterGraphListenerTest {
GraphProducerInterface graphProducer = new MemGraphSuite.GraphProducer();
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphReifierTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphReifierTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphReifierTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphReifierTest.java Sat Sep 7 18:58:59 2013
@@ -18,30 +18,20 @@
package com.hp.hpl.jena.graph;
-import java.lang.reflect.Constructor ;
-
-import junit.framework.TestSuite ;
-
-import com.hp.hpl.jena.graph.Graph ;
-import com.hp.hpl.jena.mem.GraphMem ;
-import com.hp.hpl.jena.shared.JenaException ;
import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
/**
- This class tests the reifiers of ordinary GraphMem graphs.
- Old test suite - kept to ensure compatibility for teh one and only Standard mode
-*/
-
-public class MemGraphReifierTest extends AbstractReifierTest
- {
-
+ * This class tests the reifiers of ordinary GraphMem graphs. Old test suite -
+ * kept to ensure compatibility for teh one and only Standard mode
+ */
+
+public class MemGraphReifierTest extends AbstractReifierTest {
+
GraphProducerInterface graphProducer = new MemGraphSuite.GraphProducer();
@Override
public GraphProducerInterface getGraphProducer() {
return graphProducer;
}
-
-
-
+
}
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphSuite.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphSuite.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphSuite.java Sat Sep 7 18:58:59 2013
@@ -1,10 +1,30 @@
+/*
+ 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;
import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
import com.hp.hpl.jena.sparql.graph.GraphFactory;
import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+@RunWith(Suite.class)
public class MemGraphSuite extends AbstractGraphSuite {
@BeforeClass
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphTest.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/MemGraphTest.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.graph;
import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
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=1520788&r1=1520787&r2=1520788&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 18:58:59 2013
@@ -23,25 +23,21 @@ import com.hp.hpl.jena.rdf.model.*;
import junit.framework.*;
/**
- Test that an inferred graph and an identical concrete graph
- compare as equal.
-*/
+ * 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/TestGraphUtils.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphUtils.java?rev=1520788&r1=1520787&r2=1520788&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphUtils.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/TestGraphUtils.java Sat Sep 7 18:58:59 2013
@@ -25,34 +25,31 @@ import org.junit.Test;
import com.hp.hpl.jena.graph.impl.GraphBase;
import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+public class TestGraphUtils {
+ private static class Bool {
+ boolean value;
-public class TestGraphUtils
- {
-
- private static class Bool
- {
- boolean value;
- Bool( boolean value ) { this.value = value; }
- }
-
- @Test
- public void testFindAll()
- {
- final Bool foundAll = new Bool( false );
- Graph mock = new GraphBase()
- {
- @Override public ExtendedIterator<Triple> graphBaseFind( TripleMatch m )
- {
- Triple t = m.asTriple();
- assertEquals( Node.ANY, t.getSubject() );
- assertEquals( Node.ANY, t.getPredicate() );
- assertEquals( Node.ANY, t.getObject() );
- foundAll.value = true;
- return null;
- }
- };
- GraphUtil.findAll( mock );
- assertTrue( "find(ANY, ANY, ANY) called", foundAll.value );
- }
- }
+ Bool(boolean value) {
+ this.value = value;
+ }
+ }
+
+ @Test
+ public void testFindAll() {
+ final Bool foundAll = new Bool(false);
+ Graph mock = new GraphBase() {
+ @Override
+ public ExtendedIterator<Triple> graphBaseFind(TripleMatch m) {
+ Triple t = m.asTriple();
+ assertEquals(Node.ANY, t.getSubject());
+ assertEquals(Node.ANY, t.getPredicate());
+ assertEquals(Node.ANY, t.getObject());
+ foundAll.value = true;
+ return null;
+ }
+ };
+ GraphUtil.findAll(mock);
+ assertTrue("find(ANY, ANY, ANY) called", foundAll.value);
+ }
+}