You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by rv...@apache.org on 2013/04/02 23:15:17 UTC

svn commit: r1463756 - in /jena/Experimental/jena-jdbc: jena-jdbc-core/src/test/java/org/apache/jena/jdbc/results/ jena-jdbc-core/src/test/java/org/apache/jena/jdbc/utils/ jena-jdbc-driver-mem/src/test/java/org/apache/jena/jdbc/mem/ jena-jdbc-driver-re...

Author: rvesse
Date: Tue Apr  2 21:15:16 2013
New Revision: 1463756

URL: http://svn.apache.org/r1463756
Log:
Fix some tests to work correctly against TDB, expand result set tests to run against remote endpoint using embedded Fuseki instance

Added:
    jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/
    jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResults.java
Modified:
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/results/AbstractResultSetTests.java
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/utils/TestUtils.java
    jena/Experimental/jena-jdbc/jena-jdbc-driver-mem/src/test/java/org/apache/jena/jdbc/mem/AbstractDatasetResultSetTests.java
    jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/TestRemoteEndpointConnection.java

Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/results/AbstractResultSetTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/results/AbstractResultSetTests.java?rev=1463756&r1=1463755&r2=1463756&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/results/AbstractResultSetTests.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/results/AbstractResultSetTests.java Tue Apr  2 21:15:16 2013
@@ -45,7 +45,7 @@ import com.hp.hpl.jena.vocabulary.XSD;
 
 /**
  * Abstract tests for Jena JDBC {@link ResultSet} implementations
- *
+ * 
  */
 public abstract class AbstractResultSetTests {
 
@@ -58,9 +58,9 @@ public abstract class AbstractResultSetT
         // Init ARQ
         ARQ.init();
     }
-    
+
     private static Dataset empty, ds;
-    
+
     /**
      * Sets up the datasets used for the tests
      */
@@ -70,12 +70,12 @@ public abstract class AbstractResultSetT
         if (empty == null) {
             empty = DatasetFactory.createMem();
         }
-        
+
         // Build a dataset that has one of every type we expect to
         // commonly see
         if (ds == null) {
             ds = DatasetFactory.createMem();
-            
+
             // Create model and our RDF terms
             Model m = ModelFactory.createDefaultModel();
             Resource subjUri = m.createResource("http://example/subject");
@@ -86,7 +86,8 @@ public abstract class AbstractResultSetT
             Literal objSimpleLiteral = m.createLiteral("simple");
             Literal objLangLiteral = m.createLiteral("simple", "en");
             Literal objBoolean = m.createTypedLiteral(true);
-            Literal objByte = m.createTypedLiteral(Byte.toString((byte)123), TypeMapper.getInstance().getSafeTypeByName(XSD.xbyte.toString()));
+            Literal objByte = m.createTypedLiteral(Byte.toString((byte) 123),
+                    TypeMapper.getInstance().getSafeTypeByName(XSD.xbyte.toString()));
             Literal objDate = m.createTypedLiteral(Calendar.getInstance());
             Literal objChar = m.createTypedLiteral('a');
             Literal objDecimal = m.createTypedLiteral(new BigDecimal(123.4));
@@ -94,10 +95,12 @@ public abstract class AbstractResultSetT
             Literal objFloat = m.createTypedLiteral(123.4f);
             Literal objInteger = m.createTypedLiteral(1234);
             Literal objLong = m.createTypedLiteral(1234l);
-            Literal objShort = m.createTypedLiteral(Short.toString((short)123), TypeMapper.getInstance().getSafeTypeByName(XSD.xshort.toString()));
+            Literal objShort = m.createTypedLiteral(Short.toString((short) 123),
+                    TypeMapper.getInstance().getSafeTypeByName(XSD.xshort.toString()));
             Literal objString = m.createTypedLiteral("typed");
-            Literal objCustom = m.createTypedLiteral("custom", TypeMapper.getInstance().getSafeTypeByName("http://example/customType"));
-            
+            Literal objCustom = m.createTypedLiteral("custom",
+                    TypeMapper.getInstance().getSafeTypeByName("http://example/customType"));
+
             m.add(new Statement[] {
                     // Simple triples with URIs and Blank Nodes only
                     m.createStatement(subjUri, predUri, objUri),
@@ -108,309 +111,304 @@ public abstract class AbstractResultSetT
                     m.createStatement(subjUri, predUri, objSimpleLiteral),
                     m.createStatement(subjUri, predUri, objLangLiteral),
                     // Triples with typed literals as objects
-                    m.createStatement(subjUri, predUri, objBoolean),
-                    m.createStatement(subjUri, predUri, objByte),
-                    m.createStatement(subjUri, predUri, objDate),
-                    m.createStatement(subjUri, predUri, objChar),
-                    m.createStatement(subjUri, predUri, objDecimal),
-                    m.createStatement(subjUri, predUri, objDouble),
-                    m.createStatement(subjUri, predUri, objFloat),
-                    m.createStatement(subjUri, predUri, objInteger),
-                    m.createStatement(subjUri, predUri, objLong),
-                    m.createStatement(subjUri, predUri, objShort),
-                    m.createStatement(subjUri, predUri, objString),
-                    m.createStatement(subjUri, predUri, objCustom)
-            });
+                    m.createStatement(subjUri, predUri, objBoolean), m.createStatement(subjUri, predUri, objByte),
+                    m.createStatement(subjUri, predUri, objDate), m.createStatement(subjUri, predUri, objChar),
+                    m.createStatement(subjUri, predUri, objDecimal), m.createStatement(subjUri, predUri, objDouble),
+                    m.createStatement(subjUri, predUri, objFloat), m.createStatement(subjUri, predUri, objInteger),
+                    m.createStatement(subjUri, predUri, objLong), m.createStatement(subjUri, predUri, objShort),
+                    m.createStatement(subjUri, predUri, objString), m.createStatement(subjUri, predUri, objCustom) });
             ds.setDefaultModel(m);
         }
     }
 
