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/05 22:29:26 UTC
svn commit: r1490026 - in /jena/Experimental/jena-jdbc:
jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/
jena-jdbc-core/src/test/java/org/apache/jena/jdbc/
jena-jdbc-core/src/test/java/org/apache/jena/jdbc/connections/ jena-j...
Author: rvesse
Date: Wed Jun 5 20:29:25 2013
New Revision: 1490026
URL: http://svn.apache.org/r1490026
Log:
Don't use conflicting versions of Fuseki
Modified:
jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ColumnInfo.java
jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/AbstractJenaDriverTests.java
jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/connections/AbstractJenaConnectionTests.java
jena/Experimental/jena-jdbc/jena-jdbc-driver-bundle/pom.xml
Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ColumnInfo.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ColumnInfo.java?rev=1490026&r1=1490025&r2=1490026&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ColumnInfo.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/main/java/org/apache/jena/jdbc/results/metadata/columns/ColumnInfo.java Wed Jun 5 20:29:25 2013
@@ -117,7 +117,7 @@ public abstract class ColumnInfo {
}
/**
- * Sets the underying database type name
+ * Sets the underlying database type name
*
* @param typeName
* Type name
@@ -241,7 +241,7 @@ public abstract class ColumnInfo {
*/
public boolean isSearchable() {
// Assume all columns are searchable since the entire RDF dataset is
- // serchable
+ // searchable
return true;
}
Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/AbstractJenaDriverTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/AbstractJenaDriverTests.java?rev=1490026&r1=1490025&r2=1490026&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/AbstractJenaDriverTests.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/AbstractJenaDriverTests.java Wed Jun 5 20:29:25 2013
@@ -253,7 +253,7 @@ public abstract class AbstractJenaDriver
conn.close();
Assert.assertTrue(conn.isClosed());
}
-
+
/**
* Tests using a driver to create a connection with its own URLs which are known to be bad
*
Modified: jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/connections/AbstractJenaConnectionTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/connections/AbstractJenaConnectionTests.java?rev=1490026&r1=1490025&r2=1490026&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/connections/AbstractJenaConnectionTests.java (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/connections/AbstractJenaConnectionTests.java Wed Jun 5 20:29:25 2013
@@ -29,13 +29,16 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Types;
+import java.util.HashMap;
import org.apache.jena.iri.IRIFactory;
import org.apache.jena.jdbc.JdbcCompatibility;
import org.apache.jena.jdbc.connections.JenaConnection;
+import org.apache.jena.jdbc.preprocessing.Echo;
import org.apache.jena.jdbc.results.metadata.AskResultsMetadata;
import org.apache.jena.jdbc.results.metadata.TripleResultsMetadata;
import org.apache.jena.jdbc.statements.JenaPreparedStatement;
@@ -54,7 +57,11 @@ import com.hp.hpl.jena.query.ARQ;
import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.query.DatasetFactory;
import com.hp.hpl.jena.query.ParameterizedSparqlString;
+import com.hp.hpl.jena.query.Query;
+import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.sparql.core.Quad;
+import com.hp.hpl.jena.update.UpdateFactory;
+import com.hp.hpl.jena.update.UpdateRequest;
/**
* Abstract tests for {@link JenaConnection} implementations
@@ -110,7 +117,8 @@ public abstract class AbstractJenaConnec
* being used as the default graph
*
* @return Named Graph being used as the default graph
- * @throws SQLException Thrown if this feature is not being used
+ * @throws SQLException
+ * Thrown if this feature is not being used
*/
protected String getDefaultGraphName() throws SQLException {
throw new SQLException(
@@ -506,317 +514,361 @@ public abstract class AbstractJenaConnec
conn.close();
Assert.assertTrue(conn.isClosed());
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_01() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, "value");
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("\"value\""));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_02() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, 123);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123"));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_03() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, 123l);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123"));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_04() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
- stmt.setObject(1, (byte)123);
+
+ stmt.setObject(1, (byte) 123);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123"));
Assert.assertTrue(pss.toString().contains(XSDDatatype.XSDbyte.getURI()));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_05() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, BigDecimal.valueOf(1234, 1));
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123.4"));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_06() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
- stmt.setObject(1, (short)123);
+
+ stmt.setObject(1, (short) 123);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123"));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_07() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, 12.3f);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("12.3"));
Assert.assertTrue(pss.toString().contains(XSDDatatype.XSDfloat.getURI()));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_08() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, 12.3d);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("12.3"));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_09() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, true);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("true"));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_10() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, new Date(0));
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains(XSDDatatype.XSDdate.getURI()));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_11() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, new Time(0));
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains(XSDDatatype.XSDtime.getURI()));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
- * @throws MalformedURLException
+ * @throws MalformedURLException
*/
@Test
public void connection_prepared_statement_setters_12() throws SQLException, MalformedURLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, new URL("http://example.org"));
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("<http://example.org>"));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
- * @throws MalformedURLException
- * @throws URISyntaxException
+ * @throws MalformedURLException
+ * @throws URISyntaxException
*/
@Test
public void connection_prepared_statement_setters_13() throws SQLException, MalformedURLException, URISyntaxException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, new URI("http://example.org"));
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("<http://example.org>"));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_14() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, IRIFactory.iriImplementation().create("http://example.org"));
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("<http://example.org>"));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_15() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, IRIFactory.iriImplementation().create("http://example.org"), Types.NVARCHAR);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("\"http://example.org\""));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_16() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, IRIFactory.iriImplementation().create("http://example.org"), Types.JAVA_OBJECT);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("<http://example.org>"));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_17() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, 12.3f, Types.DOUBLE);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("12.3"));
Assert.assertFalse(pss.toString().contains(XSDDatatype.XSDfloat.getURI()));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_18() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, 12.3d, Types.DOUBLE);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("12.3"));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_19() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, 123l, Types.BIGINT);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123"));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_20() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
+
stmt.setObject(1, 123, Types.BIGINT);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123"));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_21() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
- stmt.setObject(1, (short)123, Types.BIGINT);
+
+ stmt.setObject(1, (short) 123, Types.BIGINT);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123"));
}
-
+
/**
- * Tests that the various set methods of {@link JenaPreparedStatement} function correctly
+ * Tests that the various set methods of {@link JenaPreparedStatement}
+ * function correctly
+ *
* @throws SQLException
*/
@Test
public void connection_prepared_statement_setters_22() throws SQLException {
JenaConnection conn = this.getConnection();
JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");
-
- stmt.setObject(1, (byte)123, Types.BIGINT);
+
+ stmt.setObject(1, (byte) 123, Types.BIGINT);
ParameterizedSparqlString pss = stmt.getParameterizedString();
Assert.assertTrue(pss.toString().contains("123"));
}
@@ -1298,6 +1350,64 @@ public abstract class AbstractJenaConnec
}
/**
+ * Test error cases for creating statements
+ * @throws SQLException
+ */
+ @Test(expected = SQLException.class)
+ public void connection_statement_bad_creation_01() throws SQLException {
+ JenaConnection conn = this.getConnection();
+ conn.close();
+
+ // Creating a statement after closing should be an error
+ conn.createStatement();
+ }
+
+ /**
+ * Test error cases for creating statements
+ * @throws SQLException
+ */
+ @Test(expected = SQLException.class)
+ public void connection_statement_bad_creation_02() throws SQLException {
+ JenaConnection conn = this.getConnection();
+ conn.close();
+
+ // Creating a statement after closing should be an error
+ conn.prepareStatement("SELECT * WHERE { ?s ?p ?o }");
+ }
+
+ /**
+ * Test error cases for creating statements
+ * @throws SQLException
+ */
+ @Test(expected = SQLException.class)
+ public void connection_statement_bad_creation_03() throws SQLException {
+ JenaConnection conn = this.getConnection();
+
+ try {
+ // Creating a SCOLL_SENSITIVE statement is not supported
+ conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
+ } finally {
+ conn.close();
+ }
+ }
+
+ /**
+ * Test error cases for creating statements
+ * @throws SQLException
+ */
+ @Test(expected = SQLException.class)
+ public void connection_statement_bad_creation_04() throws SQLException {
+ JenaConnection conn = this.getConnection();
+
+ try {
+ // Creating a CONCUR_UPDATABLE statement is not supported
+ conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
+ } finally {
+ conn.close();
+ }
+ }
+
+ /**
* Runs a batch of operations and checks the results results
*
* @throws SQLException
@@ -1475,4 +1585,311 @@ public abstract class AbstractJenaConnec
conn.close();
Assert.assertTrue(conn.isClosed());
}
+
+ /**
+ * Tests pre-processor management operations
+ *
+ * @throws SQLException
+ */
+ @Test
+ public void connection_pre_processors_01() throws SQLException {
+ JenaConnection conn = this.getConnection();
+ Assert.assertFalse(conn.getPreProcessors().hasNext());
+
+ // Adding a null pre-processor has no effect
+ conn.addPreProcessor(null);
+ Assert.assertFalse(conn.getPreProcessors().hasNext());
+
+ // Similarly so does removing a null pre-processor
+ conn.removePreProcessor(null);
+ Assert.assertFalse(conn.getPreProcessors().hasNext());
+
+ // Inserting a null pre-processor also has no effect
+ conn.insertPreProcessor(0, null);
+ Assert.assertFalse(conn.getPreProcessors().hasNext());
+
+ conn.close();
+ }
+
+ /**
+ * Tests pre-processor management operations
+ *
+ * @throws SQLException
+ */
+ @Test(expected = IndexOutOfBoundsException.class)
+ public void connection_pre_processors_02() throws SQLException {
+ JenaConnection conn = this.getConnection();
+ Assert.assertFalse(conn.getPreProcessors().hasNext());
+
+ Echo echo = new Echo();
+
+ // Inserting at zero index should be safe
+ conn.insertPreProcessor(0, echo);
+ Assert.assertTrue(conn.getPreProcessors().hasNext());
+
+ // Inserting at some random index will cause an error
+ try {
+ conn.insertPreProcessor(50, echo);
+ } finally {
+ conn.close();
+ }
+ }
+
+ /**
+ * Tests pre-processor management operations
+ *
+ * @throws SQLException
+ */
+ @Test
+ public void connection_pre_processors_03() throws SQLException {
+ JenaConnection conn = this.getConnection();
+ Assert.assertFalse(conn.getPreProcessors().hasNext());
+
+ // Add a pre-processor
+ Echo echo = new Echo();
+ conn.addPreProcessor(echo);
+ Assert.assertTrue(conn.getPreProcessors().hasNext());
+
+ // Remove it
+ conn.removePreProcessor(echo);
+ Assert.assertFalse(conn.getPreProcessors().hasNext());
+
+ conn.close();
+ }
+
+ /**
+ * Tests pre-processor management operations
+ *
+ * @throws SQLException
+ */
+ @Test
+ public void connection_pre_processors_04() throws SQLException {
+ JenaConnection conn = this.getConnection();
+ Assert.assertFalse(conn.getPreProcessors().hasNext());
+
+ // Add a pre-processor
+ Echo echo = new Echo();
+ conn.addPreProcessor(echo);
+ Assert.assertTrue(conn.getPreProcessors().hasNext());
+
+ // Remove it
+ conn.removePreProcessor(0);
+ Assert.assertFalse(conn.getPreProcessors().hasNext());
+
+ conn.close();
+ }
+
+ /**
+ * Tests pre-processor management operations
+ *
+ * @throws SQLException
+ */
+ @Test
+ public void connection_pre_processors_05() throws SQLException {
+ JenaConnection conn = this.getConnection();
+ Assert.assertFalse(conn.getPreProcessors().hasNext());
+
+ // Add a pre-processor
+ Echo echo = new Echo();
+ conn.addPreProcessor(echo);
+ Assert.assertTrue(conn.getPreProcessors().hasNext());
+
+ // Remove all
+ conn.clearPreProcessors();
+ Assert.assertFalse(conn.getPreProcessors().hasNext());
+
+ conn.close();
+ }
+
+ /**
+ * Tests pre-processor management operations
+ *
+ * @throws SQLException
+ */
+ @Test
+ public void connection_pre_processors_06() throws SQLException {
+ JenaConnection conn = this.getConnection();
+ Assert.assertFalse(conn.getPreProcessors().hasNext());
+
+ // Add a pre-processor
+ Echo echo = new Echo();
+ conn.addPreProcessor(echo);
+ Assert.assertTrue(conn.getPreProcessors().hasNext());
+
+ // Apply the pre-processor
+ String input = "SELECT * WHERE { ?s ?p ?o }";
+ String output = conn.applyPreProcessors(input);
+ Assert.assertEquals(input, output);
+
+ conn.close();
+ }
+
+ /**
+ * Tests pre-processor management operations
+ *
+ * @throws SQLException
+ */
+ @Test
+ public void connection_pre_processors_07() throws SQLException {
+ JenaConnection conn = this.getConnection();
+ Assert.assertFalse(conn.getPreProcessors().hasNext());
+
+ // Add a pre-processor
+ Echo echo = new Echo();
+ conn.addPreProcessor(echo);
+ Assert.assertTrue(conn.getPreProcessors().hasNext());
+
+ // Apply the pre-processor
+ Query input = QueryFactory.create("SELECT * WHERE { ?s ?p ?o }");
+ Query output = conn.applyPreProcessors(input);
+ Assert.assertEquals(input, output);
+
+ conn.close();
+ }
+
+ /**
+ * Tests pre-processor management operations
+ *
+ * @throws SQLException
+ */
+ @Test
+ public void connection_pre_processors_08() throws SQLException {
+ JenaConnection conn = this.getConnection();
+ Assert.assertFalse(conn.getPreProcessors().hasNext());
+
+ // Add a pre-processor
+ Echo echo = new Echo();
+ conn.addPreProcessor(echo);
+ Assert.assertTrue(conn.getPreProcessors().hasNext());
+
+ // Apply the pre-processor
+ UpdateRequest input = UpdateFactory.create("DELETE WHERE { ?s ?p ?o }");
+ UpdateRequest output = conn.applyPreProcessors(input);
+ Assert.assertEquals(input, output);
+
+ conn.close();
+ }
+
+ /**
+ * Tests error cases trying to set invalid options
+ * @throws SQLException
+ */
+ @Test(expected=SQLFeatureNotSupportedException.class)
+ public void connection_bad_option_01() throws SQLException {
+ JenaConnection conn = this.getConnection();
+
+ try {
+ // Can't change catalog
+ conn.setCatalog("test");
+ } finally {
+ conn.close();
+ }
+ }
+
+ /**
+ * Tests error cases trying to set invalid options
+ * @throws SQLException
+ */
+ @Test(expected=SQLException.class)
+ public void connection_bad_option_02() throws SQLException {
+ JenaConnection conn = this.getConnection();
+
+ try {
+ // Invalid holdability setting
+ conn.setHoldability(-1);
+ } finally {
+ conn.close();
+ }
+ }
+
+ /**
+ * Tests error cases trying to set invalid options
+ * @throws SQLException
+ */
+ @Test(expected=SQLException.class)
+ public void connection_bad_option_03() throws SQLException {
+ JenaConnection conn = this.getConnection();
+
+ try {
+ // Invalid transaction isolation setting
+ conn.setTransactionIsolation(-1);
+ } finally {
+ conn.close();
+ }
+ }
+
+ /**
+ * Tests error cases around savepoints which are unsupported
+ * @throws SQLException
+ */
+ @Test(expected=SQLFeatureNotSupportedException.class)
+ public void connection_bad_savepoints_01() throws SQLException {
+ JenaConnection conn = this.getConnection();
+
+ try {
+ conn.setSavepoint();
+ } finally {
+ conn.close();
+ }
+ }
+
+ /**
+ * Tests error cases around savepoints which are unsupported
+ * @throws SQLException
+ */
+ @Test(expected=SQLFeatureNotSupportedException.class)
+ public void connection_bad_savepoints_02() throws SQLException {
+ JenaConnection conn = this.getConnection();
+
+ try {
+ conn.setSavepoint("test");
+ } finally {
+ conn.close();
+ }
+ }
+
+ /**
+ * Tests error cases around savepoints which are unsupported
+ * @throws SQLException
+ */
+ @Test(expected=SQLFeatureNotSupportedException.class)
+ public void connection_bad_savepoints_03() throws SQLException {
+ JenaConnection conn = this.getConnection();
+
+ try {
+ conn.rollback(null);
+ } finally {
+ conn.close();
+ }
+ }
+
+ /**
+ * Tests error cases around savepoints which are unsupported
+ * @throws SQLException
+ */
+ @Test(expected=SQLFeatureNotSupportedException.class)
+ public void connection_bad_savepoints_04() throws SQLException {
+ JenaConnection conn = this.getConnection();
+
+ try {
+ conn.releaseSavepoint(null);
+ } finally {
+ conn.close();
+ }
+ }
+
+ /**
+ * Tests error cases around type maps which are unsupported
+ * @throws SQLException
+ */
+ @Test(expected=SQLFeatureNotSupportedException.class)
+ public void connection_bad_type_map_01() throws SQLException {
+ JenaConnection conn = this.getConnection();
+
+ try {
+ conn.setTypeMap(new HashMap<String, Class<?>>());
+ } finally {
+ conn.close();
+ }
+ }
}
Modified: jena/Experimental/jena-jdbc/jena-jdbc-driver-bundle/pom.xml
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-jdbc/jena-jdbc-driver-bundle/pom.xml?rev=1490026&r1=1490025&r2=1490026&view=diff
==============================================================================
--- jena/Experimental/jena-jdbc/jena-jdbc-driver-bundle/pom.xml (original)
+++ jena/Experimental/jena-jdbc/jena-jdbc-driver-bundle/pom.xml Wed Jun 5 20:29:25 2013
@@ -84,7 +84,7 @@
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-fuseki</artifactId>
- <version>0.2.8-SNAPSHOT</version>
+ <version>0.2.7</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>