Search in sources :

Example 11 with CommandPreProcessor

use of org.apache.jena.jdbc.preprocessing.CommandPreProcessor in project jena by apache.

the class AbstractJenaDriverTests method driver_connect_06.

/**
     * Tests using a driver to create a connection with its own URLs plus the
     * standard pre-processor parameter
     * 
     * @throws SQLException
     */
@Test
public void driver_connect_06() throws SQLException {
    String url = this.getConnectionUrl();
    Assume.assumeNotNull(url);
    url = url + "&" + JenaDriver.PARAM_PRE_PROCESSOR + "=" + Echo.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());
    iter.next();
    Assert.assertFalse(iter.hasNext());
    conn.close();
    Assert.assertTrue(conn.isClosed());
}
Also used : CommandPreProcessor(org.apache.jena.jdbc.preprocessing.CommandPreProcessor) JenaConnection(org.apache.jena.jdbc.connections.JenaConnection) Test(org.junit.Test)

Aggregations

JenaConnection (org.apache.jena.jdbc.connections.JenaConnection)11 CommandPreProcessor (org.apache.jena.jdbc.preprocessing.CommandPreProcessor)11 Test (org.junit.Test)10 Properties (java.util.Properties)7 ResultsEcho (org.apache.jena.jdbc.postprocessing.ResultsEcho)7 Echo (org.apache.jena.jdbc.preprocessing.Echo)7 File (java.io.File)6 FileWriter (java.io.FileWriter)5 ResultsPostProcessor (org.apache.jena.jdbc.postprocessing.ResultsPostProcessor)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 URL (java.net.URL)1 SQLException (java.sql.SQLException)1 SQLFeatureNotSupportedException (java.sql.SQLFeatureNotSupportedException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1