jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cla...@apache.org
Subject svn commit: r1555607 - in /jena/Experimental/jena-rmi: jena-rmi-client/src/test/java/og/ jena-rmi-client/src/test/java/org/ jena-rmi-client/src/test/java/org/apache/ jena-rmi-client/src/test/java/org/apache/jena/ jena-rmi-client/src/test/java/org/apach...
Date Sun, 05 Jan 2014 18:36:04 GMT
Author: claude
Date: Sun Jan  5 18:36:03 2014
New Revision: 1555607

URL: http://svn.apache.org/r1555607
Log:
Fixed package name

Added:
    jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/
    jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/
    jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/
    jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/rmi/
    jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/rmi/client/
    jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/rmi/client/GraphEventManagerTest.java
  (with props)
    jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/rmi/client/GraphTest.java
  (with props)
Removed:
    jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/og/
Modified:
    jena/Experimental/jena-rmi/jena-rmi-server/   (props changed)

Added: jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/rmi/client/GraphEventManagerTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/rmi/client/GraphEventManagerTest.java?rev=1555607&view=auto
==============================================================================
--- jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/rmi/client/GraphEventManagerTest.java
(added)
+++ jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/rmi/client/GraphEventManagerTest.java
Sun Jan  5 18:36:03 2014
@@ -0,0 +1,101 @@
+package org.apache.jena.rmi.client;
+
+import java.rmi.NotBoundException;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.util.Iterator;
+
+import org.apache.jena.rmi.shared.RMI_Graph;
+import org.apache.jena.rmi.shared.RMI_GraphEventManager;
+import org.apache.jena.rmi.shared.RMI_GraphListener;
+import org.apache.jena.rmi.shared.remote.GraphExistsException;
+import org.apache.jena.rmi.shared.remote.RemoteGraph;
+import org.apache.jena.rmi.shared.remote.RemoteGraphEngine;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.xenei.junit.contract.Contract.Inject;
+import org.xenei.junit.contract.ContractImpl;
+import org.xenei.junit.contract.ContractSuite;
+import org.xenei.junit.contract.ContractTest;
+import org.xenei.junit.contract.IProducer;
+
+import static org.junit.Assert.*;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.GraphStatisticsHandler;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Node_URI;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.mem.GraphMem;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+import static com.hp.hpl.jena.testing_framework.GraphHelper.*;
+
+@RunWith(ContractSuite.class)
+@ContractImpl(RMI_GraphEventManager.class)
+public class GraphEventManagerTest {
+
+	static RemoteGraphEngine graphEngine;
+
+	@BeforeClass
+	public static void beforeClass() throws Exception {
+		if (System.getSecurityManager() == null) {
+			System.setSecurityManager(new SecurityManager());
+		}
+
+		String name = "GraphEngine";
+		Registry registry = LocateRegistry.getRegistry();
+		graphEngine = (RemoteGraphEngine) registry.lookup(name);
+
+	}
+
+	protected IProducer<RMI_GraphEventManager> eventManagerProducer = new IProducer<RMI_GraphEventManager>()
{
+
+		private RemoteGraph rGraph;
+
+		private RemoteGraph getRemoteGraph() throws RemoteException {
+			if (rGraph == null)
+			{
+				try {
+					rGraph = graphEngine.createGraph("test0" );
+				}
+				catch (GraphExistsException e)
+				{
+					rGraph = graphEngine.getGraph("test0");
+				}
+			}
+			return rGraph;
+		}
+
+		@Override
+		public RMI_GraphEventManager newInstance() {
+			try {
+				return new RMI_GraphEventManager(
+						getRemoteGraph().getEventManager());
+			} catch (RemoteException e) {
+				throw new RuntimeException( e );
+			} catch (NotBoundException e) {
+				throw new RuntimeException( e );
+			}
+		}
+
+		@Override
+		public void cleanUp() {
+			if (rGraph != null)
+			{
+				try {
+					graphEngine.destroyGraph("test0" );
+				} catch (RemoteException e) {
+					// do nothing.
+				}
+			}
+		}
+
+	};
+
+	@Inject
+	public IProducer<RMI_GraphEventManager> getGraphProducer() {
+		return eventManagerProducer;
+	}
+
+	
+}
\ No newline at end of file