-    protected abstract ResultSet createAskResult(Dataset ds, String query) throws SQLException;
-    
-    protected abstract ResultSet createSelectResults(Dataset ds, String query) throws SQLException;
-    
-    protected ResultSet createSelectResults(Model m, String query) throws SQLException {
-        Dataset ds = DatasetFactory.createMem();
-        ds.setDefaultModel(m);
-        return createSelectResults(ds, query);
-    }
-    
-    protected abstract ResultSet createConstructResults(Dataset ds, String query) throws SQLException;
-    
-    protected ResultSet createConstructResults(Model m, String query) throws SQLException {
-        Dataset ds = DatasetFactory.createMem();
-        ds.setDefaultModel(m);
-        return createConstructResults(ds, query);
-    }
-    
-    protected abstract ResultSet createDescribeResults(Dataset ds, String query) throws SQLException;
-    
-    protected ResultSet createDescribeResults(Model m, String query) throws SQLException {
-        Dataset ds = DatasetFactory.createMem();
-        ds.setDefaultModel(m);
-        return createDescribeResults(ds, query);
-    }
-    
-    protected String getIntegerTypeUri() { return XSD.xint.toString(); }
-    
-    protected String getByteTypeUri() { return XSD.xbyte.toString(); }
-    
-    protected String getShortTypeUri() { return XSD.xshort.toString(); }
-    
-    protected String getLongTypeUri() { return XSD.xlong.toString(); }
-    
+    protected abstract ResultSet createResults(Dataset ds, String query) throws SQLException;
+
+    protected String getIntegerTypeUri() {
+        return XSD.xint.toString();
+    }
+
+    protected String getByteTypeUri() {
+        return XSD.xbyte.toString();
+    }
+
+    protected String getShortTypeUri() {
+        return XSD.xshort.toString();
+    }
+
+    protected String getLongTypeUri() {
+        return XSD.xlong.toString();
+    }
+
     /**
      * Test ASK results with a true result
+     * 
      * @throws SQLException
      */
     @Test
     public void test_results_ask_true() throws SQLException {
-        ResultSet rset = this.createAskResult(AbstractResultSetTests.empty, "ASK { }");
+        ResultSet rset = this.createResults(AbstractResultSetTests.empty, "ASK { }");
         Assert.assertFalse(rset.isClosed());
         Assert.assertTrue(rset.isBeforeFirst());
-        
+
         // Try to move to the result row
         Assert.assertTrue(rset.next());
-        
+
         // Check the boolean return value
         Assert.assertTrue(rset.getBoolean(AskResultsMetadata.COLUMN_LABEL_ASK));
-        
+
         // Check no further rows
         Assert.assertFalse(rset.next());
         Assert.assertTrue(rset.isAfterLast());
-        
+
         // Close and clean up
         rset.close();
         Assert.assertTrue(rset.isClosed());
     }
