jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rve...@apache.org
Subject svn commit: r1492303 - /jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/AbstractJenaDriverTests.java
Date Wed, 12 Jun 2013 17:45:59 GMT
Author: rvesse
Date: Wed Jun 12 17:45:58 2013
New Revision: 1492303

URL: http://svn.apache.org/r1492303
Log:
Add test for using post-processor parameter

Modified:
    jena/Experimental/jena-jdbc/jena-jdbc-core/src/test/java/org/apache/jena/jdbc/AbstractJenaDriverTests.java

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=1492303&r1=1492302&r2=1492303&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 12 17:45:58 2013
@@ -23,6 +23,8 @@ import java.sql.SQLException;
 import java.util.Iterator;
 
 import org.apache.jena.jdbc.connections.JenaConnection;
+import org.apache.jena.jdbc.postprocessing.ResultsEcho;
+import org.apache.jena.jdbc.postprocessing.ResultsPostProcessor;
 import org.apache.jena.jdbc.preprocessing.CommandPreProcessor;
 import org.apache.jena.jdbc.preprocessing.Echo;
 import org.apache.log4j.BasicConfigurator;
@@ -253,6 +255,35 @@ public abstract class AbstractJenaDriver
         conn.close();
         Assert.assertTrue(conn.isClosed());
     }
+    
+    /**
+     * Tests using a driver to create a connection with its own URLs plus the standard pre-processor
and post-processor parameter
+     * 
+     * @throws SQLException
+     */
+    @Test
+    public void driver_connect_08() throws SQLException {
+        String url = this.getConnectionUrl();
+        Assume.assumeNotNull(url);
+        url = url + "&" + JenaDriver.PARAM_PRE_PROCESSOR + "=" + Echo.class.getCanonicalName();
+        url = url + "&" + JenaDriver.PARAM_POST_PROCESSOR + "=" + ResultsEcho.class.getCanonicalName();
+        JenaDriver driver = this.getDriver();
+
+        JenaConnection conn = (JenaConnection)driver.connect(url, null);
+        Assert.assertFalse(conn.isClosed());
+        Iterator<CommandPreProcessor> iter = conn.getPreProcessors();
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertTrue(iter.next() instanceof Echo);
+        Assert.assertFalse(iter.hasNext());
+        
+        Iterator<ResultsPostProcessor> iter2 = conn.getPostProcessors();
+        Assert.assertTrue(iter2.hasNext());
+        Assert.assertTrue(iter2.next() instanceof ResultsEcho);
+        Assert.assertFalse(iter2.hasNext());
+        
+        conn.close();
+        Assert.assertTrue(conn.isClosed());
+    }
         
     /**
      * Tests using a driver to create a connection with its own URLs which are known to be
bad



Mime
View raw message