Propchange: jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/rmi/client/GraphEventManagerTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/rmi/client/GraphTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/rmi/client/GraphTest.java?rev=1555607&view=auto
==============================================================================
--- jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/rmi/client/GraphTest.java
(added)
+++ jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/rmi/client/GraphTest.java
Sun Jan  5 18:36:03 2014
@@ -0,0 +1,131 @@
+package org.apache.jena.rmi.client;
+
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.util.Iterator;
+
+import org.apache.jena.rmi.shared.RMI_Graph;
+import org.apache.jena.rmi.shared.remote.GraphExistsException;
+import org.apache.jena.rmi.shared.remote.RemoteGraph;
+import org.apache.jena.rmi.shared.remote.RemoteGraphEngine;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.xenei.junit.contract.Contract.Inject;
+import org.xenei.junit.contract.ContractImpl;
+import org.xenei.junit.contract.ContractSuite;
+import org.xenei.junit.contract.ContractTest;
+import org.xenei.junit.contract.IProducer;
+
+import static org.junit.Assert.*;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.graph.GraphStatisticsHandler;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Node_URI;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.mem.GraphMem;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+import static com.hp.hpl.jena.testing_framework.GraphHelper.*;
+
+@RunWith(ContractSuite.class)
+@ContractImpl(RMI_Graph.class)
+public class GraphTest {
+
+	static RemoteGraphEngine graphEngine;
+
+	@BeforeClass
+	public static void beforeClass() throws Exception {
+		if (System.getSecurityManager() == null) {
+			System.setSecurityManager(new SecurityManager());
+		}
+
+		String name = "GraphEngine";
+		Registry registry = LocateRegistry.getRegistry();
+		graphEngine = (RemoteGraphEngine) registry.lookup(name);
+
+	}
+
+	protected IProducer<RMI_Graph> graphProducer = new AbstractGraphProducer<RMI_Graph>()
{
+
+		int i = 0;
+
+		@Override
+		protected RMI_Graph createNewGraph() {
+			RemoteGraph rg = null;
+			try {	
+				try {
+					rg = graphEngine.createGraph("test"
+							+ (i++));
+				}
+				catch (GraphExistsException e)
+				{
+					graphEngine.destroyGraph("test"+ i);
+					rg = graphEngine.createGraph("test"+ i );
+				}
+			
+				RMI_Graph g = new RMI_Graph(rg);
+				return g;
+			} catch (RemoteException e) {
+				throw new RuntimeException(e);
+			}
+		}
+
+		@Override
+		public Graph[] getDependsOn(Graph g) {
+			return null;
+		}
+
+		@Override
+		public Graph[] getNotDependsOn(Graph g) {
+			return new Graph[] { new GraphMem() };
+		}
+
+		@Override
+		protected void afterClose(Graph g) {
+			if (g instanceof RMI_Graph) {
+				try {
+					graphEngine.destroyGraph(((RMI_Graph) g).getName());
+				} catch (RemoteException e) {
+					throw new RuntimeException(e);
+				}
+			}
+			super.afterClose(g);
+		}
+
+	};
+
+	@Inject
+	public IProducer<RMI_Graph> getGraphProducer() {
+		return graphProducer;
+	}
+
+	@ContractTest
+	public void testHasStatistics() {
+		GraphStatisticsHandler h = graphProducer.newInstance()
+				.getStatisticsHandler();
+		assertNotNull(h);
+	}
+
+	@ContractTest
+	public void testUnnecessaryMatches() {
+		Node special = new Node_URI("eg:foo") {
+			@Override
+			public boolean matches(Node s) {
+				fail("Matched called superfluously.");
+				return true;
+			}
+		};
+		Graph g = graphWith(graphProducer.newInstance(), "x p y");
+		g.add(new Triple(special, special, special));
+		exhaust(g.find(special, Node.ANY, Node.ANY));
+		exhaust(g.find(Node.ANY, special, Node.ANY));
+		exhaust(g.find(Node.ANY, Node.ANY, special));
+
+	}
+
+	protected void exhaust(Iterator<?> it) {
+		while (it.hasNext())
+			it.next();
+	}
+
+}
\ No newline at end of file

Propchange: jena/Experimental/jena-rmi/jena-rmi-client/src/test/java/org/apache/jena/rmi/client/GraphTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: jena/Experimental/jena-rmi/jena-rmi-server/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Jan  5 18:36:03 2014
@@ -0,0 +1,11 @@
+.settings
+
+target
+
+log.txt
+
+.project
+
+go.sh
+
+.classpath



Mime
View raw message