-    
+
     /**
      * Test ASK results with a false result
+     * 
      * @throws SQLException
      */
     @Test
     public void test_results_ask_false() throws SQLException {
-        ResultSet rset = this.createAskResult(AbstractResultSetTests.empty, "ASK { FILTER(false) }");
+        ResultSet rset = this.createResults(AbstractResultSetTests.empty, "ASK { FILTER(false) }");
         Assert.assertFalse(rset.isClosed());
         Assert.assertTrue(rset.isBeforeFirst());
-        
+
         // Try to move to the result row
         Assert.assertTrue(rset.next());
-        
+
         // Check the boolean return value
         Assert.assertFalse(rset.getBoolean(AskResultsMetadata.COLUMN_LABEL_ASK));
-        
+
         // Check no further rows
         Assert.assertFalse(rset.next());
         Assert.assertTrue(rset.isAfterLast());
-        
+
         // Close and clean up
         rset.close();
         Assert.assertTrue(rset.isClosed());
     }
-    
+
     /**
      * Tests that SELECT result values can be marshalled to strings OK
+     * 
      * @throws SQLException
      */
     @Test
     public void test_results_select_strings_01() throws SQLException {
-        ResultSet rset = this.createSelectResults(ds, "SELECT (STR(?o) AS ?str) { ?s ?p ?o . FILTER(!ISBLANK(?o)) }");
+        ResultSet rset = this.createResults(ds, "SELECT (STR(?o) AS ?str) { ?s ?p ?o . FILTER(!ISBLANK(?o)) }");
         Assert.assertFalse(rset.isClosed());
         Assert.assertTrue(rset.isBeforeFirst());
         Assert.assertFalse(rset.isLast());
-        
+
         // Check all rows allow us to marshal strings OK
         while (rset.next()) {
             Assert.assertNotNull(rset.getString("str"));
             Assert.assertFalse(rset.wasNull());
         }
-        
+
         Assert.assertTrue(rset.isAfterLast());
         rset.close();
         Assert.assertTrue(rset.isClosed());
     }
-    
+
     /**
      * Tests that SELECT result values can be marshalled to strings OK
+     * 
      * @throws SQLException
      */
     @Test
     public void test_results_select_strings_02() throws SQLException {
-        ResultSet rset = this.createSelectResults(ds, "SELECT (STR(?o) AS ?str) { ?s ?p ?o . FILTER(!ISBLANK(?o)) }");
+        ResultSet rset = this.createResults(ds, "SELECT (STR(?o) AS ?str) { ?s ?p ?o . FILTER(!ISBLANK(?o)) }");
         Assert.assertFalse(rset.isClosed());
         Assert.assertTrue(rset.isBeforeFirst());
         Assert.assertFalse(rset.isLast());
-        
+
         // Check all rows allow us to marshal strings OK
         while (rset.next()) {
             Assert.assertNotNull(rset.getNString("str"));
             Assert.assertFalse(rset.wasNull());
         }
-        
+
         Assert.assertTrue(rset.isAfterLast());
         rset.close();
         Assert.assertTrue(rset.isClosed());
     }
-    
+
     /**
      * Tests that SELECT result values can be marshalled to numerics OK
+     * 
      * @throws SQLException
      */
     @Test
     public void test_results_select_numerics() throws SQLException {
-        ResultSet rset = this.createSelectResults(ds, "SELECT ?o { ?s ?p ?o . FILTER(ISNUMERIC(?o)) }");
+        ResultSet rset = this.createResults(ds, "SELECT ?o { ?s ?p ?o . FILTER(ISNUMERIC(?o)) }");
         Assert.assertFalse(rset.isClosed());
         Assert.assertTrue(rset.isBeforeFirst());
         Assert.assertFalse(rset.isLast());
-        
+
         // Check all rows allow us to marshal big decimal OK
         BigDecimal zero = new BigDecimal(0);
         while (rset.next()) {
             Assert.assertNotNull(rset.getString("o"));
-            // Use decimal since all numeric types should be promotable to decimal
+            // Use decimal since all numeric types should be promotable to
+            // decimal
             Assert.assertFalse(rset.getBigDecimal("o").equals(zero));
             Assert.assertFalse(rset.wasNull());
         }
-        
+
         Assert.assertTrue(rset.isAfterLast());
         rset.close();
         Assert.assertTrue(rset.isClosed());
     }
