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/06/01 00:18:33 UTC
svn commit: r1488418 - in
/jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote:
connections/TestRemoteEndpointConnectionWithResultSetTypes.java
results/TestRemoteEndpointResultsWithResultSetTypes.java
Author: rvesse
Date: Fri May 31 22:18:33 2013
New Revision: 1488418
URL: http://svn.apache.org/r1488418
Log:
Add tests that use the remote endpoint driver with custom result set types configured
Added:
jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithResultSetTypes.java
jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithResultSetTypes.java
Added: jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithResultSetTypes.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithResultSetTypes.java?rev=1488418&view=auto
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithResultSetTypes.java (added)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithResultSetTypes.java Fri May 31 22:18:33 2013
@@ -0,0 +1,77 @@
+/**
+ * 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.connections;
+
+import java.sql.SQLException;
+import org.apache.jena.fuseki.BaseServerTest;
+import org.apache.jena.fuseki.ServerTest;
+import org.apache.jena.jdbc.JdbcCompatibility;
+import org.apache.jena.jdbc.connections.AbstractJenaConnectionTests;
+import org.apache.jena.jdbc.connections.JenaConnection;
+import org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection;
+import org.apache.jena.jdbc.utils.TestUtils;
+import org.apache.jena.riot.WebContent;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+import com.hp.hpl.jena.query.Dataset;
+
+/**
+ * Tests for the {@link RemoteEndpointConnection} where we use custom result set types
+ *
+ */
+public class TestRemoteEndpointConnectionWithResultSetTypes extends AbstractJenaConnectionTests {
+
+ /**
+ * Setup for the tests by allocating a Fuseki instance to work with
+ */
+ @BeforeClass
+ public static void setup() {
+ ServerTest.allocServer();
+ }
+
+ /**
+ * 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
+ */
+ @AfterClass
+ public static void cleanup() {
+ ServerTest.freeServer();
+ }
+
+ @Override
+ protected JenaConnection getConnection() throws SQLException {
+ return new RemoteEndpointConnection(BaseServerTest.serviceQuery, BaseServerTest.serviceUpdate, null, null, null, null, null, null, JenaConnection.DEFAULT_HOLDABILITY, JdbcCompatibility.DEFAULT, WebContent.contentTypeTextTSV, WebContent.contentTypeRdfJson);
+ }
+
+ @Override
+ protected JenaConnection getConnection(Dataset ds) throws SQLException {
+ // Set up the dataset
+ TestUtils.copyToRemoteDataset(ds, BaseServerTest.serviceREST);
+ return new RemoteEndpointConnection(BaseServerTest.serviceQuery, BaseServerTest.serviceUpdate, null, null, null, null, null, null, JenaConnection.DEFAULT_HOLDABILITY, JdbcCompatibility.DEFAULT, WebContent.contentTypeTextTSV, WebContent.contentTypeRdfJson);
+ }
+}
Added: jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithResultSetTypes.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithResultSetTypes.java?rev=1488418&view=auto
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithResultSetTypes.java (added)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithResultSetTypes.java Fri May 31 22:18:33 2013
@@ -0,0 +1,88 @@
+/**
+ * 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.JdbcCompatibility;
+import org.apache.jena.jdbc.connections.JenaConnection;
+import org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection;
+import org.apache.jena.jdbc.results.AbstractResultSetTests;
+import org.apache.jena.jdbc.utils.TestUtils;
+import org.apache.jena.riot.WebContent;
+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 TestRemoteEndpointResultsWithResultSetTypes 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, null, null, null, null, null, null, JenaConnection.DEFAULT_HOLDABILITY, JdbcCompatibility.DEFAULT, WebContent.contentTypeTextTSV, WebContent.contentTypeRdfJson);
+ connection.setJdbcCompatibilityLevel(JdbcCompatibility.HIGH);
+ }
+
+ /**
+ * 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 {
+ return createResults(ds, query, ResultSet.TYPE_FORWARD_ONLY);
+ }
+
+ @Override
+ protected ResultSet createResults(Dataset ds, String query, int resultSetType) throws SQLException {
+ TestUtils.copyToRemoteDataset(ds, BaseServerTest.serviceREST);
+ Statement stmt = connection.createStatement(resultSetType, ResultSet.CONCUR_READ_ONLY);
+ return stmt.executeQuery(query);
+ }
+}