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/05/01 23:05:15 UTC

svn commit: r1478189 [2/2] - in /jena/Experimental/jena-jdbc: jena-jdbc-core/src/main/java/org/apache/jena/jdbc/connections/ jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/ jena-jdbc-core/src/main/java/org/apache/jena/jdbc/statements/ jena-j...

Modified: jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointStatement.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointStatement.java?rev=1478189&r1=1478188&r2=1478189&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointStatement.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointStatement.java Wed May  1 21:05:13 2013
@@ -54,7 +54,7 @@ public class RemoteEndpointStatement ext
      *             Thrown if there is an error with the statement parameters
      */
     public RemoteEndpointStatement(RemoteEndpointConnection connection) throws SQLException {
-        this(connection, null, null, DEFAULT_FETCH_DIRECTION, DEFAULT_FETCH_SIZE, DEFAULT_HOLDABILITY);
+        this(connection, null, null, DEFAULT_TYPE, DEFAULT_FETCH_DIRECTION, DEFAULT_FETCH_SIZE, DEFAULT_HOLDABILITY);
     }
 
     /**
@@ -62,6 +62,8 @@ public class RemoteEndpointStatement ext
      * 
      * @param connection
      *            Connection
+     * @param type
+     *            Result Set type for result sets produced by this statement
      * @param username
      *            Username for HTTP Basic Authentication
      * @param password
@@ -76,9 +78,9 @@ public class RemoteEndpointStatement ext
      *             Thrown if there is an error with the statement parameters
      * 
      */
-    public RemoteEndpointStatement(RemoteEndpointConnection connection, String username, char[] password, int fetchDir,
+    public RemoteEndpointStatement(RemoteEndpointConnection connection, String username, char[] password, int type, int fetchDir,
             int fetchSize, int holdability) throws SQLException {
-        super(connection, fetchDir, fetchSize, holdability, false, Connection.TRANSACTION_NONE);
+        super(connection, type, fetchDir, fetchSize, holdability, false, Connection.TRANSACTION_NONE);
         this.remoteConn = connection;
         this.username = username;
         this.password = password;

Modified: jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithGraphUris.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithGraphUris.java?rev=1478189&r1=1478188&r2=1478189&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithGraphUris.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithGraphUris.java Wed May  1 21:05:13 2013
@@ -75,7 +75,7 @@ public class TestRemoteEndpointConnectio
     protected JenaConnection getConnection() throws SQLException {
         List<String> defaultGraphs = new ArrayList<String>();
         defaultGraphs.add(DEFAULT_GRAPH_URI);
-        return new RemoteEndpointConnection(BaseServerTest.serviceQuery, BaseServerTest.serviceUpdate, defaultGraphs, null, null, null, null, null, JenaConnection.DEFAULT_HOLDABILITY, JdbcCompatibility.DEFAULT);
+        return new RemoteEndpointConnection(BaseServerTest.serviceQuery, BaseServerTest.serviceUpdate, defaultGraphs, null, defaultGraphs, null, null, null, JenaConnection.DEFAULT_HOLDABILITY, JdbcCompatibility.DEFAULT);
     }
 
     @Override
@@ -90,5 +90,14 @@ public class TestRemoteEndpointConnectio
         return new RemoteEndpointConnection(BaseServerTest.serviceQuery, BaseServerTest.serviceUpdate, JenaConnection.DEFAULT_HOLDABILITY, JdbcCompatibility.DEFAULT);
     }
 
+    @Override
+    protected boolean usesNamedGraphAsDefault() {
+        return true;
+    }
+    
+    @Override
+    protected String getDefaultGraphName() throws SQLException {
+        return DEFAULT_GRAPH_URI;
+    }
 
 }