-    
+
     /**
      * Tests that SELECT result values can be marshalled to integers OK
+     * 
      * @throws SQLException
      */
     @Test
     public void test_results_select_integers() throws SQLException {
-        ResultSet rset = this.createSelectResults(ds, "SELECT ?o { ?s ?p ?o . FILTER(DATATYPE(?o) = <" + this.getIntegerTypeUri() + ">) }");
+        ResultSet rset = this.createResults(ds, "SELECT ?o { ?s ?p ?o . FILTER(DATATYPE(?o) = <" + this.getIntegerTypeUri()
+                + ">) }");
         Assert.assertFalse(rset.isClosed());
         Assert.assertTrue(rset.isBeforeFirst());
         Assert.assertFalse(rset.isLast());
-        
+
         // Check all rows allow us to marshal integers OK
         while (rset.next()) {
             Assert.assertNotNull(rset.getString("o"));
             Assert.assertFalse(0 == rset.getInt("o"));
             Assert.assertFalse(rset.wasNull());
         }
-        
+
         Assert.assertTrue(rset.isAfterLast());
         rset.close();
         Assert.assertTrue(rset.isClosed());
     }
-    
+
     /**
      * Tests that SELECT result values can be marshalled to bytes OK
+     * 
      * @throws SQLException
      */
     @Test
     public void test_results_select_bytes() throws SQLException {
-        ResultSet rset = this.createSelectResults(ds, "SELECT ?o { ?s ?p ?o . FILTER(DATATYPE(?o) = <" + this.getByteTypeUri() + "> && ?o <= 255) }");
+        ResultSet rset = this.createResults(ds, "SELECT ?o { ?s ?p ?o . FILTER(DATATYPE(?o) = <" + this.getByteTypeUri()
+                + "> && ?o <= 255) }");
         Assert.assertFalse(rset.isClosed());
         Assert.assertTrue(rset.isBeforeFirst());
         Assert.assertFalse(rset.isLast());
-        
+
         // Check all rows allow us to marshal bytes OK
         while (rset.next()) {
             Assert.assertNotNull(rset.getString("o"));
-            Assert.assertFalse((byte)0 == rset.getByte("o"));
+            Assert.assertFalse((byte) 0 == rset.getByte("o"));
             Assert.assertFalse(rset.wasNull());
         }
-        
+
         Assert.assertTrue(rset.isAfterLast());
         rset.close();
         Assert.assertTrue(rset.isClosed());
     }
-    
+
     /**
      * Tests that SELECT result values can be marshalled to floats OK
+     * 
      * @throws SQLException
      */
     @Test
     public void test_results_select_floats() throws SQLException {
-        ResultSet rset = this.createSelectResults(ds, "SELECT ?o { ?s ?p ?o . FILTER(DATATYPE(?o) = <" + XSD.xfloat.toString() + ">) }");
+        ResultSet rset = this
+                .createResults(ds, "SELECT ?o { ?s ?p ?o . FILTER(DATATYPE(?o) = <" + XSD.xfloat.toString() + ">) }");
         Assert.assertFalse(rset.isClosed());
         Assert.assertTrue(rset.isBeforeFirst());
         Assert.assertFalse(rset.isLast());
-        
+
         // Check all rows allow us to marshal floats OK
         while (rset.next()) {
             Assert.assertNotNull(rset.getString("o"));
             Assert.assertFalse(0f == rset.getFloat("o"));
             Assert.assertFalse(rset.wasNull());
         }
-        
+
         Assert.assertTrue(rset.isAfterLast());
         rset.close();
         Assert.assertTrue(rset.isClosed());
     }
-    
+
     /**
      * Tests that SELECT result values can be marshalled to doubles OK
+     * 
      * @throws SQLException
      */
     @Test
     public void test_results_select_doubles() throws SQLException {
-        ResultSet rset = this.createSelectResults(ds, "SELECT ?o { ?s ?p ?o . FILTER(DATATYPE(?o) = <" + XSD.xdouble.toString() + ">) }");
+        ResultSet rset = this.createResults(ds, "SELECT ?o { ?s ?p ?o . FILTER(DATATYPE(?o) = <" + XSD.xdouble.toString()
+                + ">) }");
         Assert.assertFalse(rset.isClosed());
         Assert.assertTrue(rset.isBeforeFirst());
         Assert.assertFalse(rset.isLast());
-        
+
         // Check all rows allow us to marshal doubles OK
         while (rset.next()) {
             Assert.assertNotNull(rset.getString("o"));
             Assert.assertFalse(0d == rset.getDouble("o"));
             Assert.assertFalse(rset.wasNull());
         }
-        
+
         Assert.assertTrue(rset.isAfterLast());
         rset.close();
         Assert.assertTrue(rset.isClosed());
     }
-    
+
     /**
      * Tests that SELECT result values can be marshalled to longs OK
+     * 
      * @throws SQLException
      */
     @Test
     public void test_results_select_longs() throws SQLException {
-        ResultSet rset = this.createSelectResults(ds, "SELECT ?o { ?s ?p ?o . FILTER(DATATYPE(?o) = <" + this.getLongTypeUri() + ">) }");
+        ResultSet rset = this
+                .createResults(ds, "SELECT ?o { ?s ?p ?o . FILTER(DATATYPE(?o) = <" + this.getLongTypeUri() + ">) }");
         Assert.assertFalse(rset.isClosed());
         Assert.assertTrue(rset.isBeforeFirst());
         Assert.assertFalse(rset.isLast());
-        
+
         // Check all rows allow us to marshal longs OK
         while (rset.next()) {
             Assert.assertNotNull(rset.getString("o"));
             Assert.assertFalse(0l == rset.getLong("o"));
             Assert.assertFalse(rset.wasNull());
         }
-        
+
         Assert.assertTrue(rset.isAfterLast());
         rset.close();
         Assert.assertTrue(rset.isClosed());
     }
-    
+
     /**
      * Tests that SELECT result values can be marshalled to shorts OK
+     * 
      * @throws SQLException
      */
     @Test
     public void test_results_select_shorts() throws SQLException {
-        ResultSet rset = this.createSelectResults(ds, "SELECT ?o { ?s ?p ?o . FILTER(DATATYPE(?o) = <" + this.getShortTypeUri() + ">) }");
+        ResultSet rset = this.createResults(ds, "SELECT ?o { ?s ?p ?o . FILTER(DATATYPE(?o) = <" + this.getShortTypeUri()
+                + ">) }");
         Assert.assertFalse(rset.isClosed());
         Assert.assertTrue(rset.isBeforeFirst());
         Assert.assertFalse(rset.isLast());
-        
+
         // Check all rows allow us to marshal shorts OK
         while (rset.next()) {
             Assert.assertNotNull(rset.getString("o"));
-            Assert.assertFalse((short)0 == rset.getShort("o"));
+            Assert.assertFalse((short) 0 == rset.getShort("o"));
             Assert.assertFalse(rset.wasNull());
         }
-        
+
         Assert.assertTrue(rset.isAfterLast());
         rset.close();
         Assert.assertTrue(rset.isClosed());

Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/utils/TestUtils.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/utils/TestUtils.java?rev=1463756&r1=1463755&r2=1463756&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/utils/TestUtils.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/utils/TestUtils.java Tue Apr  2 21:15:16 2013
@@ -64,7 +64,7 @@ public class TestUtils {
             while (quads.hasNext()) {
                 targetDSG.add(quads.next());
             }
-        } else {
+        } else  {
             target.setDefaultModel(source.getDefaultModel());
         }
 

Modified: jena/Experimental/jena-jdbc/jena-jdbc-driver-mem/src/test/java/org/apache/jena/jdbc/mem/AbstractDatasetResultSetTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-mem/src/test/java/org/apache/jena/jdbc/mem/AbstractDatasetResultSetTests.java?rev=1463756&r1=1463755&r2=1463756&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-mem/src/test/java/org/apache/jena/jdbc/mem/AbstractDatasetResultSetTests.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-mem/src/test/java/org/apache/jena/jdbc/mem/AbstractDatasetResultSetTests.java Tue Apr  2 21:15:16 2013
@@ -65,31 +65,9 @@ public abstract class AbstractDatasetRes
     protected abstract Dataset prepareDataset(Dataset ds) throws SQLException;
     
     @Override
-    protected final ResultSet createAskResult(Dataset ds, String query) throws SQLException {
+    protected final ResultSet createResults(Dataset ds, String query) throws SQLException {
         connection.setJenaDataset(this.prepareDataset(ds));
         Statement stmt = connection.createStatement();
         return stmt.executeQuery(query);
     }
-
-    @Override
-    protected final ResultSet createSelectResults(Dataset ds, String query) throws SQLException {
-        connection.setJenaDataset(this.prepareDataset(ds));
-        Statement stmt = connection.createStatement();
-        return stmt.executeQuery(query);
-    }
-
-    @Override
-    protected final ResultSet createConstructResults(Dataset ds, String query) throws SQLException {
-        connection.setJenaDataset(this.prepareDataset(ds));
-        Statement stmt = connection.createStatement();
-        return stmt.executeQuery(query);
-    }
-
-    @Override
-    protected final ResultSet createDescribeResults(Dataset ds, String query) throws SQLException {
-        connection.setJenaDataset(this.prepareDataset(ds));
-        Statement stmt = connection.createStatement();
-        return stmt.executeQuery(query);
-    }
-
 }
\ No newline at end of file

Modified: jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/TestRemoteEndpointConnection.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/TestRemoteEndpointConnection.java?rev=1463756&r1=1463755&r2=1463756&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/TestRemoteEndpointConnection.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/TestRemoteEndpointConnection.java Tue Apr  2 21:15:16 2013
@@ -19,26 +19,23 @@
 package org.apache.jena.jdbc.remote;
 
 import java.sql.SQLException;
-import java.util.Iterator;
-
 import org.apache.jena.fuseki.BaseServerTest;
 import org.apache.jena.fuseki.ServerTest;
 import org.apache.jena.jdbc.AbstractJenaJdbcConnectionTests;
 import org.apache.jena.jdbc.JenaJdbcConnection;
+import org.apache.jena.jdbc.utils.TestUtils;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
 import com.hp.hpl.jena.query.Dataset;
-import com.hp.hpl.jena.query.DatasetAccessor;
-import com.hp.hpl.jena.query.DatasetAccessorFactory;
 
 /**
  * Tests for the {@link RemoteEndpointConnection}
  *
  */
 public class TestRemoteEndpointConnection extends AbstractJenaJdbcConnectionTests {
-    
+        
     /**
      * Setup for the tests by allocating a Fuseki instance to work with
      */
@@ -71,14 +68,7 @@ public class TestRemoteEndpointConnectio
     @Override
     protected JenaJdbcConnection getConnection(Dataset ds) throws SQLException {
         // Set up the dataset
-        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(BaseServerTest.serviceREST);
-        accessor.putModel(ds.getDefaultModel());
-        Iterator<String> uris = ds.listNames();
-        while (uris.hasNext()) {
-            String uri = uris.next();
-            accessor.putModel(uri, ds.getNamedModel(uri));
-        }
-        
+        TestUtils.copyToRemoteDataset(ds, BaseServerTest.serviceREST);
         return new RemoteEndpointConnection(BaseServerTest.serviceQuery, BaseServerTest.serviceUpdate, JenaJdbcConnection.DEFAULT_HOLDABILITY);
     }
 

Added: jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResults.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResults.java?rev=1463756&view=auto
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResults.java (added)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResults.java Tue Apr  2 21:15:16 2013
@@ -0,0 +1,81 @@
+/**
+ * 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 org.apache.jena.jdbc.remote.results;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import org.apache.jena.fuseki.BaseServerTest;
+import org.apache.jena.fuseki.ServerTest;
+import org.apache.jena.jdbc.JenaJdbcConnection;
+import org.apache.jena.jdbc.remote.RemoteEndpointConnection;
+import org.apache.jena.jdbc.results.AbstractResultSetTests;
+import org.apache.jena.jdbc.utils.TestUtils;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+import com.hp.hpl.jena.query.Dataset;
+
+/**
+ * Tests result sets from a remote endpoint
+ *
+ */
+public class TestRemoteEndpointResults extends AbstractResultSetTests {
+    
+    private static RemoteEndpointConnection connection;
+    
+    /**
+     * Setup for the tests by allocating a Fuseki instance to work with
+     * @throws SQLException 
+     */
+    @BeforeClass
+    public static void setup() throws SQLException {
+        ServerTest.allocServer();
+        
+        connection = new RemoteEndpointConnection(BaseServerTest.serviceQuery, BaseServerTest.serviceUpdate, JenaJdbcConnection.DEFAULT_HOLDABILITY);
+    }
+    
+    /**
+     * Clean up after each test by resetting the Fuseki instance
+     */
+    @After
+    public void cleanupTest() {
+        ServerTest.resetServer();
+    }
+    
+    /**
+     * Clean up after tests by de-allocating the Fuseki instance
+     * @throws SQLException 
+     */
+    @AfterClass
+    public static void cleanup() throws SQLException {
+        ServerTest.freeServer();
+        
+        connection.close();
+    }
+
+    @Override
+    protected ResultSet createResults(Dataset ds, String query) throws SQLException {
+        TestUtils.copyToRemoteDataset(ds, BaseServerTest.serviceREST);
+        Statement stmt = connection.createStatement();
+        return stmt.executeQuery(query);
+    }
+}