Added: jena/Experimental/jena-jdbc/jena-jdbc-driver-tdb/src/test/java/org/apache/jena/jdbc/tdb/connections/TestTdbDiskConnection.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-tdb/src/test/java/org/apache/jena/jdbc/tdb/connections/TestTdbDiskConnection.java?rev=1478189&view=auto
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-tdb/src/test/java/org/apache/jena/jdbc/tdb/connections/TestTdbDiskConnection.java (added)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-tdb/src/test/java/org/apache/jena/jdbc/tdb/connections/TestTdbDiskConnection.java Wed May  1 21:05:13 2013
@@ -0,0 +1,63 @@
+/**
+ * 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.tdb.connections;
+
+import java.sql.SQLException;
+
+import org.apache.jena.jdbc.JdbcCompatibility;
+import org.apache.jena.jdbc.connections.AbstractJenaConnectionTests;
+import org.apache.jena.jdbc.connections.DatasetConnection;
+import org.apache.jena.jdbc.connections.JenaConnection;
+import org.apache.jena.jdbc.tdb.connections.TDBConnection;
+import org.apache.jena.jdbc.utils.TestUtils;
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
+
+import com.hp.hpl.jena.query.Dataset;
+import com.hp.hpl.jena.tdb.TDBFactory;
+
+/**
+ * Tests for the {@link DatasetConnection} backed by a purely in-memory testing
+ * only TDB dataset
+ * 
+ */
+public class TestTdbDiskConnection extends AbstractJenaConnectionTests {
+
+    /**
+     * Temporary directory rule used to guarantee a unique temporary folder for
+     * each test method
+     */
+    @Rule
+    public TemporaryFolder tempDir = new TemporaryFolder();
+
+    @Override
+    protected JenaConnection getConnection() throws SQLException {
+        return new TDBConnection(TDBFactory.createDataset(tempDir.getRoot().getAbsolutePath()),
+                JenaConnection.DEFAULT_HOLDABILITY, JenaConnection.DEFAULT_AUTO_COMMIT, JdbcCompatibility.DEFAULT);
+    }
+
+    @Override
+    protected JenaConnection getConnection(Dataset ds) throws SQLException {
+        Dataset tdb = TDBFactory.createDataset(tempDir.getRoot().getAbsolutePath());
+        TestUtils.copyDataset(ds, tdb, true);
+        return new TDBConnection(tdb, JenaConnection.DEFAULT_HOLDABILITY, JenaConnection.DEFAULT_AUTO_COMMIT,
+                JdbcCompatibility.DEFAULT);
+    }
+
+}

Added: jena/Experimental/jena-jdbc/jena-jdbc-driver-tdb/src/test/java/org/apache/jena/jdbc/tdb/connections/TestTdbMemConnection.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-tdb/src/test/java/org/apache/jena/jdbc/tdb/connections/TestTdbMemConnection.java?rev=1478189&view=auto
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-tdb/src/test/java/org/apache/jena/jdbc/tdb/connections/TestTdbMemConnection.java (added)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-tdb/src/test/java/org/apache/jena/jdbc/tdb/connections/TestTdbMemConnection.java Wed May  1 21:05:13 2013
@@ -0,0 +1,54 @@
+/**
+ * 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.tdb.connections;
+
+import java.sql.SQLException;
+
+import org.apache.jena.jdbc.JdbcCompatibility;
+import org.apache.jena.jdbc.connections.AbstractJenaConnectionTests;
+import org.apache.jena.jdbc.connections.DatasetConnection;
+import org.apache.jena.jdbc.connections.JenaConnection;
+import org.apache.jena.jdbc.tdb.connections.TDBConnection;
+import org.apache.jena.jdbc.utils.TestUtils;
+
+import com.hp.hpl.jena.query.Dataset;
+import com.hp.hpl.jena.tdb.TDBFactory;
+
+/**
+ * Tests for the {@link DatasetConnection} backed by a purely in-memory testing
+ * only TDB dataset
+ * 
+ */
+public class TestTdbMemConnection extends AbstractJenaConnectionTests {
+
+    @Override
+    protected JenaConnection getConnection() throws SQLException {
+        return new TDBConnection(TDBFactory.createDataset(), JenaConnection.DEFAULT_HOLDABILITY,
+                JenaConnection.DEFAULT_AUTO_COMMIT, JdbcCompatibility.DEFAULT);
+    }
+
+    @Override
+    protected JenaConnection getConnection(Dataset ds) throws SQLException {
+        Dataset tdb = TDBFactory.createDataset();
+        TestUtils.copyDataset(ds, tdb, true);
+        return new TDBConnection(tdb, JenaConnection.DEFAULT_HOLDABILITY, JenaConnection.DEFAULT_AUTO_COMMIT,
+                JdbcCompatibility.DEFAULT);
+    }
+
+}